--- /srv/reproducible-results/rbuild-debian/r-b-build.uuoEmkis/b1/dune-istl_2.9.0-2_amd64.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.uuoEmkis/b2/dune-istl_2.9.0-2_amd64.changes ├── Files │ @@ -1,3 +1,3 @@ │ │ 4c39d7e6af03ee70996ee0a7931097bf 210184 libdevel optional libdune-istl-dev_2.9.0-2_amd64.deb │ - e2a2b12e822e50b14845f4cecf964a6d 3828572 doc optional libdune-istl-doc_2.9.0-2_all.deb │ + 3bc507f9dc6bc9f71efedefb8df3a2bc 3830932 doc optional libdune-istl-doc_2.9.0-2_all.deb ├── libdune-istl-doc_2.9.0-2_all.deb │ ├── file list │ │ @@ -1,3 +1,3 @@ │ │ -rw-r--r-- 0 0 0 4 2023-01-12 16:57:44.000000 debian-binary │ │ --rw-r--r-- 0 0 0 26836 2023-01-12 16:57:44.000000 control.tar.xz │ │ --rw-r--r-- 0 0 0 3801544 2023-01-12 16:57:44.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 26880 2023-01-12 16:57:44.000000 control.tar.xz │ │ +-rw-r--r-- 0 0 0 3803860 2023-01-12 16:57:44.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ ├── data.tar.xz │ │ ├── data.tar │ │ │ ├── file list │ │ │ │ @@ -5,162 +5,162 @@ │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 854 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/changelog.Debian.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3688 2022-10-20 18:22:18.000000 ./usr/share/doc/libdune-istl-doc/changelog.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3254 2023-01-12 15:07:31.000000 ./usr/share/doc/libdune-istl-doc/copyright │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3041 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00002.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3039 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00005.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7150 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 58273 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13276 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 300759 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8602 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 40910 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9765 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 132844 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7564 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 142750 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5597 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 44694 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9765 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 42295 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9273 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 122293 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13397 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 185807 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7084 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14008 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4922 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14276 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33564 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 145690 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4785 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14866 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7796 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 34254 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 44339 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 253737 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8727 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 34366 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12157 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21373 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9225 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 74488 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10170 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12125 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7778 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17437 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8610 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 79459 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8585 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 75169 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5570 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 36127 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3364 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 58162 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13203 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 131101 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19506 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 312867 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6811 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 74451 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4950 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9481 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4706 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22955 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8771 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 68876 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9508 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 87692 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8901 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 47367 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5186 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22059 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 18719 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 208523 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5437 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14295 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6665 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 52582 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10970 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 187347 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7901 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 66465 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15753 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 410562 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5870 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20990 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6403 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 65781 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9428 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 238441 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6348 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17314 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8180 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 122236 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7691 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 220462 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13397 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 185807 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15320 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 151385 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4706 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22955 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6811 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 74451 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9765 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 132844 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10514 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 147916 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4544 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 53931 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5597 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 44694 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33564 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 145690 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8610 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 79459 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6568 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 34046 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7084 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14008 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7778 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17437 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10170 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12125 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8891 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 412251 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19506 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 312867 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17510 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 315503 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5570 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 36127 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8585 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 75169 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7796 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 34254 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4785 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14866 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4950 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9481 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9273 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 122293 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 44339 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 253737 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16830 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 48381 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7150 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 58273 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12195 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 79104 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8602 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 40910 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13203 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 131101 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4555 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 55816 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13276 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 300759 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7679 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 61431 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6799 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11407 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12508 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 121274 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3364 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 58162 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6351 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 134026 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6403 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 65781 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8180 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 122236 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9429 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 133063 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5437 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14295 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7901 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 66465 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6562 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 69285 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5186 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22059 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5397 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 29692 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5679 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 30672 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9429 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 133063 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13573 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 345513 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6562 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 69285 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7254 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 75348 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7520 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 98130 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4679 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 24711 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5446 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 165179 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5930 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 162672 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4385 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 18371 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12508 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 121274 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7679 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 61431 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8891 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 412251 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10065 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 107941 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6351 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 134026 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12195 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 79104 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6499 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 44115 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6044 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 114981 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16830 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 48381 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17510 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 315503 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17812 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 125151 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7691 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 220462 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9168 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 126666 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4544 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 53931 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6799 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11407 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15320 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 151385 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4555 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 55816 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6568 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 34046 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10514 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 147916 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7520 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 98130 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15753 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 410562 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5870 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20990 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8771 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 68876 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10970 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 187347 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7254 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 75348 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8901 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 47367 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13573 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 345513 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9428 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 238441 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 18719 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 208523 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5679 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 30672 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6348 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17314 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6665 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 52582 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9508 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 87692 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4385 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 18371 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17812 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 125151 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9168 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 126666 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4679 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 24711 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8727 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 34366 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10065 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 107941 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9765 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 42295 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5446 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 165179 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5930 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 162672 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6044 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 114981 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9225 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 74488 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12157 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21373 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7564 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 142750 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6499 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 44115 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4922 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14276 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5517 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3416 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00231.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3725 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00232.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 274514 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00233.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 23094 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00233.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 32149 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00234.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 19073 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00234.png │ │ │ │ @@ -1086,15 +1086,15 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 8035 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e12c67a8fe12cf8b78c94f3b4cb9926_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 4247 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e69be5995c9f5d42bf491ae6f29600e.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1620 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e69be5995c9f5d42bf491ae6f29600e_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 14065 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_667edbdb0a8210232217f5e7df6d52d4.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1878 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_667edbdb0a8210232217f5e7df6d52d4_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3665 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_e68e8157741866f444e17edd764ebbae.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 45631 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/doxygen.css │ │ │ │ --rw-r--r-- 0 root (0) root (0) 175714 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dune-istl.tag.gz │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 175723 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dune-istl.tag.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7704 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dynsections.js │ │ │ │ -rw-r--r-- 0 root (0) root (0) 28998 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/files.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 549 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_0.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 572 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_0_dark.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 531 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_1.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 860 2023-01-12 16:57:44.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_10.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 909 2023-01-12 16:57:44.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: schwarz.hh File Reference │ │ │ │ +dune-istl: matrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,56 +72,58 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
schwarz.hh File Reference
│ │ │ │ +
matrix.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#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"
│ │ │ │ + │ │ │ │ +

A dynamic dense block matrix class. │ │ │ │ +More...

│ │ │ │ +
#include <cmath>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <dune/common/ftraits.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include <dune/istl/bvector.hh>
│ │ │ │ +#include <dune/istl/istlexception.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::OverlappingSchwarzOperator< M, X, Y, C >
 An overlapping Schwarz operator. More...
class  Dune::MatrixImp::DenseMatrixBase< B, A >
 A Vector of blocks with different blocksizes. More...
 
class  Dune::MatrixImp::DenseMatrixBase< B, A >::Iterator
 Iterator class for sequential access. More...
 
class  Dune::MatrixImp::DenseMatrixBase< B, A >::ConstIterator
 ConstIterator class for sequential access. More...
 
class  Dune::ParSSOR< M, X, Y, C >
 A parallel SSOR preconditioner. More...
class  Dune::Matrix< T, A >
 A generic dynamic dense matrix. More...
 
class  Dune::BlockPreconditioner< X, Y, C, P >
 Block parallel preconditioner. More...
struct  Dune::FieldTraits< Matrix< T, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ +

A dynamic dense block matrix class.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,43 +1,43 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ +matrix.hh File Reference │ │ │ │ │ +A dynamic dense block matrix class. _M_o_r_e_._._. │ │ │ │ │ #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" │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#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_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._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_:_:_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_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_ _B_,_ _A_ _> │ │ │ │ │ +  A Vector of blocks with different blocksizes. _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_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_ _B_,_ _A_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +  _I_t_e_r_a_t_o_r class for sequential access. _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_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_ _B_,_ _A_ _>_:_:_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 class for sequential access. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_a_t_r_i_x_<_ _T_,_ _A_ _> │ │ │ │ │ +  A generic dynamic dense matrix. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _> │ │ │ │ │   │ │ │ │ │ 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_I_m_p │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +A dynamic dense block matrix class. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: schwarz.hh Source File │ │ │ │ +dune-istl: matrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,302 +74,1258 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
schwarz.hh
│ │ │ │ +
matrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ISTL_MATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_MATRIX_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
│ │ │ │ +
12#include <cmath>
│ │ │ │ +
13#include <memory>
│ │ │ │
14
│ │ │ │ -
15#include <dune/common/timer.hh>
│ │ │ │ -
16
│ │ │ │ -
17#include "io.hh"
│ │ │ │ -
18#include "bvector.hh"
│ │ │ │ -
19#include "vbvector.hh"
│ │ │ │ -
20#include "bcrsmatrix.hh"
│ │ │ │ -
21#include "io.hh"
│ │ │ │ -
22#include "gsetc.hh"
│ │ │ │ -
23#include "ilu.hh"
│ │ │ │ -
24#include "operators.hh"
│ │ │ │ -
25#include "solvers.hh"
│ │ │ │ -
26#include "preconditioners.hh"
│ │ │ │ -
27#include "scalarproducts.hh"
│ │ │ │ -
28#include "owneroverlapcopy.hh"
│ │ │ │ -
29
│ │ │ │ -
30namespace Dune {
│ │ │ │ -
31
│ │ │ │ -
73 template<class M, class X, class Y, class C>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
75 {
│ │ │ │ -
76 public:
│ │ │ │ -
81 typedef M matrix_type;
│ │ │ │ -
86 typedef X domain_type;
│ │ │ │ -
91 typedef Y range_type;
│ │ │ │ -
93 typedef typename X::field_type field_type;
│ │ │ │ - │ │ │ │ -
99
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
108 : _A_(stackobject_to_shared_ptr(A)), communication(com)
│ │ │ │ -
109 {}
│ │ │ │ -
│ │ │ │ +
15#include <dune/common/ftraits.hh>
│ │ │ │ +
16#include <dune/common/typetraits.hh>
│ │ │ │ +
17#include <dune/common/scalarvectorview.hh>
│ │ │ │ +
18#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +
19
│ │ │ │ +
20#include <dune/istl/bvector.hh>
│ │ │ │ + │ │ │ │ + │ │ │ │ +
23
│ │ │ │ +
24namespace Dune {
│ │ │ │ +
25
│ │ │ │ +
│ │ │ │ +
26namespace MatrixImp
│ │ │ │ +
27{
│ │ │ │ +
39 template<class B, class A=std::allocator<B> >
│ │ │ │ +
│ │ │ │ +
40 class DenseMatrixBase : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ +
41 // this derivation gives us all the blas level 1 and norms
│ │ │ │ +
42 // on the large array. However, access operators have to be
│ │ │ │ +
43 // overwritten.
│ │ │ │ +
44 {
│ │ │ │ +
45 public:
│ │ │ │ +
46
│ │ │ │ +
47 //===== type definitions and constants
│ │ │ │ +
48
│ │ │ │ +
50 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
51
│ │ │ │ +
53 typedef A allocator_type;
│ │ │ │ +
54
│ │ │ │ +
56 typedef typename A::size_type size_type;
│ │ │ │ +
57
│ │ │ │ + │ │ │ │ +
64
│ │ │ │ + │ │ │ │ +
68
│ │ │ │ +
69 // just a shorthand
│ │ │ │ +
70 typedef Imp::BlockVectorWindow<B,A> window_type;
│ │ │ │ +
71
│ │ │ │ + │ │ │ │ +
73
│ │ │ │ + │ │ │ │ +
75
│ │ │ │ +
76
│ │ │ │ +
77 //===== constructors and such
│ │ │ │ +
78
│ │ │ │ +
│ │ │ │ +
82 DenseMatrixBase () : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ +
83 {
│ │ │ │ +
84 // nothing is known ...
│ │ │ │ +
85 rows_ = 0;
│ │ │ │ +
86 columns_ = 0;
│ │ │ │ +
87 }
│ │ │ │ +
│ │ │ │ +
88
│ │ │ │ +
│ │ │ │ +
95 DenseMatrixBase (size_type rows, size_type columns) : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ +
96 {
│ │ │ │ +
97 // and we can allocate the big array in the base class
│ │ │ │ +
98 this->n = rows*columns;
│ │ │ │ +
99 columns_ = columns;
│ │ │ │ +
100 if (this->n>0)
│ │ │ │ +
101 {
│ │ │ │ +
102 this->p = allocator_.allocate(this->n);
│ │ │ │ +
103 new (this->p)B[this->n];
│ │ │ │ +
104 }
│ │ │ │ +
105 else
│ │ │ │ +
106 {
│ │ │ │ +
107 this->n = 0;
│ │ │ │ +
108 this->p = 0;
│ │ │ │ +
109 }
│ │ │ │
110
│ │ │ │ -
│ │ │ │ -
111 OverlappingSchwarzOperator (const std::shared_ptr<matrix_type> A, const communication_type& com)
│ │ │ │ -
112 : _A_(A), communication(com)
│ │ │ │ -
113 {}
│ │ │ │ +
111 // we can allocate the windows now
│ │ │ │ +
112 rows_ = rows;
│ │ │ │ +
113 }
│ │ │ │
│ │ │ │
114
│ │ │ │
│ │ │ │ -
116 virtual void apply (const X& x, Y& y) const
│ │ │ │ -
117 {
│ │ │ │ -
118 y = 0;
│ │ │ │ -
119 _A_->umv(x,y); // result is consistent on interior+border
│ │ │ │ -
120 communication.project(y); // we want this here to avoid it before the preconditioner
│ │ │ │ -
121 // since there d is const!
│ │ │ │ -
122 }
│ │ │ │ -
│ │ │ │ -
123
│ │ │ │ -
│ │ │ │ -
125 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
│ │ │ │ -
126 {
│ │ │ │ -
127 _A_->usmv(alpha,x,y); // result is consistent on interior+border
│ │ │ │ -
128 communication.project(y); // we want this here to avoid it before the preconditioner
│ │ │ │ -
129 // since there d is const!
│ │ │ │ -
130 }
│ │ │ │ -
│ │ │ │ -
131
│ │ │ │ -
│ │ │ │ -
133 virtual const matrix_type& getmat () const
│ │ │ │ -
134 {
│ │ │ │ -
135 return *_A_;
│ │ │ │ -
136 }
│ │ │ │ -
│ │ │ │ -
137
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
140 {
│ │ │ │ - │ │ │ │ -
142 }
│ │ │ │ -
│ │ │ │ -
143
│ │ │ │ -
144
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
147 {
│ │ │ │ -
148 return communication;
│ │ │ │ -
149 }
│ │ │ │ -
│ │ │ │ -
150 private:
│ │ │ │ -
151 const std::shared_ptr<const matrix_type>_A_;
│ │ │ │ -
152 const communication_type& communication;
│ │ │ │ -
153 };
│ │ │ │ -
│ │ │ │ -
154
│ │ │ │ -
157 /*
│ │ │ │ -
158 * @addtogroup ISTL_Prec
│ │ │ │ -
159 * @{
│ │ │ │ -
160 */
│ │ │ │ -
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;
│ │ │ │ - │ │ │ │ -
187
│ │ │ │ -
│ │ │ │ -
197 ParSSOR (const matrix_type& A, int n, field_type w, const communication_type& c)
│ │ │ │ -
198 : _A_(A), _n(n), _w(w), communication(c)
│ │ │ │ -
199 { }
│ │ │ │ -
│ │ │ │ -
200
│ │ │ │ -
│ │ │ │ -
206 virtual void pre (X& x, [[maybe_unused]] Y& b)
│ │ │ │ -
207 {
│ │ │ │ -
208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ │ -
209 }
│ │ │ │ -
│ │ │ │ -
210
│ │ │ │ -
│ │ │ │ -
216 virtual void apply (X& v, const Y& d)
│ │ │ │ -
217 {
│ │ │ │ -
218 for (int i=0; i<_n; i++) {
│ │ │ │ -
219 bsorf(_A_,v,d,_w);
│ │ │ │ -
220 bsorb(_A_,v,d,_w);
│ │ │ │ -
221 }
│ │ │ │ -
222 communication.copyOwnerToAll(v,v);
│ │ │ │ + │ │ │ │ +
117 {
│ │ │ │ +
118 // allocate the big array in the base class
│ │ │ │ +
119 this->n = a.n;
│ │ │ │ +
120 columns_ = a.columns_;
│ │ │ │ +
121 if (this->n>0)
│ │ │ │ +
122 {
│ │ │ │ +
123 // allocate and construct objects
│ │ │ │ +
124 this->p = allocator_.allocate(this->n);
│ │ │ │ +
125 new (this->p)B[this->n];
│ │ │ │ +
126
│ │ │ │ +
127 // copy data
│ │ │ │ +
128 for (size_type i=0; i<this->n; i++)
│ │ │ │ +
129 this->p[i]=a.p[i];
│ │ │ │ +
130 }
│ │ │ │ +
131 else
│ │ │ │ +
132 {
│ │ │ │ +
133 this->n = 0;
│ │ │ │ +
134 this->p = nullptr;
│ │ │ │ +
135 }
│ │ │ │ +
136
│ │ │ │ +
137 // we can allocate the windows now
│ │ │ │ +
138 rows_ = a.rows_;
│ │ │ │ +
139 }
│ │ │ │ +
│ │ │ │ +
140
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
143 {
│ │ │ │ +
144 if (this->n>0) {
│ │ │ │ +
145 size_type i=this->n;
│ │ │ │ +
146 while (i)
│ │ │ │ +
147 this->p[--i].~B();
│ │ │ │ +
148 allocator_.deallocate(this->p,this->n);
│ │ │ │ +
149 }
│ │ │ │ +
150 }
│ │ │ │ +
│ │ │ │ +
151
│ │ │ │ +
│ │ │ │ +
153 void resize (size_type rows, size_type columns)
│ │ │ │ +
154 {
│ │ │ │ +
155 // deconstruct objects and deallocate memory if necessary
│ │ │ │ +
156 if (this->n>0) {
│ │ │ │ +
157 size_type i=this->n;
│ │ │ │ +
158 while (i)
│ │ │ │ +
159 this->p[--i].~B();
│ │ │ │ +
160 allocator_.deallocate(this->p,this->n);
│ │ │ │ +
161 }
│ │ │ │ +
162
│ │ │ │ +
163 // and we can allocate the big array in the base class
│ │ │ │ +
164 this->n = rows*columns;
│ │ │ │ +
165 if (this->n>0)
│ │ │ │ +
166 {
│ │ │ │ +
167 this->p = allocator_.allocate(this->n);
│ │ │ │ +
168 new (this->p)B[this->n];
│ │ │ │ +
169 }
│ │ │ │ +
170 else
│ │ │ │ +
171 {
│ │ │ │ +
172 this->n = 0;
│ │ │ │ +
173 this->p = nullptr;
│ │ │ │ +
174 }
│ │ │ │ +
175
│ │ │ │ +
176 // we can allocate the windows now
│ │ │ │ +
177 rows_ = rows;
│ │ │ │ +
178 columns_ = columns;
│ │ │ │ +
179 }
│ │ │ │ +
│ │ │ │ +
180
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
183 {
│ │ │ │ +
184 if (&a!=this) // check if this and a are different objects
│ │ │ │ +
185 {
│ │ │ │ +
186 columns_ = a.columns_;
│ │ │ │ +
187 // reallocate arrays if necessary
│ │ │ │ +
188 // Note: still the block sizes may vary !
│ │ │ │ +
189 if (this->n!=a.n || rows_!=a.rows_)
│ │ │ │ +
190 {
│ │ │ │ +
191 // deconstruct objects and deallocate memory if necessary
│ │ │ │ +
192 if (this->n>0) {
│ │ │ │ +
193 size_type i=this->n;
│ │ │ │ +
194 while (i)
│ │ │ │ +
195 this->p[--i].~B();
│ │ │ │ +
196 allocator_.deallocate(this->p,this->n);
│ │ │ │ +
197 }
│ │ │ │ +
198
│ │ │ │ +
199 // allocate the big array in the base class
│ │ │ │ +
200 this->n = a.n;
│ │ │ │ +
201 if (this->n>0)
│ │ │ │ +
202 {
│ │ │ │ +
203 // allocate and construct objects
│ │ │ │ +
204 this->p = allocator_.allocate(this->n);
│ │ │ │ +
205 new (this->p)B[this->n];
│ │ │ │ +
206 }
│ │ │ │ +
207 else
│ │ │ │ +
208 {
│ │ │ │ +
209 this->n = 0;
│ │ │ │ +
210 this->p = nullptr;
│ │ │ │ +
211 }
│ │ │ │ +
212
│ │ │ │ +
213 // Copy number of rows
│ │ │ │ +
214 rows_ = a.rows_;
│ │ │ │ +
215 }
│ │ │ │ +
216
│ │ │ │ +
217 // and copy the data
│ │ │ │ +
218 for (size_type i=0; i<this->n; i++)
│ │ │ │ +
219 this->p[i]=a.p[i];
│ │ │ │ +
220 }
│ │ │ │ +
221
│ │ │ │ +
222 return *this;
│ │ │ │
223 }
│ │ │ │
│ │ │ │
224
│ │ │ │ -
230 virtual void post ([[maybe_unused]] X& x) {}
│ │ │ │ -
231
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
234 {
│ │ │ │ - │ │ │ │ -
236 }
│ │ │ │ -
│ │ │ │ -
237
│ │ │ │ -
238 private:
│ │ │ │ -
240 const matrix_type& _A_;
│ │ │ │ -
242 int _n;
│ │ │ │ -
244 field_type _w;
│ │ │ │ -
246 const communication_type& communication;
│ │ │ │ -
247 };
│ │ │ │ +
225
│ │ │ │ +
226 //===== assignment from scalar
│ │ │ │ +
227
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
230 {
│ │ │ │ +
231 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ +
232 return *this;
│ │ │ │ +
233 }
│ │ │ │ +
│ │ │ │ +
234
│ │ │ │ +
235
│ │ │ │ +
236 //===== access to components
│ │ │ │ +
237 // has to be overwritten from base class because it must
│ │ │ │ +
238 // return access to the windows
│ │ │ │ +
239
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
242 {
│ │ │ │ +
243#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
244 if (i>=rows_) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
245#endif
│ │ │ │ +
246 return window_type(this->p + i*columns_, columns_);
│ │ │ │ +
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;
│ │ │ │ - │ │ │ │ +
│ │ │ │ + │ │ │ │ +
251 {
│ │ │ │ +
252#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
253 if (i<0 || i>=rows_) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
254#endif
│ │ │ │ +
255 return window_type(this->p + i*columns_, columns_);
│ │ │ │ +
256 }
│ │ │ │ +
│ │ │ │ +
257
│ │ │ │ +
258 // forward declaration
│ │ │ │ +
259 class ConstIterator;
│ │ │ │ +
260
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
263 {
│ │ │ │ +
264 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
267 : window_(nullptr,0)
│ │ │ │ +
268 {
│ │ │ │ +
269 i = 0;
│ │ │ │ +
270 }
│ │ │ │ +
│ │ │ │ +
271
│ │ │ │ +
272 Iterator (Iterator& other) = default;
│ │ │ │ +
273 Iterator (Iterator&& other) = default;
│ │ │ │ +
274
│ │ │ │ +
│ │ │ │ +
276 Iterator (B* data, size_type columns, size_type _i)
│ │ │ │ +
277 : i(_i),
│ │ │ │ +
278 window_(data + _i*columns, columns)
│ │ │ │ +
279 {}
│ │ │ │ +
│ │ │ │ +
280
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
283 {
│ │ │ │ +
284 i = other.i;
│ │ │ │ +
285 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ +
286 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ +
287 return *this;
│ │ │ │ +
288 }
│ │ │ │ +
│ │ │ │ +
289
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
292 {
│ │ │ │ +
293 i = other.i;
│ │ │ │ +
294 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ +
295 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ +
296 return *this;
│ │ │ │ +
297 }
│ │ │ │ +
│ │ │ │
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 { }
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
301 {
│ │ │ │ +
302 ++i;
│ │ │ │ +
303 window_.setptr(window_.getptr()+window_.getsize());
│ │ │ │ +
304 return *this;
│ │ │ │ +
305 }
│ │ │ │ +
│ │ │ │ +
306
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
309 {
│ │ │ │ +
310 --i;
│ │ │ │ +
311 window_.setptr(window_.getptr()-window_.getsize());
│ │ │ │ +
312 return *this;
│ │ │ │ +
313 }
│ │ │ │ +
│ │ │ │ +
314
│ │ │ │ +
│ │ │ │ +
316 bool operator== (const Iterator& it) const
│ │ │ │ +
317 {
│ │ │ │ +
318 return window_.getptr() == it.window_.getptr();
│ │ │ │ +
319 }
│ │ │ │
│ │ │ │
320
│ │ │ │ -
│ │ │ │ -
326 virtual void pre (X& x, Y& b)
│ │ │ │ -
327 {
│ │ │ │ -
328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ │ -
329 _preconditioner->pre(x,b);
│ │ │ │ -
330 }
│ │ │ │ -
│ │ │ │ -
331
│ │ │ │ -
│ │ │ │ -
337 virtual void apply (X& v, const Y& d)
│ │ │ │ -
338 {
│ │ │ │ -
339 _preconditioner->apply(v,d);
│ │ │ │ -
340 _communication.copyOwnerToAll(v,v);
│ │ │ │ -
341 }
│ │ │ │ -
│ │ │ │ -
342
│ │ │ │ -
343 template<bool forward>
│ │ │ │ -
│ │ │ │ -
344 void apply (X& v, const Y& d)
│ │ │ │ -
345 {
│ │ │ │ -
346 _preconditioner->template apply<forward>(v,d);
│ │ │ │ -
347 _communication.copyOwnerToAll(v,v);
│ │ │ │ -
348 }
│ │ │ │ -
│ │ │ │ -
349
│ │ │ │ -
│ │ │ │ -
355 virtual void post (X& x)
│ │ │ │ -
356 {
│ │ │ │ -
357 _preconditioner->post(x);
│ │ │ │ -
358 }
│ │ │ │ -
│ │ │ │ -
359
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
362 {
│ │ │ │ - │ │ │ │ -
364 }
│ │ │ │ -
│ │ │ │ -
365
│ │ │ │ -
366 private:
│ │ │ │ -
368 std::shared_ptr<P> _preconditioner;
│ │ │ │ -
369
│ │ │ │ -
371 const communication_type& _communication;
│ │ │ │ -
372 };
│ │ │ │ +
│ │ │ │ +
322 bool operator!= (const Iterator& it) const
│ │ │ │ +
323 {
│ │ │ │ +
324 return window_.getptr() != it.window_.getptr();
│ │ │ │ +
325 }
│ │ │ │ +
│ │ │ │ +
326
│ │ │ │ +
│ │ │ │ +
328 bool operator== (const ConstIterator& it) const
│ │ │ │ +
329 {
│ │ │ │ +
330 return window_.getptr() == it.window_.getptr();
│ │ │ │ +
331 }
│ │ │ │ +
│ │ │ │ +
332
│ │ │ │ +
│ │ │ │ +
334 bool operator!= (const ConstIterator& it) const
│ │ │ │ +
335 {
│ │ │ │ +
336 return window_.getptr() != it.window_.getptr();
│ │ │ │ +
337 }
│ │ │ │ +
│ │ │ │ +
338
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
341 {
│ │ │ │ +
342 return window_;
│ │ │ │ +
343 }
│ │ │ │ +
│ │ │ │ +
344
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
347 {
│ │ │ │ +
348 return &window_;
│ │ │ │ +
349 }
│ │ │ │ +
│ │ │ │ +
350
│ │ │ │ +
351 // return index corresponding to pointer
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
353 {
│ │ │ │ +
354 return i;
│ │ │ │ +
355 }
│ │ │ │ +
│ │ │ │ +
356
│ │ │ │ +
357 friend class ConstIterator;
│ │ │ │ +
358
│ │ │ │ +
359 private:
│ │ │ │ +
360 size_type i;
│ │ │ │ +
361 mutable window_type window_;
│ │ │ │ +
362 };
│ │ │ │ +
│ │ │ │ +
363
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
366 {
│ │ │ │ +
367 return Iterator(this->p, columns_, 0);
│ │ │ │ +
368 }
│ │ │ │
│ │ │ │ -
373
│ │ │ │ -
376} // end namespace
│ │ │ │ -
377
│ │ │ │ -
378#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 base class for scalar product and norm.
│ │ │ │ -
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ - │ │ │ │ -
The incomplete LU factorization kernels.
│ │ │ │ -
Implementations of the inverse operator interface.
│ │ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ -
Define general preconditioner interface.
│ │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ -
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
│ │ │ │ +
369
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
372 {
│ │ │ │ +
373 return Iterator(this->p, columns_, rows_);
│ │ │ │ +
374 }
│ │ │ │ +
│ │ │ │ +
375
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
379 {
│ │ │ │ +
380 return Iterator(this->p, columns_, rows_-1);
│ │ │ │ +
381 }
│ │ │ │ +
│ │ │ │ +
382
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
386 {
│ │ │ │ +
387 return Iterator(this->p, columns_, -1);
│ │ │ │ +
388 }
│ │ │ │ +
│ │ │ │ +
389
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
392 {
│ │ │ │ +
393 return Iterator(this->p, columns_, std::min(i,rows_));
│ │ │ │ +
394 }
│ │ │ │ +
│ │ │ │ +
395
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
398 {
│ │ │ │ +
399 return ConstIterator(this->p, columns_, std::min(i,rows_));
│ │ │ │ +
400 }
│ │ │ │ +
│ │ │ │ +
401
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
404 {
│ │ │ │ +
405 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
408 : window_(nullptr,0)
│ │ │ │ +
409 {
│ │ │ │ +
410 i = 0;
│ │ │ │ +
411 }
│ │ │ │ +
│ │ │ │ +
412
│ │ │ │ +
│ │ │ │ +
414 ConstIterator (const B* data, size_type columns, size_type _i)
│ │ │ │ +
415 : i(_i),
│ │ │ │ +
416 window_(const_cast<B*>(data + _i * columns), columns)
│ │ │ │ +
417 {}
│ │ │ │ +
│ │ │ │ +
418
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
421 : i(it.i), window_(it.window_.getptr(),it.window_.getsize())
│ │ │ │ +
422 {}
│ │ │ │ +
│ │ │ │ +
423
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
425 {
│ │ │ │ +
426 i = other.i;
│ │ │ │ +
427 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ +
428 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ +
429 return *this;
│ │ │ │ +
430 }
│ │ │ │ +
│ │ │ │ +
431
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
433 {
│ │ │ │ +
434 i = other.i;
│ │ │ │ +
435 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ +
436 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ +
437 return *this;
│ │ │ │ +
438 }
│ │ │ │ +
│ │ │ │ +
439
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
442 {
│ │ │ │ +
443 ++i;
│ │ │ │ +
444 window_.setptr(window_.getptr()+window_.getsize());
│ │ │ │ +
445 return *this;
│ │ │ │ +
446 }
│ │ │ │ +
│ │ │ │ +
447
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
450 {
│ │ │ │ +
451 --i;
│ │ │ │ +
452 window_.setptr(window_.getptr()-window_.getsize());
│ │ │ │ +
453 return *this;
│ │ │ │ +
454 }
│ │ │ │ +
│ │ │ │ +
455
│ │ │ │ +
│ │ │ │ +
457 bool operator== (const ConstIterator& it) const
│ │ │ │ +
458 {
│ │ │ │ +
459 return window_.getptr() == it.window_.getptr();
│ │ │ │ +
460 }
│ │ │ │ +
│ │ │ │ +
461
│ │ │ │ +
│ │ │ │ +
463 bool operator!= (const ConstIterator& it) const
│ │ │ │ +
464 {
│ │ │ │ +
465 return window_.getptr() != it.window_.getptr();
│ │ │ │ +
466 }
│ │ │ │ +
│ │ │ │ +
467
│ │ │ │ +
│ │ │ │ +
469 bool operator== (const Iterator& it) const
│ │ │ │ +
470 {
│ │ │ │ +
471 return window_.getptr() == it.window_.getptr();
│ │ │ │ +
472 }
│ │ │ │ +
│ │ │ │ +
473
│ │ │ │ +
│ │ │ │ +
475 bool operator!= (const Iterator& it) const
│ │ │ │ +
476 {
│ │ │ │ +
477 return window_.getptr() != it.window_.getptr();
│ │ │ │ +
478 }
│ │ │ │ +
│ │ │ │ +
479
│ │ │ │ +
│ │ │ │ +
481 const window_type& operator* () const
│ │ │ │ +
482 {
│ │ │ │ +
483 return window_;
│ │ │ │ +
484 }
│ │ │ │ +
│ │ │ │ +
485
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
488 {
│ │ │ │ +
489 return &window_;
│ │ │ │ +
490 }
│ │ │ │ +
│ │ │ │ +
491
│ │ │ │ +
492 // return index corresponding to pointer
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
494 {
│ │ │ │ +
495 return i;
│ │ │ │ +
496 }
│ │ │ │ +
│ │ │ │ +
497
│ │ │ │ +
498 friend class Iterator;
│ │ │ │ +
499
│ │ │ │ +
500 private:
│ │ │ │ +
501 size_type i;
│ │ │ │ +
502 mutable window_type window_;
│ │ │ │ +
503 };
│ │ │ │ +
│ │ │ │ +
504
│ │ │ │ + │ │ │ │ +
507
│ │ │ │ + │ │ │ │ +
510
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
513 {
│ │ │ │ +
514 return ConstIterator(this->p, columns_, 0);
│ │ │ │ +
515 }
│ │ │ │ +
│ │ │ │ +
516
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
519 {
│ │ │ │ +
520 return ConstIterator(this->p, columns_, rows_);
│ │ │ │ +
521 }
│ │ │ │ +
│ │ │ │ +
522
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
526 {
│ │ │ │ +
527 return ConstIterator(this->p, columns_, rows_-1);
│ │ │ │ +
528 }
│ │ │ │ +
│ │ │ │ +
529
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
532 {
│ │ │ │ +
533 return ConstIterator(this->p, columns_, -1);
│ │ │ │ +
534 }
│ │ │ │ +
│ │ │ │ +
535
│ │ │ │ +
536 //===== sizes
│ │ │ │ +
537
│ │ │ │ +
│ │ │ │ +
539 size_type N () const
│ │ │ │ +
540 {
│ │ │ │ +
541 return rows_;
│ │ │ │ +
542 }
│ │ │ │ +
│ │ │ │ +
543
│ │ │ │ +
544
│ │ │ │ +
545 private:
│ │ │ │ +
546 size_type rows_; // number of matrix rows
│ │ │ │ +
547 size_type columns_; // number of matrix columns
│ │ │ │ +
548
│ │ │ │ +
549 A allocator_;
│ │ │ │ +
550 };
│ │ │ │ +
│ │ │ │ +
551
│ │ │ │ +
552} // namespace MatrixImp
│ │ │ │ +
│ │ │ │ +
553
│ │ │ │ +
559 template<class T, class A=std::allocator<T> >
│ │ │ │ +
│ │ │ │ +
560 class Matrix
│ │ │ │ +
561 {
│ │ │ │ +
562 public:
│ │ │ │ +
563
│ │ │ │ +
565 using field_type = typename Imp::BlockTraits<T>::field_type;
│ │ │ │ +
566
│ │ │ │ +
568 typedef T block_type;
│ │ │ │ +
569
│ │ │ │ +
571 typedef A allocator_type;
│ │ │ │ +
572
│ │ │ │ + │ │ │ │ +
575
│ │ │ │ +
577 typedef typename A::size_type size_type;
│ │ │ │ +
578
│ │ │ │ + │ │ │ │ +
581
│ │ │ │ +
583 typedef typename row_type::iterator ColIterator;
│ │ │ │ +
584
│ │ │ │ + │ │ │ │ +
587
│ │ │ │ +
589 typedef typename row_type::const_iterator ConstColIterator;
│ │ │ │ +
590
│ │ │ │ +
592 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
593 static constexpr auto blocklevel = blockLevel<T>()+1;
│ │ │ │ +
594
│ │ │ │ +
│ │ │ │ +
596 Matrix() : data_(0,0), cols_(0)
│ │ │ │ +
597 {}
│ │ │ │ +
│ │ │ │ +
598
│ │ │ │ +
│ │ │ │ +
601 Matrix(size_type rows, size_type cols) : data_(rows,cols), cols_(cols)
│ │ │ │ +
602 {}
│ │ │ │ +
│ │ │ │ +
603
│ │ │ │ +
│ │ │ │ +
608 void setSize(size_type rows, size_type cols) {
│ │ │ │ +
609 data_.resize(rows,cols);
│ │ │ │ +
610 cols_ = cols;
│ │ │ │ +
611 }
│ │ │ │ +
│ │ │ │ +
612
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
615 {
│ │ │ │ +
616 return data_.begin();
│ │ │ │ +
617 }
│ │ │ │ +
│ │ │ │ +
618
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
621 {
│ │ │ │ +
622 return data_.end();
│ │ │ │ +
623 }
│ │ │ │ +
│ │ │ │ +
624
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
628 {
│ │ │ │ +
629 return data_.beforeEnd();
│ │ │ │ +
630 }
│ │ │ │ +
│ │ │ │ +
631
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
635 {
│ │ │ │ +
636 return data_.beforeBegin();
│ │ │ │ +
637 }
│ │ │ │ +
│ │ │ │ +
638
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
641 {
│ │ │ │ +
642 return data_.begin();
│ │ │ │ +
643 }
│ │ │ │ +
│ │ │ │ +
644
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
647 {
│ │ │ │ +
648 return data_.end();
│ │ │ │ +
649 }
│ │ │ │ +
│ │ │ │ +
650
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
654 {
│ │ │ │ +
655 return data_.beforeEnd();
│ │ │ │ +
656 }
│ │ │ │ +
│ │ │ │ +
657
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
661 {
│ │ │ │ +
662 return data_.beforeBegin();
│ │ │ │ +
663 }
│ │ │ │ +
│ │ │ │ +
664
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
667 {
│ │ │ │ +
668 data_ = t;
│ │ │ │ +
669 return *this;
│ │ │ │ +
670 }
│ │ │ │ +
│ │ │ │ +
671
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
674#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
675 if (row<0)
│ │ │ │ +
676 DUNE_THROW(ISTLError, "Can't access negative rows!");
│ │ │ │ +
677 if (row>=N())
│ │ │ │ +
678 DUNE_THROW(ISTLError, "Row index out of range!");
│ │ │ │ +
679#endif
│ │ │ │ +
680 return data_[row];
│ │ │ │ +
681 }
│ │ │ │ +
│ │ │ │ +
682
│ │ │ │ +
│ │ │ │ +
684 const row_type operator[](size_type row) const {
│ │ │ │ +
685#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
686 if (row<0)
│ │ │ │ +
687 DUNE_THROW(ISTLError, "Can't access negative rows!");
│ │ │ │ +
688 if (row>=N())
│ │ │ │ +
689 DUNE_THROW(ISTLError, "Row index out of range!");
│ │ │ │ +
690#endif
│ │ │ │ +
691 return data_[row];
│ │ │ │ +
692 }
│ │ │ │ +
│ │ │ │ +
693
│ │ │ │ +
│ │ │ │ +
695 size_type N() const {
│ │ │ │ +
696 return data_.N();
│ │ │ │ +
697 }
│ │ │ │ +
│ │ │ │ +
698
│ │ │ │ +
│ │ │ │ +
700 size_type M() const {
│ │ │ │ +
701 return cols_;
│ │ │ │ +
702 }
│ │ │ │ +
│ │ │ │ +
703
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
706 data_ *= scalar;
│ │ │ │ +
707 return (*this);
│ │ │ │ +
708 }
│ │ │ │ +
│ │ │ │ +
709
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
712 data_ /= scalar;
│ │ │ │ +
713 return (*this);
│ │ │ │ +
714 }
│ │ │ │ +
│ │ │ │ +
715
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
722#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
723 if(N()!=b.N() || M() != b.M())
│ │ │ │ +
724 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ +
725#endif
│ │ │ │ +
726 data_ += b.data_;
│ │ │ │ +
727 return (*this);
│ │ │ │ +
728 }
│ │ │ │ +
│ │ │ │ +
729
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
736#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
737 if(N()!=b.N() || M() != b.M())
│ │ │ │ +
738 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ +
739#endif
│ │ │ │ +
740 data_ -= b.data_;
│ │ │ │ +
741 return (*this);
│ │ │ │ +
742 }
│ │ │ │ +
│ │ │ │ +
743
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
746 Matrix out(M(), N());
│ │ │ │ +
747 for (size_type i=0; i<N(); i++)
│ │ │ │ +
748 for (size_type j=0; j<M(); j++)
│ │ │ │ +
749 out[j][i] = (*this)[i][j];
│ │ │ │ +
750
│ │ │ │ +
751 return out;
│ │ │ │ +
752 }
│ │ │ │ +
│ │ │ │ +
753
│ │ │ │ +
│ │ │ │ +
755 friend Matrix<T> operator*(const Matrix<T>& m1, const Matrix<T>& m2) {
│ │ │ │ +
756 Matrix<T> out(m1.N(), m2.M());
│ │ │ │ +
757 out = 0;
│ │ │ │ +
758
│ │ │ │ +
759 for (size_type i=0; i<out.N(); i++ ) {
│ │ │ │ +
760 for ( size_type j=0; j<out.M(); j++ )
│ │ │ │ +
761 for (size_type k=0; k<m1.M(); k++)
│ │ │ │ +
762 out[i][j] += m1[i][k]*m2[k][j];
│ │ │ │ +
763 }
│ │ │ │ +
764
│ │ │ │ +
765 return out;
│ │ │ │ +
766 }
│ │ │ │ +
│ │ │ │ +
767
│ │ │ │ +
769 template <class X, class Y>
│ │ │ │ +
│ │ │ │ +
770 friend Y operator*(const Matrix<T>& m, const X& vec) {
│ │ │ │ +
771#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
772 if (m.M()!=vec.size())
│ │ │ │ +
773 DUNE_THROW(ISTLError, "Vector size doesn't match the number of matrix columns!");
│ │ │ │ +
774#endif
│ │ │ │ +
775 Y out(m.N());
│ │ │ │ +
776 out = 0;
│ │ │ │ +
777
│ │ │ │ +
778 for (size_type i=0; i<out.size(); i++ ) {
│ │ │ │ +
779 for ( size_type j=0; j<vec.size(); j++ )
│ │ │ │ +
780 out[i] += m[i][j]*vec[j];
│ │ │ │ +
781 }
│ │ │ │ +
782
│ │ │ │ +
783 return out;
│ │ │ │ +
784 }
│ │ │ │ +
│ │ │ │ +
785
│ │ │ │ +
787 template <class X, class Y>
│ │ │ │ +
│ │ │ │ +
788 void mv(const X& x, Y& y) const
│ │ │ │ +
789 {
│ │ │ │ +
790#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
791 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
792 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
793#endif
│ │ │ │ +
794 for (size_type i=0; i<data_.N(); i++) {
│ │ │ │ +
795 y[i]=0;
│ │ │ │ +
796 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
797 {
│ │ │ │ +
798 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ +
799 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ +
800 Impl::asMatrix((*this)[i][j]).umv(xj, yi);
│ │ │ │ +
801 }
│ │ │ │ +
802 }
│ │ │ │ +
803 }
│ │ │ │ +
│ │ │ │ +
804
│ │ │ │ +
806 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
807 void mtv (const X& x, Y& y) const
│ │ │ │ +
808 {
│ │ │ │ +
809#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
810 if (x.N()!=N()) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
811 if (y.N()!=M()) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
812#endif
│ │ │ │ +
813 for(size_type i=0; i<y.N(); ++i)
│ │ │ │ +
814 y[i]=0;
│ │ │ │ +
815 umtv(x,y);
│ │ │ │ +
816 }
│ │ │ │ +
│ │ │ │ +
817
│ │ │ │ +
819 template <class X, class Y>
│ │ │ │ +
│ │ │ │ +
820 void umv(const X& x, Y& y) const
│ │ │ │ +
821 {
│ │ │ │ +
822#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
823 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
824 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
825#endif
│ │ │ │ +
826 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
827 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
828 {
│ │ │ │ +
829 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ +
830 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ +
831 Impl::asMatrix((*this)[i][j]).umv(xj, yi);
│ │ │ │ +
832 }
│ │ │ │ +
833 }
│ │ │ │ +
│ │ │ │ +
834
│ │ │ │ +
836 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
837 void mmv (const X& x, Y& y) const
│ │ │ │ +
838 {
│ │ │ │ +
839#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
840 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
841 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
842#endif
│ │ │ │ +
843 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
844 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
845 {
│ │ │ │ +
846 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ +
847 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ +
848 Impl::asMatrix((*this)[i][j]).mmv(xj, yi);
│ │ │ │ +
849 }
│ │ │ │ +
850 }
│ │ │ │ +
│ │ │ │ +
851
│ │ │ │ +
853 template <class X, class Y>
│ │ │ │ +
│ │ │ │ +
854 void usmv(const field_type& alpha, const X& x, Y& y) const
│ │ │ │ +
855 {
│ │ │ │ +
856#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
857 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
858 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
859#endif
│ │ │ │ +
860 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
861 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
862 {
│ │ │ │ +
863 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ +
864 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ +
865 Impl::asMatrix((*this)[i][j]).usmv(alpha, xj, yi);
│ │ │ │ +
866 }
│ │ │ │ +
867 }
│ │ │ │ +
│ │ │ │ +
868
│ │ │ │ +
870 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
871 void umtv (const X& x, Y& y) const
│ │ │ │ +
872 {
│ │ │ │ +
873#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
874 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
875 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
876#endif
│ │ │ │ +
877 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
878 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
879 {
│ │ │ │ +
880 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ +
881 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ +
882 Impl::asMatrix((*this)[i][j]).umtv(xi, yj);
│ │ │ │ +
883 }
│ │ │ │ +
884 }
│ │ │ │ +
│ │ │ │ +
885
│ │ │ │ +
887 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
888 void mmtv (const X& x, Y& y) const
│ │ │ │ +
889 {
│ │ │ │ +
890#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
891 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
892 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
893#endif
│ │ │ │ +
894 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
895 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
896 {
│ │ │ │ +
897 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ +
898 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ +
899 Impl::asMatrix((*this)[i][j]).mmtv(xi, yj);
│ │ │ │ +
900 }
│ │ │ │ +
901 }
│ │ │ │ +
│ │ │ │ +
902
│ │ │ │ +
904 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
905 void usmtv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ +
906 {
│ │ │ │ +
907#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
908 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
909 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
910#endif
│ │ │ │ +
911 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
912 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
913 {
│ │ │ │ +
914 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ +
915 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ +
916 Impl::asMatrix((*this)[i][j]).usmtv(alpha, xi, yj);
│ │ │ │ +
917 }
│ │ │ │ +
918 }
│ │ │ │ +
│ │ │ │ +
919
│ │ │ │ +
921 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
922 void umhv (const X& x, Y& y) const
│ │ │ │ +
923 {
│ │ │ │ +
924#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
925 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
926 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
927#endif
│ │ │ │ +
928 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
929 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
930 {
│ │ │ │ +
931 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ +
932 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ +
933 Impl::asMatrix((*this)[i][j]).umhv(xi,yj);
│ │ │ │ +
934 }
│ │ │ │ +
935 }
│ │ │ │ +
│ │ │ │ +
936
│ │ │ │ +
938 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
939 void mmhv (const X& x, Y& y) const
│ │ │ │ +
940 {
│ │ │ │ +
941#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
942 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
943 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
944#endif
│ │ │ │ +
945 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
946 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
947 {
│ │ │ │ +
948 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ +
949 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ +
950 Impl::asMatrix((*this)[i][j]).mmhv(xi,yj);
│ │ │ │ +
951 }
│ │ │ │ +
952 }
│ │ │ │ +
│ │ │ │ +
953
│ │ │ │ +
955 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
956 void usmhv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ +
957 {
│ │ │ │ +
958#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
959 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
960 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ +
961#endif
│ │ │ │ +
962 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ +
963 for (size_type j=0; j<cols_; j++)
│ │ │ │ +
964 {
│ │ │ │ +
965 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ +
966 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ +
967 Impl::asMatrix((*this)[i][j]).usmhv(alpha,xi,yj);
│ │ │ │ +
968 }
│ │ │ │ +
969 }
│ │ │ │ +
│ │ │ │ +
970
│ │ │ │ +
971 //===== norms
│ │ │ │ +
972
│ │ │ │ +
│ │ │ │ +
974 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ +
975 {
│ │ │ │ +
976 return std::sqrt(frobenius_norm2());
│ │ │ │ +
977 }
│ │ │ │ +
│ │ │ │ +
978
│ │ │ │ +
│ │ │ │ +
980 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ │ +
981 {
│ │ │ │ +
982 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
983 for (size_type i=0; i<this->N(); i++)
│ │ │ │ +
984 for (size_type j=0; j<this->M(); j++)
│ │ │ │ +
985 sum += Impl::asMatrix(data_[i][j]).frobenius_norm2();
│ │ │ │ +
986 return sum;
│ │ │ │ +
987 }
│ │ │ │ +
│ │ │ │ +
988
│ │ │ │ +
990 template <typename ft = field_type,
│ │ │ │ +
991 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
992 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
993 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
994 using std::max;
│ │ │ │ +
995
│ │ │ │ +
996 real_type norm = 0;
│ │ │ │ +
997 for (auto const &x : *this) {
│ │ │ │ +
998 real_type sum = 0;
│ │ │ │ +
999 for (auto const &y : x)
│ │ │ │ +
1000 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ +
1001 norm = max(sum, norm);
│ │ │ │ +
1002 isNaN += sum;
│ │ │ │ +
1003 }
│ │ │ │ +
1004
│ │ │ │ +
1005 return norm;
│ │ │ │ +
1006 }
│ │ │ │ +
│ │ │ │ +
1007
│ │ │ │ +
1009 template <typename ft = field_type,
│ │ │ │ +
1010 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
1011 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
1012 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
1013 using std::max;
│ │ │ │ +
1014
│ │ │ │ +
1015 real_type norm = 0;
│ │ │ │ +
1016 for (auto const &x : *this) {
│ │ │ │ +
1017 real_type sum = 0;
│ │ │ │ +
1018 for (auto const &y : x)
│ │ │ │ +
1019 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ +
1020 norm = max(sum, norm);
│ │ │ │ +
1021 }
│ │ │ │ +
1022 return norm;
│ │ │ │ +
1023 }
│ │ │ │ +
│ │ │ │ +
1024
│ │ │ │ +
1026 template <typename ft = field_type,
│ │ │ │ +
1027 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
1028 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
1029 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
1030 using std::max;
│ │ │ │ +
1031
│ │ │ │ +
1032 real_type norm = 0;
│ │ │ │ +
1033 real_type isNaN = 1;
│ │ │ │ +
1034 for (auto const &x : *this) {
│ │ │ │ +
1035 real_type sum = 0;
│ │ │ │ +
1036 for (auto const &y : x)
│ │ │ │ +
1037 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ +
1038 norm = max(sum, norm);
│ │ │ │ +
1039 isNaN += sum;
│ │ │ │ +
1040 }
│ │ │ │ +
1041
│ │ │ │ +
1042 return norm * (isNaN / isNaN);
│ │ │ │ +
1043 }
│ │ │ │ +
│ │ │ │ +
1044
│ │ │ │ +
1046 template <typename ft = field_type,
│ │ │ │ +
1047 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
1048 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
1049 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
1050 using std::max;
│ │ │ │ +
1051
│ │ │ │ +
1052 real_type norm = 0;
│ │ │ │ +
1053 real_type isNaN = 1;
│ │ │ │ +
1054 for (auto const &x : *this) {
│ │ │ │ +
1055 real_type sum = 0;
│ │ │ │ +
1056 for (auto const &y : x)
│ │ │ │ +
1057 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ +
1058 norm = max(sum, norm);
│ │ │ │ +
1059 isNaN += sum;
│ │ │ │ +
1060 }
│ │ │ │ +
1061
│ │ │ │ +
1062 return norm * (isNaN / isNaN);
│ │ │ │ +
1063 }
│ │ │ │ +
│ │ │ │ +
1064
│ │ │ │ +
1065 //===== query
│ │ │ │ +
1066
│ │ │ │ +
│ │ │ │ +
1068 bool exists ([[maybe_unused]] size_type i, [[maybe_unused]] size_type j) const
│ │ │ │ +
1069 {
│ │ │ │ +
1070#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1071 if (i<0 || i>=N()) DUNE_THROW(ISTLError,"row index out of range");
│ │ │ │ +
1072 if (j<0 || i>=M()) DUNE_THROW(ISTLError,"column index out of range");
│ │ │ │ +
1073#endif
│ │ │ │ +
1074 return true;
│ │ │ │ +
1075 }
│ │ │ │ +
│ │ │ │ +
1076
│ │ │ │ +
1077 protected:
│ │ │ │ +
1078
│ │ │ │ + │ │ │ │ +
1082
│ │ │ │ + │ │ │ │ +
1089 };
│ │ │ │ +
│ │ │ │ +
1090
│ │ │ │ +
1091 template<class T, class A>
│ │ │ │ +
│ │ │ │ +
1092 struct FieldTraits< Matrix<T, A> >
│ │ │ │ +
1093 {
│ │ │ │ + │ │ │ │ +
1095 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
1096 };
│ │ │ │ +
│ │ │ │ +
1097
│ │ │ │ +
1099} // end namespace Dune
│ │ │ │ +
1100
│ │ │ │ +
1101#endif
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ + │ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A linear operator exporting itself in matrix form.
Definition operators.hh:109
│ │ │ │ -
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ │ -
const communication_type & getCommunication() const
Get the object responsible for communication.
Definition schwarz.hh:146
│ │ │ │ -
virtual const matrix_type & getmat() const
get the sequential assembled linear operator.
Definition schwarz.hh:133
│ │ │ │ -
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const
apply operator to x, scale and add:
Definition schwarz.hh:125
│ │ │ │ -
virtual void apply(const X &x, Y &y) const
apply operator to x:
Definition schwarz.hh:116
│ │ │ │ -
C communication_type
The type of the communication object.
Definition schwarz.hh:98
│ │ │ │ -
X domain_type
The type of the domain.
Definition schwarz.hh:86
│ │ │ │ -
M matrix_type
The type of the matrix we operate on.
Definition schwarz.hh:81
│ │ │ │ -
Y range_type
The type of the range.
Definition schwarz.hh:91
│ │ │ │ -
X::field_type field_type
The field type of the range.
Definition schwarz.hh:93
│ │ │ │ -
OverlappingSchwarzOperator(const matrix_type &A, const communication_type &com)
constructor: just store a reference to a matrix.
Definition schwarz.hh:107
│ │ │ │ -
OverlappingSchwarzOperator(const std::shared_ptr< matrix_type > A, const communication_type &com)
Definition schwarz.hh:111
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the linear operator (see SolverCategory::Category)
Definition schwarz.hh:139
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
A parallel SSOR preconditioner.
Definition schwarz.hh:175
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition schwarz.hh:184
│ │ │ │ -
C communication_type
The type of the communication object.
Definition schwarz.hh:186
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition schwarz.hh:233
│ │ │ │ -
ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c)
Constructor.
Definition schwarz.hh:197
│ │ │ │ -
virtual void post(X &x)
Clean up.
Definition schwarz.hh:230
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:180
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:182
│ │ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition schwarz.hh:178
│ │ │ │ -
virtual void apply(X &v, const Y &d)
Apply the precondtioner.
Definition schwarz.hh:216
│ │ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition schwarz.hh:206
│ │ │ │ -
Block parallel preconditioner.
Definition schwarz.hh:278
│ │ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition schwarz.hh:326
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:285
│ │ │ │ -
BlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c)
Constructor.
Definition schwarz.hh:317
│ │ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition schwarz.hh:337
│ │ │ │ -
BlockPreconditioner(P &p, const communication_type &c)
Constructor.
Definition schwarz.hh:306
│ │ │ │ -
void apply(X &v, const Y &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition schwarz.hh:344
│ │ │ │ -
C communication_type
The type of the communication object..
Definition schwarz.hh:297
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition schwarz.hh:292
│ │ │ │ -
virtual void post(X &x)
Clean up.
Definition schwarz.hh:355
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:290
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition schwarz.hh:361
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ -
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
A Vector of blocks with different blocksizes.
Definition matrix.hh:44
│ │ │ │ +
Imp::BlockVectorWindow< B, A > window_type
Definition matrix.hh:70
│ │ │ │ +
BlockVector< B, A > block_type
Same as value_type, here for historical reasons.
Definition matrix.hh:67
│ │ │ │ +
DenseMatrixBase & operator=(const DenseMatrixBase &a)
assignment
Definition matrix.hh:182
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition matrix.hh:50
│ │ │ │ +
Iterator beforeBegin() const
Definition matrix.hh:385
│ │ │ │ +
void resize(size_type rows, size_type columns)
same effect as constructor with same argument
Definition matrix.hh:153
│ │ │ │ +
const window_type const_reference
Definition matrix.hh:74
│ │ │ │ +
DenseMatrixBase(size_type rows, size_type columns)
Definition matrix.hh:95
│ │ │ │ +
Iterator end()
end Iterator
Definition matrix.hh:371
│ │ │ │ +
reference operator[](size_type i)
random access to blocks
Definition matrix.hh:241
│ │ │ │ +
BlockVector< B, A > value_type
Type of the elements of the outer vector, i.e., dynamic vectors of B.
Definition matrix.hh:63
│ │ │ │ +
Iterator find(size_type i)
random access returning iterator (end if not contained)
Definition matrix.hh:391
│ │ │ │ +
size_type N() const
number of blocks in the vector (are of variable size here)
Definition matrix.hh:539
│ │ │ │ +
ConstIterator beforeEnd() const
Definition matrix.hh:525
│ │ │ │ +
ConstIterator end() const
end ConstIterator
Definition matrix.hh:518
│ │ │ │ +
window_type reference
Definition matrix.hh:72
│ │ │ │ +
ConstIterator rend() const
end ConstIterator
Definition matrix.hh:531
│ │ │ │ +
Iterator beforeEnd()
Definition matrix.hh:378
│ │ │ │ +
ConstIterator begin() const
begin ConstIterator
Definition matrix.hh:512
│ │ │ │ +
A allocator_type
export the allocator type
Definition matrix.hh:53
│ │ │ │ +
DenseMatrixBase()
Definition matrix.hh:82
│ │ │ │ +
ConstIterator find(size_type i) const
random access returning iterator (end if not contained)
Definition matrix.hh:397
│ │ │ │ +
A::size_type size_type
The size type for the index access.
Definition matrix.hh:56
│ │ │ │ +
~DenseMatrixBase()
free dynamic memory
Definition matrix.hh:142
│ │ │ │ +
Iterator begin()
begin Iterator
Definition matrix.hh:365
│ │ │ │ +
DenseMatrixBase(const DenseMatrixBase &a)
copy constructor, has copy semantics
Definition matrix.hh:116
│ │ │ │ +
Iterator class for sequential access.
Definition matrix.hh:263
│ │ │ │ +
Iterator & operator--()
prefix decrement
Definition matrix.hh:308
│ │ │ │ +
size_type index() const
Definition matrix.hh:352
│ │ │ │ + │ │ │ │ + │ │ │ │ +
bool operator!=(const Iterator &it) const
inequality
Definition matrix.hh:322
│ │ │ │ +
Iterator & operator=(Iterator &&other)
Move assignment.
Definition matrix.hh:282
│ │ │ │ +
Iterator & operator++()
prefix increment
Definition matrix.hh:300
│ │ │ │ +
Iterator()
constructor, no arguments
Definition matrix.hh:266
│ │ │ │ +
window_type & operator*() const
dereferencing
Definition matrix.hh:340
│ │ │ │ +
bool operator==(const Iterator &it) const
equality
Definition matrix.hh:316
│ │ │ │ +
Iterator & operator=(Iterator &other)
Copy assignment.
Definition matrix.hh:291
│ │ │ │ +
Iterator(B *data, size_type columns, size_type _i)
constructor
Definition matrix.hh:276
│ │ │ │ +
window_type * operator->() const
arrow
Definition matrix.hh:346
│ │ │ │ +
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ +
const window_type * operator->() const
arrow
Definition matrix.hh:487
│ │ │ │ +
const window_type & operator*() const
dereferencing
Definition matrix.hh:481
│ │ │ │ +
ConstIterator & operator++()
prefix increment
Definition matrix.hh:441
│ │ │ │ +
ConstIterator(const B *data, size_type columns, size_type _i)
constructor from pointer
Definition matrix.hh:414
│ │ │ │ +
ConstIterator & operator--()
prefix decrement
Definition matrix.hh:449
│ │ │ │ +
ConstIterator(const Iterator &it)
constructor from non_const iterator
Definition matrix.hh:420
│ │ │ │ +
bool operator!=(const ConstIterator &it) const
inequality
Definition matrix.hh:463
│ │ │ │ +
ConstIterator()
constructor
Definition matrix.hh:407
│ │ │ │ +
bool operator==(const ConstIterator &it) const
equality
Definition matrix.hh:457
│ │ │ │ +
size_type index() const
Definition matrix.hh:493
│ │ │ │ +
ConstIterator & operator=(Iterator &&other)
Definition matrix.hh:424
│ │ │ │ +
ConstIterator & operator=(Iterator &other)
Definition matrix.hh:432
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
size_type cols_
Number of columns of the matrix.
Definition matrix.hh:1088
│ │ │ │ +
FieldTraits< ft >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition matrix.hh:992
│ │ │ │ +
A allocator_type
Export the allocator.
Definition matrix.hh:571
│ │ │ │ +
FieldTraits< ft >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition matrix.hh:1011
│ │ │ │ +
void usmhv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition matrix.hh:956
│ │ │ │ +
void usmv(const field_type &alpha, const X &x, Y &y) const
Definition matrix.hh:854
│ │ │ │ +
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ │ +
MatrixImp::DenseMatrixBase< T, A > data_
Abuse DenseMatrixBase as an engine for a 2d array ISTL-style.
Definition matrix.hh:1081
│ │ │ │ +
Matrix transpose() const
Return the transpose of the matrix.
Definition matrix.hh:745
│ │ │ │ +
void mtv(const X &x, Y &y) const
y = A^T x
Definition matrix.hh:807
│ │ │ │ +
void umv(const X &x, Y &y) const
y += A x
Definition matrix.hh:820
│ │ │ │ +
void mv(const X &x, Y &y) const
y = A x
Definition matrix.hh:788
│ │ │ │ +
MatrixImp::DenseMatrixBase< T, A >::ConstIterator ConstRowIterator
Const iterator over the matrix rows.
Definition matrix.hh:586
│ │ │ │ +
void setSize(size_type rows, size_type cols)
Change the matrix size.
Definition matrix.hh:608
│ │ │ │ +
RowIterator beforeBegin()
Definition matrix.hh:634
│ │ │ │ +
RowIterator beforeEnd()
Definition matrix.hh:627
│ │ │ │ +
Matrix()
Create empty matrix.
Definition matrix.hh:596
│ │ │ │ +
Matrix & operator-=(const Matrix &b)
Subtract the entries of another matrix from this one.
Definition matrix.hh:735
│ │ │ │ +
FieldTraits< field_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition matrix.hh:980
│ │ │ │ +
row_type::iterator ColIterator
Iterator for the entries of each row.
Definition matrix.hh:583
│ │ │ │ +
ConstRowIterator beforeEnd() const
Definition matrix.hh:653
│ │ │ │ +
Matrix & operator=(const field_type &t)
Assignment from scalar.
Definition matrix.hh:666
│ │ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ +
const row_type operator[](size_type row) const
The const index operator.
Definition matrix.hh:684
│ │ │ │ +
ConstRowIterator end() const
Get const iterator to one beyond last row.
Definition matrix.hh:646
│ │ │ │ +
friend Y operator*(const Matrix< T > &m, const X &vec)
Generic matrix-vector multiplication.
Definition matrix.hh:770
│ │ │ │ +
Matrix< T > & operator*=(const field_type &scalar)
Multiplication with a scalar.
Definition matrix.hh:705
│ │ │ │ +
row_type operator[](size_type row)
The index operator.
Definition matrix.hh:673
│ │ │ │ +
void mmv(const X &x, Y &y) const
y -= A x
Definition matrix.hh:837
│ │ │ │ +
Matrix & operator+=(const Matrix &b)
Add the entries of another matrix to this one.
Definition matrix.hh:721
│ │ │ │ +
ConstRowIterator begin() const
Get const iterator to first row.
Definition matrix.hh:640
│ │ │ │ +
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition matrix.hh:939
│ │ │ │ +
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:614
│ │ │ │ +
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
│ │ │ │ +
static constexpr auto blocklevel
The number of nesting levels the matrix contains.
Definition matrix.hh:593
│ │ │ │ +
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ +
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ +
bool exists(size_type i, size_type j) const
return true if (i,j) is in pattern
Definition matrix.hh:1068
│ │ │ │ +
Matrix< T > & operator/=(const field_type &scalar)
Division by a scalar.
Definition matrix.hh:711
│ │ │ │ +
friend Matrix< T > operator*(const Matrix< T > &m1, const Matrix< T > &m2)
Generic matrix multiplication.
Definition matrix.hh:755
│ │ │ │ +
void umtv(const X &x, Y &y) const
y += A^T x
Definition matrix.hh:871
│ │ │ │ +
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition matrix.hh:888
│ │ │ │ +
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ │ +
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition matrix.hh:974
│ │ │ │ +
void usmtv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition matrix.hh:905
│ │ │ │ +
void umhv(const X &x, Y &y) const
y += A^H x
Definition matrix.hh:922
│ │ │ │ +
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │ +
ConstRowIterator beforeBegin() const
Definition matrix.hh:660
│ │ │ │ +
Matrix(size_type rows, size_type cols)
Create uninitialized matrix of size rows x cols.
Definition matrix.hh:601
│ │ │ │ +
MatrixImp::DenseMatrixBase< T, A >::Iterator RowIterator
Iterator over the matrix rows.
Definition matrix.hh:580
│ │ │ │ +
typename Matrix< T, A >::field_type field_type
Definition matrix.hh:1094
│ │ │ │ +
typename FieldTraits< field_type >::real_type real_type
Definition matrix.hh:1095
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,395 +1,1378 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -schwarz.hh │ │ │ │ │ +matrix.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 (C) 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_ISTL_MATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_MATRIX_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 │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ 14 │ │ │ │ │ -15#include │ │ │ │ │ -16 │ │ │ │ │ -17#include "_i_o_._h_h" │ │ │ │ │ -18#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -19#include "_v_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -20#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ │ -21#include "_i_o_._h_h" │ │ │ │ │ -22#include "_g_s_e_t_c_._h_h" │ │ │ │ │ -23#include "_i_l_u_._h_h" │ │ │ │ │ -24#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ │ -25#include "_s_o_l_v_e_r_s_._h_h" │ │ │ │ │ -26#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ │ -27#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ │ -28#include "_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h" │ │ │ │ │ -29 │ │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ │ -31 │ │ │ │ │ -73 template │ │ │ │ │ -_7_4 class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r : public _A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -75 { │ │ │ │ │ -76 public: │ │ │ │ │ -_8_1 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_8_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_9_1 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_9_3 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_9_8 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ -99 │ │ │ │ │ -_1_0_7 _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r (const _m_a_t_r_i_x___t_y_p_e& A, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& │ │ │ │ │ -com) │ │ │ │ │ -108 : _A_(stackobject_to_shared_ptr(A)), communication(com) │ │ │ │ │ -109 {} │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19 │ │ │ │ │ +20#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +23 │ │ │ │ │ +24namespace _D_u_n_e { │ │ │ │ │ +25 │ │ │ │ │ +_2_6namespace MatrixImp │ │ │ │ │ +27{ │ │ │ │ │ +39 template > │ │ │ │ │ +_4_0 class _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e : public Imp::block_vector_unmanaged │ │ │ │ │ +41 // this derivation gives us all the blas level 1 and norms │ │ │ │ │ +42 // on the large array. However, access operators have to be │ │ │ │ │ +43 // overwritten. │ │ │ │ │ +44 { │ │ │ │ │ +45 public: │ │ │ │ │ +46 │ │ │ │ │ +47 //===== type definitions and constants │ │ │ │ │ +48 │ │ │ │ │ +_5_0 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ +51 │ │ │ │ │ +_5_3 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +54 │ │ │ │ │ +_5_6 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +57 │ │ │ │ │ +_6_3 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +64 │ │ │ │ │ +_6_7 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +68 │ │ │ │ │ +69 // just a shorthand │ │ │ │ │ +_7_0 typedef Imp::BlockVectorWindow _w_i_n_d_o_w___t_y_p_e; │ │ │ │ │ +71 │ │ │ │ │ +_7_2 typedef _w_i_n_d_o_w___t_y_p_e _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +73 │ │ │ │ │ +_7_4 typedef const _w_i_n_d_o_w___t_y_p_e _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ +75 │ │ │ │ │ +76 │ │ │ │ │ +77 //===== constructors and such │ │ │ │ │ +78 │ │ │ │ │ +_8_2 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e () : Imp::block_vector_unmanaged() │ │ │ │ │ +83 { │ │ │ │ │ +84 // nothing is known ... │ │ │ │ │ +85 rows_ = 0; │ │ │ │ │ +86 columns_ = 0; │ │ │ │ │ +87 } │ │ │ │ │ +88 │ │ │ │ │ +_9_5 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e (_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns) : Imp:: │ │ │ │ │ +block_vector_unmanaged() │ │ │ │ │ +96 { │ │ │ │ │ +97 // and we can allocate the big array in the base class │ │ │ │ │ +98 this->n = rows*columns; │ │ │ │ │ +99 columns_ = columns; │ │ │ │ │ +100 if (this->n>0) │ │ │ │ │ +101 { │ │ │ │ │ +102 this->p = allocator_.allocate(this->n); │ │ │ │ │ +103 new (this->p)B[this->n]; │ │ │ │ │ +104 } │ │ │ │ │ +105 else │ │ │ │ │ +106 { │ │ │ │ │ +107 this->n = 0; │ │ │ │ │ +108 this->p = 0; │ │ │ │ │ +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 {} │ │ │ │ │ +111 // we can allocate the windows now │ │ │ │ │ +112 rows_ = rows; │ │ │ │ │ +113 } │ │ │ │ │ 114 │ │ │ │ │ -_1_1_6 virtual void _a_p_p_l_y (const X& x, Y& y) const │ │ │ │ │ +_1_1_6 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e (const _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& a) │ │ │ │ │ 117 { │ │ │ │ │ -118 y = 0; │ │ │ │ │ -119 _A_->umv(x,y); // result is consistent on interior+border │ │ │ │ │ -120 communication.project(y); // we want this here to avoid it before the │ │ │ │ │ -preconditioner │ │ │ │ │ -121 // since there d is const! │ │ │ │ │ -122 } │ │ │ │ │ -123 │ │ │ │ │ -_1_2_5 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (_f_i_e_l_d___t_y_p_e alpha, const X& x, Y& y) const │ │ │ │ │ -126 { │ │ │ │ │ -127 _A_->usmv(alpha,x,y); // result is consistent on interior+border │ │ │ │ │ -128 communication.project(y); // we want this here to avoid it before the │ │ │ │ │ -preconditioner │ │ │ │ │ -129 // since there d is const! │ │ │ │ │ +118 // allocate the big array in the base class │ │ │ │ │ +119 this->n = a.n; │ │ │ │ │ +120 columns_ = a.columns_; │ │ │ │ │ +121 if (this->n>0) │ │ │ │ │ +122 { │ │ │ │ │ +123 // allocate and construct objects │ │ │ │ │ +124 this->p = allocator_.allocate(this->n); │ │ │ │ │ +125 new (this->p)B[this->n]; │ │ │ │ │ +126 │ │ │ │ │ +127 // copy data │ │ │ │ │ +128 for (_s_i_z_e___t_y_p_e i=0; in; i++) │ │ │ │ │ +129 this->p[i]=a.p[i]; │ │ │ │ │ 130 } │ │ │ │ │ -131 │ │ │ │ │ -_1_3_3 virtual const _m_a_t_r_i_x___t_y_p_e& _g_e_t_m_a_t () const │ │ │ │ │ -134 { │ │ │ │ │ -135 return *_A_; │ │ │ │ │ -136 } │ │ │ │ │ -137 │ │ │ │ │ -_1_3_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -140 { │ │ │ │ │ -141 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ │ -142 } │ │ │ │ │ -143 │ │ │ │ │ -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; │ │ │ │ │ +131 else │ │ │ │ │ +132 { │ │ │ │ │ +133 this->n = 0; │ │ │ │ │ +134 this->p = nullptr; │ │ │ │ │ +135 } │ │ │ │ │ +136 │ │ │ │ │ +137 // we can allocate the windows now │ │ │ │ │ +138 rows_ = a.rows_; │ │ │ │ │ +139 } │ │ │ │ │ +140 │ │ │ │ │ +_1_4_2 _~_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e () │ │ │ │ │ +143 { │ │ │ │ │ +144 if (this->n>0) { │ │ │ │ │ +145 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ +146 while (i) │ │ │ │ │ +147 this->p[--i].~B(); │ │ │ │ │ +148 allocator_.deallocate(this->p,this->n); │ │ │ │ │ 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 │ │ │ │ │ -157 /* │ │ │ │ │ -158 * @addtogroup ISTL_Prec │ │ │ │ │ -159 * @{ │ │ │ │ │ -160 */ │ │ │ │ │ -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; │ │ │ │ │ -187 │ │ │ │ │ -_1_9_7 _P_a_r_S_S_O_R (const _m_a_t_r_i_x___t_y_p_e& A, int n, _f_i_e_l_d___t_y_p_e w, const │ │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ │ -198 : _A_(A), _n(n), _w(w), communication(c) │ │ │ │ │ -199 { } │ │ │ │ │ -200 │ │ │ │ │ -_2_0_6 virtual void _p_r_e (X& x, [[maybe_unused]] Y& b) │ │ │ │ │ -207 { │ │ │ │ │ -208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ │ -209 } │ │ │ │ │ -210 │ │ │ │ │ -_2_1_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -217 { │ │ │ │ │ -218 for (int i=0; i<_n; i++) { │ │ │ │ │ -219 _b_s_o_r_f(_A_,v,d,_w); │ │ │ │ │ -220 _b_s_o_r_b(_A_,v,d,_w); │ │ │ │ │ -221 } │ │ │ │ │ -222 communication.copyOwnerToAll(v,v); │ │ │ │ │ +150 } │ │ │ │ │ +151 │ │ │ │ │ +_1_5_3 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns) │ │ │ │ │ +154 { │ │ │ │ │ +155 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ +156 if (this->n>0) { │ │ │ │ │ +157 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ +158 while (i) │ │ │ │ │ +159 this->p[--i].~B(); │ │ │ │ │ +160 allocator_.deallocate(this->p,this->n); │ │ │ │ │ +161 } │ │ │ │ │ +162 │ │ │ │ │ +163 // and we can allocate the big array in the base class │ │ │ │ │ +164 this->n = rows*columns; │ │ │ │ │ +165 if (this->n>0) │ │ │ │ │ +166 { │ │ │ │ │ +167 this->p = allocator_.allocate(this->n); │ │ │ │ │ +168 new (this->p)B[this->n]; │ │ │ │ │ +169 } │ │ │ │ │ +170 else │ │ │ │ │ +171 { │ │ │ │ │ +172 this->n = 0; │ │ │ │ │ +173 this->p = nullptr; │ │ │ │ │ +174 } │ │ │ │ │ +175 │ │ │ │ │ +176 // we can allocate the windows now │ │ │ │ │ +177 rows_ = rows; │ │ │ │ │ +178 columns_ = columns; │ │ │ │ │ +179 } │ │ │ │ │ +180 │ │ │ │ │ +_1_8_2 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& _o_p_e_r_a_t_o_r_=_ (const _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& a) │ │ │ │ │ +183 { │ │ │ │ │ +184 if (&a!=this) // check if this and a are different objects │ │ │ │ │ +185 { │ │ │ │ │ +186 columns_ = a.columns_; │ │ │ │ │ +187 // reallocate arrays if necessary │ │ │ │ │ +188 // Note: still the block sizes may vary ! │ │ │ │ │ +189 if (this->n!=a.n || rows_!=a.rows_) │ │ │ │ │ +190 { │ │ │ │ │ +191 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ +192 if (this->n>0) { │ │ │ │ │ +193 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ +194 while (i) │ │ │ │ │ +195 this->p[--i].~B(); │ │ │ │ │ +196 allocator_.deallocate(this->p,this->n); │ │ │ │ │ +197 } │ │ │ │ │ +198 │ │ │ │ │ +199 // allocate the big array in the base class │ │ │ │ │ +200 this->n = a.n; │ │ │ │ │ +201 if (this->n>0) │ │ │ │ │ +202 { │ │ │ │ │ +203 // allocate and construct objects │ │ │ │ │ +204 this->p = allocator_.allocate(this->n); │ │ │ │ │ +205 new (this->p)B[this->n]; │ │ │ │ │ +206 } │ │ │ │ │ +207 else │ │ │ │ │ +208 { │ │ │ │ │ +209 this->n = 0; │ │ │ │ │ +210 this->p = nullptr; │ │ │ │ │ +211 } │ │ │ │ │ +212 │ │ │ │ │ +213 // Copy number of rows │ │ │ │ │ +214 rows_ = a.rows_; │ │ │ │ │ +215 } │ │ │ │ │ +216 │ │ │ │ │ +217 // and copy the data │ │ │ │ │ +218 for (_s_i_z_e___t_y_p_e i=0; in; i++) │ │ │ │ │ +219 this->p[i]=a.p[i]; │ │ │ │ │ +220 } │ │ │ │ │ +221 │ │ │ │ │ +222 return *this; │ │ │ │ │ 223 } │ │ │ │ │ 224 │ │ │ │ │ -_2_3_0 virtual void _p_o_s_t ([[maybe_unused]] X& x) {} │ │ │ │ │ -231 │ │ │ │ │ -_2_3_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -234 { │ │ │ │ │ -235 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ │ -236 } │ │ │ │ │ -237 │ │ │ │ │ -238 private: │ │ │ │ │ -240 const _m_a_t_r_i_x___t_y_p_e& _A_; │ │ │ │ │ -242 int _n; │ │ │ │ │ -244 _f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ -_2_4_6 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& communication; │ │ │ │ │ -247 }; │ │ │ │ │ +225 │ │ │ │ │ +226 //===== assignment from scalar │ │ │ │ │ +227 │ │ │ │ │ +_2_2_9 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +230 { │ │ │ │ │ +231 (static_cast&>(*this)) = k; │ │ │ │ │ +232 return *this; │ │ │ │ │ +233 } │ │ │ │ │ +234 │ │ │ │ │ +235 │ │ │ │ │ +236 //===== access to components │ │ │ │ │ +237 // has to be overwritten from base class because it must │ │ │ │ │ +238 // return access to the windows │ │ │ │ │ +239 │ │ │ │ │ +_2_4_1 _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) │ │ │ │ │ +242 { │ │ │ │ │ +243#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +244 if (i>=rows_) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ +245#endif │ │ │ │ │ +246 return _w_i_n_d_o_w___t_y_p_e(this->p + i*columns_, columns_); │ │ │ │ │ +247 } │ │ │ │ │ 248 │ │ │ │ │ -249 namespace Amg │ │ │ │ │ -250 { │ │ │ │ │ -251 template struct ConstructionTraits; │ │ │ │ │ -252 } │ │ │ │ │ -253 │ │ │ │ │ -277 template > │ │ │ │ │ -_2_7_8 class _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ -279 friend struct Amg::ConstructionTraits<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r >; │ │ │ │ │ -280 public: │ │ │ │ │ -_2_8_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_2_9_0 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_2_9_2 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_2_9_7 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ +_2_5_0 _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 │ │ │ │ │ +251 { │ │ │ │ │ +252#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +253 if (i<0 || i>=rows_) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ +254#endif │ │ │ │ │ +255 return _w_i_n_d_o_w___t_y_p_e(this->p + i*columns_, columns_); │ │ │ │ │ +256 } │ │ │ │ │ +257 │ │ │ │ │ +258 // forward declaration │ │ │ │ │ +259 class ConstIterator; │ │ │ │ │ +260 │ │ │ │ │ +_2_6_2 class _I_t_e_r_a_t_o_r │ │ │ │ │ +263 { │ │ │ │ │ +264 public: │ │ │ │ │ +_2_6_6 _I_t_e_r_a_t_o_r () │ │ │ │ │ +267 : window_(nullptr,0) │ │ │ │ │ +268 { │ │ │ │ │ +269 i = 0; │ │ │ │ │ +270 } │ │ │ │ │ +271 │ │ │ │ │ +_2_7_2 _I_t_e_r_a_t_o_r (_I_t_e_r_a_t_o_r& other) = default; │ │ │ │ │ +_2_7_3 _I_t_e_r_a_t_o_r (_I_t_e_r_a_t_o_r&& other) = default; │ │ │ │ │ +274 │ │ │ │ │ +_2_7_6 _I_t_e_r_a_t_o_r (B* data, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ +277 : i(_i), │ │ │ │ │ +278 window_(data + _i*columns, columns) │ │ │ │ │ +279 {} │ │ │ │ │ +280 │ │ │ │ │ +_2_8_2 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r&& other) │ │ │ │ │ +283 { │ │ │ │ │ +284 i = other.i; │ │ │ │ │ +285 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ +not just the window! │ │ │ │ │ +286 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ +287 return *this; │ │ │ │ │ +288 } │ │ │ │ │ +289 │ │ │ │ │ +_2_9_1 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r& other) │ │ │ │ │ +292 { │ │ │ │ │ +293 i = other.i; │ │ │ │ │ +294 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ +not just the window! │ │ │ │ │ +295 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ +296 return *this; │ │ │ │ │ +297 } │ │ │ │ │ 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 { } │ │ │ │ │ +_3_0_0 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +301 { │ │ │ │ │ +302 ++i; │ │ │ │ │ +303 window_.setptr(window_.getptr()+window_.getsize()); │ │ │ │ │ +304 return *this; │ │ │ │ │ +305 } │ │ │ │ │ +306 │ │ │ │ │ +_3_0_8 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ +309 { │ │ │ │ │ +310 --i; │ │ │ │ │ +311 window_.setptr(window_.getptr()-window_.getsize()); │ │ │ │ │ +312 return *this; │ │ │ │ │ +313 } │ │ │ │ │ +314 │ │ │ │ │ +_3_1_6 bool _o_p_e_r_a_t_o_r_=_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +317 { │ │ │ │ │ +318 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ +319 } │ │ │ │ │ 320 │ │ │ │ │ -_3_2_6 virtual void _p_r_e (X& x, Y& b) │ │ │ │ │ -327 { │ │ │ │ │ -328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ │ -329 _preconditioner->pre(x,b); │ │ │ │ │ -330 } │ │ │ │ │ -331 │ │ │ │ │ -_3_3_7 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -338 { │ │ │ │ │ -339 _preconditioner->apply(v,d); │ │ │ │ │ -340 _communication.copyOwnerToAll(v,v); │ │ │ │ │ -341 } │ │ │ │ │ -342 │ │ │ │ │ -343 template │ │ │ │ │ -_3_4_4 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -345 { │ │ │ │ │ -346 _preconditioner->template apply(v,d); │ │ │ │ │ -347 _communication.copyOwnerToAll(v,v); │ │ │ │ │ -348 } │ │ │ │ │ -349 │ │ │ │ │ -_3_5_5 virtual void _p_o_s_t (X& x) │ │ │ │ │ -356 { │ │ │ │ │ -357 _preconditioner->post(x); │ │ │ │ │ -358 } │ │ │ │ │ -359 │ │ │ │ │ -_3_6_1 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -362 { │ │ │ │ │ -363 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ │ -364 } │ │ │ │ │ -365 │ │ │ │ │ -366 private: │ │ │ │ │ -368 std::shared_ptr

_preconditioner; │ │ │ │ │ +_3_2_2 bool _o_p_e_r_a_t_o_r_!_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +323 { │ │ │ │ │ +324 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ +325 } │ │ │ │ │ +326 │ │ │ │ │ +_3_2_8 bool _o_p_e_r_a_t_o_r_=_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +329 { │ │ │ │ │ +330 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ +331 } │ │ │ │ │ +332 │ │ │ │ │ +_3_3_4 bool _o_p_e_r_a_t_o_r_!_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +335 { │ │ │ │ │ +336 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ +337 } │ │ │ │ │ +338 │ │ │ │ │ +_3_4_0 _w_i_n_d_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_*_ () const │ │ │ │ │ +341 { │ │ │ │ │ +342 return window_; │ │ │ │ │ +343 } │ │ │ │ │ +344 │ │ │ │ │ +_3_4_6 _w_i_n_d_o_w___t_y_p_e* _o_p_e_r_a_t_o_r_-_>_ () const │ │ │ │ │ +347 { │ │ │ │ │ +348 return &window_; │ │ │ │ │ +349 } │ │ │ │ │ +350 │ │ │ │ │ +351 // return index corresponding to pointer │ │ │ │ │ +_3_5_2 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ +353 { │ │ │ │ │ +354 return i; │ │ │ │ │ +355 } │ │ │ │ │ +356 │ │ │ │ │ +_3_5_7 friend class _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +358 │ │ │ │ │ +359 private: │ │ │ │ │ +360 _s_i_z_e___t_y_p_e i; │ │ │ │ │ +361 mutable _w_i_n_d_o_w___t_y_p_e window_; │ │ │ │ │ +362 }; │ │ │ │ │ +363 │ │ │ │ │ +_3_6_5 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ +366 { │ │ │ │ │ +367 return _I_t_e_r_a_t_o_r(this->p, columns_, 0); │ │ │ │ │ +368 } │ │ │ │ │ 369 │ │ │ │ │ -371 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& _communication; │ │ │ │ │ -372 }; │ │ │ │ │ -373 │ │ │ │ │ -376} // end namespace │ │ │ │ │ -377 │ │ │ │ │ -378#endif │ │ │ │ │ -_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. │ │ │ │ │ +_3_7_1 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ +372 { │ │ │ │ │ +373 return _I_t_e_r_a_t_o_r(this->p, columns_, rows_); │ │ │ │ │ +374 } │ │ │ │ │ +375 │ │ │ │ │ +_3_7_8 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ +379 { │ │ │ │ │ +380 return _I_t_e_r_a_t_o_r(this->p, columns_, rows_-1); │ │ │ │ │ +381 } │ │ │ │ │ +382 │ │ │ │ │ +_3_8_5 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ │ +386 { │ │ │ │ │ +387 return _I_t_e_r_a_t_o_r(this->p, columns_, -1); │ │ │ │ │ +388 } │ │ │ │ │ +389 │ │ │ │ │ +_3_9_1 _I_t_e_r_a_t_o_r _f_i_n_d (_s_i_z_e___t_y_p_e i) │ │ │ │ │ +392 { │ │ │ │ │ +393 return _I_t_e_r_a_t_o_r(this->p, columns_, std::min(i,rows_)); │ │ │ │ │ +394 } │ │ │ │ │ +395 │ │ │ │ │ +_3_9_7 _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 │ │ │ │ │ +398 { │ │ │ │ │ +399 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, std::min(i,rows_)); │ │ │ │ │ +400 } │ │ │ │ │ +401 │ │ │ │ │ +_4_0_3 class _C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +404 { │ │ │ │ │ +405 public: │ │ │ │ │ +_4_0_7 _C_o_n_s_t_I_t_e_r_a_t_o_r () │ │ │ │ │ +408 : window_(nullptr,0) │ │ │ │ │ +409 { │ │ │ │ │ +410 i = 0; │ │ │ │ │ +411 } │ │ │ │ │ +412 │ │ │ │ │ +_4_1_4 _C_o_n_s_t_I_t_e_r_a_t_o_r (const B* data, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ +415 : i(_i), │ │ │ │ │ +416 window_(const_cast(data + _i * columns), columns) │ │ │ │ │ +417 {} │ │ │ │ │ +418 │ │ │ │ │ +_4_2_0 _C_o_n_s_t_I_t_e_r_a_t_o_r (const _I_t_e_r_a_t_o_r& it) │ │ │ │ │ +421 : i(it.i), window_(it.window_.getptr(),it.window_.getsize()) │ │ │ │ │ +422 {} │ │ │ │ │ +423 │ │ │ │ │ +_4_2_4 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r&& other) │ │ │ │ │ +425 { │ │ │ │ │ +426 i = other.i; │ │ │ │ │ +427 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ +not just the window! │ │ │ │ │ +428 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ +429 return *this; │ │ │ │ │ +430 } │ │ │ │ │ +431 │ │ │ │ │ +_4_3_2 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r& other) │ │ │ │ │ +433 { │ │ │ │ │ +434 i = other.i; │ │ │ │ │ +435 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ +not just the window! │ │ │ │ │ +436 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ +437 return *this; │ │ │ │ │ +438 } │ │ │ │ │ +439 │ │ │ │ │ +_4_4_1 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +442 { │ │ │ │ │ +443 ++i; │ │ │ │ │ +444 window_.setptr(window_.getptr()+window_.getsize()); │ │ │ │ │ +445 return *this; │ │ │ │ │ +446 } │ │ │ │ │ +447 │ │ │ │ │ +_4_4_9 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ +450 { │ │ │ │ │ +451 --i; │ │ │ │ │ +452 window_.setptr(window_.getptr()-window_.getsize()); │ │ │ │ │ +453 return *this; │ │ │ │ │ +454 } │ │ │ │ │ +455 │ │ │ │ │ +_4_5_7 bool _o_p_e_r_a_t_o_r_=_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +458 { │ │ │ │ │ +459 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ +460 } │ │ │ │ │ +461 │ │ │ │ │ +_4_6_3 bool _o_p_e_r_a_t_o_r_!_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +464 { │ │ │ │ │ +465 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ +466 } │ │ │ │ │ +467 │ │ │ │ │ +_4_6_9 bool _o_p_e_r_a_t_o_r_=_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +470 { │ │ │ │ │ +471 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ +472 } │ │ │ │ │ +473 │ │ │ │ │ +_4_7_5 bool _o_p_e_r_a_t_o_r_!_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +476 { │ │ │ │ │ +477 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ +478 } │ │ │ │ │ +479 │ │ │ │ │ +_4_8_1 const _w_i_n_d_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_*_ () const │ │ │ │ │ +482 { │ │ │ │ │ +483 return window_; │ │ │ │ │ +484 } │ │ │ │ │ +485 │ │ │ │ │ +_4_8_7 const _w_i_n_d_o_w___t_y_p_e* _o_p_e_r_a_t_o_r_-_>_ () const │ │ │ │ │ +488 { │ │ │ │ │ +489 return &window_; │ │ │ │ │ +490 } │ │ │ │ │ +491 │ │ │ │ │ +492 // return index corresponding to pointer │ │ │ │ │ +_4_9_3 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ +494 { │ │ │ │ │ +495 return i; │ │ │ │ │ +496 } │ │ │ │ │ +497 │ │ │ │ │ +_4_9_8 friend class _I_t_e_r_a_t_o_r; │ │ │ │ │ +499 │ │ │ │ │ +500 private: │ │ │ │ │ +501 _s_i_z_e___t_y_p_e i; │ │ │ │ │ +502 mutable _w_i_n_d_o_w___t_y_p_e window_; │ │ │ │ │ +503 }; │ │ │ │ │ +504 │ │ │ │ │ +_5_0_6 using _i_t_e_r_a_t_o_r = _I_t_e_r_a_t_o_r; │ │ │ │ │ +507 │ │ │ │ │ +_5_0_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; │ │ │ │ │ +510 │ │ │ │ │ +_5_1_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ +513 { │ │ │ │ │ +514 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, 0); │ │ │ │ │ +515 } │ │ │ │ │ +516 │ │ │ │ │ +_5_1_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ +519 { │ │ │ │ │ +520 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, rows_); │ │ │ │ │ +521 } │ │ │ │ │ +522 │ │ │ │ │ +_5_2_5 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ +526 { │ │ │ │ │ +527 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, rows_-1); │ │ │ │ │ +528 } │ │ │ │ │ +529 │ │ │ │ │ +_5_3_1 _C_o_n_s_t_I_t_e_r_a_t_o_r _r_e_n_d () const │ │ │ │ │ +532 { │ │ │ │ │ +533 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, -1); │ │ │ │ │ +534 } │ │ │ │ │ +535 │ │ │ │ │ +536 //===== sizes │ │ │ │ │ +537 │ │ │ │ │ +_5_3_9 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ +540 { │ │ │ │ │ +541 return rows_; │ │ │ │ │ +542 } │ │ │ │ │ +543 │ │ │ │ │ +544 │ │ │ │ │ +545 private: │ │ │ │ │ +546 _s_i_z_e___t_y_p_e rows_; // number of matrix rows │ │ │ │ │ +547 _s_i_z_e___t_y_p_e columns_; // number of matrix columns │ │ │ │ │ +548 │ │ │ │ │ +549 A allocator_; │ │ │ │ │ +550 }; │ │ │ │ │ +551 │ │ │ │ │ +552} // namespace MatrixImp │ │ │ │ │ +553 │ │ │ │ │ +559 template > │ │ │ │ │ +_5_6_0 class _M_a_t_r_i_x │ │ │ │ │ +561 { │ │ │ │ │ +562 public: │ │ │ │ │ +563 │ │ │ │ │ +_5_6_5 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ +566 │ │ │ │ │ +_5_6_8 typedef T _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +569 │ │ │ │ │ +_5_7_1 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +572 │ │ │ │ │ +_5_7_4 typedef typename _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_>_:_:_w_i_n_d_o_w___t_y_p_e _r_o_w___t_y_p_e; │ │ │ │ │ +575 │ │ │ │ │ +_5_7_7 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +578 │ │ │ │ │ +_5_8_0 typedef typename _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ +581 │ │ │ │ │ +_5_8_3 typedef typename row_type::iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +584 │ │ │ │ │ +_5_8_6 typedef typename _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_>_:_:_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; │ │ │ │ │ +587 │ │ │ │ │ +_5_8_9 typedef typename row_type::const_iterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +590 │ │ │ │ │ +592 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ +2.8.")]] │ │ │ │ │ +_5_9_3 static constexpr auto _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ +594 │ │ │ │ │ +_5_9_6 _M_a_t_r_i_x() : _d_a_t_a__(0,0), _c_o_l_s__(0) │ │ │ │ │ +597 {} │ │ │ │ │ +598 │ │ │ │ │ +_6_0_1 _M_a_t_r_i_x(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e cols) : _d_a_t_a__(rows,cols), _c_o_l_s__(cols) │ │ │ │ │ +602 {} │ │ │ │ │ +603 │ │ │ │ │ +_6_0_8 void _s_e_t_S_i_z_e(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e cols) { │ │ │ │ │ +609 _d_a_t_a__.resize(rows,cols); │ │ │ │ │ +610 _c_o_l_s__ = cols; │ │ │ │ │ +611 } │ │ │ │ │ +612 │ │ │ │ │ +_6_1_4 _R_o_w_I_t_e_r_a_t_o_r _b_e_g_i_n() │ │ │ │ │ +615 { │ │ │ │ │ +616 return _d_a_t_a__.begin(); │ │ │ │ │ +617 } │ │ │ │ │ +618 │ │ │ │ │ +_6_2_0 _R_o_w_I_t_e_r_a_t_o_r _e_n_d() │ │ │ │ │ +621 { │ │ │ │ │ +622 return _d_a_t_a__.end(); │ │ │ │ │ +623 } │ │ │ │ │ +624 │ │ │ │ │ +_6_2_7 _R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ +628 { │ │ │ │ │ +629 return _d_a_t_a__.beforeEnd(); │ │ │ │ │ +630 } │ │ │ │ │ +631 │ │ │ │ │ +_6_3_4 _R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ +635 { │ │ │ │ │ +636 return _d_a_t_a__.beforeBegin(); │ │ │ │ │ +637 } │ │ │ │ │ +638 │ │ │ │ │ +_6_4_0 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _b_e_g_i_n() const │ │ │ │ │ +641 { │ │ │ │ │ +642 return _d_a_t_a__.begin(); │ │ │ │ │ +643 } │ │ │ │ │ +644 │ │ │ │ │ +_6_4_6 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _e_n_d() const │ │ │ │ │ +647 { │ │ │ │ │ +648 return _d_a_t_a__.end(); │ │ │ │ │ +649 } │ │ │ │ │ +650 │ │ │ │ │ +_6_5_3 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ +654 { │ │ │ │ │ +655 return _d_a_t_a__.beforeEnd(); │ │ │ │ │ +656 } │ │ │ │ │ +657 │ │ │ │ │ +_6_6_0 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ │ +661 { │ │ │ │ │ +662 return _d_a_t_a__.beforeBegin(); │ │ │ │ │ +663 } │ │ │ │ │ +664 │ │ │ │ │ +_6_6_6 _M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& t) │ │ │ │ │ +667 { │ │ │ │ │ +668 _d_a_t_a__ = t; │ │ │ │ │ +669 return *this; │ │ │ │ │ +670 } │ │ │ │ │ +671 │ │ │ │ │ +_6_7_3 _r_o_w___t_y_p_e _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e row) { │ │ │ │ │ +674#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +675 if (row<0) │ │ │ │ │ +676 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Can't access negative rows!"); │ │ │ │ │ +677 if (row>=_N()) │ │ │ │ │ +678 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Row index out of range!"); │ │ │ │ │ +679#endif │ │ │ │ │ +680 return _d_a_t_a__[row]; │ │ │ │ │ +681 } │ │ │ │ │ +682 │ │ │ │ │ +_6_8_4 const _r_o_w___t_y_p_e _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e row) const { │ │ │ │ │ +685#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +686 if (row<0) │ │ │ │ │ +687 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Can't access negative rows!"); │ │ │ │ │ +688 if (row>=_N()) │ │ │ │ │ +689 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Row index out of range!"); │ │ │ │ │ +690#endif │ │ │ │ │ +691 return _d_a_t_a__[row]; │ │ │ │ │ +692 } │ │ │ │ │ +693 │ │ │ │ │ +_6_9_5 _s_i_z_e___t_y_p_e _N() const { │ │ │ │ │ +696 return _d_a_t_a__.N(); │ │ │ │ │ +697 } │ │ │ │ │ +698 │ │ │ │ │ +_7_0_0 _s_i_z_e___t_y_p_e _M() const { │ │ │ │ │ +701 return _c_o_l_s__; │ │ │ │ │ +702 } │ │ │ │ │ +703 │ │ │ │ │ +_7_0_5 _M_a_t_r_i_x_<_T_>& _o_p_e_r_a_t_o_r_*_=(const _f_i_e_l_d___t_y_p_e& scalar) { │ │ │ │ │ +706 _d_a_t_a__ *= scalar; │ │ │ │ │ +707 return (*this); │ │ │ │ │ +708 } │ │ │ │ │ +709 │ │ │ │ │ +_7_1_1 _M_a_t_r_i_x_<_T_>& _o_p_e_r_a_t_o_r_/_=(const _f_i_e_l_d___t_y_p_e& scalar) { │ │ │ │ │ +712 _d_a_t_a__ /= scalar; │ │ │ │ │ +713 return (*this); │ │ │ │ │ +714 } │ │ │ │ │ +715 │ │ │ │ │ +_7_2_1 _M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _M_a_t_r_i_x& b) { │ │ │ │ │ +722#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +723 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ +724 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ +725#endif │ │ │ │ │ +726 _d_a_t_a__ += b._d_a_t_a__; │ │ │ │ │ +727 return (*this); │ │ │ │ │ +728 } │ │ │ │ │ +729 │ │ │ │ │ +_7_3_5 _M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _M_a_t_r_i_x& b) { │ │ │ │ │ +736#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +737 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ +738 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ +739#endif │ │ │ │ │ +740 _d_a_t_a__ -= b._d_a_t_a__; │ │ │ │ │ +741 return (*this); │ │ │ │ │ +742 } │ │ │ │ │ +743 │ │ │ │ │ +_7_4_5 _M_a_t_r_i_x _t_r_a_n_s_p_o_s_e() const { │ │ │ │ │ +746 _M_a_t_r_i_x out(_M(), _N()); │ │ │ │ │ +747 for (_s_i_z_e___t_y_p_e i=0; i<_N(); i++) │ │ │ │ │ +748 for (_s_i_z_e___t_y_p_e j=0; j<_M(); j++) │ │ │ │ │ +749 out[j][i] = (*this)[i][j]; │ │ │ │ │ +750 │ │ │ │ │ +751 return out; │ │ │ │ │ +752 } │ │ │ │ │ +753 │ │ │ │ │ +_7_5_5 friend _M_a_t_r_i_x_<_T_> _o_p_e_r_a_t_o_r_*(const _M_a_t_r_i_x_<_T_>& m1, const _M_a_t_r_i_x_<_T_>& m2) { │ │ │ │ │ +756 _M_a_t_r_i_x_<_T_> out(m1._N(), m2._M()); │ │ │ │ │ +757 out = 0; │ │ │ │ │ +758 │ │ │ │ │ +759 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_7_7_0 friend Y _o_p_e_r_a_t_o_r_*(const _M_a_t_r_i_x_<_T_>& m, const X& vec) { │ │ │ │ │ +771#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +772 if (m._M()!=vec.size()) │ │ │ │ │ +773 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Vector size doesn't match the number of matrix │ │ │ │ │ +columns!"); │ │ │ │ │ +774#endif │ │ │ │ │ +775 Y out(m._N()); │ │ │ │ │ +776 out = 0; │ │ │ │ │ +777 │ │ │ │ │ +778 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_7_8_8 void _m_v(const X& x, Y& y) const │ │ │ │ │ +789 { │ │ │ │ │ +790#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +791 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +792 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +793#endif │ │ │ │ │ +794 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) { │ │ │ │ │ +795 y[i]=0; │ │ │ │ │ +796 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +797 { │ │ │ │ │ +798 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ +799 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ +800 Impl::asMatrix((*this)[i][j]).umv(xj, yi); │ │ │ │ │ +801 } │ │ │ │ │ +802 } │ │ │ │ │ +803 } │ │ │ │ │ +804 │ │ │ │ │ +806 template │ │ │ │ │ +_8_0_7 void _m_t_v (const X& x, Y& y) const │ │ │ │ │ +808 { │ │ │ │ │ +809#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +810 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ +811 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ +812#endif │ │ │ │ │ +813 for(_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_8_2_0 void _u_m_v(const X& x, Y& y) const │ │ │ │ │ +821 { │ │ │ │ │ +822#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +823 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +824 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +825#endif │ │ │ │ │ +826 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +827 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +828 { │ │ │ │ │ +829 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ +830 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ +831 Impl::asMatrix((*this)[i][j]).umv(xj, yi); │ │ │ │ │ +832 } │ │ │ │ │ +833 } │ │ │ │ │ +834 │ │ │ │ │ +836 template │ │ │ │ │ +_8_3_7 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ +838 { │ │ │ │ │ +839#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +840 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +841 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +842#endif │ │ │ │ │ +843 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +844 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +845 { │ │ │ │ │ +846 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ +847 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ +848 Impl::asMatrix((*this)[i][j]).mmv(xj, yi); │ │ │ │ │ +849 } │ │ │ │ │ +850 } │ │ │ │ │ +851 │ │ │ │ │ +853 template │ │ │ │ │ +_8_5_4 void _u_s_m_v(const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ +855 { │ │ │ │ │ +856#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +857 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +858 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +859#endif │ │ │ │ │ +860 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +861 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +862 { │ │ │ │ │ +863 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ +864 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ +865 Impl::asMatrix((*this)[i][j]).usmv(alpha, xj, yi); │ │ │ │ │ +866 } │ │ │ │ │ +867 } │ │ │ │ │ +868 │ │ │ │ │ +870 template │ │ │ │ │ +_8_7_1 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ +872 { │ │ │ │ │ +873#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +874 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +875 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +876#endif │ │ │ │ │ +877 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +878 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +879 { │ │ │ │ │ +880 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ +881 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ +882 Impl::asMatrix((*this)[i][j]).umtv(xi, yj); │ │ │ │ │ +883 } │ │ │ │ │ +884 } │ │ │ │ │ +885 │ │ │ │ │ +887 template │ │ │ │ │ +_8_8_8 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ +889 { │ │ │ │ │ +890#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +891 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +892 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +893#endif │ │ │ │ │ +894 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +895 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +896 { │ │ │ │ │ +897 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ +898 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ +899 Impl::asMatrix((*this)[i][j]).mmtv(xi, yj); │ │ │ │ │ +900 } │ │ │ │ │ +901 } │ │ │ │ │ +902 │ │ │ │ │ +904 template │ │ │ │ │ +_9_0_5 void _u_s_m_t_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ +906 { │ │ │ │ │ +907#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +908 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +909 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +910#endif │ │ │ │ │ +911 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +912 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +913 { │ │ │ │ │ +914 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ +915 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ +916 Impl::asMatrix((*this)[i][j]).usmtv(alpha, xi, yj); │ │ │ │ │ +917 } │ │ │ │ │ +918 } │ │ │ │ │ +919 │ │ │ │ │ +921 template │ │ │ │ │ +_9_2_2 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ +923 { │ │ │ │ │ +924#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +925 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +926 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +927#endif │ │ │ │ │ +928 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +929 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +930 { │ │ │ │ │ +931 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ +932 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ +933 Impl::asMatrix((*this)[i][j]).umhv(xi,yj); │ │ │ │ │ +934 } │ │ │ │ │ +935 } │ │ │ │ │ +936 │ │ │ │ │ +938 template │ │ │ │ │ +_9_3_9 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ +940 { │ │ │ │ │ +941#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +942 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +943 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +944#endif │ │ │ │ │ +945 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +946 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +947 { │ │ │ │ │ +948 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ +949 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ +950 Impl::asMatrix((*this)[i][j]).mmhv(xi,yj); │ │ │ │ │ +951 } │ │ │ │ │ +952 } │ │ │ │ │ +953 │ │ │ │ │ +955 template │ │ │ │ │ +_9_5_6 void _u_s_m_h_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ +957 { │ │ │ │ │ +958#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +959 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +960 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ +961#endif │ │ │ │ │ +962 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ +963 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ +964 { │ │ │ │ │ +965 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ +966 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ +967 Impl::asMatrix((*this)[i][j]).usmhv(alpha,xi,yj); │ │ │ │ │ +968 } │ │ │ │ │ +969 } │ │ │ │ │ +970 │ │ │ │ │ +971 //===== norms │ │ │ │ │ +972 │ │ │ │ │ +_9_7_4 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ │ +975 { │ │ │ │ │ +976 return std::sqrt(_f_r_o_b_e_n_i_u_s___n_o_r_m_2()); │ │ │ │ │ +977 } │ │ │ │ │ +978 │ │ │ │ │ +_9_8_0 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ +981 { │ │ │ │ │ +982 typename FieldTraits::real_type sum=0; │ │ │ │ │ +983 for (_s_i_z_e___t_y_p_e i=0; i_N(); i++) │ │ │ │ │ +984 for (_s_i_z_e___t_y_p_e j=0; j_M(); j++) │ │ │ │ │ +985 sum += Impl::asMatrix(_d_a_t_a__[i][j]).frobenius_norm2(); │ │ │ │ │ +986 return sum; │ │ │ │ │ +987 } │ │ │ │ │ +988 │ │ │ │ │ +990 template ::value, int>::type = 0> │ │ │ │ │ +_9_9_2 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +993 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +994 using std::max; │ │ │ │ │ +995 │ │ │ │ │ +996 real_type norm = 0; │ │ │ │ │ +997 for (auto const &x : *this) { │ │ │ │ │ +998 real_type sum = 0; │ │ │ │ │ +999 for (auto const &y : x) │ │ │ │ │ +1000 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ +1001 norm = max(sum, norm); │ │ │ │ │ +1002 isNaN += sum; │ │ │ │ │ +1003 } │ │ │ │ │ +1004 │ │ │ │ │ +1005 return norm; │ │ │ │ │ +1006 } │ │ │ │ │ +1007 │ │ │ │ │ +1009 template ::value, int>::type = 0> │ │ │ │ │ +_1_0_1_1 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +1012 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1013 using std::max; │ │ │ │ │ +1014 │ │ │ │ │ +1015 real_type norm = 0; │ │ │ │ │ +1016 for (auto const &x : *this) { │ │ │ │ │ +1017 real_type sum = 0; │ │ │ │ │ +1018 for (auto const &y : x) │ │ │ │ │ +1019 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ +1020 norm = max(sum, norm); │ │ │ │ │ +1021 } │ │ │ │ │ +1022 return norm; │ │ │ │ │ +1023 } │ │ │ │ │ +1024 │ │ │ │ │ +1026 template ::value, int>::type = 0> │ │ │ │ │ +_1_0_2_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +1029 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1030 using std::max; │ │ │ │ │ +1031 │ │ │ │ │ +1032 real_type norm = 0; │ │ │ │ │ +1033 real_type isNaN = 1; │ │ │ │ │ +1034 for (auto const &x : *this) { │ │ │ │ │ +1035 real_type sum = 0; │ │ │ │ │ +1036 for (auto const &y : x) │ │ │ │ │ +1037 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ +1038 norm = max(sum, norm); │ │ │ │ │ +1039 isNaN += sum; │ │ │ │ │ +1040 } │ │ │ │ │ +1041 │ │ │ │ │ +1042 return norm * (isNaN / isNaN); │ │ │ │ │ +1043 } │ │ │ │ │ +1044 │ │ │ │ │ +1046 template ::value, int>::type = 0> │ │ │ │ │ +_1_0_4_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +1049 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1050 using std::max; │ │ │ │ │ +1051 │ │ │ │ │ +1052 real_type norm = 0; │ │ │ │ │ +1053 real_type isNaN = 1; │ │ │ │ │ +1054 for (auto const &x : *this) { │ │ │ │ │ +1055 real_type sum = 0; │ │ │ │ │ +1056 for (auto const &y : x) │ │ │ │ │ +1057 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ +1058 norm = max(sum, norm); │ │ │ │ │ +1059 isNaN += sum; │ │ │ │ │ +1060 } │ │ │ │ │ +1061 │ │ │ │ │ +1062 return norm * (isNaN / isNaN); │ │ │ │ │ +1063 } │ │ │ │ │ +1064 │ │ │ │ │ +1065 //===== query │ │ │ │ │ +1066 │ │ │ │ │ +_1_0_6_8 bool _e_x_i_s_t_s ([[maybe_unused]] _s_i_z_e___t_y_p_e i, [[maybe_unused]] _s_i_z_e___t_y_p_e j) │ │ │ │ │ +const │ │ │ │ │ +1069 { │ │ │ │ │ +1070#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1071 if (i<0 || i>=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"row index out of range"); │ │ │ │ │ +1072 if (j<0 || i>=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"column index out of range"); │ │ │ │ │ +1073#endif │ │ │ │ │ +1074 return true; │ │ │ │ │ +1075 } │ │ │ │ │ +1076 │ │ │ │ │ +1077 protected: │ │ │ │ │ +1078 │ │ │ │ │ +_1_0_8_1 _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_> _d_a_t_a__; │ │ │ │ │ +1082 │ │ │ │ │ +_1_0_8_8 _s_i_z_e___t_y_p_e _c_o_l_s__; │ │ │ │ │ +1089 }; │ │ │ │ │ +1090 │ │ │ │ │ +1091 template │ │ │ │ │ +_1_0_9_2 struct FieldTraits< _M_a_t_r_i_x > │ │ │ │ │ +1093 { │ │ │ │ │ +_1_0_9_4 using _f_i_e_l_d___t_y_p_e = typename _M_a_t_r_i_x_<_T_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_0_9_5 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ +1096 }; │ │ │ │ │ +1097 │ │ │ │ │ +1099} // end namespace Dune │ │ │ │ │ +1100 │ │ │ │ │ +1101#endif │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ +_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... │ │ │ │ │ -_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ │ -_g_s_e_t_c_._h_h │ │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ -generic way. │ │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ │ -_v_b_v_e_c_t_o_r_._h_h │ │ │ │ │ -??? │ │ │ │ │ -_i_l_u_._h_h │ │ │ │ │ -The incomplete LU factorization kernels. │ │ │ │ │ -_s_o_l_v_e_r_s_._h_h │ │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ │ -_i_o_._h_h │ │ │ │ │ -Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ -Define general preconditioner interface. │ │ │ │ │ -_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_:_:_b_s_o_r_b │ │ │ │ │ -void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -SSOR step. │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:646 │ │ │ │ │ -_D_u_n_e_:_:_b_s_o_r_f │ │ │ │ │ -void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -SOR step. │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:634 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -A linear operator exporting itself in matrix form. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:109 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ -An overlapping Schwarz operator. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -const communication_type & getCommunication() const │ │ │ │ │ -Get the object responsible for communication. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:146 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_g_e_t_m_a_t │ │ │ │ │ -virtual const matrix_type & getmat() const │ │ │ │ │ -get the sequential assembled linear operator. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:133 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ -virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const │ │ │ │ │ -apply operator to x, scale and add: │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:125 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(const X &x, Y &y) const │ │ │ │ │ -apply operator to x: │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ │ -C communication_type │ │ │ │ │ -The type of the communication object. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:98 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The type of the domain. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -The type of the matrix we operate on. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The type of the range. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the range. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ -OverlappingSchwarzOperator(const matrix_type &A, const communication_type &com) │ │ │ │ │ -constructor: just store a reference to a matrix. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:107 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ -OverlappingSchwarzOperator(const std::shared_ptr< matrix_type > A, const │ │ │ │ │ -communication_type &com) │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:111 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the linear operator (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:139 │ │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R │ │ │ │ │ -A parallel SSOR preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:175 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:184 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ │ -C communication_type │ │ │ │ │ -The type of the communication object. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:186 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:233 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_P_a_r_S_S_O_R │ │ │ │ │ -ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:197 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:178 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ │ -Apply the precondtioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:206 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -Block parallel preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:326 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:285 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -BlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:317 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ │ -Apply the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:337 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -BlockPreconditioner(P &p, const communication_type &c) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:306 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ │ -void apply(X &v, const Y &d) │ │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:344 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ │ -C communication_type │ │ │ │ │ -The type of the communication object.. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:297 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:292 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:355 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:290 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:361 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -Category │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ │ -@ overlapping │ │ │ │ │ -Category for overlapping solvers. │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:29 │ │ │ │ │ +_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:395 │ │ │ │ │ +_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_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ +A Vector of blocks with different blocksizes. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_w_i_n_d_o_w___t_y_p_e │ │ │ │ │ +Imp::BlockVectorWindow< B, A > window_type │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +BlockVector< B, A > block_type │ │ │ │ │ +Same as value_type, here for historical reasons. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +DenseMatrixBase & operator=(const DenseMatrixBase &a) │ │ │ │ │ +assignment │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +Iterator beforeBegin() const │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:385 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_r_e_s_i_z_e │ │ │ │ │ +void resize(size_type rows, size_type columns) │ │ │ │ │ +same effect as constructor with same argument │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ +const window_type const_reference │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ +DenseMatrixBase(size_type rows, size_type columns) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_e_n_d │ │ │ │ │ +Iterator end() │ │ │ │ │ +end Iterator │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:371 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +reference operator[](size_type i) │ │ │ │ │ +random access to blocks │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:241 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_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 matrix.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_f_i_n_d │ │ │ │ │ +Iterator find(size_type i) │ │ │ │ │ +random access returning iterator (end if not contained) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:391 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_N │ │ │ │ │ +size_type N() const │ │ │ │ │ +number of blocks in the vector (are of variable size here) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:539 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +ConstIterator beforeEnd() const │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:525 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_e_n_d │ │ │ │ │ +ConstIterator end() const │ │ │ │ │ +end ConstIterator │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:518 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ +window_type reference │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_r_e_n_d │ │ │ │ │ +ConstIterator rend() const │ │ │ │ │ +end ConstIterator │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:531 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +Iterator beforeEnd() │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:378 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_g_i_n │ │ │ │ │ +ConstIterator begin() const │ │ │ │ │ +begin ConstIterator │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:512 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +A allocator_type │ │ │ │ │ +export the allocator type │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ +DenseMatrixBase() │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_f_i_n_d │ │ │ │ │ +ConstIterator find(size_type i) const │ │ │ │ │ +random access returning iterator (end if not contained) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:397 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The size type for the index access. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_~_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ +~DenseMatrixBase() │ │ │ │ │ +free dynamic memory │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_g_i_n │ │ │ │ │ +Iterator begin() │ │ │ │ │ +begin Iterator │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:365 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ +DenseMatrixBase(const DenseMatrixBase &a) │ │ │ │ │ +copy constructor, has copy semantics │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ +Iterator & operator--() │ │ │ │ │ +prefix decrement │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:308 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ +size_type index() const │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:352 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator(Iterator &other)=default │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator(Iterator &&other)=default │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const Iterator &it) const │ │ │ │ │ +inequality │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:322 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +Iterator & operator=(Iterator &&other) │ │ │ │ │ +Move assignment. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +Iterator & operator++() │ │ │ │ │ +prefix increment │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator() │ │ │ │ │ +constructor, no arguments │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:266 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +window_type & operator*() const │ │ │ │ │ +dereferencing │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:340 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const Iterator &it) const │ │ │ │ │ +equality │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:316 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +Iterator & operator=(Iterator &other) │ │ │ │ │ +Copy assignment. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:291 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator(B *data, size_type columns, size_type _i) │ │ │ │ │ +constructor │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ +window_type * operator->() const │ │ │ │ │ +arrow │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:346 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ +const window_type * operator->() const │ │ │ │ │ +arrow │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:487 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +const window_type & operator*() const │ │ │ │ │ +dereferencing │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:481 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +ConstIterator & operator++() │ │ │ │ │ +prefix increment │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:441 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator(const B *data, size_type columns, size_type _i) │ │ │ │ │ +constructor from pointer │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:414 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ +ConstIterator & operator--() │ │ │ │ │ +prefix decrement │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator(const Iterator &it) │ │ │ │ │ +constructor from non_const iterator │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:420 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const ConstIterator &it) const │ │ │ │ │ +inequality │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:463 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator() │ │ │ │ │ +constructor │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:407 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const ConstIterator &it) const │ │ │ │ │ +equality │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:457 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ +size_type index() const │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:493 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +ConstIterator & operator=(Iterator &&other) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:424 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +ConstIterator & operator=(Iterator &other) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:432 │ │ │ │ │ +_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_l_s__ │ │ │ │ │ +size_type cols_ │ │ │ │ │ +Number of columns of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:1088 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ +FieldTraits< ft >::real_type infinity_norm() const │ │ │ │ │ +infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:992 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +A allocator_type │ │ │ │ │ +Export the allocator. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:571 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ +FieldTraits< ft >::real_type infinity_norm_real() const │ │ │ │ │ +simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:1011 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ +void usmhv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^H x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:956 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ +void usmv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:854 │ │ │ │ │ +_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_:_:_d_a_t_a__ │ │ │ │ │ +MatrixImp::DenseMatrixBase< T, A > data_ │ │ │ │ │ +Abuse DenseMatrixBase as an engine for a 2d array ISTL-style. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:1081 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_t_r_a_n_s_p_o_s_e │ │ │ │ │ +Matrix transpose() const │ │ │ │ │ +Return the transpose of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:745 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ +void mtv(const X &x, Y &y) const │ │ │ │ │ +y = A^T x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:807 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ +void umv(const X &x, Y &y) const │ │ │ │ │ +y += A x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:820 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ +void mv(const X &x, Y &y) const │ │ │ │ │ +y = A x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:788 │ │ │ │ │ +_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_:_:_s_e_t_S_i_z_e │ │ │ │ │ +void setSize(size_type rows, size_type cols) │ │ │ │ │ +Change the matrix size. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:608 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +RowIterator beforeBegin() │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:634 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +RowIterator beforeEnd() │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:627 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M_a_t_r_i_x │ │ │ │ │ +Matrix() │ │ │ │ │ +Create empty matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:596 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ +Matrix & operator-=(const Matrix &b) │ │ │ │ │ +Subtract the entries of another matrix from this one. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:735 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ +FieldTraits< field_type >::real_type frobenius_norm2() const │ │ │ │ │ +square of frobenius norm, need for block recursion │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:980 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::iterator ColIterator │ │ │ │ │ +Iterator for the entries of each row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:583 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +ConstRowIterator beforeEnd() const │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:653 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +Matrix & operator=(const field_type &t) │ │ │ │ │ +Assignment from scalar. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:666 │ │ │ │ │ +_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:620 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +const row_type operator[](size_type row) const │ │ │ │ │ +The const index operator. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:684 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +ConstRowIterator end() const │ │ │ │ │ +Get const iterator to one beyond last row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:646 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +friend Y operator*(const Matrix< T > &m, const X &vec) │ │ │ │ │ +Generic matrix-vector multiplication. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:770 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ +Matrix< T > & operator*=(const field_type &scalar) │ │ │ │ │ +Multiplication with a scalar. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:705 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +row_type operator[](size_type row) │ │ │ │ │ +The index operator. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:673 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ +void mmv(const X &x, Y &y) const │ │ │ │ │ +y -= A x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:837 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ +Matrix & operator+=(const Matrix &b) │ │ │ │ │ +Add the entries of another matrix to this one. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:721 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ +ConstRowIterator begin() const │ │ │ │ │ +Get const iterator to first row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:640 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ +void mmhv(const X &x, Y &y) const │ │ │ │ │ +y -= A^H x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:939 │ │ │ │ │ +_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:614 │ │ │ │ │ +_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_l_e_v_e_l │ │ │ │ │ +static constexpr auto blocklevel │ │ │ │ │ +The number of nesting levels the matrix contains. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:593 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M │ │ │ │ │ +size_type M() const │ │ │ │ │ +Return the number of columns. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:700 │ │ │ │ │ +_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_:_:_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 pattern │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:1068 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ +Matrix< T > & operator/=(const field_type &scalar) │ │ │ │ │ +Division by a scalar. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:711 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +friend Matrix< T > operator*(const Matrix< T > &m1, const Matrix< T > &m2) │ │ │ │ │ +Generic matrix multiplication. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:755 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ +void umtv(const X &x, Y &y) const │ │ │ │ │ +y += A^T x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:871 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ +void mmtv(const X &x, Y &y) const │ │ │ │ │ +y -= A^T x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:888 │ │ │ │ │ +_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_:_:_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ +FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ +frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:974 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ +void usmtv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^T x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:905 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ +void umhv(const X &x, Y &y) const │ │ │ │ │ +y += A^H x │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:922 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ +size_type N() const │ │ │ │ │ +Return the number of rows. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +ConstRowIterator beforeBegin() const │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:660 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M_a_t_r_i_x │ │ │ │ │ +Matrix(size_type rows, size_type cols) │ │ │ │ │ +Create uninitialized matrix of size rows x cols. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:601 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +MatrixImp::DenseMatrixBase< T, A >::Iterator RowIterator │ │ │ │ │ +Iterator over the matrix rows. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:580 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Matrix< T, A >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:1094 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:1095 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: repartition.hh File Reference │ │ │ │ +dune-istl: matrixredistribute.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,100 +72,85 @@ │ │ │ │

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

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

Functionality for redistributing a sparse matrix. │ │ │ │ More...

│ │ │ │ -
#include <cassert>
│ │ │ │ -#include <map>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <cmath>
│ │ │ │ -#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 <memory>
│ │ │ │ +#include "repartition.hh"
│ │ │ │ +#include <dune/common/exceptions.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/istl/owneroverlapcopy.hh>
│ │ │ │ +#include <dune/istl/paamg/pinfo.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::RedistributeInterface
struct  Dune::RedistributeInformation< T >
 
class  Dune::RedistributeInformation< OwnerOverlapCopyCommunication< T, T1 > >
 
struct  Dune::CommMatrixRowSize< M, RI >
 Utility class to communicate and set the row sizes of a redistributed matrix. More...
 
struct  Dune::CommMatrixSparsityPattern< M, I >
 Utility class to communicate and build the sparsity pattern of a redistributed matrix. More...
 
struct  Dune::CommPolicy< CommMatrixSparsityPattern< M, I > >
 
struct  Dune::CommMatrixRow< M, I >
 Utility class for comunicating the matrix entries. More...
 
struct  Dune::CommPolicy< CommMatrixRow< M, I > >
 
struct  Dune::MatrixRowSizeGatherScatter< M, I, RI >
 
struct  Dune::MatrixCopyRowSizeGatherScatter< M, I, RI >
 
struct  Dune::MatrixSparsityPatternGatherScatter< M, I >
 
struct  Dune::MatrixRowGatherScatter< M, I >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Typedefs

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

│ │ │ │ Functions

template<class G , class T1 , class T2 >
void Dune::fillIndexSetHoles (const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
 Fills the holes in an index set.
 
template<class G , class T1 , class T2 >
bool Dune::buildCommunication (const G &graph, std::vector< int > &realparts, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 
template<class S , class T >
void Dune::print_carray (S &os, T *array, std::size_t l)
 
template<class S , class T >
bool Dune::isValidGraph (std::size_t noVtx, std::size_t gnoVtx, S noEdges, T *xadj, T *adjncy, bool checkSymmetry)
 
template<class M , class T1 , class T2 >
bool Dune::commGraphRepartition (const M &mat, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 
template<class G , class T1 , class T2 >
bool Dune::graphRepartition (const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 execute a graph repartition for a giving graph and indexset.
 
template<typename M , typename C >
void Dune::redistributeSparsityPattern (M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
 
template<typename M , typename C >
void Dune::redistributeMatrixEntries (M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
 
template<typename M , typename C >
void Dune::redistributeMatrix (M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
 Redistribute a matrix according to given domain decompositions.
 
template<typename M >
void Dune::redistributeMatrixEntries (M &origMatrix, M &newMatrix, Dune::Amg::SequentialInformation &origComm, Dune::Amg::SequentialInformation &newComm, RedistributeInformation< Dune::Amg::SequentialInformation > &ri)
 
template<typename M >
void Dune::redistributeMatrix (M &origMatrix, M &newMatrix, Dune::Amg::SequentialInformation &origComm, Dune::Amg::SequentialInformation &newComm, RedistributeInformation< Dune::Amg::SequentialInformation > &ri)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Functionality for redistributing a parallel index set using graph partitioning.

│ │ │ │ -

Refactored version of an intern.

Author
Markus Blatt
│ │ │ │ -

Variable Documentation

│ │ │ │ - │ │ │ │ -

◆ globalOwnerVertices

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

Functionality for redistributing a sparse matrix.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,81 +1,80 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -#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 │ │ │ │ │ +matrixredistribute.hh File Reference │ │ │ │ │ +Functionality for redistributing a sparse matrix. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include "_r_e_p_a_r_t_i_t_i_o_n_._h_h" │ │ │ │ │ +#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 <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_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_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ │ +struct   _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_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ + class   _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_<_ _O_w_n_e_r_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_ _> │ │ │ │ │ + _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_ _M_,_ _R_I_ _> │ │ │ │ │ +  Utility class to communicate and set the row sizes of a redistributed │ │ │ │ │ + matrix. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _> │ │ │ │ │ +  Utility class to communicate and build the sparsity pattern of a │ │ │ │ │ + redistributed matrix. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _> │ │ │ │ │ +  Utility class for comunicating the matrix entries. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_M_e_t_i_s │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _> │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -using  _D_u_n_e_:_:_M_e_t_i_s_:_:_r_e_a_l___t = float │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_,_ _R_I_ _> │ │ │ │ │   │ │ │ │ │ -using  _D_u_n_e_:_:_M_e_t_i_s_:_:_i_d_x___t = std::size_t │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_,_ _R_I_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_ _> │ │ │ │ │ +  │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s (const G &graph, _D_u_n_e_:_: │ │ │ │ │ - _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm) │ │ │ │ │ -  Fills the holes in an index set. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n (const G &graph, std::vector< int > &realparts, │ │ │ │ │ - _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, std::shared_ptr< │ │ │ │ │ - _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > &outcomm, │ │ │ │ │ - _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_p_r_i_n_t___c_a_r_r_a_y (S &os, T *array, std::size_t l) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_i_s_V_a_l_i_d_G_r_a_p_h (std::size_t noVtx, std::size_t gnoVtx, S noEdges, T │ │ │ │ │ - *xadj, T *adjncy, bool checkSymmetry) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n (const M &_m_a_t, _D_u_n_e_:_: │ │ │ │ │ - _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ │ - std::shared_ptr< _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > │ │ │ │ │ - &outcomm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_g_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n (const G &graph, _D_u_n_e_:_: │ │ │ │ │ - _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ │ - std::shared_ptr< _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > │ │ │ │ │ - &outcomm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ │ -  execute a graph repartition for a giving graph and indexset. │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n (M &origMatrix, M &newMatrix, C │ │ │ │ │ + &origComm, 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) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _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 (M &origMatrix, M &newMatrix, C │ │ │ │ │ + &origComm, 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) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (M &origMatrix, M &newMatrix, C &origComm, 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) │ │ │ │ │ +  Redistribute a matrix according to given domain decompositions. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _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 (M &origMatrix, M &newMatrix, _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 &origComm, _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 │ │ │ │ │ + &newComm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< _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 > │ │ │ │ │ + &ri) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (M &origMatrix, M &newMatrix, _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 &origComm, _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 │ │ │ │ │ + &newComm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< _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 > │ │ │ │ │ + &ri) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Functionality for redistributing a parallel index set using graph partitioning. │ │ │ │ │ -Refactored version of an intern. │ │ │ │ │ +Functionality for redistributing a sparse matrix. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ -********** VVaarriiaabbllee DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? gglloobbaallOOwwnneerrVVeerrttiicceess ********** │ │ │ │ │ -int globalOwnerVertices │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: repartition.hh Source File │ │ │ │ +dune-istl: matrixredistribute.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,1851 +74,996 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
repartition.hh
│ │ │ │ +
matrixredistribute.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ -
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". Therfore no nested extern "C" will be created
│ │ │ │ -
17extern "C"
│ │ │ │ -
18{
│ │ │ │ -
19#include <parmetis.h>
│ │ │ │ -
20}
│ │ │ │ -
21#endif
│ │ │ │ -
22
│ │ │ │ -
23#include <dune/common/timer.hh>
│ │ │ │ -
24#include <dune/common/enumset.hh>
│ │ │ │ -
25#include <dune/common/stdstreams.hh>
│ │ │ │ -
26#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ -
27#include <dune/common/parallel/communicator.hh>
│ │ │ │ -
28#include <dune/common/parallel/indexset.hh>
│ │ │ │ -
29#include <dune/common/parallel/indicessyncer.hh>
│ │ │ │ -
30#include <dune/common/parallel/remoteindices.hh>
│ │ │ │ -
31#include <dune/common/rangeutilities.hh>
│ │ │ │ -
32
│ │ │ │ - │ │ │ │ - │ │ │ │ -
35
│ │ │ │ -
44namespace Dune
│ │ │ │ -
45{
│ │ │ │ -
│ │ │ │ -
46 namespace Metis
│ │ │ │ -
47 {
│ │ │ │ -
48 // Explicitly specify a real_t and idx_t for older (Par)METIS versions that do not
│ │ │ │ -
49 // provide these typedefs
│ │ │ │ -
50#if HAVE_PARMETIS && defined(REALTYPEWIDTH)
│ │ │ │ -
51 using real_t = ::real_t;
│ │ │ │ -
52#else
│ │ │ │ -
53 using real_t = float;
│ │ │ │ -
54#endif
│ │ │ │ -
55
│ │ │ │ -
56#if HAVE_PARMETIS && defined(IDXTYPEWIDTH)
│ │ │ │ -
57 using idx_t = ::idx_t;
│ │ │ │ -
58#elif HAVE_PARMETIS && defined(HAVE_SCOTCH_NUM_TYPE)
│ │ │ │ -
59 using idx_t = SCOTCH_Num;
│ │ │ │ -
60#elif HAVE_PARMETIS
│ │ │ │ -
61 using idx_t = int;
│ │ │ │ -
62#else
│ │ │ │ -
63 using idx_t = std::size_t;
│ │ │ │ -
64#endif
│ │ │ │ -
65 }
│ │ │ │ -
│ │ │ │ -
66
│ │ │ │ -
67
│ │ │ │ -
68#if HAVE_MPI
│ │ │ │ -
82 template<class G, class T1, class T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
84 {
│ │ │ │ - │ │ │ │ -
86 typedef typename IndexSet::LocalIndex::Attribute Attribute;
│ │ │ │ -
87
│ │ │ │ -
88 IndexSet& indexSet = oocomm.indexSet();
│ │ │ │ - │ │ │ │ -
90
│ │ │ │ -
91 std::size_t sum=0, needed = graph.noVertices()-indexSet.size();
│ │ │ │ -
92 std::vector<std::size_t> neededall(oocomm.communicator().size(), 0);
│ │ │ │ -
93
│ │ │ │ -
94 MPI_Allgather(&needed, 1, MPITraits<std::size_t>::getType() , &(neededall[0]), 1, MPITraits<std::size_t>::getType(), oocomm.communicator());
│ │ │ │ -
95 for(int i=0; i<oocomm.communicator().size(); ++i)
│ │ │ │ -
96 sum=sum+neededall[i]; // MAke this for generic
│ │ │ │ -
97
│ │ │ │ -
98 if(sum==0)
│ │ │ │ -
99 // Nothing to do
│ │ │ │ -
100 return;
│ │ │ │ +
5#ifndef DUNE_ISTL_MATRIXREDISTRIBUTE_HH
│ │ │ │ +
6#define DUNE_ISTL_MATRIXREDISTRIBUTE_HH
│ │ │ │ +
7#include <memory>
│ │ │ │ +
8#include "repartition.hh"
│ │ │ │ +
9#include <dune/common/exceptions.hh>
│ │ │ │ +
10#include <dune/common/parallel/indexset.hh>
│ │ │ │ + │ │ │ │ + │ │ │ │ +
18namespace Dune
│ │ │ │ +
19{
│ │ │ │ +
20 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
22 {
│ │ │ │ +
│ │ │ │ +
23 bool isSetup() const
│ │ │ │ +
24 {
│ │ │ │ +
25 return false;
│ │ │ │ +
26 }
│ │ │ │ +
│ │ │ │ +
27 template<class D>
│ │ │ │ +
│ │ │ │ +
28 void redistribute([[maybe_unused]] const D& from, [[maybe_unused]] D& to) const
│ │ │ │ +
29 {}
│ │ │ │ +
│ │ │ │ +
30
│ │ │ │ +
31 template<class D>
│ │ │ │ +
│ │ │ │ +
32 void redistributeBackward([[maybe_unused]] D& from, [[maybe_unused]]const D& to) const
│ │ │ │ +
33 {}
│ │ │ │ +
│ │ │ │ +
34
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
36 {}
│ │ │ │ +
│ │ │ │ +
37
│ │ │ │ +
│ │ │ │ +
38 void setNoRows([[maybe_unused]] std::size_t size)
│ │ │ │ +
39 {}
│ │ │ │ +
│ │ │ │ +
40
│ │ │ │ +
│ │ │ │ +
41 void setNoCopyRows([[maybe_unused]] std::size_t size)
│ │ │ │ +
42 {}
│ │ │ │ +
│ │ │ │ +
43
│ │ │ │ +
│ │ │ │ +
44 void setNoBackwardsCopyRows([[maybe_unused]] std::size_t size)
│ │ │ │ +
45 {}
│ │ │ │ +
│ │ │ │ +
46
│ │ │ │ +
│ │ │ │ +
47 std::size_t getRowSize([[maybe_unused]] std::size_t index) const
│ │ │ │ +
48 {
│ │ │ │ +
49 return -1;
│ │ │ │ +
50 }
│ │ │ │ +
│ │ │ │ +
51
│ │ │ │ +
│ │ │ │ +
52 std::size_t getCopyRowSize([[maybe_unused]] std::size_t index) const
│ │ │ │ +
53 {
│ │ │ │ +
54 return -1;
│ │ │ │ +
55 }
│ │ │ │ +
│ │ │ │ +
56
│ │ │ │ +
│ │ │ │ +
57 std::size_t getBackwardsCopyRowSize([[maybe_unused]] std::size_t index) const
│ │ │ │ +
58 {
│ │ │ │ +
59 return -1;
│ │ │ │ +
60 }
│ │ │ │ +
│ │ │ │ +
61
│ │ │ │ +
62 };
│ │ │ │ +
│ │ │ │ +
63
│ │ │ │ +
64#if HAVE_MPI
│ │ │ │ +
65 template<typename T, typename T1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
67 {
│ │ │ │ +
68 public:
│ │ │ │ + │ │ │ │ +
70
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
72 : interface(), setup_(false)
│ │ │ │ +
73 {}
│ │ │ │ +
│ │ │ │ +
74
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
76 {
│ │ │ │ +
77 return interface;
│ │ │ │ +
78 }
│ │ │ │ +
│ │ │ │ +
79 template<typename IS>
│ │ │ │ +
│ │ │ │ +
80 void checkInterface(const IS& source,
│ │ │ │ +
81 const IS& target, MPI_Comm comm)
│ │ │ │ +
82 {
│ │ │ │ +
83 auto ri = std::make_unique<RemoteIndices<IS> >(source, target, comm);
│ │ │ │ +
84 ri->template rebuild<true>();
│ │ │ │ +
85 Interface inf;
│ │ │ │ + │ │ │ │ +
87 int rank;
│ │ │ │ +
88 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ +
89 inf.free();
│ │ │ │ +
90 inf.build(*ri, flags, flags);
│ │ │ │ +
91
│ │ │ │ +
92
│ │ │ │ +
93#ifdef DEBUG_REPART
│ │ │ │ +
94 if(inf!=interface) {
│ │ │ │ +
95
│ │ │ │ +
96 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ +
97 if(rank==0)
│ │ │ │ +
98 std::cout<<"Interfaces do not match!"<<std::endl;
│ │ │ │ +
99 std::cout<<rank<<": redist interface new :"<<inf<<std::endl;
│ │ │ │ +
100 std::cout<<rank<<": redist interface :"<<interface<<std::endl;
│ │ │ │
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; //Sart with the next free index.
│ │ │ │ -
113
│ │ │ │ -
114 for(int i=0; i<oocomm.communicator().rank(); ++i)
│ │ │ │ -
115 maxgi=maxgi+neededall[i]; // TODO: make this more generic
│ │ │ │ +
102 throw "autsch!";
│ │ │ │ +
103 }
│ │ │ │ +
104#endif
│ │ │ │ +
105 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
106 void setSetup()
│ │ │ │ +
107 {
│ │ │ │ +
108 setup_=true;
│ │ │ │ +
109 interface.strip();
│ │ │ │ +
110 }
│ │ │ │ +
│ │ │ │ +
111
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
113 {
│ │ │ │ +
114 setup_=false;
│ │ │ │ +
115 }
│ │ │ │ +
│ │ │ │
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);
│ │ │ │ +
117 template<class GatherScatter, class D>
│ │ │ │ +
│ │ │ │ +
118 void redistribute(const D& from, D& to) const
│ │ │ │ +
119 {
│ │ │ │ +
120 BufferedCommunicator communicator;
│ │ │ │ +
121 communicator.template build<D>(from,to, interface);
│ │ │ │ +
122 communicator.template forward<GatherScatter>(from, to);
│ │ │ │ +
123 communicator.free();
│ │ │ │ +
124 }
│ │ │ │ +
│ │ │ │ +
125 template<class GatherScatter, class D>
│ │ │ │ +
│ │ │ │ +
126 void redistributeBackward(D& from, const D& to) const
│ │ │ │ +
127 {
│ │ │ │ +
128
│ │ │ │ +
129 BufferedCommunicator communicator;
│ │ │ │ +
130 communicator.template build<D>(from,to, interface);
│ │ │ │ +
131 communicator.template backward<GatherScatter>(from, to);
│ │ │ │ +
132 communicator.free();
│ │ │ │ +
133 }
│ │ │ │ +
│ │ │ │
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 }
│ │ │ │ - │ │ │ │ -
176 private:
│ │ │ │ -
177 int base_;
│ │ │ │ -
178 std::vector<int> duneToParmetis;
│ │ │ │ -
179 std::vector<int> parmetisToDune;
│ │ │ │ -
180 // range of vertices for processor i: vtxdist[i] to vtxdist[i+1] (parmetis global)
│ │ │ │ -
181 std::vector<Metis::idx_t> vtxDist_;
│ │ │ │ -
182 };
│ │ │ │ -
183
│ │ │ │ -
184 template<class G, class OOComm>
│ │ │ │ -
185 ParmetisDuneIndexMap::ParmetisDuneIndexMap(const G& graph, const OOComm& oocomm)
│ │ │ │ -
186 : duneToParmetis(graph.noVertices(), -1), vtxDist_(oocomm.communicator().size()+1)
│ │ │ │ -
187 {
│ │ │ │ -
188 int npes=oocomm.communicator().size(), mype=oocomm.communicator().rank();
│ │ │ │ -
189
│ │ │ │ -
190 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ │ -
191
│ │ │ │ -
192 int numOfOwnVtx=0;
│ │ │ │ -
193 auto end = oocomm.indexSet().end();
│ │ │ │ -
194 for(auto index = oocomm.indexSet().begin(); index != end; ++index) {
│ │ │ │ -
195 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ │ -
196 numOfOwnVtx++;
│ │ │ │ -
197 }
│ │ │ │ -
198 }
│ │ │ │ -
199 parmetisToDune.resize(numOfOwnVtx);
│ │ │ │ -
200 std::vector<int> globalNumOfVtx(npes);
│ │ │ │ -
201 // make this number available to all processes
│ │ │ │ -
202 MPI_Allgather(&numOfOwnVtx, 1, MPI_INT, &(globalNumOfVtx[0]), 1, MPI_INT, oocomm.communicator());
│ │ │ │ -
203
│ │ │ │ -
204 int base=0;
│ │ │ │ -
205 vtxDist_[0] = 0;
│ │ │ │ -
206 for(int i=0; i<npes; i++) {
│ │ │ │ -
207 if (i<mype) {
│ │ │ │ -
208 base += globalNumOfVtx[i];
│ │ │ │ -
209 }
│ │ │ │ -
210 vtxDist_[i+1] = vtxDist_[i] + globalNumOfVtx[i];
│ │ │ │ -
211 }
│ │ │ │ -
212 globalOwnerVertices=vtxDist_[npes];
│ │ │ │ -
213 base_=base;
│ │ │ │ -
214
│ │ │ │ -
215#ifdef DEBUG_REPART
│ │ │ │ -
216 std::cout << oocomm.communicator().rank()<<" vtxDist: ";
│ │ │ │ -
217 for(int i=0; i<= npes; ++i)
│ │ │ │ -
218 std::cout << vtxDist_[i]<<" ";
│ │ │ │ -
219 std::cout<<std::endl;
│ │ │ │ -
220#endif
│ │ │ │ -
221
│ │ │ │ -
222 // Traverse the graph and assign a new consecutive number/index
│ │ │ │ -
223 // starting by "base" to all owner vertices.
│ │ │ │ -
224 // The new index is used as the ParMETIS global index and is
│ │ │ │ -
225 // stored in the vector "duneToParmetis"
│ │ │ │ -
226 auto vend = graph.end();
│ │ │ │ -
227 for(auto vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ │ -
228 const typename OOComm::ParallelIndexSet::IndexPair* index=oocomm.globalLookup().pair(*vertex);
│ │ │ │ -
229 assert(index);
│ │ │ │ -
230 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ │ -
231 // assign and count the index
│ │ │ │ -
232 parmetisToDune[base-base_]=index->local();
│ │ │ │ -
233 duneToParmetis[index->local()] = base++;
│ │ │ │ -
234 }
│ │ │ │ -
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 }
│ │ │ │ +
135 template<class D>
│ │ │ │ +
│ │ │ │ +
136 void redistribute(const D& from, D& to) const
│ │ │ │ +
137 {
│ │ │ │ +
138 redistribute<CopyGatherScatter<D> >(from,to);
│ │ │ │ +
139 }
│ │ │ │ +
│ │ │ │ +
140 template<class D>
│ │ │ │ +
│ │ │ │ +
141 void redistributeBackward(D& from, const D& to) const
│ │ │ │ +
142 {
│ │ │ │ +
143 redistributeBackward<CopyGatherScatter<D> >(from,to);
│ │ │ │ +
144 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
145 bool isSetup() const
│ │ │ │ +
146 {
│ │ │ │ +
147 return setup_;
│ │ │ │ +
148 }
│ │ │ │ +
│ │ │ │ +
149
│ │ │ │ +
│ │ │ │ +
150 void reserve(std::size_t size)
│ │ │ │ +
151 {}
│ │ │ │ +
│ │ │ │ +
152
│ │ │ │ +
│ │ │ │ +
153 std::size_t& getRowSize(std::size_t index)
│ │ │ │ +
154 {
│ │ │ │ +
155 return rowSize[index];
│ │ │ │ +
156 }
│ │ │ │ +
│ │ │ │ +
157
│ │ │ │ +
│ │ │ │ +
158 std::size_t getRowSize(std::size_t index) const
│ │ │ │ +
159 {
│ │ │ │ +
160 return rowSize[index];
│ │ │ │ +
161 }
│ │ │ │ +
│ │ │ │ +
162
│ │ │ │ +
│ │ │ │ +
163 std::size_t& getCopyRowSize(std::size_t index)
│ │ │ │ +
164 {
│ │ │ │ +
165 return copyrowSize[index];
│ │ │ │ +
166 }
│ │ │ │ +
│ │ │ │ +
167
│ │ │ │ +
│ │ │ │ +
168 std::size_t getCopyRowSize(std::size_t index) const
│ │ │ │ +
169 {
│ │ │ │ +
170 return copyrowSize[index];
│ │ │ │ +
171 }
│ │ │ │ +
│ │ │ │ +
172
│ │ │ │ +
│ │ │ │ +
173 std::size_t& getBackwardsCopyRowSize(std::size_t index)
│ │ │ │ +
174 {
│ │ │ │ +
175 return backwardscopyrowSize[index];
│ │ │ │ +
176 }
│ │ │ │ +
│ │ │ │ +
177
│ │ │ │ +
│ │ │ │ +
178 std::size_t getBackwardsCopyRowSize(std::size_t index) const
│ │ │ │ +
179 {
│ │ │ │ +
180 return backwardscopyrowSize[index];
│ │ │ │ +
181 }
│ │ │ │ +
│ │ │ │ +
182
│ │ │ │ +
│ │ │ │ +
183 void setNoRows(std::size_t rows)
│ │ │ │ +
184 {
│ │ │ │ +
185 rowSize.resize(rows, 0);
│ │ │ │ +
186 }
│ │ │ │ +
│ │ │ │ +
187
│ │ │ │ +
│ │ │ │ +
188 void setNoCopyRows(std::size_t rows)
│ │ │ │ +
189 {
│ │ │ │ +
190 copyrowSize.resize(rows, 0);
│ │ │ │ +
191 }
│ │ │ │ +
│ │ │ │ +
192
│ │ │ │ +
│ │ │ │ +
193 void setNoBackwardsCopyRows(std::size_t rows)
│ │ │ │ +
194 {
│ │ │ │ +
195 backwardscopyrowSize.resize(rows, 0);
│ │ │ │ +
196 }
│ │ │ │ +
│ │ │ │ +
197
│ │ │ │ +
198 private:
│ │ │ │ +
199 std::vector<std::size_t> rowSize;
│ │ │ │ +
200 std::vector<std::size_t> copyrowSize;
│ │ │ │ +
201 std::vector<std::size_t> backwardscopyrowSize;
│ │ │ │ +
202 RedistributeInterface interface;
│ │ │ │ +
203 bool setup_;
│ │ │ │ +
204 };
│ │ │ │ +
│ │ │ │ +
205
│ │ │ │ +
214 template<class M, class RI>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
216 {
│ │ │ │ +
217 // Make the default communication policy work.
│ │ │ │ +
218 typedef typename M::size_type value_type;
│ │ │ │ +
219 typedef typename M::size_type size_type;
│ │ │ │ +
220
│ │ │ │ +
│ │ │ │ +
226 CommMatrixRowSize(const M& m_, RI& rowsize_)
│ │ │ │ +
227 : matrix(m_), rowsize(rowsize_)
│ │ │ │ +
228 {}
│ │ │ │ +
│ │ │ │ +
229 const M& matrix;
│ │ │ │ + │ │ │ │ +
231
│ │ │ │ +
232 };
│ │ │ │ +
│ │ │ │ +
233
│ │ │ │ +
234
│ │ │ │ +
243 template<class M, class I>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
245 {
│ │ │ │ +
246 typedef typename M::size_type size_type;
│ │ │ │ +
247
│ │ │ │ +
│ │ │ │ +
254 CommMatrixSparsityPattern(const M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_)
│ │ │ │ +
255 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), rowsize()
│ │ │ │ +
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;
│ │ │ │ +
│ │ │ │ +
265 CommMatrixSparsityPattern(const M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_,
│ │ │ │ +
266 const std::vector<typename M::size_type>& rowsize_)
│ │ │ │ +
267 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), sparsity(aggidxset_.size()), rowsize(&rowsize_)
│ │ │ │ +
268 {}
│ │ │ │ +
│ │ │ │
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 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
302 {}
│ │ │ │ -
│ │ │ │ -
303
│ │ │ │ -
304 };
│ │ │ │ -
│ │ │ │ -
305
│ │ │ │ -
306 namespace
│ │ │ │ -
307 {
│ │ │ │ -
317 template<class GI>
│ │ │ │ -
318 void createSendBuf(std::vector<GI>& ownerVec, std::set<GI>& overlapVec, std::set<int>& neighbors, char *sendBuf, int buffersize, MPI_Comm comm) {
│ │ │ │ -
319 // Pack owner vertices
│ │ │ │ -
320 std::size_t s=ownerVec.size();
│ │ │ │ -
321 int pos=0;
│ │ │ │ -
322 if(s==0)
│ │ │ │ -
323 ownerVec.resize(1); // otherwise would read beyond the memory bound
│ │ │ │ -
324 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ -
325 MPI_Pack(&(ownerVec[0]), s, MPITraits<GI>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ -
326 s = overlapVec.size();
│ │ │ │ -
327 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ -
328 for(auto i=overlapVec.begin(), end= overlapVec.end(); i != end; ++i)
│ │ │ │ -
329 MPI_Pack(const_cast<GI*>(&(*i)), 1, MPITraits<GI>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ -
330
│ │ │ │ -
331 s=neighbors.size();
│ │ │ │ -
332 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ -
333
│ │ │ │ -
334 for(auto i=neighbors.begin(), end= neighbors.end(); i != end; ++i)
│ │ │ │ -
335 MPI_Pack(const_cast<int*>(&(*i)), 1, MPI_INT, sendBuf, buffersize, &pos, comm);
│ │ │ │ -
336 }
│ │ │ │ -
345 template<class GI>
│ │ │ │ -
346 void saveRecvBuf(char *recvBuf, int bufferSize, std::vector<std::pair<GI,int> >& ownerVec,
│ │ │ │ -
347 std::set<GI>& overlapVec, std::set<int>& neighbors, RedistributeInterface& inf, int from, MPI_Comm comm) {
│ │ │ │ -
348 std::size_t size;
│ │ │ │ -
349 int pos=0;
│ │ │ │ -
350 // unpack owner vertices
│ │ │ │ -
351 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ │ -
352 inf.reserveSpaceForReceiveInterface(from, size);
│ │ │ │ -
353 ownerVec.reserve(ownerVec.size()+size);
│ │ │ │ -
354 for(; size!=0; --size) {
│ │ │ │ -
355 GI gi;
│ │ │ │ -
356 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits<GI>::getType(), comm);
│ │ │ │ -
357 ownerVec.push_back(std::make_pair(gi,from));
│ │ │ │ -
358 }
│ │ │ │ -
359 // unpack overlap vertices
│ │ │ │ -
360 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ │ -
361 typename std::set<GI>::iterator ipos = overlapVec.begin();
│ │ │ │ -
362 Dune::dverb << "unpacking "<<size<<" overlap"<<std::endl;
│ │ │ │ -
363 for(; size!=0; --size) {
│ │ │ │ -
364 GI gi;
│ │ │ │ -
365 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits<GI>::getType(), comm);
│ │ │ │ -
366 ipos=overlapVec.insert(ipos, gi);
│ │ │ │ -
367 }
│ │ │ │ -
368 //unpack neighbors
│ │ │ │ -
369 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ │ -
370 Dune::dverb << "unpacking "<<size<<" neighbors"<<std::endl;
│ │ │ │ -
371 typename std::set<int>::iterator npos = neighbors.begin();
│ │ │ │ -
372 for(; size!=0; --size) {
│ │ │ │ -
373 int n;
│ │ │ │ -
374 MPI_Unpack(recvBuf, bufferSize, &pos, &n, 1, MPI_INT, comm);
│ │ │ │ -
375 npos=neighbors.insert(npos, n);
│ │ │ │ -
376 }
│ │ │ │ -
377 }
│ │ │ │ -
378
│ │ │ │ -
392 template<typename T>
│ │ │ │ -
393 void getDomain(const MPI_Comm& comm, T *part, int numOfOwnVtx, int nparts, int *myDomain, std::vector<int> &domainMapping) {
│ │ │ │ -
394 int npes, mype;
│ │ │ │ -
395 MPI_Comm_size(comm, &npes);
│ │ │ │ -
396 MPI_Comm_rank(comm, &mype);
│ │ │ │ -
397 MPI_Status status;
│ │ │ │ -
398
│ │ │ │ -
399 *myDomain = -1;
│ │ │ │ -
400 int i=0;
│ │ │ │ -
401 int j=0;
│ │ │ │ -
402
│ │ │ │ -
403 std::vector<int> domain(nparts, 0);
│ │ │ │ -
404 std::vector<int> assigned(npes, 0);
│ │ │ │ -
405 // init domain Mapping
│ │ │ │ -
406 domainMapping.assign(domainMapping.size(), -1);
│ │ │ │ -
407
│ │ │ │ -
408 // count the occurrence of domains
│ │ │ │ -
409 for (i=0; i<numOfOwnVtx; i++) {
│ │ │ │ -
410 domain[part[i]]++;
│ │ │ │ -
411 }
│ │ │ │ -
412
│ │ │ │ -
413 std::vector<int> domainMatrix(npes * nparts, -1);
│ │ │ │ -
414
│ │ │ │ -
415 // init buffer with the own domain
│ │ │ │ -
416 int *buf = new int[nparts];
│ │ │ │ -
417 for (i=0; i<nparts; i++) {
│ │ │ │ -
418 buf[i] = domain[i];
│ │ │ │ -
419 domainMatrix[mype*nparts+i] = domain[i];
│ │ │ │ -
420 }
│ │ │ │ -
421 int pe=0;
│ │ │ │ -
422 int src = (mype-1+npes)%npes;
│ │ │ │ -
423 int dest = (mype+1)%npes;
│ │ │ │ -
424 // ring communication, we need n-1 communications for n processors
│ │ │ │ -
425 for (i=0; i<npes-1; i++) {
│ │ │ │ -
426 MPI_Sendrecv_replace(buf, nparts, MPI_INT, dest, 0, src, 0, comm, &status);
│ │ │ │ -
427 // pe is the process of the actual received buffer
│ │ │ │ -
428 pe = ((mype-1-i)+npes)%npes;
│ │ │ │ -
429 for(j=0; j<nparts; j++) {
│ │ │ │ -
430 // save the values to the domain matrix
│ │ │ │ -
431 domainMatrix[pe*nparts+j] = buf[j];
│ │ │ │ -
432 }
│ │ │ │ -
433 }
│ │ │ │ -
434 delete[] buf;
│ │ │ │ -
435
│ │ │ │ -
436 // Start the domain calculation.
│ │ │ │ -
437 // The process which contains the maximum number of vertices of a
│ │ │ │ -
438 // particular domain is selected to choose it's favorate domain
│ │ │ │ -
439 int maxOccurance = 0;
│ │ │ │ -
440 pe = -1;
│ │ │ │ -
441 std::set<std::size_t> unassigned;
│ │ │ │ -
442
│ │ │ │ -
443 for(i=0; i<nparts; i++) {
│ │ │ │ -
444 for(j=0; j<npes; j++) {
│ │ │ │ -
445 // process has no domain assigned
│ │ │ │ -
446 if (assigned[j]==0) {
│ │ │ │ -
447 if (maxOccurance < domainMatrix[j*nparts+i]) {
│ │ │ │ -
448 maxOccurance = domainMatrix[j*nparts+i];
│ │ │ │ -
449 pe = j;
│ │ │ │ -
450 }
│ │ │ │ -
451 }
│ │ │ │ -
452
│ │ │ │ -
453 }
│ │ │ │ -
454 if (pe!=-1) {
│ │ │ │ -
455 // process got a domain, ...
│ │ │ │ -
456 domainMapping[i] = pe;
│ │ │ │ -
457 // ...mark as assigned
│ │ │ │ -
458 assigned[pe] = 1;
│ │ │ │ -
459 if (pe==mype) {
│ │ │ │ -
460 *myDomain = i;
│ │ │ │ -
461 }
│ │ │ │ -
462 pe = -1;
│ │ │ │ -
463 }
│ │ │ │ -
464 else
│ │ │ │ -
465 {
│ │ │ │ -
466 unassigned.insert(i);
│ │ │ │ -
467 }
│ │ │ │ -
468 maxOccurance = 0;
│ │ │ │ -
469 }
│ │ │ │ -
470
│ │ │ │ -
471 typename std::vector<int>::iterator next_free = assigned.begin();
│ │ │ │ -
472
│ │ │ │ -
473 for(auto udomain = unassigned.begin(),
│ │ │ │ -
474 end = unassigned.end(); udomain != end; ++udomain)
│ │ │ │ -
475 {
│ │ │ │ -
476 next_free = std::find_if(next_free, assigned.end(), std::bind(std::less<int>(), std::placeholders::_1, 1));
│ │ │ │ -
477 assert(next_free != assigned.end());
│ │ │ │ -
478 domainMapping[*udomain] = next_free-assigned.begin();
│ │ │ │ -
479 *next_free = 1;
│ │ │ │ -
480 }
│ │ │ │ -
481 }
│ │ │ │ -
482
│ │ │ │ -
483 struct SortFirst
│ │ │ │ -
484 {
│ │ │ │ -
485 template<class T>
│ │ │ │ -
486 bool operator()(const T& t1, const T& t2) const
│ │ │ │ -
487 {
│ │ │ │ -
488 return t1<t2;
│ │ │ │ -
489 }
│ │ │ │ -
490 };
│ │ │ │ -
491
│ │ │ │ -
492
│ │ │ │ -
503 template<class GI>
│ │ │ │ -
504 void mergeVec(std::vector<std::pair<GI, int> >& ownerVec, std::set<GI>& overlapSet) {
│ │ │ │ -
505
│ │ │ │ -
506#ifdef DEBUG_REPART
│ │ │ │ -
507 // Safety check for duplicates.
│ │ │ │ -
508 if(ownerVec.size()>0)
│ │ │ │ -
509 {
│ │ │ │ -
510 auto old=ownerVec.begin();
│ │ │ │ -
511 for(auto i=old+1, end=ownerVec.end(); i != end; old=i++)
│ │ │ │ -
512 {
│ │ │ │ -
513 if(i->first==old->first)
│ │ │ │ -
514 {
│ │ │ │ -
515 std::cerr<<"Value at indes"<<old-ownerVec.begin()<<" is the same as at index "
│ │ │ │ -
516 <<i-ownerVec.begin()<<" ["<<old->first<<","<<old->second<<"]==["
│ │ │ │ -
517 <<i->first<<","<<i->second<<"]"<<std::endl;
│ │ │ │ -
518 throw "Huch!";
│ │ │ │ -
519 }
│ │ │ │ -
520 }
│ │ │ │ -
521 }
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
277 {
│ │ │ │ +
278 // insert diagonal to overlap rows
│ │ │ │ +
279 typedef typename Dune::GlobalLookupIndexSet<I>::const_iterator IIter;
│ │ │ │ + │ │ │ │ +
281 std::size_t nnz=0;
│ │ │ │ +
282#ifdef DEBUG_REPART
│ │ │ │ +
283 int rank;
│ │ │ │ +
284
│ │ │ │ +
285 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ +
286#endif
│ │ │ │ +
287 for(IIter i= aggidxset.begin(), end=aggidxset.end(); i!=end; ++i) {
│ │ │ │ +
288 if(!OwnerSet::contains(i->local().attribute())) {
│ │ │ │ +
289#ifdef DEBUG_REPART
│ │ │ │ +
290 std::cout<<rank<<" Inserting diagonal for"<<i->local()<<std::endl;
│ │ │ │ +
291#endif
│ │ │ │ +
292 sparsity[i->local()].insert(i->local());
│ │ │ │ +
293 }
│ │ │ │ +
294
│ │ │ │ +
295 nnz+=sparsity[i->local()].size();
│ │ │ │ +
296 }
│ │ │ │ +
297 assert( aggidxset.size()==sparsity.size());
│ │ │ │ +
298
│ │ │ │ +
299 if(nnz>0) {
│ │ │ │ +
300 m.setSize(aggidxset.size(), aggidxset.size(), nnz);
│ │ │ │ +
301 m.setBuildMode(M::row_wise);
│ │ │ │ +
302 typename M::CreateIterator citer=m.createbegin();
│ │ │ │ +
303#ifdef DEBUG_REPART
│ │ │ │ +
304 std::size_t idx=0;
│ │ │ │ +
305 bool correct=true;
│ │ │ │ +
306 Dune::GlobalLookupIndexSet<I> global(aggidxset);
│ │ │ │ +
307#endif
│ │ │ │ +
308 typedef typename std::vector<std::set<size_type> >::const_iterator Iter;
│ │ │ │ +
309 for(Iter i=sparsity.begin(), end=sparsity.end(); i!=end; ++i, ++citer)
│ │ │ │ +
310 {
│ │ │ │ +
311 typedef typename std::set<size_type>::const_iterator SIter;
│ │ │ │ +
312 for(SIter si=i->begin(), send=i->end(); si!=send; ++si)
│ │ │ │ +
313 citer.insert(*si);
│ │ │ │ +
314#ifdef DEBUG_REPART
│ │ │ │ +
315 if(i->find(idx)==i->end()) {
│ │ │ │ +
316 const typename I::IndexPair* gi=global.pair(idx);
│ │ │ │ +
317 assert(gi);
│ │ │ │ +
318 std::cout<<rank<<": row "<<idx<<" is missing a diagonal entry! global="<<gi->global()<<" attr="<<gi->local().attribute()<<" "<<
│ │ │ │ +
319 OwnerSet::contains(gi->local().attribute())<<
│ │ │ │ +
320 " row size="<<i->size()<<std::endl;
│ │ │ │ +
321 correct=false;
│ │ │ │ +
322 }
│ │ │ │ +
323 ++idx;
│ │ │ │ +
324#endif
│ │ │ │ +
325 }
│ │ │ │ +
326#ifdef DEBUG_REPART
│ │ │ │ +
327 if(!correct)
│ │ │ │ +
328 throw "bla";
│ │ │ │ +
329#endif
│ │ │ │ +
330 }
│ │ │ │ +
331 }
│ │ │ │ +
│ │ │ │ +
332
│ │ │ │ +
│ │ │ │ +
340 void completeSparsityPattern(std::vector<std::set<size_type> > add_sparsity)
│ │ │ │ +
341 {
│ │ │ │ +
342 for (unsigned int i = 0; i != sparsity.size(); ++i) {
│ │ │ │ +
343 if (add_sparsity[i].size() != 0) {
│ │ │ │ +
344 typedef std::set<size_type> Set;
│ │ │ │ +
345 Set tmp_set;
│ │ │ │ +
346 std::insert_iterator<Set> tmp_insert (tmp_set, tmp_set.begin());
│ │ │ │ +
347 std::set_union(add_sparsity[i].begin(), add_sparsity[i].end(),
│ │ │ │ +
348 sparsity[i].begin(), sparsity[i].end(), tmp_insert);
│ │ │ │ +
349 sparsity[i].swap(tmp_set);
│ │ │ │ +
350 }
│ │ │ │ +
351 }
│ │ │ │ +
352 }
│ │ │ │ +
│ │ │ │ +
353
│ │ │ │ +
354 const M& matrix;
│ │ │ │ +
355 typedef Dune::GlobalLookupIndexSet<I> LookupIndexSet;
│ │ │ │ +
356 const Dune::GlobalLookupIndexSet<I>& idxset;
│ │ │ │ +
357 const I& aggidxset;
│ │ │ │ +
358 std::vector<std::set<size_type> > sparsity;
│ │ │ │ +
359 const std::vector<size_type>* rowsize;
│ │ │ │ +
360 };
│ │ │ │ +
│ │ │ │ +
361
│ │ │ │ +
362 template<class M, class I>
│ │ │ │ +
│ │ │ │ +
363 struct CommPolicy<CommMatrixSparsityPattern<M,I> >
│ │ │ │ +
364 {
│ │ │ │ + │ │ │ │ +
366
│ │ │ │ +
371 typedef typename I::GlobalIndex IndexedType;
│ │ │ │ +
372
│ │ │ │ +
374 typedef VariableSize IndexedTypeFlag;
│ │ │ │ +
375
│ │ │ │ +
│ │ │ │ +
376 static typename M::size_type getSize(const Type& t, std::size_t i)
│ │ │ │ +
377 {
│ │ │ │ +
378 if(!t.rowsize)
│ │ │ │ +
379 return t.matrix[i].size();
│ │ │ │ +
380 else
│ │ │ │ +
381 {
│ │ │ │ +
382 assert((*t.rowsize)[i]>0);
│ │ │ │ +
383 return (*t.rowsize)[i];
│ │ │ │ +
384 }
│ │ │ │ +
385 }
│ │ │ │ +
│ │ │ │ +
386 };
│ │ │ │ +
│ │ │ │ +
387
│ │ │ │ +
394 template<class M, class I>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
396 {
│ │ │ │ +
│ │ │ │ +
405 CommMatrixRow(M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_)
│ │ │ │ +
406 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), rowsize()
│ │ │ │ +
407 {}
│ │ │ │ +
│ │ │ │ +
408
│ │ │ │ +
│ │ │ │ +
412 CommMatrixRow(M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_,
│ │ │ │ +
413 std::vector<size_t>& rowsize_)
│ │ │ │ +
414 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), rowsize(&rowsize_)
│ │ │ │ +
415 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
422 {
│ │ │ │ +
423 typedef typename Dune::GlobalLookupIndexSet<I>::const_iterator Iter;
│ │ │ │ + │ │ │ │ +
425
│ │ │ │ +
426 for(Iter i= aggidxset.begin(), end=aggidxset.end(); i!=end; ++i)
│ │ │ │ +
427 if(!OwnerSet::contains(i->local().attribute())) {
│ │ │ │ +
428 // Set to Dirchlet
│ │ │ │ +
429 typedef typename M::ColIterator CIter;
│ │ │ │ +
430 for(CIter c=matrix[i->local()].begin(), cend= matrix[i->local()].end();
│ │ │ │ +
431 c!= cend; ++c)
│ │ │ │ +
432 {
│ │ │ │ +
433 *c=0;
│ │ │ │ +
434 if(c.index()==i->local()) {
│ │ │ │ +
435 auto setDiagonal = [](auto&& scalarOrMatrix, const auto& value) {
│ │ │ │ +
436 auto&& matrixView = Dune::Impl::asMatrix(scalarOrMatrix);
│ │ │ │ +
437 for (auto rowIt = matrixView.begin(); rowIt != matrixView.end(); ++rowIt)
│ │ │ │ +
438 (*rowIt)[rowIt.index()] = value;
│ │ │ │ +
439 };
│ │ │ │ +
440 setDiagonal(*c, 1);
│ │ │ │ +
441 }
│ │ │ │ +
442 }
│ │ │ │ +
443 }
│ │ │ │ +
444 }
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
448 const Dune::GlobalLookupIndexSet<I>& idxset;
│ │ │ │ +
450 const I& aggidxset;
│ │ │ │ +
452 std::vector<size_t>* rowsize; // row sizes differ from sender side in overlap!
│ │ │ │ +
453 };
│ │ │ │ +
│ │ │ │ +
454
│ │ │ │ +
455 template<class M, class I>
│ │ │ │ +
│ │ │ │ +
456 struct CommPolicy<CommMatrixRow<M,I> >
│ │ │ │ +
457 {
│ │ │ │ + │ │ │ │ +
459
│ │ │ │ +
464 typedef std::pair<typename I::GlobalIndex,typename M::block_type> IndexedType;
│ │ │ │ +
465
│ │ │ │ +
467 typedef VariableSize IndexedTypeFlag;
│ │ │ │ +
468
│ │ │ │ +
│ │ │ │ +
469 static std::size_t getSize(const Type& t, std::size_t i)
│ │ │ │ +
470 {
│ │ │ │ +
471 if(!t.rowsize)
│ │ │ │ +
472 return t.matrix[i].size();
│ │ │ │ +
473 else
│ │ │ │ +
474 {
│ │ │ │ +
475 assert((*t.rowsize)[i]>0);
│ │ │ │ +
476 return (*t.rowsize)[i];
│ │ │ │ +
477 }
│ │ │ │ +
478 }
│ │ │ │ +
│ │ │ │ +
479 };
│ │ │ │ +
│ │ │ │ +
480
│ │ │ │ +
481 template<class M, class I, class RI>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
483 {
│ │ │ │ + │ │ │ │ +
485
│ │ │ │ +
│ │ │ │ +
486 static const typename M::size_type gather(const Container& cont, std::size_t i)
│ │ │ │ +
487 {
│ │ │ │ +
488 return cont.matrix[i].size();
│ │ │ │ +
489 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
490 static void scatter(Container& cont, const typename M::size_type& rowsize, std::size_t i)
│ │ │ │ +
491 {
│ │ │ │ +
492 assert(rowsize);
│ │ │ │ +
493 cont.rowsize.getRowSize(i)=rowsize;
│ │ │ │ +
494 }
│ │ │ │ +
│ │ │ │ +
495
│ │ │ │ +
496 };
│ │ │ │ +
│ │ │ │ +
497
│ │ │ │ +
498 template<class M, class I, class RI>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
500 {
│ │ │ │ + │ │ │ │ +
502
│ │ │ │ +
│ │ │ │ +
503 static const typename M::size_type gather(const Container& cont, std::size_t i)
│ │ │ │ +
504 {
│ │ │ │ +
505 return cont.matrix[i].size();
│ │ │ │ +
506 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
507 static void scatter(Container& cont, const typename M::size_type& rowsize, std::size_t i)
│ │ │ │ +
508 {
│ │ │ │ +
509 assert(rowsize);
│ │ │ │ +
510 if (rowsize > cont.rowsize.getCopyRowSize(i))
│ │ │ │ +
511 cont.rowsize.getCopyRowSize(i)=rowsize;
│ │ │ │ +
512 }
│ │ │ │ +
│ │ │ │ +
513
│ │ │ │ +
514 };
│ │ │ │ +
│ │ │ │ +
515
│ │ │ │ +
516 template<class M, class I>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
518 {
│ │ │ │ +
519 typedef typename I::GlobalIndex GlobalIndex;
│ │ │ │ + │ │ │ │ +
521 typedef typename M::ConstColIterator ColIter;
│ │ │ │
522
│ │ │ │ -
523#endif
│ │ │ │ -
524
│ │ │ │ -
525 auto v=ownerVec.begin(), vend=ownerVec.end();
│ │ │ │ -
526 for(auto s=overlapSet.begin(), send=overlapSet.end(); s!=send;)
│ │ │ │ -
527 {
│ │ │ │ -
528 while(v!=vend && v->first<*s) ++v;
│ │ │ │ -
529 if(v!=vend && v->first==*s) {
│ │ │ │ -
530 // Move to the next element before erasing
│ │ │ │ -
531 // thus s stays valid!
│ │ │ │ -
532 auto tmp=s;
│ │ │ │ -
533 ++s;
│ │ │ │ -
534 overlapSet.erase(tmp);
│ │ │ │ -
535 }else
│ │ │ │ -
536 ++s;
│ │ │ │ -
537 }
│ │ │ │ -
538 }
│ │ │ │ -
539
│ │ │ │ -
540
│ │ │ │ -
554 template<class OwnerSet, class Graph, class IS, class GI>
│ │ │ │ -
555 void getNeighbor(const Graph& g, std::vector<int>& part,
│ │ │ │ -
556 typename Graph::VertexDescriptor vtx, const IS& indexSet,
│ │ │ │ -
557 int toPe, std::set<GI>& neighbor, std::set<int>& neighborProcs) {
│ │ │ │ -
558 for(auto edge=g.beginEdges(vtx), end=g.endEdges(vtx); edge!=end; ++edge)
│ │ │ │ -
559 {
│ │ │ │ -
560 const typename IS::IndexPair* pindex = indexSet.pair(edge.target());
│ │ │ │ -
561 assert(pindex);
│ │ │ │ -
562 if(part[pindex->local()]!=toPe || !OwnerSet::contains(pindex->local().attribute()))
│ │ │ │ -
563 {
│ │ │ │ -
564 // is sent to another process and therefore becomes overlap
│ │ │ │ -
565 neighbor.insert(pindex->global());
│ │ │ │ -
566 neighborProcs.insert(part[pindex->local()]);
│ │ │ │ -
567 }
│ │ │ │ -
568 }
│ │ │ │ -
569 }
│ │ │ │ -
570
│ │ │ │ -
571 template<class T, class I>
│ │ │ │ -
572 void my_push_back(std::vector<T>& ownerVec, const I& index, [[maybe_unused]] int proc)
│ │ │ │ -
573 {
│ │ │ │ -
574 ownerVec.push_back(index);
│ │ │ │ -
575 }
│ │ │ │ -
576
│ │ │ │ -
577 template<class T, class I>
│ │ │ │ -
578 void my_push_back(std::vector<std::pair<T,int> >& ownerVec, const I& index, int proc)
│ │ │ │ -
579 {
│ │ │ │ -
580 ownerVec.push_back(std::make_pair(index,proc));
│ │ │ │ -
581 }
│ │ │ │ -
582 template<class T>
│ │ │ │ -
583 void reserve(std::vector<T>&, RedistributeInterface&, int)
│ │ │ │ -
584 {}
│ │ │ │ -
585 template<class T>
│ │ │ │ -
586 void reserve(std::vector<std::pair<T,int> >& ownerVec, RedistributeInterface& redist, int proc)
│ │ │ │ -
587 {
│ │ │ │ -
588 redist.reserveSpaceForReceiveInterface(proc, ownerVec.size());
│ │ │ │ -
589 }
│ │ │ │ -
590
│ │ │ │ -
591
│ │ │ │ -
609 template<class OwnerSet, class G, class IS, class T, class GI>
│ │ │ │ -
610 void getOwnerOverlapVec(const G& graph, std::vector<int>& part, IS& indexSet,
│ │ │ │ -
611 [[maybe_unused]] int myPe, int toPe, std::vector<T>& ownerVec, std::set<GI>& overlapSet,
│ │ │ │ -
612 RedistributeInterface& redist, std::set<int>& neighborProcs) {
│ │ │ │ -
613 for(auto index = indexSet.begin(); index != indexSet.end(); ++index) {
│ │ │ │ -
614 // Only Process owner vertices, the others are not in the parmetis graph.
│ │ │ │ -
615 if(OwnerSet::contains(index->local().attribute()))
│ │ │ │ -
616 {
│ │ │ │ -
617 if(part[index->local()]==toPe)
│ │ │ │ -
618 {
│ │ │ │ -
619 getNeighbor<OwnerSet>(graph, part, index->local(), indexSet,
│ │ │ │ -
620 toPe, overlapSet, neighborProcs);
│ │ │ │ -
621 my_push_back(ownerVec, index->global(), toPe);
│ │ │ │ -
622 }
│ │ │ │ -
623 }
│ │ │ │ -
624 }
│ │ │ │ -
625 reserve(ownerVec, redist, toPe);
│ │ │ │ -
626
│ │ │ │ -
627 }
│ │ │ │ -
628
│ │ │ │ -
629
│ │ │ │ -
636 template<class F, class IS>
│ │ │ │ -
637 inline bool isOwner(IS& indexSet, int index) {
│ │ │ │ -
638
│ │ │ │ -
639 const typename IS::IndexPair* pindex=indexSet.pair(index);
│ │ │ │ -
640
│ │ │ │ -
641 assert(pindex);
│ │ │ │ -
642 return F::contains(pindex->local().attribute());
│ │ │ │ -
643 }
│ │ │ │ -
644
│ │ │ │ -
645
│ │ │ │ -
646 class BaseEdgeFunctor
│ │ │ │ -
647 {
│ │ │ │ -
648 public:
│ │ │ │ -
649 BaseEdgeFunctor(Metis::idx_t* adj,const ParmetisDuneIndexMap& data)
│ │ │ │ -
650 : i_(), adj_(adj), data_(data)
│ │ │ │ -
651 {}
│ │ │ │ +
523 static ColIter col;
│ │ │ │ + │ │ │ │ +
525
│ │ │ │ +
│ │ │ │ +
526 static const GlobalIndex& gather(const Container& cont, std::size_t i, std::size_t j)
│ │ │ │ +
527 {
│ │ │ │ +
528 if(j==0)
│ │ │ │ +
529 col=cont.matrix[i].begin();
│ │ │ │ +
530 else if (col!=cont.matrix[i].end())
│ │ │ │ +
531 ++col;
│ │ │ │ +
532
│ │ │ │ +
533 //copy communication: different row sizes for copy rows with the same global index
│ │ │ │ +
534 //are possible. If all values of current matrix row are sent, send
│ │ │ │ +
535 //std::numeric_limits<GlobalIndex>::max()
│ │ │ │ +
536 //and receiver will ignore it.
│ │ │ │ +
537 if (col==cont.matrix[i].end()) {
│ │ │ │ +
538 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ +
539 return numlimits;
│ │ │ │ +
540 }
│ │ │ │ +
541 else {
│ │ │ │ +
542 const typename I::IndexPair* index=cont.idxset.pair(col.index());
│ │ │ │ +
543 assert(index);
│ │ │ │ +
544 // Only send index if col is no ghost
│ │ │ │ +
545 if ( index->local().attribute() != 2)
│ │ │ │ +
546 return index->global();
│ │ │ │ +
547 else {
│ │ │ │ +
548 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ +
549 return numlimits;
│ │ │ │ +
550 }
│ │ │ │ +
551 }
│ │ │ │ +
552 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
553 static void scatter(Container& cont, const GlobalIndex& gi, std::size_t i, [[maybe_unused]] std::size_t j)
│ │ │ │ +
554 {
│ │ │ │ +
555 try{
│ │ │ │ +
556 if (gi != std::numeric_limits<GlobalIndex>::max()) {
│ │ │ │ +
557 const typename I::IndexPair& ip=cont.aggidxset.at(gi);
│ │ │ │ +
558 assert(ip.global()==gi);
│ │ │ │ +
559 std::size_t column = ip.local();
│ │ │ │ +
560 cont.sparsity[i].insert(column);
│ │ │ │ +
561
│ │ │ │ + │ │ │ │ +
563 if(!OwnerSet::contains(ip.local().attribute()))
│ │ │ │ +
564 // preserve symmetry for overlap
│ │ │ │ +
565 cont.sparsity[column].insert(i);
│ │ │ │ +
566 }
│ │ │ │ +
567 }
│ │ │ │ +
568 catch(const Dune::RangeError&) {
│ │ │ │ +
569 // Entry not present in the new index set. Ignore!
│ │ │ │ +
570#ifdef DEBUG_REPART
│ │ │ │ +
571 typedef typename Container::LookupIndexSet GlobalLookup;
│ │ │ │ +
572 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ │ + │ │ │ │ +
574
│ │ │ │ +
575 GlobalLookup lookup(cont.aggidxset);
│ │ │ │ +
576 const IndexPair* pi=lookup.pair(i);
│ │ │ │ +
577 assert(pi);
│ │ │ │ +
578 if(OwnerSet::contains(pi->local().attribute())) {
│ │ │ │ +
579 int rank;
│ │ │ │ +
580 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
│ │ │ │ +
581 std::cout<<rank<<cont.aggidxset<<std::endl;
│ │ │ │ +
582 std::cout<<rank<<": row "<<i<<" (global="<<gi <<") not in index set for owner index "<<pi->global()<<std::endl;
│ │ │ │ +
583 throw;
│ │ │ │ +
584 }
│ │ │ │ +
585#endif
│ │ │ │ +
586 }
│ │ │ │ +
587 }
│ │ │ │ +
│ │ │ │ +
588
│ │ │ │ +
589 };
│ │ │ │ +
│ │ │ │ +
590 template<class M, class I>
│ │ │ │ + │ │ │ │ +
592
│ │ │ │ +
593 template<class M, class I>
│ │ │ │ + │ │ │ │ +
595
│ │ │ │ +
596
│ │ │ │ +
597 template<class M, class I>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
599 {
│ │ │ │ +
600 typedef typename I::GlobalIndex GlobalIndex;
│ │ │ │ + │ │ │ │ +
602 typedef typename M::ConstColIterator ColIter;
│ │ │ │ +
603 typedef typename std::pair<GlobalIndex,typename M::block_type> Data;
│ │ │ │ +
604 static ColIter col;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
607
│ │ │ │ +
│ │ │ │ +
608 static const Data& gather(const Container& cont, std::size_t i, std::size_t j)
│ │ │ │ +
609 {
│ │ │ │ +
610 if(j==0)
│ │ │ │ +
611 col=cont.matrix[i].begin();
│ │ │ │ +
612 else if (col!=cont.matrix[i].end())
│ │ │ │ +
613 ++col;
│ │ │ │ +
614 // copy communication: different row sizes for copy rows with the same global index
│ │ │ │ +
615 // are possible. If all values of current matrix row are sent, send
│ │ │ │ +
616 // std::numeric_limits<GlobalIndex>::max()
│ │ │ │ +
617 // and receiver will ignore it.
│ │ │ │ +
618 if (col==cont.matrix[i].end()) {
│ │ │ │ +
619 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ + │ │ │ │ +
621 return datastore;
│ │ │ │ +
622 }
│ │ │ │ +
623 else {
│ │ │ │ +
624 // convert local column index to global index
│ │ │ │ +
625 const typename I::IndexPair* index=cont.idxset.pair(col.index());
│ │ │ │ +
626 assert(index);
│ │ │ │ +
627 // Store the data to prevent reference to temporary
│ │ │ │ +
628 // Only send index if col is no ghost
│ │ │ │ +
629 if ( index->local().attribute() != 2)
│ │ │ │ +
630 datastore = Data(index->global(),*col);
│ │ │ │ +
631 else {
│ │ │ │ +
632 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ + │ │ │ │ +
634 }
│ │ │ │ +
635 return datastore;
│ │ │ │ +
636 }
│ │ │ │ +
637 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
638 static void scatter(Container& cont, const Data& data, std::size_t i, [[maybe_unused]] std::size_t j)
│ │ │ │ +
639 {
│ │ │ │ +
640 try{
│ │ │ │ +
641 if (data.first != std::numeric_limits<GlobalIndex>::max()) {
│ │ │ │ +
642 typename M::size_type column=cont.aggidxset.at(data.first).local();
│ │ │ │ +
643 cont.matrix[i][column]=data.second;
│ │ │ │ +
644 }
│ │ │ │ +
645 }
│ │ │ │ +
646 catch(const Dune::RangeError&) {
│ │ │ │ +
647 // This an overlap row and might therefore lack some entries!
│ │ │ │ +
648 }
│ │ │ │ +
649
│ │ │ │ +
650 }
│ │ │ │ +
│ │ │ │ +
651 };
│ │ │ │ +
│ │ │ │
652
│ │ │ │ -
653 template<class T>
│ │ │ │ -
654 void operator()(const T& edge)
│ │ │ │ -
655 {
│ │ │ │ -
656 // Get the egde weight
│ │ │ │ -
657 // const Weight& weight=edge.weight();
│ │ │ │ -
658 adj_[i_] = data_.toParmetis(edge.target());
│ │ │ │ -
659 i_++;
│ │ │ │ -
660 }
│ │ │ │ -
661 std::size_t index()
│ │ │ │ -
662 {
│ │ │ │ -
663 return i_;
│ │ │ │ -
664 }
│ │ │ │ -
665
│ │ │ │ -
666 private:
│ │ │ │ -
667 std::size_t i_;
│ │ │ │ -
668 Metis::idx_t* adj_;
│ │ │ │ -
669 const ParmetisDuneIndexMap& data_;
│ │ │ │ -
670 };
│ │ │ │ -
671
│ │ │ │ -
672 template<typename G>
│ │ │ │ -
673 struct EdgeFunctor
│ │ │ │ -
674 : public BaseEdgeFunctor
│ │ │ │ -
675 {
│ │ │ │ -
676 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std::size_t)
│ │ │ │ -
677 : BaseEdgeFunctor(adj, data)
│ │ │ │ -
678 {}
│ │ │ │ +
653 template<class M, class I>
│ │ │ │ + │ │ │ │ +
655
│ │ │ │ +
656 template<class M, class I>
│ │ │ │ + │ │ │ │ +
658
│ │ │ │ +
659 template<class M, class I>
│ │ │ │ + │ │ │ │ +
661
│ │ │ │ +
662 template<typename M, typename C>
│ │ │ │ +
│ │ │ │ +
663 void redistributeSparsityPattern(M& origMatrix, M& newMatrix, C& origComm, C& newComm,
│ │ │ │ + │ │ │ │ +
665 {
│ │ │ │ +
666 typename C::CopySet copyflags;
│ │ │ │ +
667 typename C::OwnerSet ownerflags;
│ │ │ │ +
668 typedef typename C::ParallelIndexSet IndexSet;
│ │ │ │ + │ │ │ │ +
670 std::vector<typename M::size_type> rowsize(newComm.indexSet().size(), 0);
│ │ │ │ +
671 std::vector<typename M::size_type> copyrowsize(newComm.indexSet().size(), 0);
│ │ │ │ +
672 std::vector<typename M::size_type> backwardscopyrowsize(origComm.indexSet().size(), 0);
│ │ │ │ +
673
│ │ │ │ +
674 // get owner rowsizes
│ │ │ │ +
675 CommMatrixRowSize<M,RI> commRowSize(origMatrix, ri);
│ │ │ │ +
676 ri.template redistribute<MatrixRowSizeGatherScatter<M,IndexSet,RI> >(commRowSize,commRowSize);
│ │ │ │ +
677
│ │ │ │ +
678 origComm.buildGlobalLookup();
│ │ │ │
679
│ │ │ │ -
680 Metis::idx_t* getWeights()
│ │ │ │ -
681 {
│ │ │ │ -
682 return NULL;
│ │ │ │ -
683 }
│ │ │ │ -
684 void free(){}
│ │ │ │ -
685 };
│ │ │ │ -
686
│ │ │ │ -
687 template<class G, class V, class E, class VM, class EM>
│ │ │ │ -
688 class EdgeFunctor<Dune::Amg::PropertiesGraph<G,V,E,VM,EM> >
│ │ │ │ -
689 : public BaseEdgeFunctor
│ │ │ │ -
690 {
│ │ │ │ -
691 public:
│ │ │ │ -
692 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std::size_t s)
│ │ │ │ -
693 : BaseEdgeFunctor(adj, data)
│ │ │ │ -
694 {
│ │ │ │ -
695 weight_=new Metis::idx_t[s];
│ │ │ │ -
696 }
│ │ │ │ +
680 for (std::size_t i=0; i < newComm.indexSet().size(); i++) {
│ │ │ │ +
681 rowsize[i] = ri.getRowSize(i);
│ │ │ │ +
682 }
│ │ │ │ +
683 // get sparsity pattern from owner rows
│ │ │ │ + │ │ │ │ +
685 origsp(origMatrix, origComm.globalLookup(), newComm.indexSet());
│ │ │ │ + │ │ │ │ +
687 newsp(origMatrix, origComm.globalLookup(), newComm.indexSet(), rowsize);
│ │ │ │ +
688
│ │ │ │ +
689 ri.template redistribute<MatrixSparsityPatternGatherScatter<M,IndexSet> >(origsp,newsp);
│ │ │ │ +
690
│ │ │ │ +
691 // build copy to owner interface to get missing matrix values for novlp case
│ │ │ │ + │ │ │ │ +
693 RemoteIndices<IndexSet> *ris = new RemoteIndices<IndexSet>(origComm.indexSet(),
│ │ │ │ +
694 newComm.indexSet(),
│ │ │ │ +
695 origComm.communicator());
│ │ │ │ +
696 ris->template rebuild<true>();
│ │ │ │
697
│ │ │ │ -
698 template<class T>
│ │ │ │ -
699 void operator()(const T& edge)
│ │ │ │ -
700 {
│ │ │ │ -
701 weight_[index()]=edge.properties().depends() ? 3 : 1;
│ │ │ │ -
702 BaseEdgeFunctor::operator()(edge);
│ │ │ │ -
703 }
│ │ │ │ -
704 Metis::idx_t* getWeights()
│ │ │ │ -
705 {
│ │ │ │ -
706 return weight_;
│ │ │ │ -
707 }
│ │ │ │ -
708 void free(){
│ │ │ │ -
709 if(weight_!=0) {
│ │ │ │ -
710 delete weight_;
│ │ │ │ -
711 weight_=0;
│ │ │ │ -
712 }
│ │ │ │ +
698 ri.getInterface().free();
│ │ │ │ +
699 ri.getInterface().build(*ris,copyflags,ownerflags);
│ │ │ │ +
700
│ │ │ │ +
701 // get copy rowsizes
│ │ │ │ +
702 CommMatrixRowSize<M,RI> commRowSize_copy(origMatrix, ri);
│ │ │ │ +
703 ri.template redistribute<MatrixCopyRowSizeGatherScatter<M,IndexSet,RI> >(commRowSize_copy,
│ │ │ │ +
704 commRowSize_copy);
│ │ │ │ +
705
│ │ │ │ +
706 for (std::size_t i=0; i < newComm.indexSet().size(); i++) {
│ │ │ │ +
707 copyrowsize[i] = ri.getCopyRowSize(i);
│ │ │ │ +
708 }
│ │ │ │ +
709 //get copy rowsizes for sender
│ │ │ │ +
710 ri.redistributeBackward(backwardscopyrowsize,copyrowsize);
│ │ │ │ +
711 for (std::size_t i=0; i < origComm.indexSet().size(); i++) {
│ │ │ │ +
712 ri.getBackwardsCopyRowSize(i) = backwardscopyrowsize[i];
│ │ │ │
713 }
│ │ │ │ -
714 private:
│ │ │ │ -
715 Metis::idx_t* weight_;
│ │ │ │ -
716 };
│ │ │ │ -
717
│ │ │ │ -
718
│ │ │ │ -
719
│ │ │ │ -
733 template<class F, class G, class IS, class EW>
│ │ │ │ -
734 void getAdjArrays(G& graph, IS& indexSet, Metis::idx_t *xadj,
│ │ │ │ -
735 EW& ew)
│ │ │ │ -
736 {
│ │ │ │ -
737 int j=0;
│ │ │ │ -
738 auto vend = graph.end();
│ │ │ │ -
739
│ │ │ │ -
740 for(auto vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ │ -
741 if (isOwner<F>(indexSet,*vertex)) {
│ │ │ │ -
742 // The type of const edge iterator.
│ │ │ │ -
743 auto eend = vertex.end();
│ │ │ │ -
744 xadj[j] = ew.index();
│ │ │ │ -
745 j++;
│ │ │ │ -
746 for(auto edge = vertex.begin(); edge != eend; ++edge) {
│ │ │ │ -
747 ew(edge);
│ │ │ │ -
748 }
│ │ │ │ -
749 }
│ │ │ │ -
750 }
│ │ │ │ -
751 xadj[j] = ew.index();
│ │ │ │ -
752 }
│ │ │ │ -
753 } // end anonymous namespace
│ │ │ │ -
754
│ │ │ │ -
755 template<class G, class T1, class T2>
│ │ │ │ -
756 bool buildCommunication(const G& graph, std::vector<int>& realparts,
│ │ │ │ - │ │ │ │ -
758 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ -
759 RedistributeInterface& redistInf,
│ │ │ │ -
760 bool verbose=false);
│ │ │ │ -
761#if HAVE_PARMETIS
│ │ │ │ -
762#ifndef METIS_VER_MAJOR
│ │ │ │ -
763 extern "C"
│ │ │ │ -
764 {
│ │ │ │ -
765 // backwards compatibility to parmetis < 4.0.0
│ │ │ │ -
766 void METIS_PartGraphKway(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t *adjncy, Metis::idx_t *vwgt,
│ │ │ │ -
767 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts,
│ │ │ │ -
768 int *options, int *edgecut, Metis::idx_t *part);
│ │ │ │ -
769
│ │ │ │ -
770 void METIS_PartGraphRecursive(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t *adjncy, Metis::idx_t *vwgt,
│ │ │ │ -
771 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts,
│ │ │ │ -
772 int *options, int *edgecut, Metis::idx_t *part);
│ │ │ │ -
773 }
│ │ │ │ -
774#endif
│ │ │ │ -
775#endif // HAVE_PARMETIS
│ │ │ │ +
714
│ │ │ │ +
715 // get sparsity pattern from copy rows
│ │ │ │ +
716 CommMatrixSparsityPattern<M,IndexSet> origsp_copy(origMatrix,
│ │ │ │ +
717 origComm.globalLookup(),
│ │ │ │ +
718 newComm.indexSet(),
│ │ │ │ +
719 backwardscopyrowsize);
│ │ │ │ +
720 CommMatrixSparsityPattern<M,IndexSet> newsp_copy(origMatrix, origComm.globalLookup(),
│ │ │ │ +
721 newComm.indexSet(), copyrowsize);
│ │ │ │ +
722 ri.template redistribute<MatrixSparsityPatternGatherScatter<M,IndexSet> >(origsp_copy,
│ │ │ │ +
723 newsp_copy);
│ │ │ │ +
724
│ │ │ │ +
725 newsp.completeSparsityPattern(newsp_copy.sparsity);
│ │ │ │ +
726 newsp.storeSparsityPattern(newMatrix);
│ │ │ │ +
727 }
│ │ │ │ +
728 else
│ │ │ │ +
729 newsp.storeSparsityPattern(newMatrix);
│ │ │ │ +
730
│ │ │ │ +
731#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
732 // Check for symmetry
│ │ │ │ +
733 int ret=0;
│ │ │ │ +
734 typedef typename M::ConstRowIterator RIter;
│ │ │ │ +
735 for(RIter row=newMatrix.begin(), rend=newMatrix.end(); row != rend; ++row) {
│ │ │ │ +
736 typedef typename M::ConstColIterator CIter;
│ │ │ │ +
737 for(CIter col=row->begin(), cend=row->end(); col!=cend; ++col)
│ │ │ │ +
738 {
│ │ │ │ +
739 try{
│ │ │ │ +
740 newMatrix[col.index()][row.index()];
│ │ │ │ +
741 }catch(const Dune::ISTLError&) {
│ │ │ │ +
742 std::cerr<<newComm.communicator().rank()<<": entry ("
│ │ │ │ +
743 <<col.index()<<","<<row.index()<<") missing! for symmetry!"<<std::endl;
│ │ │ │ +
744 ret=1;
│ │ │ │ +
745
│ │ │ │ +
746 }
│ │ │ │ +
747
│ │ │ │ +
748 }
│ │ │ │ +
749 }
│ │ │ │ +
750
│ │ │ │ +
751 if(ret)
│ │ │ │ +
752 DUNE_THROW(ISTLError, "Matrix not symmetric!");
│ │ │ │ +
753#endif
│ │ │ │ +
754 }
│ │ │ │ +
│ │ │ │ +
755
│ │ │ │ +
756 template<typename M, typename C>
│ │ │ │ +
│ │ │ │ +
757 void redistributeMatrixEntries(M& origMatrix, M& newMatrix, C& origComm, C& newComm,
│ │ │ │ + │ │ │ │ +
759 {
│ │ │ │ +
760 typedef typename C::ParallelIndexSet IndexSet;
│ │ │ │ +
761 typename C::OwnerSet ownerflags;
│ │ │ │ +
762 std::vector<typename M::size_type> rowsize(newComm.indexSet().size(), 0);
│ │ │ │ +
763 std::vector<typename M::size_type> copyrowsize(newComm.indexSet().size(), 0);
│ │ │ │ +
764 std::vector<typename M::size_type> backwardscopyrowsize(origComm.indexSet().size(), 0);
│ │ │ │ +
765
│ │ │ │ +
766 for (std::size_t i=0; i < newComm.indexSet().size(); i++) {
│ │ │ │ +
767 rowsize[i] = ri.getRowSize(i);
│ │ │ │ + │ │ │ │ +
769 copyrowsize[i] = ri.getCopyRowSize(i);
│ │ │ │ +
770 }
│ │ │ │ +
771 }
│ │ │ │ +
772
│ │ │ │ +
773 for (std::size_t i=0; i < origComm.indexSet().size(); i++)
│ │ │ │ + │ │ │ │ +
775 backwardscopyrowsize[i] = ri.getBackwardsCopyRowSize(i);
│ │ │ │
776
│ │ │ │ -
777 template<class S, class T>
│ │ │ │ -
│ │ │ │ -
778 inline void print_carray(S& os, T* array, std::size_t l)
│ │ │ │ -
779 {
│ │ │ │ -
780 for(T *cur=array, *end=array+l; cur!=end; ++cur)
│ │ │ │ -
781 os<<*cur<<" ";
│ │ │ │ -
782 }
│ │ │ │ -
│ │ │ │ -
783
│ │ │ │ -
784 template<class S, class T>
│ │ │ │ -
│ │ │ │ -
785 inline bool isValidGraph(std::size_t noVtx, std::size_t gnoVtx, S noEdges, T* xadj,
│ │ │ │ -
786 T* adjncy, bool checkSymmetry)
│ │ │ │ -
787 {
│ │ │ │ -
788 bool correct=true;
│ │ │ │ -
789
│ │ │ │ -
790 using std::signbit;
│ │ │ │ -
791 for(Metis::idx_t vtx=0; vtx<(Metis::idx_t)noVtx; ++vtx) {
│ │ │ │ -
792 if(static_cast<S>(xadj[vtx])>noEdges || signbit(xadj[vtx])) {
│ │ │ │ -
793 std::cerr <<"Check graph: xadj["<<vtx<<"]="<<xadj[vtx]<<" (>"
│ │ │ │ -
794 <<noEdges<<") out of range!"<<std::endl;
│ │ │ │ -
795 correct=false;
│ │ │ │ -
796 }
│ │ │ │ -
797 if(static_cast<S>(xadj[vtx+1])>noEdges || signbit(xadj[vtx+1])) {
│ │ │ │ -
798 std::cerr <<"Check graph: xadj["<<vtx+1<<"]="<<xadj[vtx+1]<<" (>"
│ │ │ │ -
799 <<noEdges<<") out of range!"<<std::endl;
│ │ │ │ -
800 correct=false;
│ │ │ │ -
801 }
│ │ │ │ -
802 // Check numbers in adjncy
│ │ │ │ -
803 for(Metis::idx_t i=xadj[vtx]; i< xadj[vtx+1]; ++i) {
│ │ │ │ -
804 if(signbit(adjncy[i]) || ((std::size_t)adjncy[i])>gnoVtx) {
│ │ │ │ -
805 std::cerr<<" Edge "<<adjncy[i]<<" out of range ["<<0<<","<<noVtx<<")"
│ │ │ │ -
806 <<std::endl;
│ │ │ │ -
807 correct=false;
│ │ │ │ -
808 }
│ │ │ │ -
809 }
│ │ │ │ -
810 if(checkSymmetry) {
│ │ │ │ -
811 for(Metis::idx_t i=xadj[vtx]; i< xadj[vtx+1]; ++i) {
│ │ │ │ -
812 Metis::idx_t target=adjncy[i];
│ │ │ │ -
813 // search for symmetric edge
│ │ │ │ -
814 int found=0;
│ │ │ │ -
815 for(Metis::idx_t j=xadj[target]; j< xadj[target+1]; ++j)
│ │ │ │ -
816 if(adjncy[j]==vtx)
│ │ │ │ -
817 found++;
│ │ │ │ -
818 if(found!=1) {
│ │ │ │ -
819 std::cerr<<"Edge ("<<target<<","<<vtx<<") "<<i<<" time"<<std::endl;
│ │ │ │ -
820 correct=false;
│ │ │ │ -
821 }
│ │ │ │ -
822 }
│ │ │ │ -
823 }
│ │ │ │ -
824 }
│ │ │ │ -
825 return correct;
│ │ │ │ -
826 }
│ │ │ │ -
│ │ │ │ -
827
│ │ │ │ -
828 template<class M, class T1, class T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
830 Metis::idx_t nparts,
│ │ │ │ -
831 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ -
832 RedistributeInterface& redistInf,
│ │ │ │ -
833 bool verbose=false)
│ │ │ │ -
834 {
│ │ │ │ -
835 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
836 std::cout<<"Repartitioning from "<<oocomm.communicator().size()
│ │ │ │ -
837 <<" to "<<nparts<<" parts"<<std::endl;
│ │ │ │ -
838 Timer time;
│ │ │ │ -
839 int rank = oocomm.communicator().rank();
│ │ │ │ -
840#if !HAVE_PARMETIS
│ │ │ │ -
841 int* part = new int[1];
│ │ │ │ -
842 part[0]=0;
│ │ │ │ -
843#else
│ │ │ │ -
844 Metis::idx_t* part = new Metis::idx_t[1]; // where all our data moves to
│ │ │ │ -
845
│ │ │ │ -
846 if(nparts>1) {
│ │ │ │ -
847
│ │ │ │ -
848 part[0]=rank;
│ │ │ │ -
849
│ │ │ │ -
850 { // sublock for automatic memory deletion
│ │ │ │ -
851
│ │ │ │ -
852 // Build the graph of the communication scheme and create an appropriate indexset.
│ │ │ │ -
853 // calculate the neighbour vertices
│ │ │ │ -
854 int noNeighbours = oocomm.remoteIndices().neighbours();
│ │ │ │ -
855
│ │ │ │ -
856 for(auto n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ │ -
857 ++n)
│ │ │ │ -
858 if(n->first==rank) {
│ │ │ │ -
859 //do not include ourselves.
│ │ │ │ -
860 --noNeighbours;
│ │ │ │ -
861 break;
│ │ │ │ -
862 }
│ │ │ │ -
863
│ │ │ │ -
864 // A parmetis graph representing the communication graph.
│ │ │ │ -
865 // The diagonal entries are the number of nodes on the process.
│ │ │ │ -
866 // The offdiagonal entries are the number of edges leading to other processes.
│ │ │ │ -
867
│ │ │ │ -
868 Metis::idx_t *xadj=new Metis::idx_t[2];
│ │ │ │ -
869 Metis::idx_t *vtxdist=new Metis::idx_t[oocomm.communicator().size()+1];
│ │ │ │ -
870 Metis::idx_t *adjncy=new Metis::idx_t[noNeighbours];
│ │ │ │ -
871#ifdef USE_WEIGHTS
│ │ │ │ -
872 Metis::idx_t *vwgt = 0;
│ │ │ │ -
873 Metis::idx_t *adjwgt = 0;
│ │ │ │ -
874#endif
│ │ │ │ -
875
│ │ │ │ -
876 // each process has exactly one vertex!
│ │ │ │ -
877 for(int i=0; i<oocomm.communicator().size(); ++i)
│ │ │ │ -
878 vtxdist[i]=i;
│ │ │ │ -
879 vtxdist[oocomm.communicator().size()]=oocomm.communicator().size();
│ │ │ │ -
880
│ │ │ │ -
881 xadj[0]=0;
│ │ │ │ -
882 xadj[1]=noNeighbours;
│ │ │ │ -
883
│ │ │ │ -
884 // count edges to other processor
│ │ │ │ -
885 // a vector mapping the index to the owner
│ │ │ │ -
886 // std::vector<int> owner(mat.N(), oocomm.communicator().rank());
│ │ │ │ -
887 // for(NeighbourIterator n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ │ -
888 // ++n)
│ │ │ │ -
889 // {
│ │ │ │ -
890 // if(n->first!=oocomm.communicator().rank()){
│ │ │ │ -
891 // typedef typename RemoteIndices::RemoteIndexList RIList;
│ │ │ │ -
892 // const RIList& rlist = *(n->second.first);
│ │ │ │ -
893 // typedef typename RIList::const_iterator LIter;
│ │ │ │ -
894 // for(LIter entry=rlist.begin(); entry!=rlist.end(); ++entry){
│ │ │ │ -
895 // if(entry->attribute()==OwnerOverlapCopyAttributeSet::owner)
│ │ │ │ -
896 // owner[entry->localIndexPair().local()] = n->first;
│ │ │ │ -
897 // }
│ │ │ │ -
898 // }
│ │ │ │ -
899 // }
│ │ │ │ -
900
│ │ │ │ -
901 // std::map<int,Metis::idx_t> edgecount; // edges to other processors
│ │ │ │ -
902 // typedef typename M::ConstRowIterator RIter;
│ │ │ │ -
903 // typedef typename M::ConstColIterator CIter;
│ │ │ │ -
904
│ │ │ │ -
905 // // calculate edge count
│ │ │ │ -
906 // for(RIter row=mat.begin(), endr=mat.end(); row != endr; ++row)
│ │ │ │ -
907 // if(owner[row.index()]==OwnerOverlapCopyAttributeSet::owner)
│ │ │ │ -
908 // for(CIter entry= row->begin(), ende = row->end(); entry != ende; ++entry)
│ │ │ │ -
909 // ++edgecount[owner[entry.index()]];
│ │ │ │ -
910
│ │ │ │ -
911 // setup edge and weight pattern
│ │ │ │ -
912
│ │ │ │ -
913 Metis::idx_t* adjp=adjncy;
│ │ │ │ -
914
│ │ │ │ -
915#ifdef USE_WEIGHTS
│ │ │ │ -
916 vwgt = new Metis::idx_t[1];
│ │ │ │ -
917 vwgt[0]= mat.N(); // weight is numer of rows TODO: Should actually be the nonzeros.
│ │ │ │ -
918
│ │ │ │ -
919 adjwgt = new Metis::idx_t[noNeighbours];
│ │ │ │ -
920 Metis::idx_t* adjwp=adjwgt;
│ │ │ │ -
921#endif
│ │ │ │ -
922
│ │ │ │ -
923 for(auto n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ │ -
924 ++n)
│ │ │ │ -
925 if(n->first != rank) {
│ │ │ │ -
926 *adjp=n->first;
│ │ │ │ -
927 ++adjp;
│ │ │ │ -
928#ifdef USE_WEIGHTS
│ │ │ │ -
929 *adjwp=1; //edgecount[n->first];
│ │ │ │ -
930 ++adjwp;
│ │ │ │ -
931#endif
│ │ │ │ -
932 }
│ │ │ │ -
933 assert(isValidGraph(vtxdist[rank+1]-vtxdist[rank],
│ │ │ │ -
934 vtxdist[oocomm.communicator().size()],
│ │ │ │ -
935 noNeighbours, xadj, adjncy, false));
│ │ │ │ -
936
│ │ │ │ -
937 [[maybe_unused]] Metis::idx_t wgtflag=0;
│ │ │ │ -
938 Metis::idx_t numflag=0;
│ │ │ │ -
939 Metis::idx_t edgecut;
│ │ │ │ -
940#ifdef USE_WEIGHTS
│ │ │ │ -
941 wgtflag=3;
│ │ │ │ -
942#endif
│ │ │ │ -
943 Metis::real_t *tpwgts = new Metis::real_t[nparts];
│ │ │ │ -
944 for(int i=0; i<nparts; ++i)
│ │ │ │ -
945 tpwgts[i]=1.0/nparts;
│ │ │ │ -
946 MPI_Comm comm=oocomm.communicator();
│ │ │ │ -
947
│ │ │ │ -
948 Dune::dinfo<<rank<<" vtxdist: ";
│ │ │ │ -
949 print_carray(Dune::dinfo, vtxdist, oocomm.communicator().size()+1);
│ │ │ │ -
950 Dune::dinfo<<std::endl<<rank<<" xadj: ";
│ │ │ │ -
951 print_carray(Dune::dinfo, xadj, 2);
│ │ │ │ -
952 Dune::dinfo<<std::endl<<rank<<" adjncy: ";
│ │ │ │ -
953 print_carray(Dune::dinfo, adjncy, noNeighbours);
│ │ │ │ -
954
│ │ │ │ -
955#ifdef USE_WEIGHTS
│ │ │ │ -
956 Dune::dinfo<<std::endl<<rank<<" vwgt: ";
│ │ │ │ -
957 print_carray(Dune::dinfo, vwgt, 1);
│ │ │ │ -
958 Dune::dinfo<<std::endl<<rank<<" adwgt: ";
│ │ │ │ -
959 print_carray(Dune::dinfo, adjwgt, noNeighbours);
│ │ │ │ -
960#endif
│ │ │ │ -
961 Dune::dinfo<<std::endl;
│ │ │ │ -
962 oocomm.communicator().barrier();
│ │ │ │ -
963 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
964 std::cout<<"Creating comm graph took "<<time.elapsed()<<std::endl;
│ │ │ │ -
965 time.reset();
│ │ │ │ -
966
│ │ │ │ -
967#ifdef PARALLEL_PARTITION
│ │ │ │ -
968 Metis::real_t ubvec = 1.15;
│ │ │ │ -
969 int ncon=1;
│ │ │ │ -
970 int options[5] ={ 0,1,15,0,0};
│ │ │ │ -
971
│ │ │ │ -
972 //=======================================================
│ │ │ │ -
973 // ParMETIS_V3_PartKway
│ │ │ │ -
974 //=======================================================
│ │ │ │ -
975 ParMETIS_V3_PartKway(vtxdist, xadj, adjncy,
│ │ │ │ -
976 vwgt, adjwgt, &wgtflag,
│ │ │ │ -
977 &numflag, &ncon, &nparts, tpwgts, &ubvec, options, &edgecut, part,
│ │ │ │ -
978 &comm);
│ │ │ │ -
979 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
980 std::cout<<"ParMETIS took "<<time.elapsed()<<std::endl;
│ │ │ │ -
981 time.reset();
│ │ │ │ -
982#else
│ │ │ │ -
983 Timer time1;
│ │ │ │ -
984 std::size_t gnoedges=0;
│ │ │ │ -
985 int* noedges = 0;
│ │ │ │ -
986 noedges = new int[oocomm.communicator().size()];
│ │ │ │ -
987 Dune::dverb<<"noNeighbours: "<<noNeighbours<<std::endl;
│ │ │ │ -
988 // gather number of edges for each vertex.
│ │ │ │ -
989 MPI_Allgather(&noNeighbours,1,MPI_INT,noedges,1, MPI_INT,oocomm.communicator());
│ │ │ │ -
990
│ │ │ │ -
991 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
992 std::cout<<"Gathering noedges took "<<time1.elapsed()<<std::endl;
│ │ │ │ -
993 time1.reset();
│ │ │ │ -
994
│ │ │ │ -
995 Metis::idx_t noVertices = vtxdist[oocomm.communicator().size()];
│ │ │ │ -
996 Metis::idx_t *gxadj = 0;
│ │ │ │ -
997 Metis::idx_t *gvwgt = 0;
│ │ │ │ -
998 Metis::idx_t *gadjncy = 0;
│ │ │ │ -
999 Metis::idx_t *gadjwgt = 0;
│ │ │ │ -
1000 Metis::idx_t *gpart = 0;
│ │ │ │ -
1001 int* displ = 0;
│ │ │ │ -
1002 int* noxs = 0;
│ │ │ │ -
1003 int* xdispl = 0; // displacement for xadj
│ │ │ │ -
1004 int* novs = 0;
│ │ │ │ -
1005 int* vdispl=0; // real vertex displacement
│ │ │ │ -
1006#ifdef USE_WEIGHTS
│ │ │ │ -
1007 std::size_t localNoVtx=vtxdist[rank+1]-vtxdist[rank];
│ │ │ │ -
1008#endif
│ │ │ │ -
1009 std::size_t gxadjlen = vtxdist[oocomm.communicator().size()]-vtxdist[0]+oocomm.communicator().size();
│ │ │ │ -
1010
│ │ │ │ -
1011 {
│ │ │ │ -
1012 Dune::dinfo<<"noedges: ";
│ │ │ │ -
1013 print_carray(Dune::dinfo, noedges, oocomm.communicator().size());
│ │ │ │ -
1014 Dune::dinfo<<std::endl;
│ │ │ │ -
1015 displ = new int[oocomm.communicator().size()];
│ │ │ │ -
1016 xdispl = new int[oocomm.communicator().size()];
│ │ │ │ -
1017 noxs = new int[oocomm.communicator().size()];
│ │ │ │ -
1018 vdispl = new int[oocomm.communicator().size()];
│ │ │ │ -
1019 novs = new int[oocomm.communicator().size()];
│ │ │ │ -
1020
│ │ │ │ -
1021 for(int i=0; i < oocomm.communicator().size(); ++i) {
│ │ │ │ -
1022 noxs[i]=vtxdist[i+1]-vtxdist[i]+1;
│ │ │ │ -
1023 novs[i]=vtxdist[i+1]-vtxdist[i];
│ │ │ │ -
1024 }
│ │ │ │ -
1025
│ │ │ │ -
1026 Metis::idx_t *so= vtxdist;
│ │ │ │ -
1027 int offset = 0;
│ │ │ │ -
1028 for(int *xcurr = xdispl, *vcurr = vdispl, *end=vdispl+oocomm.communicator().size();
│ │ │ │ -
1029 vcurr!=end; ++vcurr, ++xcurr, ++so, ++offset) {
│ │ │ │ -
1030 *vcurr = *so;
│ │ │ │ -
1031 *xcurr = offset + *so;
│ │ │ │ -
1032 }
│ │ │ │ -
1033
│ │ │ │ -
1034 int *pdispl =displ;
│ │ │ │ -
1035 int cdispl = 0;
│ │ │ │ -
1036 *pdispl = 0;
│ │ │ │ -
1037 for(int *curr=noedges, *end=noedges+oocomm.communicator().size()-1;
│ │ │ │ -
1038 curr!=end; ++curr) {
│ │ │ │ -
1039 ++pdispl; // next displacement
│ │ │ │ -
1040 cdispl += *curr; // next value
│ │ │ │ -
1041 *pdispl = cdispl;
│ │ │ │ -
1042 }
│ │ │ │ -
1043 Dune::dinfo<<"displ: ";
│ │ │ │ -
1044 print_carray(Dune::dinfo, displ, oocomm.communicator().size());
│ │ │ │ -
1045 Dune::dinfo<<std::endl;
│ │ │ │ -
1046
│ │ │ │ -
1047 // calculate global number of edges
│ │ │ │ -
1048 // It is bigger than the actual one as we habe size-1 additional end entries
│ │ │ │ -
1049 for(int *curr=noedges, *end=noedges+oocomm.communicator().size();
│ │ │ │ -
1050 curr!=end; ++curr)
│ │ │ │ -
1051 gnoedges += *curr;
│ │ │ │ -
1052
│ │ │ │ -
1053 // alocate gobal graph
│ │ │ │ -
1054 Dune::dinfo<<"gxadjlen: "<<gxadjlen<<" noVertices: "<<noVertices
│ │ │ │ -
1055 <<" gnoedges: "<<gnoedges<<std::endl;
│ │ │ │ -
1056 gxadj = new Metis::idx_t[gxadjlen];
│ │ │ │ -
1057 gpart = new Metis::idx_t[noVertices];
│ │ │ │ -
1058#ifdef USE_WEIGHTS
│ │ │ │ -
1059 gvwgt = new Metis::idx_t[noVertices];
│ │ │ │ -
1060 gadjwgt = new Metis::idx_t[gnoedges];
│ │ │ │ -
1061#endif
│ │ │ │ -
1062 gadjncy = new Metis::idx_t[gnoedges];
│ │ │ │ -
1063 }
│ │ │ │ -
1064
│ │ │ │ -
1065 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1066 std::cout<<"Preparing global graph took "<<time1.elapsed()<<std::endl;
│ │ │ │ -
1067 time1.reset();
│ │ │ │ -
1068 // Communicate data
│ │ │ │ -
1069
│ │ │ │ -
1070 MPI_Allgatherv(xadj,2,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1071 gxadj,noxs,xdispl,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1072 comm);
│ │ │ │ -
1073 MPI_Allgatherv(adjncy,noNeighbours,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1074 gadjncy,noedges,displ,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1075 comm);
│ │ │ │ -
1076#ifdef USE_WEIGHTS
│ │ │ │ -
1077 MPI_Allgatherv(adjwgt,noNeighbours,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1078 gadjwgt,noedges,displ,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1079 comm);
│ │ │ │ -
1080 MPI_Allgatherv(vwgt,localNoVtx,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1081 gvwgt,novs,vdispl,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ -
1082 comm);
│ │ │ │ -
1083#endif
│ │ │ │ -
1084 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1085 std::cout<<"Gathering global graph data took "<<time1.elapsed()<<std::endl;
│ │ │ │ -
1086 time1.reset();
│ │ │ │ -
1087
│ │ │ │ -
1088 {
│ │ │ │ -
1089 // create the real gxadj array
│ │ │ │ -
1090 // i.e. shift entries and add displacements.
│ │ │ │ -
1091
│ │ │ │ -
1092 print_carray(Dune::dinfo, gxadj, gxadjlen);
│ │ │ │ -
1093
│ │ │ │ -
1094 int offset = 0;
│ │ │ │ -
1095 Metis::idx_t increment = vtxdist[1];
│ │ │ │ -
1096 Metis::idx_t *start=gxadj+1;
│ │ │ │ -
1097 for(int i=1; i<oocomm.communicator().size(); ++i) {
│ │ │ │ -
1098 offset+=1;
│ │ │ │ -
1099 int lprev = vtxdist[i]-vtxdist[i-1];
│ │ │ │ -
1100 int l = vtxdist[i+1]-vtxdist[i];
│ │ │ │ -
1101 start+=lprev;
│ │ │ │ -
1102 assert((start+l+offset)-gxadj<=static_cast<Metis::idx_t>(gxadjlen));
│ │ │ │ -
1103 increment = *(start-1);
│ │ │ │ -
1104 std::transform(start+offset, start+l+offset, start, std::bind(std::plus<Metis::idx_t>(), std::placeholders::_1, increment));
│ │ │ │ -
1105 }
│ │ │ │ -
1106 Dune::dinfo<<std::endl<<"shifted xadj:";
│ │ │ │ -
1107 print_carray(Dune::dinfo, gxadj, noVertices+1);
│ │ │ │ -
1108 Dune::dinfo<<std::endl<<" gadjncy: ";
│ │ │ │ -
1109 print_carray(Dune::dinfo, gadjncy, gnoedges);
│ │ │ │ -
1110#ifdef USE_WEIGHTS
│ │ │ │ -
1111 Dune::dinfo<<std::endl<<" gvwgt: ";
│ │ │ │ -
1112 print_carray(Dune::dinfo, gvwgt, noVertices);
│ │ │ │ -
1113 Dune::dinfo<<std::endl<<"adjwgt: ";
│ │ │ │ -
1114 print_carray(Dune::dinfo, gadjwgt, gnoedges);
│ │ │ │ -
1115 Dune::dinfo<<std::endl;
│ │ │ │ -
1116#endif
│ │ │ │ -
1117 // everything should be fine now!!!
│ │ │ │ -
1118 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1119 std::cout<<"Postprocesing global graph data took "<<time1.elapsed()<<std::endl;
│ │ │ │ -
1120 time1.reset();
│ │ │ │ -
1121#ifndef NDEBUG
│ │ │ │ -
1122 assert(isValidGraph(noVertices, noVertices, gnoedges,
│ │ │ │ -
1123 gxadj, gadjncy, true));
│ │ │ │ -
1124#endif
│ │ │ │ -
1125
│ │ │ │ -
1126 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1127 std::cout<<"Creating grah one 1 process took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1128 time.reset();
│ │ │ │ -
1129#if METIS_VER_MAJOR >= 5
│ │ │ │ -
1130 Metis::idx_t ncon = 1;
│ │ │ │ -
1131 Metis::idx_t moptions[METIS_NOPTIONS];
│ │ │ │ -
1132 METIS_SetDefaultOptions(moptions);
│ │ │ │ -
1133 moptions[METIS_OPTION_NUMBERING] = numflag;
│ │ │ │ -
1134 METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, gadjwgt,
│ │ │ │ -
1135 &nparts, NULL, NULL, moptions, &edgecut, gpart);
│ │ │ │ -
1136#else
│ │ │ │ -
1137 int options[5] = {0, 1, 1, 3, 3};
│ │ │ │ -
1138 // Call metis
│ │ │ │ -
1139 METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, &wgtflag,
│ │ │ │ -
1140 &numflag, &nparts, options, &edgecut, gpart);
│ │ │ │ -
1141#endif
│ │ │ │ -
1142
│ │ │ │ -
1143 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1144 std::cout<<"METIS took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1145 time.reset();
│ │ │ │ -
1146
│ │ │ │ -
1147 Dune::dinfo<<std::endl<<"part:";
│ │ │ │ -
1148 print_carray(Dune::dinfo, gpart, noVertices);
│ │ │ │ -
1149
│ │ │ │ -
1150 delete[] gxadj;
│ │ │ │ -
1151 delete[] gadjncy;
│ │ │ │ -
1152#ifdef USE_WEIGHTS
│ │ │ │ -
1153 delete[] gvwgt;
│ │ │ │ -
1154 delete[] gadjwgt;
│ │ │ │ -
1155#endif
│ │ │ │ -
1156 }
│ │ │ │ -
1157 // Scatter result
│ │ │ │ -
1158 MPI_Scatter(gpart, 1, MPITraits<Metis::idx_t>::getType(), part, 1,
│ │ │ │ -
1159 MPITraits<Metis::idx_t>::getType(), 0, comm);
│ │ │ │ -
1160
│ │ │ │ -
1161 {
│ │ │ │ -
1162 // release remaining memory
│ │ │ │ -
1163 delete[] gpart;
│ │ │ │ -
1164 delete[] noedges;
│ │ │ │ -
1165 delete[] displ;
│ │ │ │ -
1166 }
│ │ │ │ -
1167
│ │ │ │ -
1168
│ │ │ │ -
1169#endif
│ │ │ │ -
1170 delete[] xadj;
│ │ │ │ -
1171 delete[] vtxdist;
│ │ │ │ -
1172 delete[] adjncy;
│ │ │ │ -
1173#ifdef USE_WEIGHTS
│ │ │ │ -
1174 delete[] vwgt;
│ │ │ │ -
1175 delete[] adjwgt;
│ │ │ │ -
1176#endif
│ │ │ │ -
1177 delete[] tpwgts;
│ │ │ │ -
1178 }
│ │ │ │ -
1179 }else{
│ │ │ │ -
1180 part[0]=0;
│ │ │ │ -
1181 }
│ │ │ │ -
1182#endif
│ │ │ │ -
1183 Dune::dinfo<<" repart "<<rank <<" -> "<< part[0]<<std::endl;
│ │ │ │ -
1184
│ │ │ │ -
1185 std::vector<int> realpart(mat.N(), part[0]);
│ │ │ │ -
1186 delete[] part;
│ │ │ │ -
1187
│ │ │ │ -
1188 oocomm.copyOwnerToAll(realpart, realpart);
│ │ │ │ -
1189
│ │ │ │ -
1190 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1191 std::cout<<"Scattering repartitioning took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1192 time.reset();
│ │ │ │ -
1193
│ │ │ │ -
1194
│ │ │ │ -
1195 oocomm.buildGlobalLookup(mat.N());
│ │ │ │ -
1196 Dune::Amg::MatrixGraph<M> graph(const_cast<M&>(mat));
│ │ │ │ -
1197 fillIndexSetHoles(graph, oocomm);
│ │ │ │ -
1198 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1199 std::cout<<"Filling index set took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1200 time.reset();
│ │ │ │ -
1201
│ │ │ │ -
1202 if(verbose) {
│ │ │ │ -
1203 int noNeighbours=oocomm.remoteIndices().neighbours();
│ │ │ │ -
1204 noNeighbours = oocomm.communicator().sum(noNeighbours)
│ │ │ │ -
1205 / oocomm.communicator().size();
│ │ │ │ -
1206 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1207 std::cout<<"Average no neighbours was "<<noNeighbours<<std::endl;
│ │ │ │ -
1208 }
│ │ │ │ -
1209 bool ret = buildCommunication(graph, realpart, oocomm, outcomm, redistInf,
│ │ │ │ -
1210 verbose);
│ │ │ │ -
1211 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1212 std::cout<<"Building index sets took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1213 time.reset();
│ │ │ │ -
1214
│ │ │ │ -
1215
│ │ │ │ -
1216 return ret;
│ │ │ │ -
1217
│ │ │ │ -
1218 }
│ │ │ │ -
│ │ │ │ -
1219
│ │ │ │ -
1234 template<class G, class T1, class T2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1236 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ -
1237 RedistributeInterface& redistInf,
│ │ │ │ -
1238 bool verbose=false)
│ │ │ │ -
1239 {
│ │ │ │ -
1240 Timer time;
│ │ │ │ -
1241
│ │ │ │ -
1242 MPI_Comm comm=oocomm.communicator();
│ │ │ │ -
1243 oocomm.buildGlobalLookup(graph.noVertices());
│ │ │ │ -
1244 fillIndexSetHoles(graph, oocomm);
│ │ │ │ -
1245
│ │ │ │ -
1246 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ -
1247 std::cout<<"Filling holes took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1248 time.reset();
│ │ │ │ -
1249
│ │ │ │ -
1250 // simple precondition checks
│ │ │ │ -
1251
│ │ │ │ -
1252#ifdef PERF_REPART
│ │ │ │ -
1253 // Profiling variables
│ │ │ │ -
1254 double t1=0.0, t2=0.0, t3=0.0, t4=0.0, tSum=0.0;
│ │ │ │ -
1255#endif
│ │ │ │ -
1256
│ │ │ │ -
1257
│ │ │ │ -
1258 // MPI variables
│ │ │ │ -
1259 int mype = oocomm.communicator().rank();
│ │ │ │ -
1260
│ │ │ │ -
1261 assert(nparts<=static_cast<Metis::idx_t>(oocomm.communicator().size()));
│ │ │ │ -
1262
│ │ │ │ -
1263 int myDomain = -1;
│ │ │ │ -
1264
│ │ │ │ -
1265 //
│ │ │ │ -
1266 // 1) Prepare the required parameters for using ParMETIS
│ │ │ │ -
1267 // Especially the arrays that represent the graph must be
│ │ │ │ -
1268 // generated by the DUNE Graph and IndexSet input variables.
│ │ │ │ -
1269 // These are the arrays:
│ │ │ │ -
1270 // - vtxdist
│ │ │ │ -
1271 // - xadj
│ │ │ │ -
1272 // - adjncy
│ │ │ │ -
1273 //
│ │ │ │ -
1274 //
│ │ │ │ -
1275#ifdef PERF_REPART
│ │ │ │ -
1276 // reset timer for step 1)
│ │ │ │ -
1277 t1=MPI_Wtime();
│ │ │ │ -
1278#endif
│ │ │ │ -
1279
│ │ │ │ -
1280
│ │ │ │ -
1281 typedef typename Dune::OwnerOverlapCopyCommunication<T1,T2> OOComm;
│ │ │ │ -
1282 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ │ -
1283
│ │ │ │ -
1284 // Create the vtxdist array and parmetisVtxMapping.
│ │ │ │ -
1285 // Global communications are necessary
│ │ │ │ -
1286 // The parmetis global identifiers for the owner vertices.
│ │ │ │ -
1287 ParmetisDuneIndexMap indexMap(graph,oocomm);
│ │ │ │ -
1288 Metis::idx_t *part = new Metis::idx_t[indexMap.numOfOwnVtx()];
│ │ │ │ -
1289 for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i)
│ │ │ │ -
1290 part[i]=mype;
│ │ │ │ -
1291
│ │ │ │ -
1292#if !HAVE_PARMETIS
│ │ │ │ -
1293 if(oocomm.communicator().rank()==0 && nparts>1)
│ │ │ │ -
1294 std::cerr<<"ParMETIS not activated. Will repartition to 1 domain instead of requested "
│ │ │ │ -
1295 <<nparts<<" domains."<<std::endl;
│ │ │ │ -
1296 nparts=1; // No parmetis available, fallback to agglomerating to 1 process
│ │ │ │ -
1297
│ │ │ │ -
1298#else
│ │ │ │ -
1299
│ │ │ │ -
1300 if(nparts>1) {
│ │ │ │ -
1301 // Create the xadj and adjncy arrays
│ │ │ │ -
1302 Metis::idx_t *xadj = new Metis::idx_t[indexMap.numOfOwnVtx()+1];
│ │ │ │ -
1303 Metis::idx_t *adjncy = new Metis::idx_t[graph.noEdges()];
│ │ │ │ -
1304 EdgeFunctor<G> ef(adjncy, indexMap, graph.noEdges());
│ │ │ │ -
1305 getAdjArrays<OwnerSet>(graph, oocomm.globalLookup(), xadj, ef);
│ │ │ │ -
1306
│ │ │ │ -
1307 //
│ │ │ │ -
1308 // 2) Call ParMETIS
│ │ │ │ -
1309 //
│ │ │ │ -
1310 //
│ │ │ │ -
1311 Metis::idx_t numflag=0, wgtflag=0, options[3], edgecut=0, ncon=1;
│ │ │ │ -
1312 //float *tpwgts = NULL;
│ │ │ │ -
1313 Metis::real_t *tpwgts = new Metis::real_t[nparts];
│ │ │ │ -
1314 for(int i=0; i<nparts; ++i)
│ │ │ │ -
1315 tpwgts[i]=1.0/nparts;
│ │ │ │ -
1316 Metis::real_t ubvec[1];
│ │ │ │ -
1317 options[0] = 0; // 0=default, 1=options are defined in [1]+[2]
│ │ │ │ -
1318#ifdef DEBUG_REPART
│ │ │ │ -
1319 options[1] = 3; // show info: 0=no message
│ │ │ │ -
1320#else
│ │ │ │ -
1321 options[1] = 0; // show info: 0=no message
│ │ │ │ -
1322#endif
│ │ │ │ -
1323 options[2] = 1; // random number seed, default is 15
│ │ │ │ -
1324 wgtflag = (ef.getWeights()!=NULL) ? 1 : 0;
│ │ │ │ -
1325 numflag = 0;
│ │ │ │ -
1326 edgecut = 0;
│ │ │ │ -
1327 ncon=1;
│ │ │ │ -
1328 ubvec[0]=1.05; // recommended by ParMETIS
│ │ │ │ -
1329
│ │ │ │ -
1330#ifdef DEBUG_REPART
│ │ │ │ -
1331 if (mype == 0) {
│ │ │ │ -
1332 std::cout<<std::endl;
│ │ │ │ -
1333 std::cout<<"Testing ParMETIS_V3_PartKway with options[1-2] = {"
│ │ │ │ -
1334 <<options[1]<<" "<<options[2]<<"}, Ncon: "
│ │ │ │ -
1335 <<ncon<<", Nparts: "<<nparts<<std::endl;
│ │ │ │ -
1336 }
│ │ │ │ -
1337#endif
│ │ │ │ -
1338#ifdef PERF_REPART
│ │ │ │ -
1339 // stop the time for step 1)
│ │ │ │ -
1340 t1=MPI_Wtime()-t1;
│ │ │ │ -
1341 // reset timer for step 2)
│ │ │ │ -
1342 t2=MPI_Wtime();
│ │ │ │ -
1343#endif
│ │ │ │ -
1344
│ │ │ │ -
1345 if(verbose) {
│ │ │ │ -
1346 oocomm.communicator().barrier();
│ │ │ │ -
1347 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1348 std::cout<<"Preparing for parmetis took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1349 }
│ │ │ │ -
1350 time.reset();
│ │ │ │ -
1351
│ │ │ │ -
1352 //=======================================================
│ │ │ │ -
1353 // ParMETIS_V3_PartKway
│ │ │ │ -
1354 //=======================================================
│ │ │ │ -
1355 ParMETIS_V3_PartKway(indexMap.vtxDist(), xadj, adjncy,
│ │ │ │ -
1356 NULL, ef.getWeights(), &wgtflag,
│ │ │ │ -
1357 &numflag, &ncon, &nparts, tpwgts, ubvec, options, &edgecut, part, &const_cast<MPI_Comm&>(comm));
│ │ │ │ -
1358
│ │ │ │ -
1359
│ │ │ │ -
1360 delete[] xadj;
│ │ │ │ -
1361 delete[] adjncy;
│ │ │ │ -
1362 delete[] tpwgts;
│ │ │ │ -
1363
│ │ │ │ -
1364 ef.free();
│ │ │ │ -
1365
│ │ │ │ -
1366#ifdef DEBUG_REPART
│ │ │ │ -
1367 if (mype == 0) {
│ │ │ │ -
1368 std::cout<<std::endl;
│ │ │ │ -
1369 std::cout<<"ParMETIS_V3_PartKway reported a cut of "<<edgecut<<std::endl;
│ │ │ │ -
1370 std::cout<<std::endl;
│ │ │ │ -
1371 }
│ │ │ │ -
1372 std::cout<<mype<<": PARMETIS-Result: ";
│ │ │ │ -
1373 for(int i=0; i < indexMap.vtxDist()[mype+1]-indexMap.vtxDist()[mype]; ++i) {
│ │ │ │ -
1374 std::cout<<part[i]<<" ";
│ │ │ │ -
1375 }
│ │ │ │ -
1376 std::cout<<std::endl;
│ │ │ │ -
1377 std::cout<<"Testing ParMETIS_V3_PartKway with options[1-2] = {"
│ │ │ │ -
1378 <<options[1]<<" "<<options[2]<<"}, Ncon: "
│ │ │ │ -
1379 <<ncon<<", Nparts: "<<nparts<<std::endl;
│ │ │ │ -
1380#endif
│ │ │ │ -
1381#ifdef PERF_REPART
│ │ │ │ -
1382 // stop the time for step 2)
│ │ │ │ -
1383 t2=MPI_Wtime()-t2;
│ │ │ │ -
1384 // reset timer for step 3)
│ │ │ │ -
1385 t3=MPI_Wtime();
│ │ │ │ -
1386#endif
│ │ │ │ -
1387
│ │ │ │ -
1388
│ │ │ │ -
1389 if(verbose) {
│ │ │ │ -
1390 oocomm.communicator().barrier();
│ │ │ │ -
1391 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1392 std::cout<<"Parmetis took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1393 }
│ │ │ │ -
1394 time.reset();
│ │ │ │ -
1395 }else
│ │ │ │ -
1396#endif
│ │ │ │ -
1397 {
│ │ │ │ -
1398 // Everything goes to process 0!
│ │ │ │ -
1399 for(std::size_t i=0; i<indexMap.numOfOwnVtx(); ++i)
│ │ │ │ -
1400 part[i]=0;
│ │ │ │ -
1401 }
│ │ │ │ -
1402
│ │ │ │ -
1403
│ │ │ │ -
1404 //
│ │ │ │ -
1405 // 3) Find a optimal domain based on the ParMETIS repartitioning
│ │ │ │ -
1406 // result
│ │ │ │ -
1407 //
│ │ │ │ -
1408
│ │ │ │ -
1409 std::vector<int> domainMapping(nparts);
│ │ │ │ -
1410 if(nparts>1)
│ │ │ │ -
1411 getDomain(comm, part, indexMap.numOfOwnVtx(), nparts, &myDomain, domainMapping);
│ │ │ │ -
1412 else
│ │ │ │ -
1413 domainMapping[0]=0;
│ │ │ │ -
1414
│ │ │ │ -
1415#ifdef DEBUG_REPART
│ │ │ │ -
1416 std::cout<<mype<<": myDomain: "<<myDomain<<std::endl;
│ │ │ │ -
1417 std::cout<<mype<<": DomainMapping: ";
│ │ │ │ -
1418 for(auto j : range(nparts)) {
│ │ │ │ -
1419 std::cout<<" do: "<<j<<" pe: "<<domainMapping[j]<<" ";
│ │ │ │ -
1420 }
│ │ │ │ -
1421 std::cout<<std::endl;
│ │ │ │ -
1422#endif
│ │ │ │ -
1423
│ │ │ │ -
1424 // Make a domain mapping for the indexset and translate
│ │ │ │ -
1425 //domain number to real process number
│ │ │ │ -
1426 // domainMapping is the one of parmetis, that is without
│ │ │ │ -
1427 // the overlap/copy vertices
│ │ │ │ -
1428 std::vector<int> setPartition(oocomm.indexSet().size(), -1);
│ │ │ │ -
1429
│ │ │ │ -
1430 std::size_t i=0; // parmetis index
│ │ │ │ -
1431 for(auto index = oocomm.indexSet().begin(); index != oocomm.indexSet().end(); ++index)
│ │ │ │ -
1432 if(OwnerSet::contains(index->local().attribute())) {
│ │ │ │ -
1433 setPartition[index->local()]=domainMapping[part[i++]];
│ │ │ │ -
1434 }
│ │ │ │ -
1435
│ │ │ │ -
1436 delete[] part;
│ │ │ │ -
1437 oocomm.copyOwnerToAll(setPartition, setPartition);
│ │ │ │ -
1438 // communication only needed for ALU
│ │ │ │ -
1439 // (ghosts with same global id as owners on the same process)
│ │ │ │ -
1440 if (SolverCategory::category(oocomm) ==
│ │ │ │ -
1441 static_cast<int>(SolverCategory::nonoverlapping))
│ │ │ │ -
1442 oocomm.copyCopyToAll(setPartition, setPartition);
│ │ │ │ -
1443 bool ret = buildCommunication(graph, setPartition, oocomm, outcomm, redistInf,
│ │ │ │ -
1444 verbose);
│ │ │ │ -
1445 if(verbose) {
│ │ │ │ -
1446 oocomm.communicator().barrier();
│ │ │ │ -
1447 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1448 std::cout<<"Creating indexsets took "<<time.elapsed()<<std::endl;
│ │ │ │ -
1449 }
│ │ │ │ -
1450 return ret;
│ │ │ │ -
1451 }
│ │ │ │ -
│ │ │ │ -
1452
│ │ │ │ -
1453
│ │ │ │ -
1454
│ │ │ │ -
1455 template<class G, class T1, class T2>
│ │ │ │ -
│ │ │ │ -
1456 bool buildCommunication(const G& graph,
│ │ │ │ -
1457 std::vector<int>& setPartition, Dune::OwnerOverlapCopyCommunication<T1,T2>& oocomm,
│ │ │ │ -
1458 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ -
1459 RedistributeInterface& redistInf,
│ │ │ │ -
1460 bool verbose)
│ │ │ │ -
1461 {
│ │ │ │ -
1462 typedef typename Dune::OwnerOverlapCopyCommunication<T1,T2> OOComm;
│ │ │ │ -
1463 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ │ -
1464
│ │ │ │ -
1465 Timer time;
│ │ │ │ -
1466
│ │ │ │ -
1467 // Build the send interface
│ │ │ │ -
1468 redistInf.buildSendInterface<OwnerSet>(setPartition, oocomm.indexSet());
│ │ │ │ -
1469
│ │ │ │ -
1470#ifdef PERF_REPART
│ │ │ │ -
1471 // stop the time for step 3)
│ │ │ │ -
1472 t3=MPI_Wtime()-t3;
│ │ │ │ -
1473 // reset timer for step 4)
│ │ │ │ -
1474 t4=MPI_Wtime();
│ │ │ │ -
1475#endif
│ │ │ │ -
1476
│ │ │ │ -
1477
│ │ │ │ -
1478 //
│ │ │ │ -
1479 // 4) Create the output IndexSet and RemoteIndices
│ │ │ │ -
1480 // 4.1) Determine the "send to" and "receive from" relation
│ │ │ │ -
1481 // according to the new partition using a MPI ring
│ │ │ │ -
1482 // communication.
│ │ │ │ -
1483 //
│ │ │ │ -
1484 // 4.2) Depends on the "send to" and "receive from" vector,
│ │ │ │ -
1485 // the processes will exchange the vertices each other
│ │ │ │ -
1486 //
│ │ │ │ -
1487 // 4.3) Create the IndexSet, RemoteIndices and the new MPI
│ │ │ │ -
1488 // communicator
│ │ │ │ -
1489 //
│ │ │ │ -
1490
│ │ │ │ -
1491 //
│ │ │ │ -
1492 // 4.1) Let's start...
│ │ │ │ -
1493 //
│ │ │ │ -
1494 int npes = oocomm.communicator().size();
│ │ │ │ -
1495 int *sendTo = 0;
│ │ │ │ -
1496 int noSendTo = 0;
│ │ │ │ -
1497 std::set<int> recvFrom;
│ │ │ │ -
1498
│ │ │ │ -
1499 // the max number of vertices is stored in the sendTo buffer,
│ │ │ │ -
1500 // not the number of vertices to send! Because the max number of Vtx
│ │ │ │ -
1501 // is used as the fixed buffer size by the MPI send/receive calls
│ │ │ │ -
1502
│ │ │ │ -
1503 int mype = oocomm.communicator().rank();
│ │ │ │ -
1504
│ │ │ │ -
1505 {
│ │ │ │ -
1506 std::set<int> tsendTo;
│ │ │ │ -
1507 for(auto i=setPartition.begin(), iend = setPartition.end(); i!=iend; ++i)
│ │ │ │ -
1508 tsendTo.insert(*i);
│ │ │ │ -
1509
│ │ │ │ -
1510 noSendTo = tsendTo.size();
│ │ │ │ -
1511 sendTo = new int[noSendTo];
│ │ │ │ -
1512 int idx=0;
│ │ │ │ -
1513 for(auto i=tsendTo.begin(); i != tsendTo.end(); ++i, ++idx)
│ │ │ │ -
1514 sendTo[idx]=*i;
│ │ │ │ -
1515 }
│ │ │ │ -
1516
│ │ │ │ -
1517 //
│ │ │ │ -
1518 int* gnoSend= new int[oocomm.communicator().size()];
│ │ │ │ -
1519 int* gsendToDispl = new int[oocomm.communicator().size()+1];
│ │ │ │ -
1520
│ │ │ │ -
1521 MPI_Allgather(&noSendTo, 1, MPI_INT, gnoSend, 1,
│ │ │ │ -
1522 MPI_INT, oocomm.communicator());
│ │ │ │ -
1523
│ │ │ │ -
1524 // calculate total receive message size
│ │ │ │ -
1525 int totalNoRecv = 0;
│ │ │ │ -
1526 for(int i=0; i<npes; ++i)
│ │ │ │ -
1527 totalNoRecv += gnoSend[i];
│ │ │ │ -
1528
│ │ │ │ -
1529 int *gsendTo = new int[totalNoRecv];
│ │ │ │ -
1530
│ │ │ │ -
1531 // calculate displacement for allgatherv
│ │ │ │ -
1532 gsendToDispl[0]=0;
│ │ │ │ -
1533 for(int i=0; i<npes; ++i)
│ │ │ │ -
1534 gsendToDispl[i+1]=gsendToDispl[i]+gnoSend[i];
│ │ │ │ -
1535
│ │ │ │ -
1536 // gather the data
│ │ │ │ -
1537 MPI_Allgatherv(sendTo, noSendTo, MPI_INT, gsendTo, gnoSend, gsendToDispl,
│ │ │ │ -
1538 MPI_INT, oocomm.communicator());
│ │ │ │ -
1539
│ │ │ │ -
1540 // Extract from which processes we will receive data
│ │ │ │ -
1541 for(int proc=0; proc < npes; ++proc)
│ │ │ │ -
1542 for(int i=gsendToDispl[proc]; i < gsendToDispl[proc+1]; ++i)
│ │ │ │ -
1543 if(gsendTo[i]==mype)
│ │ │ │ -
1544 recvFrom.insert(proc);
│ │ │ │ -
1545
│ │ │ │ -
1546 bool existentOnNextLevel = recvFrom.size()>0;
│ │ │ │ -
1547
│ │ │ │ -
1548 // Delete memory
│ │ │ │ -
1549 delete[] gnoSend;
│ │ │ │ -
1550 delete[] gsendToDispl;
│ │ │ │ -
1551 delete[] gsendTo;
│ │ │ │ -
1552
│ │ │ │ -
1553
│ │ │ │ -
1554#ifdef DEBUG_REPART
│ │ │ │ -
1555 if(recvFrom.size()) {
│ │ │ │ -
1556 std::cout<<mype<<": recvFrom: ";
│ │ │ │ -
1557 for(auto i=recvFrom.begin(); i!= recvFrom.end(); ++i) {
│ │ │ │ -
1558 std::cout<<*i<<" ";
│ │ │ │ -
1559 }
│ │ │ │ -
1560 }
│ │ │ │ -
1561
│ │ │ │ -
1562 std::cout<<std::endl<<std::endl;
│ │ │ │ -
1563 std::cout<<mype<<": sendTo: ";
│ │ │ │ -
1564 for(int i=0; i<noSendTo; i++) {
│ │ │ │ -
1565 std::cout<<sendTo[i]<<" ";
│ │ │ │ -
1566 }
│ │ │ │ -
1567 std::cout<<std::endl<<std::endl;
│ │ │ │ -
1568#endif
│ │ │ │ -
1569
│ │ │ │ -
1570 if(verbose)
│ │ │ │ -
1571 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1572 std::cout<<" Communicating the receive information took "<<
│ │ │ │ -
1573 time.elapsed()<<std::endl;
│ │ │ │ -
1574 time.reset();
│ │ │ │ -
1575
│ │ │ │ -
1576 //
│ │ │ │ -
1577 // 4.2) Start the communication
│ │ │ │ -
1578 //
│ │ │ │ -
1579
│ │ │ │ -
1580 // Get all the owner and overlap vertices for myself ans save
│ │ │ │ -
1581 // it in the vectors myOwnerVec and myOverlapVec.
│ │ │ │ -
1582 // The received vertices from the other processes are simple
│ │ │ │ -
1583 // added to these vector.
│ │ │ │ -
1584 //
│ │ │ │ -
1585
│ │ │ │ -
1586
│ │ │ │ -
1587 typedef typename OOComm::ParallelIndexSet::GlobalIndex GI;
│ │ │ │ -
1588 typedef std::vector<GI> GlobalVector;
│ │ │ │ -
1589 std::vector<std::pair<GI,int> > myOwnerVec;
│ │ │ │ -
1590 std::set<GI> myOverlapSet;
│ │ │ │ -
1591 GlobalVector sendOwnerVec;
│ │ │ │ -
1592 std::set<GI> sendOverlapSet;
│ │ │ │ -
1593 std::set<int> myNeighbors;
│ │ │ │ -
1594
│ │ │ │ -
1595 // getOwnerOverlapVec<OwnerSet>(graph, setPartition, oocomm.globalLookup(),
│ │ │ │ -
1596 // mype, mype, myOwnerVec, myOverlapSet, redistInf, myNeighbors);
│ │ │ │ -
1597
│ │ │ │ -
1598 char **sendBuffers=new char*[noSendTo];
│ │ │ │ -
1599 MPI_Request *requests = new MPI_Request[noSendTo];
│ │ │ │ -
1600
│ │ │ │ -
1601 // Create all messages to be sent
│ │ │ │ -
1602 for(int i=0; i < noSendTo; ++i) {
│ │ │ │ -
1603 // clear the vector for sending
│ │ │ │ -
1604 sendOwnerVec.clear();
│ │ │ │ -
1605 sendOverlapSet.clear();
│ │ │ │ -
1606 // get all owner and overlap vertices for process j and save these
│ │ │ │ -
1607 // in the vectors sendOwnerVec and sendOverlapSet
│ │ │ │ -
1608 std::set<int> neighbors;
│ │ │ │ -
1609 getOwnerOverlapVec<OwnerSet>(graph, setPartition, oocomm.globalLookup(),
│ │ │ │ -
1610 mype, sendTo[i], sendOwnerVec, sendOverlapSet, redistInf,
│ │ │ │ -
1611 neighbors);
│ │ │ │ -
1612 // +2, we need 2 integer more for the length of each part
│ │ │ │ -
1613 // (owner/overlap) of the array
│ │ │ │ -
1614 int buffersize=0;
│ │ │ │ -
1615 int tsize;
│ │ │ │ -
1616 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &buffersize);
│ │ │ │ -
1617 MPI_Pack_size(sendOwnerVec.size(), MPITraits<GI>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ -
1618 buffersize +=tsize;
│ │ │ │ -
1619 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ -
1620 buffersize +=tsize;
│ │ │ │ -
1621 MPI_Pack_size(sendOverlapSet.size(), MPITraits<GI>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ -
1622 buffersize += tsize;
│ │ │ │ -
1623 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ -
1624 buffersize += tsize;
│ │ │ │ -
1625 MPI_Pack_size(neighbors.size(), MPI_INT, oocomm.communicator(), &tsize);
│ │ │ │ -
1626 buffersize += tsize;
│ │ │ │ -
1627
│ │ │ │ -
1628 sendBuffers[i] = new char[buffersize];
│ │ │ │ -
1629
│ │ │ │ -
1630#ifdef DEBUG_REPART
│ │ │ │ -
1631 std::cout<<mype<<" sending "<<sendOwnerVec.size()<<" owner and "<<
│ │ │ │ -
1632 sendOverlapSet.size()<<" overlap to "<<sendTo[i]<<" buffersize="<<buffersize<<std::endl;
│ │ │ │ -
1633#endif
│ │ │ │ -
1634 createSendBuf(sendOwnerVec, sendOverlapSet, neighbors, sendBuffers[i], buffersize, oocomm.communicator());
│ │ │ │ -
1635 MPI_Issend(sendBuffers[i], buffersize, MPI_PACKED, sendTo[i], 99, oocomm.communicator(), requests+i);
│ │ │ │ -
1636 }
│ │ │ │ -
1637
│ │ │ │ -
1638 if(verbose) {
│ │ │ │ -
1639 oocomm.communicator().barrier();
│ │ │ │ -
1640 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1641 std::cout<<" Creating sends took "<<
│ │ │ │ -
1642 time.elapsed()<<std::endl;
│ │ │ │ -
1643 }
│ │ │ │ -
1644 time.reset();
│ │ │ │ -
1645
│ │ │ │ -
1646 // Receive Messages
│ │ │ │ -
1647 int noRecv = recvFrom.size();
│ │ │ │ -
1648 int oldbuffersize=0;
│ │ │ │ -
1649 char* recvBuf = 0;
│ │ │ │ -
1650 while(noRecv>0) {
│ │ │ │ -
1651 // probe for an incoming message
│ │ │ │ -
1652 MPI_Status stat;
│ │ │ │ -
1653 MPI_Probe(MPI_ANY_SOURCE, 99, oocomm.communicator(), &stat);
│ │ │ │ -
1654 int buffersize;
│ │ │ │ -
1655 MPI_Get_count(&stat, MPI_PACKED, &buffersize);
│ │ │ │ -
1656
│ │ │ │ -
1657 if(oldbuffersize<buffersize) {
│ │ │ │ -
1658 // buffer too small, reallocate
│ │ │ │ -
1659 delete[] recvBuf;
│ │ │ │ -
1660 recvBuf = new char[buffersize];
│ │ │ │ -
1661 oldbuffersize = buffersize;
│ │ │ │ -
1662 }
│ │ │ │ -
1663 MPI_Recv(recvBuf, buffersize, MPI_PACKED, stat.MPI_SOURCE, 99, oocomm.communicator(), &stat);
│ │ │ │ -
1664 saveRecvBuf(recvBuf, buffersize, myOwnerVec, myOverlapSet, myNeighbors, redistInf,
│ │ │ │ -
1665 stat.MPI_SOURCE, oocomm.communicator());
│ │ │ │ -
1666 --noRecv;
│ │ │ │ -
1667 }
│ │ │ │ -
1668
│ │ │ │ -
1669 if(recvBuf)
│ │ │ │ -
1670 delete[] recvBuf;
│ │ │ │ -
1671
│ │ │ │ -
1672 time.reset();
│ │ │ │ -
1673 // Wait for sending messages to complete
│ │ │ │ -
1674 MPI_Status *statuses = new MPI_Status[noSendTo];
│ │ │ │ -
1675 int send = MPI_Waitall(noSendTo, requests, statuses);
│ │ │ │ -
1676
│ │ │ │ -
1677 // check for errors
│ │ │ │ -
1678 if(send==MPI_ERR_IN_STATUS) {
│ │ │ │ -
1679 std::cerr<<mype<<": Error in sending :"<<std::endl;
│ │ │ │ -
1680 // Search for the error
│ │ │ │ -
1681 for(int i=0; i< noSendTo; i++)
│ │ │ │ -
1682 if(statuses[i].MPI_ERROR!=MPI_SUCCESS) {
│ │ │ │ -
1683 char message[300];
│ │ │ │ -
1684 int messageLength;
│ │ │ │ -
1685 MPI_Error_string(statuses[i].MPI_ERROR, message, &messageLength);
│ │ │ │ -
1686 std::cerr<<" source="<<statuses[i].MPI_SOURCE<<" message: ";
│ │ │ │ -
1687 for(int j = 0; j < messageLength; j++)
│ │ │ │ -
1688 std::cout<<message[j];
│ │ │ │ -
1689 }
│ │ │ │ -
1690 std::cerr<<std::endl;
│ │ │ │ -
1691 }
│ │ │ │ -
1692
│ │ │ │ -
1693 if(verbose) {
│ │ │ │ -
1694 oocomm.communicator().barrier();
│ │ │ │ -
1695 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1696 std::cout<<" Receiving and saving took "<<
│ │ │ │ -
1697 time.elapsed()<<std::endl;
│ │ │ │ -
1698 }
│ │ │ │ -
1699 time.reset();
│ │ │ │ -
1700
│ │ │ │ -
1701 for(int i=0; i < noSendTo; ++i)
│ │ │ │ -
1702 delete[] sendBuffers[i];
│ │ │ │ -
1703
│ │ │ │ -
1704 delete[] sendBuffers;
│ │ │ │ -
1705 delete[] statuses;
│ │ │ │ -
1706 delete[] requests;
│ │ │ │ -
1707
│ │ │ │ -
1708 redistInf.setCommunicator(oocomm.communicator());
│ │ │ │ -
1709
│ │ │ │ -
1710 //
│ │ │ │ -
1711 // 4.2) Create the IndexSet etc.
│ │ │ │ -
1712 //
│ │ │ │ -
1713
│ │ │ │ -
1714 // build the new outputIndexSet
│ │ │ │ -
1715
│ │ │ │ -
1716
│ │ │ │ -
1717 int color=0;
│ │ │ │ -
1718
│ │ │ │ -
1719 if (!existentOnNextLevel) {
│ │ │ │ -
1720 // this process is not used anymore
│ │ │ │ -
1721 color= MPI_UNDEFINED;
│ │ │ │ -
1722 }
│ │ │ │ -
1723 MPI_Comm outputComm;
│ │ │ │ -
1724
│ │ │ │ -
1725 MPI_Comm_split(oocomm.communicator(), color, oocomm.communicator().rank(), &outputComm);
│ │ │ │ -
1726 outcomm = std::make_shared<OOComm>(outputComm,SolverCategory::category(oocomm),true);
│ │ │ │ -
1727
│ │ │ │ -
1728 // translate neighbor ranks.
│ │ │ │ -
1729 int newrank=outcomm->communicator().rank();
│ │ │ │ -
1730 int *newranks=new int[oocomm.communicator().size()];
│ │ │ │ -
1731 std::vector<int> tneighbors;
│ │ │ │ -
1732 tneighbors.reserve(myNeighbors.size());
│ │ │ │ -
1733
│ │ │ │ -
1734 typename OOComm::ParallelIndexSet& outputIndexSet = outcomm->indexSet();
│ │ │ │ -
1735
│ │ │ │ -
1736 MPI_Allgather(&newrank, 1, MPI_INT, newranks, 1,
│ │ │ │ -
1737 MPI_INT, oocomm.communicator());
│ │ │ │ -
1738
│ │ │ │ -
1739#ifdef DEBUG_REPART
│ │ │ │ -
1740 std::cout<<oocomm.communicator().rank()<<" ";
│ │ │ │ -
1741 for(auto i=myNeighbors.begin(), end=myNeighbors.end();
│ │ │ │ -
1742 i!=end; ++i) {
│ │ │ │ -
1743 assert(newranks[*i]>=0);
│ │ │ │ -
1744 std::cout<<*i<<"->"<<newranks[*i]<<" ";
│ │ │ │ -
1745 tneighbors.push_back(newranks[*i]);
│ │ │ │ -
1746 }
│ │ │ │ -
1747 std::cout<<std::endl;
│ │ │ │ -
1748#else
│ │ │ │ -
1749 for(auto i=myNeighbors.begin(), end=myNeighbors.end();
│ │ │ │ -
1750 i!=end; ++i) {
│ │ │ │ -
1751 tneighbors.push_back(newranks[*i]);
│ │ │ │ -
1752 }
│ │ │ │ -
1753#endif
│ │ │ │ -
1754 delete[] newranks;
│ │ │ │ -
1755 myNeighbors.clear();
│ │ │ │ -
1756
│ │ │ │ -
1757 if(verbose) {
│ │ │ │ -
1758 oocomm.communicator().barrier();
│ │ │ │ -
1759 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1760 std::cout<<" Calculating new neighbours ("<<tneighbors.size()<<") took "<<
│ │ │ │ -
1761 time.elapsed()<<std::endl;
│ │ │ │ -
1762 }
│ │ │ │ -
1763 time.reset();
│ │ │ │ -
1764
│ │ │ │ -
1765
│ │ │ │ -
1766 outputIndexSet.beginResize();
│ │ │ │ -
1767 // 1) add the owner vertices
│ │ │ │ -
1768 // Sort the owners
│ │ │ │ -
1769 std::sort(myOwnerVec.begin(), myOwnerVec.end(), SortFirst());
│ │ │ │ -
1770 // The owners are sorted according to there global index
│ │ │ │ -
1771 // Therefore the entries of ownerVec are the same as the
│ │ │ │ -
1772 // ones in the resulting index set.
│ │ │ │ -
1773 int i=0;
│ │ │ │ -
1774 using LocalIndexT = typename OOComm::ParallelIndexSet::LocalIndex;
│ │ │ │ -
1775 for(auto g=myOwnerVec.begin(), end =myOwnerVec.end(); g!=end; ++g, ++i ) {
│ │ │ │ -
1776 outputIndexSet.add(g->first,LocalIndexT(i, OwnerOverlapCopyAttributeSet::owner, true));
│ │ │ │ -
1777 redistInf.addReceiveIndex(g->second, i);
│ │ │ │ -
1778 }
│ │ │ │ -
1779
│ │ │ │ -
1780 if(verbose) {
│ │ │ │ -
1781 oocomm.communicator().barrier();
│ │ │ │ -
1782 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1783 std::cout<<" Adding owner indices took "<<
│ │ │ │ -
1784 time.elapsed()<<std::endl;
│ │ │ │ -
1785 }
│ │ │ │ -
1786 time.reset();
│ │ │ │ -
1787
│ │ │ │ -
1788
│ │ │ │ -
1789 // After all the vertices are received, the vectors must
│ │ │ │ -
1790 // be "merged" together to create the final vectors.
│ │ │ │ -
1791 // Because some vertices that are sent as overlap could now
│ │ │ │ -
1792 // already included as owner vertiecs in the new partition
│ │ │ │ -
1793 mergeVec(myOwnerVec, myOverlapSet);
│ │ │ │ -
1794
│ │ │ │ -
1795 // Trick to free memory
│ │ │ │ -
1796 myOwnerVec.clear();
│ │ │ │ -
1797 myOwnerVec.swap(myOwnerVec);
│ │ │ │ -
1798
│ │ │ │ -
1799 if(verbose) {
│ │ │ │ -
1800 oocomm.communicator().barrier();
│ │ │ │ -
1801 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1802 std::cout<<" Merging indices took "<<
│ │ │ │ -
1803 time.elapsed()<<std::endl;
│ │ │ │ -
1804 }
│ │ │ │ -
1805 time.reset();
│ │ │ │ -
1806
│ │ │ │ -
1807
│ │ │ │ -
1808 // 2) add the overlap vertices
│ │ │ │ -
1809 for(auto g=myOverlapSet.begin(), end=myOverlapSet.end(); g!=end; ++g, i++) {
│ │ │ │ -
1810 outputIndexSet.add(*g,LocalIndexT(i, OwnerOverlapCopyAttributeSet::copy, true));
│ │ │ │ -
1811 }
│ │ │ │ -
1812 myOverlapSet.clear();
│ │ │ │ -
1813 outputIndexSet.endResize();
│ │ │ │ -
1814
│ │ │ │ -
1815#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1816 int numOfOwnVtx =0;
│ │ │ │ -
1817 auto end = outputIndexSet.end();
│ │ │ │ -
1818 for(auto index = outputIndexSet.begin(); index != end; ++index) {
│ │ │ │ -
1819 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ │ -
1820 numOfOwnVtx++;
│ │ │ │ -
1821 }
│ │ │ │ -
1822 }
│ │ │ │ -
1823 numOfOwnVtx = oocomm.communicator().sum(numOfOwnVtx);
│ │ │ │ -
1824 // if(numOfOwnVtx!=indexMap.globalOwnerVertices)
│ │ │ │ -
1825 // {
│ │ │ │ -
1826 // std::cerr<<numOfOwnVtx<<"!="<<indexMap.globalOwnerVertices<<" owners missing or additional ones!"<<std::endl;
│ │ │ │ -
1827 // DUNE_THROW(ISTLError, numOfOwnVtx<<"!="<<indexMap.globalOwnerVertices<<" owners missing or additional ones"
│ │ │ │ -
1828 // <<" during repartitioning.");
│ │ │ │ -
1829 // }
│ │ │ │ -
1830 std::is_sorted(outputIndexSet.begin(), outputIndexSet.end(),
│ │ │ │ -
1831 [](const auto& v1, const auto& v2){ return v1.global() < v2.global();});
│ │ │ │ -
1832#endif
│ │ │ │ -
1833 if(verbose) {
│ │ │ │ -
1834 oocomm.communicator().barrier();
│ │ │ │ -
1835 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1836 std::cout<<" Adding overlap indices took "<<
│ │ │ │ -
1837 time.elapsed()<<std::endl;
│ │ │ │ -
1838 }
│ │ │ │ -
1839 time.reset();
│ │ │ │ -
1840
│ │ │ │ -
1841
│ │ │ │ -
1842 if(color != MPI_UNDEFINED) {
│ │ │ │ -
1843 outcomm->remoteIndices().setNeighbours(tneighbors);
│ │ │ │ -
1844 outcomm->remoteIndices().template rebuild<true>();
│ │ │ │ -
1845
│ │ │ │ -
1846 }
│ │ │ │ -
1847
│ │ │ │ -
1848 // release the memory
│ │ │ │ -
1849 delete[] sendTo;
│ │ │ │ -
1850
│ │ │ │ -
1851 if(verbose) {
│ │ │ │ -
1852 oocomm.communicator().barrier();
│ │ │ │ -
1853 if(oocomm.communicator().rank()==0)
│ │ │ │ -
1854 std::cout<<" Storing indexsets took "<<
│ │ │ │ -
1855 time.elapsed()<<std::endl;
│ │ │ │ -
1856 }
│ │ │ │ -
1857
│ │ │ │ -
1858#ifdef PERF_REPART
│ │ │ │ -
1859 // stop the time for step 4) and print the results
│ │ │ │ -
1860 t4=MPI_Wtime()-t4;
│ │ │ │ -
1861 tSum = t1 + t2 + t3 + t4;
│ │ │ │ -
1862 std::cout<<std::endl
│ │ │ │ -
1863 <<mype<<": WTime for step 1): "<<t1
│ │ │ │ -
1864 <<" 2): "<<t2
│ │ │ │ -
1865 <<" 3): "<<t3
│ │ │ │ -
1866 <<" 4): "<<t4
│ │ │ │ -
1867 <<" total: "<<tSum
│ │ │ │ -
1868 <<std::endl;
│ │ │ │ -
1869#endif
│ │ │ │ -
1870
│ │ │ │ -
1871 return color!=MPI_UNDEFINED;
│ │ │ │ -
1872
│ │ │ │ -
1873 }
│ │ │ │ -
│ │ │ │ -
1874#else
│ │ │ │ -
1875 template<class G, class P,class T1, class T2, class R>
│ │ │ │ -
1876 bool graphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ │ -
1877 std::shared_ptr<P>& outcomm,
│ │ │ │ -
1878 R& redistInf,
│ │ │ │ -
1879 bool v=false)
│ │ │ │ -
1880 {
│ │ │ │ -
1881 if(nparts!=oocomm.size())
│ │ │ │ -
1882 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ │ -
1883 }
│ │ │ │ -
1884
│ │ │ │ -
1885
│ │ │ │ -
1886 template<class G, class P,class T1, class T2, class R>
│ │ │ │ -
1887 bool commGraphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ │ -
1888 std::shared_ptr<P>& outcomm,
│ │ │ │ -
1889 R& redistInf,
│ │ │ │ -
1890 bool v=false)
│ │ │ │ -
1891 {
│ │ │ │ -
1892 if(nparts!=oocomm.size())
│ │ │ │ -
1893 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ │ -
1894 }
│ │ │ │ -
1895#endif // HAVE_MPI
│ │ │ │ -
1896} // end of namespace Dune
│ │ │ │ -
1897#endif
│ │ │ │ -
int globalOwnerVertices
Definition repartition.hh:175
│ │ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ -
Provides classes for building the matrix graph.
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
777
│ │ │ │ + │ │ │ │ +
779 // fill sparsity pattern from copy rows
│ │ │ │ +
780 CommMatrixRow<M,IndexSet> origrow_copy(origMatrix, origComm.globalLookup(),
│ │ │ │ +
781 newComm.indexSet(), backwardscopyrowsize);
│ │ │ │ +
782 CommMatrixRow<M,IndexSet> newrow_copy(newMatrix, origComm.globalLookup(),
│ │ │ │ +
783 newComm.indexSet(),copyrowsize);
│ │ │ │ +
784 ri.template redistribute<MatrixRowGatherScatter<M,IndexSet> >(origrow_copy,
│ │ │ │ +
785 newrow_copy);
│ │ │ │ +
786 ri.getInterface().free();
│ │ │ │ +
787 RemoteIndices<IndexSet> *ris = new RemoteIndices<IndexSet>(origComm.indexSet(),
│ │ │ │ +
788 newComm.indexSet(),
│ │ │ │ +
789 origComm.communicator());
│ │ │ │ +
790 ris->template rebuild<true>();
│ │ │ │ +
791 ri.getInterface().build(*ris,ownerflags,ownerflags);
│ │ │ │ +
792 }
│ │ │ │ +
793
│ │ │ │ + │ │ │ │ +
795 origrow(origMatrix, origComm.globalLookup(), newComm.indexSet());
│ │ │ │ + │ │ │ │ +
797 newrow(newMatrix, origComm.globalLookup(), newComm.indexSet(),rowsize);
│ │ │ │ +
798 ri.template redistribute<MatrixRowGatherScatter<M,IndexSet> >(origrow,newrow);
│ │ │ │ +
799 if (SolverCategory::category(origComm) != static_cast<int>(SolverCategory::nonoverlapping))
│ │ │ │ + │ │ │ │ +
801 }
│ │ │ │ +
│ │ │ │ +
802
│ │ │ │ +
819 template<typename M, typename C>
│ │ │ │ +
│ │ │ │ +
820 void redistributeMatrix(M& origMatrix, M& newMatrix, C& origComm, C& newComm,
│ │ │ │ + │ │ │ │ +
822 {
│ │ │ │ +
823 ri.setNoRows(newComm.indexSet().size());
│ │ │ │ +
824 ri.setNoCopyRows(newComm.indexSet().size());
│ │ │ │ +
825 ri.setNoBackwardsCopyRows(origComm.indexSet().size());
│ │ │ │ +
826 redistributeSparsityPattern(origMatrix, newMatrix, origComm, newComm, ri);
│ │ │ │ +
827 redistributeMatrixEntries(origMatrix, newMatrix, origComm, newComm, ri);
│ │ │ │ +
828 }
│ │ │ │ +
│ │ │ │ +
829#endif
│ │ │ │ +
830
│ │ │ │ +
831template<typename M>
│ │ │ │ +
│ │ │ │ +
832 void redistributeMatrixEntries(M& origMatrix, M& newMatrix,
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
836 {
│ │ │ │ +
837 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential program!");
│ │ │ │ +
838 }
│ │ │ │ +
│ │ │ │ +
839 template<typename M>
│ │ │ │ +
│ │ │ │ +
840 void redistributeMatrix(M& origMatrix, M& newMatrix,
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
844 {
│ │ │ │ +
845 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential program!");
│ │ │ │ +
846 }
│ │ │ │ +
│ │ │ │ +
847}
│ │ │ │ +
848#endif
│ │ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ +
Functionality for redistributing a parallel index set using graph partitioning.
│ │ │ │ + │ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │
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:1456
│ │ │ │ -
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:829
│ │ │ │ -
void print_carray(S &os, T *array, std::size_t l)
Definition repartition.hh:778
│ │ │ │ -
bool isValidGraph(std::size_t noVtx, std::size_t gnoVtx, S noEdges, T *xadj, T *adjncy, bool checkSymmetry)
Definition repartition.hh:785
│ │ │ │ -
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:1235
│ │ │ │ -
float real_t
Definition repartition.hh:53
│ │ │ │ -
std::size_t idx_t
Definition repartition.hh:63
│ │ │ │ -
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ │ +
void redistributeMatrixEntries(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Definition matrixredistribute.hh:757
│ │ │ │ +
void redistributeSparsityPattern(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Definition matrixredistribute.hh:663
│ │ │ │ +
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
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
Definition matrixredistribute.hh:22
│ │ │ │ +
void setNoBackwardsCopyRows(std::size_t size)
Definition matrixredistribute.hh:44
│ │ │ │ +
void redistribute(const D &from, D &to) const
Definition matrixredistribute.hh:28
│ │ │ │ +
void resetSetup()
Definition matrixredistribute.hh:35
│ │ │ │ +
void setNoCopyRows(std::size_t size)
Definition matrixredistribute.hh:41
│ │ │ │ +
bool isSetup() const
Definition matrixredistribute.hh:23
│ │ │ │ +
void setNoRows(std::size_t size)
Definition matrixredistribute.hh:38
│ │ │ │ +
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:32
│ │ │ │ +
std::size_t getBackwardsCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:57
│ │ │ │ +
std::size_t getRowSize(std::size_t index) const
Definition matrixredistribute.hh:47
│ │ │ │ +
std::size_t getCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:52
│ │ │ │ +
std::size_t getRowSize(std::size_t index) const
Definition matrixredistribute.hh:158
│ │ │ │ +
std::size_t & getBackwardsCopyRowSize(std::size_t index)
Definition matrixredistribute.hh:173
│ │ │ │ +
RedistributeInterface & getInterface()
Definition matrixredistribute.hh:75
│ │ │ │ +
void redistribute(const D &from, D &to) const
Definition matrixredistribute.hh:136
│ │ │ │ +
void setNoBackwardsCopyRows(std::size_t rows)
Definition matrixredistribute.hh:193
│ │ │ │ +
std::size_t & getCopyRowSize(std::size_t index)
Definition matrixredistribute.hh:163
│ │ │ │ + │ │ │ │ +
std::size_t getCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:168
│ │ │ │ +
void setNoRows(std::size_t rows)
Definition matrixredistribute.hh:183
│ │ │ │ +
void reserve(std::size_t size)
Definition matrixredistribute.hh:150
│ │ │ │ +
OwnerOverlapCopyCommunication< T, T1 > Comm
Definition matrixredistribute.hh:69
│ │ │ │ +
void setNoCopyRows(std::size_t rows)
Definition matrixredistribute.hh:188
│ │ │ │ +
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:141
│ │ │ │ + │ │ │ │ +
std::size_t getBackwardsCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:178
│ │ │ │ +
void redistribute(const D &from, D &to) const
Definition matrixredistribute.hh:118
│ │ │ │ + │ │ │ │ +
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:126
│ │ │ │ +
void checkInterface(const IS &source, const IS &target, MPI_Comm comm)
Definition matrixredistribute.hh:80
│ │ │ │ +
bool isSetup() const
Definition matrixredistribute.hh:145
│ │ │ │ +
std::size_t & getRowSize(std::size_t index)
Definition matrixredistribute.hh:153
│ │ │ │ +
Utility class to communicate and set the row sizes of a redistributed matrix.
Definition matrixredistribute.hh:216
│ │ │ │ +
M::size_type size_type
Definition matrixredistribute.hh:219
│ │ │ │ +
M::size_type value_type
Definition matrixredistribute.hh:218
│ │ │ │ +
RI & rowsize
Definition matrixredistribute.hh:230
│ │ │ │ +
const M & matrix
Definition matrixredistribute.hh:229
│ │ │ │ +
CommMatrixRowSize(const M &m_, RI &rowsize_)
Constructor.
Definition matrixredistribute.hh:226
│ │ │ │ +
Utility class to communicate and build the sparsity pattern of a redistributed matrix.
Definition matrixredistribute.hh:245
│ │ │ │ +
M::size_type size_type
Definition matrixredistribute.hh:246
│ │ │ │ +
const Dune::GlobalLookupIndexSet< I > & idxset
Definition matrixredistribute.hh:356
│ │ │ │ +
void storeSparsityPattern(M &m)
Creates and stores the sparsity pattern of the redistributed matrix.
Definition matrixredistribute.hh:276
│ │ │ │ +
const I & aggidxset
Definition matrixredistribute.hh:357
│ │ │ │ +
const std::vector< size_type > * rowsize
Definition matrixredistribute.hh:359
│ │ │ │ +
void completeSparsityPattern(std::vector< std::set< size_type > > add_sparsity)
Completes the sparsity pattern of the redistributed matrix with data from copy rows for the novlp cas...
Definition matrixredistribute.hh:340
│ │ │ │ +
CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_)
Constructor for the original side.
Definition matrixredistribute.hh:254
│ │ │ │ +
const M & matrix
Definition matrixredistribute.hh:354
│ │ │ │ +
CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_, const std::vector< typename M::size_type > &rowsize_)
Constructor for the redistruted side.
Definition matrixredistribute.hh:265
│ │ │ │ +
std::vector< std::set< size_type > > sparsity
Definition matrixredistribute.hh:358
│ │ │ │ +
Dune::GlobalLookupIndexSet< I > LookupIndexSet
Definition matrixredistribute.hh:355
│ │ │ │ +
static M::size_type getSize(const Type &t, std::size_t i)
Definition matrixredistribute.hh:376
│ │ │ │ +
CommMatrixSparsityPattern< M, I > Type
Definition matrixredistribute.hh:365
│ │ │ │ +
I::GlobalIndex IndexedType
The indexed type we send. This is the global index indentitfying the column.
Definition matrixredistribute.hh:371
│ │ │ │ +
VariableSize IndexedTypeFlag
Each row varies in size.
Definition matrixredistribute.hh:374
│ │ │ │ +
Utility class for comunicating the matrix entries.
Definition matrixredistribute.hh:396
│ │ │ │ +
std::vector< size_t > * rowsize
row size information for the receiving side.
Definition matrixredistribute.hh:452
│ │ │ │ +
M & matrix
The matrix to communicate the values of.
Definition matrixredistribute.hh:446
│ │ │ │ +
CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_, std::vector< size_t > &rowsize_)
Constructor.
Definition matrixredistribute.hh:412
│ │ │ │ +
const Dune::GlobalLookupIndexSet< I > & idxset
Index set for the original matrix.
Definition matrixredistribute.hh:448
│ │ │ │ +
void setOverlapRowsToDirichlet()
Sets the non-owner rows correctly as Dirichlet boundaries.
Definition matrixredistribute.hh:421
│ │ │ │ +
const I & aggidxset
Index set for the redistributed matrix.
Definition matrixredistribute.hh:450
│ │ │ │ +
CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_)
Constructor.
Definition matrixredistribute.hh:405
│ │ │ │ +
std::pair< typename I::GlobalIndex, typename M::block_type > IndexedType
The indexed type we send. This is the pair of global index indentitfying the column and the value its...
Definition matrixredistribute.hh:464
│ │ │ │ +
CommMatrixRow< M, I > Type
Definition matrixredistribute.hh:458
│ │ │ │ +
static std::size_t getSize(const Type &t, std::size_t i)
Definition matrixredistribute.hh:469
│ │ │ │ +
VariableSize IndexedTypeFlag
Each row varies in size.
Definition matrixredistribute.hh:467
│ │ │ │ +
Definition matrixredistribute.hh:483
│ │ │ │ +
static void scatter(Container &cont, const typename M::size_type &rowsize, std::size_t i)
Definition matrixredistribute.hh:490
│ │ │ │ +
static const M::size_type gather(const Container &cont, std::size_t i)
Definition matrixredistribute.hh:486
│ │ │ │ +
CommMatrixRowSize< M, RI > Container
Definition matrixredistribute.hh:484
│ │ │ │ +
Definition matrixredistribute.hh:500
│ │ │ │ +
static const M::size_type gather(const Container &cont, std::size_t i)
Definition matrixredistribute.hh:503
│ │ │ │ +
static void scatter(Container &cont, const typename M::size_type &rowsize, std::size_t i)
Definition matrixredistribute.hh:507
│ │ │ │ +
CommMatrixRowSize< M, RI > Container
Definition matrixredistribute.hh:501
│ │ │ │ +
Definition matrixredistribute.hh:518
│ │ │ │ +
M::ConstColIterator ColIter
Definition matrixredistribute.hh:521
│ │ │ │ +
static void scatter(Container &cont, const GlobalIndex &gi, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:553
│ │ │ │ +
CommMatrixSparsityPattern< M, I > Container
Definition matrixredistribute.hh:520
│ │ │ │ +
static GlobalIndex numlimits
Definition matrixredistribute.hh:524
│ │ │ │ +
static ColIter col
Definition matrixredistribute.hh:523
│ │ │ │ +
I::GlobalIndex GlobalIndex
Definition matrixredistribute.hh:519
│ │ │ │ +
static const GlobalIndex & gather(const Container &cont, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:526
│ │ │ │ +
Definition matrixredistribute.hh:599
│ │ │ │ +
I::GlobalIndex GlobalIndex
Definition matrixredistribute.hh:600
│ │ │ │ +
static Data datastore
Definition matrixredistribute.hh:605
│ │ │ │ +
static GlobalIndex numlimits
Definition matrixredistribute.hh:606
│ │ │ │ +
M::ConstColIterator ColIter
Definition matrixredistribute.hh:602
│ │ │ │ +
static const Data & gather(const Container &cont, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:608
│ │ │ │ +
std::pair< GlobalIndex, typename M::block_type > Data
Definition matrixredistribute.hh:603
│ │ │ │ +
static void scatter(Container &cont, const Data &data, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:638
│ │ │ │ +
static ColIter col
Definition matrixredistribute.hh:604
│ │ │ │ +
CommMatrixRow< M, I > Container
Definition matrixredistribute.hh:601
│ │ │ │
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ -
const GlobalLookupIndexSet & globalLookup() const
Definition owneroverlapcopy.hh:526
│ │ │ │ -
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:462
│ │ │ │ -
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ │ -
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ │ -
void buildGlobalLookup()
Definition owneroverlapcopy.hh:495
│ │ │ │ -
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ │ -
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ -
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ │ -
void freeGlobalLookup()
Definition owneroverlapcopy.hh:520
│ │ │ │ -
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ │ +
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet
Definition owneroverlapcopy.hh:194
│ │ │ │ +
Definition pinfo.hh:28
│ │ │ │
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
│ │ │ │ -
~RedistributeInterface()
Definition repartition.hh:301
│ │ │ │ -
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1986 +1,1173 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -repartition.hh │ │ │ │ │ +matrixredistribute.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 (C) 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 │ │ │ │ │ -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". Therfore no nested extern "C" will be created │ │ │ │ │ -17extern "C" │ │ │ │ │ -18{ │ │ │ │ │ -19#include │ │ │ │ │ -20} │ │ │ │ │ -21#endif │ │ │ │ │ -22 │ │ │ │ │ -23#include │ │ │ │ │ -24#include │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27#include │ │ │ │ │ -28#include │ │ │ │ │ -29#include │ │ │ │ │ -30#include │ │ │ │ │ -31#include │ │ │ │ │ -32 │ │ │ │ │ -33#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ │ -34#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ │ -35 │ │ │ │ │ -44namespace _D_u_n_e │ │ │ │ │ -45{ │ │ │ │ │ -_4_6 namespace Metis │ │ │ │ │ -47 { │ │ │ │ │ -48 // Explicitly specify a real_t and idx_t for older (Par)METIS versions that │ │ │ │ │ -do not │ │ │ │ │ -49 // provide these typedefs │ │ │ │ │ -50#if HAVE_PARMETIS && defined(REALTYPEWIDTH) │ │ │ │ │ -51 using _r_e_a_l___t = _:_:_r_e_a_l___t; │ │ │ │ │ -52#else │ │ │ │ │ -_5_3 using _r_e_a_l___t = float; │ │ │ │ │ -54#endif │ │ │ │ │ -55 │ │ │ │ │ -56#if HAVE_PARMETIS && defined(IDXTYPEWIDTH) │ │ │ │ │ -57 using _i_d_x___t = _:_:_i_d_x___t; │ │ │ │ │ -58#elif HAVE_PARMETIS && defined(HAVE_SCOTCH_NUM_TYPE) │ │ │ │ │ -59 using _i_d_x___t = SCOTCH_Num; │ │ │ │ │ -60#elif HAVE_PARMETIS │ │ │ │ │ -61 using _i_d_x___t = int; │ │ │ │ │ -62#else │ │ │ │ │ -_6_3 using _i_d_x___t = std::size_t; │ │ │ │ │ -64#endif │ │ │ │ │ -65 } │ │ │ │ │ -66 │ │ │ │ │ -67 │ │ │ │ │ -68#if HAVE_MPI │ │ │ │ │ -82 template │ │ │ │ │ -_8_3 void _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(const G& graph, _D_u_n_e_:_: │ │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm) │ │ │ │ │ -84 { │ │ │ │ │ -85 typedef typename _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>_:_: │ │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t IndexSet; │ │ │ │ │ -86 typedef typename IndexSet::LocalIndex::Attribute Attribute; │ │ │ │ │ -87 │ │ │ │ │ -88 IndexSet& indexSet = oocomm._i_n_d_e_x_S_e_t(); │ │ │ │ │ -89 const typename _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>_:_: │ │ │ │ │ -_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& lookup =oocomm._g_l_o_b_a_l_L_o_o_k_u_p(); │ │ │ │ │ -90 │ │ │ │ │ -91 std::size_t sum=0, needed = graph.noVertices()-indexSet.size(); │ │ │ │ │ -92 std::vector neededall(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size(), 0); │ │ │ │ │ -93 │ │ │ │ │ -94 MPI_Allgather(&needed, 1, MPITraits::getType() , &(neededall │ │ │ │ │ -[0]), 1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -95 for(int i=0; i │ │ │ │ │ +8#include "_r_e_p_a_r_t_i_t_i_o_n_._h_h" │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +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_/_p_i_n_f_o_._h_h> │ │ │ │ │ +18namespace _D_u_n_e │ │ │ │ │ +19{ │ │ │ │ │ +20 template │ │ │ │ │ +_2_1 struct _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +22 { │ │ │ │ │ +_2_3 bool _i_s_S_e_t_u_p() const │ │ │ │ │ +24 { │ │ │ │ │ +25 return false; │ │ │ │ │ +26 } │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 void _r_e_d_i_s_t_r_i_b_u_t_e([[maybe_unused]] const D& from, [[maybe_unused]] D& to) │ │ │ │ │ +const │ │ │ │ │ +29 {} │ │ │ │ │ +30 │ │ │ │ │ +31 template │ │ │ │ │ +_3_2 void _r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d([[maybe_unused]] D& from, [[maybe_unused]]const D& │ │ │ │ │ +to) const │ │ │ │ │ +33 {} │ │ │ │ │ +34 │ │ │ │ │ +_3_5 void _r_e_s_e_t_S_e_t_u_p() │ │ │ │ │ +36 {} │ │ │ │ │ +37 │ │ │ │ │ +_3_8 void _s_e_t_N_o_R_o_w_s([[maybe_unused]] std::size_t size) │ │ │ │ │ +39 {} │ │ │ │ │ +40 │ │ │ │ │ +_4_1 void _s_e_t_N_o_C_o_p_y_R_o_w_s([[maybe_unused]] std::size_t size) │ │ │ │ │ +42 {} │ │ │ │ │ +43 │ │ │ │ │ +_4_4 void _s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s([[maybe_unused]] std::size_t size) │ │ │ │ │ +45 {} │ │ │ │ │ +46 │ │ │ │ │ +_4_7 std::size_t _g_e_t_R_o_w_S_i_z_e([[maybe_unused]] std::size_t index) const │ │ │ │ │ +48 { │ │ │ │ │ +49 return -1; │ │ │ │ │ +50 } │ │ │ │ │ +51 │ │ │ │ │ +_5_2 std::size_t _g_e_t_C_o_p_y_R_o_w_S_i_z_e([[maybe_unused]] std::size_t index) const │ │ │ │ │ +53 { │ │ │ │ │ +54 return -1; │ │ │ │ │ +55 } │ │ │ │ │ +56 │ │ │ │ │ +_5_7 std::size_t _g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e([[maybe_unused]] std::size_t index) │ │ │ │ │ +const │ │ │ │ │ +58 { │ │ │ │ │ +59 return -1; │ │ │ │ │ +60 } │ │ │ │ │ +61 │ │ │ │ │ +62 }; │ │ │ │ │ +63 │ │ │ │ │ +64#if HAVE_MPI │ │ │ │ │ +65 template │ │ │ │ │ +_6_6 class _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 > │ │ │ │ │ +67 { │ │ │ │ │ +68 public: │ │ │ │ │ +_6_9 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_,_T_1_> _C_o_m_m; │ │ │ │ │ +70 │ │ │ │ │ +_7_1 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() │ │ │ │ │ +72 : interface(), setup_(false) │ │ │ │ │ +73 {} │ │ │ │ │ +74 │ │ │ │ │ +_7_5 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& _g_e_t_I_n_t_e_r_f_a_c_e() │ │ │ │ │ +76 { │ │ │ │ │ +77 return interface; │ │ │ │ │ +78 } │ │ │ │ │ +79 template │ │ │ │ │ +_8_0 void _c_h_e_c_k_I_n_t_e_r_f_a_c_e(const IS& source, │ │ │ │ │ +81 const IS& target, MPI_Comm comm) │ │ │ │ │ +82 { │ │ │ │ │ +83 auto ri = std::make_unique >(source, target, comm); │ │ │ │ │ +84 ri->template rebuild(); │ │ │ │ │ +85 Interface inf; │ │ │ │ │ +86 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t flags; │ │ │ │ │ +87 int rank; │ │ │ │ │ +88 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ +89 inf.free(); │ │ │ │ │ +90 inf.build(*ri, flags, flags); │ │ │ │ │ +91 │ │ │ │ │ +92 │ │ │ │ │ +93#ifdef DEBUG_REPART │ │ │ │ │ +94 if(inf!=interface) { │ │ │ │ │ +95 │ │ │ │ │ +96 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ +97 if(rank==0) │ │ │ │ │ +98 std::cout<<"Interfaces do not match!"<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._c_o_m_m_u_n_i_c_a_t_o_r().max(maxgi); │ │ │ │ │ -112 ++maxgi; //Sart with the next free index. │ │ │ │ │ -113 │ │ │ │ │ -114 for(int i=0; i > > globalIndices; │ │ │ │ │ -119 storeGlobalIndicesOfRemoteIndices(globalIndices, oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s()); │ │ │ │ │ -120 indexSet.beginResize(); │ │ │ │ │ -121 │ │ │ │ │ -122 for(auto vertex = graph.begin(), vend=graph.end(); vertex != vend; │ │ │ │ │ -++vertex) { │ │ │ │ │ -123 const typename IndexSet::IndexPair* pair=lookup.pair(*vertex); │ │ │ │ │ -124 if(pair==0) { │ │ │ │ │ -125 // No index yet, add new one │ │ │ │ │ -126 indexSet.add(maxgi, typename IndexSet::LocalIndex(*vertex, │ │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r, false)); │ │ │ │ │ -127 ++maxgi; │ │ │ │ │ -128 } │ │ │ │ │ -129 } │ │ │ │ │ -130 │ │ │ │ │ -131 indexSet.endResize(); │ │ │ │ │ -132 │ │ │ │ │ -133 repairLocalIndexPointers(globalIndices, oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s(), indexSet); │ │ │ │ │ +117 template │ │ │ │ │ +_1_1_8 void _r_e_d_i_s_t_r_i_b_u_t_e(const D& from, D& to) const │ │ │ │ │ +119 { │ │ │ │ │ +120 BufferedCommunicator communicator; │ │ │ │ │ +121 communicator.template build(from,to, interface); │ │ │ │ │ +122 communicator.template forward(from, to); │ │ │ │ │ +123 communicator.free(); │ │ │ │ │ +124 } │ │ │ │ │ +125 template │ │ │ │ │ +_1_2_6 void _r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(D& from, const D& to) const │ │ │ │ │ +127 { │ │ │ │ │ +128 │ │ │ │ │ +129 BufferedCommunicator communicator; │ │ │ │ │ +130 communicator.template build(from,to, interface); │ │ │ │ │ +131 communicator.template backward(from, to); │ │ │ │ │ +132 communicator.free(); │ │ │ │ │ +133 } │ │ │ │ │ 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!"< │ │ │ │ │ -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 │ │ │ │ │ +135 template │ │ │ │ │ +_1_3_6 void _r_e_d_i_s_t_r_i_b_u_t_e(const D& from, D& to) const │ │ │ │ │ +137 { │ │ │ │ │ +138 redistribute >(from,to); │ │ │ │ │ +139 } │ │ │ │ │ +140 template │ │ │ │ │ +_1_4_1 void _r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(D& from, const D& to) const │ │ │ │ │ +142 { │ │ │ │ │ +143 redistributeBackward >(from,to); │ │ │ │ │ +144 } │ │ │ │ │ +_1_4_5 bool _i_s_S_e_t_u_p() const │ │ │ │ │ +146 { │ │ │ │ │ +147 return setup_; │ │ │ │ │ +148 } │ │ │ │ │ +149 │ │ │ │ │ +_1_5_0 void _r_e_s_e_r_v_e(std::size_t size) │ │ │ │ │ +151 {} │ │ │ │ │ +152 │ │ │ │ │ +_1_5_3 std::size_t& _g_e_t_R_o_w_S_i_z_e(std::size_t index) │ │ │ │ │ +154 { │ │ │ │ │ +155 return rowSize[index]; │ │ │ │ │ +156 } │ │ │ │ │ +157 │ │ │ │ │ +_1_5_8 std::size_t _g_e_t_R_o_w_S_i_z_e(std::size_t index) const │ │ │ │ │ +159 { │ │ │ │ │ +160 return rowSize[index]; │ │ │ │ │ +161 } │ │ │ │ │ +162 │ │ │ │ │ +_1_6_3 std::size_t& _g_e_t_C_o_p_y_R_o_w_S_i_z_e(std::size_t index) │ │ │ │ │ 164 { │ │ │ │ │ -165 return parmetisToDune[i]; │ │ │ │ │ +165 return copyrowSize[index]; │ │ │ │ │ 166 } │ │ │ │ │ -167 std::vector::size_type numOfOwnVtx() const │ │ │ │ │ -168 { │ │ │ │ │ -169 return parmetisToDune.size(); │ │ │ │ │ -170 } │ │ │ │ │ -171 _M_e_t_i_s_:_:_i_d_x___t* vtxDist() │ │ │ │ │ -172 { │ │ │ │ │ -173 return &vtxDist_[0]; │ │ │ │ │ -174 } │ │ │ │ │ -_1_7_5 int _g_l_o_b_a_l_O_w_n_e_r_V_e_r_t_i_c_e_s; │ │ │ │ │ -176 private: │ │ │ │ │ -177 int base_; │ │ │ │ │ -178 std::vector duneToParmetis; │ │ │ │ │ -179 std::vector parmetisToDune; │ │ │ │ │ -180 // range of vertices for processor i: vtxdist[i] to vtxdist[i+1] (parmetis │ │ │ │ │ -global) │ │ │ │ │ -181 std::vector vtxDist_; │ │ │ │ │ -182 }; │ │ │ │ │ -183 │ │ │ │ │ -184 template │ │ │ │ │ -185 ParmetisDuneIndexMap::ParmetisDuneIndexMap(const G& graph, const OOComm& │ │ │ │ │ -oocomm) │ │ │ │ │ -186 : duneToParmetis(graph.noVertices(), -1), vtxDist_(oocomm.communicator │ │ │ │ │ -().size()+1) │ │ │ │ │ -187 { │ │ │ │ │ -188 int npes=oocomm.communicator().size(), mype=oocomm.communicator().rank(); │ │ │ │ │ -189 │ │ │ │ │ -190 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ │ -191 │ │ │ │ │ -192 int numOfOwnVtx=0; │ │ │ │ │ -193 auto end = oocomm.indexSet().end(); │ │ │ │ │ -194 for(auto index = oocomm.indexSet().begin(); index != end; ++index) { │ │ │ │ │ -195 if (OwnerSet::contains(index->local().attribute())) { │ │ │ │ │ -196 numOfOwnVtx++; │ │ │ │ │ -197 } │ │ │ │ │ -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; ilocal().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 < rowSize; │ │ │ │ │ +200 std::vector copyrowSize; │ │ │ │ │ +201 std::vector backwardscopyrowSize; │ │ │ │ │ +202 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e interface; │ │ │ │ │ +203 bool setup_; │ │ │ │ │ +204 }; │ │ │ │ │ +205 │ │ │ │ │ +214 template │ │ │ │ │ +_2_1_5 struct _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e │ │ │ │ │ +216 { │ │ │ │ │ +217 // Make the default communication policy work. │ │ │ │ │ +_2_1_8 typedef typename M::size_type _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_2_1_9 typedef typename M::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +220 │ │ │ │ │ +_2_2_6 _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e(const M& m_, RI& rowsize_) │ │ │ │ │ +227 : _m_a_t_r_i_x(m_), _r_o_w_s_i_z_e(rowsize_) │ │ │ │ │ +228 {} │ │ │ │ │ +_2_2_9 const M& _m_a_t_r_i_x; │ │ │ │ │ +_2_3_0 RI& _r_o_w_s_i_z_e; │ │ │ │ │ +231 │ │ │ │ │ +232 }; │ │ │ │ │ +233 │ │ │ │ │ +234 │ │ │ │ │ +243 template │ │ │ │ │ +_2_4_4 struct _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ +245 { │ │ │ │ │ +_2_4_6 typedef typename M::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +247 │ │ │ │ │ +_2_5_4 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(const M& m_, const Dune::GlobalLookupIndexSet& │ │ │ │ │ +idxset_, const I& aggidxset_) │ │ │ │ │ +255 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _r_o_w_s_i_z_e() │ │ │ │ │ +256 {} │ │ │ │ │ 257 │ │ │ │ │ -_2_5_8 struct _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ │ -259 : public Interface │ │ │ │ │ -260 { │ │ │ │ │ -_2_6_1 void _s_e_t_C_o_m_m_u_n_i_c_a_t_o_r(MPI_Comm comm) │ │ │ │ │ -262 { │ │ │ │ │ -263 communicator_=comm; │ │ │ │ │ -264 } │ │ │ │ │ -265 template │ │ │ │ │ -_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; │ │ │ │ │ +_2_6_5 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(const M& m_, const Dune::GlobalLookupIndexSet& │ │ │ │ │ +idxset_, const I& aggidxset_, │ │ │ │ │ +266 const std::vector& rowsize_) │ │ │ │ │ +267 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _s_p_a_r_s_i_t_y │ │ │ │ │ +(aggidxset_.size()), _r_o_w_s_i_z_e(&rowsize_) │ │ │ │ │ +268 {} │ │ │ │ │ 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 │ │ │ │ │ -_3_0_1 _~_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e() │ │ │ │ │ -302 {} │ │ │ │ │ -303 │ │ │ │ │ -304 }; │ │ │ │ │ -305 │ │ │ │ │ -306 namespace │ │ │ │ │ -307 { │ │ │ │ │ -317 template │ │ │ │ │ -318 void createSendBuf(std::vector& ownerVec, std::set& overlapVec, │ │ │ │ │ -std::set& neighbors, char *sendBuf, int buffersize, MPI_Comm comm) { │ │ │ │ │ -319 // Pack owner vertices │ │ │ │ │ -320 std::size_t s=ownerVec.size(); │ │ │ │ │ -321 int pos=0; │ │ │ │ │ -322 if(s==0) │ │ │ │ │ -323 ownerVec.resize(1); // otherwise would read beyond the memory bound │ │ │ │ │ -324 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ -&pos, comm); │ │ │ │ │ -325 MPI_Pack(&(ownerVec[0]), s, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ -&pos, comm); │ │ │ │ │ -326 s = overlapVec.size(); │ │ │ │ │ -327 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ -&pos, comm); │ │ │ │ │ -328 for(auto i=overlapVec.begin(), end= overlapVec.end(); i != end; ++i) │ │ │ │ │ -329 MPI_Pack(const_cast(&(*i)), 1, MPITraits::getType(), sendBuf, │ │ │ │ │ -buffersize, &pos, comm); │ │ │ │ │ -330 │ │ │ │ │ -331 s=neighbors.size(); │ │ │ │ │ -332 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ -&pos, comm); │ │ │ │ │ -333 │ │ │ │ │ -334 for(auto i=neighbors.begin(), end= neighbors.end(); i != end; ++i) │ │ │ │ │ -335 MPI_Pack(const_cast(&(*i)), 1, MPI_INT, sendBuf, buffersize, &pos, │ │ │ │ │ -comm); │ │ │ │ │ -336 } │ │ │ │ │ -345 template │ │ │ │ │ -346 void saveRecvBuf(char *recvBuf, int bufferSize, std::vector >& ownerVec, │ │ │ │ │ -347 std::set& overlapVec, std::set& neighbors, RedistributeInterface& │ │ │ │ │ -inf, int from, MPI_Comm comm) { │ │ │ │ │ -348 std::size_t size; │ │ │ │ │ -349 int pos=0; │ │ │ │ │ -350 // unpack owner vertices │ │ │ │ │ -351 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ │ -getType(), comm); │ │ │ │ │ -352 inf.reserveSpaceForReceiveInterface(from, size); │ │ │ │ │ -353 ownerVec.reserve(ownerVec.size()+size); │ │ │ │ │ -354 for(; size!=0; --size) { │ │ │ │ │ -355 GI gi; │ │ │ │ │ -356 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits::getType(), │ │ │ │ │ -comm); │ │ │ │ │ -357 ownerVec.push_back(std::make_pair(gi,from)); │ │ │ │ │ -358 } │ │ │ │ │ -359 // unpack overlap vertices │ │ │ │ │ -360 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ │ -getType(), comm); │ │ │ │ │ -361 typename std::set::iterator ipos = overlapVec.begin(); │ │ │ │ │ -362 Dune::dverb << "unpacking "<::getType(), │ │ │ │ │ -comm); │ │ │ │ │ -366 ipos=overlapVec.insert(ipos, gi); │ │ │ │ │ -367 } │ │ │ │ │ -368 //unpack neighbors │ │ │ │ │ -369 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ │ -getType(), comm); │ │ │ │ │ -370 Dune::dverb << "unpacking "<::iterator npos = neighbors.begin(); │ │ │ │ │ -372 for(; size!=0; --size) { │ │ │ │ │ -373 int n; │ │ │ │ │ -374 MPI_Unpack(recvBuf, bufferSize, &pos, &n, 1, MPI_INT, comm); │ │ │ │ │ -375 npos=neighbors.insert(npos, n); │ │ │ │ │ -376 } │ │ │ │ │ -377 } │ │ │ │ │ -378 │ │ │ │ │ -392 template │ │ │ │ │ -393 void getDomain(const MPI_Comm& comm, T *part, int numOfOwnVtx, int nparts, │ │ │ │ │ -int *myDomain, std::vector &domainMapping) { │ │ │ │ │ -394 int npes, mype; │ │ │ │ │ -395 MPI_Comm_size(comm, &npes); │ │ │ │ │ -396 MPI_Comm_rank(comm, &mype); │ │ │ │ │ -397 MPI_Status status; │ │ │ │ │ -398 │ │ │ │ │ -399 *myDomain = -1; │ │ │ │ │ -400 int i=0; │ │ │ │ │ -401 int j=0; │ │ │ │ │ -402 │ │ │ │ │ -403 std::vector domain(nparts, 0); │ │ │ │ │ -404 std::vector assigned(npes, 0); │ │ │ │ │ -405 // init domain Mapping │ │ │ │ │ -406 domainMapping.assign(domainMapping.size(), -1); │ │ │ │ │ -407 │ │ │ │ │ -408 // count the occurrence of domains │ │ │ │ │ -409 for (i=0; i domainMatrix(npes * nparts, -1); │ │ │ │ │ -414 │ │ │ │ │ -415 // init buffer with the own domain │ │ │ │ │ -416 int *buf = new int[nparts]; │ │ │ │ │ -417 for (i=0; i unassigned; │ │ │ │ │ -442 │ │ │ │ │ -443 for(i=0; i::iterator next_free = assigned.begin(); │ │ │ │ │ -472 │ │ │ │ │ -473 for(auto udomain = unassigned.begin(), │ │ │ │ │ -474 end = unassigned.end(); udomain != end; ++udomain) │ │ │ │ │ -475 { │ │ │ │ │ -476 next_free = std::find_if(next_free, assigned.end(), std::bind(std:: │ │ │ │ │ -less(), std::placeholders::_1, 1)); │ │ │ │ │ -477 assert(next_free != assigned.end()); │ │ │ │ │ -478 domainMapping[*udomain] = next_free-assigned.begin(); │ │ │ │ │ -479 *next_free = 1; │ │ │ │ │ -480 } │ │ │ │ │ -481 } │ │ │ │ │ -482 │ │ │ │ │ -483 struct SortFirst │ │ │ │ │ -484 { │ │ │ │ │ -485 template │ │ │ │ │ -486 bool operator()(const T& t1, const T& t2) const │ │ │ │ │ +_2_7_6 void _s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(M& m) │ │ │ │ │ +277 { │ │ │ │ │ +278 // insert diagonal to overlap rows │ │ │ │ │ +279 typedef typename Dune::GlobalLookupIndexSet::const_iterator IIter; │ │ │ │ │ +280 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ +OwnerSet; │ │ │ │ │ +281 std::size_t nnz=0; │ │ │ │ │ +282#ifdef DEBUG_REPART │ │ │ │ │ +283 int rank; │ │ │ │ │ +284 │ │ │ │ │ +285 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ +286#endif │ │ │ │ │ +287 for(IIter i= _a_g_g_i_d_x_s_e_t.begin(), end=_a_g_g_i_d_x_s_e_t.end(); i!=end; ++i) { │ │ │ │ │ +288 if(!OwnerSet::contains(i->local().attribute())) { │ │ │ │ │ +289#ifdef DEBUG_REPART │ │ │ │ │ +290 std::cout<local()<local()].insert(i->local()); │ │ │ │ │ +293 } │ │ │ │ │ +294 │ │ │ │ │ +295 nnz+=_s_p_a_r_s_i_t_y[i->local()].size(); │ │ │ │ │ +296 } │ │ │ │ │ +297 assert( _a_g_g_i_d_x_s_e_t.size()==_s_p_a_r_s_i_t_y.size()); │ │ │ │ │ +298 │ │ │ │ │ +299 if(nnz>0) { │ │ │ │ │ +300 m.setSize(_a_g_g_i_d_x_s_e_t.size(), _a_g_g_i_d_x_s_e_t.size(), nnz); │ │ │ │ │ +301 m.setBuildMode(M::row_wise); │ │ │ │ │ +302 typename M::CreateIterator citer=m.createbegin(); │ │ │ │ │ +303#ifdef DEBUG_REPART │ │ │ │ │ +304 std::size_t idx=0; │ │ │ │ │ +305 bool correct=true; │ │ │ │ │ +306 Dune::GlobalLookupIndexSet global(_a_g_g_i_d_x_s_e_t); │ │ │ │ │ +307#endif │ │ │ │ │ +308 typedef typename std::vector >::const_iterator Iter; │ │ │ │ │ +309 for(Iter i=_s_p_a_r_s_i_t_y.begin(), end=_s_p_a_r_s_i_t_y.end(); i!=end; ++i, ++citer) │ │ │ │ │ +310 { │ │ │ │ │ +311 typedef typename std::set::const_iterator SIter; │ │ │ │ │ +312 for(SIter si=i->begin(), send=i->end(); si!=send; ++si) │ │ │ │ │ +313 citer.insert(*si); │ │ │ │ │ +314#ifdef DEBUG_REPART │ │ │ │ │ +315 if(i->find(idx)==i->end()) { │ │ │ │ │ +316 const typename I::IndexPair* gi=global.pair(idx); │ │ │ │ │ +317 assert(gi); │ │ │ │ │ +318 std::cout<local().attribute())<< │ │ │ │ │ +320 " row size="<size()< > │ │ │ │ │ +add_sparsity) │ │ │ │ │ +341 { │ │ │ │ │ +342 for (unsigned int i = 0; i != _s_p_a_r_s_i_t_y.size(); ++i) { │ │ │ │ │ +343 if (add_sparsity[i].size() != 0) { │ │ │ │ │ +344 typedef std::set Set; │ │ │ │ │ +345 Set tmp_set; │ │ │ │ │ +346 std::insert_iterator tmp_insert (tmp_set, tmp_set.begin()); │ │ │ │ │ +347 std::set_union(add_sparsity[i].begin(), add_sparsity[i].end(), │ │ │ │ │ +348 _s_p_a_r_s_i_t_y[i].begin(), _s_p_a_r_s_i_t_y[i].end(), tmp_insert); │ │ │ │ │ +349 _s_p_a_r_s_i_t_y[i].swap(tmp_set); │ │ │ │ │ +350 } │ │ │ │ │ +351 } │ │ │ │ │ +352 } │ │ │ │ │ +353 │ │ │ │ │ +_3_5_4 const M& _m_a_t_r_i_x; │ │ │ │ │ +_3_5_5 typedef Dune::GlobalLookupIndexSet _L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ │ +_3_5_6 const Dune::GlobalLookupIndexSet& _i_d_x_s_e_t; │ │ │ │ │ +_3_5_7 const I& _a_g_g_i_d_x_s_e_t; │ │ │ │ │ +_3_5_8 std::vector > _s_p_a_r_s_i_t_y; │ │ │ │ │ +_3_5_9 const std::vector* _r_o_w_s_i_z_e; │ │ │ │ │ +360 }; │ │ │ │ │ +361 │ │ │ │ │ +362 template │ │ │ │ │ +_3_6_3 struct CommPolicy<_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n > │ │ │ │ │ +364 { │ │ │ │ │ +_3_6_5 typedef _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_> _T_y_p_e; │ │ │ │ │ +366 │ │ │ │ │ +_3_7_1 typedef typename I::GlobalIndex _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +372 │ │ │ │ │ +_3_7_4 typedef VariableSize _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ +375 │ │ │ │ │ +_3_7_6 static typename M::size_type _g_e_t_S_i_z_e(const _T_y_p_e& t, std::size_t i) │ │ │ │ │ +377 { │ │ │ │ │ +378 if(!t._r_o_w_s_i_z_e) │ │ │ │ │ +379 return t._m_a_t_r_i_x[i].size(); │ │ │ │ │ +380 else │ │ │ │ │ +381 { │ │ │ │ │ +382 assert((*t._r_o_w_s_i_z_e)[i]>0); │ │ │ │ │ +383 return (*t._r_o_w_s_i_z_e)[i]; │ │ │ │ │ +384 } │ │ │ │ │ +385 } │ │ │ │ │ +386 }; │ │ │ │ │ +387 │ │ │ │ │ +394 template │ │ │ │ │ +_3_9_5 struct _C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ +396 { │ │ │ │ │ +_4_0_5 _C_o_m_m_M_a_t_r_i_x_R_o_w(M& m_, const Dune::GlobalLookupIndexSet& idxset_, const I& │ │ │ │ │ +aggidxset_) │ │ │ │ │ +406 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _r_o_w_s_i_z_e() │ │ │ │ │ +407 {} │ │ │ │ │ +408 │ │ │ │ │ +_4_1_2 _C_o_m_m_M_a_t_r_i_x_R_o_w(M& m_, const Dune::GlobalLookupIndexSet& idxset_, const I& │ │ │ │ │ +aggidxset_, │ │ │ │ │ +413 std::vector& rowsize_) │ │ │ │ │ +414 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _r_o_w_s_i_z_e(&rowsize_) │ │ │ │ │ +415 {} │ │ │ │ │ +_4_2_1 void _s_e_t_O_v_e_r_l_a_p_R_o_w_s_T_o_D_i_r_i_c_h_l_e_t() │ │ │ │ │ +422 { │ │ │ │ │ +423 typedef typename Dune::GlobalLookupIndexSet::const_iterator Iter; │ │ │ │ │ +424 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ +OwnerSet; │ │ │ │ │ +425 │ │ │ │ │ +426 for(Iter i= _a_g_g_i_d_x_s_e_t.begin(), end=_a_g_g_i_d_x_s_e_t.end(); i!=end; ++i) │ │ │ │ │ +427 if(!OwnerSet::contains(i->local().attribute())) { │ │ │ │ │ +428 // Set to Dirchlet │ │ │ │ │ +429 typedef typename M::ColIterator CIter; │ │ │ │ │ +430 for(CIter c=_m_a_t_r_i_x[i->local()].begin(), cend= _m_a_t_r_i_x[i->local()].end(); │ │ │ │ │ +431 c!= cend; ++c) │ │ │ │ │ +432 { │ │ │ │ │ +433 *c=0; │ │ │ │ │ +434 if(c.index()==i->local()) { │ │ │ │ │ +435 auto setDiagonal = [](auto&& scalarOrMatrix, const auto& value) { │ │ │ │ │ +436 auto&& matrixView = Dune::Impl::asMatrix(scalarOrMatrix); │ │ │ │ │ +437 for (auto rowIt = matrixView.begin(); rowIt != matrixView.end(); ++rowIt) │ │ │ │ │ +438 (*rowIt)[rowIt.index()] = value; │ │ │ │ │ +439 }; │ │ │ │ │ +440 setDiagonal(*c, 1); │ │ │ │ │ +441 } │ │ │ │ │ +442 } │ │ │ │ │ +443 } │ │ │ │ │ +444 } │ │ │ │ │ +_4_4_6 M& _m_a_t_r_i_x; │ │ │ │ │ +_4_4_8 const Dune::GlobalLookupIndexSet& _i_d_x_s_e_t; │ │ │ │ │ +_4_5_0 const I& _a_g_g_i_d_x_s_e_t; │ │ │ │ │ +_4_5_2 std::vector* _r_o_w_s_i_z_e; // row sizes differ from sender side in │ │ │ │ │ +overlap! │ │ │ │ │ +453 }; │ │ │ │ │ +454 │ │ │ │ │ +455 template │ │ │ │ │ +_4_5_6 struct CommPolicy<_C_o_m_m_M_a_t_r_i_x_R_o_w > │ │ │ │ │ +457 { │ │ │ │ │ +_4_5_8 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_> _T_y_p_e; │ │ │ │ │ +459 │ │ │ │ │ +_4_6_4 typedef std::pair │ │ │ │ │ +_I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +465 │ │ │ │ │ +_4_6_7 typedef VariableSize _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ +468 │ │ │ │ │ +_4_6_9 static std::size_t _g_e_t_S_i_z_e(const _T_y_p_e& t, std::size_t i) │ │ │ │ │ +470 { │ │ │ │ │ +471 if(!t._r_o_w_s_i_z_e) │ │ │ │ │ +472 return t._m_a_t_r_i_x[i].size(); │ │ │ │ │ +473 else │ │ │ │ │ +474 { │ │ │ │ │ +475 assert((*t._r_o_w_s_i_z_e)[i]>0); │ │ │ │ │ +476 return (*t._r_o_w_s_i_z_e)[i]; │ │ │ │ │ +477 } │ │ │ │ │ +478 } │ │ │ │ │ +479 }; │ │ │ │ │ +480 │ │ │ │ │ +481 template │ │ │ │ │ +_4_8_2 struct _M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +483 { │ │ │ │ │ +_4_8_4 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ +485 │ │ │ │ │ +_4_8_6 static const typename M::size_type _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std:: │ │ │ │ │ +size_t i) │ │ │ │ │ 487 { │ │ │ │ │ -488 return t1 │ │ │ │ │ -504 void mergeVec(std::vector >& ownerVec, std::set& │ │ │ │ │ -overlapSet) { │ │ │ │ │ -505 │ │ │ │ │ -506#ifdef DEBUG_REPART │ │ │ │ │ -507 // Safety check for duplicates. │ │ │ │ │ -508 if(ownerVec.size()>0) │ │ │ │ │ -509 { │ │ │ │ │ -510 auto old=ownerVec.begin(); │ │ │ │ │ -511 for(auto i=old+1, end=ownerVec.end(); i != end; old=i++) │ │ │ │ │ -512 { │ │ │ │ │ -513 if(i->first==old->first) │ │ │ │ │ -514 { │ │ │ │ │ -515 std::cerr<<"Value at indes"<first<<","<second<<"]==[" │ │ │ │ │ -517 <first<<","<second<<"]"< │ │ │ │ │ +_4_9_9 struct _M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +500 { │ │ │ │ │ +_5_0_1 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ +502 │ │ │ │ │ +_5_0_3 static const typename M::size_type _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std:: │ │ │ │ │ +size_t i) │ │ │ │ │ +504 { │ │ │ │ │ +505 return cont._m_a_t_r_i_x[i].size(); │ │ │ │ │ +506 } │ │ │ │ │ +_5_0_7 static void _s_c_a_t_t_e_r(_C_o_n_t_a_i_n_e_r& cont, const typename M::size_type& rowsize, │ │ │ │ │ +std::size_t i) │ │ │ │ │ +508 { │ │ │ │ │ +509 assert(rowsize); │ │ │ │ │ +510 if (rowsize > cont._r_o_w_s_i_z_e.getCopyRowSize(i)) │ │ │ │ │ +511 cont._r_o_w_s_i_z_e.getCopyRowSize(i)=rowsize; │ │ │ │ │ +512 } │ │ │ │ │ +513 │ │ │ │ │ +514 }; │ │ │ │ │ +515 │ │ │ │ │ +516 template │ │ │ │ │ +_5_1_7 struct _M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +518 { │ │ │ │ │ +_5_1_9 typedef typename I::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +_5_2_0 typedef _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ +_5_2_1 typedef typename M::ConstColIterator _C_o_l_I_t_e_r; │ │ │ │ │ 522 │ │ │ │ │ -523#endif │ │ │ │ │ -524 │ │ │ │ │ -525 auto v=ownerVec.begin(), vend=ownerVec.end(); │ │ │ │ │ -526 for(auto s=overlapSet.begin(), send=overlapSet.end(); s!=send;) │ │ │ │ │ +_5_2_3 static _C_o_l_I_t_e_r _c_o_l; │ │ │ │ │ +_5_2_4 static _G_l_o_b_a_l_I_n_d_e_x _n_u_m_l_i_m_i_t_s; │ │ │ │ │ +525 │ │ │ │ │ +_5_2_6 static const _G_l_o_b_a_l_I_n_d_e_x& _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std::size_t i, │ │ │ │ │ +std::size_t j) │ │ │ │ │ 527 { │ │ │ │ │ -528 while(v!=vend && v->first<*s) ++v; │ │ │ │ │ -529 if(v!=vend && v->first==*s) { │ │ │ │ │ -530 // Move to the next element before erasing │ │ │ │ │ -531 // thus s stays valid! │ │ │ │ │ -532 auto tmp=s; │ │ │ │ │ -533 ++s; │ │ │ │ │ -534 overlapSet.erase(tmp); │ │ │ │ │ -535 }else │ │ │ │ │ -536 ++s; │ │ │ │ │ -537 } │ │ │ │ │ -538 } │ │ │ │ │ -539 │ │ │ │ │ -540 │ │ │ │ │ -554 template │ │ │ │ │ -555 void getNeighbor(const Graph& g, std::vector& part, │ │ │ │ │ -556 typename Graph::VertexDescriptor vtx, const IS& indexSet, │ │ │ │ │ -557 int toPe, std::set& neighbor, std::set& neighborProcs) { │ │ │ │ │ -558 for(auto edge=g.beginEdges(vtx), end=g.endEdges(vtx); edge!=end; ++edge) │ │ │ │ │ -559 { │ │ │ │ │ -560 const typename IS::IndexPair* pindex = indexSet.pair(edge.target()); │ │ │ │ │ -561 assert(pindex); │ │ │ │ │ -562 if(part[pindex->local()]!=toPe || !OwnerSet::contains(pindex->local │ │ │ │ │ -().attribute())) │ │ │ │ │ -563 { │ │ │ │ │ -564 // is sent to another process and therefore becomes overlap │ │ │ │ │ -565 neighbor.insert(pindex->global()); │ │ │ │ │ -566 neighborProcs.insert(part[pindex->local()]); │ │ │ │ │ +528 if(j==0) │ │ │ │ │ +529 _c_o_l=cont._m_a_t_r_i_x[i].begin(); │ │ │ │ │ +530 else if (_c_o_l!=cont._m_a_t_r_i_x[i].end()) │ │ │ │ │ +531 ++_c_o_l; │ │ │ │ │ +532 │ │ │ │ │ +533 //copy communication: different row sizes for copy rows with the same │ │ │ │ │ +global index │ │ │ │ │ +534 //are possible. If all values of current matrix row are sent, send │ │ │ │ │ +535 //std::numeric_limits::max() │ │ │ │ │ +536 //and receiver will ignore it. │ │ │ │ │ +537 if (_c_o_l==cont._m_a_t_r_i_x[i].end()) { │ │ │ │ │ +538 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ +539 return _n_u_m_l_i_m_i_t_s; │ │ │ │ │ +540 } │ │ │ │ │ +541 else { │ │ │ │ │ +542 const typename I::IndexPair* index=cont._i_d_x_s_e_t.pair(_c_o_l.index()); │ │ │ │ │ +543 assert(index); │ │ │ │ │ +544 // Only send index if col is no ghost │ │ │ │ │ +545 if ( index->local().attribute() != 2) │ │ │ │ │ +546 return index->global(); │ │ │ │ │ +547 else { │ │ │ │ │ +548 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ +549 return _n_u_m_l_i_m_i_t_s; │ │ │ │ │ +550 } │ │ │ │ │ +551 } │ │ │ │ │ +552 } │ │ │ │ │ +_5_5_3 static void _s_c_a_t_t_e_r(_C_o_n_t_a_i_n_e_r& cont, const _G_l_o_b_a_l_I_n_d_e_x& gi, std::size_t i, │ │ │ │ │ +[[maybe_unused]] std::size_t j) │ │ │ │ │ +554 { │ │ │ │ │ +555 try{ │ │ │ │ │ +556 if (gi != std::numeric_limits::max()) { │ │ │ │ │ +557 const typename I::IndexPair& ip=cont._a_g_g_i_d_x_s_e_t.at(gi); │ │ │ │ │ +558 assert(ip.global()==gi); │ │ │ │ │ +559 std::size_t column = ip.local(); │ │ │ │ │ +560 cont._s_p_a_r_s_i_t_y[i].insert(column); │ │ │ │ │ +561 │ │ │ │ │ +562 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ +OwnerSet; │ │ │ │ │ +563 if(!OwnerSet::contains(ip.local().attribute())) │ │ │ │ │ +564 // preserve symmetry for overlap │ │ │ │ │ +565 cont._s_p_a_r_s_i_t_y[column].insert(i); │ │ │ │ │ +566 } │ │ │ │ │ 567 } │ │ │ │ │ -568 } │ │ │ │ │ -569 } │ │ │ │ │ -570 │ │ │ │ │ -571 template │ │ │ │ │ -572 void my_push_back(std::vector& ownerVec, const I& index, [ │ │ │ │ │ -[maybe_unused]] int proc) │ │ │ │ │ -573 { │ │ │ │ │ -574 ownerVec.push_back(index); │ │ │ │ │ -575 } │ │ │ │ │ -576 │ │ │ │ │ -577 template │ │ │ │ │ -578 void my_push_back(std::vector >& ownerVec, const I& index, │ │ │ │ │ -int proc) │ │ │ │ │ -579 { │ │ │ │ │ -580 ownerVec.push_back(std::make_pair(index,proc)); │ │ │ │ │ -581 } │ │ │ │ │ -582 template │ │ │ │ │ -583 void reserve(std::vector&, RedistributeInterface&, int) │ │ │ │ │ -584 {} │ │ │ │ │ -585 template │ │ │ │ │ -586 void reserve(std::vector >& ownerVec, │ │ │ │ │ -RedistributeInterface& redist, int proc) │ │ │ │ │ -587 { │ │ │ │ │ -588 redist.reserveSpaceForReceiveInterface(proc, ownerVec.size()); │ │ │ │ │ -589 } │ │ │ │ │ -590 │ │ │ │ │ -591 │ │ │ │ │ -609 template │ │ │ │ │ -610 void getOwnerOverlapVec(const G& graph, std::vector& part, IS& │ │ │ │ │ -indexSet, │ │ │ │ │ -611 [[maybe_unused]] int myPe, int toPe, std::vector& ownerVec, std:: │ │ │ │ │ -set& overlapSet, │ │ │ │ │ -612 RedistributeInterface& redist, std::set& neighborProcs) { │ │ │ │ │ -613 for(auto index = indexSet.begin(); index != indexSet.end(); ++index) { │ │ │ │ │ -614 // Only Process owner vertices, the others are not in the parmetis graph. │ │ │ │ │ -615 if(OwnerSet::contains(index->local().attribute())) │ │ │ │ │ -616 { │ │ │ │ │ -617 if(part[index->local()]==toPe) │ │ │ │ │ -618 { │ │ │ │ │ -619 getNeighbor(graph, part, index->local(), indexSet, │ │ │ │ │ -620 toPe, overlapSet, neighborProcs); │ │ │ │ │ -621 my_push_back(ownerVec, index->global(), toPe); │ │ │ │ │ +568 catch(const Dune::RangeError&) { │ │ │ │ │ +569 // Entry not present in the new index set. Ignore! │ │ │ │ │ +570#ifdef DEBUG_REPART │ │ │ │ │ +571 typedef typename _C_o_n_t_a_i_n_e_r_:_:_L_o_o_k_u_p_I_n_d_e_x_S_e_t GlobalLookup; │ │ │ │ │ +572 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ │ +573 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ +OwnerSet; │ │ │ │ │ +574 │ │ │ │ │ +575 GlobalLookup lookup(cont._a_g_g_i_d_x_s_e_t); │ │ │ │ │ +576 const IndexPair* pi=lookup.pair(i); │ │ │ │ │ +577 assert(pi); │ │ │ │ │ +578 if(OwnerSet::contains(pi->local().attribute())) { │ │ │ │ │ +579 int rank; │ │ │ │ │ +580 MPI_Comm_rank(MPI_COMM_WORLD,&rank); │ │ │ │ │ +581 std::cout<global()< │ │ │ │ │ +591 typename _M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_C_o_l_I_t_e_r │ │ │ │ │ +_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_c_o_l; │ │ │ │ │ +592 │ │ │ │ │ +593 template │ │ │ │ │ +594 typename _M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_n_u_m_l_i_m_i_t_s; │ │ │ │ │ +595 │ │ │ │ │ +596 │ │ │ │ │ +597 template │ │ │ │ │ +_5_9_8 struct _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +599 { │ │ │ │ │ +_6_0_0 typedef typename I::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +_6_0_1 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ +_6_0_2 typedef typename M::ConstColIterator _C_o_l_I_t_e_r; │ │ │ │ │ +_6_0_3 typedef typename std::pair _D_a_t_a; │ │ │ │ │ +_6_0_4 static _C_o_l_I_t_e_r _c_o_l; │ │ │ │ │ +_6_0_5 static _D_a_t_a _d_a_t_a_s_t_o_r_e; │ │ │ │ │ +_6_0_6 static _G_l_o_b_a_l_I_n_d_e_x _n_u_m_l_i_m_i_t_s; │ │ │ │ │ +607 │ │ │ │ │ +_6_0_8 static const _D_a_t_a& _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std::size_t i, std::size_t │ │ │ │ │ +j) │ │ │ │ │ +609 { │ │ │ │ │ +610 if(j==0) │ │ │ │ │ +611 _c_o_l=cont._m_a_t_r_i_x[i].begin(); │ │ │ │ │ +612 else if (_c_o_l!=cont._m_a_t_r_i_x[i].end()) │ │ │ │ │ +613 ++_c_o_l; │ │ │ │ │ +614 // copy communication: different row sizes for copy rows with the same │ │ │ │ │ +global index │ │ │ │ │ +615 // are possible. If all values of current matrix row are sent, send │ │ │ │ │ +616 // std::numeric_limits::max() │ │ │ │ │ +617 // and receiver will ignore it. │ │ │ │ │ +618 if (_c_o_l==cont._m_a_t_r_i_x[i].end()) { │ │ │ │ │ +619 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ +620 _d_a_t_a_s_t_o_r_e = _D_a_t_a(_n_u_m_l_i_m_i_t_s,*_c_o_l); │ │ │ │ │ +621 return _d_a_t_a_s_t_o_r_e; │ │ │ │ │ 622 } │ │ │ │ │ -623 } │ │ │ │ │ -624 } │ │ │ │ │ -625 reserve(ownerVec, redist, toPe); │ │ │ │ │ -626 │ │ │ │ │ -627 } │ │ │ │ │ -628 │ │ │ │ │ -629 │ │ │ │ │ -636 template │ │ │ │ │ -637 inline bool isOwner(IS& indexSet, int index) { │ │ │ │ │ -638 │ │ │ │ │ -639 const typename IS::IndexPair* pindex=indexSet.pair(index); │ │ │ │ │ -640 │ │ │ │ │ -641 assert(pindex); │ │ │ │ │ -642 return F::contains(pindex->local().attribute()); │ │ │ │ │ -643 } │ │ │ │ │ -644 │ │ │ │ │ -645 │ │ │ │ │ -646 class BaseEdgeFunctor │ │ │ │ │ -647 { │ │ │ │ │ -648 public: │ │ │ │ │ -649 BaseEdgeFunctor(Metis::idx_t* adj,const ParmetisDuneIndexMap& data) │ │ │ │ │ -650 : i_(), adj_(adj), data_(data) │ │ │ │ │ -651 {} │ │ │ │ │ +623 else { │ │ │ │ │ +624 // convert local column index to global index │ │ │ │ │ +625 const typename I::IndexPair* index=cont._i_d_x_s_e_t.pair(_c_o_l.index()); │ │ │ │ │ +626 assert(index); │ │ │ │ │ +627 // Store the data to prevent reference to temporary │ │ │ │ │ +628 // Only send index if col is no ghost │ │ │ │ │ +629 if ( index->local().attribute() != 2) │ │ │ │ │ +630 _d_a_t_a_s_t_o_r_e = _D_a_t_a(index->global(),*_c_o_l); │ │ │ │ │ +631 else { │ │ │ │ │ +632 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ +633 _d_a_t_a_s_t_o_r_e = _D_a_t_a(_n_u_m_l_i_m_i_t_s,*_c_o_l); │ │ │ │ │ +634 } │ │ │ │ │ +635 return _d_a_t_a_s_t_o_r_e; │ │ │ │ │ +636 } │ │ │ │ │ +637 } │ │ │ │ │ +_6_3_8 static void _s_c_a_t_t_e_r(_C_o_n_t_a_i_n_e_r& cont, const _D_a_t_a& data, std::size_t i, [ │ │ │ │ │ +[maybe_unused]] std::size_t j) │ │ │ │ │ +639 { │ │ │ │ │ +640 try{ │ │ │ │ │ +641 if (data.first != std::numeric_limits::max()) { │ │ │ │ │ +642 typename M::size_type column=cont._a_g_g_i_d_x_s_e_t.at(data.first).local(); │ │ │ │ │ +643 cont._m_a_t_r_i_x[i][column]=data.second; │ │ │ │ │ +644 } │ │ │ │ │ +645 } │ │ │ │ │ +646 catch(const Dune::RangeError&) { │ │ │ │ │ +647 // This an overlap row and might therefore lack some entries! │ │ │ │ │ +648 } │ │ │ │ │ +649 │ │ │ │ │ +650 } │ │ │ │ │ +651 }; │ │ │ │ │ 652 │ │ │ │ │ -653 template │ │ │ │ │ -654 void operator()(const T& edge) │ │ │ │ │ -655 { │ │ │ │ │ -656 // Get the egde weight │ │ │ │ │ -657 // const Weight& weight=edge.weight(); │ │ │ │ │ -658 adj_[i_] = data_.toParmetis(edge.target()); │ │ │ │ │ -659 i_++; │ │ │ │ │ -660 } │ │ │ │ │ -661 std::size_t index() │ │ │ │ │ -662 { │ │ │ │ │ -663 return i_; │ │ │ │ │ -664 } │ │ │ │ │ -665 │ │ │ │ │ -666 private: │ │ │ │ │ -667 std::size_t i_; │ │ │ │ │ -668 Metis::idx_t* adj_; │ │ │ │ │ -669 const ParmetisDuneIndexMap& data_; │ │ │ │ │ -670 }; │ │ │ │ │ -671 │ │ │ │ │ -672 template │ │ │ │ │ -673 struct EdgeFunctor │ │ │ │ │ -674 : public BaseEdgeFunctor │ │ │ │ │ -675 { │ │ │ │ │ -676 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std:: │ │ │ │ │ -size_t) │ │ │ │ │ -677 : BaseEdgeFunctor(adj, data) │ │ │ │ │ -678 {} │ │ │ │ │ +653 template │ │ │ │ │ +654 typename _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_C_o_l_I_t_e_r _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_: │ │ │ │ │ +_c_o_l; │ │ │ │ │ +655 │ │ │ │ │ +656 template │ │ │ │ │ +657 typename _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_D_a_t_a _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_: │ │ │ │ │ +_d_a_t_a_s_t_o_r_e; │ │ │ │ │ +658 │ │ │ │ │ +659 template │ │ │ │ │ +660 typename _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_n_u_m_l_i_m_i_t_s; │ │ │ │ │ +661 │ │ │ │ │ +662 template │ │ │ │ │ +_6_6_3 void _r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(M& origMatrix, M& newMatrix, C& origComm, │ │ │ │ │ +C& newComm, │ │ │ │ │ +664 _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) │ │ │ │ │ +665 { │ │ │ │ │ +666 typename C::CopySet copyflags; │ │ │ │ │ +667 typename C::OwnerSet ownerflags; │ │ │ │ │ +668 typedef typename C::ParallelIndexSet IndexSet; │ │ │ │ │ +669 typedef _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; │ │ │ │ │ +670 std::vector rowsize(newComm.indexSet().size(), 0); │ │ │ │ │ +671 std::vector copyrowsize(newComm.indexSet().size(), │ │ │ │ │ +0); │ │ │ │ │ +672 std::vector backwardscopyrowsize(origComm.indexSet │ │ │ │ │ +().size(), 0); │ │ │ │ │ +673 │ │ │ │ │ +674 // get owner rowsizes │ │ │ │ │ +675 _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> commRowSize(origMatrix, ri); │ │ │ │ │ +676 ri.template redistribute > │ │ │ │ │ +(commRowSize,commRowSize); │ │ │ │ │ +677 │ │ │ │ │ +678 origComm.buildGlobalLookup(); │ │ │ │ │ 679 │ │ │ │ │ -680 Metis::idx_t* getWeights() │ │ │ │ │ -681 { │ │ │ │ │ -682 return NULL; │ │ │ │ │ -683 } │ │ │ │ │ -684 void free(){} │ │ │ │ │ -685 }; │ │ │ │ │ -686 │ │ │ │ │ -687 template │ │ │ │ │ -688 class EdgeFunctor<_D_u_n_e::Amg::PropertiesGraph > │ │ │ │ │ -689 : public BaseEdgeFunctor │ │ │ │ │ -690 { │ │ │ │ │ -691 public: │ │ │ │ │ -692 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std:: │ │ │ │ │ -size_t s) │ │ │ │ │ -693 : BaseEdgeFunctor(adj, data) │ │ │ │ │ -694 { │ │ │ │ │ -695 weight_=new Metis::idx_t[s]; │ │ │ │ │ -696 } │ │ │ │ │ +680 for (std::size_t i=0; i < newComm.indexSet().size(); i++) { │ │ │ │ │ +681 rowsize[i] = ri._g_e_t_R_o_w_S_i_z_e(i); │ │ │ │ │ +682 } │ │ │ │ │ +683 // get sparsity pattern from owner rows │ │ │ │ │ +684 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ +685 origsp(origMatrix, origComm.globalLookup(), newComm.indexSet()); │ │ │ │ │ +686 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ +687 newsp(origMatrix, origComm.globalLookup(), newComm.indexSet(), rowsize); │ │ │ │ │ +688 │ │ │ │ │ +689 ri.template redistribute > │ │ │ │ │ +(origsp,newsp); │ │ │ │ │ +690 │ │ │ │ │ +691 // build copy to owner interface to get missing matrix values for novlp │ │ │ │ │ +case │ │ │ │ │ +692 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) == _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) { │ │ │ │ │ +693 RemoteIndices *ris = new RemoteIndices │ │ │ │ │ +(origComm.indexSet(), │ │ │ │ │ +694 newComm.indexSet(), │ │ │ │ │ +695 origComm.communicator()); │ │ │ │ │ +696 ris->template rebuild(); │ │ │ │ │ 697 │ │ │ │ │ -698 template │ │ │ │ │ -699 void operator()(const T& edge) │ │ │ │ │ -700 { │ │ │ │ │ -701 weight_[index()]=edge.properties().depends() ? 3 : 1; │ │ │ │ │ -702 BaseEdgeFunctor::operator()(edge); │ │ │ │ │ -703 } │ │ │ │ │ -704 Metis::idx_t* getWeights() │ │ │ │ │ -705 { │ │ │ │ │ -706 return weight_; │ │ │ │ │ -707 } │ │ │ │ │ -708 void free(){ │ │ │ │ │ -709 if(weight_!=0) { │ │ │ │ │ -710 delete weight_; │ │ │ │ │ -711 weight_=0; │ │ │ │ │ -712 } │ │ │ │ │ +698 ri.getInterface().free(); │ │ │ │ │ +699 ri.getInterface().build(*ris,copyflags,ownerflags); │ │ │ │ │ +700 │ │ │ │ │ +701 // get copy rowsizes │ │ │ │ │ +702 _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> commRowSize_copy(origMatrix, ri); │ │ │ │ │ +703 ri.template redistribute > │ │ │ │ │ +(commRowSize_copy, │ │ │ │ │ +704 commRowSize_copy); │ │ │ │ │ +705 │ │ │ │ │ +706 for (std::size_t i=0; i < newComm.indexSet().size(); i++) { │ │ │ │ │ +707 copyrowsize[i] = ri._g_e_t_C_o_p_y_R_o_w_S_i_z_e(i); │ │ │ │ │ +708 } │ │ │ │ │ +709 //get copy rowsizes for sender │ │ │ │ │ +710 ri._r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(backwardscopyrowsize,copyrowsize); │ │ │ │ │ +711 for (std::size_t i=0; i < origComm.indexSet().size(); i++) { │ │ │ │ │ +712 ri._g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e(i) = backwardscopyrowsize[i]; │ │ │ │ │ 713 } │ │ │ │ │ -714 private: │ │ │ │ │ -715 Metis::idx_t* weight_; │ │ │ │ │ -716 }; │ │ │ │ │ -717 │ │ │ │ │ -718 │ │ │ │ │ -719 │ │ │ │ │ -733 template │ │ │ │ │ -734 void getAdjArrays(G& graph, IS& indexSet, Metis::idx_t *xadj, │ │ │ │ │ -735 EW& ew) │ │ │ │ │ -736 { │ │ │ │ │ -737 int j=0; │ │ │ │ │ -738 auto vend = graph.end(); │ │ │ │ │ -739 │ │ │ │ │ -740 for(auto vertex = graph.begin(); vertex != vend; ++vertex) { │ │ │ │ │ -741 if (isOwner(indexSet,*vertex)) { │ │ │ │ │ -742 // The type of const edge iterator. │ │ │ │ │ -743 auto eend = vertex.end(); │ │ │ │ │ -744 xadj[j] = ew.index(); │ │ │ │ │ -745 j++; │ │ │ │ │ -746 for(auto edge = vertex.begin(); edge != eend; ++edge) { │ │ │ │ │ -747 ew(edge); │ │ │ │ │ +714 │ │ │ │ │ +715 // get sparsity pattern from copy rows │ │ │ │ │ +716 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> origsp_copy(origMatrix, │ │ │ │ │ +717 origComm.globalLookup(), │ │ │ │ │ +718 newComm.indexSet(), │ │ │ │ │ +719 backwardscopyrowsize); │ │ │ │ │ +720 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> newsp_copy(origMatrix, │ │ │ │ │ +origComm.globalLookup(), │ │ │ │ │ +721 newComm.indexSet(), copyrowsize); │ │ │ │ │ +722 ri.template redistribute > │ │ │ │ │ +(origsp_copy, │ │ │ │ │ +723 newsp_copy); │ │ │ │ │ +724 │ │ │ │ │ +725 newsp._c_o_m_p_l_e_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(newsp_copy._s_p_a_r_s_i_t_y); │ │ │ │ │ +726 newsp._s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(newMatrix); │ │ │ │ │ +727 } │ │ │ │ │ +728 else │ │ │ │ │ +729 newsp._s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(newMatrix); │ │ │ │ │ +730 │ │ │ │ │ +731#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +732 // Check for symmetry │ │ │ │ │ +733 int ret=0; │ │ │ │ │ +734 typedef typename M::ConstRowIterator RIter; │ │ │ │ │ +735 for(RIter row=newMatrix.begin(), rend=newMatrix.end(); row != rend; ++row) │ │ │ │ │ +{ │ │ │ │ │ +736 typedef typename M::ConstColIterator CIter; │ │ │ │ │ +737 for(CIter _c_o_l=row->begin(), cend=row->end(); _c_o_l!=cend; ++_c_o_l) │ │ │ │ │ +738 { │ │ │ │ │ +739 try{ │ │ │ │ │ +740 newMatrix[_c_o_l.index()][row.index()]; │ │ │ │ │ +741 }catch(const _D_u_n_e_:_:_I_S_T_L_E_r_r_o_r&) { │ │ │ │ │ +742 std::cerr< │ │ │ │ │ -756 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, │ │ │ │ │ -757 _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, │ │ │ │ │ -758 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, │ │ │ │ │ -759 RedistributeInterface& redistInf, │ │ │ │ │ -760 bool verbose=false); │ │ │ │ │ -761#if HAVE_PARMETIS │ │ │ │ │ -762#ifndef METIS_VER_MAJOR │ │ │ │ │ -763 extern "C" │ │ │ │ │ -764 { │ │ │ │ │ -765 // backwards compatibility to parmetis < 4.0.0 │ │ │ │ │ -766 void METIS_PartGraphKway(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t │ │ │ │ │ -*adjncy, Metis::idx_t *vwgt, │ │ │ │ │ -767 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts, │ │ │ │ │ -768 int *options, int *edgecut, Metis::idx_t *part); │ │ │ │ │ -769 │ │ │ │ │ -770 void METIS_PartGraphRecursive(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t │ │ │ │ │ -*adjncy, Metis::idx_t *vwgt, │ │ │ │ │ -771 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts, │ │ │ │ │ -772 int *options, int *edgecut, Metis::idx_t *part); │ │ │ │ │ -773 } │ │ │ │ │ -774#endif │ │ │ │ │ -775#endif // HAVE_PARMETIS │ │ │ │ │ +750 │ │ │ │ │ +751 if(ret) │ │ │ │ │ +752 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Matrix not symmetric!"); │ │ │ │ │ +753#endif │ │ │ │ │ +754 } │ │ │ │ │ +755 │ │ │ │ │ +756 template │ │ │ │ │ +_7_5_7 void _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(M& origMatrix, M& newMatrix, C& origComm, C& │ │ │ │ │ +newComm, │ │ │ │ │ +758 _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) │ │ │ │ │ +759 { │ │ │ │ │ +760 typedef typename C::ParallelIndexSet IndexSet; │ │ │ │ │ +761 typename C::OwnerSet ownerflags; │ │ │ │ │ +762 std::vector rowsize(newComm.indexSet().size(), 0); │ │ │ │ │ +763 std::vector copyrowsize(newComm.indexSet().size(), │ │ │ │ │ +0); │ │ │ │ │ +764 std::vector backwardscopyrowsize(origComm.indexSet │ │ │ │ │ +().size(), 0); │ │ │ │ │ +765 │ │ │ │ │ +766 for (std::size_t i=0; i < newComm.indexSet().size(); i++) { │ │ │ │ │ +767 rowsize[i] = ri._g_e_t_R_o_w_S_i_z_e(i); │ │ │ │ │ +768 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) == _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) { │ │ │ │ │ +769 copyrowsize[i] = ri._g_e_t_C_o_p_y_R_o_w_S_i_z_e(i); │ │ │ │ │ +770 } │ │ │ │ │ +771 } │ │ │ │ │ +772 │ │ │ │ │ +773 for (std::size_t i=0; i < origComm.indexSet().size(); i++) │ │ │ │ │ +774 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) == _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) │ │ │ │ │ +775 backwardscopyrowsize[i] = ri._g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e(i); │ │ │ │ │ 776 │ │ │ │ │ -777 template │ │ │ │ │ -_7_7_8 inline void _p_r_i_n_t___c_a_r_r_a_y(S& os, T* array, std::size_t l) │ │ │ │ │ -779 { │ │ │ │ │ -780 for(T *cur=array, *end=array+l; cur!=end; ++cur) │ │ │ │ │ -781 os<<*cur<<" "; │ │ │ │ │ -782 } │ │ │ │ │ -783 │ │ │ │ │ -784 template │ │ │ │ │ -_7_8_5 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, │ │ │ │ │ -786 T* adjncy, bool checkSymmetry) │ │ │ │ │ -787 { │ │ │ │ │ -788 bool correct=true; │ │ │ │ │ -789 │ │ │ │ │ -790 using std::signbit; │ │ │ │ │ -791 for(_M_e_t_i_s_:_:_i_d_x___t vtx=0; vtx<(_M_e_t_i_s_:_:_i_d_x___t)noVtx; ++vtx) { │ │ │ │ │ -792 if(static_cast(xadj[vtx])>noEdges || signbit(xadj[vtx])) { │ │ │ │ │ -793 std::cerr <<"Check graph: xadj["<" │ │ │ │ │ -794 <(xadj[vtx+1])>noEdges || signbit(xadj[vtx+1])) { │ │ │ │ │ -798 std::cerr <<"Check graph: xadj["<" │ │ │ │ │ -799 < origrow_copy(origMatrix, origComm.globalLookup(), │ │ │ │ │ +781 newComm.indexSet(), backwardscopyrowsize); │ │ │ │ │ +782 _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_n_d_e_x_S_e_t_> newrow_copy(newMatrix, origComm.globalLookup(), │ │ │ │ │ +783 newComm.indexSet(),copyrowsize); │ │ │ │ │ +784 ri.template redistribute >(origrow_copy, │ │ │ │ │ +785 newrow_copy); │ │ │ │ │ +786 ri.getInterface().free(); │ │ │ │ │ +787 RemoteIndices *ris = new RemoteIndices │ │ │ │ │ +(origComm.indexSet(), │ │ │ │ │ +788 newComm.indexSet(), │ │ │ │ │ +789 origComm.communicator()); │ │ │ │ │ +790 ris->template rebuild(); │ │ │ │ │ +791 ri.getInterface().build(*ris,ownerflags,ownerflags); │ │ │ │ │ +792 } │ │ │ │ │ +793 │ │ │ │ │ +794 _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ +795 origrow(origMatrix, origComm.globalLookup(), newComm.indexSet()); │ │ │ │ │ +796 _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ +797 newrow(newMatrix, origComm.globalLookup(), newComm.indexSet(),rowsize); │ │ │ │ │ +798 ri.template redistribute > │ │ │ │ │ +(origrow,newrow); │ │ │ │ │ +799 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) != 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)) │ │ │ │ │ +800 newrow._s_e_t_O_v_e_r_l_a_p_R_o_w_s_T_o_D_i_r_i_c_h_l_e_t(); │ │ │ │ │ 801 } │ │ │ │ │ -802 // Check numbers in adjncy │ │ │ │ │ -803 for(_M_e_t_i_s_:_:_i_d_x___t i=xadj[vtx]; i< xadj[vtx+1]; ++i) { │ │ │ │ │ -804 if(signbit(adjncy[i]) || ((std::size_t)adjncy[i])>gnoVtx) { │ │ │ │ │ -805 std::cerr<<" Edge "< │ │ │ │ │ -_8_2_9 bool _c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n(const M& _m_a_t, _D_u_n_e_:_: │ │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm, │ │ │ │ │ -830 _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ │ -831 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, │ │ │ │ │ -832 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ │ -833 bool verbose=false) │ │ │ │ │ -834 { │ │ │ │ │ -835 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -836 std::cout<<"Repartitioning from "<1) { │ │ │ │ │ -847 │ │ │ │ │ -848 part[0]=rank; │ │ │ │ │ -849 │ │ │ │ │ -850 { // sublock for automatic memory deletion │ │ │ │ │ -851 │ │ │ │ │ -852 // Build the graph of the communication scheme and create an appropriate │ │ │ │ │ -indexset. │ │ │ │ │ -853 // calculate the neighbour vertices │ │ │ │ │ -854 int noNeighbours = oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s().neighbours(); │ │ │ │ │ -855 │ │ │ │ │ -856 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 │ │ │ │ │ -(); │ │ │ │ │ -857 ++n) │ │ │ │ │ -858 if(n->first==rank) { │ │ │ │ │ -859 //do not include ourselves. │ │ │ │ │ -860 --noNeighbours; │ │ │ │ │ -861 break; │ │ │ │ │ -862 } │ │ │ │ │ -863 │ │ │ │ │ -864 // A parmetis graph representing the communication graph. │ │ │ │ │ -865 // The diagonal entries are the number of nodes on the process. │ │ │ │ │ -866 // The offdiagonal entries are the number of edges leading to other │ │ │ │ │ -processes. │ │ │ │ │ -867 │ │ │ │ │ -868 _M_e_t_i_s_:_:_i_d_x___t *xadj=new _M_e_t_i_s_:_:_i_d_x___t[2]; │ │ │ │ │ -869 _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]; │ │ │ │ │ -870 _M_e_t_i_s_:_:_i_d_x___t *adjncy=new _M_e_t_i_s_:_:_i_d_x___t[noNeighbours]; │ │ │ │ │ -871#ifdef USE_WEIGHTS │ │ │ │ │ -872 _M_e_t_i_s_:_:_i_d_x___t *vwgt = 0; │ │ │ │ │ -873 _M_e_t_i_s_:_:_i_d_x___t *adjwgt = 0; │ │ │ │ │ -874#endif │ │ │ │ │ -875 │ │ │ │ │ -876 // each process has exactly one vertex! │ │ │ │ │ -877 for(int i=0; i owner(mat.N(), oocomm.communicator().rank()); │ │ │ │ │ -887 // for(NeighbourIterator n= oocomm.remoteIndices().begin(); n != │ │ │ │ │ -oocomm.remoteIndices().end(); │ │ │ │ │ -888 // ++n) │ │ │ │ │ -889 // { │ │ │ │ │ -890 // if(n->first!=oocomm.communicator().rank()){ │ │ │ │ │ -891 // typedef typename RemoteIndices::RemoteIndexList RIList; │ │ │ │ │ -892 // const RIList& rlist = *(n->second.first); │ │ │ │ │ -893 // typedef typename RIList::const_iterator LIter; │ │ │ │ │ -894 // for(LIter entry=rlist.begin(); entry!=rlist.end(); ++entry){ │ │ │ │ │ -895 // if(entry->attribute()==OwnerOverlapCopyAttributeSet::owner) │ │ │ │ │ -896 // owner[entry->localIndexPair().local()] = n->first; │ │ │ │ │ -897 // } │ │ │ │ │ -898 // } │ │ │ │ │ -899 // } │ │ │ │ │ -900 │ │ │ │ │ -901 // std::map edgecount; // edges to other processors │ │ │ │ │ -902 // typedef typename M::ConstRowIterator RIter; │ │ │ │ │ -903 // typedef typename M::ConstColIterator CIter; │ │ │ │ │ -904 │ │ │ │ │ -905 // // calculate edge count │ │ │ │ │ -906 // for(RIter row=mat.begin(), endr=mat.end(); row != endr; ++row) │ │ │ │ │ -907 // if(owner[row.index()]==OwnerOverlapCopyAttributeSet::owner) │ │ │ │ │ -908 // for(CIter entry= row->begin(), ende = row->end(); entry != ende; │ │ │ │ │ -++entry) │ │ │ │ │ -909 // ++edgecount[owner[entry.index()]]; │ │ │ │ │ -910 │ │ │ │ │ -911 // setup edge and weight pattern │ │ │ │ │ -912 │ │ │ │ │ -913 _M_e_t_i_s_:_:_i_d_x___t* adjp=adjncy; │ │ │ │ │ -914 │ │ │ │ │ -915#ifdef USE_WEIGHTS │ │ │ │ │ -916 vwgt = new _M_e_t_i_s_:_:_i_d_x___t[1]; │ │ │ │ │ -917 vwgt[0]= _m_a_t.N(); // weight is numer of rows TODO: Should actually be the │ │ │ │ │ -nonzeros. │ │ │ │ │ -918 │ │ │ │ │ -919 adjwgt = new _M_e_t_i_s_:_:_i_d_x___t[noNeighbours]; │ │ │ │ │ -920 _M_e_t_i_s_:_:_i_d_x___t* adjwp=adjwgt; │ │ │ │ │ -921#endif │ │ │ │ │ -922 │ │ │ │ │ -923 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 │ │ │ │ │ -(); │ │ │ │ │ -924 ++n) │ │ │ │ │ -925 if(n->first != rank) { │ │ │ │ │ -926 *adjp=n->first; │ │ │ │ │ -927 ++adjp; │ │ │ │ │ -928#ifdef USE_WEIGHTS │ │ │ │ │ -929 *adjwp=1; //edgecount[n->first]; │ │ │ │ │ -930 ++adjwp; │ │ │ │ │ -931#endif │ │ │ │ │ -932 } │ │ │ │ │ -933 assert(_i_s_V_a_l_i_d_G_r_a_p_h(vtxdist[rank+1]-vtxdist[rank], │ │ │ │ │ -934 vtxdist[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()], │ │ │ │ │ -935 noNeighbours, xadj, adjncy, false)); │ │ │ │ │ -936 │ │ │ │ │ -937 [[maybe_unused]] _M_e_t_i_s_:_:_i_d_x___t wgtflag=0; │ │ │ │ │ -938 _M_e_t_i_s_:_:_i_d_x___t numflag=0; │ │ │ │ │ -939 _M_e_t_i_s_:_:_i_d_x___t edgecut; │ │ │ │ │ -940#ifdef USE_WEIGHTS │ │ │ │ │ -941 wgtflag=3; │ │ │ │ │ -942#endif │ │ │ │ │ -943 _M_e_t_i_s_:_:_r_e_a_l___t *tpwgts = new _M_e_t_i_s_:_:_r_e_a_l___t[nparts]; │ │ │ │ │ -944 for(int i=0; i::getType(), │ │ │ │ │ -1071 gxadj,noxs,xdispl,MPITraits::getType(), │ │ │ │ │ -1072 comm); │ │ │ │ │ -1073 MPI_Allgatherv(adjncy,noNeighbours,MPITraits::getType(), │ │ │ │ │ -1074 gadjncy,noedges,displ,MPITraits::getType(), │ │ │ │ │ -1075 comm); │ │ │ │ │ -1076#ifdef USE_WEIGHTS │ │ │ │ │ -1077 MPI_Allgatherv(adjwgt,noNeighbours,MPITraits::getType(), │ │ │ │ │ -1078 gadjwgt,noedges,displ,MPITraits::getType(), │ │ │ │ │ -1079 comm); │ │ │ │ │ -1080 MPI_Allgatherv(vwgt,localNoVtx,MPITraits::getType(), │ │ │ │ │ -1081 gvwgt,novs,vdispl,MPITraits::getType(), │ │ │ │ │ -1082 comm); │ │ │ │ │ -1083#endif │ │ │ │ │ -1084 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1085 std::cout<<"Gathering global graph data took "<(gxadjlen)); │ │ │ │ │ -1103 increment = *(start-1); │ │ │ │ │ -1104 std::transform(start+offset, start+l+offset, start, std::bind(std:: │ │ │ │ │ -plus(), std::placeholders::_1, increment)); │ │ │ │ │ -1105 } │ │ │ │ │ -1106 Dune::dinfo<= 5 │ │ │ │ │ -1130 _M_e_t_i_s_:_:_i_d_x___t ncon = 1; │ │ │ │ │ -1131 _M_e_t_i_s_:_:_i_d_x___t moptions[METIS_NOPTIONS]; │ │ │ │ │ -1132 METIS_SetDefaultOptions(moptions); │ │ │ │ │ -1133 moptions[METIS_OPTION_NUMBERING] = numflag; │ │ │ │ │ -1134 METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, │ │ │ │ │ -gadjwgt, │ │ │ │ │ -1135 &nparts, NULL, NULL, moptions, &edgecut, gpart); │ │ │ │ │ -1136#else │ │ │ │ │ -1137 int options[5] = {0, 1, 1, 3, 3}; │ │ │ │ │ -1138 // Call metis │ │ │ │ │ -1139 METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, │ │ │ │ │ -&wgtflag, │ │ │ │ │ -1140 &numflag, &nparts, options, &edgecut, gpart); │ │ │ │ │ -1141#endif │ │ │ │ │ -1142 │ │ │ │ │ -1143 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1144 std::cout<<"METIS took "<::getType(), part, 1, │ │ │ │ │ -1159 MPITraits::getType(), 0, comm); │ │ │ │ │ -1160 │ │ │ │ │ -1161 { │ │ │ │ │ -1162 // release remaining memory │ │ │ │ │ -1163 delete[] gpart; │ │ │ │ │ -1164 delete[] noedges; │ │ │ │ │ -1165 delete[] displ; │ │ │ │ │ -1166 } │ │ │ │ │ -1167 │ │ │ │ │ -1168 │ │ │ │ │ -1169#endif │ │ │ │ │ -1170 delete[] xadj; │ │ │ │ │ -1171 delete[] vtxdist; │ │ │ │ │ -1172 delete[] adjncy; │ │ │ │ │ -1173#ifdef USE_WEIGHTS │ │ │ │ │ -1174 delete[] vwgt; │ │ │ │ │ -1175 delete[] adjwgt; │ │ │ │ │ -1176#endif │ │ │ │ │ -1177 delete[] tpwgts; │ │ │ │ │ -1178 } │ │ │ │ │ -1179 }else{ │ │ │ │ │ -1180 part[0]=0; │ │ │ │ │ -1181 } │ │ │ │ │ -1182#endif │ │ │ │ │ -1183 Dune::dinfo<<" repart "< "<< part[0]< realpart(_m_a_t.N(), part[0]); │ │ │ │ │ -1186 delete[] part; │ │ │ │ │ -1187 │ │ │ │ │ -1188 oocomm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(realpart, realpart); │ │ │ │ │ -1189 │ │ │ │ │ -1190 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1191 std::cout<<"Scattering repartitioning took "< graph(const_cast(_m_a_t)); │ │ │ │ │ -1197 _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(graph, oocomm); │ │ │ │ │ -1198 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1199 std::cout<<"Filling index set took "< │ │ │ │ │ -_1_2_3_5 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, │ │ │ │ │ -1236 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, │ │ │ │ │ -1237 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ │ -1238 bool verbose=false) │ │ │ │ │ -1239 { │ │ │ │ │ -1240 Timer time; │ │ │ │ │ -1241 │ │ │ │ │ -1242 MPI_Comm comm=oocomm._c_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ -1243 oocomm._b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p(graph.noVertices()); │ │ │ │ │ -1244 _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(graph, oocomm); │ │ │ │ │ -1245 │ │ │ │ │ -1246 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1247 std::cout<<"Filling holes took "<(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size())); │ │ │ │ │ -1262 │ │ │ │ │ -1263 int myDomain = -1; │ │ │ │ │ -1264 │ │ │ │ │ -1265 // │ │ │ │ │ -1266 // 1) Prepare the required parameters for using ParMETIS │ │ │ │ │ -1267 // Especially the arrays that represent the graph must be │ │ │ │ │ -1268 // generated by the DUNE Graph and IndexSet input variables. │ │ │ │ │ -1269 // These are the arrays: │ │ │ │ │ -1270 // - vtxdist │ │ │ │ │ -1271 // - xadj │ │ │ │ │ -1272 // - adjncy │ │ │ │ │ -1273 // │ │ │ │ │ -1274 // │ │ │ │ │ -1275#ifdef PERF_REPART │ │ │ │ │ -1276 // reset timer for step 1) │ │ │ │ │ -1277 t1=MPI_Wtime(); │ │ │ │ │ -1278#endif │ │ │ │ │ -1279 │ │ │ │ │ -1280 │ │ │ │ │ -1281 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; │ │ │ │ │ -1282 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ │ -1283 │ │ │ │ │ -1284 // Create the vtxdist array and parmetisVtxMapping. │ │ │ │ │ -1285 // Global communications are necessary │ │ │ │ │ -1286 // The parmetis global identifiers for the owner vertices. │ │ │ │ │ -1287 ParmetisDuneIndexMap indexMap(graph,oocomm); │ │ │ │ │ -1288 _M_e_t_i_s_:_:_i_d_x___t *part = new _M_e_t_i_s_:_:_i_d_x___t[indexMap.numOfOwnVtx()]; │ │ │ │ │ -1289 for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i) │ │ │ │ │ -1290 part[i]=mype; │ │ │ │ │ -1291 │ │ │ │ │ -1292#if !HAVE_PARMETIS │ │ │ │ │ -1293 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0 && nparts>1) │ │ │ │ │ -1294 std::cerr<<"ParMETIS not activated. Will repartition to 1 domain instead │ │ │ │ │ -of requested " │ │ │ │ │ -1295 <1) { │ │ │ │ │ -1301 // Create the xadj and adjncy arrays │ │ │ │ │ -1302 _M_e_t_i_s_:_:_i_d_x___t *xadj = new _M_e_t_i_s_:_:_i_d_x___t[indexMap.numOfOwnVtx()+1]; │ │ │ │ │ -1303 _M_e_t_i_s_:_:_i_d_x___t *adjncy = new _M_e_t_i_s_:_:_i_d_x___t[graph.noEdges()]; │ │ │ │ │ -1304 EdgeFunctor ef(adjncy, indexMap, graph.noEdges()); │ │ │ │ │ -1305 getAdjArrays(graph, oocomm._g_l_o_b_a_l_L_o_o_k_u_p(), xadj, ef); │ │ │ │ │ -1306 │ │ │ │ │ -1307 // │ │ │ │ │ -1308 // 2) Call ParMETIS │ │ │ │ │ -1309 // │ │ │ │ │ -1310 // │ │ │ │ │ -1311 _M_e_t_i_s_:_:_i_d_x___t numflag=0, wgtflag=0, options[3], edgecut=0, ncon=1; │ │ │ │ │ -1312 //float *tpwgts = NULL; │ │ │ │ │ -1313 _M_e_t_i_s_:_:_r_e_a_l___t *tpwgts = new _M_e_t_i_s_:_:_r_e_a_l___t[nparts]; │ │ │ │ │ -1314 for(int i=0; i(comm)); │ │ │ │ │ -1358 │ │ │ │ │ -1359 │ │ │ │ │ -1360 delete[] xadj; │ │ │ │ │ -1361 delete[] adjncy; │ │ │ │ │ -1362 delete[] tpwgts; │ │ │ │ │ -1363 │ │ │ │ │ -1364 ef.free(); │ │ │ │ │ -1365 │ │ │ │ │ -1366#ifdef DEBUG_REPART │ │ │ │ │ -1367 if (mype == 0) { │ │ │ │ │ -1368 std::cout< domainMapping(nparts); │ │ │ │ │ -1410 if(nparts>1) │ │ │ │ │ -1411 getDomain(comm, part, indexMap.numOfOwnVtx(), nparts, &myDomain, │ │ │ │ │ -domainMapping); │ │ │ │ │ -1412 else │ │ │ │ │ -1413 domainMapping[0]=0; │ │ │ │ │ -1414 │ │ │ │ │ -1415#ifdef DEBUG_REPART │ │ │ │ │ -1416 std::cout< setPartition(oocomm._i_n_d_e_x_S_e_t().size(), -1); │ │ │ │ │ -1429 │ │ │ │ │ -1430 std::size_t i=0; // parmetis index │ │ │ │ │ -1431 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) │ │ │ │ │ -1432 if(OwnerSet::contains(index->local().attribute())) { │ │ │ │ │ -1433 setPartition[index->local()]=domainMapping[part[i++]]; │ │ │ │ │ -1434 } │ │ │ │ │ -1435 │ │ │ │ │ -1436 delete[] part; │ │ │ │ │ -1437 oocomm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(setPartition, setPartition); │ │ │ │ │ -1438 // communication only needed for ALU │ │ │ │ │ -1439 // (ghosts with same global id as owners on the same process) │ │ │ │ │ -1440 if (SolverCategory::category(oocomm) == │ │ │ │ │ -1441 static_cast(SolverCategory::nonoverlapping)) │ │ │ │ │ -1442 oocomm._c_o_p_y_C_o_p_y_T_o_A_l_l(setPartition, setPartition); │ │ │ │ │ -1443 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, │ │ │ │ │ -1444 verbose); │ │ │ │ │ -1445 if(verbose) { │ │ │ │ │ -1446 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ │ -1447 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1448 std::cout<<"Creating indexsets took "< │ │ │ │ │ -_1_4_5_6 bool _b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n(const G& graph, │ │ │ │ │ -1457 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, │ │ │ │ │ -1458 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, │ │ │ │ │ -1459 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ │ -1460 bool verbose) │ │ │ │ │ -1461 { │ │ │ │ │ -1462 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; │ │ │ │ │ -1463 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ │ -1464 │ │ │ │ │ -1465 Timer time; │ │ │ │ │ -1466 │ │ │ │ │ -1467 // Build the send interface │ │ │ │ │ -1468 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()); │ │ │ │ │ -1469 │ │ │ │ │ -1470#ifdef PERF_REPART │ │ │ │ │ -1471 // stop the time for step 3) │ │ │ │ │ -1472 t3=MPI_Wtime()-t3; │ │ │ │ │ -1473 // reset timer for step 4) │ │ │ │ │ -1474 t4=MPI_Wtime(); │ │ │ │ │ -1475#endif │ │ │ │ │ -1476 │ │ │ │ │ -1477 │ │ │ │ │ -1478 // │ │ │ │ │ -1479 // 4) Create the output IndexSet and RemoteIndices │ │ │ │ │ -1480 // 4.1) Determine the "send to" and "receive from" relation │ │ │ │ │ -1481 // according to the new partition using a MPI ring │ │ │ │ │ -1482 // communication. │ │ │ │ │ -1483 // │ │ │ │ │ -1484 // 4.2) Depends on the "send to" and "receive from" vector, │ │ │ │ │ -1485 // the processes will exchange the vertices each other │ │ │ │ │ -1486 // │ │ │ │ │ -1487 // 4.3) Create the IndexSet, RemoteIndices and the new MPI │ │ │ │ │ -1488 // communicator │ │ │ │ │ -1489 // │ │ │ │ │ -1490 │ │ │ │ │ -1491 // │ │ │ │ │ -1492 // 4.1) Let's start... │ │ │ │ │ -1493 // │ │ │ │ │ -1494 int npes = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size(); │ │ │ │ │ -1495 int *sendTo = 0; │ │ │ │ │ -1496 int noSendTo = 0; │ │ │ │ │ -1497 std::set recvFrom; │ │ │ │ │ -1498 │ │ │ │ │ -1499 // the max number of vertices is stored in the sendTo buffer, │ │ │ │ │ -1500 // not the number of vertices to send! Because the max number of Vtx │ │ │ │ │ -1501 // is used as the fixed buffer size by the MPI send/receive calls │ │ │ │ │ -1502 │ │ │ │ │ -1503 int mype = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank(); │ │ │ │ │ -1504 │ │ │ │ │ -1505 { │ │ │ │ │ -1506 std::set tsendTo; │ │ │ │ │ -1507 for(auto i=setPartition.begin(), iend = setPartition.end(); i!=iend; ++i) │ │ │ │ │ -1508 tsendTo.insert(*i); │ │ │ │ │ -1509 │ │ │ │ │ -1510 noSendTo = tsendTo.size(); │ │ │ │ │ -1511 sendTo = new int[noSendTo]; │ │ │ │ │ -1512 int idx=0; │ │ │ │ │ -1513 for(auto i=tsendTo.begin(); i != tsendTo.end(); ++i, ++idx) │ │ │ │ │ -1514 sendTo[idx]=*i; │ │ │ │ │ -1515 } │ │ │ │ │ -1516 │ │ │ │ │ -1517 // │ │ │ │ │ -1518 int* gnoSend= new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()]; │ │ │ │ │ -1519 int* gsendToDispl = new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()+1]; │ │ │ │ │ -1520 │ │ │ │ │ -1521 MPI_Allgather(&noSendTo, 1, MPI_INT, gnoSend, 1, │ │ │ │ │ -1522 MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1523 │ │ │ │ │ -1524 // calculate total receive message size │ │ │ │ │ -1525 int totalNoRecv = 0; │ │ │ │ │ -1526 for(int i=0; i0; │ │ │ │ │ -1547 │ │ │ │ │ -1548 // Delete memory │ │ │ │ │ -1549 delete[] gnoSend; │ │ │ │ │ -1550 delete[] gsendToDispl; │ │ │ │ │ -1551 delete[] gsendTo; │ │ │ │ │ -1552 │ │ │ │ │ -1553 │ │ │ │ │ -1554#ifdef DEBUG_REPART │ │ │ │ │ -1555 if(recvFrom.size()) { │ │ │ │ │ -1556 std::cout< GlobalVector; │ │ │ │ │ -1589 std::vector > myOwnerVec; │ │ │ │ │ -1590 std::set myOverlapSet; │ │ │ │ │ -1591 GlobalVector sendOwnerVec; │ │ │ │ │ -1592 std::set sendOverlapSet; │ │ │ │ │ -1593 std::set myNeighbors; │ │ │ │ │ -1594 │ │ │ │ │ -1595 // getOwnerOverlapVec(graph, setPartition, oocomm.globalLookup │ │ │ │ │ -(), │ │ │ │ │ -1596 // mype, mype, myOwnerVec, myOverlapSet, redistInf, myNeighbors); │ │ │ │ │ -1597 │ │ │ │ │ -1598 char **sendBuffers=new char*[noSendTo]; │ │ │ │ │ -1599 MPI_Request *requests = new MPI_Request[noSendTo]; │ │ │ │ │ -1600 │ │ │ │ │ -1601 // Create all messages to be sent │ │ │ │ │ -1602 for(int i=0; i < noSendTo; ++i) { │ │ │ │ │ -1603 // clear the vector for sending │ │ │ │ │ -1604 sendOwnerVec.clear(); │ │ │ │ │ -1605 sendOverlapSet.clear(); │ │ │ │ │ -1606 // get all owner and overlap vertices for process j and save these │ │ │ │ │ -1607 // in the vectors sendOwnerVec and sendOverlapSet │ │ │ │ │ -1608 std::set neighbors; │ │ │ │ │ -1609 getOwnerOverlapVec(graph, setPartition, oocomm._g_l_o_b_a_l_L_o_o_k_u_p(), │ │ │ │ │ -1610 mype, sendTo[i], sendOwnerVec, sendOverlapSet, redistInf, │ │ │ │ │ -1611 neighbors); │ │ │ │ │ -1612 // +2, we need 2 integer more for the length of each part │ │ │ │ │ -1613 // (owner/overlap) of the array │ │ │ │ │ -1614 int buffersize=0; │ │ │ │ │ -1615 int tsize; │ │ │ │ │ -1616 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ │ -&buffersize); │ │ │ │ │ -1617 MPI_Pack_size(sendOwnerVec.size(), MPITraits::getType(), │ │ │ │ │ -oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -1618 buffersize +=tsize; │ │ │ │ │ -1619 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ │ -&tsize); │ │ │ │ │ -1620 buffersize +=tsize; │ │ │ │ │ -1621 MPI_Pack_size(sendOverlapSet.size(), MPITraits::getType(), │ │ │ │ │ -oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -1622 buffersize += tsize; │ │ │ │ │ -1623 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ │ -&tsize); │ │ │ │ │ -1624 buffersize += tsize; │ │ │ │ │ -1625 MPI_Pack_size(neighbors.size(), MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ -1626 buffersize += tsize; │ │ │ │ │ -1627 │ │ │ │ │ -1628 sendBuffers[i] = new char[buffersize]; │ │ │ │ │ -1629 │ │ │ │ │ -1630#ifdef DEBUG_REPART │ │ │ │ │ -1631 std::cout<0) { │ │ │ │ │ -1651 // probe for an incoming message │ │ │ │ │ -1652 MPI_Status stat; │ │ │ │ │ -1653 MPI_Probe(MPI_ANY_SOURCE, 99, oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &stat); │ │ │ │ │ -1654 int buffersize; │ │ │ │ │ -1655 MPI_Get_count(&stat, MPI_PACKED, &buffersize); │ │ │ │ │ -1656 │ │ │ │ │ -1657 if(oldbuffersize(outputComm,SolverCategory::category │ │ │ │ │ -(oocomm),true); │ │ │ │ │ -1727 │ │ │ │ │ -1728 // translate neighbor ranks. │ │ │ │ │ -1729 int newrank=outcomm->communicator().rank(); │ │ │ │ │ -1730 int *newranks=new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()]; │ │ │ │ │ -1731 std::vector tneighbors; │ │ │ │ │ -1732 tneighbors.reserve(myNeighbors.size()); │ │ │ │ │ -1733 │ │ │ │ │ -1734 typename OOComm::ParallelIndexSet& outputIndexSet = outcomm->indexSet(); │ │ │ │ │ -1735 │ │ │ │ │ -1736 MPI_Allgather(&newrank, 1, MPI_INT, newranks, 1, │ │ │ │ │ -1737 MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ -1738 │ │ │ │ │ -1739#ifdef DEBUG_REPART │ │ │ │ │ -1740 std::cout<=0); │ │ │ │ │ -1744 std::cout<<*i<<"->"<first,LocalIndexT(i, OwnerOverlapCopyAttributeSet:: │ │ │ │ │ -owner, true)); │ │ │ │ │ -1777 redistInf._a_d_d_R_e_c_e_i_v_e_I_n_d_e_x(g->second, i); │ │ │ │ │ -1778 } │ │ │ │ │ -1779 │ │ │ │ │ -1780 if(verbose) { │ │ │ │ │ -1781 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ │ -1782 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1783 std::cout<<" Adding owner indices took "<< │ │ │ │ │ -1784 time.elapsed()<local().attribute())) { │ │ │ │ │ -1820 numOfOwnVtx++; │ │ │ │ │ -1821 } │ │ │ │ │ -1822 } │ │ │ │ │ -1823 numOfOwnVtx = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().sum(numOfOwnVtx); │ │ │ │ │ -1824 // if(numOfOwnVtx!=indexMap.globalOwnerVertices) │ │ │ │ │ -1825 // { │ │ │ │ │ -1826 // std::cerr<remoteIndices().setNeighbours(tneighbors); │ │ │ │ │ -1844 outcomm->remoteIndices().template rebuild(); │ │ │ │ │ -1845 │ │ │ │ │ -1846 } │ │ │ │ │ -1847 │ │ │ │ │ -1848 // release the memory │ │ │ │ │ -1849 delete[] sendTo; │ │ │ │ │ -1850 │ │ │ │ │ -1851 if(verbose) { │ │ │ │ │ -1852 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ │ -1853 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ -1854 std::cout<<" Storing indexsets took "<< │ │ │ │ │ -1855 time.elapsed()< │ │ │ │ │ -1876 bool graphRepartition(const G& graph, P& oocomm, int nparts, │ │ │ │ │ -1877 std::shared_ptr

& outcomm, │ │ │ │ │ -1878 R& redistInf, │ │ │ │ │ -1879 bool v=false) │ │ │ │ │ -1880 { │ │ │ │ │ -1881 if(nparts!=oocomm.size()) │ │ │ │ │ -1882 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ │ -1883 } │ │ │ │ │ -1884 │ │ │ │ │ -1885 │ │ │ │ │ -1886 template │ │ │ │ │ -1887 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, │ │ │ │ │ -1888 std::shared_ptr

& outcomm, │ │ │ │ │ -1889 R& redistInf, │ │ │ │ │ -1890 bool v=false) │ │ │ │ │ -1891 { │ │ │ │ │ -1892 if(nparts!=oocomm.size()) │ │ │ │ │ -1893 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ │ -1894 } │ │ │ │ │ -1895#endif // HAVE_MPI │ │ │ │ │ -1896} // end of namespace Dune │ │ │ │ │ -1897#endif │ │ │ │ │ -_g_l_o_b_a_l_O_w_n_e_r_V_e_r_t_i_c_e_s │ │ │ │ │ -int globalOwnerVertices │ │ │ │ │ -DDeeffiinniittiioonn repartition.hh:175 │ │ │ │ │ +802 │ │ │ │ │ +819 template │ │ │ │ │ +_8_2_0 void _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(M& origMatrix, M& newMatrix, C& origComm, C& │ │ │ │ │ +newComm, │ │ │ │ │ +821 _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) │ │ │ │ │ +822 { │ │ │ │ │ +823 ri._s_e_t_N_o_R_o_w_s(newComm.indexSet().size()); │ │ │ │ │ +824 ri._s_e_t_N_o_C_o_p_y_R_o_w_s(newComm.indexSet().size()); │ │ │ │ │ +825 ri._s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s(origComm.indexSet().size()); │ │ │ │ │ +826 _r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(origMatrix, newMatrix, origComm, newComm, ri); │ │ │ │ │ +827 _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(origMatrix, newMatrix, origComm, newComm, ri); │ │ │ │ │ +828 } │ │ │ │ │ +829#endif │ │ │ │ │ +830 │ │ │ │ │ +831template │ │ │ │ │ +_8_3_2 void _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(M& origMatrix, M& newMatrix, │ │ │ │ │ +833 _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& origComm, │ │ │ │ │ +834 _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& newComm, │ │ │ │ │ +835 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_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_>& ri) │ │ │ │ │ +836 { │ │ │ │ │ +837 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential │ │ │ │ │ +program!"); │ │ │ │ │ +838 } │ │ │ │ │ +839 template │ │ │ │ │ +_8_4_0 void _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(M& origMatrix, M& newMatrix, │ │ │ │ │ +841 _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& origComm, │ │ │ │ │ +842 _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& newComm, │ │ │ │ │ +843 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_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_>& ri) │ │ │ │ │ +844 { │ │ │ │ │ +845 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential │ │ │ │ │ +program!"); │ │ │ │ │ +846 } │ │ │ │ │ +847} │ │ │ │ │ +848#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. │ │ │ │ │ -_g_r_a_p_h_._h_h │ │ │ │ │ -Provides classes for building the matrix graph. │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_r_e_p_a_r_t_i_t_i_o_n_._h_h │ │ │ │ │ +Functionality for redistributing a parallel index set using graph partitioning. │ │ │ │ │ +_p_i_n_f_o_._h_h │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ _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:1456 │ │ │ │ │ -_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:829 │ │ │ │ │ -_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:778 │ │ │ │ │ -_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:785 │ │ │ │ │ -_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:1235 │ │ │ │ │ -_D_u_n_e_:_:_M_e_t_i_s_:_:_r_e_a_l___t │ │ │ │ │ -float real_t │ │ │ │ │ -DDeeffiinniittiioonn repartition.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_M_e_t_i_s_:_:_i_d_x___t │ │ │ │ │ -std::size_t idx_t │ │ │ │ │ -DDeeffiinniittiioonn repartition.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r │ │ │ │ │ -@ owner │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ +void redistributeSparsityPattern(M &origMatrix, M &newMatrix, C &origComm, C │ │ │ │ │ +&newComm, RedistributeInformation< C > &ri) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:663 │ │ │ │ │ +_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_:_:_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_:_:_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_:_:_s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s │ │ │ │ │ +void setNoBackwardsCopyRows(std::size_t size) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:44 │ │ │ │ │ +_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 │ │ │ │ │ +void redistribute(const D &from, D &to) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:28 │ │ │ │ │ +_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_s_e_t_S_e_t_u_p │ │ │ │ │ +void resetSetup() │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:35 │ │ │ │ │ +_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_:_:_s_e_t_N_o_C_o_p_y_R_o_w_s │ │ │ │ │ +void setNoCopyRows(std::size_t size) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:41 │ │ │ │ │ +_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_:_:_i_s_S_e_t_u_p │ │ │ │ │ +bool isSetup() const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:23 │ │ │ │ │ +_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_:_:_s_e_t_N_o_R_o_w_s │ │ │ │ │ +void setNoRows(std::size_t size) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:38 │ │ │ │ │ +_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_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_:_:_g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t getBackwardsCopyRowSize(std::size_t index) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:57 │ │ │ │ │ +_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_:_:_g_e_t_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t getRowSize(std::size_t index) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:47 │ │ │ │ │ +_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_:_:_g_e_t_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t getCopyRowSize(std::size_t index) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:52 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_e_t_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t getRowSize(std::size_t index) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:158 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t & getBackwardsCopyRowSize(std::size_t index) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:173 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_e_t_I_n_t_e_r_f_a_c_e │ │ │ │ │ +RedistributeInterface & getInterface() │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:75 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_d_i_s_t_r_i_b_u_t_e │ │ │ │ │ +void redistribute(const D &from, D &to) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:136 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ +_s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s │ │ │ │ │ +void setNoBackwardsCopyRows(std::size_t rows) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:193 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_e_t_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t & getCopyRowSize(std::size_t index) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:163 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +RedistributeInformation() │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:71 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_e_t_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t getCopyRowSize(std::size_t index) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:168 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ +_s_e_t_N_o_R_o_w_s │ │ │ │ │ +void setNoRows(std::size_t rows) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:183 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_s_e_r_v_e │ │ │ │ │ +void reserve(std::size_t size) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:150 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_m_m │ │ │ │ │ +OwnerOverlapCopyCommunication< T, T1 > Comm │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:69 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ +_s_e_t_N_o_C_o_p_y_R_o_w_s │ │ │ │ │ +void setNoCopyRows(std::size_t rows) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:188 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_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:141 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ +_s_e_t_S_e_t_u_p │ │ │ │ │ +void setSetup() │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:106 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t getBackwardsCopyRowSize(std::size_t index) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:178 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_d_i_s_t_r_i_b_u_t_e │ │ │ │ │ +void redistribute(const D &from, D &to) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:118 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_s_e_t_S_e_t_u_p │ │ │ │ │ +void resetSetup() │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:112 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_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:126 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_h_e_c_k_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void checkInterface(const IS &source, const IS &target, MPI_Comm comm) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:80 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_s_S_e_t_u_p │ │ │ │ │ +bool isSetup() const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:145 │ │ │ │ │ +_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_<_ _O_w_n_e_r_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_e_t_R_o_w_S_i_z_e │ │ │ │ │ +std::size_t & getRowSize(std::size_t index) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e │ │ │ │ │ +Utility class to communicate and set the row sizes of a redistributed matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +M::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +M::size_type value_type │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_r_o_w_s_i_z_e │ │ │ │ │ +RI & rowsize │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_m_a_t_r_i_x │ │ │ │ │ +const M & matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e │ │ │ │ │ +CommMatrixRowSize(const M &m_, RI &rowsize_) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:226 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ +Utility class to communicate and build the sparsity pattern of a redistributed │ │ │ │ │ +matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:245 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +M::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:246 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_i_d_x_s_e_t │ │ │ │ │ +const Dune::GlobalLookupIndexSet< I > & idxset │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:356 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ +void storeSparsityPattern(M &m) │ │ │ │ │ +Creates and stores the sparsity pattern of the redistributed matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_a_g_g_i_d_x_s_e_t │ │ │ │ │ +const I & aggidxset │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:357 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_r_o_w_s_i_z_e │ │ │ │ │ +const std::vector< size_type > * rowsize │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:359 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_c_o_m_p_l_e_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ +void completeSparsityPattern(std::vector< std::set< size_type > > add_sparsity) │ │ │ │ │ +Completes the sparsity pattern of the redistributed matrix with data from copy │ │ │ │ │ +rows for the novlp cas... │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:340 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ +CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > │ │ │ │ │ +&idxset_, const I &aggidxset_) │ │ │ │ │ +Constructor for the original side. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:254 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_m_a_t_r_i_x │ │ │ │ │ +const M & matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:354 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ +CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > │ │ │ │ │ +&idxset_, const I &aggidxset_, const std::vector< typename M::size_type > │ │ │ │ │ +&rowsize_) │ │ │ │ │ +Constructor for the redistruted side. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:265 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_s_p_a_r_s_i_t_y │ │ │ │ │ +std::vector< std::set< size_type > > sparsity │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:358 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::GlobalLookupIndexSet< I > LookupIndexSet │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:355 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_g_e_t_S_i_z_e │ │ │ │ │ +static M::size_type getSize(const Type &t, std::size_t i) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:376 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_T_y_p_e │ │ │ │ │ +CommMatrixSparsityPattern< M, I > Type │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:365 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ +I::GlobalIndex IndexedType │ │ │ │ │ +The indexed type we send. This is the global index indentitfying the column. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:371 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ +VariableSize IndexedTypeFlag │ │ │ │ │ +Each row varies in size. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:374 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ +Utility class for comunicating the matrix entries. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:396 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_r_o_w_s_i_z_e │ │ │ │ │ +std::vector< size_t > * rowsize │ │ │ │ │ +row size information for the receiving side. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:452 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_m_a_t_r_i_x │ │ │ │ │ +M & matrix │ │ │ │ │ +The matrix to communicate the values of. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:446 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ +CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I │ │ │ │ │ +&aggidxset_, std::vector< size_t > &rowsize_) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:412 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_i_d_x_s_e_t │ │ │ │ │ +const Dune::GlobalLookupIndexSet< I > & idxset │ │ │ │ │ +Index set for the original matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:448 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_s_e_t_O_v_e_r_l_a_p_R_o_w_s_T_o_D_i_r_i_c_h_l_e_t │ │ │ │ │ +void setOverlapRowsToDirichlet() │ │ │ │ │ +Sets the non-owner rows correctly as Dirichlet boundaries. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:421 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_a_g_g_i_d_x_s_e_t │ │ │ │ │ +const I & aggidxset │ │ │ │ │ +Index set for the redistributed matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:450 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ +CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I │ │ │ │ │ +&aggidxset_) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:405 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ +std::pair< typename I::GlobalIndex, typename M::block_type > IndexedType │ │ │ │ │ +The indexed type we send. This is the pair of global index indentitfying the │ │ │ │ │ +column and the value its... │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:464 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_T_y_p_e │ │ │ │ │ +CommMatrixRow< M, I > Type │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:458 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_g_e_t_S_i_z_e │ │ │ │ │ +static std::size_t getSize(const Type &t, std::size_t i) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:469 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ +VariableSize IndexedTypeFlag │ │ │ │ │ +Each row varies in size. │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:467 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:483 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ +static void scatter(Container &cont, const typename M::size_type &rowsize, │ │ │ │ │ +std::size_t i) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:490 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ +static const M::size_type gather(const Container &cont, std::size_t i) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:486 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ +CommMatrixRowSize< M, RI > Container │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:484 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:500 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ +static const M::size_type gather(const Container &cont, std::size_t i) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:503 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ +static void scatter(Container &cont, const typename M::size_type &rowsize, │ │ │ │ │ +std::size_t i) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:507 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ +CommMatrixRowSize< M, RI > Container │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:501 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:518 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_l_I_t_e_r │ │ │ │ │ +M::ConstColIterator ColIter │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:521 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ +static void scatter(Container &cont, const GlobalIndex &gi, std::size_t i, │ │ │ │ │ +std::size_t j) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:553 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ +CommMatrixSparsityPattern< M, I > Container │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_n_u_m_l_i_m_i_t_s │ │ │ │ │ +static GlobalIndex numlimits │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:524 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_c_o_l │ │ │ │ │ +static ColIter col │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:523 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +I::GlobalIndex GlobalIndex │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:519 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ +static const GlobalIndex & gather(const Container &cont, std::size_t i, std:: │ │ │ │ │ +size_t j) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:526 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:599 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ +I::GlobalIndex GlobalIndex │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:600 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_d_a_t_a_s_t_o_r_e │ │ │ │ │ +static Data datastore │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:605 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_n_u_m_l_i_m_i_t_s │ │ │ │ │ +static GlobalIndex numlimits │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:606 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_l_I_t_e_r │ │ │ │ │ +M::ConstColIterator ColIter │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:602 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ +static const Data & gather(const Container &cont, std::size_t i, std::size_t j) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:608 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_D_a_t_a │ │ │ │ │ +std::pair< GlobalIndex, typename M::block_type > Data │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:603 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ +static void scatter(Container &cont, const Data &data, std::size_t i, std:: │ │ │ │ │ +size_t j) │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:638 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_c_o_l │ │ │ │ │ +static ColIter col │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:604 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ +CommMatrixRow< M, I > Container │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:601 │ │ │ │ │ _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ owner/overlap/copy sema... │ │ │ │ │ DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ -const GlobalLookupIndexSet & globalLookup() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:526 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ │ -const ParallelIndexSet & indexSet() const │ │ │ │ │ -Get the underlying parallel index set. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:462 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ │ -void copyCopyToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from copy data points to all other data points. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ │ -The type of the reverse lookup of indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ -void buildGlobalLookup() │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:495 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -const Communication< MPI_Comm > & communicator() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ -void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from owner data points to all other data points. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -const RemoteIndices & remoteIndices() const │ │ │ │ │ -Get the underlying remote indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ -void freeGlobalLookup() │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:520 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ │ -The type of the parallel index set. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ -The (undirected) graph of a matrix. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ +EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_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_:_:_~_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ │ -~RedistributeInterface() │ │ │ │ │ -DDeeffiinniittiioonn repartition.hh:301 │ │ │ │ │ -_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: ildl.hh File Reference │ │ │ │ +dune-istl: preconditioners.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,55 +70,100 @@ │ │ │ │

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

Incomplete LDL decomposition. │ │ │ │ +

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

│ │ │ │ -
#include <dune/common/scalarvectorview.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include "ilu.hh"
│ │ │ │ +
#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 "ildl.hh"
│ │ │ │ +#include "ilu.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::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...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

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

│ │ │ │ Functions

template<class K , int m, int n>
static void Dune::bildl_subtractBCT (const FieldMatrix< K, m, n > &B, const FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A)
 
template<class K >
static void Dune::bildl_subtractBCT (const K &B, const K &CT, K &A, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
 
template<class Matrix >
static void Dune::bildl_subtractBCT (const Matrix &B, const Matrix &CT, Matrix &A, typename std::enable_if_t<!Dune::IsNumber< Matrix >::value > *sfinae=nullptr)
 
template<class Matrix >
void Dune::bildl_decompose (Matrix &A)
 compute ILDL decomposition of a symmetric matrix A
 
template<class Matrix , class X , class Y >
void Dune::bildl_backsolve (const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
 
 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 ("ilu", defaultPreconditionerBlockLevelCreator< Dune::SeqILU >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("richardson", [](auto tl, const auto &, const ParameterTree &config){ using D=typename Dune::TypeListElement< 1, decltype(tl)>::type;using R=typename Dune::TypeListElement< 2, decltype(tl)>::type;return std::make_shared< Richardson< D, R > >(config);})
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("ildl", defaultPreconditionerCreator< Dune::SeqILDL >())
 
│ │ │ │

Detailed Description

│ │ │ │ -

Incomplete LDL decomposition.

│ │ │ │ -
Author
Martin Nolte
│ │ │ │ +

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,44 +1,89 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -_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 │ │ │ │ │ +_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 "_i_l_d_l_._h_h" │ │ │ │ │ #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_:_:_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_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_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_S_e_q_G_S = _S_e_q_S_O_R< M, X, Y, l > │ │ │ │ │ +  Sequential Gauss Seidel preconditioner. │ │ │ │ │ +  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &B, const │ │ │ │ │ - _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &CT, _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &A) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const K &B, const K &CT, K &A, typename │ │ │ │ │ - std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const _M_a_t_r_i_x &B, const _M_a_t_r_i_x &CT, _M_a_t_r_i_x │ │ │ │ │ - &A, typename std::enable_if_t::value > │ │ │ │ │ - *sfinae=nullptr) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e (_M_a_t_r_i_x &A) │ │ │ │ │ -  compute ILDL decomposition of a symmetric matrix A │ │ │ │ │ -  │ │ │ │ │ -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) │ │ │ │ │ +  _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 ("ilu", │ │ │ │ │ + _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_I_L_U >()) │ │ │ │ │ +  │ │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("richardson", [](auto tl, const auto &, │ │ │ │ │ + const ParameterTree &config){ using D=typename Dune::TypeListElement< 1, │ │ │ │ │ + decltype(tl)>::type;using R=typename Dune::TypeListElement< 2, decltype │ │ │ │ │ + (tl)>::type;return std::make_shared< _R_i_c_h_a_r_d_s_o_n< D, R > >(config);}) │ │ │ │ │ +  │ │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("ildl", _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r< │ │ │ │ │ + _D_u_n_e_:_:_S_e_q_I_L_D_L >()) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Incomplete LDL decomposition. │ │ │ │ │ - Author │ │ │ │ │ - Martin Nolte │ │ │ │ │ +Define general preconditioner interface. │ │ │ │ │ +Wrap the methods implemented by ISTL in this interface. However, the interface │ │ │ │ │ +is extensible such that new preconditioners can be implemented and used with │ │ │ │ │ +the solvers. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: ildl.hh Source File │ │ │ │ +dune-istl: preconditioners.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,246 +74,738 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
ildl.hh
│ │ │ │ +
preconditioners.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
3#ifndef DUNE_ISTL_ILDL_HH
│ │ │ │ -
4#define DUNE_ISTL_ILDL_HH
│ │ │ │ -
5
│ │ │ │ -
6#include <dune/common/scalarvectorview.hh>
│ │ │ │ -
7#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
8#include "ilu.hh"
│ │ │ │ -
9
│ │ │ │ -
17namespace Dune
│ │ │ │ -
18{
│ │ │ │ -
19
│ │ │ │ -
20 // bildl_subtractBCT
│ │ │ │ -
21 // -----------------
│ │ │ │ -
22
│ │ │ │ -
23 template< class K, int m, int n >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
25 {
│ │ │ │ -
26 for( int i = 0; i < m; ++i )
│ │ │ │ -
27 {
│ │ │ │ -
28 for( int j = 0; j < n; ++j )
│ │ │ │ -
29 {
│ │ │ │ -
30 for( int k = 0; k < n; ++k )
│ │ │ │ -
31 A[ i ][ j ] -= B[ i ][ k ] * CT[ j ][ k ];
│ │ │ │ -
32 }
│ │ │ │ -
33 }
│ │ │ │ -
34 }
│ │ │ │ -
│ │ │ │ -
35
│ │ │ │ -
36 template< class K >
│ │ │ │ -
│ │ │ │ -
37 inline static void bildl_subtractBCT ( const K &B, const K &CT, K &A,
│ │ │ │ -
38 typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr )
│ │ │ │ -
39 {
│ │ │ │ -
40 A -= B * CT;
│ │ │ │ -
41 }
│ │ │ │ -
│ │ │ │ -
42
│ │ │ │ -
43 template< class Matrix >
│ │ │ │ -
│ │ │ │ -
44 inline static void bildl_subtractBCT ( const Matrix &B, const Matrix &CT, Matrix &A,
│ │ │ │ -
45 typename std::enable_if_t<!Dune::IsNumber<Matrix>::value>* sfinae = nullptr )
│ │ │ │ -
46 {
│ │ │ │ -
47 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ -
48 {
│ │ │ │ -
49 auto &&A_i = *i;
│ │ │ │ -
50 auto &&B_i = B[ i.index() ];
│ │ │ │ -
51 const auto ikend = B_i.end();
│ │ │ │ -
52 for( auto j = A_i.begin(), jend = A_i.end(); j != jend; ++j )
│ │ │ │ -
53 {
│ │ │ │ -
54 auto &&A_ij = *j;
│ │ │ │ -
55 auto &&CT_j = CT[ j.index() ];
│ │ │ │ -
56 const auto jkend = CT_j.end();
│ │ │ │ -
57 for( auto ik = B_i.begin(), jk = CT_j.begin(); (ik != ikend) && (jk != jkend); )
│ │ │ │ -
58 {
│ │ │ │ -
59 if( ik.index() == jk.index() )
│ │ │ │ -
60 {
│ │ │ │ -
61 bildl_subtractBCT( *ik, *jk, A_ij );
│ │ │ │ -
62 ++ik; ++jk;
│ │ │ │ -
63 }
│ │ │ │ -
64 else if( ik.index() < jk.index() )
│ │ │ │ -
65 ++ik;
│ │ │ │ -
66 else
│ │ │ │ -
67 ++jk;
│ │ │ │ -
68 }
│ │ │ │ -
69 }
│ │ │ │ -
70 }
│ │ │ │ -
71 }
│ │ │ │ -
│ │ │ │ -
72
│ │ │ │ -
73
│ │ │ │ -
74
│ │ │ │ -
75 // bildl_decompose
│ │ │ │ -
76 // ---------------
│ │ │ │ -
77
│ │ │ │ -
87 template< class Matrix >
│ │ │ │ -
│ │ │ │ -
88 inline void bildl_decompose ( Matrix &A )
│ │ │ │ -
89 {
│ │ │ │ -
90 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ -
91 {
│ │ │ │ -
92 auto &&A_i = *i;
│ │ │ │ -
93
│ │ │ │ -
94 auto ij = A_i.begin();
│ │ │ │ -
95 for( ; ij.index() < i.index(); ++ij )
│ │ │ │ -
96 {
│ │ │ │ -
97 auto &&A_ij = *ij;
│ │ │ │ -
98 auto &&A_j = A[ ij.index() ];
│ │ │ │ -
99
│ │ │ │ -
100 // store L_ij Dj in A_ij (note: for k < i: A_kj = L_kj)
│ │ │ │ -
101 // L_ij Dj = A_ij - \sum_{k < j} (L_ik D_k) L_jk^T
│ │ │ │ -
102 auto ik = A_i.begin();
│ │ │ │ -
103 auto jk = A_j.begin();
│ │ │ │ -
104 while( (ik != ij) && (jk.index() < ij.index()) )
│ │ │ │ -
105 {
│ │ │ │ -
106 if( ik.index() == jk.index() )
│ │ │ │ -
107 {
│ │ │ │ -
108 bildl_subtractBCT(*ik, *jk, A_ij);
│ │ │ │ -
109 ++ik; ++jk;
│ │ │ │ -
110 }
│ │ │ │ -
111 else if( ik.index() < jk.index() )
│ │ │ │ -
112 ++ik;
│ │ │ │ -
113 else
│ │ │ │ -
114 ++jk;
│ │ │ │ -
115 }
│ │ │ │ -
116 }
│ │ │ │ -
117
│ │ │ │ -
118 if( ij.index() != i.index() )
│ │ │ │ -
119 DUNE_THROW( ISTLError, "diagonal entry missing" );
│ │ │ │ -
120
│ │ │ │ -
121 // update diagonal and multiply A_ij by D_j^{-1}
│ │ │ │ -
122 auto &&A_ii = *ij;
│ │ │ │ -
123 for( auto ik = A_i.begin(); ik != ij; ++ik )
│ │ │ │ -
124 {
│ │ │ │ -
125 auto &&A_ik = *ik;
│ │ │ │ -
126 const auto &A_k = A[ ik.index() ];
│ │ │ │ +
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
│ │ │ │ +
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 "ildl.hh"
│ │ │ │ +
26#include "ilu.hh"
│ │ │ │ +
27
│ │ │ │ +
28
│ │ │ │ +
29namespace Dune {
│ │ │ │ +
72 template<class O, int c = -1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
74 public Preconditioner<typename O::domain_type, typename O::range_type>
│ │ │ │ +
75 {
│ │ │ │ +
76 public:
│ │ │ │ +
78 typedef typename O::domain_type domain_type;
│ │ │ │ +
80 typedef typename O::range_type range_type;
│ │ │ │ +
82 typedef typename range_type::field_type field_type;
│ │ │ │ +
84 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ +
86 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ +
88 typedef O InverseOperator;
│ │ │ │ +
89
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
95 : inverse_operator_(inverse_operator)
│ │ │ │ +
96 {
│ │ │ │ +
97 if(c != -1 && SolverCategory::category(inverse_operator_) != c)
│ │ │ │ +
98 DUNE_THROW(InvalidStateException, "User-supplied solver category does not match that of the given inverse operator");
│ │ │ │ +
99 }
│ │ │ │ +
│ │ │ │ +
100
│ │ │ │ +
│ │ │ │ +
101 virtual void pre(domain_type&,range_type&)
│ │ │ │ +
102 {}
│ │ │ │ +
│ │ │ │ +
103
│ │ │ │ +
│ │ │ │ +
104 virtual void apply(domain_type& v, const range_type& d)
│ │ │ │ +
105 {
│ │ │ │ + │ │ │ │ +
107 range_type copy(d);
│ │ │ │ +
108 inverse_operator_.apply(v, copy, res);
│ │ │ │ +
109 }
│ │ │ │ +
│ │ │ │ +
110
│ │ │ │ +
│ │ │ │ +
111 virtual void post(domain_type&)
│ │ │ │ +
112 {}
│ │ │ │ +
│ │ │ │ +
113
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
116 {
│ │ │ │ +
117 return SolverCategory::category(inverse_operator_);
│ │ │ │ +
118 }
│ │ │ │ +
│ │ │ │ +
119
│ │ │ │ +
120 private:
│ │ │ │ +
121 InverseOperator& inverse_operator_;
│ │ │ │ +
122 };
│ │ │ │ +
│ │ │ │ +
123
│ │ │ │ +
124 //=====================================================================
│ │ │ │ +
125 // Implementation of this interface for sequential ISTL-preconditioners
│ │ │ │ +
126 //=====================================================================
│ │ │ │
127
│ │ │ │ -
128 auto B = A_ik;
│ │ │ │ -
129 Impl::asMatrix(A_ik).rightmultiply( Impl::asMatrix(*A_k.find( ik.index() )) );
│ │ │ │ -
130 bildl_subtractBCT( B, A_ik, A_ii );
│ │ │ │ -
131 }
│ │ │ │ -
132 try
│ │ │ │ -
133 {
│ │ │ │ -
134 Impl::asMatrix(A_ii).invert();
│ │ │ │ -
135 }
│ │ │ │ -
136 catch( const Dune::FMatrixError &e )
│ │ │ │ -
137 {
│ │ │ │ -
138 DUNE_THROW( MatrixBlockError, "ILDL failed to invert matrix block A[" << i.index() << "][" << ij.index() << "]" << e.what(); th__ex.r = i.index(); th__ex.c = ij.index() );
│ │ │ │ -
139 }
│ │ │ │ -
140 }
│ │ │ │ -
141 }
│ │ │ │ -
│ │ │ │ -
142
│ │ │ │ -
143
│ │ │ │ -
144
│ │ │ │ -
145 // bildl_backsolve
│ │ │ │ -
146 // ---------------
│ │ │ │ -
147
│ │ │ │ -
148 template< class Matrix, class X, class Y >
│ │ │ │ -
│ │ │ │ -
149 inline void bildl_backsolve ( const Matrix &A, X &v, const Y &d, bool isLowerTriangular = false )
│ │ │ │ -
150 {
│ │ │ │ -
151 // solve L v = d, note: Lii = I
│ │ │ │ -
152 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ -
153 {
│ │ │ │ -
154 const auto &A_i = *i;
│ │ │ │ -
155 v[ i.index() ] = d[ i.index() ];
│ │ │ │ -
156 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij )
│ │ │ │ -
157 {
│ │ │ │ -
158 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ │ -
159 Impl::asMatrix(*ij).mmv(Impl::asVector( v[ ij.index() ] ), vi);
│ │ │ │ -
160 }
│ │ │ │ -
161 }
│ │ │ │ -
162
│ │ │ │ -
163 // solve D w = v, note: diagonal stores Dii^{-1}
│ │ │ │ -
164 if( isLowerTriangular )
│ │ │ │ +
128
│ │ │ │ +
140 template<class M, class X, class Y, int l=1>
│ │ │ │ +
│ │ │ │ +
141 class SeqSSOR : public Preconditioner<X,Y> {
│ │ │ │ +
142 public:
│ │ │ │ +
144 typedef M matrix_type;
│ │ │ │ +
146 typedef X domain_type;
│ │ │ │ +
148 typedef Y range_type;
│ │ │ │ +
150 typedef typename X::field_type field_type;
│ │ │ │ +
152 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ +
154 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ +
155
│ │ │ │ +
│ │ │ │ +
163 SeqSSOR (const M& A, int n, real_field_type w)
│ │ │ │ +
164 : _A_(A), _n(n), _w(w)
│ │ │ │
165 {
│ │ │ │ -
166 // The matrix is lower triangular, so the diagonal entry is the
│ │ │ │ -
167 // last one in each row.
│ │ │ │ -
168 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ -
169 {
│ │ │ │ -
170 const auto &A_i = *i;
│ │ │ │ -
171 const auto ii = A_i.beforeEnd();
│ │ │ │ -
172 assert( ii.index() == i.index() );
│ │ │ │ -
173 // We need to be careful here: Directly using
│ │ │ │ -
174 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ │ -
175 // is not OK in case this is a proxy. Hence
│ │ │ │ -
176 // we first have to copy the value. Notice that
│ │ │ │ -
177 // this is still not OK, if the vector type itself returns
│ │ │ │ -
178 // proxy references.
│ │ │ │ -
179 auto rhsValue = v[ i.index() ];
│ │ │ │ -
180 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ -
181 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ │ -
182 Impl::asMatrix(*ii).mv(rhs, vi);
│ │ │ │ -
183 }
│ │ │ │ -
184 }
│ │ │ │ -
185 else
│ │ │ │ -
186 {
│ │ │ │ -
187 // Without assumptions on the sparsity pattern we have to search
│ │ │ │ -
188 // for the diagonal entry in each row.
│ │ │ │ -
189 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ -
190 {
│ │ │ │ -
191 const auto &A_i = *i;
│ │ │ │ -
192 const auto ii = A_i.find( i.index() );
│ │ │ │ -
193 assert( ii.index() == i.index() );
│ │ │ │ -
194 // We need to be careful here: Directly using
│ │ │ │ -
195 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ │ -
196 // is not OK in case this is a proxy. Hence
│ │ │ │ -
197 // we first have to copy the value. Notice that
│ │ │ │ -
198 // this is still not OK, if the vector type itself returns
│ │ │ │ -
199 // proxy references.
│ │ │ │ -
200 auto rhsValue = v[ i.index() ];
│ │ │ │ -
201 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ -
202 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ │ -
203 Impl::asMatrix(*ii).mv(rhs, vi);
│ │ │ │ -
204 }
│ │ │ │ -
205 }
│ │ │ │ -
206
│ │ │ │ -
207 // solve L^T v = w, note: only L is stored
│ │ │ │ -
208 // note: we perform the operation column-wise from right to left
│ │ │ │ -
209 for( auto i = A.beforeEnd(), iend = A.beforeBegin(); i != iend; --i )
│ │ │ │ -
210 {
│ │ │ │ -
211 const auto &A_i = *i;
│ │ │ │ -
212 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij )
│ │ │ │ -
213 {
│ │ │ │ -
214 auto&& vij = Impl::asVector( v[ ij.index() ] );
│ │ │ │ -
215 Impl::asMatrix(*ij).mmtv(Impl::asVector( v[ i.index() ] ), vij);
│ │ │ │ -
216 }
│ │ │ │ -
217 }
│ │ │ │ -
218 }
│ │ │ │ -
│ │ │ │ -
219
│ │ │ │ -
220} // namespace Dune
│ │ │ │ -
221
│ │ │ │ -
222#endif // #ifndef DUNE_ISTL_ILDL_HH
│ │ │ │ -
The incomplete LU factorization kernels.
│ │ │ │ + │ │ │ │ +
167 }
│ │ │ │ +
│ │ │ │ +
168
│ │ │ │ +
│ │ │ │ +
182 SeqSSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ +
183 : SeqSSOR(A->getmat(), configuration)
│ │ │ │ +
184 {}
│ │ │ │ +
│ │ │ │ +
185
│ │ │ │ +
│ │ │ │ +
199 SeqSSOR (const M& A, const ParameterTree& configuration)
│ │ │ │ +
200 : SeqSSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ │ +
201 {}
│ │ │ │ +
│ │ │ │ +
202
│ │ │ │ +
│ │ │ │ +
208 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ +
209 {}
│ │ │ │ +
│ │ │ │ +
210
│ │ │ │ +
│ │ │ │ +
216 virtual void apply (X& v, const Y& d)
│ │ │ │ +
217 {
│ │ │ │ +
218 for (int i=0; i<_n; i++) {
│ │ │ │ +
219 bsorf(_A_,v,d,_w,BL<l>());
│ │ │ │ +
220 bsorb(_A_,v,d,_w,BL<l>());
│ │ │ │ +
221 }
│ │ │ │ +
222 }
│ │ │ │ +
│ │ │ │ +
223
│ │ │ │ +
│ │ │ │ +
229 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ +
230 {}
│ │ │ │ +
│ │ │ │ +
231
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
234 {
│ │ │ │ + │ │ │ │ +
236 }
│ │ │ │ +
│ │ │ │ +
237
│ │ │ │ +
238 private:
│ │ │ │ +
240 const M& _A_;
│ │ │ │ +
242 int _n;
│ │ │ │ + │ │ │ │ +
245 };
│ │ │ │ +
│ │ │ │ +
246 DUNE_REGISTER_PRECONDITIONER("ssor", defaultPreconditionerBlockLevelCreator<Dune::SeqSSOR>());
│ │ │ │ +
247
│ │ │ │ +
248
│ │ │ │ +
260 template<class M, class X, class Y, int l=1>
│ │ │ │ +
│ │ │ │ +
261 class SeqSOR : public Preconditioner<X,Y> {
│ │ │ │ +
262 public:
│ │ │ │ +
264 typedef M matrix_type;
│ │ │ │ +
266 typedef X domain_type;
│ │ │ │ +
268 typedef Y range_type;
│ │ │ │ +
270 typedef typename X::field_type field_type;
│ │ │ │ +
272 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ +
274 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ +
275
│ │ │ │ +
│ │ │ │ +
283 SeqSOR (const M& A, int n, real_field_type w)
│ │ │ │ +
284 : _A_(A), _n(n), _w(w)
│ │ │ │ +
285 {
│ │ │ │ + │ │ │ │ +
287 }
│ │ │ │ +
│ │ │ │ +
288
│ │ │ │ +
│ │ │ │ +
302 SeqSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ +
303 : SeqSOR(A->getmat(), configuration)
│ │ │ │ +
304 {}
│ │ │ │ +
│ │ │ │ +
305
│ │ │ │ +
│ │ │ │ +
319 SeqSOR (const M& A, const ParameterTree& configuration)
│ │ │ │ +
320 : SeqSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ │ +
321 {}
│ │ │ │ +
│ │ │ │ +
322
│ │ │ │ +
│ │ │ │ +
328 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ +
329 {}
│ │ │ │ +
│ │ │ │ +
330
│ │ │ │ +
│ │ │ │ +
336 virtual void apply (X& v, const Y& d)
│ │ │ │ +
337 {
│ │ │ │ +
338 this->template apply<true>(v,d);
│ │ │ │ +
339 }
│ │ │ │ +
│ │ │ │ +
340
│ │ │ │ +
349 template<bool forward>
│ │ │ │ +
│ │ │ │ +
350 void apply(X& v, const Y& d)
│ │ │ │ +
351 {
│ │ │ │ +
352 if(forward)
│ │ │ │ +
353 for (int i=0; i<_n; i++) {
│ │ │ │ +
354 bsorf(_A_,v,d,_w,BL<l>());
│ │ │ │ +
355 }
│ │ │ │ +
356 else
│ │ │ │ +
357 for (int i=0; i<_n; i++) {
│ │ │ │ +
358 bsorb(_A_,v,d,_w,BL<l>());
│ │ │ │ +
359 }
│ │ │ │ +
360 }
│ │ │ │ +
│ │ │ │ +
361
│ │ │ │ +
│ │ │ │ +
367 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ +
368 {}
│ │ │ │ +
│ │ │ │ +
369
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
372 {
│ │ │ │ + │ │ │ │ +
374 }
│ │ │ │ +
│ │ │ │ +
375
│ │ │ │ +
376 private:
│ │ │ │ +
378 const M& _A_;
│ │ │ │ +
380 int _n;
│ │ │ │ + │ │ │ │ +
383 };
│ │ │ │ +
│ │ │ │ +
384 DUNE_REGISTER_PRECONDITIONER("sor", defaultPreconditionerBlockLevelCreator<Dune::SeqSOR>());
│ │ │ │ +
385
│ │ │ │ +
386
│ │ │ │ +
397 template<class M, class X, class Y, int l=1>
│ │ │ │ + │ │ │ │ +
399 DUNE_REGISTER_PRECONDITIONER("gs", defaultPreconditionerBlockLevelCreator<Dune::SeqGS>());
│ │ │ │ +
400
│ │ │ │ +
411 template<class M, class X, class Y, int l=1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
413 public:
│ │ │ │ +
415 typedef M matrix_type;
│ │ │ │ +
417 typedef X domain_type;
│ │ │ │ +
419 typedef Y range_type;
│ │ │ │ +
421 typedef typename X::field_type field_type;
│ │ │ │ +
423 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ +
425 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ +
426
│ │ │ │ +
│ │ │ │ +
434 SeqJac (const M& A, int n, real_field_type w)
│ │ │ │ +
435 : _A_(A), _n(n), _w(w)
│ │ │ │ +
436 {
│ │ │ │ + │ │ │ │ +
438 }
│ │ │ │ +
│ │ │ │ +
439
│ │ │ │ +
│ │ │ │ +
453 SeqJac (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ +
454 : SeqJac(A->getmat(), configuration)
│ │ │ │ +
455 {}
│ │ │ │ +
│ │ │ │ +
456
│ │ │ │ +
│ │ │ │ +
470 SeqJac (const M& A, const ParameterTree& configuration)
│ │ │ │ +
471 : SeqJac(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ │ +
472 {}
│ │ │ │ +
│ │ │ │ +
473
│ │ │ │ +
│ │ │ │ +
479 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ +
480 {}
│ │ │ │ +
│ │ │ │ +
481
│ │ │ │ +
│ │ │ │ +
487 virtual void apply (X& v, const Y& d)
│ │ │ │ +
488 {
│ │ │ │ +
489 for (int i=0; i<_n; i++) {
│ │ │ │ +
490 dbjac(_A_,v,d,_w,BL<l>());
│ │ │ │ +
491 }
│ │ │ │ +
492 }
│ │ │ │ +
│ │ │ │ +
493
│ │ │ │ +
│ │ │ │ +
499 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ +
500 {}
│ │ │ │ +
│ │ │ │ +
501
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
504 {
│ │ │ │ + │ │ │ │ +
506 }
│ │ │ │ +
│ │ │ │ +
507
│ │ │ │ +
508 private:
│ │ │ │ +
510 const M& _A_;
│ │ │ │ +
512 int _n;
│ │ │ │ +
514 real_field_type _w;
│ │ │ │ +
515 };
│ │ │ │ +
│ │ │ │ +
516 DUNE_REGISTER_PRECONDITIONER("jac", defaultPreconditionerBlockLevelCreator<Dune::SeqJac>());
│ │ │ │ +
517
│ │ │ │ +
518
│ │ │ │ +
519
│ │ │ │ +
531 template<class M, class X, class Y, int l=1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
533 public:
│ │ │ │ +
535 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ │ +
537 typedef typename matrix_type :: block_type block_type;
│ │ │ │ +
539 typedef X domain_type;
│ │ │ │ +
541 typedef Y range_type;
│ │ │ │ +
542
│ │ │ │ +
544 typedef typename X::field_type field_type;
│ │ │ │ +
545
│ │ │ │ +
547 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ +
549 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ +
550
│ │ │ │ + │ │ │ │ +
553
│ │ │ │ +
│ │ │ │ +
561 SeqILU (const M& A, real_field_type w, const bool resort = false )
│ │ │ │ +
562 : SeqILU( A, 0, w, resort ) // construct ILU(0)
│ │ │ │ +
563 {
│ │ │ │ +
564 }
│ │ │ │ +
│ │ │ │ +
565
│ │ │ │ +
│ │ │ │ +
580 SeqILU (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ +
581 : SeqILU(A->getmat(), configuration)
│ │ │ │ +
582 {}
│ │ │ │ +
│ │ │ │ +
583
│ │ │ │ +
│ │ │ │ +
598 SeqILU(const M& A, const ParameterTree& config)
│ │ │ │ +
599 : SeqILU(A, config.get("n", 0),
│ │ │ │ +
600 config.get<real_field_type>("relaxation", 1.0),
│ │ │ │ +
601 config.get("resort", false))
│ │ │ │ +
602 {}
│ │ │ │ +
│ │ │ │ +
603
│ │ │ │ +
│ │ │ │ +
612 SeqILU (const M& A, int n, real_field_type w, const bool resort = false )
│ │ │ │ +
613 : ILU_(),
│ │ │ │ +
614 lower_(),
│ │ │ │ +
615 upper_(),
│ │ │ │ +
616 inv_(),
│ │ │ │ +
617 w_(w),
│ │ │ │ +
618 wNotIdentity_([w]{using std::abs; return abs(w - real_field_type(1)) > 1e-15;}() )
│ │ │ │ +
619 {
│ │ │ │ +
620 if( n == 0 )
│ │ │ │ +
621 {
│ │ │ │ +
622 // copy A
│ │ │ │ +
623 ILU_.reset( new matrix_type( A ) );
│ │ │ │ +
624 // create ILU(0) decomposition
│ │ │ │ + │ │ │ │ +
626 }
│ │ │ │ +
627 else
│ │ │ │ +
628 {
│ │ │ │ +
629 // create matrix in build mode
│ │ │ │ +
630 ILU_.reset( new matrix_type( A.N(), A.M(), matrix_type::row_wise) );
│ │ │ │ +
631 // create ILU(n) decomposition
│ │ │ │ +
632 ILU::blockILUDecomposition( A, n, *ILU_ );
│ │ │ │ +
633 }
│ │ │ │ +
634
│ │ │ │ +
635 if( resort )
│ │ │ │ +
636 {
│ │ │ │ +
637 // store ILU in simple CRS format
│ │ │ │ +
638 ILU::convertToCRS( *ILU_, lower_, upper_, inv_ );
│ │ │ │ +
639 ILU_.reset();
│ │ │ │ +
640 }
│ │ │ │ +
641 }
│ │ │ │ +
│ │ │ │ +
642
│ │ │ │ +
│ │ │ │ +
648 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ +
649 {}
│ │ │ │ +
│ │ │ │ +
650
│ │ │ │ +
│ │ │ │ +
656 virtual void apply (X& v, const Y& d)
│ │ │ │ +
657 {
│ │ │ │ +
658 if( ILU_ )
│ │ │ │ +
659 {
│ │ │ │ +
660 ILU::blockILUBacksolve( *ILU_, v, d);
│ │ │ │ +
661 }
│ │ │ │ +
662 else
│ │ │ │ +
663 {
│ │ │ │ +
664 ILU::blockILUBacksolve(lower_, upper_, inv_, v, d);
│ │ │ │ +
665 }
│ │ │ │ +
666
│ │ │ │ +
667 if( wNotIdentity_ )
│ │ │ │ +
668 {
│ │ │ │ +
669 v *= w_;
│ │ │ │ +
670 }
│ │ │ │ +
671 }
│ │ │ │ +
│ │ │ │ +
672
│ │ │ │ +
│ │ │ │ +
678 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ +
679 {}
│ │ │ │ +
│ │ │ │ +
680
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
683 {
│ │ │ │ + │ │ │ │ +
685 }
│ │ │ │ +
│ │ │ │ +
686
│ │ │ │ +
687 protected:
│ │ │ │ +
689 std::unique_ptr< matrix_type > ILU_;
│ │ │ │ +
690
│ │ │ │ + │ │ │ │ + │ │ │ │ +
694 std::vector< block_type, typename matrix_type::allocator_type > inv_;
│ │ │ │ +
695
│ │ │ │ + │ │ │ │ +
699 const bool wNotIdentity_;
│ │ │ │ +
700 };
│ │ │ │ +
│ │ │ │ +
701 DUNE_REGISTER_PRECONDITIONER("ilu", defaultPreconditionerBlockLevelCreator<Dune::SeqILU>());
│ │ │ │ +
702
│ │ │ │ +
703
│ │ │ │ +
712 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
713 class Richardson : public Preconditioner<X,Y> {
│ │ │ │ +
714 public:
│ │ │ │ +
716 typedef X domain_type;
│ │ │ │ +
718 typedef Y range_type;
│ │ │ │ +
720 typedef typename X::field_type field_type;
│ │ │ │ +
722 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ +
724 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ +
725
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
732 _w(w)
│ │ │ │ +
733 {}
│ │ │ │ +
│ │ │ │ +
734
│ │ │ │ +
│ │ │ │ +
746 Richardson (const ParameterTree& configuration)
│ │ │ │ +
747 : Richardson(configuration.get<real_field_type>("relaxation", 1.0))
│ │ │ │ +
748 {}
│ │ │ │ +
│ │ │ │ +
749
│ │ │ │ +
│ │ │ │ +
755 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ +
756 {}
│ │ │ │ +
│ │ │ │ +
757
│ │ │ │ +
│ │ │ │ +
763 virtual void apply (X& v, const Y& d)
│ │ │ │ +
764 {
│ │ │ │ +
765 v = d;
│ │ │ │ +
766 v *= _w;
│ │ │ │ +
767 }
│ │ │ │ +
│ │ │ │ +
768
│ │ │ │ +
│ │ │ │ +
774 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ +
775 {}
│ │ │ │ +
│ │ │ │ +
776
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
779 {
│ │ │ │ + │ │ │ │ +
781 }
│ │ │ │ +
│ │ │ │ +
782
│ │ │ │ +
783 private:
│ │ │ │ + │ │ │ │ +
786 };
│ │ │ │ +
│ │ │ │ +
787 DUNE_REGISTER_PRECONDITIONER("richardson", [](auto tl, const auto& /* mat */, const ParameterTree& config){
│ │ │ │ +
788 using D = typename Dune::TypeListElement<1, decltype(tl)>::type;
│ │ │ │ +
789 using R = typename Dune::TypeListElement<2, decltype(tl)>::type;
│ │ │ │ +
790 return std::make_shared<Richardson<D,R>>(config);
│ │ │ │ +
791 });
│ │ │ │ +
792
│ │ │ │ +
793
│ │ │ │ +
804 template< class M, class X, class Y >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
806 : public Preconditioner< X, Y >
│ │ │ │ +
807 {
│ │ │ │ +
808 typedef SeqILDL< M, X, Y > This;
│ │ │ │ + │ │ │ │ +
810
│ │ │ │ +
811 public:
│ │ │ │ +
813 typedef std::remove_const_t< M > matrix_type;
│ │ │ │ +
815 typedef X domain_type;
│ │ │ │ +
817 typedef Y range_type;
│ │ │ │ +
819 typedef typename X::field_type field_type;
│ │ │ │ +
821 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ +
823 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ +
824
│ │ │ │ +
│ │ │ │ +
837 SeqILDL (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ +
838 : SeqILDL(A->getmat(), configuration)
│ │ │ │ +
839 {}
│ │ │ │ +
│ │ │ │ +
840
│ │ │ │ +
│ │ │ │ +
853 SeqILDL(const matrix_type& A, const ParameterTree& config)
│ │ │ │ +
854 : SeqILDL(A, config.get<real_field_type>("relaxation", 1.0))
│ │ │ │ +
855 {}
│ │ │ │ +
│ │ │ │ +
856
│ │ │ │ +
│ │ │ │ +
865 explicit SeqILDL ( const matrix_type &A, real_field_type relax = real_field_type( 1 ) )
│ │ │ │ +
866 : decomposition_( A.N(), A.M(), matrix_type::random ),
│ │ │ │ +
867 relax_( relax )
│ │ │ │ +
868 {
│ │ │ │ +
869 // setup row sizes for lower triangular matrix
│ │ │ │ +
870 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ +
871 {
│ │ │ │ +
872 const auto &A_i = *i;
│ │ │ │ +
873 const auto ij = A_i.find( i.index() );
│ │ │ │ +
874 if( ij != A_i.end() )
│ │ │ │ +
875 decomposition_.setrowsize( i.index(), ij.offset()+1 );
│ │ │ │ +
876 else
│ │ │ │ +
877 DUNE_THROW( ISTLError, "diagonal entry missing" );
│ │ │ │ +
878 }
│ │ │ │ +
879 decomposition_.endrowsizes();
│ │ │ │ +
880
│ │ │ │ +
881 // setup row indices for lower triangular matrix
│ │ │ │ +
882 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ +
883 {
│ │ │ │ +
884 const auto &A_i = *i;
│ │ │ │ +
885 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij )
│ │ │ │ +
886 decomposition_.addindex( i.index(), ij.index() );
│ │ │ │ +
887 decomposition_.addindex( i.index(), i.index() );
│ │ │ │ +
888 }
│ │ │ │ +
889 decomposition_.endindices();
│ │ │ │ +
890
│ │ │ │ +
891 // copy values of lower triangular matrix
│ │ │ │ +
892 auto i = A.begin();
│ │ │ │ +
893 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row != rowend; ++row, ++i )
│ │ │ │ +
894 {
│ │ │ │ +
895 auto ij = i->begin();
│ │ │ │ +
896 for( auto col = row->begin(), colend = row->end(); col != colend; ++col, ++ij )
│ │ │ │ +
897 *col = *ij;
│ │ │ │ +
898 }
│ │ │ │ +
899
│ │ │ │ +
900 // perform ILDL decomposition
│ │ │ │ +
901 bildl_decompose( decomposition_ );
│ │ │ │ +
902 }
│ │ │ │ +
│ │ │ │ +
903
│ │ │ │ +
│ │ │ │ +
905 void pre ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override
│ │ │ │ +
906 {}
│ │ │ │ +
│ │ │ │ +
907
│ │ │ │ +
│ │ │ │ +
909 void apply ( X &v, const Y &d ) override
│ │ │ │ +
910 {
│ │ │ │ +
911 bildl_backsolve( decomposition_, v, d, true );
│ │ │ │ +
912 v *= relax_;
│ │ │ │ +
913 }
│ │ │ │ +
│ │ │ │ +
914
│ │ │ │ +
│ │ │ │ +
916 void post ([[maybe_unused]] X &x) override
│ │ │ │ +
917 {}
│ │ │ │ +
│ │ │ │ +
918
│ │ │ │ + │ │ │ │ +
921
│ │ │ │ +
922 private:
│ │ │ │ +
923 matrix_type decomposition_;
│ │ │ │ +
924 real_field_type relax_;
│ │ │ │ +
925 };
│ │ │ │ +
│ │ │ │ +
926 DUNE_REGISTER_PRECONDITIONER("ildl", defaultPreconditionerCreator<Dune::SeqILDL>());
│ │ │ │ +
927
│ │ │ │ +
930} // end namespace
│ │ │ │ +
931
│ │ │ │ +
932
│ │ │ │ +
933#endif
│ │ │ │ +
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ + │ │ │ │ +
The incomplete LU factorization kernels.
│ │ │ │ +
Incomplete LDL decomposition.
│ │ │ │ +
Some handy generic functions for ISTL matrices.
│ │ │ │ + │ │ │ │ +
Define general, extensible interface for inverse operators.
│ │ │ │ + │ │ │ │ +
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:16
│ │ │ │ + │ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition gsetc.hh:646
│ │ │ │ +
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition gsetc.hh:658
│ │ │ │ +
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition gsetc.hh:634
│ │ │ │
Definition allocator.hh:11
│ │ │ │
void bildl_decompose(Matrix &A)
compute ILDL decomposition of a symmetric matrix A
Definition ildl.hh:88
│ │ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │
void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
Definition ildl.hh:149
│ │ │ │ -
static void bildl_subtractBCT(const FieldMatrix< K, m, n > &B, const FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A)
Definition ildl.hh:24
│ │ │ │ +
void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv)
convert ILU decomposition into CRS format for lower and upper triangular and inverse.
Definition ilu.hh:307
│ │ │ │ +
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ │ +
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ │ +
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ │ +
compile-time parameter for block recursion depth
Definition gsetc.hh:45
│ │ │ │ +
a simple compressed row storage matrix class
Definition ilu.hh:259
│ │ │ │
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
RowIterator beforeBegin()
Definition matrix.hh:634
│ │ │ │ -
RowIterator beforeEnd()
Definition matrix.hh:627
│ │ │ │ -
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ -
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:614
│ │ │ │ -
Definition matrixutils.hh:27
│ │ │ │ +
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ +
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │ +
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:109
│ │ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
Turns an InverseOperator into a Preconditioner.
Definition preconditioners.hh:75
│ │ │ │ +
O::range_type range_type
The range type of the preconditioner.
Definition preconditioners.hh:80
│ │ │ │ +
O::domain_type domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:78
│ │ │ │ +
virtual void post(domain_type &)
Clean up.
Definition preconditioners.hh:111
│ │ │ │ +
range_type::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:82
│ │ │ │ +
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:86
│ │ │ │ +
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:84
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:115
│ │ │ │ +
virtual void pre(domain_type &, range_type &)
Prepare the preconditioner.
Definition preconditioners.hh:101
│ │ │ │ +
InverseOperator2Preconditioner(InverseOperator &inverse_operator)
Construct the preconditioner from the solver.
Definition preconditioners.hh:94
│ │ │ │ +
O InverseOperator
type of the wrapped inverse operator
Definition preconditioners.hh:88
│ │ │ │ +
virtual void apply(domain_type &v, const range_type &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:104
│ │ │ │ +
Sequential SSOR preconditioner.
Definition preconditioners.hh:141
│ │ │ │ +
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:229
│ │ │ │ +
SeqSSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:182
│ │ │ │ +
SeqSSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:199
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:233
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:150
│ │ │ │ +
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:152
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:146
│ │ │ │ +
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:144
│ │ │ │ +
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:216
│ │ │ │ +
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:208
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:148
│ │ │ │ +
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:154
│ │ │ │ +
SeqSSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:163
│ │ │ │ +
Sequential SOR preconditioner.
Definition preconditioners.hh:261
│ │ │ │ +
SeqSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:302
│ │ │ │ +
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:264
│ │ │ │ +
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:274
│ │ │ │ +
void apply(X &v, const Y &d)
Apply the preconditioner in a special direction.
Definition preconditioners.hh:350
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:266
│ │ │ │ +
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:367
│ │ │ │ +
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:328
│ │ │ │ +
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:272
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:371
│ │ │ │ +
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:336
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:268
│ │ │ │ +
SeqSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:319
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:270
│ │ │ │ +
SeqSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:283
│ │ │ │ +
The sequential jacobian preconditioner.
Definition preconditioners.hh:412
│ │ │ │ +
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:499
│ │ │ │ +
SeqJac(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:470
│ │ │ │ +
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:487
│ │ │ │ +
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:415
│ │ │ │ +
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:423
│ │ │ │ +
SeqJac(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:453
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:421
│ │ │ │ +
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:479
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:417
│ │ │ │ +
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:425
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:503
│ │ │ │ +
SeqJac(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:434
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:419
│ │ │ │ +
Sequential ILU preconditioner.
Definition preconditioners.hh:532
│ │ │ │ +
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:678
│ │ │ │ +
SeqILU(const M &A, int n, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:612
│ │ │ │ +
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:648
│ │ │ │ +
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:656
│ │ │ │ +
ILU::CRS< block_type, typename M::allocator_type > CRS
type of ILU storage
Definition preconditioners.hh:552
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:541
│ │ │ │ +
CRS lower_
The ILU(n) decomposition of the matrix. As storage a CRS structure is used.
Definition preconditioners.hh:692
│ │ │ │ +
const bool wNotIdentity_
true if w != 1.0
Definition preconditioners.hh:699
│ │ │ │ +
SeqILU(const M &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:598
│ │ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:535
│ │ │ │ +
matrix_type::block_type block_type
block type of matrix
Definition preconditioners.hh:537
│ │ │ │ +
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:549
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:544
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:682
│ │ │ │ +
SeqILU(const M &A, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:561
│ │ │ │ +
const real_field_type w_
The relaxation factor to use.
Definition preconditioners.hh:697
│ │ │ │ +
SeqILU(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:580
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:539
│ │ │ │ +
std::vector< block_type, typename matrix_type::allocator_type > inv_
Definition preconditioners.hh:694
│ │ │ │ +
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:547
│ │ │ │ +
std::unique_ptr< matrix_type > ILU_
The ILU(n) decomposition of the matrix. As storage a BCRSMatrix is used.
Definition preconditioners.hh:689
│ │ │ │ +
CRS upper_
Definition preconditioners.hh:693
│ │ │ │ +
Richardson preconditioner.
Definition preconditioners.hh:713
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:720
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:778
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:718
│ │ │ │ +
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:755
│ │ │ │ +
Richardson(real_field_type w=1.0)
Constructor.
Definition preconditioners.hh:731
│ │ │ │ +
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:774
│ │ │ │ +
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:724
│ │ │ │ +
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:722
│ │ │ │ +
Richardson(const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:746
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:716
│ │ │ │ +
virtual void apply(X &v, const Y &d)
Apply the precondioner.
Definition preconditioners.hh:763
│ │ │ │ +
sequential ILDL preconditioner
Definition preconditioners.hh:807
│ │ │ │ +
SeqILDL(const matrix_type &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:853
│ │ │ │ +
SeqILDL(const matrix_type &A, real_field_type relax=real_field_type(1))
constructor
Definition preconditioners.hh:865
│ │ │ │ +
X domain_type
domain type of the preconditioner
Definition preconditioners.hh:815
│ │ │ │ +
void post(X &x) override
Clean up.
Definition preconditioners.hh:916
│ │ │ │ +
Y range_type
range type of the preconditioner
Definition preconditioners.hh:817
│ │ │ │ +
std::remove_const_t< M > matrix_type
type of matrix the preconditioner is for
Definition preconditioners.hh:813
│ │ │ │ +
void apply(X &v, const Y &d) override
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:909
│ │ │ │ +
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:823
│ │ │ │ +
SeqILDL(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:837
│ │ │ │ +
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:905
│ │ │ │ +
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:821
│ │ │ │ +
X::field_type field_type
field type of the preconditioner
Definition preconditioners.hh:819
│ │ │ │ +
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:920
│ │ │ │ +
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ +
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,266 +1,1027 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -ildl.hh │ │ │ │ │ +preconditioners.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -3#ifndef DUNE_ISTL_ILDL_HH │ │ │ │ │ -4#define DUNE_ISTL_ILDL_HH │ │ │ │ │ -5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8#include "_i_l_u_._h_h" │ │ │ │ │ -9 │ │ │ │ │ -17namespace _D_u_n_e │ │ │ │ │ -18{ │ │ │ │ │ -19 │ │ │ │ │ -20 // bildl_subtractBCT │ │ │ │ │ -21 // ----------------- │ │ │ │ │ -22 │ │ │ │ │ -23 template< class K, int m, int n > │ │ │ │ │ -_2_4 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &B, │ │ │ │ │ -const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &CT, _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &A ) │ │ │ │ │ -25 { │ │ │ │ │ -26 for( int i = 0; i < m; ++i ) │ │ │ │ │ -27 { │ │ │ │ │ -28 for( int j = 0; j < n; ++j ) │ │ │ │ │ -29 { │ │ │ │ │ -30 for( int k = 0; k < n; ++k ) │ │ │ │ │ -31 A[ i ][ j ] -= B[ i ][ k ] * CT[ j ][ k ]; │ │ │ │ │ -32 } │ │ │ │ │ -33 } │ │ │ │ │ -34 } │ │ │ │ │ -35 │ │ │ │ │ -36 template< class K > │ │ │ │ │ -_3_7 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const K &B, const K &CT, K &A, │ │ │ │ │ -38 typename std::enable_if_t::value>* sfinae = nullptr ) │ │ │ │ │ -39 { │ │ │ │ │ -40 A -= B * CT; │ │ │ │ │ -41 } │ │ │ │ │ -42 │ │ │ │ │ -43 template< class Matrix > │ │ │ │ │ -_4_4 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const _M_a_t_r_i_x &B, const _M_a_t_r_i_x &CT, │ │ │ │ │ -_M_a_t_r_i_x &A, │ │ │ │ │ -45 typename std::enable_if_t::value>* sfinae = nullptr │ │ │ │ │ -) │ │ │ │ │ -46 { │ │ │ │ │ -47 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ -48 { │ │ │ │ │ -49 auto &&A_i = *i; │ │ │ │ │ -50 auto &&B_i = B[ i.index() ]; │ │ │ │ │ -51 const auto ikend = B_i._e_n_d(); │ │ │ │ │ -52 for( auto j = A_i.begin(), jend = A_i.end(); j != jend; ++j ) │ │ │ │ │ -53 { │ │ │ │ │ -54 auto &&A_ij = *j; │ │ │ │ │ -55 auto &&CT_j = CT[ j.index() ]; │ │ │ │ │ -56 const auto jkend = CT_j._e_n_d(); │ │ │ │ │ -57 for( auto ik = B_i.begin(), jk = CT_j.begin(); (ik != ikend) && (jk != │ │ │ │ │ -jkend); ) │ │ │ │ │ -58 { │ │ │ │ │ -59 if( ik.index() == jk.index() ) │ │ │ │ │ -60 { │ │ │ │ │ -61 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T( *ik, *jk, A_ij ); │ │ │ │ │ -62 ++ik; ++jk; │ │ │ │ │ -63 } │ │ │ │ │ -64 else if( ik.index() < jk.index() ) │ │ │ │ │ -65 ++ik; │ │ │ │ │ -66 else │ │ │ │ │ -67 ++jk; │ │ │ │ │ -68 } │ │ │ │ │ -69 } │ │ │ │ │ -70 } │ │ │ │ │ -71 } │ │ │ │ │ -72 │ │ │ │ │ -73 │ │ │ │ │ -74 │ │ │ │ │ -75 // bildl_decompose │ │ │ │ │ -76 // --------------- │ │ │ │ │ -77 │ │ │ │ │ -87 template< class Matrix > │ │ │ │ │ -_8_8 inline void _b_i_l_d_l___d_e_c_o_m_p_o_s_e ( _M_a_t_r_i_x &A ) │ │ │ │ │ -89 { │ │ │ │ │ -90 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ -91 { │ │ │ │ │ -92 auto &&A_i = *i; │ │ │ │ │ -93 │ │ │ │ │ -94 auto ij = A_i.begin(); │ │ │ │ │ -95 for( ; ij.index() < i.index(); ++ij ) │ │ │ │ │ +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 │ │ │ │ │ +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 "_i_l_d_l_._h_h" │ │ │ │ │ +26#include "_i_l_u_._h_h" │ │ │ │ │ +27 │ │ │ │ │ +28 │ │ │ │ │ +29namespace _D_u_n_e { │ │ │ │ │ +72 template │ │ │ │ │ +_7_3 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 : │ │ │ │ │ +74 public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +75 { │ │ │ │ │ +76 public: │ │ │ │ │ +_7_8 typedef typename O::domain_type _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_8_0 typedef typename O::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_8_2 typedef typename range_type::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_8_4 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_8_6 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_8_8 typedef O _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r; │ │ │ │ │ +89 │ │ │ │ │ +_9_4 _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) │ │ │ │ │ +95 : inverse_operator_(inverse_operator) │ │ │ │ │ 96 { │ │ │ │ │ -97 auto &&A_ij = *ij; │ │ │ │ │ -98 auto &&A_j = A[ ij.index() ]; │ │ │ │ │ -99 │ │ │ │ │ -100 // store L_ij Dj in A_ij (note: for k < i: A_kj = L_kj) │ │ │ │ │ -101 // L_ij Dj = A_ij - \sum_{k < j} (L_ik D_k) L_jk^T │ │ │ │ │ -102 auto ik = A_i._b_e_g_i_n(); │ │ │ │ │ -103 auto jk = A_j.begin(); │ │ │ │ │ -104 while( (ik != ij) && (jk.index() < ij.index()) ) │ │ │ │ │ +97 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) │ │ │ │ │ +98 DUNE_THROW(InvalidStateException, "User-supplied solver category does not │ │ │ │ │ +match that of the given inverse operator"); │ │ │ │ │ +99 } │ │ │ │ │ +100 │ │ │ │ │ +_1_0_1 virtual void _p_r_e(_d_o_m_a_i_n___t_y_p_e&,_r_a_n_g_e___t_y_p_e&) │ │ │ │ │ +102 {} │ │ │ │ │ +103 │ │ │ │ │ +_1_0_4 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& d) │ │ │ │ │ 105 { │ │ │ │ │ -106 if( ik.index() == jk.index() ) │ │ │ │ │ -107 { │ │ │ │ │ -108 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T(*ik, *jk, A_ij); │ │ │ │ │ -109 ++ik; ++jk; │ │ │ │ │ -110 } │ │ │ │ │ -111 else if( ik.index() < jk.index() ) │ │ │ │ │ -112 ++ik; │ │ │ │ │ -113 else │ │ │ │ │ -114 ++jk; │ │ │ │ │ -115 } │ │ │ │ │ -116 } │ │ │ │ │ -117 │ │ │ │ │ -118 if( ij.index() != i.index() ) │ │ │ │ │ -119 DUNE_THROW( _I_S_T_L_E_r_r_o_r, "diagonal entry missing" ); │ │ │ │ │ -120 │ │ │ │ │ -121 // update diagonal and multiply A_ij by D_j^{-1} │ │ │ │ │ -122 auto &&A_ii = *ij; │ │ │ │ │ -123 for( auto ik = A_i.begin(); ik != ij; ++ik ) │ │ │ │ │ -124 { │ │ │ │ │ -125 auto &&A_ik = *ik; │ │ │ │ │ -126 const auto &A_k = A[ ik.index() ]; │ │ │ │ │ +106 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ +107 _r_a_n_g_e___t_y_p_e copy(d); │ │ │ │ │ +108 inverse_operator_.apply(v, copy, res); │ │ │ │ │ +109 } │ │ │ │ │ +110 │ │ │ │ │ +_1_1_1 virtual void _p_o_s_t(_d_o_m_a_i_n___t_y_p_e&) │ │ │ │ │ +112 {} │ │ │ │ │ +113 │ │ │ │ │ +_1_1_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 │ │ │ │ │ +116 { │ │ │ │ │ +117 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_); │ │ │ │ │ +118 } │ │ │ │ │ +119 │ │ │ │ │ +120 private: │ │ │ │ │ +121 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r& inverse_operator_; │ │ │ │ │ +122 }; │ │ │ │ │ +123 │ │ │ │ │ +124 //===================================================================== │ │ │ │ │ +125 // Implementation of this interface for sequential ISTL-preconditioners │ │ │ │ │ +126 //===================================================================== │ │ │ │ │ 127 │ │ │ │ │ -128 auto B = A_ik; │ │ │ │ │ -129 Impl::asMatrix(A_ik).rightmultiply( Impl::asMatrix(*A_k.find( ik.index() )) │ │ │ │ │ -); │ │ │ │ │ -130 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T( B, A_ik, A_ii ); │ │ │ │ │ -131 } │ │ │ │ │ -132 try │ │ │ │ │ -133 { │ │ │ │ │ -134 Impl::asMatrix(A_ii).invert(); │ │ │ │ │ -135 } │ │ │ │ │ -136 catch( const Dune::FMatrixError &e ) │ │ │ │ │ -137 { │ │ │ │ │ -138 DUNE_THROW( _M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r, "ILDL failed to invert matrix block A[" << │ │ │ │ │ -i.index() << "][" << ij.index() << "]" << e.what(); th__ex.r = i.index(); │ │ │ │ │ -th__ex.c = ij.index() ); │ │ │ │ │ -139 } │ │ │ │ │ -140 } │ │ │ │ │ -141 } │ │ │ │ │ -142 │ │ │ │ │ -143 │ │ │ │ │ -144 │ │ │ │ │ -145 // bildl_backsolve │ │ │ │ │ -146 // --------------- │ │ │ │ │ -147 │ │ │ │ │ -148 template< class Matrix, class X, class Y > │ │ │ │ │ -_1_4_9 inline void _b_i_l_d_l___b_a_c_k_s_o_l_v_e ( const _M_a_t_r_i_x &A, X &v, const Y &d, bool │ │ │ │ │ -isLowerTriangular = false ) │ │ │ │ │ -150 { │ │ │ │ │ -151 // solve L v = d, note: Lii = I │ │ │ │ │ -152 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ -153 { │ │ │ │ │ -154 const auto &A_i = *i; │ │ │ │ │ -155 v[ i.index() ] = d[ i.index() ]; │ │ │ │ │ -156 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij ) │ │ │ │ │ -157 { │ │ │ │ │ -158 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ │ -159 Impl::asMatrix(*ij).mmv(Impl::asVector( v[ ij.index() ] ), vi); │ │ │ │ │ -160 } │ │ │ │ │ -161 } │ │ │ │ │ -162 │ │ │ │ │ -163 // solve D w = v, note: diagonal stores Dii^{-1} │ │ │ │ │ -164 if( isLowerTriangular ) │ │ │ │ │ +128 │ │ │ │ │ +140 template │ │ │ │ │ +_1_4_1 class _S_e_q_S_S_O_R : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ +142 public: │ │ │ │ │ +_1_4_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_1_4_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_1_4_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_1_5_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_5_2 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_5_4 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +155 │ │ │ │ │ +_1_6_3 _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) │ │ │ │ │ +164 : _A_(A), _n(n), _w(w) │ │ │ │ │ 165 { │ │ │ │ │ -166 // The matrix is lower triangular, so the diagonal entry is the │ │ │ │ │ -167 // last one in each row. │ │ │ │ │ -168 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ -169 { │ │ │ │ │ -170 const auto &A_i = *i; │ │ │ │ │ -171 const auto ii = A_i.beforeEnd(); │ │ │ │ │ -172 assert( ii.index() == i.index() ); │ │ │ │ │ -173 // We need to be careful here: Directly using │ │ │ │ │ -174 // auto rhs = Impl::asVector(v[ i.index() ]); │ │ │ │ │ -175 // is not OK in case this is a proxy. Hence │ │ │ │ │ -176 // we first have to copy the value. Notice that │ │ │ │ │ -177 // this is still not OK, if the vector type itself returns │ │ │ │ │ -178 // proxy references. │ │ │ │ │ -179 auto rhsValue = v[ i.index() ]; │ │ │ │ │ -180 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ │ -181 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ │ -182 Impl::asMatrix(*ii).mv(rhs, vi); │ │ │ │ │ -183 } │ │ │ │ │ -184 } │ │ │ │ │ -185 else │ │ │ │ │ -186 { │ │ │ │ │ -187 // Without assumptions on the sparsity pattern we have to search │ │ │ │ │ -188 // for the diagonal entry in each row. │ │ │ │ │ -189 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ -190 { │ │ │ │ │ -191 const auto &A_i = *i; │ │ │ │ │ -192 const auto ii = A_i.find( i.index() ); │ │ │ │ │ -193 assert( ii.index() == i.index() ); │ │ │ │ │ -194 // We need to be careful here: Directly using │ │ │ │ │ -195 // auto rhs = Impl::asVector(v[ i.index() ]); │ │ │ │ │ -196 // is not OK in case this is a proxy. Hence │ │ │ │ │ -197 // we first have to copy the value. Notice that │ │ │ │ │ -198 // this is still not OK, if the vector type itself returns │ │ │ │ │ -199 // proxy references. │ │ │ │ │ -200 auto rhsValue = v[ i.index() ]; │ │ │ │ │ -201 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ │ -202 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ │ -203 Impl::asMatrix(*ii).mv(rhs, vi); │ │ │ │ │ -204 } │ │ │ │ │ -205 } │ │ │ │ │ -206 │ │ │ │ │ -207 // solve L^T v = w, note: only L is stored │ │ │ │ │ -208 // note: we perform the operation column-wise from right to left │ │ │ │ │ -209 for( auto i = A._b_e_f_o_r_e_E_n_d(), iend = A._b_e_f_o_r_e_B_e_g_i_n(); i != iend; --i ) │ │ │ │ │ -210 { │ │ │ │ │ -211 const auto &A_i = *i; │ │ │ │ │ -212 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij ) │ │ │ │ │ -213 { │ │ │ │ │ -214 auto&& vij = Impl::asVector( v[ ij.index() ] ); │ │ │ │ │ -215 Impl::asMatrix(*ij).mmtv(Impl::asVector( v[ i.index() ] ), vij); │ │ │ │ │ -216 } │ │ │ │ │ -217 } │ │ │ │ │ -218 } │ │ │ │ │ -219 │ │ │ │ │ -220} // namespace Dune │ │ │ │ │ -221 │ │ │ │ │ -222#endif // #ifndef DUNE_ISTL_ILDL_HH │ │ │ │ │ +166 _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_); │ │ │ │ │ +167 } │ │ │ │ │ +168 │ │ │ │ │ +_1_8_2 _S_e_q_S_S_O_R (const std::shared_ptr>& A, │ │ │ │ │ +const ParameterTree& configuration) │ │ │ │ │ +183 : _S_e_q_S_S_O_R(A->getmat(), configuration) │ │ │ │ │ +184 {} │ │ │ │ │ +185 │ │ │ │ │ +_1_9_9 _S_e_q_S_S_O_R (const M& A, const ParameterTree& configuration) │ │ │ │ │ +200 : _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)) │ │ │ │ │ +201 {} │ │ │ │ │ +202 │ │ │ │ │ +_2_0_8 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ +209 {} │ │ │ │ │ +210 │ │ │ │ │ +_2_1_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +217 { │ │ │ │ │ +218 for (int i=0; i<_n; i++) { │ │ │ │ │ +219 _b_s_o_r_f(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ +220 _b_s_o_r_b(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ +221 } │ │ │ │ │ +222 } │ │ │ │ │ +223 │ │ │ │ │ +_2_2_9 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ +230 {} │ │ │ │ │ +231 │ │ │ │ │ +_2_3_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +234 { │ │ │ │ │ +235 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ │ +236 } │ │ │ │ │ +237 │ │ │ │ │ +238 private: │ │ │ │ │ +240 const M& _A_; │ │ │ │ │ +242 int _n; │ │ │ │ │ +244 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ +245 }; │ │ │ │ │ +_2_4_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("ssor", │ │ │ │ │ +defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ +247 │ │ │ │ │ +248 │ │ │ │ │ +260 template │ │ │ │ │ +_2_6_1 class _S_e_q_S_O_R : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ +262 public: │ │ │ │ │ +_2_6_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_2_6_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_2_6_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_2_7_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_7_2 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_7_4 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +275 │ │ │ │ │ +_2_8_3 _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) │ │ │ │ │ +284 : _A_(A), _n(n), _w(w) │ │ │ │ │ +285 { │ │ │ │ │ +286 _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_); │ │ │ │ │ +287 } │ │ │ │ │ +288 │ │ │ │ │ +_3_0_2 _S_e_q_S_O_R (const std::shared_ptr>& A, │ │ │ │ │ +const ParameterTree& configuration) │ │ │ │ │ +303 : _S_e_q_S_O_R(A->getmat(), configuration) │ │ │ │ │ +304 {} │ │ │ │ │ +305 │ │ │ │ │ +_3_1_9 _S_e_q_S_O_R (const M& A, const ParameterTree& configuration) │ │ │ │ │ +320 : _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)) │ │ │ │ │ +321 {} │ │ │ │ │ +322 │ │ │ │ │ +_3_2_8 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ +329 {} │ │ │ │ │ +330 │ │ │ │ │ +_3_3_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +337 { │ │ │ │ │ +338 this->template apply(v,d); │ │ │ │ │ +339 } │ │ │ │ │ +340 │ │ │ │ │ +349 template │ │ │ │ │ +_3_5_0 void _a_p_p_l_y(X& v, const Y& d) │ │ │ │ │ +351 { │ │ │ │ │ +352 if(forward) │ │ │ │ │ +353 for (int i=0; i<_n; i++) { │ │ │ │ │ +354 _b_s_o_r_f(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ +355 } │ │ │ │ │ +356 else │ │ │ │ │ +357 for (int i=0; i<_n; i++) { │ │ │ │ │ +358 _b_s_o_r_b(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ +359 } │ │ │ │ │ +360 } │ │ │ │ │ +361 │ │ │ │ │ +_3_6_7 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ +368 {} │ │ │ │ │ +369 │ │ │ │ │ +_3_7_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 │ │ │ │ │ +372 { │ │ │ │ │ +373 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; │ │ │ │ │ +374 } │ │ │ │ │ +375 │ │ │ │ │ +376 private: │ │ │ │ │ +378 const M& _A_; │ │ │ │ │ +380 int _n; │ │ │ │ │ +382 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ +383 }; │ │ │ │ │ +_3_8_4 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("sor", │ │ │ │ │ +defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ +385 │ │ │ │ │ +386 │ │ │ │ │ +397 template │ │ │ │ │ +_3_9_8 using _S_e_q_G_S = _S_e_q_S_O_R_<_M_,_X_,_Y_,_l_>; │ │ │ │ │ +_3_9_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("gs", │ │ │ │ │ +defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ +400 │ │ │ │ │ +411 template │ │ │ │ │ +_4_1_2 class _S_e_q_J_a_c : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_> { │ │ │ │ │ +413 public: │ │ │ │ │ +_4_1_5 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_4_1_7 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_4_1_9 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_4_2_1 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_4_2_3 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_4_2_5 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +426 │ │ │ │ │ +_4_3_4 _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) │ │ │ │ │ +435 : _A_(A), _n(n), _w(w) │ │ │ │ │ +436 { │ │ │ │ │ +437 _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_); │ │ │ │ │ +438 } │ │ │ │ │ +439 │ │ │ │ │ +_4_5_3 _S_e_q_J_a_c (const std::shared_ptr>& A, │ │ │ │ │ +const ParameterTree& configuration) │ │ │ │ │ +454 : _S_e_q_J_a_c(A->getmat(), configuration) │ │ │ │ │ +455 {} │ │ │ │ │ +456 │ │ │ │ │ +_4_7_0 _S_e_q_J_a_c (const M& A, const ParameterTree& configuration) │ │ │ │ │ +471 : _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)) │ │ │ │ │ +472 {} │ │ │ │ │ +473 │ │ │ │ │ +_4_7_9 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ +480 {} │ │ │ │ │ +481 │ │ │ │ │ +_4_8_7 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +488 { │ │ │ │ │ +489 for (int i=0; i<_n; i++) { │ │ │ │ │ +490 _d_b_j_a_c(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ +491 } │ │ │ │ │ +492 } │ │ │ │ │ +493 │ │ │ │ │ +_4_9_9 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ +500 {} │ │ │ │ │ +501 │ │ │ │ │ +_5_0_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +504 { │ │ │ │ │ +505 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; │ │ │ │ │ +506 } │ │ │ │ │ +507 │ │ │ │ │ +508 private: │ │ │ │ │ +510 const M& _A_; │ │ │ │ │ +512 int _n; │ │ │ │ │ +514 real_field_type _w; │ │ │ │ │ +515 }; │ │ │ │ │ +_5_1_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("jac", │ │ │ │ │ +defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ +517 │ │ │ │ │ +518 │ │ │ │ │ +519 │ │ │ │ │ +531 template │ │ │ │ │ +_5_3_2 class _S_e_q_I_L_U : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_> { │ │ │ │ │ +533 public: │ │ │ │ │ +_5_3_5 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_5_3_7 typedef typename matrix_type :: block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +_5_3_9 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_5_4_1 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +542 │ │ │ │ │ +_5_4_4 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +545 │ │ │ │ │ +_5_4_7 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_5_4_9 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +550 │ │ │ │ │ +_5_5_2 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; │ │ │ │ │ +553 │ │ │ │ │ +_5_6_1 _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 ) │ │ │ │ │ +562 : _S_e_q_I_L_U( A, 0, w, resort ) // construct ILU(0) │ │ │ │ │ +563 { │ │ │ │ │ +564 } │ │ │ │ │ +565 │ │ │ │ │ +_5_8_0 _S_e_q_I_L_U (const std::shared_ptr>& A, │ │ │ │ │ +const ParameterTree& configuration) │ │ │ │ │ +581 : _S_e_q_I_L_U(A->getmat(), configuration) │ │ │ │ │ +582 {} │ │ │ │ │ +583 │ │ │ │ │ +_5_9_8 _S_e_q_I_L_U(const M& A, const ParameterTree& config) │ │ │ │ │ +599 : _S_e_q_I_L_U(A, config._g_e_t("n", 0), │ │ │ │ │ +600 config._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation", 1.0), │ │ │ │ │ +601 config._g_e_t("resort", false)) │ │ │ │ │ +602 {} │ │ │ │ │ +603 │ │ │ │ │ +_6_1_2 _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 ) │ │ │ │ │ +613 : ILU_(), │ │ │ │ │ +614 lower_(), │ │ │ │ │ +615 upper_(), │ │ │ │ │ +616 inv_(), │ │ │ │ │ +617 w_(w), │ │ │ │ │ +618 wNotIdentity_([w]{using std::abs; return abs(w - _r_e_a_l___f_i_e_l_d___t_y_p_e(1)) > 1e- │ │ │ │ │ +15;}() ) │ │ │ │ │ +619 { │ │ │ │ │ +620 if( n == 0 ) │ │ │ │ │ +621 { │ │ │ │ │ +622 // copy A │ │ │ │ │ +623 ILU_.reset( new matrix_type( A ) ); │ │ │ │ │ +624 // create ILU(0) decomposition │ │ │ │ │ +625 _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( *ILU_ ); │ │ │ │ │ +626 } │ │ │ │ │ +627 else │ │ │ │ │ +628 { │ │ │ │ │ +629 // create matrix in build mode │ │ │ │ │ +630 ILU_.reset( new matrix_type( A._N(), A._M(), matrix_type::row_wise) ); │ │ │ │ │ +631 // create ILU(n) decomposition │ │ │ │ │ +632 _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, *ILU_ ); │ │ │ │ │ +633 } │ │ │ │ │ +634 │ │ │ │ │ +635 if( resort ) │ │ │ │ │ +636 { │ │ │ │ │ +637 // store ILU in simple CRS format │ │ │ │ │ +638 _I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S( *ILU_, lower_, upper_, inv_ ); │ │ │ │ │ +639 ILU_.reset(); │ │ │ │ │ +640 } │ │ │ │ │ +641 } │ │ │ │ │ +642 │ │ │ │ │ +_6_4_8 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ +649 {} │ │ │ │ │ +650 │ │ │ │ │ +_6_5_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +657 { │ │ │ │ │ +658 if( ILU_ ) │ │ │ │ │ +659 { │ │ │ │ │ +660 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e( *ILU_, v, d); │ │ │ │ │ +661 } │ │ │ │ │ +662 else │ │ │ │ │ +663 { │ │ │ │ │ +664 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e(lower_, upper_, inv_, v, d); │ │ │ │ │ +665 } │ │ │ │ │ +666 │ │ │ │ │ +667 if( wNotIdentity_ ) │ │ │ │ │ +668 { │ │ │ │ │ +669 v *= w_; │ │ │ │ │ +670 } │ │ │ │ │ +671 } │ │ │ │ │ +672 │ │ │ │ │ +_6_7_8 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ +679 {} │ │ │ │ │ +680 │ │ │ │ │ +_6_8_2 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +683 { │ │ │ │ │ +684 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; │ │ │ │ │ +685 } │ │ │ │ │ +686 │ │ │ │ │ +687 protected: │ │ │ │ │ +_6_8_9 std::unique_ptr< matrix_type > _I_L_U__; │ │ │ │ │ +690 │ │ │ │ │ +_6_9_2 _C_R_S _l_o_w_e_r__; │ │ │ │ │ +_6_9_3 _C_R_S _u_p_p_e_r__; │ │ │ │ │ +_6_9_4 std::vector< block_type, typename matrix_type::allocator_type > _i_n_v__; │ │ │ │ │ +695 │ │ │ │ │ +_6_9_7 const _r_e_a_l___f_i_e_l_d___t_y_p_e _w__; │ │ │ │ │ +_6_9_9 const bool _w_N_o_t_I_d_e_n_t_i_t_y__; │ │ │ │ │ +700 }; │ │ │ │ │ +_7_0_1 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("ilu", │ │ │ │ │ +defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ +702 │ │ │ │ │ +703 │ │ │ │ │ +712 template │ │ │ │ │ +_7_1_3 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 { │ │ │ │ │ +714 public: │ │ │ │ │ +_7_1_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_7_1_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_7_2_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_7_2_2 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_7_2_4 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +725 │ │ │ │ │ +_7_3_1 _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) : │ │ │ │ │ +732 _w(w) │ │ │ │ │ +733 {} │ │ │ │ │ +734 │ │ │ │ │ +_7_4_6 _R_i_c_h_a_r_d_s_o_n (const ParameterTree& configuration) │ │ │ │ │ +747 : _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)) │ │ │ │ │ +748 {} │ │ │ │ │ +749 │ │ │ │ │ +_7_5_5 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ +756 {} │ │ │ │ │ +757 │ │ │ │ │ +_7_6_3 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +764 { │ │ │ │ │ +765 v = d; │ │ │ │ │ +766 v *= _w; │ │ │ │ │ +767 } │ │ │ │ │ +768 │ │ │ │ │ +_7_7_4 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ +775 {} │ │ │ │ │ +776 │ │ │ │ │ +_7_7_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 │ │ │ │ │ +779 { │ │ │ │ │ +780 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; │ │ │ │ │ +781 } │ │ │ │ │ +782 │ │ │ │ │ +783 private: │ │ │ │ │ +785 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ +786 }; │ │ │ │ │ +_7_8_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("richardson", [](auto tl, const auto& /* mat │ │ │ │ │ +*/, const ParameterTree& config){ │ │ │ │ │ +788 using D = typename Dune::TypeListElement<1, decltype(tl)>::type; │ │ │ │ │ +789 using R = typename Dune::TypeListElement<2, decltype(tl)>::type; │ │ │ │ │ +790 return std::make_shared>(config); │ │ │ │ │ +791 }); │ │ │ │ │ +792 │ │ │ │ │ +793 │ │ │ │ │ +804 template< class M, class X, class Y > │ │ │ │ │ +_8_0_5 class _S_e_q_I_L_D_L │ │ │ │ │ +806 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ │ +807 { │ │ │ │ │ +808 typedef _S_e_q_I_L_D_L_<_ _M_,_ _X_,_ _Y_ _> _T_h_i_s; │ │ │ │ │ +809 typedef _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_ _> _B_a_s_e; │ │ │ │ │ +810 │ │ │ │ │ +811 public: │ │ │ │ │ +_8_1_3 typedef std::remove_const_t< M > _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_8_1_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_8_1_7 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_8_1_9 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_8_2_1 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_8_2_3 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ +824 │ │ │ │ │ +_8_3_7 _S_e_q_I_L_D_L (const std::shared_ptr>& A, │ │ │ │ │ +const ParameterTree& configuration) │ │ │ │ │ +838 : _S_e_q_I_L_D_L(A->getmat(), configuration) │ │ │ │ │ +839 {} │ │ │ │ │ +840 │ │ │ │ │ +_8_5_3 _S_e_q_I_L_D_L(const _m_a_t_r_i_x___t_y_p_e& A, const ParameterTree& config) │ │ │ │ │ +854 : _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)) │ │ │ │ │ +855 {} │ │ │ │ │ +856 │ │ │ │ │ +_8_6_5 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 ) ) │ │ │ │ │ +866 : decomposition_( A.N(), A.M(), _m_a_t_r_i_x___t_y_p_e::random ), │ │ │ │ │ +867 relax_( relax ) │ │ │ │ │ +868 { │ │ │ │ │ +869 // setup row sizes for lower triangular matrix │ │ │ │ │ +870 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ │ +871 { │ │ │ │ │ +872 const auto &A_i = *i; │ │ │ │ │ +873 const auto ij = A_i.find( i.index() ); │ │ │ │ │ +874 if( ij != A_i.end() ) │ │ │ │ │ +875 decomposition_.setrowsize( i.index(), ij.offset()+1 ); │ │ │ │ │ +876 else │ │ │ │ │ +877 DUNE_THROW( _I_S_T_L_E_r_r_o_r, "diagonal entry missing" ); │ │ │ │ │ +878 } │ │ │ │ │ +879 decomposition_.endrowsizes(); │ │ │ │ │ +880 │ │ │ │ │ +881 // setup row indices for lower triangular matrix │ │ │ │ │ +882 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ │ +883 { │ │ │ │ │ +884 const auto &A_i = *i; │ │ │ │ │ +885 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij ) │ │ │ │ │ +886 decomposition_.addindex( i.index(), ij.index() ); │ │ │ │ │ +887 decomposition_.addindex( i.index(), i.index() ); │ │ │ │ │ +888 } │ │ │ │ │ +889 decomposition_.endindices(); │ │ │ │ │ +890 │ │ │ │ │ +891 // copy values of lower triangular matrix │ │ │ │ │ +892 auto i = A.begin(); │ │ │ │ │ +893 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row │ │ │ │ │ +!= rowend; ++row, ++i ) │ │ │ │ │ +894 { │ │ │ │ │ +895 auto ij = i->begin(); │ │ │ │ │ +896 for( auto _c_o_l = row->begin(), colend = row->end(); _c_o_l != colend; ++_c_o_l, │ │ │ │ │ +++ij ) │ │ │ │ │ +897 *_c_o_l = *ij; │ │ │ │ │ +898 } │ │ │ │ │ +899 │ │ │ │ │ +900 // perform ILDL decomposition │ │ │ │ │ +901 _b_i_l_d_l___d_e_c_o_m_p_o_s_e( decomposition_ ); │ │ │ │ │ +902 } │ │ │ │ │ +903 │ │ │ │ │ +_9_0_5 void _p_r_e ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override │ │ │ │ │ +906 {} │ │ │ │ │ +907 │ │ │ │ │ +_9_0_9 void _a_p_p_l_y ( X &v, const Y &d ) override │ │ │ │ │ +910 { │ │ │ │ │ +911 _b_i_l_d_l___b_a_c_k_s_o_l_v_e( decomposition_, v, d, true ); │ │ │ │ │ +912 v *= relax_; │ │ │ │ │ +913 } │ │ │ │ │ +914 │ │ │ │ │ +_9_1_6 void _p_o_s_t ([[maybe_unused]] X &x) override │ │ │ │ │ +917 {} │ │ │ │ │ +918 │ │ │ │ │ +_9_2_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 { 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; } │ │ │ │ │ +921 │ │ │ │ │ +922 private: │ │ │ │ │ +923 _m_a_t_r_i_x___t_y_p_e decomposition_; │ │ │ │ │ +924 _r_e_a_l___f_i_e_l_d___t_y_p_e relax_; │ │ │ │ │ +925 }; │ │ │ │ │ +_9_2_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("ildl", defaultPreconditionerCreator()); │ │ │ │ │ +927 │ │ │ │ │ +930} // end namespace │ │ │ │ │ +931 │ │ │ │ │ +932 │ │ │ │ │ +933#endif │ │ │ │ │ +_g_s_e_t_c_._h_h │ │ │ │ │ +Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ +generic way. │ │ │ │ │ +_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h │ │ │ │ │ _i_l_u_._h_h │ │ │ │ │ The incomplete LU factorization kernels. │ │ │ │ │ +_i_l_d_l_._h_h │ │ │ │ │ +Incomplete LDL decomposition. │ │ │ │ │ +_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 │ │ │ │ │ +_s_o_l_v_e_r_._h_h │ │ │ │ │ +Define general, extensible interface for inverse operators. │ │ │ │ │ +_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h │ │ │ │ │ +_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R │ │ │ │ │ +#define DUNE_REGISTER_PRECONDITIONER(name,...) │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ │ +_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_D_u_n_e_:_:_b_s_o_r_b │ │ │ │ │ +void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +SSOR step. │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:646 │ │ │ │ │ +_D_u_n_e_:_:_d_b_j_a_c │ │ │ │ │ +void dbjac(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +Jacobi step. │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:658 │ │ │ │ │ +_D_u_n_e_:_:_b_s_o_r_f │ │ │ │ │ +void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +SOR step. │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:634 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ _D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e │ │ │ │ │ void bildl_decompose(Matrix &A) │ │ │ │ │ compute ILDL decomposition of a symmetric matrix A │ │ │ │ │ DDeeffiinniittiioonn ildl.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ │ +PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ +VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ +Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ _D_u_n_e_:_:_b_i_l_d_l___b_a_c_k_s_o_l_v_e │ │ │ │ │ void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool │ │ │ │ │ isLowerTriangular=false) │ │ │ │ │ DDeeffiinniittiioonn ildl.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T │ │ │ │ │ -static void bildl_subtractBCT(const FieldMatrix< K, m, n > &B, const │ │ │ │ │ -FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A) │ │ │ │ │ -DDeeffiinniittiioonn ildl.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S │ │ │ │ │ +void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv) │ │ │ │ │ +convert ILU decomposition into CRS format for lower and upper triangular and │ │ │ │ │ +inverse. │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:307 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ │ +void blockILUBacksolve(const M &A, X &v, const Y &d) │ │ │ │ │ +LU backsolve with stored inverse. │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ +void blockILU0Decomposition(M &A) │ │ │ │ │ +compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ +void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_B_L │ │ │ │ │ +compile-time parameter for block recursion depth │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S │ │ │ │ │ +a simple compressed row storage matrix class │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:259 │ │ │ │ │ _D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ derive error class from the base class in common │ │ │ │ │ DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r │ │ │ │ │ -Error when performing an operation on a matrix block. │ │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -RowIterator beforeBegin() │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:634 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -RowIterator beforeEnd() │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:627 │ │ │ │ │ -_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:620 │ │ │ │ │ -_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:614 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M │ │ │ │ │ +size_type M() const │ │ │ │ │ +Return the number of columns. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:700 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ +size_type N() const │ │ │ │ │ +Return the number of rows. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ +_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:109 │ │ │ │ │ +_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:32 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +Turns an InverseOperator into a Preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:75 │ │ │ │ │ +_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:80 │ │ │ │ │ +_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:78 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_o_s_t │ │ │ │ │ +virtual void post(domain_type &) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:111 │ │ │ │ │ +_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:82 │ │ │ │ │ +_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:86 │ │ │ │ │ +_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:84 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_r_e │ │ │ │ │ +virtual void pre(domain_type &, range_type &) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:101 │ │ │ │ │ +_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:94 │ │ │ │ │ +_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:88 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(domain_type &v, const range_type &d) │ │ │ │ │ +Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R │ │ │ │ │ +Sequential SSOR preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:229 │ │ │ │ │ +_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:182 │ │ │ │ │ +_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:199 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:233 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ │ +Simd::Scalar< field_type > scalar_field_type │ │ │ │ │ +scalar type underlying the field_type │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:152 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:146 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +The matrix type the preconditioner is for. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:144 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const Y &d) │ │ │ │ │ +Apply the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, Y &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:208 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:148 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ │ +real scalar type underlying the field_type │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:154 │ │ │ │ │ +_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:163 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R │ │ │ │ │ +Sequential SOR preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:261 │ │ │ │ │ +_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:302 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +The matrix type the preconditioner is for. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:264 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ │ +FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ │ +real scalar type underlying the field_type │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:274 │ │ │ │ │ +_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:350 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:266 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:367 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, Y &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ │ +Simd::Scalar< field_type > scalar_field_type │ │ │ │ │ +scalar type underlying the field_type │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:272 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:371 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const Y &d) │ │ │ │ │ +Apply the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:336 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:268 │ │ │ │ │ +_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:319 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:270 │ │ │ │ │ +_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:283 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_J_a_c │ │ │ │ │ +The sequential jacobian preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:412 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_J_a_c_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:499 │ │ │ │ │ +_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:470 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_J_a_c_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const Y &d) │ │ │ │ │ +Apply the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:487 │ │ │ │ │ +_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:415 │ │ │ │ │ +_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:423 │ │ │ │ │ +_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:453 │ │ │ │ │ +_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:421 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_J_a_c_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, Y &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:479 │ │ │ │ │ +_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:417 │ │ │ │ │ +_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:425 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_J_a_c_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:503 │ │ │ │ │ +_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:434 │ │ │ │ │ +_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:419 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_U │ │ │ │ │ +Sequential ILU preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:532 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_U_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:678 │ │ │ │ │ +_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:612 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_U_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, Y &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:648 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_U_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const Y &d) │ │ │ │ │ +Apply the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:656 │ │ │ │ │ +_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:552 │ │ │ │ │ +_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:541 │ │ │ │ │ +_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:692 │ │ │ │ │ +_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:699 │ │ │ │ │ +_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:598 │ │ │ │ │ +_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:535 │ │ │ │ │ +_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:537 │ │ │ │ │ +_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:549 │ │ │ │ │ +_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:544 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_U_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:682 │ │ │ │ │ +_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:561 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_U_:_:_w__ │ │ │ │ │ +const real_field_type w_ │ │ │ │ │ +The relaxation factor to use. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:697 │ │ │ │ │ +_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:580 │ │ │ │ │ +_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:539 │ │ │ │ │ +_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:694 │ │ │ │ │ +_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:547 │ │ │ │ │ +_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:689 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_U_:_:_u_p_p_e_r__ │ │ │ │ │ +CRS upper_ │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:693 │ │ │ │ │ +_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n │ │ │ │ │ +Richardson preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:713 │ │ │ │ │ +_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:720 │ │ │ │ │ +_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:778 │ │ │ │ │ +_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:718 │ │ │ │ │ +_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, Y &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:755 │ │ │ │ │ +_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:731 │ │ │ │ │ +_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:774 │ │ │ │ │ +_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:724 │ │ │ │ │ +_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:722 │ │ │ │ │ +_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:746 │ │ │ │ │ +_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:716 │ │ │ │ │ +_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const Y &d) │ │ │ │ │ +Apply the precondioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:763 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_I_L_D_L │ │ │ │ │ +sequential ILDL preconditioner │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:807 │ │ │ │ │ +_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:853 │ │ │ │ │ +_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:865 │ │ │ │ │ +_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:815 │ │ │ │ │ +_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:916 │ │ │ │ │ +_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:817 │ │ │ │ │ +_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:813 │ │ │ │ │ +_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:909 │ │ │ │ │ +_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:823 │ │ │ │ │ +_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:837 │ │ │ │ │ +_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:905 │ │ │ │ │ +_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:821 │ │ │ │ │ +_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:819 │ │ │ │ │ +_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:920 │ │ │ │ │ +_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:48 │ │ │ │ │ +_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:99 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: owneroverlapcopy.hh File Reference │ │ │ │ +dune-istl: superlufunctions.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,90 +70,37 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Macros
│ │ │ │ +
superlufunctions.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#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>
│ │ │ │ +
#include "supermatrix.h"
│ │ │ │ +#include "slu_util.h"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

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 communcation More...
 
struct  Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::AddGatherScatter< T >
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Namespaces

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

│ │ │ │ -Functions

template<int dim, template< class, class > class Comm>
void testRedistributed (int s)
 

│ │ │ │ +Macros

#define int_t   SUPERLU_INT_TYPE
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Classes providing communication interfaces for overlapping Schwarz methods.

│ │ │ │ -
Author
Peter Bastian
│ │ │ │ -

Function Documentation

│ │ │ │ - │ │ │ │ -

◆ testRedistributed()

│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ int_t

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
│ │ │ │ -template<int dim, template< class, class > class Comm>
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │
void testRedistributed (int s)#define int_t   SUPERLU_INT_TYPE
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,65 +1,19 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -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 "cmath" │ │ │ │ │ -#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> │ │ │ │ │ +_M_a_c_r_o_s │ │ │ │ │ +superlufunctions.hh File Reference │ │ │ │ │ +#include "supermatrix.h" │ │ │ │ │ +#include "slu_util.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_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_._._. │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _i_n_t___t   SUPERLU_INT_TYPE │ │ │ │ │   │ │ │ │ │ - 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 communcation _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 │ │ │ │ │ -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 ********** │ │ │ │ │ -Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ │ - Author │ │ │ │ │ - Peter Bastian │ │ │ │ │ -********** FFuunnccttiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? tteessttRReeddiissttrriibbuutteedd(()) ********** │ │ │ │ │ -template class Comm> │ │ │ │ │ -void testRedistributed ( int  ss ) │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? iinntt__tt ********** │ │ │ │ │ +#define int_t   SUPERLU_INT_TYPE │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: owneroverlapcopy.hh Source File │ │ │ │ +dune-istl: superlufunctions.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,712 +74,130 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
owneroverlapcopy.hh
│ │ │ │ +
superlufunctions.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_OWNEROVERLAPCOPY_HH
│ │ │ │ -
6#define DUNE_ISTL_OWNEROVERLAPCOPY_HH
│ │ │ │ -
7
│ │ │ │ -
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
│ │ │ │ +
5#ifndef DUNE_ISTL_SUPERLUFUNCTIONS_HH
│ │ │ │ +
6#define DUNE_ISTL_SUPERLUFUNCTIONS_HH
│ │ │ │ +
7#if HAVE_SUPERLU
│ │ │ │ +
8
│ │ │ │ +
9
│ │ │ │ +
10#define int_t SUPERLU_INT_TYPE
│ │ │ │ +
11#include "supermatrix.h"
│ │ │ │ +
12#include "slu_util.h"
│ │ │ │ +
13#undef int_t
│ │ │ │ +
14
│ │ │ │ +
15#if __has_include("slu_sdefs.h")
│ │ │ │ +
16extern "C" {
│ │ │ │ +
17 extern void
│ │ │ │ +
18 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ +
19 char *, float *, float *, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
20 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
21 float *, float *, float *, float *,
│ │ │ │ +
22 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ +
23
│ │ │ │ +
24 extern void
│ │ │ │ +
25 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int,
│ │ │ │ +
26 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
27 extern void
│ │ │ │ +
28 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *,
│ │ │ │ +
29 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
30 extern int sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │
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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
59 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
62 };
│ │ │ │ -
│ │ │ │ -
63 };
│ │ │ │ -
│ │ │ │ -
64
│ │ │ │ -
76 template <class G, class L>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
78 {
│ │ │ │ -
79 public:
│ │ │ │ -
81 typedef G GlobalIdType;
│ │ │ │ -
82
│ │ │ │ -
84 typedef L LocalIdType;
│ │ │ │ +
32 extern void sPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ +
33}
│ │ │ │ +
34#endif
│ │ │ │ +
35
│ │ │ │ +
36#if __has_include("slu_ddefs.h")
│ │ │ │ +
37extern "C" {
│ │ │ │ +
38 extern void
│ │ │ │ +
39 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ +
40 char *, double *, double *, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
41 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
42 double *, double *, double *, double *,
│ │ │ │ +
43 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ +
44
│ │ │ │ +
45 extern void
│ │ │ │ +
46 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
│ │ │ │ +
47 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
48
│ │ │ │ +
49 extern void
│ │ │ │ +
50 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
│ │ │ │ +
51 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
52
│ │ │ │ +
53 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │ +
54
│ │ │ │ +
55 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ +
56}
│ │ │ │ +
57#endif
│ │ │ │ +
58
│ │ │ │ +
59#if __has_include("slu_cdefs.h")
│ │ │ │ +
60#include "slu_scomplex.h"
│ │ │ │ +
61
│ │ │ │ +
62extern "C" {
│ │ │ │ +
63 extern void
│ │ │ │ +
64 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ +
65 char *, float *, float *, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
66 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
67 float *, float *, float *, float *,
│ │ │ │ +
68 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ +
69
│ │ │ │ +
70
│ │ │ │ +
71 extern void
│ │ │ │ +
72 cCreate_Dense_Matrix(SuperMatrix *, int, int, ::complex *, int,
│ │ │ │ +
73 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
74
│ │ │ │ +
75
│ │ │ │ +
76 extern void
│ │ │ │ +
77 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, ::complex *,
│ │ │ │ +
78 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
79
│ │ │ │ +
80 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │ +
81
│ │ │ │ +
82 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ +
83}
│ │ │ │ +
84#endif
│ │ │ │
85
│ │ │ │ -
92 typedef std::tuple<GlobalIdType,LocalIdType,int> IndexTripel;
│ │ │ │ -
99 typedef std::tuple<int,GlobalIdType,int> RemoteIndexTripel;
│ │ │ │ +
86#if __has_include("slu_zdefs.h")
│ │ │ │ +
87#include "slu_dcomplex.h"
│ │ │ │ +
88extern "C" {
│ │ │ │ +
89 extern void
│ │ │ │ +
90 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ +
91 char *, double *, double *, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
92 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ +
93 double *, double *, double *, double *,
│ │ │ │ +
94 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ +
95
│ │ │ │ +
96
│ │ │ │ +
97 extern void
│ │ │ │ +
98 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
│ │ │ │ +
99 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │
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
│ │ │ │ -
164#if HAVE_MPI
│ │ │ │ -
165
│ │ │ │ -
172 template <class GlobalIdType, class LocalIdType=int>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
174 {
│ │ │ │ -
175 template<typename M, typename G, typename L>
│ │ │ │ -
176 friend void loadMatrixMarket(M&,
│ │ │ │ -
177 const std::string&,
│ │ │ │ - │ │ │ │ -
179 bool);
│ │ │ │ -
180 // used types
│ │ │ │ - │ │ │ │ - │ │ │ │ -
183 typedef typename std::set<IndexTripel>::const_iterator localindex_iterator;
│ │ │ │ -
184 typedef typename std::set<RemoteIndexTripel>::const_iterator remoteindex_iterator;
│ │ │ │ - │ │ │ │ -
186 typedef Dune::ParallelLocalIndex<AttributeSet> LI;
│ │ │ │ -
187 public:
│ │ │ │ -
188 typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> PIS;
│ │ │ │ -
189 typedef Dune::RemoteIndices<PIS> RI;
│ │ │ │ -
190 typedef Dune::RemoteIndexListModifier<PIS,typename RI::Allocator,false> RILM;
│ │ │ │ -
191 typedef typename RI::RemoteIndex RX;
│ │ │ │ -
192 typedef Dune::BufferedCommunicator BC;
│ │ │ │ -
193 typedef Dune::Interface IF;
│ │ │ │ -
194 typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner> OwnerSet;
│ │ │ │ -
195 typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopySet;
│ │ │ │ -
196 typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> OwnerOverlapSet;
│ │ │ │ -
197 typedef Dune::AllSet<AttributeSet> AllSet;
│ │ │ │ -
198 protected:
│ │ │ │ -
199
│ │ │ │ -
200
│ │ │ │ -
202 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
204 {
│ │ │ │ -
205 typedef typename CommPolicy<T>::IndexedType V;
│ │ │ │ -
206
│ │ │ │ -
│ │ │ │ -
207 static V gather(const T& a, std::size_t i)
│ │ │ │ -
208 {
│ │ │ │ -
209 return a[i];
│ │ │ │ -
210 }
│ │ │ │ -
│ │ │ │ -
211
│ │ │ │ -
│ │ │ │ -
212 static void scatter(T& a, V v, std::size_t i)
│ │ │ │ -
213 {
│ │ │ │ -
214 a[i] = v;
│ │ │ │ -
215 }
│ │ │ │ -
│ │ │ │ -
216 };
│ │ │ │ -
│ │ │ │ -
217 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
219 {
│ │ │ │ -
220 typedef typename CommPolicy<T>::IndexedType V;
│ │ │ │ -
221
│ │ │ │ -
│ │ │ │ -
222 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==true)
│ │ │ │ -
660 if(comm!=MPI_COMM_NULL)
│ │ │ │ -
661 {
│ │ │ │ -
662#ifdef MPI_2
│ │ │ │ -
663 // If it is possible to query whether MPI_Finalize
│ │ │ │ -
664 // was called, only free the communicator before
│ │ │ │ -
665 // calling MPI_Finalize.
│ │ │ │ -
666 int wasFinalized = 0;
│ │ │ │ -
667 MPI_Finalized( &wasFinalized );
│ │ │ │ -
668 if(!wasFinalized)
│ │ │ │ -
669#endif
│ │ │ │ -
670 MPI_Comm_free(&comm);
│ │ │ │ -
671 }
│ │ │ │ -
672 }
│ │ │ │ -
│ │ │ │ -
673
│ │ │ │ -
674 private:
│ │ │ │ - │ │ │ │ -
676 {}
│ │ │ │ -
677 MPI_Comm comm;
│ │ │ │ -
678 Communication<MPI_Comm> cc;
│ │ │ │ -
679 PIS pis;
│ │ │ │ -
680 RI ri;
│ │ │ │ -
681 mutable IF OwnerToAllInterface;
│ │ │ │ -
682 mutable bool OwnerToAllInterfaceBuilt;
│ │ │ │ -
683 mutable IF OwnerOverlapToAllInterface;
│ │ │ │ -
684 mutable bool OwnerOverlapToAllInterfaceBuilt;
│ │ │ │ -
685 mutable IF OwnerCopyToAllInterface;
│ │ │ │ -
686 mutable bool OwnerCopyToAllInterfaceBuilt;
│ │ │ │ -
687 mutable IF OwnerCopyToOwnerCopyInterface;
│ │ │ │ -
688 mutable bool OwnerCopyToOwnerCopyInterfaceBuilt;
│ │ │ │ -
689 mutable IF CopyToAllInterface;
│ │ │ │ -
690 mutable bool CopyToAllInterfaceBuilt;
│ │ │ │ -
691 mutable std::vector<double> mask;
│ │ │ │ -
692 int oldseqNo;
│ │ │ │ -
693 GlobalLookupIndexSet* globalLookup_;
│ │ │ │ -
694 const SolverCategory::Category category_;
│ │ │ │ -
695 bool freecomm;
│ │ │ │ -
696 };
│ │ │ │ -
│ │ │ │ -
697
│ │ │ │ -
698#endif
│ │ │ │ -
699
│ │ │ │ -
700
│ │ │ │ -
703} // end namespace
│ │ │ │ -
704
│ │ │ │ -
705#endif
│ │ │ │ -
void testRedistributed(int s)
│ │ │ │ - │ │ │ │ -
Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
│ │ │ │ - │ │ │ │ -
Definition allocator.hh:11
│ │ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
Attribute set for overlapping Schwarz.
Definition owneroverlapcopy.hh:59
│ │ │ │ -
AttributeSet
Definition owneroverlapcopy.hh:60
│ │ │ │ -
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ │ -
@ copy
Definition owneroverlapcopy.hh:61
│ │ │ │ -
@ overlap
Definition owneroverlapcopy.hh:61
│ │ │ │ -
Information about the index distribution.
Definition owneroverlapcopy.hh:78
│ │ │ │ -
std::tuple< GlobalIdType, LocalIdType, int > IndexTripel
A triple describing a local index.
Definition owneroverlapcopy.hh:92
│ │ │ │ -
void addRemoteIndex(const RemoteIndexTripel &x)
Add a new remote index triple to the set of remote indices.
Definition owneroverlapcopy.hh:120
│ │ │ │ -
G GlobalIdType
The type of the global index.
Definition owneroverlapcopy.hh:81
│ │ │ │ -
const std::set< IndexTripel > & localIndices() const
Get the set of indices local to the process.
Definition owneroverlapcopy.hh:133
│ │ │ │ -
const std::set< RemoteIndexTripel > & remoteIndices() const
Get the set of remote indices.
Definition owneroverlapcopy.hh:142
│ │ │ │ -
L LocalIdType
The type of the local index.
Definition owneroverlapcopy.hh:84
│ │ │ │ -
void clear()
Remove all indices from the sets.
Definition owneroverlapcopy.hh:150
│ │ │ │ -
void addLocalIndex(const IndexTripel &x)
Add a new index triple to the set of local indices.
Definition owneroverlapcopy.hh:106
│ │ │ │ -
std::tuple< int, GlobalIdType, int > RemoteIndexTripel
A triple describing a remote index.
Definition owneroverlapcopy.hh:99
│ │ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ -
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet
Definition owneroverlapcopy.hh:195
│ │ │ │ -
const GlobalLookupIndexSet & globalLookup() const
Definition owneroverlapcopy.hh:526
│ │ │ │ -
FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const
Compute the global Euclidean norm of a vector.
Definition owneroverlapcopy.hh:425
│ │ │ │ -
void buildOwnerOverlapToAllInterface() const
Definition owneroverlapcopy.hh:233
│ │ │ │ -
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS
Definition owneroverlapcopy.hh:188
│ │ │ │ -
void buildOwnerCopyToAllInterface() const
Definition owneroverlapcopy.hh:254
│ │ │ │ -
void buildOwnerCopyToOwnerCopyInterface() const
Definition owneroverlapcopy.hh:266
│ │ │ │ -
OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Constructor.
Definition owneroverlapcopy.hh:586
│ │ │ │ -
SolverCategory::Category category() const
Get Solver Category.
Definition owneroverlapcopy.hh:295
│ │ │ │ -
void addOwnerCopyToOwnerCopy(const T &source, T &dest) const
Communicate values from owner and copy data points to owner and copy data points and add them to thos...
Definition owneroverlapcopy.hh:379
│ │ │ │ -
void buildCopyToAllInterface() const
Definition owneroverlapcopy.hh:279
│ │ │ │ -
Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags
Definition owneroverlapcopy.hh:446
│ │ │ │ -
RemoteIndices & remoteIndices()
Get the underlying remote indices.
Definition owneroverlapcopy.hh:490
│ │ │ │ -
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:462
│ │ │ │ -
Dune::RemoteIndices< PIS > RI
Definition owneroverlapcopy.hh:189
│ │ │ │ -
void buildGlobalLookup(std::size_t size)
Definition owneroverlapcopy.hh:508
│ │ │ │ -
void addOwnerOverlapToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points and add them to those values.
Definition owneroverlapcopy.hh:345
│ │ │ │ -
Dune::RemoteIndices< PIS > RemoteIndices
The type of the remote indices.
Definition owneroverlapcopy.hh:452
│ │ │ │ -
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition owneroverlapcopy.hh:538
│ │ │ │ -
Dune::AllSet< AttributeSet > AllSet
Definition owneroverlapcopy.hh:197
│ │ │ │ -
Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > OwnerOverlapSet
Definition owneroverlapcopy.hh:196
│ │ │ │ -
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ │ -
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ │ -
Dune::Interface IF
Definition owneroverlapcopy.hh:193
│ │ │ │ -
~OwnerOverlapCopyCommunication()
Definition owneroverlapcopy.hh:650
│ │ │ │ -
void buildGlobalLookup()
Definition owneroverlapcopy.hh:495
│ │ │ │ -
Dune::BufferedCommunicator BC
Definition owneroverlapcopy.hh:192
│ │ │ │ -
OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Construct the communication without any indices.
Definition owneroverlapcopy.hh:554
│ │ │ │ -
ParallelIndexSet & indexSet()
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:480
│ │ │ │ -
void dot(const T1 &x, const T1 &y, T2 &result) const
Compute a global dot product of two vectors.
Definition owneroverlapcopy.hh:398
│ │ │ │ -
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ │ -
OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory::overlapping)
Construct the communication without any indices using MPI_COMM_WORLD.
Definition owneroverlapcopy.hh:572
│ │ │ │ -
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet
Definition owneroverlapcopy.hh:194
│ │ │ │ -
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ -
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ │ -
friend void loadMatrixMarket(M &, const std::string &, OwnerOverlapCopyCommunication< G, L > &, bool)
Load a parallel matrix/vector stored in matrix market format.
Definition matrixmarket.hh:1269
│ │ │ │ -
RI::RemoteIndex RX
Definition owneroverlapcopy.hh:191
│ │ │ │ -
void addOwnerCopyToAll(const T &source, T &dest) const
Communicate values from owner and copy data points to all other data points and add them to those val...
Definition owneroverlapcopy.hh:362
│ │ │ │ -
void freeGlobalLookup()
Definition owneroverlapcopy.hh:520
│ │ │ │ -
Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM
Definition owneroverlapcopy.hh:190
│ │ │ │ -
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ │ -
void buildOwnerToAllInterface() const
Definition owneroverlapcopy.hh:244
│ │ │ │ -
gather/scatter callback for communcation
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
│ │ │ │ -
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │ │ +
101 extern void
│ │ │ │ +
102 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int,
│ │ │ │ +
103 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
104
│ │ │ │ +
105 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │ +
106
│ │ │ │ +
107 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ +
108}
│ │ │ │ +
109#endif
│ │ │ │ +
110
│ │ │ │ +
111
│ │ │ │ +
112#endif
│ │ │ │ +
113#endif
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,839 +1,124 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -owneroverlapcopy.hh │ │ │ │ │ +superlufunctions.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 (C) 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_OWNEROVERLAPCOPY_HH │ │ │ │ │ -6#define DUNE_ISTL_OWNEROVERLAPCOPY_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include "cmath" │ │ │ │ │ -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 │ │ │ │ │ +5#ifndef DUNE_ISTL_SUPERLUFUNCTIONS_HH │ │ │ │ │ +6#define DUNE_ISTL_SUPERLUFUNCTIONS_HH │ │ │ │ │ +7#if HAVE_SUPERLU │ │ │ │ │ +8 │ │ │ │ │ +9 │ │ │ │ │ +_1_0#define int_t SUPERLU_INT_TYPE │ │ │ │ │ +11#include "supermatrix.h" │ │ │ │ │ +12#include "slu_util.h" │ │ │ │ │ +13#undef int_t │ │ │ │ │ +14 │ │ │ │ │ +15#if __has_include("slu_sdefs.h") │ │ │ │ │ +16extern "C" { │ │ │ │ │ +17 extern void │ │ │ │ │ +18 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ +19 char *, float *, float *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +20 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +21 float *, float *, float *, float *, │ │ │ │ │ +22 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ +23 │ │ │ │ │ +24 extern void │ │ │ │ │ +25 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int, │ │ │ │ │ +26 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +27 extern void │ │ │ │ │ +28 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *, │ │ │ │ │ +29 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +30 extern int sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ 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 │ │ │ │ │ -41namespace _D_u_n_e { │ │ │ │ │ -42 │ │ │ │ │ -_5_8 struct _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ -59 { │ │ │ │ │ -_6_0 enum _A_t_t_r_i_b_u_t_e_S_e_t { │ │ │ │ │ -_6_1 _o_w_n_e_r=1, _o_v_e_r_l_a_p=2, _c_o_p_y=3 │ │ │ │ │ -_6_2 }; │ │ │ │ │ -63 }; │ │ │ │ │ -64 │ │ │ │ │ -76 template │ │ │ │ │ -_7_7 class _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d │ │ │ │ │ -78 { │ │ │ │ │ -79 public: │ │ │ │ │ -_8_1 typedef G _G_l_o_b_a_l_I_d_T_y_p_e; │ │ │ │ │ -82 │ │ │ │ │ -_8_4 typedef L _L_o_c_a_l_I_d_T_y_p_e; │ │ │ │ │ +32 extern void sPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ +33} │ │ │ │ │ +34#endif │ │ │ │ │ +35 │ │ │ │ │ +36#if __has_include("slu_ddefs.h") │ │ │ │ │ +37extern "C" { │ │ │ │ │ +38 extern void │ │ │ │ │ +39 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ +40 char *, double *, double *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +41 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +42 double *, double *, double *, double *, │ │ │ │ │ +43 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ +44 │ │ │ │ │ +45 extern void │ │ │ │ │ +46 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *, │ │ │ │ │ +47 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +48 │ │ │ │ │ +49 extern void │ │ │ │ │ +50 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int, │ │ │ │ │ +51 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +52 │ │ │ │ │ +53 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ +54 │ │ │ │ │ +55 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ +56} │ │ │ │ │ +57#endif │ │ │ │ │ +58 │ │ │ │ │ +59#if __has_include("slu_cdefs.h") │ │ │ │ │ +60#include "slu_scomplex.h" │ │ │ │ │ +61 │ │ │ │ │ +62extern "C" { │ │ │ │ │ +63 extern void │ │ │ │ │ +64 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ +65 char *, float *, float *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +66 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +67 float *, float *, float *, float *, │ │ │ │ │ +68 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ +69 │ │ │ │ │ +70 │ │ │ │ │ +71 extern void │ │ │ │ │ +72 cCreate_Dense_Matrix(SuperMatrix *, int, int, ::complex *, int, │ │ │ │ │ +73 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +74 │ │ │ │ │ +75 │ │ │ │ │ +76 extern void │ │ │ │ │ +77 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, ::complex *, │ │ │ │ │ +78 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +79 │ │ │ │ │ +80 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ +81 │ │ │ │ │ +82 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ +83} │ │ │ │ │ +84#endif │ │ │ │ │ 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; │ │ │ │ │ +86#if __has_include("slu_zdefs.h") │ │ │ │ │ +87#include "slu_dcomplex.h" │ │ │ │ │ +88extern "C" { │ │ │ │ │ +89 extern void │ │ │ │ │ +90 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ +91 char *, double *, double *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +92 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ +93 double *, double *, double *, double *, │ │ │ │ │ +94 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ +95 │ │ │ │ │ +96 │ │ │ │ │ +97 extern void │ │ │ │ │ +98 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *, │ │ │ │ │ +99 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ 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 │ │ │ │ │ -164#if HAVE_MPI │ │ │ │ │ -165 │ │ │ │ │ -172 template │ │ │ │ │ -_1_7_3 class _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -174 { │ │ │ │ │ -175 template │ │ │ │ │ -176 friend void _l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t(M&, │ │ │ │ │ -177 const std::string&, │ │ │ │ │ -178 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_G_,_L_>&, │ │ │ │ │ -179 bool); │ │ │ │ │ -180 // used types │ │ │ │ │ -181 typedef typename _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_G_l_o_b_a_l_I_d_T_y_p_e_,_L_o_c_a_l_I_d_T_y_p_e_>_:_:_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ │ -IndexTripel; │ │ │ │ │ -182 typedef typename _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_G_l_o_b_a_l_I_d_T_y_p_e_,_L_o_c_a_l_I_d_T_y_p_e_>_:_: │ │ │ │ │ -_R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l RemoteIndexTripel; │ │ │ │ │ -183 typedef typename std::set::const_iterator localindex_iterator; │ │ │ │ │ -184 typedef typename std::set::const_iterator │ │ │ │ │ -remoteindex_iterator; │ │ │ │ │ -185 typedef typename _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_A_t_t_r_i_b_u_t_e_S_e_t _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ -186 typedef Dune::ParallelLocalIndex LI; │ │ │ │ │ -187 public: │ │ │ │ │ -_1_8_8 typedef Dune::ParallelIndexSet _P_I_S; │ │ │ │ │ -_1_8_9 typedef Dune::RemoteIndices _R_I; │ │ │ │ │ -_1_9_0 typedef Dune::RemoteIndexListModifier │ │ │ │ │ -_R_I_L_M; │ │ │ │ │ -_1_9_1 typedef typename RI::RemoteIndex _R_X; │ │ │ │ │ -_1_9_2 typedef Dune::BufferedCommunicator _B_C; │ │ │ │ │ -_1_9_3 typedef Dune::Interface _I_F; │ │ │ │ │ -_1_9_4 typedef EnumItem │ │ │ │ │ -_O_w_n_e_r_S_e_t; │ │ │ │ │ -_1_9_5 typedef EnumItem _C_o_p_y_S_e_t; │ │ │ │ │ -_1_9_6 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> _O_w_n_e_r_O_v_e_r_l_a_p_S_e_t; │ │ │ │ │ -_1_9_7 typedef Dune::AllSet _A_l_l_S_e_t; │ │ │ │ │ -198 protected: │ │ │ │ │ -199 │ │ │ │ │ -200 │ │ │ │ │ -202 template │ │ │ │ │ -_2_0_3 struct _C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -204 { │ │ │ │ │ -_2_0_5 typedef typename CommPolicy::IndexedType _V; │ │ │ │ │ -206 │ │ │ │ │ -_2_0_7 static _V _g_a_t_h_e_r(const T& a, std::size_t i) │ │ │ │ │ -208 { │ │ │ │ │ -209 return a[i]; │ │ │ │ │ -210 } │ │ │ │ │ -211 │ │ │ │ │ -_2_1_2 static void _s_c_a_t_t_e_r(T& a, _V v, std::size_t i) │ │ │ │ │ -213 { │ │ │ │ │ -214 a[i] = v; │ │ │ │ │ -215 } │ │ │ │ │ -216 }; │ │ │ │ │ -217 template │ │ │ │ │ -_2_1_8 struct _A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -219 { │ │ │ │ │ -_2_2_0 typedef typename CommPolicy::IndexedType _V; │ │ │ │ │ -221 │ │ │ │ │ -_2_2_2 static _V _g_a_t_h_e_r(const T& a, std::size_t i) │ │ │ │ │ -223 { │ │ │ │ │ -224 return a[i]; │ │ │ │ │ -225 } │ │ │ │ │ -226 │ │ │ │ │ -_2_2_7 static void _s_c_a_t_t_e_r(T& a, _V v, std::size_t i) │ │ │ │ │ -228 { │ │ │ │ │ -229 a[i] += v; │ │ │ │ │ -230 } │ │ │ │ │ -231 }; │ │ │ │ │ -232 │ │ │ │ │ -_2_3_3 void _b_u_i_l_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ -234 { │ │ │ │ │ -235 if (OwnerOverlapToAllInterfaceBuilt) │ │ │ │ │ -236 OwnerOverlapToAllInterface.free(); │ │ │ │ │ -237 _O_w_n_e_r_O_v_e_r_l_a_p_S_e_t sourceFlags; │ │ │ │ │ -238 │ │ │ │ │ -Combine,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ │ -239 destFlags; │ │ │ │ │ -240 OwnerOverlapToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ -241 OwnerOverlapToAllInterfaceBuilt = true; │ │ │ │ │ -242 } │ │ │ │ │ -243 │ │ │ │ │ -_2_4_4 void _b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ -245 { │ │ │ │ │ -246 if (OwnerToAllInterfaceBuilt) │ │ │ │ │ -247 OwnerToAllInterface.free(); │ │ │ │ │ -248 _O_w_n_e_r_S_e_t sourceFlags; │ │ │ │ │ -249 _A_l_l_S_e_t destFlags; │ │ │ │ │ -250 OwnerToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ -251 OwnerToAllInterfaceBuilt = true; │ │ │ │ │ -252 } │ │ │ │ │ -253 │ │ │ │ │ -_2_5_4 void _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ -255 { │ │ │ │ │ -256 if (OwnerCopyToAllInterfaceBuilt) │ │ │ │ │ -257 OwnerCopyToAllInterface.free(); │ │ │ │ │ -258 │ │ │ │ │ -259 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ │ -OwnerCopySet; │ │ │ │ │ -260 OwnerCopySet sourceFlags; │ │ │ │ │ -261 Combine,_A_t_t_r_i_b_u_t_e_S_e_t> destFlags; │ │ │ │ │ -262 OwnerCopyToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ -263 OwnerCopyToAllInterfaceBuilt = true; │ │ │ │ │ -264 } │ │ │ │ │ -265 │ │ │ │ │ -_2_6_6 void _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ -267 { │ │ │ │ │ -268 if (OwnerCopyToOwnerCopyInterfaceBuilt) │ │ │ │ │ -269 OwnerCopyToOwnerCopyInterface.free(); │ │ │ │ │ -270 │ │ │ │ │ -271 │ │ │ │ │ -272 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ │ -OwnerCopySet; │ │ │ │ │ -273 OwnerCopySet sourceFlags; │ │ │ │ │ -274 OwnerCopySet destFlags; │ │ │ │ │ -275 OwnerCopyToOwnerCopyInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ -276 OwnerCopyToOwnerCopyInterfaceBuilt = true; │ │ │ │ │ -277 } │ │ │ │ │ -278 │ │ │ │ │ -_2_7_9 void _b_u_i_l_d_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ -280 { │ │ │ │ │ -281 if (CopyToAllInterfaceBuilt) │ │ │ │ │ -282 CopyToAllInterface.free(); │ │ │ │ │ -283 _C_o_p_y_S_e_t sourceFlags; │ │ │ │ │ -284 _A_l_l_S_e_t destFlags; │ │ │ │ │ -285 CopyToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ -286 CopyToAllInterfaceBuilt = true; │ │ │ │ │ -287 } │ │ │ │ │ -288 │ │ │ │ │ -289 public: │ │ │ │ │ -290 │ │ │ │ │ -_2_9_5 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y () const { │ │ │ │ │ -296 return category_; │ │ │ │ │ -297 } │ │ │ │ │ -298 │ │ │ │ │ -_2_9_9 const Communication& _c_o_m_m_u_n_i_c_a_t_o_r() const │ │ │ │ │ -300 { │ │ │ │ │ -301 return cc; │ │ │ │ │ -302 } │ │ │ │ │ -303 │ │ │ │ │ -310 template │ │ │ │ │ -_3_1_1 void _c_o_p_y_O_w_n_e_r_T_o_A_l_l (const T& source, T& dest) const │ │ │ │ │ -312 { │ │ │ │ │ -313 if (!OwnerToAllInterfaceBuilt) │ │ │ │ │ -314 _b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e (); │ │ │ │ │ -315 _B_C _c_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ -316 _c_o_m_m_u_n_i_c_a_t_o_r.template build(OwnerToAllInterface); │ │ │ │ │ -317 _c_o_m_m_u_n_i_c_a_t_o_r.template forward >(source,dest); │ │ │ │ │ -318 _c_o_m_m_u_n_i_c_a_t_o_r.free(); │ │ │ │ │ -319 } │ │ │ │ │ -320 │ │ │ │ │ -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 { │ │ │ │ │ -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)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ │ -600 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ │ -_o_w_n_e_r,true)); │ │ │ │ │ -601 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p) │ │ │ │ │ -602 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ │ -_o_v_e_r_l_a_p,true)); │ │ │ │ │ -603 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ │ -604 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ │ -_c_o_p_y,true)); │ │ │ │ │ -605 // std::cout << cc.rank() << ": adding index " << std::get<0>(*i) << " " << │ │ │ │ │ -std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; │ │ │ │ │ -606 } │ │ │ │ │ -607 pis.endResize(); │ │ │ │ │ -608 │ │ │ │ │ -609 // build remote indices WITHOUT communication │ │ │ │ │ -610 // std::cout << cc.rank() << ": build remote indices" << std::endl; │ │ │ │ │ -611 ri.setIndexSets(pis,pis,cc); │ │ │ │ │ -612 if (indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().size()>0) │ │ │ │ │ -613 { │ │ │ │ │ -614 remoteindex_iterator i=indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().begin(); │ │ │ │ │ -615 int p = std::get<0>(*i); │ │ │ │ │ -616 _R_I_L_M modifier = ri.template getModifier(p); │ │ │ │ │ -617 typename PIS::const_iterator pi=pis.begin(); │ │ │ │ │ -618 for ( ; i!=indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().end(); ++i) │ │ │ │ │ -619 { │ │ │ │ │ -620 // handle processor change │ │ │ │ │ -621 if (p!=std::get<0>(*i)) │ │ │ │ │ -622 { │ │ │ │ │ -623 p = std::get<0>(*i); │ │ │ │ │ -624 modifier = ri.template getModifier(p); │ │ │ │ │ -625 pi=pis.begin(); │ │ │ │ │ -626 } │ │ │ │ │ -627 │ │ │ │ │ -628 // position to correct entry in parallel index set │ │ │ │ │ -629 while (pi->global()!=std::get<1>(*i) && pi!=pis.end()) │ │ │ │ │ -630 ++pi; │ │ │ │ │ -631 if (pi==pis.end()) │ │ │ │ │ -632 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"OwnerOverlapCopyCommunication: global index not in │ │ │ │ │ -index set"); │ │ │ │ │ -633 │ │ │ │ │ -634 // insert entry │ │ │ │ │ -635 // std::cout << cc.rank() << ": adding remote index " << std::get<0>(*i) << │ │ │ │ │ -" " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; │ │ │ │ │ -636 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ │ -637 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r,&(*pi))); │ │ │ │ │ -638 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p) │ │ │ │ │ -639 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p,&(*pi))); │ │ │ │ │ -640 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ │ -641 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y,&(*pi))); │ │ │ │ │ -642 } │ │ │ │ │ -643 }else{ │ │ │ │ │ -644 // Force remote indices to be synced! │ │ │ │ │ -645 ri.template getModifier(0); │ │ │ │ │ -646 } │ │ │ │ │ -647 } │ │ │ │ │ -648 │ │ │ │ │ -649 // destructor: free memory in some objects │ │ │ │ │ -_6_5_0 _~_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n () │ │ │ │ │ -651 { │ │ │ │ │ -652 ri.free(); │ │ │ │ │ -653 if (OwnerToAllInterfaceBuilt) OwnerToAllInterface.free(); │ │ │ │ │ -654 if (OwnerOverlapToAllInterfaceBuilt) OwnerOverlapToAllInterface.free(); │ │ │ │ │ -655 if (OwnerCopyToAllInterfaceBuilt) OwnerCopyToAllInterface.free(); │ │ │ │ │ -656 if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free │ │ │ │ │ -(); │ │ │ │ │ -657 if (CopyToAllInterfaceBuilt) CopyToAllInterface.free(); │ │ │ │ │ -658 if (globalLookup_) delete globalLookup_; │ │ │ │ │ -659 if (freecomm==true) │ │ │ │ │ -660 if(comm!=MPI_COMM_NULL) │ │ │ │ │ -661 { │ │ │ │ │ -662#ifdef MPI_2 │ │ │ │ │ -663 // If it is possible to query whether MPI_Finalize │ │ │ │ │ -664 // was called, only free the communicator before │ │ │ │ │ -665 // calling MPI_Finalize. │ │ │ │ │ -666 int wasFinalized = 0; │ │ │ │ │ -667 MPI_Finalized( &wasFinalized ); │ │ │ │ │ -668 if(!wasFinalized) │ │ │ │ │ -669#endif │ │ │ │ │ -670 MPI_Comm_free(&comm); │ │ │ │ │ -671 } │ │ │ │ │ -672 } │ │ │ │ │ -673 │ │ │ │ │ -674 private: │ │ │ │ │ -675 _O_w_n_e_r_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&) │ │ │ │ │ -676 {} │ │ │ │ │ -677 MPI_Comm comm; │ │ │ │ │ -678 Communication cc; │ │ │ │ │ -679 _P_I_S pis; │ │ │ │ │ -680 _R_I ri; │ │ │ │ │ -681 mutable _I_F OwnerToAllInterface; │ │ │ │ │ -682 mutable bool OwnerToAllInterfaceBuilt; │ │ │ │ │ -683 mutable _I_F OwnerOverlapToAllInterface; │ │ │ │ │ -684 mutable bool OwnerOverlapToAllInterfaceBuilt; │ │ │ │ │ -685 mutable _I_F OwnerCopyToAllInterface; │ │ │ │ │ -686 mutable bool OwnerCopyToAllInterfaceBuilt; │ │ │ │ │ -687 mutable _I_F OwnerCopyToOwnerCopyInterface; │ │ │ │ │ -688 mutable bool OwnerCopyToOwnerCopyInterfaceBuilt; │ │ │ │ │ -689 mutable _I_F CopyToAllInterface; │ │ │ │ │ -690 mutable bool CopyToAllInterfaceBuilt; │ │ │ │ │ -691 mutable std::vector mask; │ │ │ │ │ -692 int oldseqNo; │ │ │ │ │ -693 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t* globalLookup_; │ │ │ │ │ -694 const _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category_; │ │ │ │ │ -695 bool freecomm; │ │ │ │ │ -696 }; │ │ │ │ │ -697 │ │ │ │ │ -698#endif │ │ │ │ │ -699 │ │ │ │ │ -700 │ │ │ │ │ -703} // end namespace │ │ │ │ │ -704 │ │ │ │ │ -705#endif │ │ │ │ │ -_t_e_s_t_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ -void testRedistributed(int s) │ │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ -_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. │ │ │ │ │ -_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_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ -derive error class from the base class in common │ │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ -Attribute set for overlapping Schwarz. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ -AttributeSet │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r │ │ │ │ │ -@ owner │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y │ │ │ │ │ -@ copy │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p │ │ │ │ │ -@ overlap │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d │ │ │ │ │ -Information about the index distribution. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ │ -std::tuple< GlobalIdType, LocalIdType, int > IndexTripel │ │ │ │ │ -A triple describing a local index. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_a_d_d_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ -void addRemoteIndex(const RemoteIndexTripel &x) │ │ │ │ │ -Add a new remote index triple to the set of remote indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_G_l_o_b_a_l_I_d_T_y_p_e │ │ │ │ │ -G GlobalIdType │ │ │ │ │ -The type of the global index. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_l_o_c_a_l_I_n_d_i_c_e_s │ │ │ │ │ -const std::set< IndexTripel > & localIndices() const │ │ │ │ │ -Get the set of indices local to the process. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:133 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -const std::set< RemoteIndexTripel > & remoteIndices() const │ │ │ │ │ -Get the set of remote indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_L_o_c_a_l_I_d_T_y_p_e │ │ │ │ │ -L LocalIdType │ │ │ │ │ -The type of the local index. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_c_l_e_a_r │ │ │ │ │ -void clear() │ │ │ │ │ -Remove all indices from the sets. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_a_d_d_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -void addLocalIndex(const IndexTripel &x) │ │ │ │ │ -Add a new index triple to the set of local indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:106 │ │ │ │ │ -_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ │ -std::tuple< int, GlobalIdType, int > RemoteIndexTripel │ │ │ │ │ -A triple describing a remote index. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:99 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ -owner/overlap/copy sema... │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_S_e_t │ │ │ │ │ -EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:195 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ -const GlobalLookupIndexSet & globalLookup() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:526 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_n_o_r_m │ │ │ │ │ -FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const │ │ │ │ │ -Compute the global Euclidean norm of a vector. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:425 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ -void buildOwnerOverlapToAllInterface() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:233 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_I_S │ │ │ │ │ -Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ -void buildOwnerCopyToAllInterface() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:254 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y_I_n_t_e_r_f_a_c_e │ │ │ │ │ -void buildOwnerCopyToOwnerCopyInterface() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:266 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, │ │ │ │ │ -LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category │ │ │ │ │ -cat_=SolverCategory::overlapping, bool freecomm_=false) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:586 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -SolverCategory::Category category() const │ │ │ │ │ -Get Solver Category. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:295 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y │ │ │ │ │ -void addOwnerCopyToOwnerCopy(const T &source, T &dest) const │ │ │ │ │ -Communicate values from owner and copy data points to owner and copy data │ │ │ │ │ -points and add them to thos... │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:379 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ -void buildCopyToAllInterface() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:279 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_F_l_a_g_s │ │ │ │ │ -Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:446 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -RemoteIndices & remoteIndices() │ │ │ │ │ -Get the underlying remote indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:490 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ │ -const ParallelIndexSet & indexSet() const │ │ │ │ │ -Get the underlying parallel index set. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:462 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_I │ │ │ │ │ -Dune::RemoteIndices< PIS > RI │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:189 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ -void buildGlobalLookup(std::size_t size) │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:508 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l │ │ │ │ │ -void addOwnerOverlapToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from owner data points to all other data points and add them │ │ │ │ │ -to those values. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:345 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -Dune::RemoteIndices< PIS > RemoteIndices │ │ │ │ │ -The type of the remote indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:452 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ │ -void project(T1 &x) const │ │ │ │ │ -Set vector to zero at copy dofs. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:538 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_A_l_l_S_e_t │ │ │ │ │ -Dune::AllSet< AttributeSet > AllSet │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:197 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_S_e_t │ │ │ │ │ -Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, │ │ │ │ │ -EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > │ │ │ │ │ -OwnerOverlapSet │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:196 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ │ -void copyCopyToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from copy data points to all other data points. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ │ -The type of the reverse lookup of indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_I_F │ │ │ │ │ -Dune::Interface IF │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:193 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_~_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -~OwnerOverlapCopyCommunication() │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:650 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ -void buildGlobalLookup() │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:495 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_B_C │ │ │ │ │ -Dune::BufferedCommunicator BC │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:192 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category │ │ │ │ │ -cat_=SolverCategory::overlapping, bool freecomm_=false) │ │ │ │ │ -Construct the communication without any indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:554 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ │ -ParallelIndexSet & indexSet() │ │ │ │ │ -Get the underlying parallel index set. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:480 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_d_o_t │ │ │ │ │ -void dot(const T1 &x, const T1 &y, T2 &result) const │ │ │ │ │ -Compute a global dot product of two vectors. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:398 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -const Communication< MPI_Comm > & communicator() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory:: │ │ │ │ │ -overlapping) │ │ │ │ │ -Construct the communication without any indices using MPI_COMM_WORLD. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:572 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ -EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ -void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from owner data points to all other data points. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -const RemoteIndices & remoteIndices() const │ │ │ │ │ -Get the underlying remote indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t │ │ │ │ │ -friend void loadMatrixMarket(M &, const std::string &, │ │ │ │ │ -OwnerOverlapCopyCommunication< G, L > &, bool) │ │ │ │ │ -Load a parallel matrix/vector stored in matrix market format. │ │ │ │ │ -DDeeffiinniittiioonn matrixmarket.hh:1269 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_X │ │ │ │ │ -RI::RemoteIndex RX │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:191 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l │ │ │ │ │ -void addOwnerCopyToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from owner and copy data points to all other data points and │ │ │ │ │ -add them to those val... │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:362 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ -void freeGlobalLookup() │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:520 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_I_L_M │ │ │ │ │ -Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:190 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ │ -The type of the parallel index set. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ -void buildOwnerToAllInterface() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:244 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -gather/scatter callback for communcation │ │ │ │ │ -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_:_:_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ │ -@ overlapping │ │ │ │ │ -Category for overlapping solvers. │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:29 │ │ │ │ │ +101 extern void │ │ │ │ │ +102 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int, │ │ │ │ │ +103 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +104 │ │ │ │ │ +105 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ +106 │ │ │ │ │ +107 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ +108} │ │ │ │ │ +109#endif │ │ │ │ │ +110 │ │ │ │ │ +111 │ │ │ │ │ +112#endif │ │ │ │ │ +113#endif │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bvector.hh File Reference │ │ │ │ +dune-istl: novlpschwarz.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,65 +71,55 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
bvector.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
novlpschwarz.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. │ │ │ │ -More...

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <cmath>
│ │ │ │ -#include <complex>
│ │ │ │ -#include <initializer_list>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <utility>
│ │ │ │ +
#include <iostream>
│ │ │ │ +#include <fstream>
│ │ │ │ #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/scalarvectorview.hh>
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ -#include "basearray.hh"
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ +#include <sstream>
│ │ │ │ +#include <cmath>
│ │ │ │ +#include <dune/common/timer.hh>
│ │ │ │ +#include <dune/common/hybridutilities.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"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::BlockVector< B, A >
 A vector of blocks with memory management. More...
class  Dune::NonoverlappingSchwarzOperator< M, X, Y, C >
 A nonoverlapping operator with communication object. More...
 
struct  Dune::FieldTraits< BlockVector< B, A > >
class  Dune::NonoverlappingBlockPreconditioner< C, P >
 Nonoverlapping parallel preconditioner. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<class K , class A >
std::ostream & Dune::operator<< (std::ostream &s, const BlockVector< K, A > &v)
 Send BlockVector to an output stream.
 
namespace  Dune::Amg
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

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,49 +1,41 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +novlpschwarz.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#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" │ │ │ │ │ +#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" │ │ │ │ │ _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_:_:_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _> │ │ │ │ │ -  A vector of blocks with memory management. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_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 nonoverlapping operator with communication object. _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_ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_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_,_ _P_ _> │ │ │ │ │ +  Nonoverlapping parallel preconditioner. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -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. │ │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ │ -space. The number of components can be given at run-time. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bvector.hh Source File │ │ │ │ +dune-istl: novlpschwarz.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,961 +74,381 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
bvector.hh
│ │ │ │ +
novlpschwarz.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_BVECTOR_HH
│ │ │ │ -
7#define DUNE_ISTL_BVECTOR_HH
│ │ │ │ -
8
│ │ │ │ -
9#include <algorithm>
│ │ │ │ -
10#include <cmath>
│ │ │ │ -
11#include <complex>
│ │ │ │ -
12#include <initializer_list>
│ │ │ │ -
13#include <limits>
│ │ │ │ -
14#include <memory>
│ │ │ │ -
15#include <utility>
│ │ │ │ -
16#include <vector>
│ │ │ │ -
17
│ │ │ │ -
18#include <dune/common/dotproduct.hh>
│ │ │ │ -
19#include <dune/common/ftraits.hh>
│ │ │ │ -
20#include <dune/common/fmatrix.hh>
│ │ │ │ -
21#include <dune/common/fvector.hh>
│ │ │ │ -
22#include <dune/common/promotiontraits.hh>
│ │ │ │ -
23#include <dune/common/typetraits.hh>
│ │ │ │ -
24#include <dune/common/scalarvectorview.hh>
│ │ │ │ -
25
│ │ │ │ - │ │ │ │ -
27
│ │ │ │ -
28#include "basearray.hh"
│ │ │ │ -
29#include "istlexception.hh"
│ │ │ │ -
30
│ │ │ │ -
38namespace Dune {
│ │ │ │ -
39
│ │ │ │ -
41namespace Imp {
│ │ │ │ -
42
│ │ │ │ -
48 template <class B, bool isNumber>
│ │ │ │ -
49 class BlockTraitsImp;
│ │ │ │ -
50
│ │ │ │ -
51 template <class B>
│ │ │ │ -
52 class BlockTraitsImp<B,true>
│ │ │ │ -
53 {
│ │ │ │ -
54 public:
│ │ │ │ -
55 using field_type = B;
│ │ │ │ -
56 };
│ │ │ │ -
57
│ │ │ │ -
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 A=std::allocator<B> >
│ │ │ │ -
84 class block_vector_unmanaged : public base_array_unmanaged<B,A>
│ │ │ │ -
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 A allocator_type;
│ │ │ │ -
96
│ │ │ │ -
98 typedef typename A::size_type size_type;
│ │ │ │ +
5#ifndef DUNE_ISTL_NOVLPSCHWARZ_HH
│ │ │ │ +
6#define DUNE_ISTL_NOVLPSCHWARZ_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>
│ │ │ │ +
16
│ │ │ │ +
17#include <dune/common/hybridutilities.hh>
│ │ │ │ +
18
│ │ │ │ +
19#include "io.hh"
│ │ │ │ +
20#include "bvector.hh"
│ │ │ │ +
21#include "vbvector.hh"
│ │ │ │ +
22#include "bcrsmatrix.hh"
│ │ │ │ +
23#include "io.hh"
│ │ │ │ +
24#include "gsetc.hh"
│ │ │ │ +
25#include "ilu.hh"
│ │ │ │ +
26#include "operators.hh"
│ │ │ │ +
27#include "solvers.hh"
│ │ │ │ +
28#include "preconditioners.hh"
│ │ │ │ +
29#include "scalarproducts.hh"
│ │ │ │ +
30#include "owneroverlapcopy.hh"
│ │ │ │ +
31
│ │ │ │ +
32namespace Dune {
│ │ │ │ +
33
│ │ │ │ +
59 template<class M, class X, class Y, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
61 {
│ │ │ │ +
62 public:
│ │ │ │ +
64 typedef M matrix_type;
│ │ │ │ +
66 typedef X domain_type;
│ │ │ │ +
68 typedef Y range_type;
│ │ │ │ +
70 typedef typename X::field_type field_type;
│ │ │ │ + │ │ │ │ +
73
│ │ │ │ +
74 typedef typename C::PIS PIS;
│ │ │ │ +
75 typedef typename C::RI RI;
│ │ │ │ +
76 typedef typename RI::RemoteIndexList RIL;
│ │ │ │ +
77 typedef typename RI::const_iterator RIIterator;
│ │ │ │ +
78 typedef typename RIL::const_iterator RILIterator;
│ │ │ │ +
79 typedef typename M::ConstColIterator ColIterator;
│ │ │ │ +
80 typedef typename M::ConstRowIterator RowIterator;
│ │ │ │ +
81 typedef std::multimap<int,int> MM;
│ │ │ │ +
82 typedef std::multimap<int,std::pair<int,RILIterator> > RIMap;
│ │ │ │ +
83 typedef typename RIMap::iterator RIMapit;
│ │ │ │ +
84
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
93 : _A_(stackobject_to_shared_ptr(A)), communication(com), buildcomm(true)
│ │ │ │ +
94 {}
│ │ │ │ +
│ │ │ │ +
95
│ │ │ │ +
│ │ │ │ +
96 NonoverlappingSchwarzOperator (std::shared_ptr<const matrix_type> A, const communication_type& com)
│ │ │ │ +
97 : _A_(A), communication(com), buildcomm(true)
│ │ │ │ +
98 {}
│ │ │ │ +
│ │ │ │
99
│ │ │ │ -
101 typedef typename base_array_unmanaged<B,A>::iterator Iterator;
│ │ │ │ -
102
│ │ │ │ -
104 typedef typename base_array_unmanaged<B,A>::const_iterator ConstIterator;
│ │ │ │ -
105
│ │ │ │ -
107 typedef B value_type;
│ │ │ │ -
108
│ │ │ │ -
110 typedef B& reference;
│ │ │ │ -
111
│ │ │ │ -
113 typedef const B& const_reference;
│ │ │ │ -
114
│ │ │ │ -
115 //===== assignment from scalar
│ │ │ │ -
117
│ │ │ │ -
118 block_vector_unmanaged& operator= (const field_type& k)
│ │ │ │ -
119 {
│ │ │ │ -
120 for (size_type i=0; i<this->n; i++)
│ │ │ │ -
121 (*this)[i] = k;
│ │ │ │ -
122 return *this;
│ │ │ │ -
123 }
│ │ │ │ -
124
│ │ │ │ -
125 //===== vector space arithmetic
│ │ │ │ -
127 block_vector_unmanaged& operator+= (const block_vector_unmanaged& y)
│ │ │ │ -
128 {
│ │ │ │ -
129#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
130 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ -
131#endif
│ │ │ │ -
132 for (size_type i=0; i<this->n; ++i) (*this)[i] += y[i];
│ │ │ │ -
133 return *this;
│ │ │ │ -
134 }
│ │ │ │ -
135
│ │ │ │ -
137 block_vector_unmanaged& operator-= (const block_vector_unmanaged& y)
│ │ │ │ -
138 {
│ │ │ │ -
139#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
140 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ -
141#endif
│ │ │ │ -
142 for (size_type i=0; i<this->n; ++i) (*this)[i] -= y[i];
│ │ │ │ -
143 return *this;
│ │ │ │ -
144 }
│ │ │ │ -
145
│ │ │ │ -
147 block_vector_unmanaged& operator*= (const field_type& k)
│ │ │ │ -
148 {
│ │ │ │ -
149 for (size_type i=0; i<this->n; ++i) (*this)[i] *= k;
│ │ │ │ -
150 return *this;
│ │ │ │ -
151 }
│ │ │ │ -
152
│ │ │ │ -
154 block_vector_unmanaged& operator/= (const field_type& k)
│ │ │ │ -
155 {
│ │ │ │ -
156 for (size_type i=0; i<this->n; ++i) (*this)[i] /= k;
│ │ │ │ -
157 return *this;
│ │ │ │ -
158 }
│ │ │ │ -
159
│ │ │ │ -
161 block_vector_unmanaged& axpy (const field_type& a, const block_vector_unmanaged& y)
│ │ │ │ -
162 {
│ │ │ │ -
163#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
164 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ -
165#endif
│ │ │ │ -
166 for (size_type i=0; i<this->n; ++i)
│ │ │ │ -
167 Impl::asVector((*this)[i]).axpy(a,Impl::asVector(y[i]));
│ │ │ │ -
168
│ │ │ │ -
169 return *this;
│ │ │ │ -
170 }
│ │ │ │ +
│ │ │ │ +
101 virtual void apply (const X& x, Y& y) const
│ │ │ │ +
102 {
│ │ │ │ +
103 y = 0;
│ │ │ │ +
104 novlp_op_apply(x,y,1);
│ │ │ │ +
105 communication.addOwnerCopyToOwnerCopy(y,y);
│ │ │ │ +
106 }
│ │ │ │ +
│ │ │ │ +
107
│ │ │ │ +
│ │ │ │ +
109 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
│ │ │ │ +
110 {
│ │ │ │ +
111 // only apply communication to alpha*A*x to make it consistent,
│ │ │ │ +
112 // y already has to be consistent.
│ │ │ │ +
113 Y y1(y);
│ │ │ │ +
114 y = 0;
│ │ │ │ +
115 novlp_op_apply(x,y,alpha);
│ │ │ │ +
116 communication.addOwnerCopyToOwnerCopy(y,y);
│ │ │ │ +
117 y += y1;
│ │ │ │ +
118 }
│ │ │ │ +
│ │ │ │ +
119
│ │ │ │ +
│ │ │ │ +
121 virtual const matrix_type& getmat () const
│ │ │ │ +
122 {
│ │ │ │ +
123 return *_A_;
│ │ │ │ +
124 }
│ │ │ │ +
│ │ │ │ +
125
│ │ │ │ +
│ │ │ │ +
126 void novlp_op_apply (const X& x, Y& y, field_type alpha) const
│ │ │ │ +
127 {
│ │ │ │ +
128 //get index sets
│ │ │ │ +
129 const PIS& pis=communication.indexSet();
│ │ │ │ +
130 const RI& ri = communication.remoteIndices();
│ │ │ │ +
131
│ │ │ │ +
132 // at the beginning make a multimap "bordercontribution".
│ │ │ │ +
133 // process has i and j as border dofs but is not the owner
│ │ │ │ +
134 // => only contribute to Ax if i,j is in bordercontribution
│ │ │ │ +
135 if (buildcomm == true) {
│ │ │ │ +
136
│ │ │ │ +
137 // set up mask vector
│ │ │ │ +
138 if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size())) {
│ │ │ │ +
139 mask.resize(x.size());
│ │ │ │ +
140 for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
│ │ │ │ +
141 mask[i] = 1;
│ │ │ │ +
142 for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
│ │ │ │ +
143 if (i->local().attribute()==OwnerOverlapCopyAttributeSet::copy)
│ │ │ │ +
144 mask[i->local().local()] = 0;
│ │ │ │ +
145 else if (i->local().attribute()==OwnerOverlapCopyAttributeSet::overlap)
│ │ │ │ +
146 mask[i->local().local()] = 2;
│ │ │ │ +
147 }
│ │ │ │ +
148
│ │ │ │ +
149 for (MM::iterator iter = bordercontribution.begin();
│ │ │ │ +
150 iter != bordercontribution.end(); ++iter)
│ │ │ │ +
151 bordercontribution.erase(iter);
│ │ │ │ +
152 std::map<int,int> owner; //key: local index i, value: process, that owns i
│ │ │ │ +
153 RIMap rimap;
│ │ │ │ +
154
│ │ │ │ +
155 // for each local index make multimap rimap:
│ │ │ │ +
156 // key: local index i, data: pair of process that knows i and pointer to RI entry
│ │ │ │ +
157 for (RowIterator i = _A_->begin(); i != _A_->end(); ++i)
│ │ │ │ +
158 if (mask[i.index()] == 0)
│ │ │ │ +
159 for (RIIterator remote = ri.begin(); remote != ri.end(); ++remote) {
│ │ │ │ +
160 RIL& ril = *(remote->second.first);
│ │ │ │ +
161 for (RILIterator rindex = ril.begin(); rindex != ril.end(); ++rindex)
│ │ │ │ +
162 if (rindex->attribute() != OwnerOverlapCopyAttributeSet::overlap)
│ │ │ │ +
163 if (rindex->localIndexPair().local().local() == i.index()) {
│ │ │ │ +
164 rimap.insert
│ │ │ │ +
165 (std::make_pair(i.index(),
│ │ │ │ +
166 std::pair<int,RILIterator>(remote->first, rindex)));
│ │ │ │ +
167 if(rindex->attribute()==OwnerOverlapCopyAttributeSet::owner)
│ │ │ │ +
168 owner.insert(std::make_pair(i.index(),remote->first));
│ │ │ │ +
169 }
│ │ │ │ +
170 }
│ │ │ │
171
│ │ │ │ -
172
│ │ │ │ -
180 template<class OtherB, class OtherA>
│ │ │ │ -
181 auto operator* (const block_vector_unmanaged<OtherB,OtherA>& y) const
│ │ │ │ -
182 {
│ │ │ │ -
183 typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
│ │ │ │ -
184 PromotedType sum(0);
│ │ │ │ -
185#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
186 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ -
187#endif
│ │ │ │ -
188 for (size_type i=0; i<this->n; ++i) {
│ │ │ │ -
189 sum += PromotedType(((*this)[i])*y[i]);
│ │ │ │ -
190 }
│ │ │ │ -
191 return sum;
│ │ │ │ -
192 }
│ │ │ │ -
193
│ │ │ │ -
201 template<class OtherB, class OtherA>
│ │ │ │ -
202 auto dot(const block_vector_unmanaged<OtherB,OtherA>& y) const
│ │ │ │ -
203 {
│ │ │ │ -
204 typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
│ │ │ │ -
205 PromotedType sum(0);
│ │ │ │ -
206#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
207 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ -
208#endif
│ │ │ │ +
172 int iowner = 0;
│ │ │ │ +
173 for (RowIterator i = _A_->begin(); i != _A_->end(); ++i) {
│ │ │ │ +
174 if (mask[i.index()] == 0) {
│ │ │ │ +
175 std::map<int,int>::iterator it = owner.find(i.index());
│ │ │ │ +
176 iowner = it->second;
│ │ │ │ +
177 std::pair<RIMapit, RIMapit> foundiit = rimap.equal_range(i.index());
│ │ │ │ +
178 for (ColIterator j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end(); ++j) {
│ │ │ │ +
179 if (mask[j.index()] == 0) {
│ │ │ │ +
180 bool flag = true;
│ │ │ │ +
181 for (RIMapit foundi = foundiit.first; foundi != foundiit.second; ++foundi) {
│ │ │ │ +
182 std::pair<RIMapit, RIMapit> foundjit = rimap.equal_range(j.index());
│ │ │ │ +
183 for (RIMapit foundj = foundjit.first; foundj != foundjit.second; ++foundj)
│ │ │ │ +
184 if (foundj->second.first == foundi->second.first)
│ │ │ │ +
185 if (foundj->second.second->attribute() == OwnerOverlapCopyAttributeSet::owner
│ │ │ │ +
186 || foundj->second.first == iowner
│ │ │ │ +
187 || foundj->second.first < communication.communicator().rank()) {
│ │ │ │ +
188 flag = false;
│ │ │ │ +
189 continue;
│ │ │ │ +
190 }
│ │ │ │ +
191 if (flag == false)
│ │ │ │ +
192 continue;
│ │ │ │ +
193 }
│ │ │ │ +
194 // don´t contribute to Ax if
│ │ │ │ +
195 // 1. the owner of j has i as interior/border dof
│ │ │ │ +
196 // 2. iowner has j as interior/border dof
│ │ │ │ +
197 // 3. there is another process with smaller rank that has i and j
│ │ │ │ +
198 // as interor/border dofs
│ │ │ │ +
199 // if the owner of j does not have i as interior/border dof,
│ │ │ │ +
200 // it will not be taken into account
│ │ │ │ +
201 if (flag==true)
│ │ │ │ +
202 bordercontribution.insert(std::pair<int,int>(i.index(),j.index()));
│ │ │ │ +
203 }
│ │ │ │ +
204 }
│ │ │ │ +
205 }
│ │ │ │ +
206 }
│ │ │ │ +
207 buildcomm = false;
│ │ │ │ +
208 }
│ │ │ │
209
│ │ │ │ -
210 for (size_type i=0; i<this->n; ++i)
│ │ │ │ -
211 sum += Impl::asVector((*this)[i]).dot(Impl::asVector(y[i]));
│ │ │ │ -
212
│ │ │ │ -
213 return sum;
│ │ │ │ -
214 }
│ │ │ │ -
215
│ │ │ │ -
216 //===== norms
│ │ │ │ -
217
│ │ │ │ -
219 typename FieldTraits<field_type>::real_type one_norm () const
│ │ │ │ -
220 {
│ │ │ │ -
221 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
222 for (size_type i=0; i<this->n; ++i)
│ │ │ │ -
223 sum += Impl::asVector((*this)[i]).one_norm();
│ │ │ │ -
224 return sum;
│ │ │ │ -
225 }
│ │ │ │ -
226
│ │ │ │ -
228 typename FieldTraits<field_type>::real_type one_norm_real () const
│ │ │ │ -
229 {
│ │ │ │ -
230 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
231 for (size_type i=0; i<this->n; ++i)
│ │ │ │ -
232 sum += Impl::asVector((*this)[i]).one_norm_real();
│ │ │ │ -
233 return sum;
│ │ │ │ -
234 }
│ │ │ │ -
235
│ │ │ │ -
237 typename FieldTraits<field_type>::real_type two_norm () const
│ │ │ │ -
238 {
│ │ │ │ -
239 using std::sqrt;
│ │ │ │ -
240 return sqrt(two_norm2());
│ │ │ │ -
241 }
│ │ │ │ -
242
│ │ │ │ -
244 typename FieldTraits<field_type>::real_type two_norm2 () const
│ │ │ │ -
245 {
│ │ │ │ -
246 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
247 for (size_type i=0; i<this->n; ++i)
│ │ │ │ -
248 sum += Impl::asVector((*this)[i]).two_norm2();
│ │ │ │ -
249 return sum;
│ │ │ │ -
250 }
│ │ │ │ -
251
│ │ │ │ -
253 template <typename ft = field_type,
│ │ │ │ -
254 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
255 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
256 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
257 using std::max;
│ │ │ │ -
258
│ │ │ │ -
259 real_type norm = 0;
│ │ │ │ -
260 for (auto const &xi : *this) {
│ │ │ │ -
261 real_type const a = Impl::asVector(xi).infinity_norm();
│ │ │ │ -
262 norm = max(a, norm);
│ │ │ │ -
263 }
│ │ │ │ -
264 return norm;
│ │ │ │ -
265 }
│ │ │ │ -
266
│ │ │ │ -
268 template <typename ft = field_type,
│ │ │ │ -
269 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
270 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
271 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
272 using std::max;
│ │ │ │ -
273
│ │ │ │ -
274 real_type norm = 0;
│ │ │ │ -
275 for (auto const &xi : *this) {
│ │ │ │ -
276 real_type const a = Impl::asVector(xi).infinity_norm_real();
│ │ │ │ -
277 norm = max(a, norm);
│ │ │ │ -
278 }
│ │ │ │ -
279 return norm;
│ │ │ │ -
280 }
│ │ │ │ -
281
│ │ │ │ -
283 template <typename ft = field_type,
│ │ │ │ -
284 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
285 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
286 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
287 using std::max;
│ │ │ │ -
288 using std::abs;
│ │ │ │ -
289
│ │ │ │ -
290 real_type norm = 0;
│ │ │ │ -
291 real_type isNaN = 1;
│ │ │ │ -
292
│ │ │ │ -
293 for (auto const &xi : *this) {
│ │ │ │ -
294 real_type const a = Impl::asVector(xi).infinity_norm();
│ │ │ │ -
295 norm = max(a, norm);
│ │ │ │ -
296 isNaN += a;
│ │ │ │ -
297 }
│ │ │ │ -
298 return norm * (isNaN / isNaN);
│ │ │ │ -
299 }
│ │ │ │ -
300
│ │ │ │ -
302 template <typename ft = field_type,
│ │ │ │ -
303 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
304 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
305 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
306 using std::max;
│ │ │ │ -
307
│ │ │ │ -
308 real_type norm = 0;
│ │ │ │ -
309 real_type isNaN = 1;
│ │ │ │ -
310
│ │ │ │ -
311 for (auto const &xi : *this) {
│ │ │ │ -
312 real_type const a = Impl::asVector(xi).infinity_norm_real();
│ │ │ │ -
313 norm = max(a, norm);
│ │ │ │ -
314 isNaN += a;
│ │ │ │ -
315 }
│ │ │ │ +
210 //compute alpha*A*x nonoverlapping case
│ │ │ │ +
211 for (RowIterator i = _A_->begin(); i != _A_->end(); ++i) {
│ │ │ │ +
212 if (mask[i.index()] == 0) {
│ │ │ │ +
213 //dof doesn't belong to process but is border (not ghost)
│ │ │ │ +
214 for (ColIterator j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end(); ++j) {
│ │ │ │ +
215 if (mask[j.index()] == 1) //j is owner => then sum entries
│ │ │ │ +
216 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]);
│ │ │ │ +
217 else if (mask[j.index()] == 0) {
│ │ │ │ +
218 std::pair<MM::iterator, MM::iterator> itp =
│ │ │ │ +
219 bordercontribution.equal_range(i.index());
│ │ │ │ +
220 for (MM::iterator it = itp.first; it != itp.second; ++it)
│ │ │ │ +
221 if ((*it).second == (int)j.index())
│ │ │ │ +
222 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]);
│ │ │ │ +
223 }
│ │ │ │ +
224 }
│ │ │ │ +
225 }
│ │ │ │ +
226 else if (mask[i.index()] == 1) {
│ │ │ │ +
227 for (ColIterator j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end(); ++j)
│ │ │ │ +
228 if (mask[j.index()] != 2)
│ │ │ │ +
229 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]);
│ │ │ │ +
230 }
│ │ │ │ +
231 }
│ │ │ │ +
232 }
│ │ │ │ +
│ │ │ │ +
233
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
236 {
│ │ │ │ + │ │ │ │ +
238 }
│ │ │ │ +
│ │ │ │ +
239
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
242 {
│ │ │ │ +
243 return communication;
│ │ │ │ +
244 }
│ │ │ │ +
│ │ │ │ +
245 private:
│ │ │ │ +
246 std::shared_ptr<const matrix_type> _A_;
│ │ │ │ +
247 const communication_type& communication;
│ │ │ │ +
248 mutable bool buildcomm;
│ │ │ │ +
249 mutable std::vector<double> mask;
│ │ │ │ +
250 mutable std::multimap<int,int> bordercontribution;
│ │ │ │ +
251 };
│ │ │ │ +
│ │ │ │ +
252
│ │ │ │ +
│ │ │ │ +
255 namespace Amg
│ │ │ │ +
256 {
│ │ │ │ +
257 template<class T> struct ConstructionTraits;
│ │ │ │ +
258 }
│ │ │ │ +
│ │ │ │ +
259
│ │ │ │ +
274 template<class C, class P>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
276 : public Preconditioner<typename P::domain_type,typename P::range_type> {
│ │ │ │ +
277 friend struct Amg::ConstructionTraits<NonoverlappingBlockPreconditioner<C,P> >;
│ │ │ │ +
278 using X = typename P::domain_type;
│ │ │ │ +
279 using Y = typename P::range_type;
│ │ │ │ +
280 public:
│ │ │ │ +
282 typedef typename P::domain_type domain_type;
│ │ │ │ +
284 typedef typename P::range_type range_type;
│ │ │ │ + │ │ │ │ +
287
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
303 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c)
│ │ │ │ +
304 { }
│ │ │ │ +
│ │ │ │ +
305
│ │ │ │ +
│ │ │ │ +
313 NonoverlappingBlockPreconditioner (const std::shared_ptr<P>& p, const communication_type& c)
│ │ │ │ +
314 : _preconditioner(p), _communication(c)
│ │ │ │ +
315 { }
│ │ │ │ +
│ │ │ │
316
│ │ │ │ -
317 return norm * (isNaN / isNaN);
│ │ │ │ -
318 }
│ │ │ │ -
319
│ │ │ │ -
320 //===== sizes
│ │ │ │ -
321
│ │ │ │ -
323 size_type N () const
│ │ │ │ -
324 {
│ │ │ │ -
325 return this->n;
│ │ │ │ -
326 }
│ │ │ │ -
327
│ │ │ │ -
329 size_type dim () const
│ │ │ │ -
330 {
│ │ │ │ -
331 size_type d=0;
│ │ │ │ -
332
│ │ │ │ -
333 for (size_type i=0; i<this->n; i++)
│ │ │ │ -
334 d += Impl::asVector((*this)[i]).dim();
│ │ │ │ -
335
│ │ │ │ -
336 return d;
│ │ │ │ -
337 }
│ │ │ │ -
338
│ │ │ │ -
339 protected:
│ │ │ │ -
341 block_vector_unmanaged () : base_array_unmanaged<B,A>()
│ │ │ │ -
342 { }
│ │ │ │ -
343 };
│ │ │ │ -
344
│ │ │ │ -
346
│ │ │ │ -
351 template<class F>
│ │ │ │ -
352 class ScopeGuard {
│ │ │ │ -
353 F cleanupFunc_;
│ │ │ │ -
354 public:
│ │ │ │ -
355 ScopeGuard(F cleanupFunc) : cleanupFunc_(std::move(cleanupFunc)) {}
│ │ │ │ -
356 ScopeGuard(const ScopeGuard &) = delete;
│ │ │ │ -
357 ScopeGuard(ScopeGuard &&) = delete;
│ │ │ │ -
358 ScopeGuard &operator=(ScopeGuard) = delete;
│ │ │ │ -
359 ~ScopeGuard() { cleanupFunc_(); }
│ │ │ │ -
360 };
│ │ │ │ -
361
│ │ │ │ +
│ │ │ │ +
322 virtual void pre (domain_type& x, range_type& b)
│ │ │ │ +
323 {
│ │ │ │ +
324 _preconditioner->pre(x,b);
│ │ │ │ +
325 }
│ │ │ │ +
│ │ │ │ +
326
│ │ │ │ +
│ │ │ │ +
332 virtual void apply (domain_type& v, const range_type& d)
│ │ │ │ +
333 {
│ │ │ │ +
334 // block preconditioner equivalent to WrappedPreconditioner from
│ │ │ │ +
335 // pdelab/backend/ovlpistsolverbackend.hh,
│ │ │ │ +
336 // but not to BlockPreconditioner from schwarz.hh
│ │ │ │ +
337 _preconditioner->apply(v,d);
│ │ │ │ +
338 _communication.addOwnerCopyToOwnerCopy(v,v);
│ │ │ │ +
339 }
│ │ │ │ +
│ │ │ │ +
340
│ │ │ │ +
341 template<bool forward>
│ │ │ │ +
│ │ │ │ +
342 void apply (X& v, const Y& d)
│ │ │ │ +
343 {
│ │ │ │ +
344 _preconditioner->template apply<forward>(v,d);
│ │ │ │ +
345 _communication.addOwnerCopyToOwnerCopy(v,v);
│ │ │ │ +
346 }
│ │ │ │ +
│ │ │ │ +
347
│ │ │ │ +
│ │ │ │ +
353 virtual void post (domain_type& x)
│ │ │ │ +
354 {
│ │ │ │ +
355 _preconditioner->post(x);
│ │ │ │ +
356 }
│ │ │ │ +
│ │ │ │ +
357
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
360 {
│ │ │ │ + │ │ │ │ +
362 }
│ │ │ │ +
│ │ │ │
363
│ │ │ │ -
372 template<class F>
│ │ │ │ -
373 ScopeGuard<F> makeScopeGuard(F cleanupFunc)
│ │ │ │ -
374 {
│ │ │ │ -
375 return { std::move(cleanupFunc) };
│ │ │ │ -
376 }
│ │ │ │ -
377
│ │ │ │ -
378} // end namespace Imp
│ │ │ │ -
393 template<class B, class A=std::allocator<B> >
│ │ │ │ -
│ │ │ │ -
394 class BlockVector : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ -
395 {
│ │ │ │ -
396 public:
│ │ │ │ -
397
│ │ │ │ -
398 //===== type definitions and constants
│ │ │ │ -
399
│ │ │ │ -
401 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
402
│ │ │ │ -
404 typedef B block_type;
│ │ │ │ -
405
│ │ │ │ -
407 typedef A allocator_type;
│ │ │ │ -
408
│ │ │ │ -
410 typedef typename A::size_type size_type;
│ │ │ │ -
411
│ │ │ │ -
413 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
414 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ -
415
│ │ │ │ -
417 typedef typename Imp::block_vector_unmanaged<B,A>::Iterator Iterator;
│ │ │ │ -
418
│ │ │ │ -
420 typedef typename Imp::block_vector_unmanaged<B,A>::ConstIterator ConstIterator;
│ │ │ │ -
421
│ │ │ │ -
422 //===== constructors and such
│ │ │ │ -
423
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
426 {
│ │ │ │ -
427 syncBaseArray();
│ │ │ │ -
428 }
│ │ │ │ -
│ │ │ │ -
429
│ │ │ │ -
│ │ │ │ -
431 explicit BlockVector (size_type _n) : storage_(_n)
│ │ │ │ -
432 {
│ │ │ │ -
433 syncBaseArray();
│ │ │ │ -
434 }
│ │ │ │ -
│ │ │ │ -
435
│ │ │ │ -
│ │ │ │ -
437 BlockVector (std::initializer_list<B> const &l) : storage_(l)
│ │ │ │ -
438 {
│ │ │ │ -
439 syncBaseArray();
│ │ │ │ -
440 }
│ │ │ │ -
│ │ │ │ -
441
│ │ │ │ -
442
│ │ │ │ -
454 template<typename S>
│ │ │ │ -
│ │ │ │ -
455 BlockVector (size_type _n, S _capacity)
│ │ │ │ -
456 {
│ │ │ │ -
457 static_assert(std::numeric_limits<S>::is_integer,
│ │ │ │ -
458 "capacity must be an unsigned integral type (be aware, that this constructor does not set the default value!)" );
│ │ │ │ -
459 if((size_type)_capacity > _n)
│ │ │ │ -
460 storage_.reserve(_capacity);
│ │ │ │ -
461 storage_.resize(_n);
│ │ │ │ -
462 syncBaseArray();
│ │ │ │ -
463 }
│ │ │ │ -
│ │ │ │ -
464
│ │ │ │ -
465
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
476 {
│ │ │ │ -
477 [[maybe_unused]] const auto &guard =
│ │ │ │ -
478 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ │ -
479 storage_.reserve(capacity);
│ │ │ │ -
480 }
│ │ │ │ -
│ │ │ │ -
481
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
489 {
│ │ │ │ -
490 return storage_.capacity();
│ │ │ │ -
491 }
│ │ │ │ -
│ │ │ │ -
492
│ │ │ │ -
│ │ │ │ -
503 void resize(size_type size)
│ │ │ │ -
504 {
│ │ │ │ -
505 [[maybe_unused]] const auto &guard =
│ │ │ │ -
506 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ │ -
507 storage_.resize(size);
│ │ │ │ -
508 }
│ │ │ │ -
│ │ │ │ -
509
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
512 noexcept(noexcept(std::declval<BlockVector>().storage_ = a.storage_))
│ │ │ │ -
513 {
│ │ │ │ -
514 storage_ = a.storage_;
│ │ │ │ -
515 syncBaseArray();
│ │ │ │ -
516 }
│ │ │ │ -
│ │ │ │ -
517
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
520 noexcept(noexcept(std::declval<BlockVector>().swap(a)))
│ │ │ │ -
521 {
│ │ │ │ -
522 swap(a);
│ │ │ │ -
523 }
│ │ │ │ -
│ │ │ │ -
524
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
527 noexcept(noexcept(std::declval<BlockVector>().storage_ = a.storage_))
│ │ │ │ -
528 {
│ │ │ │ -
529 [[maybe_unused]] const auto &guard =
│ │ │ │ -
530 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ │ -
531 storage_ = a.storage_;
│ │ │ │ -
532 return *this;
│ │ │ │ -
533 }
│ │ │ │ -
│ │ │ │ -
534
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
537 noexcept(noexcept(std::declval<BlockVector>().swap(a)))
│ │ │ │ -
538 {
│ │ │ │ -
539 swap(a);
│ │ │ │ -
540 return *this;
│ │ │ │ -
541 }
│ │ │ │ -
│ │ │ │ -
542
│ │ │ │ -
│ │ │ │ -
544 void swap(BlockVector &other)
│ │ │ │ -
545 noexcept(noexcept(
│ │ │ │ -
546 std::declval<BlockVector&>().storage_.swap(other.storage_)))
│ │ │ │ -
547 {
│ │ │ │ -
548 [[maybe_unused]] const auto &guard = Imp::makeScopeGuard([&]{
│ │ │ │ -
549 syncBaseArray();
│ │ │ │ -
550 other.syncBaseArray();
│ │ │ │ -
551 });
│ │ │ │ -
552 storage_.swap(other.storage_);
│ │ │ │ -
553 }
│ │ │ │ -
│ │ │ │ -
554
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
557 {
│ │ │ │ -
558 // forward to operator= in base class
│ │ │ │ -
559 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ -
560 return *this;
│ │ │ │ -
561 }
│ │ │ │ -
│ │ │ │ -
562
│ │ │ │ -
563 private:
│ │ │ │ -
564 void syncBaseArray() noexcept
│ │ │ │ -
565 {
│ │ │ │ -
566 this->p = storage_.data();
│ │ │ │ -
567 this->n = storage_.size();
│ │ │ │ -
568 }
│ │ │ │ -
569
│ │ │ │ -
570 std::vector<B, A> storage_;
│ │ │ │ -
571 };
│ │ │ │ -
│ │ │ │ -
572
│ │ │ │ -
578 template<class B, class A>
│ │ │ │ -
│ │ │ │ -
579 struct FieldTraits< BlockVector<B, A> >
│ │ │ │ -
580 {
│ │ │ │ -
581 typedef typename FieldTraits<B>::field_type field_type;
│ │ │ │ -
582 typedef typename FieldTraits<B>::real_type real_type;
│ │ │ │ -
583 };
│ │ │ │ -
│ │ │ │ -
589 template<class K, class A>
│ │ │ │ -
│ │ │ │ -
590 std::ostream& operator<< (std::ostream& s, const BlockVector<K, A>& v)
│ │ │ │ -
591 {
│ │ │ │ -
592 typedef typename BlockVector<K, A>::size_type size_type;
│ │ │ │ -
593
│ │ │ │ -
594 for (size_type i=0; i<v.size(); i++)
│ │ │ │ -
595 s << v[i] << std::endl;
│ │ │ │ -
596
│ │ │ │ -
597 return s;
│ │ │ │ -
598 }
│ │ │ │ -
│ │ │ │ -
599
│ │ │ │ -
601namespace Imp {
│ │ │ │ -
602
│ │ │ │ -
621#ifndef DOXYGEN
│ │ │ │ -
622 template<class B, class A>
│ │ │ │ -
623#else
│ │ │ │ -
624 template<class B, class A=std::allocator<B> >
│ │ │ │ -
625#endif
│ │ │ │ -
626 class BlockVectorWindow : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ -
627 {
│ │ │ │ -
628 public:
│ │ │ │ -
629
│ │ │ │ -
630 //===== type definitions and constants
│ │ │ │ -
631
│ │ │ │ -
633 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
634
│ │ │ │ -
636 typedef B block_type;
│ │ │ │ -
637
│ │ │ │ -
639 typedef A allocator_type;
│ │ │ │ -
640
│ │ │ │ -
642 typedef typename A::size_type size_type;
│ │ │ │ -
643
│ │ │ │ -
645 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
646 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ -
647
│ │ │ │ -
649 typedef typename Imp::block_vector_unmanaged<B,A>::Iterator Iterator;
│ │ │ │ -
650
│ │ │ │ -
652 typedef typename Imp::block_vector_unmanaged<B,A>::ConstIterator ConstIterator;
│ │ │ │ -
653
│ │ │ │ -
654
│ │ │ │ -
655 //===== constructors and such
│ │ │ │ -
657 BlockVectorWindow () : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ -
658 { }
│ │ │ │ -
659
│ │ │ │ -
661 BlockVectorWindow (B* _p, size_type _n)
│ │ │ │ -
662 {
│ │ │ │ -
663 this->n = _n;
│ │ │ │ -
664 this->p = _p;
│ │ │ │ -
665 }
│ │ │ │ -
666
│ │ │ │ -
668 BlockVectorWindow (const BlockVectorWindow& a)
│ │ │ │ -
669 {
│ │ │ │ -
670 this->n = a.n;
│ │ │ │ -
671 this->p = a.p;
│ │ │ │ -
672 }
│ │ │ │ -
673
│ │ │ │ -
675 BlockVectorWindow& operator= (const BlockVectorWindow& a)
│ │ │ │ -
676 {
│ │ │ │ -
677 // check correct size
│ │ │ │ -
678#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
679 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ -
680#endif
│ │ │ │ -
681
│ │ │ │ -
682 if (&a!=this) // check if this and a are different objects
│ │ │ │ -
683 {
│ │ │ │ -
684 // copy data
│ │ │ │ -
685 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ -
686 }
│ │ │ │ -
687 return *this;
│ │ │ │ -
688 }
│ │ │ │ -
689
│ │ │ │ -
691 BlockVectorWindow& operator= (const field_type& k)
│ │ │ │ -
692 {
│ │ │ │ -
693 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ -
694 return *this;
│ │ │ │ -
695 }
│ │ │ │ -
696
│ │ │ │ -
698 operator BlockVector<B, A>() const {
│ │ │ │ -
699 auto bv = BlockVector<B, A>(this->n);
│ │ │ │ -
700
│ │ │ │ -
701 std::copy(this->begin(), this->end(), bv.begin());
│ │ │ │ -
702
│ │ │ │ -
703 return bv;
│ │ │ │ -
704 }
│ │ │ │ -
705
│ │ │ │ -
706 //===== window manipulation methods
│ │ │ │ -
707
│ │ │ │ -
709 void set (size_type _n, B* _p)
│ │ │ │ -
710 {
│ │ │ │ -
711 this->n = _n;
│ │ │ │ -
712 this->p = _p;
│ │ │ │ -
713 }
│ │ │ │ -
714
│ │ │ │ -
716 void setsize (size_type _n)
│ │ │ │ -
717 {
│ │ │ │ -
718 this->n = _n;
│ │ │ │ -
719 }
│ │ │ │ -
720
│ │ │ │ -
722 void setptr (B* _p)
│ │ │ │ -
723 {
│ │ │ │ -
724 this->p = _p;
│ │ │ │ -
725 }
│ │ │ │ -
726
│ │ │ │ -
728 B* getptr ()
│ │ │ │ -
729 {
│ │ │ │ -
730 return this->p;
│ │ │ │ -
731 }
│ │ │ │ -
732
│ │ │ │ -
734 size_type getsize () const
│ │ │ │ -
735 {
│ │ │ │ -
736 return this->n;
│ │ │ │ -
737 }
│ │ │ │ -
738 };
│ │ │ │ -
739
│ │ │ │ -
740
│ │ │ │ -
741
│ │ │ │ -
752 template<class B, class A=std::allocator<B> >
│ │ │ │ -
753 class compressed_block_vector_unmanaged : public compressed_base_array_unmanaged<B,A>
│ │ │ │ -
754 {
│ │ │ │ -
755 public:
│ │ │ │ -
756
│ │ │ │ -
757 //===== type definitions and constants
│ │ │ │ -
758
│ │ │ │ -
760 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
761
│ │ │ │ -
763 typedef B block_type;
│ │ │ │ -
764
│ │ │ │ -
766 typedef A allocator_type;
│ │ │ │ -
767
│ │ │ │ -
769 typedef typename compressed_base_array_unmanaged<B,A>::iterator Iterator;
│ │ │ │ -
770
│ │ │ │ -
772 typedef typename compressed_base_array_unmanaged<B,A>::const_iterator ConstIterator;
│ │ │ │ -
773
│ │ │ │ -
775 typedef typename A::size_type size_type;
│ │ │ │ -
776
│ │ │ │ -
777 //===== assignment from scalar
│ │ │ │ -
778
│ │ │ │ -
779 compressed_block_vector_unmanaged& operator= (const field_type& k)
│ │ │ │ -
780 {
│ │ │ │ -
781 for (size_type i=0; i<this->n; i++)
│ │ │ │ -
782 (this->p)[i] = k;
│ │ │ │ -
783 return *this;
│ │ │ │ -
784 }
│ │ │ │ -
785
│ │ │ │ -
786
│ │ │ │ -
787 //===== vector space arithmetic
│ │ │ │ -
788
│ │ │ │ -
790 template<class V>
│ │ │ │ -
791 compressed_block_vector_unmanaged& operator+= (const V& y)
│ │ │ │ -
792 {
│ │ │ │ -
793#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
794 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ -
795#endif
│ │ │ │ -
796 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) += y.p[i];
│ │ │ │ -
797 return *this;
│ │ │ │ -
798 }
│ │ │ │ -
799
│ │ │ │ -
801 template<class V>
│ │ │ │ -
802 compressed_block_vector_unmanaged& operator-= (const V& y)
│ │ │ │ -
803 {
│ │ │ │ -
804#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
805 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ -
806#endif
│ │ │ │ -
807 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) -= y.p[i];
│ │ │ │ -
808 return *this;
│ │ │ │ -
809 }
│ │ │ │ -
810
│ │ │ │ -
812 template<class V>
│ │ │ │ -
813 compressed_block_vector_unmanaged& axpy (const field_type& a, const V& y)
│ │ │ │ -
814 {
│ │ │ │ -
815#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
816 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ -
817#endif
│ │ │ │ -
818 for (size_type i=0; i<y.n; ++i)
│ │ │ │ -
819 Impl::asVector((*this)[y.j[i]]).axpy(a,Impl::asVector(y.p[i]));
│ │ │ │ -
820 return *this;
│ │ │ │ -
821 }
│ │ │ │ -
822
│ │ │ │ -
824 compressed_block_vector_unmanaged& operator*= (const field_type& k)
│ │ │ │ -
825 {
│ │ │ │ -
826 for (size_type i=0; i<this->n; ++i) (this->p)[i] *= k;
│ │ │ │ -
827 return *this;
│ │ │ │ -
828 }
│ │ │ │ -
829
│ │ │ │ -
831 compressed_block_vector_unmanaged& operator/= (const field_type& k)
│ │ │ │ -
832 {
│ │ │ │ -
833 for (size_type i=0; i<this->n; ++i) (this->p)[i] /= k;
│ │ │ │ -
834 return *this;
│ │ │ │ -
835 }
│ │ │ │ -
836
│ │ │ │ -
837
│ │ │ │ -
838 //===== Euclidean scalar product
│ │ │ │ -
839
│ │ │ │ -
841 field_type operator* (const compressed_block_vector_unmanaged& y) const
│ │ │ │ -
842 {
│ │ │ │ -
843#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
844 if (!includesindexset(y) || !y.includesindexset(*this) )
│ │ │ │ -
845 DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ -
846#endif
│ │ │ │ -
847 field_type sum=0;
│ │ │ │ -
848 for (size_type i=0; i<this->n; ++i)
│ │ │ │ -
849 sum += (this->p)[i] * y[(this->j)[i]];
│ │ │ │ -
850 return sum;
│ │ │ │ -
851 }
│ │ │ │ -
852
│ │ │ │ -
853
│ │ │ │ -
854 //===== norms
│ │ │ │ -
855
│ │ │ │ -
857 typename FieldTraits<field_type>::real_type one_norm () const
│ │ │ │ -
858 {
│ │ │ │ -
859 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
860 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm();
│ │ │ │ -
861 return sum;
│ │ │ │ -
862 }
│ │ │ │ -
863
│ │ │ │ -
865 typename FieldTraits<field_type>::real_type one_norm_real () const
│ │ │ │ -
866 {
│ │ │ │ -
867 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
868 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm_real();
│ │ │ │ -
869 return sum;
│ │ │ │ -
870 }
│ │ │ │ -
871
│ │ │ │ -
873 typename FieldTraits<field_type>::real_type two_norm () const
│ │ │ │ -
874 {
│ │ │ │ -
875 using std::sqrt;
│ │ │ │ -
876 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
877 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
│ │ │ │ -
878 return sqrt(sum);
│ │ │ │ -
879 }
│ │ │ │ -
880
│ │ │ │ -
882 typename FieldTraits<field_type>::real_type two_norm2 () const
│ │ │ │ -
883 {
│ │ │ │ -
884 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
885 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
│ │ │ │ -
886 return sum;
│ │ │ │ -
887 }
│ │ │ │ -
888
│ │ │ │ -
890 template <typename ft = field_type,
│ │ │ │ -
891 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
892 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
893 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
894 using std::max;
│ │ │ │ -
895
│ │ │ │ -
896 real_type norm = 0;
│ │ │ │ -
897 for (auto const &x : *this) {
│ │ │ │ -
898 real_type const a = x.infinity_norm();
│ │ │ │ -
899 norm = max(a, norm);
│ │ │ │ -
900 }
│ │ │ │ -
901 return norm;
│ │ │ │ -
902 }
│ │ │ │ -
903
│ │ │ │ -
905 template <typename ft = field_type,
│ │ │ │ -
906 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
907 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
908 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
909 using std::max;
│ │ │ │ -
910
│ │ │ │ -
911 real_type norm = 0;
│ │ │ │ -
912 for (auto const &x : *this) {
│ │ │ │ -
913 real_type const a = x.infinity_norm_real();
│ │ │ │ -
914 norm = max(a, norm);
│ │ │ │ -
915 }
│ │ │ │ -
916 return norm;
│ │ │ │ -
917 }
│ │ │ │ -
918
│ │ │ │ -
920 template <typename ft = field_type,
│ │ │ │ -
921 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
922 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
923 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
924 using std::max;
│ │ │ │ -
925
│ │ │ │ -
926 real_type norm = 0;
│ │ │ │ -
927 real_type isNaN = 1;
│ │ │ │ -
928 for (auto const &x : *this) {
│ │ │ │ -
929 real_type const a = x.infinity_norm();
│ │ │ │ -
930 norm = max(a, norm);
│ │ │ │ -
931 isNaN += a;
│ │ │ │ -
932 }
│ │ │ │ -
933 return norm * (isNaN / isNaN);
│ │ │ │ -
934 }
│ │ │ │ -
935
│ │ │ │ -
937 template <typename ft = field_type,
│ │ │ │ -
938 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
939 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
940 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
941 using std::max;
│ │ │ │ -
942
│ │ │ │ -
943 real_type norm = 0;
│ │ │ │ -
944 real_type isNaN = 1;
│ │ │ │ -
945 for (auto const &x : *this) {
│ │ │ │ -
946 real_type const a = x.infinity_norm_real();
│ │ │ │ -
947 norm = max(a, norm);
│ │ │ │ -
948 isNaN += a;
│ │ │ │ -
949 }
│ │ │ │ -
950 return norm * (isNaN / isNaN);
│ │ │ │ -
951 }
│ │ │ │ -
952
│ │ │ │ -
953 //===== sizes
│ │ │ │ -
954
│ │ │ │ -
956 size_type N () const
│ │ │ │ -
957 {
│ │ │ │ -
958 return this->n;
│ │ │ │ -
959 }
│ │ │ │ -
960
│ │ │ │ -
962 size_type dim () const
│ │ │ │ -
963 {
│ │ │ │ -
964 size_type d=0;
│ │ │ │ -
965 for (size_type i=0; i<this->n; i++)
│ │ │ │ -
966 d += (this->p)[i].dim();
│ │ │ │ -
967 return d;
│ │ │ │ -
968 }
│ │ │ │ -
969
│ │ │ │ -
970 protected:
│ │ │ │ -
972 compressed_block_vector_unmanaged () : compressed_base_array_unmanaged<B,A>()
│ │ │ │ -
973 { }
│ │ │ │ -
974
│ │ │ │ -
976 template<class V>
│ │ │ │ -
977 bool includesindexset (const V& y)
│ │ │ │ -
978 {
│ │ │ │ -
979 typename V::ConstIterator e=this->end();
│ │ │ │ -
980 for (size_type i=0; i<y.n; i++)
│ │ │ │ -
981 if (this->find(y.j[i])==e)
│ │ │ │ -
982 return false;
│ │ │ │ -
983 return true;
│ │ │ │ -
984 }
│ │ │ │ -
985 };
│ │ │ │ -
986
│ │ │ │ -
987
│ │ │ │ -
1006 template<class B, class A=std::allocator<B> >
│ │ │ │ -
1007 class CompressedBlockVectorWindow : public compressed_block_vector_unmanaged<B,A>
│ │ │ │ -
1008 {
│ │ │ │ -
1009 public:
│ │ │ │ -
1010
│ │ │ │ -
1011 //===== type definitions and constants
│ │ │ │ -
1012
│ │ │ │ -
1014 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
1015
│ │ │ │ -
1017 typedef B block_type;
│ │ │ │ -
1018
│ │ │ │ -
1020 typedef A allocator_type;
│ │ │ │ -
1021
│ │ │ │ -
1023 typedef typename A::size_type size_type;
│ │ │ │ -
1024
│ │ │ │ -
1026 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
1027 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ -
1028
│ │ │ │ -
1030 typedef typename compressed_block_vector_unmanaged<B,A>::Iterator Iterator;
│ │ │ │ -
1031
│ │ │ │ -
1033 typedef typename compressed_block_vector_unmanaged<B,A>::ConstIterator ConstIterator;
│ │ │ │ -
1034
│ │ │ │ -
1035
│ │ │ │ -
1036 //===== constructors and such
│ │ │ │ -
1038 CompressedBlockVectorWindow () : compressed_block_vector_unmanaged<B,A>()
│ │ │ │ -
1039 { }
│ │ │ │ -
1040
│ │ │ │ -
1042 CompressedBlockVectorWindow (B* _p, size_type* _j, size_type _n)
│ │ │ │ -
1043 {
│ │ │ │ -
1044 this->n = _n;
│ │ │ │ -
1045 this->p = _p;
│ │ │ │ -
1046 this->j = _j;
│ │ │ │ -
1047 }
│ │ │ │ -
1048
│ │ │ │ -
1050 CompressedBlockVectorWindow (const CompressedBlockVectorWindow& a)
│ │ │ │ -
1051 {
│ │ │ │ -
1052 this->n = a.n;
│ │ │ │ -
1053 this->p = a.p;
│ │ │ │ -
1054 this->j = a.j;
│ │ │ │ -
1055 }
│ │ │ │ -
1056
│ │ │ │ -
1058 CompressedBlockVectorWindow& operator= (const CompressedBlockVectorWindow& a)
│ │ │ │ -
1059 {
│ │ │ │ -
1060 // check correct size
│ │ │ │ -
1061#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1062 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ -
1063#endif
│ │ │ │ -
1064
│ │ │ │ -
1065 if (&a!=this) // check if this and a are different objects
│ │ │ │ -
1066 {
│ │ │ │ -
1067 // copy data
│ │ │ │ -
1068 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ -
1069 for (size_type i=0; i<this->n; i++) this->j[i]=a.j[i];
│ │ │ │ -
1070 }
│ │ │ │ -
1071 return *this;
│ │ │ │ -
1072 }
│ │ │ │ -
1073
│ │ │ │ -
1075 CompressedBlockVectorWindow& operator= (const field_type& k)
│ │ │ │ -
1076 {
│ │ │ │ -
1077 (static_cast<compressed_block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ -
1078 return *this;
│ │ │ │ -
1079 }
│ │ │ │ -
1080
│ │ │ │ -
1081
│ │ │ │ -
1082 //===== window manipulation methods
│ │ │ │ -
1083
│ │ │ │ -
1085 void set (size_type _n, B* _p, size_type* _j)
│ │ │ │ -
1086 {
│ │ │ │ -
1087 this->n = _n;
│ │ │ │ -
1088 this->p = _p;
│ │ │ │ -
1089 this->j = _j;
│ │ │ │ -
1090 }
│ │ │ │ -
1091
│ │ │ │ -
1093 void setsize (size_type _n)
│ │ │ │ -
1094 {
│ │ │ │ -
1095 this->n = _n;
│ │ │ │ -
1096 }
│ │ │ │ -
1097
│ │ │ │ -
1099 void setptr (B* _p)
│ │ │ │ -
1100 {
│ │ │ │ -
1101 this->p = _p;
│ │ │ │ -
1102 }
│ │ │ │ -
1103
│ │ │ │ -
1105 void setindexptr (size_type* _j)
│ │ │ │ -
1106 {
│ │ │ │ -
1107 this->j = _j;
│ │ │ │ -
1108 }
│ │ │ │ -
1109
│ │ │ │ -
1111 B* getptr ()
│ │ │ │ -
1112 {
│ │ │ │ -
1113 return this->p;
│ │ │ │ -
1114 }
│ │ │ │ -
1115
│ │ │ │ -
1117 size_type* getindexptr ()
│ │ │ │ -
1118 {
│ │ │ │ -
1119 return this->j;
│ │ │ │ -
1120 }
│ │ │ │ -
1121
│ │ │ │ -
1123 const B* getptr () const
│ │ │ │ -
1124 {
│ │ │ │ -
1125 return this->p;
│ │ │ │ -
1126 }
│ │ │ │ -
1127
│ │ │ │ -
1129 const size_type* getindexptr () const
│ │ │ │ -
1130 {
│ │ │ │ -
1131 return this->j;
│ │ │ │ -
1132 }
│ │ │ │ -
1134 size_type getsize () const
│ │ │ │ -
1135 {
│ │ │ │ -
1136 return this->n;
│ │ │ │ -
1137 }
│ │ │ │ -
1138 };
│ │ │ │ -
1139
│ │ │ │ -
1140} // end namespace 'Imp'
│ │ │ │ -
1141
│ │ │ │ -
1142
│ │ │ │ -
1144 template<typename B, typename A>
│ │ │ │ -
1145 struct AutonomousValueType<Imp::BlockVectorWindow<B,A>>
│ │ │ │ -
1146 {
│ │ │ │ -
1147 using type = BlockVector<B, A>;
│ │ │ │ -
1148 };
│ │ │ │ -
1149
│ │ │ │ -
1150
│ │ │ │ -
1151} // end namespace 'Dune'
│ │ │ │ -
1152
│ │ │ │ -
1153#endif
│ │ │ │ -
Helper functions for determining the vector/matrix block level.
│ │ │ │ - │ │ │ │ -
Implements several basic array containers.
│ │ │ │ -
STL namespace.
│ │ │ │ +
364 private:
│ │ │ │ +
366 std::shared_ptr<P> _preconditioner;
│ │ │ │ +
367
│ │ │ │ +
369 const communication_type& _communication;
│ │ │ │ +
370 };
│ │ │ │ +
│ │ │ │ +
371
│ │ │ │ +
374} // end namespace
│ │ │ │ +
375
│ │ │ │ +
376#endif
│ │ │ │ +
Define general preconditioner interface.
│ │ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ +
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
Implementations of the inverse operator interface.
│ │ │ │ +
The incomplete LU factorization kernels.
│ │ │ │ + │ │ │ │ +
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ +
Define base class for scalar product and norm.
│ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:590
│ │ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ -
BlockVector()
makes empty vector
Definition bvector.hh:425
│ │ │ │ -
void reserve(size_type capacity)
Reserve space.
Definition bvector.hh:475
│ │ │ │ -
BlockVector(BlockVector &&a) noexcept(noexcept(std::declval< BlockVector >().swap(a)))
move constructor
Definition bvector.hh:519
│ │ │ │ -
BlockVector(size_type _n)
make vector with _n components
Definition bvector.hh:431
│ │ │ │ -
void resize(size_type size)
Resize the vector.
Definition bvector.hh:503
│ │ │ │ -
Imp::block_vector_unmanaged< B, A >::Iterator Iterator
make iterators available as types
Definition bvector.hh:417
│ │ │ │ -
static constexpr unsigned int blocklevel
increment block level counter
Definition bvector.hh:414
│ │ │ │ -
BlockVector(const BlockVector &a) noexcept(noexcept(std::declval< BlockVector >().storage_=a.storage_))
copy constructor
Definition bvector.hh:511
│ │ │ │ -
A allocator_type
export the allocator type
Definition bvector.hh:407
│ │ │ │ -
BlockVector & operator=(const BlockVector &a) noexcept(noexcept(std::declval< BlockVector >().storage_=a.storage_))
assignment
Definition bvector.hh:526
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:401
│ │ │ │ -
A::size_type size_type
The type for the index access.
Definition bvector.hh:410
│ │ │ │ -
BlockVector(std::initializer_list< B > const &l)
Construct from a std::initializer_list.
Definition bvector.hh:437
│ │ │ │ -
size_type capacity() const
Get the capacity of the vector.
Definition bvector.hh:488
│ │ │ │ -
BlockVector(size_type _n, S _capacity)
Make vector with _n components but preallocating capacity components.
Definition bvector.hh:455
│ │ │ │ -
B block_type
export the type representing the components
Definition bvector.hh:404
│ │ │ │ -
void swap(BlockVector &other) noexcept(noexcept(std::declval< BlockVector & >().storage_.swap(other.storage_)))
swap operation
Definition bvector.hh:544
│ │ │ │ -
Imp::block_vector_unmanaged< B, A >::ConstIterator ConstIterator
make iterators available as types
Definition bvector.hh:420
│ │ │ │ -
FieldTraits< B >::real_type real_type
Definition bvector.hh:582
│ │ │ │ -
FieldTraits< B >::field_type field_type
Definition bvector.hh:581
│ │ │ │ +
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │ +
C::PIS PIS
Definition novlpschwarz.hh:74
│ │ │ │ +
C communication_type
The type of the communication object.
Definition novlpschwarz.hh:72
│ │ │ │ +
std::multimap< int, std::pair< int, RILIterator > > RIMap
Definition novlpschwarz.hh:82
│ │ │ │ +
C::RI RI
Definition novlpschwarz.hh:75
│ │ │ │ +
void novlp_op_apply(const X &x, Y &y, field_type alpha) const
Definition novlpschwarz.hh:126
│ │ │ │ +
NonoverlappingSchwarzOperator(std::shared_ptr< const matrix_type > A, const communication_type &com)
Definition novlpschwarz.hh:96
│ │ │ │ +
M::ConstColIterator ColIterator
Definition novlpschwarz.hh:79
│ │ │ │ +
virtual void apply(const X &x, Y &y) const
apply operator to x:
Definition novlpschwarz.hh:101
│ │ │ │ +
X domain_type
The type of the domain.
Definition novlpschwarz.hh:66
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the linear operator (see SolverCategory::Category)
Definition novlpschwarz.hh:235
│ │ │ │ +
RIMap::iterator RIMapit
Definition novlpschwarz.hh:83
│ │ │ │ +
virtual const matrix_type & getmat() const
get matrix via *
Definition novlpschwarz.hh:121
│ │ │ │ +
RIL::const_iterator RILIterator
Definition novlpschwarz.hh:78
│ │ │ │ +
std::multimap< int, int > MM
Definition novlpschwarz.hh:81
│ │ │ │ +
Y range_type
The type of the range.
Definition novlpschwarz.hh:68
│ │ │ │ +
M matrix_type
The type of the matrix we operate on.
Definition novlpschwarz.hh:64
│ │ │ │ +
M::ConstRowIterator RowIterator
Definition novlpschwarz.hh:80
│ │ │ │ +
const communication_type & getCommunication() const
Get the object responsible for communication.
Definition novlpschwarz.hh:241
│ │ │ │ +
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const
apply operator to x, scale and add:
Definition novlpschwarz.hh:109
│ │ │ │ +
RI::RemoteIndexList RIL
Definition novlpschwarz.hh:76
│ │ │ │ +
X::field_type field_type
The field type of the range.
Definition novlpschwarz.hh:70
│ │ │ │ +
NonoverlappingSchwarzOperator(const matrix_type &A, const communication_type &com)
constructor: just store a reference to a matrix.
Definition novlpschwarz.hh:92
│ │ │ │ +
RI::const_iterator RIIterator
Definition novlpschwarz.hh:77
│ │ │ │ +
Nonoverlapping parallel preconditioner.
Definition novlpschwarz.hh:276
│ │ │ │ +
NonoverlappingBlockPreconditioner(P &p, const communication_type &c)
Constructor.
Definition novlpschwarz.hh:302
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition novlpschwarz.hh:359
│ │ │ │ +
virtual void apply(domain_type &v, const range_type &d)
Apply the preconditioner.
Definition novlpschwarz.hh:332
│ │ │ │ +
P::range_type range_type
The range type of the preconditioner.
Definition novlpschwarz.hh:284
│ │ │ │ +
NonoverlappingBlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c)
Constructor.
Definition novlpschwarz.hh:313
│ │ │ │ +
virtual void post(domain_type &x)
Clean up.
Definition novlpschwarz.hh:353
│ │ │ │ +
C communication_type
The type of the communication object.
Definition novlpschwarz.hh:286
│ │ │ │ +
virtual void pre(domain_type &x, range_type &b)
Prepare the preconditioner.
Definition novlpschwarz.hh:322
│ │ │ │ +
void apply(X &v, const Y &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition novlpschwarz.hh:342
│ │ │ │ +
P::domain_type domain_type
The domain type of the preconditioner.
Definition novlpschwarz.hh:282
│ │ │ │ +
A linear operator exporting itself in matrix form.
Definition operators.hh:109
│ │ │ │ +
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ │ +
@ copy
Definition owneroverlapcopy.hh:61
│ │ │ │ +
@ overlap
Definition owneroverlapcopy.hh:61
│ │ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
@ nonoverlapping
Category for non-overlapping solvers.
Definition solvercategory.hh:27
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1010 +1,474 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -bvector.hh │ │ │ │ │ +novlpschwarz.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 (C) 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_BVECTOR_HH │ │ │ │ │ -7#define DUNE_ISTL_BVECTOR_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17 │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22#include │ │ │ │ │ -23#include │ │ │ │ │ -24#include │ │ │ │ │ -25 │ │ │ │ │ -26#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -27 │ │ │ │ │ -28#include "_b_a_s_e_a_r_r_a_y_._h_h" │ │ │ │ │ -29#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -30 │ │ │ │ │ -38namespace _D_u_n_e { │ │ │ │ │ -39 │ │ │ │ │ -41namespace Imp { │ │ │ │ │ -42 │ │ │ │ │ -48 template │ │ │ │ │ -49 class BlockTraitsImp; │ │ │ │ │ -50 │ │ │ │ │ -51 template │ │ │ │ │ -52 class BlockTraitsImp │ │ │ │ │ -53 { │ │ │ │ │ -54 public: │ │ │ │ │ -55 using field_type = B; │ │ │ │ │ -56 }; │ │ │ │ │ -57 │ │ │ │ │ -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 A allocator_type; │ │ │ │ │ -96 │ │ │ │ │ -98 typedef typename A::size_type size_type; │ │ │ │ │ +5#ifndef DUNE_ISTL_NOVLPSCHWARZ_HH │ │ │ │ │ +6#define DUNE_ISTL_NOVLPSCHWARZ_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 │ │ │ │ │ +16 │ │ │ │ │ +17#include │ │ │ │ │ +18 │ │ │ │ │ +19#include "_i_o_._h_h" │ │ │ │ │ +20#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ +21#include "_v_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ +22#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ │ +23#include "_i_o_._h_h" │ │ │ │ │ +24#include "_g_s_e_t_c_._h_h" │ │ │ │ │ +25#include "_i_l_u_._h_h" │ │ │ │ │ +26#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ │ +27#include "_s_o_l_v_e_r_s_._h_h" │ │ │ │ │ +28#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ │ +29#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ │ +30#include "_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h" │ │ │ │ │ +31 │ │ │ │ │ +32namespace _D_u_n_e { │ │ │ │ │ +33 │ │ │ │ │ +59 template │ │ │ │ │ +_6_0 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 : public _A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ +61 { │ │ │ │ │ +62 public: │ │ │ │ │ +_6_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_6_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_6_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_7_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_7_2 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ +73 │ │ │ │ │ +_7_4 typedef typename C::PIS _P_I_S; │ │ │ │ │ +_7_5 typedef typename C::RI _R_I; │ │ │ │ │ +_7_6 typedef typename RI::RemoteIndexList _R_I_L; │ │ │ │ │ +_7_7 typedef typename RI::const_iterator _R_I_I_t_e_r_a_t_o_r; │ │ │ │ │ +_7_8 typedef typename RIL::const_iterator _R_I_L_I_t_e_r_a_t_o_r; │ │ │ │ │ +_7_9 typedef typename M::ConstColIterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +_8_0 typedef typename M::ConstRowIterator _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ +_8_1 typedef std::multimap _M_M; │ │ │ │ │ +_8_2 typedef std::multimap > _R_I_M_a_p; │ │ │ │ │ +_8_3 typedef typename RIMap::iterator _R_I_M_a_p_i_t; │ │ │ │ │ +84 │ │ │ │ │ +_9_2 _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 (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) │ │ │ │ │ +93 : _A_(stackobject_to_shared_ptr(A)), communication(com), buildcomm(true) │ │ │ │ │ +94 {} │ │ │ │ │ +95 │ │ │ │ │ +_9_6 _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 (std::shared_ptr A, const │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& com) │ │ │ │ │ +97 : _A_(A), communication(com), buildcomm(true) │ │ │ │ │ +98 {} │ │ │ │ │ 99 │ │ │ │ │ -101 typedef typename base_array_unmanaged::iterator Iterator; │ │ │ │ │ -102 │ │ │ │ │ -104 typedef typename base_array_unmanaged::const_iterator ConstIterator; │ │ │ │ │ -105 │ │ │ │ │ -107 typedef B value_type; │ │ │ │ │ -108 │ │ │ │ │ -110 typedef B& reference; │ │ │ │ │ -111 │ │ │ │ │ -113 typedef const B& const_reference; │ │ │ │ │ -114 │ │ │ │ │ -115 //===== assignment from scalar │ │ │ │ │ -117 │ │ │ │ │ -118 block_vector_unmanaged& operator= (const field_type& k) │ │ │ │ │ -119 { │ │ │ │ │ -120 for (size_type i=0; in; i++) │ │ │ │ │ -121 (*this)[i] = k; │ │ │ │ │ -122 return *this; │ │ │ │ │ -123 } │ │ │ │ │ -124 │ │ │ │ │ -125 //===== vector space arithmetic │ │ │ │ │ -127 block_vector_unmanaged& operator+= (const block_vector_unmanaged& y) │ │ │ │ │ -128 { │ │ │ │ │ -129#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -130 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ -131#endif │ │ │ │ │ -132 for (size_type i=0; in; ++i) (*this)[i] += y[i]; │ │ │ │ │ -133 return *this; │ │ │ │ │ -134 } │ │ │ │ │ -135 │ │ │ │ │ -137 block_vector_unmanaged& operator-= (const block_vector_unmanaged& y) │ │ │ │ │ -138 { │ │ │ │ │ -139#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -140 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ -141#endif │ │ │ │ │ -142 for (size_type i=0; in; ++i) (*this)[i] -= y[i]; │ │ │ │ │ -143 return *this; │ │ │ │ │ -144 } │ │ │ │ │ -145 │ │ │ │ │ -147 block_vector_unmanaged& operator*= (const field_type& k) │ │ │ │ │ -148 { │ │ │ │ │ -149 for (size_type i=0; in; ++i) (*this)[i] *= k; │ │ │ │ │ -150 return *this; │ │ │ │ │ -151 } │ │ │ │ │ -152 │ │ │ │ │ -154 block_vector_unmanaged& operator/= (const field_type& k) │ │ │ │ │ -155 { │ │ │ │ │ -156 for (size_type i=0; in; ++i) (*this)[i] /= k; │ │ │ │ │ -157 return *this; │ │ │ │ │ -158 } │ │ │ │ │ -159 │ │ │ │ │ -161 block_vector_unmanaged& axpy (const field_type& a, const │ │ │ │ │ -block_vector_unmanaged& y) │ │ │ │ │ -162 { │ │ │ │ │ -163#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -164 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ -165#endif │ │ │ │ │ -166 for (size_type i=0; in; ++i) │ │ │ │ │ -167 Impl::asVector((*this)[i]).axpy(a,Impl::asVector(y[i])); │ │ │ │ │ -168 │ │ │ │ │ -169 return *this; │ │ │ │ │ +_1_0_1 virtual void _a_p_p_l_y (const X& x, Y& y) const │ │ │ │ │ +102 { │ │ │ │ │ +103 y = 0; │ │ │ │ │ +104 _n_o_v_l_p___o_p___a_p_p_l_y(x,y,1); │ │ │ │ │ +105 communication.addOwnerCopyToOwnerCopy(y,y); │ │ │ │ │ +106 } │ │ │ │ │ +107 │ │ │ │ │ +_1_0_9 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (_f_i_e_l_d___t_y_p_e alpha, const X& x, Y& y) const │ │ │ │ │ +110 { │ │ │ │ │ +111 // only apply communication to alpha*A*x to make it consistent, │ │ │ │ │ +112 // y already has to be consistent. │ │ │ │ │ +113 Y y1(y); │ │ │ │ │ +114 y = 0; │ │ │ │ │ +115 _n_o_v_l_p___o_p___a_p_p_l_y(x,y,alpha); │ │ │ │ │ +116 communication.addOwnerCopyToOwnerCopy(y,y); │ │ │ │ │ +117 y += y1; │ │ │ │ │ +118 } │ │ │ │ │ +119 │ │ │ │ │ +_1_2_1 virtual const _m_a_t_r_i_x___t_y_p_e& _g_e_t_m_a_t () const │ │ │ │ │ +122 { │ │ │ │ │ +123 return *_A_; │ │ │ │ │ +124 } │ │ │ │ │ +125 │ │ │ │ │ +_1_2_6 void _n_o_v_l_p___o_p___a_p_p_l_y (const X& x, Y& y, _f_i_e_l_d___t_y_p_e alpha) const │ │ │ │ │ +127 { │ │ │ │ │ +128 //get index sets │ │ │ │ │ +129 const _P_I_S& pis=communication.indexSet(); │ │ │ │ │ +130 const _R_I& ri = communication.remoteIndices(); │ │ │ │ │ +131 │ │ │ │ │ +132 // at the beginning make a multimap "bordercontribution". │ │ │ │ │ +133 // process has i and j as border dofs but is not the owner │ │ │ │ │ +134 // => only contribute to Ax if i,j is in bordercontribution │ │ │ │ │ +135 if (buildcomm == true) { │ │ │ │ │ +136 │ │ │ │ │ +137 // set up mask vector │ │ │ │ │ +138 if (mask.size()!=static_cast::size_type> │ │ │ │ │ +(x.size())) { │ │ │ │ │ +139 mask.resize(x.size()); │ │ │ │ │ +140 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_:_:_c_o_p_y) │ │ │ │ │ +144 mask[i->local().local()] = 0; │ │ │ │ │ +145 else 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_:_:_o_v_e_r_l_a_p) │ │ │ │ │ +146 mask[i->local().local()] = 2; │ │ │ │ │ +147 } │ │ │ │ │ +148 │ │ │ │ │ +149 for (MM::iterator iter = bordercontribution.begin(); │ │ │ │ │ +150 iter != bordercontribution.end(); ++iter) │ │ │ │ │ +151 bordercontribution.erase(iter); │ │ │ │ │ +152 std::map owner; //key: local index i, value: process, that owns i │ │ │ │ │ +153 _R_I_M_a_p rimap; │ │ │ │ │ +154 │ │ │ │ │ +155 // for each local index make multimap rimap: │ │ │ │ │ +156 // key: local index i, data: pair of process that knows i and pointer to RI │ │ │ │ │ +entry │ │ │ │ │ +157 for (_R_o_w_I_t_e_r_a_t_o_r i = _A_->begin(); i != _A_->end(); ++i) │ │ │ │ │ +158 if (mask[i.index()] == 0) │ │ │ │ │ +159 for (_R_I_I_t_e_r_a_t_o_r remote = ri.begin(); remote != ri.end(); ++remote) { │ │ │ │ │ +160 _R_I_L& ril = *(remote->second.first); │ │ │ │ │ +161 for (_R_I_L_I_t_e_r_a_t_o_r rindex = ril.begin(); rindex != ril.end(); ++rindex) │ │ │ │ │ +162 if (rindex->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_v_e_r_l_a_p) │ │ │ │ │ +163 if (rindex->localIndexPair().local().local() == i.index()) { │ │ │ │ │ +164 rimap.insert │ │ │ │ │ +165 (std::make_pair(i.index(), │ │ │ │ │ +166 std::pair(remote->first, rindex))); │ │ │ │ │ +167 if(rindex->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) │ │ │ │ │ +168 owner.insert(std::make_pair(i.index(),remote->first)); │ │ │ │ │ +169 } │ │ │ │ │ 170 } │ │ │ │ │ 171 │ │ │ │ │ -172 │ │ │ │ │ -180 template │ │ │ │ │ -181 auto operator* (const block_vector_unmanaged& y) const │ │ │ │ │ -182 { │ │ │ │ │ -183 typedef typename PromotionTraits:: │ │ │ │ │ -field_type>::PromotedType PromotedType; │ │ │ │ │ -184 PromotedType sum(0); │ │ │ │ │ -185#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -186 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ -187#endif │ │ │ │ │ -188 for (size_type i=0; in; ++i) { │ │ │ │ │ -189 sum += PromotedType(((*this)[i])*y[i]); │ │ │ │ │ +172 int iowner = 0; │ │ │ │ │ +173 for (_R_o_w_I_t_e_r_a_t_o_r i = _A_->begin(); i != _A_->end(); ++i) { │ │ │ │ │ +174 if (mask[i.index()] == 0) { │ │ │ │ │ +175 std::map::iterator it = owner.find(i.index()); │ │ │ │ │ +176 iowner = it->second; │ │ │ │ │ +177 std::pair foundiit = rimap.equal_range(i.index()); │ │ │ │ │ +178 for (_C_o_l_I_t_e_r_a_t_o_r j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end │ │ │ │ │ +(); ++j) { │ │ │ │ │ +179 if (mask[j.index()] == 0) { │ │ │ │ │ +180 bool flag = true; │ │ │ │ │ +181 for (_R_I_M_a_p_i_t foundi = foundiit.first; foundi != foundiit.second; ++foundi) │ │ │ │ │ +{ │ │ │ │ │ +182 std::pair foundjit = rimap.equal_range(j.index()); │ │ │ │ │ +183 for (_R_I_M_a_p_i_t foundj = foundjit.first; foundj != foundjit.second; ++foundj) │ │ │ │ │ +184 if (foundj->second.first == foundi->second.first) │ │ │ │ │ +185 if (foundj->second.second->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 │ │ │ │ │ +186 || foundj->second.first == iowner │ │ │ │ │ +187 || foundj->second.first < communication.communicator().rank()) { │ │ │ │ │ +188 flag = false; │ │ │ │ │ +189 continue; │ │ │ │ │ 190 } │ │ │ │ │ -191 return sum; │ │ │ │ │ -192 } │ │ │ │ │ -193 │ │ │ │ │ -201 template │ │ │ │ │ -202 auto dot(const block_vector_unmanaged& y) const │ │ │ │ │ -203 { │ │ │ │ │ -204 typedef typename PromotionTraits:: │ │ │ │ │ -field_type>::PromotedType PromotedType; │ │ │ │ │ -205 PromotedType sum(0); │ │ │ │ │ -206#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -207 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ -208#endif │ │ │ │ │ +191 if (flag == false) │ │ │ │ │ +192 continue; │ │ │ │ │ +193 } │ │ │ │ │ +194 // don´t contribute to Ax if │ │ │ │ │ +195 // 1. the owner of j has i as interior/border dof │ │ │ │ │ +196 // 2. iowner has j as interior/border dof │ │ │ │ │ +197 // 3. there is another process with smaller rank that has i and j │ │ │ │ │ +198 // as interor/border dofs │ │ │ │ │ +199 // if the owner of j does not have i as interior/border dof, │ │ │ │ │ +200 // it will not be taken into account │ │ │ │ │ +201 if (flag==true) │ │ │ │ │ +202 bordercontribution.insert(std::pair(i.index(),j.index())); │ │ │ │ │ +203 } │ │ │ │ │ +204 } │ │ │ │ │ +205 } │ │ │ │ │ +206 } │ │ │ │ │ +207 buildcomm = false; │ │ │ │ │ +208 } │ │ │ │ │ 209 │ │ │ │ │ -210 for (size_type i=0; in; ++i) │ │ │ │ │ -211 sum += Impl::asVector((*this)[i]).dot(Impl::asVector(y[i])); │ │ │ │ │ -212 │ │ │ │ │ -213 return sum; │ │ │ │ │ -214 } │ │ │ │ │ -215 │ │ │ │ │ -216 //===== norms │ │ │ │ │ -217 │ │ │ │ │ -219 typename FieldTraits::real_type one_norm () const │ │ │ │ │ -220 { │ │ │ │ │ -221 typename FieldTraits::real_type sum=0; │ │ │ │ │ -222 for (size_type i=0; in; ++i) │ │ │ │ │ -223 sum += Impl::asVector((*this)[i]).one_norm(); │ │ │ │ │ -224 return sum; │ │ │ │ │ +210 //compute alpha*A*x nonoverlapping case │ │ │ │ │ +211 for (_R_o_w_I_t_e_r_a_t_o_r i = _A_->begin(); i != _A_->end(); ++i) { │ │ │ │ │ +212 if (mask[i.index()] == 0) { │ │ │ │ │ +213 //dof doesn't belong to process but is border (not ghost) │ │ │ │ │ +214 for (_C_o_l_I_t_e_r_a_t_o_r j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end │ │ │ │ │ +(); ++j) { │ │ │ │ │ +215 if (mask[j.index()] == 1) //j is owner => then sum entries │ │ │ │ │ +216 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]); │ │ │ │ │ +217 else if (mask[j.index()] == 0) { │ │ │ │ │ +218 std::pair itp = │ │ │ │ │ +219 bordercontribution.equal_range(i.index()); │ │ │ │ │ +220 for (MM::iterator it = itp.first; it != itp.second; ++it) │ │ │ │ │ +221 if ((*it).second == (int)j.index()) │ │ │ │ │ +222 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]); │ │ │ │ │ +223 } │ │ │ │ │ +224 } │ │ │ │ │ 225 } │ │ │ │ │ -226 │ │ │ │ │ -228 typename FieldTraits::real_type one_norm_real () const │ │ │ │ │ -229 { │ │ │ │ │ -230 typename FieldTraits::real_type sum=0; │ │ │ │ │ -231 for (size_type i=0; in; ++i) │ │ │ │ │ -232 sum += Impl::asVector((*this)[i]).one_norm_real(); │ │ │ │ │ -233 return sum; │ │ │ │ │ -234 } │ │ │ │ │ -235 │ │ │ │ │ -237 typename FieldTraits::real_type two_norm () const │ │ │ │ │ -238 { │ │ │ │ │ -239 using std::sqrt; │ │ │ │ │ -240 return sqrt(two_norm2()); │ │ │ │ │ -241 } │ │ │ │ │ -242 │ │ │ │ │ -244 typename FieldTraits::real_type two_norm2 () const │ │ │ │ │ -245 { │ │ │ │ │ -246 typename FieldTraits::real_type sum=0; │ │ │ │ │ -247 for (size_type i=0; in; ++i) │ │ │ │ │ -248 sum += Impl::asVector((*this)[i]).two_norm2(); │ │ │ │ │ -249 return sum; │ │ │ │ │ -250 } │ │ │ │ │ -251 │ │ │ │ │ -253 template ::value, int>::type = 0> │ │ │ │ │ -255 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ -256 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -257 using std::max; │ │ │ │ │ -258 │ │ │ │ │ -259 real_type norm = 0; │ │ │ │ │ -260 for (auto const &xi : *this) { │ │ │ │ │ -261 real_type const a = Impl::asVector(xi).infinity_norm(); │ │ │ │ │ -262 norm = max(a, norm); │ │ │ │ │ -263 } │ │ │ │ │ -264 return norm; │ │ │ │ │ -265 } │ │ │ │ │ -266 │ │ │ │ │ -268 template ::value, int>::type = 0> │ │ │ │ │ -270 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ -271 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -272 using std::max; │ │ │ │ │ -273 │ │ │ │ │ -274 real_type norm = 0; │ │ │ │ │ -275 for (auto const &xi : *this) { │ │ │ │ │ -276 real_type const a = Impl::asVector(xi).infinity_norm_real(); │ │ │ │ │ -277 norm = max(a, norm); │ │ │ │ │ -278 } │ │ │ │ │ -279 return norm; │ │ │ │ │ -280 } │ │ │ │ │ -281 │ │ │ │ │ -283 template ::value, int>::type = 0> │ │ │ │ │ -285 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ -286 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -287 using std::max; │ │ │ │ │ -288 using std::abs; │ │ │ │ │ -289 │ │ │ │ │ -290 real_type norm = 0; │ │ │ │ │ -291 real_type isNaN = 1; │ │ │ │ │ -292 │ │ │ │ │ -293 for (auto const &xi : *this) { │ │ │ │ │ -294 real_type const a = Impl::asVector(xi).infinity_norm(); │ │ │ │ │ -295 norm = max(a, norm); │ │ │ │ │ -296 isNaN += a; │ │ │ │ │ -297 } │ │ │ │ │ -298 return norm * (isNaN / isNaN); │ │ │ │ │ -299 } │ │ │ │ │ -300 │ │ │ │ │ -302 template ::value, int>::type = 0> │ │ │ │ │ -304 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ -305 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -306 using std::max; │ │ │ │ │ -307 │ │ │ │ │ -308 real_type norm = 0; │ │ │ │ │ -309 real_type isNaN = 1; │ │ │ │ │ -310 │ │ │ │ │ -311 for (auto const &xi : *this) { │ │ │ │ │ -312 real_type const a = Impl::asVector(xi).infinity_norm_real(); │ │ │ │ │ -313 norm = max(a, norm); │ │ │ │ │ -314 isNaN += a; │ │ │ │ │ -315 } │ │ │ │ │ +226 else if (mask[i.index()] == 1) { │ │ │ │ │ +227 for (_C_o_l_I_t_e_r_a_t_o_r j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end │ │ │ │ │ +(); ++j) │ │ │ │ │ +228 if (mask[j.index()] != 2) │ │ │ │ │ +229 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]); │ │ │ │ │ +230 } │ │ │ │ │ +231 } │ │ │ │ │ +232 } │ │ │ │ │ +233 │ │ │ │ │ +_2_3_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 │ │ │ │ │ +236 { │ │ │ │ │ +237 return _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; │ │ │ │ │ +238 } │ │ │ │ │ +239 │ │ │ │ │ +_2_4_1 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 │ │ │ │ │ +242 { │ │ │ │ │ +243 return communication; │ │ │ │ │ +244 } │ │ │ │ │ +245 private: │ │ │ │ │ +246 std::shared_ptr _A_; │ │ │ │ │ +247 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& communication; │ │ │ │ │ +248 mutable bool buildcomm; │ │ │ │ │ +249 mutable std::vector mask; │ │ │ │ │ +_2_5_0 mutable std::multimap bordercontribution; │ │ │ │ │ +251 }; │ │ │ │ │ +252 │ │ │ │ │ +_2_5_5 namespace Amg │ │ │ │ │ +256 { │ │ │ │ │ +257 template struct ConstructionTraits; │ │ │ │ │ +258 } │ │ │ │ │ +259 │ │ │ │ │ +274 template │ │ │ │ │ +_2_7_5 class _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 │ │ │ │ │ +276 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ +277 friend struct Amg:: │ │ │ │ │ +ConstructionTraits<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r >; │ │ │ │ │ +278 using X = typename P::domain_type; │ │ │ │ │ +279 using Y = typename P::range_type; │ │ │ │ │ +280 public: │ │ │ │ │ +_2_8_2 typedef typename P::domain_type _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_2_8_4 typedef typename P::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_2_8_6 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ +287 │ │ │ │ │ +_3_0_2 _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 (P& p, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ │ +303 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c) │ │ │ │ │ +304 { } │ │ │ │ │ +305 │ │ │ │ │ +_3_1_3 _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 (const std::shared_ptr

& p, const │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ │ +314 : _preconditioner(p), _communication(c) │ │ │ │ │ +315 { } │ │ │ │ │ 316 │ │ │ │ │ -317 return norm * (isNaN / isNaN); │ │ │ │ │ -318 } │ │ │ │ │ -319 │ │ │ │ │ -320 //===== sizes │ │ │ │ │ -321 │ │ │ │ │ -323 size_type N () const │ │ │ │ │ -324 { │ │ │ │ │ -325 return this->n; │ │ │ │ │ -326 } │ │ │ │ │ -327 │ │ │ │ │ -329 size_type dim () const │ │ │ │ │ -330 { │ │ │ │ │ -331 size_type d=0; │ │ │ │ │ -332 │ │ │ │ │ -333 for (size_type i=0; in; i++) │ │ │ │ │ -334 d += Impl::asVector((*this)[i]).dim(); │ │ │ │ │ -335 │ │ │ │ │ -336 return d; │ │ │ │ │ -337 } │ │ │ │ │ -338 │ │ │ │ │ -339 protected: │ │ │ │ │ -341 block_vector_unmanaged () : base_array_unmanaged() │ │ │ │ │ -342 { } │ │ │ │ │ -343 }; │ │ │ │ │ -344 │ │ │ │ │ -346 │ │ │ │ │ -351 template │ │ │ │ │ -352 class ScopeGuard { │ │ │ │ │ -353 F cleanupFunc_; │ │ │ │ │ -354 public: │ │ │ │ │ -355 ScopeGuard(F cleanupFunc) : cleanupFunc_(_s_t_d::move(cleanupFunc)) {} │ │ │ │ │ -356 ScopeGuard(const ScopeGuard &) = delete; │ │ │ │ │ -357 ScopeGuard(ScopeGuard &&) = delete; │ │ │ │ │ -358 ScopeGuard &operator=(ScopeGuard) = delete; │ │ │ │ │ -359 ~ScopeGuard() { cleanupFunc_(); } │ │ │ │ │ -360 }; │ │ │ │ │ -361 │ │ │ │ │ +_3_2_2 virtual void _p_r_e (_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b) │ │ │ │ │ +323 { │ │ │ │ │ +324 _preconditioner->pre(x,b); │ │ │ │ │ +325 } │ │ │ │ │ +326 │ │ │ │ │ +_3_3_2 virtual void _a_p_p_l_y (_d_o_m_a_i_n___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& d) │ │ │ │ │ +333 { │ │ │ │ │ +334 // block preconditioner equivalent to WrappedPreconditioner from │ │ │ │ │ +335 // pdelab/backend/ovlpistsolverbackend.hh, │ │ │ │ │ +336 // but not to BlockPreconditioner from schwarz.hh │ │ │ │ │ +337 _preconditioner->apply(v,d); │ │ │ │ │ +338 _communication.addOwnerCopyToOwnerCopy(v,v); │ │ │ │ │ +339 } │ │ │ │ │ +340 │ │ │ │ │ +341 template │ │ │ │ │ +_3_4_2 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +343 { │ │ │ │ │ +344 _preconditioner->template apply(v,d); │ │ │ │ │ +345 _communication.addOwnerCopyToOwnerCopy(v,v); │ │ │ │ │ +346 } │ │ │ │ │ +347 │ │ │ │ │ +_3_5_3 virtual void _p_o_s_t (_d_o_m_a_i_n___t_y_p_e& x) │ │ │ │ │ +354 { │ │ │ │ │ +355 _preconditioner->post(x); │ │ │ │ │ +356 } │ │ │ │ │ +357 │ │ │ │ │ +_3_5_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +360 { │ │ │ │ │ +361 return _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; │ │ │ │ │ +362 } │ │ │ │ │ 363 │ │ │ │ │ -372 template │ │ │ │ │ -373 ScopeGuard makeScopeGuard(F cleanupFunc) │ │ │ │ │ -374 { │ │ │ │ │ -375 return { std::move(cleanupFunc) }; │ │ │ │ │ -376 } │ │ │ │ │ -377 │ │ │ │ │ -378} // end namespace Imp │ │ │ │ │ -393 template > │ │ │ │ │ -_3_9_4 class _B_l_o_c_k_V_e_c_t_o_r : public Imp::block_vector_unmanaged │ │ │ │ │ -395 { │ │ │ │ │ -396 public: │ │ │ │ │ -397 │ │ │ │ │ -398 //===== type definitions and constants │ │ │ │ │ -399 │ │ │ │ │ -_4_0_1 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ -402 │ │ │ │ │ -_4_0_4 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -405 │ │ │ │ │ -_4_0_7 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ -408 │ │ │ │ │ -_4_1_0 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -411 │ │ │ │ │ -413 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ -2.8.")]] │ │ │ │ │ -_4_1_4 static constexpr unsigned int _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ -415 │ │ │ │ │ -_4_1_7 typedef typename Imp::block_vector_unmanaged::Iterator _I_t_e_r_a_t_o_r; │ │ │ │ │ -418 │ │ │ │ │ -_4_2_0 typedef typename Imp::block_vector_unmanaged::ConstIterator │ │ │ │ │ -_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -421 │ │ │ │ │ -422 //===== constructors and such │ │ │ │ │ -423 │ │ │ │ │ -_4_2_5 _B_l_o_c_k_V_e_c_t_o_r () │ │ │ │ │ -426 { │ │ │ │ │ -427 syncBaseArray(); │ │ │ │ │ -428 } │ │ │ │ │ -429 │ │ │ │ │ -_4_3_1 explicit _B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e _n) : storage_(_n) │ │ │ │ │ -432 { │ │ │ │ │ -433 syncBaseArray(); │ │ │ │ │ -434 } │ │ │ │ │ -435 │ │ │ │ │ -_4_3_7 _B_l_o_c_k_V_e_c_t_o_r (std::initializer_list const &l) : storage_(l) │ │ │ │ │ -438 { │ │ │ │ │ -439 syncBaseArray(); │ │ │ │ │ -440 } │ │ │ │ │ -441 │ │ │ │ │ -442 │ │ │ │ │ -454 template │ │ │ │ │ -_4_5_5 _B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e _n, S _capacity) │ │ │ │ │ -456 { │ │ │ │ │ -457 static_assert(std::numeric_limits::is_integer, │ │ │ │ │ -458 "capacity must be an unsigned integral type (be aware, that this │ │ │ │ │ -constructor does not set the default value!)" ); │ │ │ │ │ -459 if((_s_i_z_e___t_y_p_e)_capacity > _n) │ │ │ │ │ -460 storage_.reserve(_capacity); │ │ │ │ │ -461 storage_.resize(_n); │ │ │ │ │ -462 syncBaseArray(); │ │ │ │ │ -463 } │ │ │ │ │ -464 │ │ │ │ │ -465 │ │ │ │ │ -_4_7_5 void _r_e_s_e_r_v_e(_s_i_z_e___t_y_p_e _c_a_p_a_c_i_t_y) │ │ │ │ │ -476 { │ │ │ │ │ -477 [[maybe_unused]] const auto &guard = │ │ │ │ │ -478 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ │ -479 storage_.reserve(_c_a_p_a_c_i_t_y); │ │ │ │ │ -480 } │ │ │ │ │ -481 │ │ │ │ │ -_4_8_8 _s_i_z_e___t_y_p_e _c_a_p_a_c_i_t_y() const │ │ │ │ │ -489 { │ │ │ │ │ -490 return storage_.capacity(); │ │ │ │ │ -491 } │ │ │ │ │ -492 │ │ │ │ │ -_5_0_3 void _r_e_s_i_z_e(_s_i_z_e___t_y_p_e size) │ │ │ │ │ -504 { │ │ │ │ │ -505 [[maybe_unused]] const auto &guard = │ │ │ │ │ -506 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ │ -507 storage_.resize(size); │ │ │ │ │ -508 } │ │ │ │ │ -509 │ │ │ │ │ -_5_1_1 _B_l_o_c_k_V_e_c_t_o_r(const _B_l_o_c_k_V_e_c_t_o_r &a) │ │ │ │ │ -512 noexcept(noexcept(std::declval().storage_ = a.storage_)) │ │ │ │ │ -513 { │ │ │ │ │ -514 storage_ = a.storage_; │ │ │ │ │ -515 syncBaseArray(); │ │ │ │ │ -516 } │ │ │ │ │ -517 │ │ │ │ │ -_5_1_9 _B_l_o_c_k_V_e_c_t_o_r(_B_l_o_c_k_V_e_c_t_o_r &&a) │ │ │ │ │ -520 noexcept(noexcept(std::declval().swap(a))) │ │ │ │ │ -521 { │ │ │ │ │ -522 _s_w_a_p(a); │ │ │ │ │ -523 } │ │ │ │ │ -524 │ │ │ │ │ -_5_2_6 _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) │ │ │ │ │ -527 noexcept(noexcept(std::declval().storage_ = a.storage_)) │ │ │ │ │ -528 { │ │ │ │ │ -529 [[maybe_unused]] const auto &guard = │ │ │ │ │ -530 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ │ -531 storage_ = a.storage_; │ │ │ │ │ -532 return *this; │ │ │ │ │ -533 } │ │ │ │ │ -534 │ │ │ │ │ -_5_3_6 _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) │ │ │ │ │ -537 noexcept(noexcept(std::declval().swap(a))) │ │ │ │ │ -538 { │ │ │ │ │ -539 _s_w_a_p(a); │ │ │ │ │ -540 return *this; │ │ │ │ │ -541 } │ │ │ │ │ -542 │ │ │ │ │ -_5_4_4 void _s_w_a_p(_B_l_o_c_k_V_e_c_t_o_r &other) │ │ │ │ │ -545 noexcept(noexcept( │ │ │ │ │ -546 std::declval().storage_.swap(other.storage_))) │ │ │ │ │ -547 { │ │ │ │ │ -548 [[maybe_unused]] const auto &guard = Imp::makeScopeGuard([&]{ │ │ │ │ │ -549 syncBaseArray(); │ │ │ │ │ -550 other.syncBaseArray(); │ │ │ │ │ -551 }); │ │ │ │ │ -552 storage_.swap(other.storage_); │ │ │ │ │ -553 } │ │ │ │ │ -554 │ │ │ │ │ -_5_5_6 _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) │ │ │ │ │ -557 { │ │ │ │ │ -558 // forward to operator= in base class │ │ │ │ │ -559 (static_cast&>(*this)) = k; │ │ │ │ │ -560 return *this; │ │ │ │ │ -561 } │ │ │ │ │ -562 │ │ │ │ │ -563 private: │ │ │ │ │ -564 void syncBaseArray() noexcept │ │ │ │ │ -565 { │ │ │ │ │ -566 this->p = storage_.data(); │ │ │ │ │ -567 this->n = storage_.size(); │ │ │ │ │ -568 } │ │ │ │ │ -569 │ │ │ │ │ -570 std::vector storage_; │ │ │ │ │ -571 }; │ │ │ │ │ -572 │ │ │ │ │ -578 template │ │ │ │ │ -_5_7_9 struct FieldTraits< _B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ │ -580 { │ │ │ │ │ -_5_8_1 typedef typename FieldTraits::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_5_8_2 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ -583 }; │ │ │ │ │ -589 template │ │ │ │ │ -_5_9_0 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) │ │ │ │ │ -591 { │ │ │ │ │ -592 typedef typename _B_l_o_c_k_V_e_c_t_o_r_<_K_,_ _A_>_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ -593 │ │ │ │ │ -594 for (size_type i=0; i │ │ │ │ │ -623#else │ │ │ │ │ -624 template > │ │ │ │ │ -625#endif │ │ │ │ │ -626 class BlockVectorWindow : public Imp::block_vector_unmanaged │ │ │ │ │ -627 { │ │ │ │ │ -628 public: │ │ │ │ │ -629 │ │ │ │ │ -630 //===== type definitions and constants │ │ │ │ │ -631 │ │ │ │ │ -633 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ │ -634 │ │ │ │ │ -636 typedef B block_type; │ │ │ │ │ -637 │ │ │ │ │ -639 typedef A allocator_type; │ │ │ │ │ -640 │ │ │ │ │ -642 typedef typename A::size_type size_type; │ │ │ │ │ -643 │ │ │ │ │ -645 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ -2.8.")]] │ │ │ │ │ -646 static constexpr unsigned int blocklevel = blockLevel()+1; │ │ │ │ │ -647 │ │ │ │ │ -649 typedef typename Imp::block_vector_unmanaged::Iterator Iterator; │ │ │ │ │ -650 │ │ │ │ │ -652 typedef typename Imp::block_vector_unmanaged::ConstIterator │ │ │ │ │ -ConstIterator; │ │ │ │ │ -653 │ │ │ │ │ -654 │ │ │ │ │ -655 //===== constructors and such │ │ │ │ │ -657 BlockVectorWindow () : Imp::block_vector_unmanaged() │ │ │ │ │ -658 { } │ │ │ │ │ -659 │ │ │ │ │ -661 BlockVectorWindow (B* _p, size_type _n) │ │ │ │ │ -662 { │ │ │ │ │ -663 this->n = _n; │ │ │ │ │ -664 this->p = _p; │ │ │ │ │ -665 } │ │ │ │ │ -666 │ │ │ │ │ -668 BlockVectorWindow (const BlockVectorWindow& a) │ │ │ │ │ -669 { │ │ │ │ │ -670 this->n = a.n; │ │ │ │ │ -671 this->p = a.p; │ │ │ │ │ -672 } │ │ │ │ │ -673 │ │ │ │ │ -675 BlockVectorWindow& operator= (const BlockVectorWindow& a) │ │ │ │ │ -676 { │ │ │ │ │ -677 // check correct size │ │ │ │ │ -678#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -679 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ -680#endif │ │ │ │ │ -681 │ │ │ │ │ -682 if (&a!=this) // check if this and a are different objects │ │ │ │ │ -683 { │ │ │ │ │ -684 // copy data │ │ │ │ │ -685 for (size_type i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ │ -686 } │ │ │ │ │ -687 return *this; │ │ │ │ │ -688 } │ │ │ │ │ -689 │ │ │ │ │ -691 BlockVectorWindow& operator= (const field_type& k) │ │ │ │ │ -692 { │ │ │ │ │ -693 (static_cast&>(*this)) = k; │ │ │ │ │ -694 return *this; │ │ │ │ │ -695 } │ │ │ │ │ -696 │ │ │ │ │ -698 operator BlockVector() const { │ │ │ │ │ -699 auto bv = BlockVector(this->n); │ │ │ │ │ -700 │ │ │ │ │ -701 std::copy(this->begin(), this->end(), bv.begin()); │ │ │ │ │ -702 │ │ │ │ │ -703 return bv; │ │ │ │ │ -704 } │ │ │ │ │ -705 │ │ │ │ │ -706 //===== window manipulation methods │ │ │ │ │ -707 │ │ │ │ │ -709 void set (size_type _n, B* _p) │ │ │ │ │ -710 { │ │ │ │ │ -711 this->n = _n; │ │ │ │ │ -712 this->p = _p; │ │ │ │ │ -713 } │ │ │ │ │ -714 │ │ │ │ │ -716 void setsize (size_type _n) │ │ │ │ │ -717 { │ │ │ │ │ -718 this->n = _n; │ │ │ │ │ -719 } │ │ │ │ │ -720 │ │ │ │ │ -722 void setptr (B* _p) │ │ │ │ │ -723 { │ │ │ │ │ -724 this->p = _p; │ │ │ │ │ -725 } │ │ │ │ │ -726 │ │ │ │ │ -728 B* getptr () │ │ │ │ │ -729 { │ │ │ │ │ -730 return this->p; │ │ │ │ │ -731 } │ │ │ │ │ -732 │ │ │ │ │ -734 size_type getsize () const │ │ │ │ │ -735 { │ │ │ │ │ -736 return this->n; │ │ │ │ │ -737 } │ │ │ │ │ -738 }; │ │ │ │ │ -739 │ │ │ │ │ -740 │ │ │ │ │ -741 │ │ │ │ │ -752 template > │ │ │ │ │ -753 class compressed_block_vector_unmanaged : public │ │ │ │ │ -compressed_base_array_unmanaged │ │ │ │ │ -754 { │ │ │ │ │ -755 public: │ │ │ │ │ -756 │ │ │ │ │ -757 //===== type definitions and constants │ │ │ │ │ -758 │ │ │ │ │ -760 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ │ -761 │ │ │ │ │ -763 typedef B block_type; │ │ │ │ │ -764 │ │ │ │ │ -766 typedef A allocator_type; │ │ │ │ │ -767 │ │ │ │ │ -769 typedef typename compressed_base_array_unmanaged::iterator Iterator; │ │ │ │ │ -770 │ │ │ │ │ -772 typedef typename compressed_base_array_unmanaged::const_iterator │ │ │ │ │ -ConstIterator; │ │ │ │ │ -773 │ │ │ │ │ -775 typedef typename A::size_type size_type; │ │ │ │ │ -776 │ │ │ │ │ -777 //===== assignment from scalar │ │ │ │ │ -778 │ │ │ │ │ -779 compressed_block_vector_unmanaged& operator= (const field_type& k) │ │ │ │ │ -780 { │ │ │ │ │ -781 for (size_type i=0; in; i++) │ │ │ │ │ -782 (this->p)[i] = k; │ │ │ │ │ -783 return *this; │ │ │ │ │ -784 } │ │ │ │ │ -785 │ │ │ │ │ -786 │ │ │ │ │ -787 //===== vector space arithmetic │ │ │ │ │ -788 │ │ │ │ │ -790 template │ │ │ │ │ -791 compressed_block_vector_unmanaged& operator+= (const V& y) │ │ │ │ │ -792 { │ │ │ │ │ -793#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -794 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ -795#endif │ │ │ │ │ -796 for (size_type i=0; ioperator[](y.j[i]) += y.p[i]; │ │ │ │ │ -797 return *this; │ │ │ │ │ -798 } │ │ │ │ │ -799 │ │ │ │ │ -801 template │ │ │ │ │ -802 compressed_block_vector_unmanaged& operator-= (const V& y) │ │ │ │ │ -803 { │ │ │ │ │ -804#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -805 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ -806#endif │ │ │ │ │ -807 for (size_type i=0; ioperator[](y.j[i]) -= y.p[i]; │ │ │ │ │ -808 return *this; │ │ │ │ │ -809 } │ │ │ │ │ -810 │ │ │ │ │ -812 template │ │ │ │ │ -813 compressed_block_vector_unmanaged& axpy (const field_type& a, const V& y) │ │ │ │ │ -814 { │ │ │ │ │ -815#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -816 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ -817#endif │ │ │ │ │ -818 for (size_type i=0; in; ++i) (this->p)[i] *= k; │ │ │ │ │ -827 return *this; │ │ │ │ │ -828 } │ │ │ │ │ -829 │ │ │ │ │ -831 compressed_block_vector_unmanaged& operator/= (const field_type& k) │ │ │ │ │ -832 { │ │ │ │ │ -833 for (size_type i=0; in; ++i) (this->p)[i] /= k; │ │ │ │ │ -834 return *this; │ │ │ │ │ -835 } │ │ │ │ │ -836 │ │ │ │ │ -837 │ │ │ │ │ -838 //===== Euclidean scalar product │ │ │ │ │ -839 │ │ │ │ │ -841 field_type operator* (const compressed_block_vector_unmanaged& y) const │ │ │ │ │ -842 { │ │ │ │ │ -843#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -844 if (!includesindexset(y) || !y.includesindexset(*this) ) │ │ │ │ │ -845 DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ -846#endif │ │ │ │ │ -847 field_type sum=0; │ │ │ │ │ -848 for (size_type i=0; in; ++i) │ │ │ │ │ -849 sum += (this->p)[i] * y[(this->j)[i]]; │ │ │ │ │ -850 return sum; │ │ │ │ │ -851 } │ │ │ │ │ -852 │ │ │ │ │ -853 │ │ │ │ │ -854 //===== norms │ │ │ │ │ -855 │ │ │ │ │ -857 typename FieldTraits::real_type one_norm () const │ │ │ │ │ -858 { │ │ │ │ │ -859 typename FieldTraits::real_type sum=0; │ │ │ │ │ -860 for (size_type i=0; in; ++i) sum += (this->p)[i].one_norm(); │ │ │ │ │ -861 return sum; │ │ │ │ │ -862 } │ │ │ │ │ -863 │ │ │ │ │ -865 typename FieldTraits::real_type one_norm_real () const │ │ │ │ │ -866 { │ │ │ │ │ -867 typename FieldTraits::real_type sum=0; │ │ │ │ │ -868 for (size_type i=0; in; ++i) sum += (this->p)[i].one_norm_real(); │ │ │ │ │ -869 return sum; │ │ │ │ │ -870 } │ │ │ │ │ -871 │ │ │ │ │ -873 typename FieldTraits::real_type two_norm () const │ │ │ │ │ -874 { │ │ │ │ │ -875 using std::sqrt; │ │ │ │ │ -876 typename FieldTraits::real_type sum=0; │ │ │ │ │ -877 for (size_type i=0; in; ++i) sum += (this->p)[i].two_norm2(); │ │ │ │ │ -878 return sqrt(sum); │ │ │ │ │ -879 } │ │ │ │ │ -880 │ │ │ │ │ -882 typename FieldTraits::real_type two_norm2 () const │ │ │ │ │ -883 { │ │ │ │ │ -884 typename FieldTraits::real_type sum=0; │ │ │ │ │ -885 for (size_type i=0; in; ++i) sum += (this->p)[i].two_norm2(); │ │ │ │ │ -886 return sum; │ │ │ │ │ -887 } │ │ │ │ │ -888 │ │ │ │ │ -890 template ::value, int>::type = 0> │ │ │ │ │ -892 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ -893 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -894 using std::max; │ │ │ │ │ -895 │ │ │ │ │ -896 real_type norm = 0; │ │ │ │ │ -897 for (auto const &x : *this) { │ │ │ │ │ -898 real_type const a = x.infinity_norm(); │ │ │ │ │ -899 norm = max(a, norm); │ │ │ │ │ -900 } │ │ │ │ │ -901 return norm; │ │ │ │ │ -902 } │ │ │ │ │ -903 │ │ │ │ │ -905 template ::value, int>::type = 0> │ │ │ │ │ -907 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ -908 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -909 using std::max; │ │ │ │ │ -910 │ │ │ │ │ -911 real_type norm = 0; │ │ │ │ │ -912 for (auto const &x : *this) { │ │ │ │ │ -913 real_type const a = x.infinity_norm_real(); │ │ │ │ │ -914 norm = max(a, norm); │ │ │ │ │ -915 } │ │ │ │ │ -916 return norm; │ │ │ │ │ -917 } │ │ │ │ │ -918 │ │ │ │ │ -920 template ::value, int>::type = 0> │ │ │ │ │ -922 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ -923 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -924 using std::max; │ │ │ │ │ -925 │ │ │ │ │ -926 real_type norm = 0; │ │ │ │ │ -927 real_type isNaN = 1; │ │ │ │ │ -928 for (auto const &x : *this) { │ │ │ │ │ -929 real_type const a = x.infinity_norm(); │ │ │ │ │ -930 norm = max(a, norm); │ │ │ │ │ -931 isNaN += a; │ │ │ │ │ -932 } │ │ │ │ │ -933 return norm * (isNaN / isNaN); │ │ │ │ │ -934 } │ │ │ │ │ -935 │ │ │ │ │ -937 template ::value, int>::type = 0> │ │ │ │ │ -939 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ -940 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -941 using std::max; │ │ │ │ │ -942 │ │ │ │ │ -943 real_type norm = 0; │ │ │ │ │ -944 real_type isNaN = 1; │ │ │ │ │ -945 for (auto const &x : *this) { │ │ │ │ │ -946 real_type const a = x.infinity_norm_real(); │ │ │ │ │ -947 norm = max(a, norm); │ │ │ │ │ -948 isNaN += a; │ │ │ │ │ -949 } │ │ │ │ │ -950 return norm * (isNaN / isNaN); │ │ │ │ │ -951 } │ │ │ │ │ -952 │ │ │ │ │ -953 //===== sizes │ │ │ │ │ -954 │ │ │ │ │ -956 size_type N () const │ │ │ │ │ -957 { │ │ │ │ │ -958 return this->n; │ │ │ │ │ -959 } │ │ │ │ │ -960 │ │ │ │ │ -962 size_type dim () const │ │ │ │ │ -963 { │ │ │ │ │ -964 size_type d=0; │ │ │ │ │ -965 for (size_type i=0; in; i++) │ │ │ │ │ -966 d += (this->p)[i].dim(); │ │ │ │ │ -967 return d; │ │ │ │ │ -968 } │ │ │ │ │ -969 │ │ │ │ │ -970 protected: │ │ │ │ │ -972 compressed_block_vector_unmanaged () : compressed_base_array_unmanaged │ │ │ │ │ -() │ │ │ │ │ -973 { } │ │ │ │ │ -974 │ │ │ │ │ -976 template │ │ │ │ │ -977 bool includesindexset (const V& y) │ │ │ │ │ -978 { │ │ │ │ │ -979 typename V::ConstIterator e=this->end(); │ │ │ │ │ -980 for (size_type i=0; ifind(y.j[i])==e) │ │ │ │ │ -982 return false; │ │ │ │ │ -983 return true; │ │ │ │ │ -984 } │ │ │ │ │ -985 }; │ │ │ │ │ -986 │ │ │ │ │ -987 │ │ │ │ │ -1006 template > │ │ │ │ │ -1007 class CompressedBlockVectorWindow : public │ │ │ │ │ -compressed_block_vector_unmanaged │ │ │ │ │ -1008 { │ │ │ │ │ -1009 public: │ │ │ │ │ -1010 │ │ │ │ │ -1011 //===== type definitions and constants │ │ │ │ │ -1012 │ │ │ │ │ -1014 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ │ -1015 │ │ │ │ │ -1017 typedef B block_type; │ │ │ │ │ -1018 │ │ │ │ │ -1020 typedef A allocator_type; │ │ │ │ │ -1021 │ │ │ │ │ -1023 typedef typename A::size_type size_type; │ │ │ │ │ -1024 │ │ │ │ │ -1026 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ -2.8.")]] │ │ │ │ │ -1027 static constexpr unsigned int blocklevel = blockLevel()+1; │ │ │ │ │ -1028 │ │ │ │ │ -1030 typedef typename compressed_block_vector_unmanaged::Iterator │ │ │ │ │ -Iterator; │ │ │ │ │ -1031 │ │ │ │ │ -1033 typedef typename compressed_block_vector_unmanaged::ConstIterator │ │ │ │ │ -ConstIterator; │ │ │ │ │ -1034 │ │ │ │ │ -1035 │ │ │ │ │ -1036 //===== constructors and such │ │ │ │ │ -1038 CompressedBlockVectorWindow () : compressed_block_vector_unmanaged() │ │ │ │ │ -1039 { } │ │ │ │ │ -1040 │ │ │ │ │ -1042 CompressedBlockVectorWindow (B* _p, size_type* _j, size_type _n) │ │ │ │ │ -1043 { │ │ │ │ │ -1044 this->n = _n; │ │ │ │ │ -1045 this->p = _p; │ │ │ │ │ -1046 this->j = _j; │ │ │ │ │ -1047 } │ │ │ │ │ -1048 │ │ │ │ │ -1050 CompressedBlockVectorWindow (const CompressedBlockVectorWindow& a) │ │ │ │ │ -1051 { │ │ │ │ │ -1052 this->n = a.n; │ │ │ │ │ -1053 this->p = a.p; │ │ │ │ │ -1054 this->j = a.j; │ │ │ │ │ -1055 } │ │ │ │ │ -1056 │ │ │ │ │ -1058 CompressedBlockVectorWindow& operator= (const CompressedBlockVectorWindow& │ │ │ │ │ -a) │ │ │ │ │ -1059 { │ │ │ │ │ -1060 // check correct size │ │ │ │ │ -1061#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1062 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ -1063#endif │ │ │ │ │ -1064 │ │ │ │ │ -1065 if (&a!=this) // check if this and a are different objects │ │ │ │ │ -1066 { │ │ │ │ │ -1067 // copy data │ │ │ │ │ -1068 for (size_type i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ │ -1069 for (size_type i=0; in; i++) this->j[i]=a.j[i]; │ │ │ │ │ -1070 } │ │ │ │ │ -1071 return *this; │ │ │ │ │ -1072 } │ │ │ │ │ -1073 │ │ │ │ │ -1075 CompressedBlockVectorWindow& operator= (const field_type& k) │ │ │ │ │ -1076 { │ │ │ │ │ -1077 (static_cast&>(*this)) = k; │ │ │ │ │ -1078 return *this; │ │ │ │ │ -1079 } │ │ │ │ │ -1080 │ │ │ │ │ -1081 │ │ │ │ │ -1082 //===== window manipulation methods │ │ │ │ │ -1083 │ │ │ │ │ -1085 void set (size_type _n, B* _p, size_type* _j) │ │ │ │ │ -1086 { │ │ │ │ │ -1087 this->n = _n; │ │ │ │ │ -1088 this->p = _p; │ │ │ │ │ -1089 this->j = _j; │ │ │ │ │ -1090 } │ │ │ │ │ -1091 │ │ │ │ │ -1093 void setsize (size_type _n) │ │ │ │ │ -1094 { │ │ │ │ │ -1095 this->n = _n; │ │ │ │ │ -1096 } │ │ │ │ │ -1097 │ │ │ │ │ -1099 void setptr (B* _p) │ │ │ │ │ -1100 { │ │ │ │ │ -1101 this->p = _p; │ │ │ │ │ -1102 } │ │ │ │ │ -1103 │ │ │ │ │ -1105 void setindexptr (size_type* _j) │ │ │ │ │ -1106 { │ │ │ │ │ -1107 this->j = _j; │ │ │ │ │ -1108 } │ │ │ │ │ -1109 │ │ │ │ │ -1111 B* getptr () │ │ │ │ │ -1112 { │ │ │ │ │ -1113 return this->p; │ │ │ │ │ -1114 } │ │ │ │ │ -1115 │ │ │ │ │ -1117 size_type* getindexptr () │ │ │ │ │ -1118 { │ │ │ │ │ -1119 return this->j; │ │ │ │ │ -1120 } │ │ │ │ │ -1121 │ │ │ │ │ -1123 const B* getptr () const │ │ │ │ │ -1124 { │ │ │ │ │ -1125 return this->p; │ │ │ │ │ -1126 } │ │ │ │ │ -1127 │ │ │ │ │ -1129 const size_type* getindexptr () const │ │ │ │ │ -1130 { │ │ │ │ │ -1131 return this->j; │ │ │ │ │ -1132 } │ │ │ │ │ -1134 size_type getsize () const │ │ │ │ │ -1135 { │ │ │ │ │ -1136 return this->n; │ │ │ │ │ -1137 } │ │ │ │ │ -1138 }; │ │ │ │ │ -1139 │ │ │ │ │ -1140} // end namespace 'Imp' │ │ │ │ │ -1141 │ │ │ │ │ -1142 │ │ │ │ │ -1144 template │ │ │ │ │ -1145 struct AutonomousValueType> │ │ │ │ │ -1146 { │ │ │ │ │ -1147 using type = BlockVector; │ │ │ │ │ -1148 }; │ │ │ │ │ -1149 │ │ │ │ │ -1150 │ │ │ │ │ -1151} // end namespace 'Dune' │ │ │ │ │ -1152 │ │ │ │ │ -1153#endif │ │ │ │ │ -_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ -_b_a_s_e_a_r_r_a_y_._h_h │ │ │ │ │ -Implements several basic array containers. │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +364 private: │ │ │ │ │ +366 std::shared_ptr

_preconditioner; │ │ │ │ │ +367 │ │ │ │ │ +369 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& _communication; │ │ │ │ │ +370 }; │ │ │ │ │ +371 │ │ │ │ │ +374} // end namespace │ │ │ │ │ +375 │ │ │ │ │ +376#endif │ │ │ │ │ +_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. │ │ │ │ │ +_g_s_e_t_c_._h_h │ │ │ │ │ +Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ +generic way. │ │ │ │ │ +_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. │ │ │ │ │ +_s_o_l_v_e_r_s_._h_h │ │ │ │ │ +Implementations of the inverse operator interface. │ │ │ │ │ +_i_l_u_._h_h │ │ │ │ │ +The incomplete LU factorization kernels. │ │ │ │ │ +_v_b_v_e_c_t_o_r_._h_h │ │ │ │ │ +??? │ │ │ │ │ +_i_o_._h_h │ │ │ │ │ +Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ +_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ │ +Define base class for scalar product and norm. │ │ │ │ │ +_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_:_:_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:590 │ │ │ │ │ -_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:395 │ │ │ │ │ -_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:425 │ │ │ │ │ -_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:475 │ │ │ │ │ -_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:519 │ │ │ │ │ -_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:431 │ │ │ │ │ -_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:503 │ │ │ │ │ -_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, A >::Iterator Iterator │ │ │ │ │ -make iterators available as types │ │ │ │ │ -DDeeffiinniittiioonn bvector.hh:417 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ -static constexpr unsigned int blocklevel │ │ │ │ │ -increment block level counter │ │ │ │ │ -DDeeffiinniittiioonn bvector.hh:414 │ │ │ │ │ -_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:511 │ │ │ │ │ -_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:407 │ │ │ │ │ -_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:526 │ │ │ │ │ -_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:401 │ │ │ │ │ -_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: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(std::initializer_list< B > const &l) │ │ │ │ │ -Construct from a std::initializer_list. │ │ │ │ │ -DDeeffiinniittiioonn bvector.hh:437 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_c_a_p_a_c_i_t_y │ │ │ │ │ -size_type capacity() const │ │ │ │ │ -Get the capacity of the vector. │ │ │ │ │ -DDeeffiinniittiioonn bvector.hh:488 │ │ │ │ │ -_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:455 │ │ │ │ │ -_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:404 │ │ │ │ │ -_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:544 │ │ │ │ │ -_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, A >::ConstIterator ConstIterator │ │ │ │ │ -make iterators available as types │ │ │ │ │ -DDeeffiinniittiioonn bvector.hh:420 │ │ │ │ │ -_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:582 │ │ │ │ │ -_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:581 │ │ │ │ │ +_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_:_:_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_:_:_P_I_S │ │ │ │ │ +C::PIS PIS │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:74 │ │ │ │ │ +_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_:_:_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 novlpschwarz.hh:72 │ │ │ │ │ +_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_:_:_R_I_M_a_p │ │ │ │ │ +std::multimap< int, std::pair< int, RILIterator > > RIMap │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:82 │ │ │ │ │ +_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_:_:_R_I │ │ │ │ │ +C::RI RI │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:75 │ │ │ │ │ +_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_:_:_n_o_v_l_p___o_p___a_p_p_l_y │ │ │ │ │ +void novlp_op_apply(const X &x, Y &y, field_type alpha) const │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:126 │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ +NonoverlappingSchwarzOperator(std::shared_ptr< const matrix_type > A, const │ │ │ │ │ +communication_type &com) │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:96 │ │ │ │ │ +_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_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +M::ConstColIterator ColIterator │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:79 │ │ │ │ │ +_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_p_p_l_y │ │ │ │ │ +virtual void apply(const X &x, Y &y) const │ │ │ │ │ +apply operator to x: │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:101 │ │ │ │ │ +_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The type of the domain. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:66 │ │ │ │ │ +_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the linear operator (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:235 │ │ │ │ │ +_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_:_:_R_I_M_a_p_i_t │ │ │ │ │ +RIMap::iterator RIMapit │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:83 │ │ │ │ │ +_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_:_:_g_e_t_m_a_t │ │ │ │ │ +virtual const matrix_type & getmat() const │ │ │ │ │ +get matrix via * │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:121 │ │ │ │ │ +_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_:_:_R_I_L_I_t_e_r_a_t_o_r │ │ │ │ │ +RIL::const_iterator RILIterator │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:78 │ │ │ │ │ +_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_:_:_M_M │ │ │ │ │ +std::multimap< int, int > MM │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:81 │ │ │ │ │ +_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +The type of the range. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:68 │ │ │ │ │ +_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_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +The type of the matrix we operate on. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:64 │ │ │ │ │ +_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_:_:_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +M::ConstRowIterator RowIterator │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:80 │ │ │ │ │ +_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_:_:_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 novlpschwarz.hh:241 │ │ │ │ │ +_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_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ +virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const │ │ │ │ │ +apply operator to x, scale and add: │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:109 │ │ │ │ │ +_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_:_:_R_I_L │ │ │ │ │ +RI::RemoteIndexList RIL │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:76 │ │ │ │ │ +_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_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type of the range. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:70 │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ +NonoverlappingSchwarzOperator(const matrix_type &A, const communication_type │ │ │ │ │ +&com) │ │ │ │ │ +constructor: just store a reference to a matrix. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:92 │ │ │ │ │ +_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_:_:_R_I_I_t_e_r_a_t_o_r │ │ │ │ │ +RI::const_iterator RIIterator │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ +Nonoverlapping parallel preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_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 │ │ │ │ │ +NonoverlappingBlockPreconditioner(P &p, const communication_type &c) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:302 │ │ │ │ │ +_D_u_n_e_:_:_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_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:359 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(domain_type &v, const range_type &d) │ │ │ │ │ +Apply the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:332 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +P::range_type range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:284 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_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 │ │ │ │ │ +NonoverlappingBlockPreconditioner(const std::shared_ptr< P > &p, const │ │ │ │ │ +communication_type &c) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:313 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_p_o_s_t │ │ │ │ │ +virtual void post(domain_type &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:353 │ │ │ │ │ +_D_u_n_e_:_:_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_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 novlpschwarz.hh:286 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_p_r_e │ │ │ │ │ +virtual void pre(domain_type &x, range_type &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:322 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_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 novlpschwarz.hh:342 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +P::domain_type domain_type │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:282 │ │ │ │ │ +_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:109 │ │ │ │ │ +_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_:_:_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: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 │ │ │ │ │ +Category │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: btdmatrix.hh File Reference │ │ │ │ +dune-istl: owneroverlapcopy.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,45 +71,95 @@ │ │ │ │

│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
btdmatrix.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Implementation of the BTDMatrix class. │ │ │ │ +

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

│ │ │ │ -
#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/scalarvectorview.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ -#include <dune/istl/blocklevel.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::BTDMatrix< B, A >
 A block-tridiagonal matrix. More...
struct  Dune::OwnerOverlapCopyAttributeSet
 Attribute set for overlapping Schwarz. More...
 
struct  Dune::FieldTraits< BTDMatrix< B, A > >
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 communcation More...
 
struct  Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::AddGatherScatter< T >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<int dim, template< class, class > class Comm>
void testRedistributed (int s)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Implementation of the BTDMatrix class.

│ │ │ │ -
Author
Oliver Sander
│ │ │ │ -
│ │ │ │ +

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,30 +1,65 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -btdmatrix.hh File Reference │ │ │ │ │ -Implementation of the BTDMatrix class. _M_o_r_e_._._. │ │ │ │ │ -#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_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +_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 │ │ │ │ │ +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 "cmath" │ │ │ │ │ +#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_:_:_B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _> │ │ │ │ │ -  A block-tridiagonal matrix. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ +  Attribute set for overlapping Schwarz. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _> │ │ │ │ │ + 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 communcation _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 │ │ │ │ │ +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 ********** │ │ │ │ │ -Implementation of the BTDMatrix class. │ │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ │ Author │ │ │ │ │ - Oliver Sander │ │ │ │ │ + Peter Bastian │ │ │ │ │ +********** FFuunnccttiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? tteessttRReeddiissttrriibbuutteedd(()) ********** │ │ │ │ │ +template class Comm> │ │ │ │ │ +void testRedistributed ( int  ss ) │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: btdmatrix.hh Source File │ │ │ │ +dune-istl: owneroverlapcopy.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,240 +74,712 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
btdmatrix.hh
│ │ │ │ +
owneroverlapcopy.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_BTDMATRIX_HH
│ │ │ │ -
6#define DUNE_ISTL_BTDMATRIX_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_OWNEROVERLAPCOPY_HH
│ │ │ │ +
6#define DUNE_ISTL_OWNEROVERLAPCOPY_HH
│ │ │ │
7
│ │ │ │ -
8#include <dune/common/fmatrix.hh>
│ │ │ │ -
9#include <dune/common/scalarvectorview.hh>
│ │ │ │ -
10#include <dune/common/scalarmatrixview.hh>
│ │ │ │ - │ │ │ │ - │ │ │ │ -
13
│ │ │ │ -
19namespace Dune {
│ │ │ │ -
29 template <class B, class A=std::allocator<B> >
│ │ │ │ -
│ │ │ │ -
30 class BTDMatrix : public BCRSMatrix<B,A>
│ │ │ │ -
31 {
│ │ │ │ -
32 public:
│ │ │ │ -
33
│ │ │ │ -
34 //===== type definitions and constants
│ │ │ │ -
35
│ │ │ │ -
37 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
38
│ │ │ │ -
40 typedef B block_type;
│ │ │ │ -
41
│ │ │ │ -
43 typedef A allocator_type;
│ │ │ │ -
44
│ │ │ │ -
46 //typedef BCRSMatrix<B,A>::row_type row_type;
│ │ │ │ -
47
│ │ │ │ -
49 typedef typename A::size_type size_type;
│ │ │ │ -
50
│ │ │ │ -
52 [[deprecated("Use free blockLevel function. Will be removed after 2.8.")]]
│ │ │ │ -
53 static constexpr auto blocklevel = blockLevel<B>()+1;
│ │ │ │ -
54
│ │ │ │ -
56 BTDMatrix() : BCRSMatrix<B,A>() {}
│ │ │ │ -
57
│ │ │ │ -
│ │ │ │ -
58 explicit BTDMatrix(size_type size)
│ │ │ │ -
59 : BCRSMatrix<B,A>(size, size, BCRSMatrix<B,A>::random)
│ │ │ │ -
60 {
│ │ │ │ -
61 // Set number of entries for each row
│ │ │ │ -
62 // All rows get three entries, except for the first and the last one
│ │ │ │ -
63 for (size_t i=0; i<size; i++)
│ │ │ │ -
64 this->BCRSMatrix<B,A>::setrowsize(i, 3 - (i==0) - (i==(size-1)));
│ │ │ │ -
65
│ │ │ │ - │ │ │ │ -
67
│ │ │ │ -
68 // The actual entries for each row
│ │ │ │ -
69 for (size_t i=0; i<size; i++) {
│ │ │ │ -
70 if (i>0)
│ │ │ │ -
71 this->BCRSMatrix<B,A>::addindex(i, i-1);
│ │ │ │ -
72 this->BCRSMatrix<B,A>::addindex(i, i );
│ │ │ │ -
73 if (i<size-1)
│ │ │ │ -
74 this->BCRSMatrix<B,A>::addindex(i, i+1);
│ │ │ │ -
75 }
│ │ │ │ -
76
│ │ │ │ - │ │ │ │ -
78 }
│ │ │ │ -
│ │ │ │ -
79
│ │ │ │ -
│ │ │ │ -
81 void setSize(size_type size)
│ │ │ │ -
82 {
│ │ │ │ -
83 auto nonZeros = (size==0) ? 0 : size + 2*(size-1);
│ │ │ │ -
84 this->BCRSMatrix<B,A>::setSize(size, // rows
│ │ │ │ -
85 size, // columns
│ │ │ │ -
86 nonZeros);
│ │ │ │ -
87
│ │ │ │ -
88 // Set number of entries for each row
│ │ │ │ -
89 // All rows get three entries, except for the first and the last one
│ │ │ │ -
90 for (size_t i=0; i<size; i++)
│ │ │ │ -
91 this->BCRSMatrix<B,A>::setrowsize(i, 3 - (i==0) - (i==(size-1)));
│ │ │ │ -
92
│ │ │ │ - │ │ │ │ -
94
│ │ │ │ -
95 // The actual entries for each row
│ │ │ │ -
96 for (size_t i=0; i<size; i++) {
│ │ │ │ -
97 if (i>0)
│ │ │ │ -
98 this->BCRSMatrix<B,A>::addindex(i, i-1);
│ │ │ │ -
99 this->BCRSMatrix<B,A>::addindex(i, i );
│ │ │ │ -
100 if (i<size-1)
│ │ │ │ -
101 this->BCRSMatrix<B,A>::addindex(i, i+1);
│ │ │ │ -
102 }
│ │ │ │ -
103
│ │ │ │ - │ │ │ │ -
105 }
│ │ │ │ -
│ │ │ │ -
106
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
109 this->BCRSMatrix<B,A>::operator=(other);
│ │ │ │ -
110 return *this;
│ │ │ │ -
111 }
│ │ │ │ -
│ │ │ │ -
112
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
116 return *this;
│ │ │ │ -
117 }
│ │ │ │ -
│ │ │ │ -
118
│ │ │ │ -
124 template <class V>
│ │ │ │ -
│ │ │ │ -
125 void solve (V& x, const V& rhs) const {
│ │ │ │ -
126
│ │ │ │ -
127 // special handling for 1x1 matrices. The generic algorithm doesn't work for them
│ │ │ │ -
128 if (this->N()==1) {
│ │ │ │ -
129 auto&& x0 = Impl::asVector(x[0]);
│ │ │ │ -
130 auto&& rhs0 = Impl::asVector(rhs[0]);
│ │ │ │ -
131 Impl::asMatrix((*this)[0][0]).solve(x0, rhs0);
│ │ │ │ -
132 return;
│ │ │ │ -
133 }
│ │ │ │ -
134
│ │ │ │ -
135 // Make copies of the rhs and the right matrix band
│ │ │ │ -
136 V d = rhs;
│ │ │ │ -
137 std::vector<block_type> c(this->N()-1);
│ │ │ │ -
138 for (size_t i=0; i<this->N()-1; i++)
│ │ │ │ -
139 c[i] = (*this)[i][i+1];
│ │ │ │ -
140
│ │ │ │ -
141 /* Modify the coefficients. */
│ │ │ │ -
142 block_type a_00_inv = (*this)[0][0];
│ │ │ │ -
143 Impl::asMatrix(a_00_inv).invert();
│ │ │ │ -
144
│ │ │ │ -
145 //c[0] /= (*this)[0][0]; /* Division by zero risk. */
│ │ │ │ -
146 block_type tmp = a_00_inv;
│ │ │ │ -
147 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[0]));
│ │ │ │ -
148 c[0] = tmp;
│ │ │ │ -
149
│ │ │ │ -
150 // d = a^{-1} d /* Division by zero would imply a singular matrix. */
│ │ │ │ -
151 auto d_0_tmp = d[0];
│ │ │ │ -
152 auto&& d_0 = Impl::asVector(d[0]);
│ │ │ │ -
153 Impl::asMatrix(a_00_inv).mv(Impl::asVector(d_0_tmp),d_0);
│ │ │ │ -
154
│ │ │ │ -
155 for (unsigned int i = 1; i < this->N(); i++) {
│ │ │ │ -
156
│ │ │ │ -
157 // id = ( a_ii - c_{i-1} a_{i, i-1} ) ^{-1}
│ │ │ │ -
158 block_type tmp;
│ │ │ │ -
159 tmp = (*this)[i][i-1];
│ │ │ │ -
160 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[i-1]));
│ │ │ │ -
161
│ │ │ │ -
162 block_type id = (*this)[i][i];
│ │ │ │ -
163 id -= tmp;
│ │ │ │ -
164 Impl::asMatrix(id).invert(); /* Division by zero risk. */
│ │ │ │ +
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
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ +
164#if HAVE_MPI
│ │ │ │
165
│ │ │ │ -
166 if (i<c.size()) {
│ │ │ │ -
167 Impl::asMatrix(c[i]).leftmultiply(Impl::asMatrix(id)); /* Last value calculated is redundant. */
│ │ │ │ -
168 }
│ │ │ │ -
169
│ │ │ │ -
170 // d[i] = (d[i] - d[i-1] * (*this)[i][i-1]) * id;
│ │ │ │ -
171 auto&& d_i = Impl::asVector(d[i]);
│ │ │ │ -
172 Impl::asMatrix((*this)[i][i-1]).mmv(Impl::asVector(d[i-1]), d_i);
│ │ │ │ -
173 auto tmpVec = d[i];
│ │ │ │ -
174 Impl::asMatrix(id).mv(Impl::asVector(tmpVec), d_i);
│ │ │ │ -
175 }
│ │ │ │ -
176
│ │ │ │ -
177 /* Now back substitute. */
│ │ │ │ -
178 x[this->N() - 1] = d[this->N() - 1];
│ │ │ │ -
179 for (int i = this->N() - 2; i >= 0; i--) {
│ │ │ │ -
180 //x[i] = d[i] - c[i] * x[i + 1];
│ │ │ │ -
181 x[i] = d[i];
│ │ │ │ -
182 auto&& x_i = Impl::asVector(x[i]);
│ │ │ │ -
183 Impl::asMatrix(c[i]).mmv(Impl::asVector(x[i+1]), x_i);
│ │ │ │ -
184 }
│ │ │ │ -
185
│ │ │ │ -
186 }
│ │ │ │ -
│ │ │ │ -
187
│ │ │ │ -
188 private:
│ │ │ │ -
189
│ │ │ │ -
190 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ -
191 // The following methods from the base class should now actually be called
│ │ │ │ -
192 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ -
193
│ │ │ │ -
194 // createbegin and createend should be in there, too, but I can't get it to compile
│ │ │ │ -
195 // BCRSMatrix<B,A>::CreateIterator createbegin () {}
│ │ │ │ -
196 // BCRSMatrix<B,A>::CreateIterator createend () {}
│ │ │ │ -
197 void setrowsize (size_type i, size_type s) {}
│ │ │ │ -
198 void incrementrowsize (size_type i) {}
│ │ │ │ -
199 void endrowsizes () {}
│ │ │ │ -
200 void addindex (size_type row, size_type col) {}
│ │ │ │ -
201 void endindices () {}
│ │ │ │ -
202 };
│ │ │ │ -
│ │ │ │ -
203
│ │ │ │ -
204 template<typename B, typename A>
│ │ │ │ -
│ │ │ │ -
205 struct FieldTraits< BTDMatrix<B, A> >
│ │ │ │ -
206 {
│ │ │ │ - │ │ │ │ -
208 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
209 };
│ │ │ │ -
│ │ │ │ -
210
│ │ │ │ -
213} // end namespace Dune
│ │ │ │ -
214
│ │ │ │ -
215#endif
│ │ │ │ -
Helper functions for determining the vector/matrix block level.
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
172 template <class GlobalIdType, class LocalIdType=int>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
174 {
│ │ │ │ +
175 template<typename M, typename G, typename L>
│ │ │ │ +
176 friend void loadMatrixMarket(M&,
│ │ │ │ +
177 const std::string&,
│ │ │ │ + │ │ │ │ +
179 bool);
│ │ │ │ +
180 // used types
│ │ │ │ + │ │ │ │ + │ │ │ │ +
183 typedef typename std::set<IndexTripel>::const_iterator localindex_iterator;
│ │ │ │ +
184 typedef typename std::set<RemoteIndexTripel>::const_iterator remoteindex_iterator;
│ │ │ │ + │ │ │ │ +
186 typedef Dune::ParallelLocalIndex<AttributeSet> LI;
│ │ │ │ +
187 public:
│ │ │ │ +
188 typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> PIS;
│ │ │ │ +
189 typedef Dune::RemoteIndices<PIS> RI;
│ │ │ │ +
190 typedef Dune::RemoteIndexListModifier<PIS,typename RI::Allocator,false> RILM;
│ │ │ │ +
191 typedef typename RI::RemoteIndex RX;
│ │ │ │ +
192 typedef Dune::BufferedCommunicator BC;
│ │ │ │ +
193 typedef Dune::Interface IF;
│ │ │ │ +
194 typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner> OwnerSet;
│ │ │ │ +
195 typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopySet;
│ │ │ │ +
196 typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> OwnerOverlapSet;
│ │ │ │ +
197 typedef Dune::AllSet<AttributeSet> AllSet;
│ │ │ │ +
198 protected:
│ │ │ │ +
199
│ │ │ │ +
200
│ │ │ │ +
202 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
204 {
│ │ │ │ +
205 typedef typename CommPolicy<T>::IndexedType V;
│ │ │ │ +
206
│ │ │ │ +
│ │ │ │ +
207 static V gather(const T& a, std::size_t i)
│ │ │ │ +
208 {
│ │ │ │ +
209 return a[i];
│ │ │ │ +
210 }
│ │ │ │ +
│ │ │ │ +
211
│ │ │ │ +
│ │ │ │ +
212 static void scatter(T& a, V v, std::size_t i)
│ │ │ │ +
213 {
│ │ │ │ +
214 a[i] = v;
│ │ │ │ +
215 }
│ │ │ │ +
│ │ │ │ +
216 };
│ │ │ │ +
│ │ │ │ +
217 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
219 {
│ │ │ │ +
220 typedef typename CommPolicy<T>::IndexedType V;
│ │ │ │ +
221
│ │ │ │ +
│ │ │ │ +
222 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==true)
│ │ │ │ +
660 if(comm!=MPI_COMM_NULL)
│ │ │ │ +
661 {
│ │ │ │ +
662#ifdef MPI_2
│ │ │ │ +
663 // If it is possible to query whether MPI_Finalize
│ │ │ │ +
664 // was called, only free the communicator before
│ │ │ │ +
665 // calling MPI_Finalize.
│ │ │ │ +
666 int wasFinalized = 0;
│ │ │ │ +
667 MPI_Finalized( &wasFinalized );
│ │ │ │ +
668 if(!wasFinalized)
│ │ │ │ +
669#endif
│ │ │ │ +
670 MPI_Comm_free(&comm);
│ │ │ │ +
671 }
│ │ │ │ +
672 }
│ │ │ │ +
│ │ │ │ +
673
│ │ │ │ +
674 private:
│ │ │ │ + │ │ │ │ +
676 {}
│ │ │ │ +
677 MPI_Comm comm;
│ │ │ │ +
678 Communication<MPI_Comm> cc;
│ │ │ │ +
679 PIS pis;
│ │ │ │ +
680 RI ri;
│ │ │ │ +
681 mutable IF OwnerToAllInterface;
│ │ │ │ +
682 mutable bool OwnerToAllInterfaceBuilt;
│ │ │ │ +
683 mutable IF OwnerOverlapToAllInterface;
│ │ │ │ +
684 mutable bool OwnerOverlapToAllInterfaceBuilt;
│ │ │ │ +
685 mutable IF OwnerCopyToAllInterface;
│ │ │ │ +
686 mutable bool OwnerCopyToAllInterfaceBuilt;
│ │ │ │ +
687 mutable IF OwnerCopyToOwnerCopyInterface;
│ │ │ │ +
688 mutable bool OwnerCopyToOwnerCopyInterfaceBuilt;
│ │ │ │ +
689 mutable IF CopyToAllInterface;
│ │ │ │ +
690 mutable bool CopyToAllInterfaceBuilt;
│ │ │ │ +
691 mutable std::vector<double> mask;
│ │ │ │ +
692 int oldseqNo;
│ │ │ │ +
693 GlobalLookupIndexSet* globalLookup_;
│ │ │ │ +
694 const SolverCategory::Category category_;
│ │ │ │ +
695 bool freecomm;
│ │ │ │ +
696 };
│ │ │ │ +
│ │ │ │ +
697
│ │ │ │ +
698#endif
│ │ │ │ +
699
│ │ │ │ +
700
│ │ │ │ +
703} // end namespace
│ │ │ │ +
704
│ │ │ │ +
705#endif
│ │ │ │ +
void testRedistributed(int s)
│ │ │ │ +
Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
│ │ │ │ + │ │ │ │ + │ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1149
│ │ │ │ -
@ random
Build entries randomly.
Definition bcrsmatrix.hh:530
│ │ │ │ -
void addindex(size_type row, size_type col)
add index (row,col) to the matrix
Definition bcrsmatrix.hh:1191
│ │ │ │ -
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1248
│ │ │ │ -
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ -
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:861
│ │ │ │ -
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:911
│ │ │ │ -
A block-tridiagonal matrix.
Definition btdmatrix.hh:31
│ │ │ │ -
static constexpr auto blocklevel
increment block level counter
Definition btdmatrix.hh:53
│ │ │ │ -
BTDMatrix(size_type size)
Definition btdmatrix.hh:58
│ │ │ │ -
void solve(V &x, const V &rhs) const
Use the Thomas algorithm to solve the system Ax=b in O(n) time.
Definition btdmatrix.hh:125
│ │ │ │ -
A::size_type size_type
implement row_type with compressed vector
Definition btdmatrix.hh:49
│ │ │ │ -
A allocator_type
export the allocator type
Definition btdmatrix.hh:43
│ │ │ │ -
B block_type
export the type representing the components
Definition btdmatrix.hh:40
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition btdmatrix.hh:37
│ │ │ │ -
BTDMatrix & operator=(const BTDMatrix &other)
assignment
Definition btdmatrix.hh:108
│ │ │ │ -
BTDMatrix()
Default constructor.
Definition btdmatrix.hh:56
│ │ │ │ -
void setSize(size_type size)
Resize the matrix. Invalidates the content!
Definition btdmatrix.hh:81
│ │ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition btdmatrix.hh:208
│ │ │ │ -
typename BTDMatrix< B, A >::field_type field_type
Definition btdmatrix.hh:207
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
Attribute set for overlapping Schwarz.
Definition owneroverlapcopy.hh:59
│ │ │ │ +
AttributeSet
Definition owneroverlapcopy.hh:60
│ │ │ │ +
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ │ +
@ copy
Definition owneroverlapcopy.hh:61
│ │ │ │ +
@ overlap
Definition owneroverlapcopy.hh:61
│ │ │ │ +
Information about the index distribution.
Definition owneroverlapcopy.hh:78
│ │ │ │ +
std::tuple< GlobalIdType, LocalIdType, int > IndexTripel
A triple describing a local index.
Definition owneroverlapcopy.hh:92
│ │ │ │ +
void addRemoteIndex(const RemoteIndexTripel &x)
Add a new remote index triple to the set of remote indices.
Definition owneroverlapcopy.hh:120
│ │ │ │ +
G GlobalIdType
The type of the global index.
Definition owneroverlapcopy.hh:81
│ │ │ │ +
const std::set< IndexTripel > & localIndices() const
Get the set of indices local to the process.
Definition owneroverlapcopy.hh:133
│ │ │ │ +
const std::set< RemoteIndexTripel > & remoteIndices() const
Get the set of remote indices.
Definition owneroverlapcopy.hh:142
│ │ │ │ +
L LocalIdType
The type of the local index.
Definition owneroverlapcopy.hh:84
│ │ │ │ +
void clear()
Remove all indices from the sets.
Definition owneroverlapcopy.hh:150
│ │ │ │ +
void addLocalIndex(const IndexTripel &x)
Add a new index triple to the set of local indices.
Definition owneroverlapcopy.hh:106
│ │ │ │ +
std::tuple< int, GlobalIdType, int > RemoteIndexTripel
A triple describing a remote index.
Definition owneroverlapcopy.hh:99
│ │ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ +
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet
Definition owneroverlapcopy.hh:195
│ │ │ │ +
const GlobalLookupIndexSet & globalLookup() const
Definition owneroverlapcopy.hh:526
│ │ │ │ +
FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const
Compute the global Euclidean norm of a vector.
Definition owneroverlapcopy.hh:425
│ │ │ │ +
void buildOwnerOverlapToAllInterface() const
Definition owneroverlapcopy.hh:233
│ │ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS
Definition owneroverlapcopy.hh:188
│ │ │ │ +
void buildOwnerCopyToAllInterface() const
Definition owneroverlapcopy.hh:254
│ │ │ │ +
void buildOwnerCopyToOwnerCopyInterface() const
Definition owneroverlapcopy.hh:266
│ │ │ │ +
OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Constructor.
Definition owneroverlapcopy.hh:586
│ │ │ │ +
SolverCategory::Category category() const
Get Solver Category.
Definition owneroverlapcopy.hh:295
│ │ │ │ +
void addOwnerCopyToOwnerCopy(const T &source, T &dest) const
Communicate values from owner and copy data points to owner and copy data points and add them to thos...
Definition owneroverlapcopy.hh:379
│ │ │ │ +
void buildCopyToAllInterface() const
Definition owneroverlapcopy.hh:279
│ │ │ │ +
Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags
Definition owneroverlapcopy.hh:446
│ │ │ │ +
RemoteIndices & remoteIndices()
Get the underlying remote indices.
Definition owneroverlapcopy.hh:490
│ │ │ │ +
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:462
│ │ │ │ +
Dune::RemoteIndices< PIS > RI
Definition owneroverlapcopy.hh:189
│ │ │ │ +
void buildGlobalLookup(std::size_t size)
Definition owneroverlapcopy.hh:508
│ │ │ │ +
void addOwnerOverlapToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points and add them to those values.
Definition owneroverlapcopy.hh:345
│ │ │ │ +
Dune::RemoteIndices< PIS > RemoteIndices
The type of the remote indices.
Definition owneroverlapcopy.hh:452
│ │ │ │ +
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition owneroverlapcopy.hh:538
│ │ │ │ +
Dune::AllSet< AttributeSet > AllSet
Definition owneroverlapcopy.hh:197
│ │ │ │ +
Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > OwnerOverlapSet
Definition owneroverlapcopy.hh:196
│ │ │ │ +
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ │ +
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ │ +
Dune::Interface IF
Definition owneroverlapcopy.hh:193
│ │ │ │ +
~OwnerOverlapCopyCommunication()
Definition owneroverlapcopy.hh:650
│ │ │ │ +
void buildGlobalLookup()
Definition owneroverlapcopy.hh:495
│ │ │ │ +
Dune::BufferedCommunicator BC
Definition owneroverlapcopy.hh:192
│ │ │ │ +
OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Construct the communication without any indices.
Definition owneroverlapcopy.hh:554
│ │ │ │ +
ParallelIndexSet & indexSet()
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:480
│ │ │ │ +
void dot(const T1 &x, const T1 &y, T2 &result) const
Compute a global dot product of two vectors.
Definition owneroverlapcopy.hh:398
│ │ │ │ +
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ │ +
OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory::overlapping)
Construct the communication without any indices using MPI_COMM_WORLD.
Definition owneroverlapcopy.hh:572
│ │ │ │ +
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet
Definition owneroverlapcopy.hh:194
│ │ │ │ +
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ +
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ │ +
friend void loadMatrixMarket(M &, const std::string &, OwnerOverlapCopyCommunication< G, L > &, bool)
Load a parallel matrix/vector stored in matrix market format.
Definition matrixmarket.hh:1269
│ │ │ │ +
RI::RemoteIndex RX
Definition owneroverlapcopy.hh:191
│ │ │ │ +
void addOwnerCopyToAll(const T &source, T &dest) const
Communicate values from owner and copy data points to all other data points and add them to those val...
Definition owneroverlapcopy.hh:362
│ │ │ │ +
void freeGlobalLookup()
Definition owneroverlapcopy.hh:520
│ │ │ │ +
Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM
Definition owneroverlapcopy.hh:190
│ │ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ │ +
void buildOwnerToAllInterface() const
Definition owneroverlapcopy.hh:244
│ │ │ │ +
gather/scatter callback for communcation
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
│ │ │ │ +
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,288 +1,839 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -btdmatrix.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 (C) 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_BTDMATRIX_HH │ │ │ │ │ -6#define DUNE_ISTL_BTDMATRIX_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_OWNEROVERLAPCOPY_HH │ │ │ │ │ +6#define DUNE_ISTL_OWNEROVERLAPCOPY_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ -12#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -13 │ │ │ │ │ -19namespace _D_u_n_e { │ │ │ │ │ -29 template > │ │ │ │ │ -_3_0 class _B_T_D_M_a_t_r_i_x : public _B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -31 { │ │ │ │ │ -32 public: │ │ │ │ │ -33 │ │ │ │ │ -34 //===== type definitions and constants │ │ │ │ │ -35 │ │ │ │ │ -_3_7 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ -38 │ │ │ │ │ -_4_0 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -41 │ │ │ │ │ -_4_3 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ -44 │ │ │ │ │ -46 //typedef BCRSMatrix::row_type row_type; │ │ │ │ │ -47 │ │ │ │ │ -_4_9 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -50 │ │ │ │ │ -52 [[deprecated("Use free blockLevel function. Will be removed after 2.8.")]] │ │ │ │ │ -_5_3 static constexpr auto _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ -54 │ │ │ │ │ -_5_6 _B_T_D_M_a_t_r_i_x() : _B_C_R_S_M_a_t_r_i_x() {} │ │ │ │ │ -57 │ │ │ │ │ -_5_8 explicit _B_T_D_M_a_t_r_i_x(_s_i_z_e___t_y_p_e size) │ │ │ │ │ -59 : _B_C_R_S_M_a_t_r_i_x(size, size, _B_C_R_S_M_a_t_r_i_x::_r_a_n_d_o_m) │ │ │ │ │ -60 { │ │ │ │ │ -61 // Set number of entries for each row │ │ │ │ │ -62 // All rows get three entries, except for the first and the last one │ │ │ │ │ -63 for (size_t i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 3 - (i==0) - (i==(size-1))); │ │ │ │ │ -65 │ │ │ │ │ -66 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ -67 │ │ │ │ │ -68 // The actual entries for each row │ │ │ │ │ -69 for (size_t i=0; i0) │ │ │ │ │ -71 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i-1); │ │ │ │ │ -72 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i ); │ │ │ │ │ -73 if (i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i+1); │ │ │ │ │ -75 } │ │ │ │ │ -76 │ │ │ │ │ -77 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ -78 } │ │ │ │ │ -79 │ │ │ │ │ -_8_1 void _s_e_t_S_i_z_e(size_type size) │ │ │ │ │ -82 { │ │ │ │ │ -83 auto nonZeros = (size==0) ? 0 : size + 2*(size-1); │ │ │ │ │ -84 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_S_i_z_e(size, // rows │ │ │ │ │ -85 size, // columns │ │ │ │ │ -86 nonZeros); │ │ │ │ │ -87 │ │ │ │ │ -88 // Set number of entries for each row │ │ │ │ │ -89 // All rows get three entries, except for the first and the last one │ │ │ │ │ -90 for (size_t i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 3 - (i==0) - (i==(size-1))); │ │ │ │ │ -92 │ │ │ │ │ -93 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ -94 │ │ │ │ │ -95 // The actual entries for each row │ │ │ │ │ -96 for (size_t i=0; i0) │ │ │ │ │ -98 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i-1); │ │ │ │ │ -99 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i ); │ │ │ │ │ -100 if (i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i+1); │ │ │ │ │ -102 } │ │ │ │ │ -103 │ │ │ │ │ -104 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ -105 } │ │ │ │ │ -106 │ │ │ │ │ -_1_0_8 _B_T_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _B_T_D_M_a_t_r_i_x& other) { │ │ │ │ │ -109 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(other); │ │ │ │ │ -110 return *this; │ │ │ │ │ -111 } │ │ │ │ │ -112 │ │ │ │ │ -_1_1_4 _B_T_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) { │ │ │ │ │ -115 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(k); │ │ │ │ │ -116 return *this; │ │ │ │ │ -117 } │ │ │ │ │ -118 │ │ │ │ │ -124 template │ │ │ │ │ -_1_2_5 void _s_o_l_v_e (V& x, const V& rhs) const { │ │ │ │ │ -126 │ │ │ │ │ -127 // special handling for 1x1 matrices. The generic algorithm doesn't work │ │ │ │ │ -for them │ │ │ │ │ -128 if (this->_N()==1) { │ │ │ │ │ -129 auto&& x0 = Impl::asVector(x[0]); │ │ │ │ │ -130 auto&& rhs0 = Impl::asVector(rhs[0]); │ │ │ │ │ -131 Impl::asMatrix((*this)[0][0]).solve(x0, rhs0); │ │ │ │ │ -132 return; │ │ │ │ │ -133 } │ │ │ │ │ -134 │ │ │ │ │ -135 // Make copies of the rhs and the right matrix band │ │ │ │ │ -136 V d = rhs; │ │ │ │ │ -137 std::vector c(this->_N()-1); │ │ │ │ │ -138 for (size_t i=0; i_N()-1; i++) │ │ │ │ │ -139 c[i] = (*this)[i][i+1]; │ │ │ │ │ -140 │ │ │ │ │ -141 /* Modify the coefficients. */ │ │ │ │ │ -142 _b_l_o_c_k___t_y_p_e a_00_inv = (*this)[0][0]; │ │ │ │ │ -143 Impl::asMatrix(a_00_inv).invert(); │ │ │ │ │ -144 │ │ │ │ │ -145 //c[0] /= (*this)[0][0]; /* Division by zero risk. */ │ │ │ │ │ -146 _b_l_o_c_k___t_y_p_e tmp = a_00_inv; │ │ │ │ │ -147 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[0])); │ │ │ │ │ -148 c[0] = tmp; │ │ │ │ │ -149 │ │ │ │ │ -150 // d = a^{-1} d /* Division by zero would imply a singular matrix. */ │ │ │ │ │ -151 auto d_0_tmp = d[0]; │ │ │ │ │ -152 auto&& d_0 = Impl::asVector(d[0]); │ │ │ │ │ -153 Impl::asMatrix(a_00_inv).mv(Impl::asVector(d_0_tmp),d_0); │ │ │ │ │ -154 │ │ │ │ │ -155 for (unsigned int i = 1; i < this->_N(); i++) { │ │ │ │ │ -156 │ │ │ │ │ -157 // id = ( a_ii - c_{i-1} a_{i, i-1} ) ^{-1} │ │ │ │ │ -158 _b_l_o_c_k___t_y_p_e tmp; │ │ │ │ │ -159 tmp = (*this)[i][i-1]; │ │ │ │ │ -160 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[i-1])); │ │ │ │ │ -161 │ │ │ │ │ -162 _b_l_o_c_k___t_y_p_e id = (*this)[i][i]; │ │ │ │ │ -163 id -= tmp; │ │ │ │ │ -164 Impl::asMatrix(id).invert(); /* Division by zero risk. */ │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#include "cmath" │ │ │ │ │ +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 │ │ │ │ │ +41namespace _D_u_n_e { │ │ │ │ │ +42 │ │ │ │ │ +_5_8 struct _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ +59 { │ │ │ │ │ +_6_0 enum _A_t_t_r_i_b_u_t_e_S_e_t { │ │ │ │ │ +_6_1 _o_w_n_e_r=1, _o_v_e_r_l_a_p=2, _c_o_p_y=3 │ │ │ │ │ +_6_2 }; │ │ │ │ │ +63 }; │ │ │ │ │ +64 │ │ │ │ │ +76 template │ │ │ │ │ +_7_7 class _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d │ │ │ │ │ +78 { │ │ │ │ │ +79 public: │ │ │ │ │ +_8_1 typedef G _G_l_o_b_a_l_I_d_T_y_p_e; │ │ │ │ │ +82 │ │ │ │ │ +_8_4 typedef L _L_o_c_a_l_I_d_T_y_p_e; │ │ │ │ │ +85 │ │ │ │ │ +_9_2 typedef std::tuple _I_n_d_e_x_T_r_i_p_e_l; │ │ │ │ │ +_9_9 typedef std::tuple _R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l; │ │ │ │ │ +100 │ │ │ │ │ +_1_0_6 void _a_d_d_L_o_c_a_l_I_n_d_e_x (const _I_n_d_e_x_T_r_i_p_e_l& x) │ │ │ │ │ +107 { │ │ │ │ │ +108 if (std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r && │ │ │ │ │ +109 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p && │ │ │ │ │ +110 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ │ +111 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"OwnerOverlapCopyCommunication: global index not in │ │ │ │ │ +index set"); │ │ │ │ │ +112 localindices.insert(x); │ │ │ │ │ +113 } │ │ │ │ │ +114 │ │ │ │ │ +_1_2_0 void _a_d_d_R_e_m_o_t_e_I_n_d_e_x (const _R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l& x) │ │ │ │ │ +121 { │ │ │ │ │ +122 if (std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r && │ │ │ │ │ +123 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p && │ │ │ │ │ +124 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ │ +125 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"OwnerOverlapCopyCommunication: global index not in │ │ │ │ │ +index set"); │ │ │ │ │ +126 remoteindices.insert(x); │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +_1_3_3 const std::set& _l_o_c_a_l_I_n_d_i_c_e_s () const │ │ │ │ │ +134 { │ │ │ │ │ +135 return localindices; │ │ │ │ │ +136 } │ │ │ │ │ +137 │ │ │ │ │ +_1_4_2 const std::set& _r_e_m_o_t_e_I_n_d_i_c_e_s () const │ │ │ │ │ +143 { │ │ │ │ │ +144 return remoteindices; │ │ │ │ │ +145 } │ │ │ │ │ +146 │ │ │ │ │ +_1_5_0 void _c_l_e_a_r () │ │ │ │ │ +151 { │ │ │ │ │ +152 localindices.clear(); │ │ │ │ │ +153 remoteindices.clear(); │ │ │ │ │ +154 } │ │ │ │ │ +155 │ │ │ │ │ +156 private: │ │ │ │ │ +158 std::set localindices; │ │ │ │ │ +160 std::set remoteindices; │ │ │ │ │ +161 }; │ │ │ │ │ +162 │ │ │ │ │ +163 │ │ │ │ │ +164#if HAVE_MPI │ │ │ │ │ 165 │ │ │ │ │ -166 if (i_N() - 1] = d[this->_N() - 1]; │ │ │ │ │ -179 for (int i = this->_N() - 2; i >= 0; i--) { │ │ │ │ │ -180 //x[i] = d[i] - c[i] * x[i + 1]; │ │ │ │ │ -181 x[i] = d[i]; │ │ │ │ │ -182 auto&& x_i = Impl::asVector(x[i]); │ │ │ │ │ -183 Impl::asMatrix(c[i]).mmv(Impl::asVector(x[i+1]), x_i); │ │ │ │ │ -184 } │ │ │ │ │ -185 │ │ │ │ │ -186 } │ │ │ │ │ -187 │ │ │ │ │ -188 private: │ │ │ │ │ -189 │ │ │ │ │ -190 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ -//// │ │ │ │ │ -191 // The following methods from the base class should now actually be called │ │ │ │ │ -192 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ -//// │ │ │ │ │ -193 │ │ │ │ │ -194 // createbegin and createend should be in there, too, but I can't get it to │ │ │ │ │ -compile │ │ │ │ │ -195 // BCRSMatrix::CreateIterator createbegin () {} │ │ │ │ │ -196 // BCRSMatrix::CreateIterator createend () {} │ │ │ │ │ -197 void setrowsize (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s) {} │ │ │ │ │ -198 void incrementrowsize (_s_i_z_e___t_y_p_e i) {} │ │ │ │ │ -199 void endrowsizes () {} │ │ │ │ │ -200 void addindex (_s_i_z_e___t_y_p_e row, _s_i_z_e___t_y_p_e _c_o_l) {} │ │ │ │ │ -201 void endindices () {} │ │ │ │ │ -202 }; │ │ │ │ │ -203 │ │ │ │ │ -204 template │ │ │ │ │ -_2_0_5 struct FieldTraits< _B_T_D_M_a_t_r_i_x > │ │ │ │ │ -206 { │ │ │ │ │ -_2_0_7 using _f_i_e_l_d___t_y_p_e = typename _B_T_D_M_a_t_r_i_x_<_B_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_2_0_8 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ -209 }; │ │ │ │ │ -210 │ │ │ │ │ -213} // end namespace Dune │ │ │ │ │ -214 │ │ │ │ │ -215#endif │ │ │ │ │ -_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +172 template │ │ │ │ │ +_1_7_3 class _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +174 { │ │ │ │ │ +175 template │ │ │ │ │ +176 friend void _l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t(M&, │ │ │ │ │ +177 const std::string&, │ │ │ │ │ +178 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_G_,_L_>&, │ │ │ │ │ +179 bool); │ │ │ │ │ +180 // used types │ │ │ │ │ +181 typedef typename _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_G_l_o_b_a_l_I_d_T_y_p_e_,_L_o_c_a_l_I_d_T_y_p_e_>_:_:_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ │ +IndexTripel; │ │ │ │ │ +182 typedef typename _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_G_l_o_b_a_l_I_d_T_y_p_e_,_L_o_c_a_l_I_d_T_y_p_e_>_:_: │ │ │ │ │ +_R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l RemoteIndexTripel; │ │ │ │ │ +183 typedef typename std::set::const_iterator localindex_iterator; │ │ │ │ │ +184 typedef typename std::set::const_iterator │ │ │ │ │ +remoteindex_iterator; │ │ │ │ │ +185 typedef typename _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_A_t_t_r_i_b_u_t_e_S_e_t _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ │ +186 typedef Dune::ParallelLocalIndex LI; │ │ │ │ │ +187 public: │ │ │ │ │ +_1_8_8 typedef Dune::ParallelIndexSet _P_I_S; │ │ │ │ │ +_1_8_9 typedef Dune::RemoteIndices _R_I; │ │ │ │ │ +_1_9_0 typedef Dune::RemoteIndexListModifier │ │ │ │ │ +_R_I_L_M; │ │ │ │ │ +_1_9_1 typedef typename RI::RemoteIndex _R_X; │ │ │ │ │ +_1_9_2 typedef Dune::BufferedCommunicator _B_C; │ │ │ │ │ +_1_9_3 typedef Dune::Interface _I_F; │ │ │ │ │ +_1_9_4 typedef EnumItem │ │ │ │ │ +_O_w_n_e_r_S_e_t; │ │ │ │ │ +_1_9_5 typedef EnumItem _C_o_p_y_S_e_t; │ │ │ │ │ +_1_9_6 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> _O_w_n_e_r_O_v_e_r_l_a_p_S_e_t; │ │ │ │ │ +_1_9_7 typedef Dune::AllSet _A_l_l_S_e_t; │ │ │ │ │ +198 protected: │ │ │ │ │ +199 │ │ │ │ │ +200 │ │ │ │ │ +202 template │ │ │ │ │ +_2_0_3 struct _C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +204 { │ │ │ │ │ +_2_0_5 typedef typename CommPolicy::IndexedType _V; │ │ │ │ │ +206 │ │ │ │ │ +_2_0_7 static _V _g_a_t_h_e_r(const T& a, std::size_t i) │ │ │ │ │ +208 { │ │ │ │ │ +209 return a[i]; │ │ │ │ │ +210 } │ │ │ │ │ +211 │ │ │ │ │ +_2_1_2 static void _s_c_a_t_t_e_r(T& a, _V v, std::size_t i) │ │ │ │ │ +213 { │ │ │ │ │ +214 a[i] = v; │ │ │ │ │ +215 } │ │ │ │ │ +216 }; │ │ │ │ │ +217 template │ │ │ │ │ +_2_1_8 struct _A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +219 { │ │ │ │ │ +_2_2_0 typedef typename CommPolicy::IndexedType _V; │ │ │ │ │ +221 │ │ │ │ │ +_2_2_2 static _V _g_a_t_h_e_r(const T& a, std::size_t i) │ │ │ │ │ +223 { │ │ │ │ │ +224 return a[i]; │ │ │ │ │ +225 } │ │ │ │ │ +226 │ │ │ │ │ +_2_2_7 static void _s_c_a_t_t_e_r(T& a, _V v, std::size_t i) │ │ │ │ │ +228 { │ │ │ │ │ +229 a[i] += v; │ │ │ │ │ +230 } │ │ │ │ │ +231 }; │ │ │ │ │ +232 │ │ │ │ │ +_2_3_3 void _b_u_i_l_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ +234 { │ │ │ │ │ +235 if (OwnerOverlapToAllInterfaceBuilt) │ │ │ │ │ +236 OwnerOverlapToAllInterface.free(); │ │ │ │ │ +237 _O_w_n_e_r_O_v_e_r_l_a_p_S_e_t sourceFlags; │ │ │ │ │ +238 │ │ │ │ │ +Combine,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ │ +239 destFlags; │ │ │ │ │ +240 OwnerOverlapToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ +241 OwnerOverlapToAllInterfaceBuilt = true; │ │ │ │ │ +242 } │ │ │ │ │ +243 │ │ │ │ │ +_2_4_4 void _b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ +245 { │ │ │ │ │ +246 if (OwnerToAllInterfaceBuilt) │ │ │ │ │ +247 OwnerToAllInterface.free(); │ │ │ │ │ +248 _O_w_n_e_r_S_e_t sourceFlags; │ │ │ │ │ +249 _A_l_l_S_e_t destFlags; │ │ │ │ │ +250 OwnerToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ +251 OwnerToAllInterfaceBuilt = true; │ │ │ │ │ +252 } │ │ │ │ │ +253 │ │ │ │ │ +_2_5_4 void _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ +255 { │ │ │ │ │ +256 if (OwnerCopyToAllInterfaceBuilt) │ │ │ │ │ +257 OwnerCopyToAllInterface.free(); │ │ │ │ │ +258 │ │ │ │ │ +259 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ │ +OwnerCopySet; │ │ │ │ │ +260 OwnerCopySet sourceFlags; │ │ │ │ │ +261 Combine,_A_t_t_r_i_b_u_t_e_S_e_t> destFlags; │ │ │ │ │ +262 OwnerCopyToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ +263 OwnerCopyToAllInterfaceBuilt = true; │ │ │ │ │ +264 } │ │ │ │ │ +265 │ │ │ │ │ +_2_6_6 void _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ +267 { │ │ │ │ │ +268 if (OwnerCopyToOwnerCopyInterfaceBuilt) │ │ │ │ │ +269 OwnerCopyToOwnerCopyInterface.free(); │ │ │ │ │ +270 │ │ │ │ │ +271 │ │ │ │ │ +272 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ │ +OwnerCopySet; │ │ │ │ │ +273 OwnerCopySet sourceFlags; │ │ │ │ │ +274 OwnerCopySet destFlags; │ │ │ │ │ +275 OwnerCopyToOwnerCopyInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ +276 OwnerCopyToOwnerCopyInterfaceBuilt = true; │ │ │ │ │ +277 } │ │ │ │ │ +278 │ │ │ │ │ +_2_7_9 void _b_u_i_l_d_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ │ +280 { │ │ │ │ │ +281 if (CopyToAllInterfaceBuilt) │ │ │ │ │ +282 CopyToAllInterface.free(); │ │ │ │ │ +283 _C_o_p_y_S_e_t sourceFlags; │ │ │ │ │ +284 _A_l_l_S_e_t destFlags; │ │ │ │ │ +285 CopyToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ │ +286 CopyToAllInterfaceBuilt = true; │ │ │ │ │ +287 } │ │ │ │ │ +288 │ │ │ │ │ +289 public: │ │ │ │ │ +290 │ │ │ │ │ +_2_9_5 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y () const { │ │ │ │ │ +296 return category_; │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +_2_9_9 const Communication& _c_o_m_m_u_n_i_c_a_t_o_r() const │ │ │ │ │ +300 { │ │ │ │ │ +301 return cc; │ │ │ │ │ +302 } │ │ │ │ │ +303 │ │ │ │ │ +310 template │ │ │ │ │ +_3_1_1 void _c_o_p_y_O_w_n_e_r_T_o_A_l_l (const T& source, T& dest) const │ │ │ │ │ +312 { │ │ │ │ │ +313 if (!OwnerToAllInterfaceBuilt) │ │ │ │ │ +314 _b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e (); │ │ │ │ │ +315 _B_C _c_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ │ +316 _c_o_m_m_u_n_i_c_a_t_o_r.template build(OwnerToAllInterface); │ │ │ │ │ +317 _c_o_m_m_u_n_i_c_a_t_o_r.template forward >(source,dest); │ │ │ │ │ +318 _c_o_m_m_u_n_i_c_a_t_o_r.free(); │ │ │ │ │ +319 } │ │ │ │ │ +320 │ │ │ │ │ +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 { │ │ │ │ │ +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)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ │ +600 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ │ +_o_w_n_e_r,true)); │ │ │ │ │ +601 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p) │ │ │ │ │ +602 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ │ +_o_v_e_r_l_a_p,true)); │ │ │ │ │ +603 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ │ +604 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ │ +_c_o_p_y,true)); │ │ │ │ │ +605 // std::cout << cc.rank() << ": adding index " << std::get<0>(*i) << " " << │ │ │ │ │ +std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; │ │ │ │ │ +606 } │ │ │ │ │ +607 pis.endResize(); │ │ │ │ │ +608 │ │ │ │ │ +609 // build remote indices WITHOUT communication │ │ │ │ │ +610 // std::cout << cc.rank() << ": build remote indices" << std::endl; │ │ │ │ │ +611 ri.setIndexSets(pis,pis,cc); │ │ │ │ │ +612 if (indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().size()>0) │ │ │ │ │ +613 { │ │ │ │ │ +614 remoteindex_iterator i=indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().begin(); │ │ │ │ │ +615 int p = std::get<0>(*i); │ │ │ │ │ +616 _R_I_L_M modifier = ri.template getModifier(p); │ │ │ │ │ +617 typename PIS::const_iterator pi=pis.begin(); │ │ │ │ │ +618 for ( ; i!=indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().end(); ++i) │ │ │ │ │ +619 { │ │ │ │ │ +620 // handle processor change │ │ │ │ │ +621 if (p!=std::get<0>(*i)) │ │ │ │ │ +622 { │ │ │ │ │ +623 p = std::get<0>(*i); │ │ │ │ │ +624 modifier = ri.template getModifier(p); │ │ │ │ │ +625 pi=pis.begin(); │ │ │ │ │ +626 } │ │ │ │ │ +627 │ │ │ │ │ +628 // position to correct entry in parallel index set │ │ │ │ │ +629 while (pi->global()!=std::get<1>(*i) && pi!=pis.end()) │ │ │ │ │ +630 ++pi; │ │ │ │ │ +631 if (pi==pis.end()) │ │ │ │ │ +632 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"OwnerOverlapCopyCommunication: global index not in │ │ │ │ │ +index set"); │ │ │ │ │ +633 │ │ │ │ │ +634 // insert entry │ │ │ │ │ +635 // std::cout << cc.rank() << ": adding remote index " << std::get<0>(*i) << │ │ │ │ │ +" " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; │ │ │ │ │ +636 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ │ +637 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r,&(*pi))); │ │ │ │ │ +638 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p) │ │ │ │ │ +639 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p,&(*pi))); │ │ │ │ │ +640 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ │ +641 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y,&(*pi))); │ │ │ │ │ +642 } │ │ │ │ │ +643 }else{ │ │ │ │ │ +644 // Force remote indices to be synced! │ │ │ │ │ +645 ri.template getModifier(0); │ │ │ │ │ +646 } │ │ │ │ │ +647 } │ │ │ │ │ +648 │ │ │ │ │ +649 // destructor: free memory in some objects │ │ │ │ │ +_6_5_0 _~_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n () │ │ │ │ │ +651 { │ │ │ │ │ +652 ri.free(); │ │ │ │ │ +653 if (OwnerToAllInterfaceBuilt) OwnerToAllInterface.free(); │ │ │ │ │ +654 if (OwnerOverlapToAllInterfaceBuilt) OwnerOverlapToAllInterface.free(); │ │ │ │ │ +655 if (OwnerCopyToAllInterfaceBuilt) OwnerCopyToAllInterface.free(); │ │ │ │ │ +656 if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free │ │ │ │ │ +(); │ │ │ │ │ +657 if (CopyToAllInterfaceBuilt) CopyToAllInterface.free(); │ │ │ │ │ +658 if (globalLookup_) delete globalLookup_; │ │ │ │ │ +659 if (freecomm==true) │ │ │ │ │ +660 if(comm!=MPI_COMM_NULL) │ │ │ │ │ +661 { │ │ │ │ │ +662#ifdef MPI_2 │ │ │ │ │ +663 // If it is possible to query whether MPI_Finalize │ │ │ │ │ +664 // was called, only free the communicator before │ │ │ │ │ +665 // calling MPI_Finalize. │ │ │ │ │ +666 int wasFinalized = 0; │ │ │ │ │ +667 MPI_Finalized( &wasFinalized ); │ │ │ │ │ +668 if(!wasFinalized) │ │ │ │ │ +669#endif │ │ │ │ │ +670 MPI_Comm_free(&comm); │ │ │ │ │ +671 } │ │ │ │ │ +672 } │ │ │ │ │ +673 │ │ │ │ │ +674 private: │ │ │ │ │ +675 _O_w_n_e_r_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&) │ │ │ │ │ +676 {} │ │ │ │ │ +677 MPI_Comm comm; │ │ │ │ │ +678 Communication cc; │ │ │ │ │ +679 _P_I_S pis; │ │ │ │ │ +680 _R_I ri; │ │ │ │ │ +681 mutable _I_F OwnerToAllInterface; │ │ │ │ │ +682 mutable bool OwnerToAllInterfaceBuilt; │ │ │ │ │ +683 mutable _I_F OwnerOverlapToAllInterface; │ │ │ │ │ +684 mutable bool OwnerOverlapToAllInterfaceBuilt; │ │ │ │ │ +685 mutable _I_F OwnerCopyToAllInterface; │ │ │ │ │ +686 mutable bool OwnerCopyToAllInterfaceBuilt; │ │ │ │ │ +687 mutable _I_F OwnerCopyToOwnerCopyInterface; │ │ │ │ │ +688 mutable bool OwnerCopyToOwnerCopyInterfaceBuilt; │ │ │ │ │ +689 mutable _I_F CopyToAllInterface; │ │ │ │ │ +690 mutable bool CopyToAllInterfaceBuilt; │ │ │ │ │ +691 mutable std::vector mask; │ │ │ │ │ +692 int oldseqNo; │ │ │ │ │ +693 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t* globalLookup_; │ │ │ │ │ +694 const _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category_; │ │ │ │ │ +695 bool freecomm; │ │ │ │ │ +696 }; │ │ │ │ │ +697 │ │ │ │ │ +698#endif │ │ │ │ │ +699 │ │ │ │ │ +700 │ │ │ │ │ +703} // end namespace │ │ │ │ │ +704 │ │ │ │ │ +705#endif │ │ │ │ │ +_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. │ │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_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_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_r_o_w_s_i_z_e_s │ │ │ │ │ -void endrowsizes() │ │ │ │ │ -indicate that size of all rows is defined │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1149 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_a_n_d_o_m │ │ │ │ │ -@ random │ │ │ │ │ -Build entries randomly. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:530 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_d_d_i_n_d_e_x │ │ │ │ │ -void addindex(size_type row, size_type col) │ │ │ │ │ -add index (row,col) to the matrix │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1191 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_i_n_d_i_c_e_s │ │ │ │ │ -void endindices() │ │ │ │ │ -indicate that all indices are defined, check consistency │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1248 │ │ │ │ │ -_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:1972 │ │ │ │ │ -_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:861 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -BCRSMatrix & operator=(const BCRSMatrix &Mat) │ │ │ │ │ -assignment │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:911 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x │ │ │ │ │ -A block-tridiagonal matrix. │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:31 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ -static constexpr auto blocklevel │ │ │ │ │ -increment block level counter │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_B_T_D_M_a_t_r_i_x │ │ │ │ │ -BTDMatrix(size_type size) │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ │ -void solve(V &x, const V &rhs) const │ │ │ │ │ -Use the Thomas algorithm to solve the system Ax=b in O(n) time. │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:125 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -implement row_type with compressed vector │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ -A allocator_type │ │ │ │ │ -export the allocator type │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -B block_type │ │ │ │ │ -export the type representing the components │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -BTDMatrix & operator=(const BTDMatrix &other) │ │ │ │ │ -assignment │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:108 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_B_T_D_M_a_t_r_i_x │ │ │ │ │ -BTDMatrix() │ │ │ │ │ -Default constructor. │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_s_e_t_S_i_z_e │ │ │ │ │ -void setSize(size_type size) │ │ │ │ │ -Resize the matrix. Invalidates the content! │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:208 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename BTDMatrix< B, A >::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn btdmatrix.hh:207 │ │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ +derive error class from the base class in common │ │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ +Attribute set for overlapping Schwarz. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ │ +AttributeSet │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r │ │ │ │ │ +@ owner │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y │ │ │ │ │ +@ copy │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p │ │ │ │ │ +@ overlap │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d │ │ │ │ │ +Information about the index distribution. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ │ +std::tuple< GlobalIdType, LocalIdType, int > IndexTripel │ │ │ │ │ +A triple describing a local index. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_a_d_d_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ │ +void addRemoteIndex(const RemoteIndexTripel &x) │ │ │ │ │ +Add a new remote index triple to the set of remote indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_G_l_o_b_a_l_I_d_T_y_p_e │ │ │ │ │ +G GlobalIdType │ │ │ │ │ +The type of the global index. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_l_o_c_a_l_I_n_d_i_c_e_s │ │ │ │ │ +const std::set< IndexTripel > & localIndices() const │ │ │ │ │ +Get the set of indices local to the process. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:133 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +const std::set< RemoteIndexTripel > & remoteIndices() const │ │ │ │ │ +Get the set of remote indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_L_o_c_a_l_I_d_T_y_p_e │ │ │ │ │ +L LocalIdType │ │ │ │ │ +The type of the local index. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +Remove all indices from the sets. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_a_d_d_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ +void addLocalIndex(const IndexTripel &x) │ │ │ │ │ +Add a new index triple to the set of local indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:106 │ │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ │ +std::tuple< int, GlobalIdType, int > RemoteIndexTripel │ │ │ │ │ +A triple describing a remote index. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ +owner/overlap/copy sema... │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_S_e_t │ │ │ │ │ +EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ +const GlobalLookupIndexSet & globalLookup() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:526 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_n_o_r_m │ │ │ │ │ +FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const │ │ │ │ │ +Compute the global Euclidean norm of a vector. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:425 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void buildOwnerOverlapToAllInterface() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:233 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_I_S │ │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void buildOwnerCopyToAllInterface() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:254 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void buildOwnerCopyToOwnerCopyInterface() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:266 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, │ │ │ │ │ +LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category │ │ │ │ │ +cat_=SolverCategory::overlapping, bool freecomm_=false) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:586 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +SolverCategory::Category category() const │ │ │ │ │ +Get Solver Category. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:295 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y │ │ │ │ │ +void addOwnerCopyToOwnerCopy(const T &source, T &dest) const │ │ │ │ │ +Communicate values from owner and copy data points to owner and copy data │ │ │ │ │ +points and add them to thos... │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:379 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void buildCopyToAllInterface() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:279 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_F_l_a_g_s │ │ │ │ │ +Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:446 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +RemoteIndices & remoteIndices() │ │ │ │ │ +Get the underlying remote indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:490 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ │ +const ParallelIndexSet & indexSet() const │ │ │ │ │ +Get the underlying parallel index set. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:462 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_I │ │ │ │ │ +Dune::RemoteIndices< PIS > RI │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ +void buildGlobalLookup(std::size_t size) │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:508 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l │ │ │ │ │ +void addOwnerOverlapToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from owner data points to all other data points and add them │ │ │ │ │ +to those values. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:345 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +Dune::RemoteIndices< PIS > RemoteIndices │ │ │ │ │ +The type of the remote indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:452 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ │ +void project(T1 &x) const │ │ │ │ │ +Set vector to zero at copy dofs. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:538 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_A_l_l_S_e_t │ │ │ │ │ +Dune::AllSet< AttributeSet > AllSet │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:197 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_S_e_t │ │ │ │ │ +Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, │ │ │ │ │ +EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > │ │ │ │ │ +OwnerOverlapSet │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:196 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ │ +void copyCopyToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from copy data points to all other data points. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ │ +The type of the reverse lookup of indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_I_F │ │ │ │ │ +Dune::Interface IF │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:193 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_~_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +~OwnerOverlapCopyCommunication() │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:650 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ +void buildGlobalLookup() │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:495 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_B_C │ │ │ │ │ +Dune::BufferedCommunicator BC │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:192 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category │ │ │ │ │ +cat_=SolverCategory::overlapping, bool freecomm_=false) │ │ │ │ │ +Construct the communication without any indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:554 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ │ +ParallelIndexSet & indexSet() │ │ │ │ │ +Get the underlying parallel index set. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:480 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_d_o_t │ │ │ │ │ +void dot(const T1 &x, const T1 &y, T2 &result) const │ │ │ │ │ +Compute a global dot product of two vectors. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:398 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +const Communication< MPI_Comm > & communicator() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory:: │ │ │ │ │ +overlapping) │ │ │ │ │ +Construct the communication without any indices using MPI_COMM_WORLD. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:572 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ +EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ +void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from owner data points to all other data points. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +const RemoteIndices & remoteIndices() const │ │ │ │ │ +Get the underlying remote indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t │ │ │ │ │ +friend void loadMatrixMarket(M &, const std::string &, │ │ │ │ │ +OwnerOverlapCopyCommunication< G, L > &, bool) │ │ │ │ │ +Load a parallel matrix/vector stored in matrix market format. │ │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1269 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_X │ │ │ │ │ +RI::RemoteIndex RX │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:191 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l │ │ │ │ │ +void addOwnerCopyToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from owner and copy data points to all other data points and │ │ │ │ │ +add them to those val... │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:362 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ +void freeGlobalLookup() │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_I_L_M │ │ │ │ │ +Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:190 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ │ +The type of the parallel index set. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void buildOwnerToAllInterface() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:244 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +gather/scatter callback for communcation │ │ │ │ │ +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_:_:_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ │ +@ overlapping │ │ │ │ │ +Category for overlapping solvers. │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:29 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: scalarproducts.hh File Reference │ │ │ │ +dune-istl: superlu.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,69 +73,79 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ - │ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Define base class for scalar product and norm. │ │ │ │ +

Classes for using SuperLU with ISTL matrices. │ │ │ │ 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 "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>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::ScalarProduct< X >
 Base class for scalar product and norm computation. More...
struct  Dune::SuperLUSolveChooser< T >
 
class  Dune::ParallelScalarProduct< X, C >
 Scalar product for overlapping Schwarz methods. More...
struct  Dune::SuperLUDenseMatChooser< T >
 
class  Dune::SeqScalarProduct< X >
 Default implementation for the scalar case. More...
struct  Dune::SuperLUQueryChooser< T >
 
class  Dune::NonoverlappingSchwarzScalarProduct< X, C >
 Nonoverlapping Scalar Product with communication object. More...
struct  Dune::QuerySpaceChooser< T >
 
class  Dune::OverlappingSchwarzScalarProduct< X, C >
 Scalar product for overlapping Schwarz methods. More...
class  Dune::SuperLU< M >
 SuperLu Solver. More...
 
struct  Dune::IsDirectSolver< SuperLU< BCRSMatrix< T, A > > >
 
struct  Dune::StoresColumnCompressed< SuperLU< BCRSMatrix< T, A > > >
 
struct  Dune::SuperLUCreator
 
struct  Dune::SuperLUCreator::isValidBlock< class >
 
struct  Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< double, k > >
 
struct  Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< std::complex< double >, k > >
 
struct  Dune::SuperLUCreator::isValidBlock< double >
 
struct  Dune::SuperLUCreator::isValidBlock< std::complex< double > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Functions

template<class X , class Comm >
std::shared_ptr< ScalarProduct< X > > Dune::makeScalarProduct (std::shared_ptr< const Comm > comm, SolverCategory::Category category)
 Choose the approriate scalar product for a solver category.
 
template<class X , class Comm >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const Comm &comm, SolverCategory::Category category)
 
 Dune::DUNE_REGISTER_DIRECT_SOLVER ("superlu", SuperLUCreator())
 
│ │ │ │

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.

│ │ │ │ +

Classes for using SuperLU with ISTL matrices.

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

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::MultiTypeBlockMatrix< FirstRow, Args >
 A Matrix class to support different block types. More...
 
class  Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, remain_col >
 part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types More...
 
class  Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, 0 >
 
class  Dune::MultiTypeBlockMatrix_Solver< I, crow, remain_row >
 solver for MultiTypeBlockVector & MultiTypeBlockMatrix types More...
 
class  Dune::MultiTypeBlockMatrix_Solver< I, crow, 0 >
 
struct  std::tuple_element< i, Dune::MultiTypeBlockMatrix< Args... > >
 Make std::tuple_element work for MultiTypeBlockMatrix. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 
namespace  std
 STL namespace.
namespace  Dune::ISTL
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

template<typename T1 , typename... Args>
std::ostream & Dune::operator<< (std::ostream &s, const MultiTypeBlockMatrix< T1, Args... > &m)
 << operator for a MultiTypeBlockMatrix
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,47 +1,21 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -multitypeblockmatrix.hh File Reference │ │ │ │ │ -#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" │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +bccsmatrixinitializer.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_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 │ │ │ │ │ - class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _F_i_r_s_t_R_o_w_,_ _A_r_g_s_ _> │ │ │ │ │ -  A _M_a_t_r_i_x class to support different block types. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_ _I_,_ _c_r_o_w_,_ _c_c_o_l_,_ _r_e_m_a_i_n___c_o_l_ _> │ │ │ │ │ -  part of solvers for _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r & _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x types │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_ _I_,_ _c_r_o_w_,_ _c_c_o_l_,_ _0_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _r_e_m_a_i_n___r_o_w_ _> │ │ │ │ │ -  solver for _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r & _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x types _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _> │ │ │ │ │ -  │ │ │ │ │ -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_M_a_t_r_i_x_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ │ -  Make std::tuple_element work for MultiTypeBlockMatrix. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -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_M_a_t_r_i_x< │ │ │ │ │ - T1, Args... > &m) │ │ │ │ │ -  << operator for a _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ +namespace   _D_u_n_e_:_:_I_S_T_L │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: multitypeblockmatrix.hh Source File │ │ │ │ +dune-istl: bccsmatrixinitializer.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,666 +74,335 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
multitypeblockmatrix.hh
│ │ │ │ +
bccsmatrixinitializer.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_MULTITYPEBLOCKMATRIX_HH
│ │ │ │ -
6#define DUNE_ISTL_MULTITYPEBLOCKMATRIX_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_BCCSMATRIX_INITIALIZER_HH
│ │ │ │ +
6#define DUNE_ISTL_BCCSMATRIX_INITIALIZER_HH
│ │ │ │
7
│ │ │ │ -
8#include <cmath>
│ │ │ │ -
9#include <iostream>
│ │ │ │ -
10#include <tuple>
│ │ │ │ -
11
│ │ │ │ -
12#include <dune/common/hybridutilities.hh>
│ │ │ │ +
8#include <limits>
│ │ │ │ +
9#include <set>
│ │ │ │ +
10
│ │ │ │ +
11#include <dune/common/typetraits.hh>
│ │ │ │ +
12#include <dune/common/scalarmatrixview.hh>
│ │ │ │
13
│ │ │ │ -
14#include "istlexception.hh"
│ │ │ │ + │ │ │ │
15
│ │ │ │ -
16// forward declaration
│ │ │ │ -
17namespace Dune
│ │ │ │ -
18{
│ │ │ │ -
19 template<typename FirstRow, typename... Args>
│ │ │ │ -
20 class MultiTypeBlockMatrix;
│ │ │ │ +
16namespace Dune
│ │ │ │ +
17{
│ │ │ │ +
18 template<class I, class S, class D>
│ │ │ │ +
19 class OverlappingSchwarzInitializer;
│ │ │ │ +
20}
│ │ │ │
21
│ │ │ │ -
22 template<int I, int crow, int remain_row>
│ │ │ │ -
23 class MultiTypeBlockMatrix_Solver;
│ │ │ │ -
24}
│ │ │ │ -
25
│ │ │ │ -
26#include "gsetc.hh"
│ │ │ │ -
27
│ │ │ │ -
28namespace Dune {
│ │ │ │ -
29
│ │ │ │ -
43 template<typename FirstRow, typename... Args>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
45 : public std::tuple<FirstRow, Args...>
│ │ │ │ -
46 {
│ │ │ │ -
47 using ParentType = std::tuple<FirstRow, Args...>;
│ │ │ │ -
48 public:
│ │ │ │ -
49
│ │ │ │ -
51 using ParentType::ParentType;
│ │ │ │ -
52
│ │ │ │ -
56 typedef MultiTypeBlockMatrix<FirstRow, Args...> type;
│ │ │ │ -
57
│ │ │ │ -
59 using size_type = std::size_t;
│ │ │ │ -
60
│ │ │ │ -
61 typedef typename FirstRow::field_type field_type;
│ │ │ │ -
62
│ │ │ │ -
│ │ │ │ -
64 static constexpr size_type N()
│ │ │ │ -
65 {
│ │ │ │ -
66 return 1+sizeof...(Args);
│ │ │ │ -
67 }
│ │ │ │ -
│ │ │ │ +
22namespace Dune::ISTL::Impl
│ │ │ │ +
23{
│ │ │ │ +
31 template<class M, class S>
│ │ │ │ +
32 class MatrixRowSubset
│ │ │ │ +
33 {
│ │ │ │ +
34 public:
│ │ │ │ +
36 typedef M Matrix;
│ │ │ │ +
38 typedef S RowIndexSet;
│ │ │ │ +
39
│ │ │ │ +
45 MatrixRowSubset(const Matrix& m, const RowIndexSet& s)
│ │ │ │ +
46 : m_(m), s_(s)
│ │ │ │ +
47 {}
│ │ │ │ +
48
│ │ │ │ +
49 const Matrix& matrix() const
│ │ │ │ +
50 {
│ │ │ │ +
51 return m_;
│ │ │ │ +
52 }
│ │ │ │ +
53
│ │ │ │ +
54 const RowIndexSet& rowIndexSet() const
│ │ │ │ +
55 {
│ │ │ │ +
56 return s_;
│ │ │ │ +
57 }
│ │ │ │ +
58
│ │ │ │ +
60 class const_iterator
│ │ │ │ +
61 : public ForwardIteratorFacade<const_iterator, const typename Matrix::row_type>
│ │ │ │ +
62 {
│ │ │ │ +
63 public:
│ │ │ │ +
64 const_iterator(typename Matrix::const_iterator firstRow,
│ │ │ │ +
65 typename RowIndexSet::const_iterator pos)
│ │ │ │ +
66 : firstRow_(firstRow), pos_(pos)
│ │ │ │ +
67 {}
│ │ │ │
68
│ │ │ │ -
74 [[deprecated("Use method 'N' instead")]]
│ │ │ │ -
│ │ │ │ -
75 static constexpr size_type size()
│ │ │ │ -
76 {
│ │ │ │ -
77 return 1+sizeof...(Args);
│ │ │ │ -
78 }
│ │ │ │ -
│ │ │ │ -
79
│ │ │ │ -
│ │ │ │ -
81 static constexpr size_type M()
│ │ │ │ -
82 {
│ │ │ │ -
83 return FirstRow::size();
│ │ │ │ -
84 }
│ │ │ │ -
│ │ │ │ -
85
│ │ │ │ -
102 template< size_type index >
│ │ │ │ -
103 auto
│ │ │ │ -
│ │ │ │ -
104 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable)
│ │ │ │ -
105 -> decltype(std::get<index>(*this))
│ │ │ │ -
106 {
│ │ │ │ -
107 return std::get<index>(*this);
│ │ │ │ -
108 }
│ │ │ │ -
│ │ │ │ -
109
│ │ │ │ -
115 template< size_type index >
│ │ │ │ -
116 auto
│ │ │ │ -
│ │ │ │ -
117 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable) const
│ │ │ │ -
118 -> decltype(std::get<index>(*this))
│ │ │ │ -
119 {
│ │ │ │ -
120 return std::get<index>(*this);
│ │ │ │ -
121 }
│ │ │ │ -
│ │ │ │ -
122
│ │ │ │ -
126 template<typename T>
│ │ │ │ -
│ │ │ │ -
127 void operator= (const T& newval) {
│ │ │ │ -
128 using namespace Dune::Hybrid;
│ │ │ │ -
129 auto size = index_constant<1+sizeof...(Args)>();
│ │ │ │ -
130 // Since Dune::Hybrid::size(MultiTypeBlockMatrix) is not implemented,
│ │ │ │ -
131 // we cannot use a plain forEach(*this, ...). This could be achieved,
│ │ │ │ -
132 // e.g., by implementing a static size() method.
│ │ │ │ -
133 forEach(integralRange(size), [&](auto&& i) {
│ │ │ │ -
134 (*this)[i] = newval;
│ │ │ │ -
135 });
│ │ │ │ -
136 }
│ │ │ │ -
│ │ │ │ -
137
│ │ │ │ -
138 //===== vector space arithmetic
│ │ │ │ -
139
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
142 {
│ │ │ │ -
143 auto size = index_constant<N()>();
│ │ │ │ -
144 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ -
145 (*this)[i] *= k;
│ │ │ │ -
146 });
│ │ │ │ +
69
│ │ │ │ +
70 const typename Matrix::row_type& dereference() const
│ │ │ │ +
71 {
│ │ │ │ +
72 return *(firstRow_+ *pos_);
│ │ │ │ +
73 }
│ │ │ │ +
74 bool equals(const const_iterator& o) const
│ │ │ │ +
75 {
│ │ │ │ +
76 return pos_==o.pos_;
│ │ │ │ +
77 }
│ │ │ │ +
78 void increment()
│ │ │ │ +
79 {
│ │ │ │ +
80 ++pos_;
│ │ │ │ +
81 }
│ │ │ │ +
82 typename RowIndexSet::value_type index() const
│ │ │ │ +
83 {
│ │ │ │ +
84 return *pos_;
│ │ │ │ +
85 }
│ │ │ │ +
86
│ │ │ │ +
87 private:
│ │ │ │ +
89 typename Matrix::const_iterator firstRow_;
│ │ │ │ +
91 typename RowIndexSet::const_iterator pos_;
│ │ │ │ +
92 };
│ │ │ │ +
93
│ │ │ │ +
95 const_iterator begin() const
│ │ │ │ +
96 {
│ │ │ │ +
97 return const_iterator(m_.begin(), s_.begin());
│ │ │ │ +
98 }
│ │ │ │ +
100 const_iterator end() const
│ │ │ │ +
101 {
│ │ │ │ +
102 return const_iterator(m_.begin(), s_.end());
│ │ │ │ +
103 }
│ │ │ │ +
104
│ │ │ │ +
105 private:
│ │ │ │ +
107 const Matrix& m_;
│ │ │ │ +
109 const RowIndexSet& s_;
│ │ │ │ +
110 };
│ │ │ │ +
111
│ │ │ │ +
118 template<class M, class I = typename M::size_type>
│ │ │ │ +
119 class BCCSMatrixInitializer
│ │ │ │ +
120 {
│ │ │ │ +
121 template<class IList, class S, class D>
│ │ │ │ + │ │ │ │ +
123 public:
│ │ │ │ +
124 using Matrix = M;
│ │ │ │ +
125 using Index = I;
│ │ │ │ +
126 typedef Dune::ISTL::Impl::BCCSMatrix<typename Matrix::field_type, I> OutputMatrix;
│ │ │ │ +
127 typedef typename Matrix::size_type size_type;
│ │ │ │ +
128
│ │ │ │ +
131 BCCSMatrixInitializer(OutputMatrix& mat_)
│ │ │ │ +
132 : mat(&mat_), cols(mat_.M())
│ │ │ │ +
133 {
│ │ │ │ +
134 if constexpr (Dune::IsNumber<typename M::block_type>::value)
│ │ │ │ +
135 {
│ │ │ │ +
136 n = m = 1;
│ │ │ │ +
137 }
│ │ │ │ +
138 else
│ │ │ │ +
139 {
│ │ │ │ +
140 // WARNING: This assumes that all blocks are dense and identical
│ │ │ │ +
141 n = M::block_type::rows;
│ │ │ │ +
142 m = M::block_type::cols;
│ │ │ │ +
143 }
│ │ │ │ +
144
│ │ │ │ +
145 mat->Nnz_=0;
│ │ │ │ +
146 }
│ │ │ │
147
│ │ │ │ -
148 return *this;
│ │ │ │ -
149 }
│ │ │ │ -
│ │ │ │ -
150
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
153 {
│ │ │ │ -
154 auto size = index_constant<N()>();
│ │ │ │ -
155 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ -
156 (*this)[i] /= k;
│ │ │ │ -
157 });
│ │ │ │ -
158
│ │ │ │ -
159 return *this;
│ │ │ │ -
160 }
│ │ │ │ -
│ │ │ │ -
161
│ │ │ │ -
162
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
169 {
│ │ │ │ -
170 auto size = index_constant<N()>();
│ │ │ │ -
171 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ -
172 (*this)[i] += b[i];
│ │ │ │ -
173 });
│ │ │ │ -
174
│ │ │ │ -
175 return *this;
│ │ │ │ -
176 }
│ │ │ │ -
│ │ │ │ -
177
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
184 {
│ │ │ │ -
185 auto size = index_constant<N()>();
│ │ │ │ -
186 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ -
187 (*this)[i] -= b[i];
│ │ │ │ -
188 });
│ │ │ │ +
148 BCCSMatrixInitializer()
│ │ │ │ +
149 : mat(0), cols(0), n(0), m(0)
│ │ │ │ +
150 {}
│ │ │ │ +
151
│ │ │ │ +
152 virtual ~BCCSMatrixInitializer()
│ │ │ │ +
153 {}
│ │ │ │ +
154
│ │ │ │ +
155 template<typename Iter>
│ │ │ │ +
156 void addRowNnz(const Iter& row) const
│ │ │ │ +
157 {
│ │ │ │ +
158 mat->Nnz_+=row->getsize();
│ │ │ │ +
159 }
│ │ │ │ +
160
│ │ │ │ +
161 template<typename Iter, typename FullMatrixIndex>
│ │ │ │ +
162 void addRowNnz(const Iter& row, const std::set<FullMatrixIndex>& indices) const
│ │ │ │ +
163 {
│ │ │ │ +
164 auto siter =indices.begin();
│ │ │ │ +
165 for (auto entry=row->begin(); entry!=row->end(); ++entry)
│ │ │ │ +
166 {
│ │ │ │ +
167 for(; siter!=indices.end() && *siter<entry.index(); ++siter) ;
│ │ │ │ +
168 if(siter==indices.end())
│ │ │ │ +
169 break;
│ │ │ │ +
170 if(*siter==entry.index())
│ │ │ │ +
171 // index is in subdomain
│ │ │ │ +
172 ++mat->Nnz_;
│ │ │ │ +
173 }
│ │ │ │ +
174 }
│ │ │ │ +
175
│ │ │ │ +
176 template<typename Iter, typename SubMatrixIndex>
│ │ │ │ +
177 void addRowNnz(const Iter& row, const std::vector<SubMatrixIndex>& indices) const
│ │ │ │ +
178 {
│ │ │ │ +
179 for (auto entry=row->begin(); entry!=row->end(); ++entry)
│ │ │ │ +
180 if (indices[entry.index()]!=std::numeric_limits<SubMatrixIndex>::max())
│ │ │ │ +
181 ++mat->Nnz_;
│ │ │ │ +
182 }
│ │ │ │ +
183
│ │ │ │ +
184 void allocate()
│ │ │ │ +
185 {
│ │ │ │ +
186 allocateMatrixStorage();
│ │ │ │ +
187 allocateMarker();
│ │ │ │ +
188 }
│ │ │ │
189
│ │ │ │ -
190 return *this;
│ │ │ │ -
191 }
│ │ │ │ -
│ │ │ │ -
192
│ │ │ │ -
195 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
196 void mv (const X& x, Y& y) const {
│ │ │ │ -
197 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ -
198 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ -
199 y = 0; //reset y (for mv uses umv)
│ │ │ │ -
200 umv(x,y);
│ │ │ │ -
201 }
│ │ │ │ -
│ │ │ │ -
202
│ │ │ │ -
205 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
206 void umv (const X& x, Y& y) const {
│ │ │ │ -
207 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ -
208 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ -
209 using namespace Dune::Hybrid;
│ │ │ │ -
210 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
211 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
212 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
213 (*this)[i][j].umv(x[j], y[i]);
│ │ │ │ -
214 });
│ │ │ │ -
215 });
│ │ │ │ -
216 }
│ │ │ │ -
│ │ │ │ -
217
│ │ │ │ -
220 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
221 void mmv (const X& x, Y& y) const {
│ │ │ │ -
222 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ -
223 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ -
224 using namespace Dune::Hybrid;
│ │ │ │ -
225 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
226 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
227 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
228 (*this)[i][j].mmv(x[j], y[i]);
│ │ │ │ -
229 });
│ │ │ │ -
230 });
│ │ │ │ -
231 }
│ │ │ │ -
│ │ │ │ -
232
│ │ │ │ -
235 template<typename AlphaType, typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
236 void usmv (const AlphaType& alpha, const X& x, Y& y) const {
│ │ │ │ -
237 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ -
238 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ -
239 using namespace Dune::Hybrid;
│ │ │ │ -
240 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
241 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
242 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
243 (*this)[i][j].usmv(alpha, x[j], y[i]);
│ │ │ │ -
244 });
│ │ │ │ -
245 });
│ │ │ │ -
246 }
│ │ │ │ -
│ │ │ │ -
247
│ │ │ │ -
250 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
251 void mtv (const X& x, Y& y) const {
│ │ │ │ -
252 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ -
253 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ -
254 y = 0;
│ │ │ │ -
255 umtv(x,y);
│ │ │ │ -
256 }
│ │ │ │ -
│ │ │ │ -
257
│ │ │ │ -
260 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
261 void umtv (const X& x, Y& y) const {
│ │ │ │ -
262 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ -
263 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ -
264 using namespace Dune::Hybrid;
│ │ │ │ -
265 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
266 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
267 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
268 (*this)[j][i].umtv(x[j], y[i]);
│ │ │ │ -
269 });
│ │ │ │ -
270 });
│ │ │ │ -
271 }
│ │ │ │ -
│ │ │ │ +
190 template<typename Iter, typename CIter>
│ │ │ │ +
191 void countEntries([[maybe_unused]] const Iter& row, const CIter& col) const
│ │ │ │ +
192 {
│ │ │ │ +
193 countEntries(col.index());
│ │ │ │ +
194 }
│ │ │ │ +
195
│ │ │ │ +
196 void countEntries(size_type colindex) const
│ │ │ │ +
197 {
│ │ │ │ +
198 for(size_type i=0; i < m; ++i)
│ │ │ │ +
199 {
│ │ │ │ +
200 assert(colindex*m+i<cols);
│ │ │ │ +
201 marker[colindex*m+i]+=n;
│ │ │ │ +
202 }
│ │ │ │ +
203 }
│ │ │ │ +
204
│ │ │ │ +
205 void calcColstart() const
│ │ │ │ +
206 {
│ │ │ │ +
207 mat->colstart[0]=0;
│ │ │ │ +
208 for(size_type i=0; i < cols; ++i) {
│ │ │ │ +
209 assert(i<cols);
│ │ │ │ +
210 mat->colstart[i+1]=mat->colstart[i]+marker[i];
│ │ │ │ +
211 marker[i]=mat->colstart[i];
│ │ │ │ +
212 }
│ │ │ │ +
213 }
│ │ │ │ +
214
│ │ │ │ +
215 template<typename Iter, typename CIter>
│ │ │ │ +
216 void copyValue(const Iter& row, const CIter& col) const
│ │ │ │ +
217 {
│ │ │ │ +
218 copyValue(col, row.index(), col.index());
│ │ │ │ +
219 }
│ │ │ │ +
220
│ │ │ │ +
221 template<typename CIter>
│ │ │ │ +
222 void copyValue(const CIter& col, size_type rowindex, size_type colindex) const
│ │ │ │ +
223 {
│ │ │ │ +
224 for(size_type i=0; i<n; i++) {
│ │ │ │ +
225 for(size_type j=0; j<m; j++) {
│ │ │ │ +
226 assert(colindex*m+j<cols-1 || (size_type)marker[colindex*m+j]<(size_type)mat->colstart[colindex*m+j+1]);
│ │ │ │ +
227 assert((size_type)marker[colindex*m+j]<mat->Nnz_);
│ │ │ │ +
228 mat->rowindex[marker[colindex*m+j]]=rowindex*n+i;
│ │ │ │ +
229 mat->values[marker[colindex*m+j]] = Dune::Impl::asMatrix(*col)[i][j];
│ │ │ │ +
230 ++marker[colindex*m+j]; // index for next entry in column
│ │ │ │ +
231 }
│ │ │ │ +
232 }
│ │ │ │ +
233 }
│ │ │ │ +
234
│ │ │ │ +
235 virtual void createMatrix() const
│ │ │ │ +
236 {
│ │ │ │ +
237 marker.clear();
│ │ │ │ +
238 }
│ │ │ │ +
239
│ │ │ │ +
240 protected:
│ │ │ │ +
241
│ │ │ │ +
242 void allocateMatrixStorage() const
│ │ │ │ +
243 {
│ │ │ │ +
244 mat->Nnz_*=n*m;
│ │ │ │ +
245 // initialize data
│ │ │ │ +
246 mat->values=new typename M::field_type[mat->Nnz_];
│ │ │ │ +
247 mat->rowindex=new I[mat->Nnz_];
│ │ │ │ +
248 mat->colstart=new I[cols+1];
│ │ │ │ +
249 }
│ │ │ │ +
250
│ │ │ │ +
251 void allocateMarker()
│ │ │ │ +
252 {
│ │ │ │ +
253 marker.resize(cols);
│ │ │ │ +
254 std::fill(marker.begin(), marker.end(), 0);
│ │ │ │ +
255 }
│ │ │ │ +
256
│ │ │ │ +
257 OutputMatrix* mat;
│ │ │ │ +
258 size_type cols;
│ │ │ │ +
259
│ │ │ │ +
260 // Number of rows/columns of the matrix entries
│ │ │ │ +
261 // (assumed to be scalars or dense matrices)
│ │ │ │ +
262 size_type n, m;
│ │ │ │ +
263
│ │ │ │ +
264 mutable std::vector<size_type> marker;
│ │ │ │ +
265 };
│ │ │ │ +
266
│ │ │ │ +
267 template<class F, class Matrix>
│ │ │ │ +
268 void copyToBCCSMatrix(F& initializer, const Matrix& matrix)
│ │ │ │ +
269 {
│ │ │ │ +
270 for (auto row=matrix.begin(); row!= matrix.end(); ++row)
│ │ │ │ +
271 initializer.addRowNnz(row);
│ │ │ │
272
│ │ │ │ -
275 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
276 void mmtv (const X& x, Y& y) const {
│ │ │ │ -
277 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ -
278 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ -
279 using namespace Dune::Hybrid;
│ │ │ │ -
280 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
281 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
282 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
283 (*this)[j][i].mmtv(x[j], y[i]);
│ │ │ │ -
284 });
│ │ │ │ -
285 });
│ │ │ │ -
286 }
│ │ │ │ -
│ │ │ │ +
273 initializer.allocate();
│ │ │ │ +
274
│ │ │ │ +
275 for (auto row=matrix.begin(); row!= matrix.end(); ++row) {
│ │ │ │ +
276
│ │ │ │ +
277 for (auto col=row->begin(); col != row->end(); ++col)
│ │ │ │ +
278 initializer.countEntries(row, col);
│ │ │ │ +
279 }
│ │ │ │ +
280
│ │ │ │ +
281 initializer.calcColstart();
│ │ │ │ +
282
│ │ │ │ +
283 for (auto row=matrix.begin(); row!= matrix.end(); ++row) {
│ │ │ │ +
284 for (auto col=row->begin(); col != row->end(); ++col) {
│ │ │ │ +
285 initializer.copyValue(row, col);
│ │ │ │ +
286 }
│ │ │ │
287
│ │ │ │ -
290 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
291 void usmtv (const field_type& alpha, const X& x, Y& y) const {
│ │ │ │ -
292 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ -
293 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ -
294 using namespace Dune::Hybrid;
│ │ │ │ -
295 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
296 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
297 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
298 (*this)[j][i].usmtv(alpha, x[j], y[i]);
│ │ │ │ -
299 });
│ │ │ │ -
300 });
│ │ │ │ -
301 }
│ │ │ │ -
│ │ │ │ -
302
│ │ │ │ -
305 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
306 void umhv (const X& x, Y& y) const {
│ │ │ │ -
307 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ -
308 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ -
309 using namespace Dune::Hybrid;
│ │ │ │ -
310 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
311 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
312 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
313 (*this)[j][i].umhv(x[j], y[i]);
│ │ │ │ -
314 });
│ │ │ │ -
315 });
│ │ │ │ -
316 }
│ │ │ │ -
│ │ │ │ +
288 }
│ │ │ │ +
289 initializer.createMatrix();
│ │ │ │ +
290 }
│ │ │ │ +
291
│ │ │ │ +
292 template<class F, class M,class S>
│ │ │ │ +
293 void copyToBCCSMatrix(F& initializer, const MatrixRowSubset<M,S>& mrs)
│ │ │ │ +
294 {
│ │ │ │ +
295 typedef MatrixRowSubset<M,S> MRS;
│ │ │ │ +
296 typedef typename MRS::RowIndexSet SIS;
│ │ │ │ +
297 typedef typename SIS::const_iterator SIter;
│ │ │ │ +
298 typedef typename MRS::const_iterator Iter;
│ │ │ │ +
299 typedef typename std::iterator_traits<Iter>::value_type row_type;
│ │ │ │ +
300 typedef typename row_type::const_iterator CIter;
│ │ │ │ +
301
│ │ │ │ +
302 typedef typename MRS::Matrix::size_type size_type;
│ │ │ │ +
303
│ │ │ │ +
304 // A vector containing the corresponding indices in
│ │ │ │ +
305 // the to create submatrix.
│ │ │ │ +
306 // If an entry is the maximum of size_type then this index will not appear in
│ │ │ │ +
307 // the submatrix.
│ │ │ │ +
308 std::vector<size_type> subMatrixIndex(mrs.matrix().N(),
│ │ │ │ +
309 std::numeric_limits<size_type>::max());
│ │ │ │ +
310 size_type s=0;
│ │ │ │ +
311 for(SIter index = mrs.rowIndexSet().begin(); index!=mrs.rowIndexSet().end(); ++index)
│ │ │ │ +
312 subMatrixIndex[*index]=s++;
│ │ │ │ +
313
│ │ │ │ +
314 // Calculate upper Bound for nonzeros
│ │ │ │ +
315 for(Iter row=mrs.begin(); row!= mrs.end(); ++row)
│ │ │ │ +
316 initializer.addRowNnz(row, subMatrixIndex);
│ │ │ │
317
│ │ │ │ -
320 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
321 void mmhv (const X& x, Y& y) const {
│ │ │ │ -
322 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ -
323 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ -
324 using namespace Dune::Hybrid;
│ │ │ │ -
325 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
326 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
327 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
328 (*this)[j][i].mmhv(x[j], y[i]);
│ │ │ │ -
329 });
│ │ │ │ -
330 });
│ │ │ │ -
331 }
│ │ │ │ -
│ │ │ │ -
332
│ │ │ │ -
335 template<typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
336 void usmhv (const field_type& alpha, const X& x, Y& y) const {
│ │ │ │ -
337 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ -
338 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ -
339 using namespace Dune::Hybrid;
│ │ │ │ -
340 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ -
341 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
342 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ -
343 (*this)[j][i].usmhv(alpha, x[j], y[i]);
│ │ │ │ -
344 });
│ │ │ │ -
345 });
│ │ │ │ -
346 }
│ │ │ │ -
│ │ │ │ -
347
│ │ │ │ -
348
│ │ │ │ -
349 //===== norms
│ │ │ │ -
350
│ │ │ │ -
│ │ │ │ -
352 auto frobenius_norm2 () const
│ │ │ │ -
353 {
│ │ │ │ -
354 using field_type_00 = typename std::decay_t<decltype((*this)[Indices::_0][Indices::_0])>::field_type;
│ │ │ │ -
355 typename FieldTraits<field_type_00>::real_type sum=0;
│ │ │ │ -
356
│ │ │ │ -
357 auto rows = index_constant<N()>();
│ │ │ │ -
358 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) {
│ │ │ │ -
359 auto cols = index_constant<MultiTypeBlockMatrix<FirstRow, Args...>::M()>();
│ │ │ │ -
360 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) {
│ │ │ │ -
361 sum += (*this)[i][j].frobenius_norm2();
│ │ │ │ -
362 });
│ │ │ │ -
363 });
│ │ │ │ -
364
│ │ │ │ -
365 return sum;
│ │ │ │ -
366 }
│ │ │ │ -
│ │ │ │ -
367
│ │ │ │ -
│ │ │ │ -
369 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ -
370 {
│ │ │ │ -
371 return sqrt(frobenius_norm2());
│ │ │ │ -
372 }
│ │ │ │ -
│ │ │ │ -
373
│ │ │ │ -
│ │ │ │ -
375 auto infinity_norm () const
│ │ │ │ -
376 {
│ │ │ │ -
377 using field_type_00 = typename std::decay_t<decltype((*this)[Indices::_0][Indices::_0])>::field_type;
│ │ │ │ -
378 using std::max;
│ │ │ │ -
379 typename FieldTraits<field_type_00>::real_type norm=0;
│ │ │ │ -
380
│ │ │ │ -
381 auto rows = index_constant<N()>();
│ │ │ │ -
382 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) {
│ │ │ │ -
383
│ │ │ │ -
384 typename FieldTraits<field_type_00>::real_type sum=0;
│ │ │ │ -
385 auto cols = index_constant<MultiTypeBlockMatrix<FirstRow, Args...>::M()>();
│ │ │ │ -
386 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) {
│ │ │ │ -
387 sum += (*this)[i][j].infinity_norm();
│ │ │ │ -
388 });
│ │ │ │ -
389 norm = max(sum, norm);
│ │ │ │ -
390 });
│ │ │ │ -
391
│ │ │ │ -
392 return norm;
│ │ │ │ -
393 }
│ │ │ │ -
│ │ │ │ -
394
│ │ │ │ -
│ │ │ │ -
396 auto infinity_norm_real () const
│ │ │ │ -
397 {
│ │ │ │ -
398 using field_type_00 = typename std::decay_t<decltype((*this)[Indices::_0][Indices::_0])>::field_type;
│ │ │ │ -
399 using std::max;
│ │ │ │ -
400 typename FieldTraits<field_type_00>::real_type norm=0;
│ │ │ │ -
401
│ │ │ │ -
402 auto rows = index_constant<N()>();
│ │ │ │ -
403 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) {
│ │ │ │ -
404
│ │ │ │ -
405 typename FieldTraits<field_type_00>::real_type sum=0;
│ │ │ │ -
406 auto cols = index_constant<MultiTypeBlockMatrix<FirstRow, Args...>::M()>();
│ │ │ │ -
407 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) {
│ │ │ │ -
408 sum += (*this)[i][j].infinity_norm_real();
│ │ │ │ -
409 });
│ │ │ │ -
410 norm = max(sum, norm);
│ │ │ │ -
411 });
│ │ │ │ -
412
│ │ │ │ -
413 return norm;
│ │ │ │ -
414 }
│ │ │ │ -
│ │ │ │ -
415
│ │ │ │ -
416 };
│ │ │ │ -
│ │ │ │ -
417
│ │ │ │ -
423 template<typename T1, typename... Args>
│ │ │ │ -
│ │ │ │ -
424 std::ostream& operator<< (std::ostream& s, const MultiTypeBlockMatrix<T1,Args...>& m) {
│ │ │ │ -
425 auto N = index_constant<MultiTypeBlockMatrix<T1,Args...>::N()>();
│ │ │ │ -
426 auto M = index_constant<MultiTypeBlockMatrix<T1,Args...>::M()>();
│ │ │ │ -
427 using namespace Dune::Hybrid;
│ │ │ │ -
428 forEach(integralRange(N), [&](auto&& i) {
│ │ │ │ -
429 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
430 forEach(integralRange(M), [&](auto&& j) {
│ │ │ │ -
431 s << "\t(" << i << ", " << j << "): \n" << m[i][j];
│ │ │ │ -
432 });
│ │ │ │ -
433 });
│ │ │ │ -
434 s << std::endl;
│ │ │ │ -
435 return s;
│ │ │ │ -
436 }
│ │ │ │ -
│ │ │ │ -
437
│ │ │ │ -
438 //make algmeta_itsteps known
│ │ │ │ -
439 template<int I, typename M>
│ │ │ │ -
440 struct algmeta_itsteps;
│ │ │ │ -
441
│ │ │ │ -
448 template<int I, int crow, int ccol, int remain_col> //MultiTypeBlockMatrix_Solver_Col: iterating over one row
│ │ │ │ -
│ │ │ │ -
449 class MultiTypeBlockMatrix_Solver_Col { //calculating b- A[i][j]*x[j]
│ │ │ │ -
450 public:
│ │ │ │ -
454 template <typename Trhs, typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
455 static void calc_rhs(const TMatrix& A, TVector& x, TVector& v, Trhs& b, const K& w) {
│ │ │ │ -
456 std::get<ccol>( std::get<crow>(A) ).mmv( std::get<ccol>(x), b );
│ │ │ │ - │ │ │ │ -
458 }
│ │ │ │ -
│ │ │ │ -
459
│ │ │ │ -
460 };
│ │ │ │ -
│ │ │ │ -
461 template<int I, int crow, int ccol> //MultiTypeBlockMatrix_Solver_Col recursion end
│ │ │ │ -
│ │ │ │ -
462 class MultiTypeBlockMatrix_Solver_Col<I,crow,ccol,0> {
│ │ │ │ -
463 public:
│ │ │ │ -
464 template <typename Trhs, typename TVector, typename TMatrix, typename K>
│ │ │ │ -
465 static void calc_rhs(const TMatrix&, TVector&, TVector&, Trhs&, const K&) {}
│ │ │ │ -
466 };
│ │ │ │ -
│ │ │ │ -
467
│ │ │ │ -
468
│ │ │ │ -
469
│ │ │ │ -
476 template<int I, int crow, int remain_row>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
478 public:
│ │ │ │ -
479
│ │ │ │ -
483 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
484 static void dbgs(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ -
485 TVector xold(x);
│ │ │ │ -
486 xold=x; //store old x values
│ │ │ │ - │ │ │ │ -
488 x *= w;
│ │ │ │ -
489 x.axpy(1-w,xold); //improve x
│ │ │ │ -
490 }
│ │ │ │ -
│ │ │ │ -
491 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
492 static void dbgs(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ -
493 auto rhs = std::get<crow> (b);
│ │ │ │ -
494
│ │ │ │ -
495 MultiTypeBlockMatrix_Solver_Col<I,crow,0, TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ -
496 //solve on blocklevel I-1
│ │ │ │ -
497 using M =
│ │ │ │ -
498 typename std::remove_cv<
│ │ │ │ -
499 typename std::remove_reference<
│ │ │ │ -
500 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ -
501 >::type
│ │ │ │ -
502 >::type;
│ │ │ │ -
503 algmeta_itsteps<I-1,M>::dbgs(std::get<crow>( std::get<crow>(A)), std::get<crow>(x),rhs,w);
│ │ │ │ - │ │ │ │ -
505 }
│ │ │ │ -
│ │ │ │ -
506
│ │ │ │ -
507
│ │ │ │ -
508
│ │ │ │ -
512 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
513 static void bsorf(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ -
514 TVector v;
│ │ │ │ -
515 v=x; //use latest x values in right side calculation
│ │ │ │ - │ │ │ │ -
517
│ │ │ │ -
518 }
│ │ │ │ -
│ │ │ │ -
519 template <typename TVector, typename TMatrix, typename K> //recursion over all matrix rows (A)
│ │ │ │ -
│ │ │ │ -
520 static void bsorf(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ -
521 auto rhs = std::get<crow> (b);
│ │ │ │ -
522
│ │ │ │ -
523 MultiTypeBlockMatrix_Solver_Col<I,crow,0,TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ -
524 //solve on blocklevel I-1
│ │ │ │ -
525 using M =
│ │ │ │ -
526 typename std::remove_cv<
│ │ │ │ -
527 typename std::remove_reference<
│ │ │ │ -
528 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ -
529 >::type
│ │ │ │ -
530 >::type;
│ │ │ │ -
531 algmeta_itsteps<I-1,M>::bsorf(std::get<crow>( std::get<crow>(A)), std::get<crow>(v),rhs,w);
│ │ │ │ -
532 std::get<crow>(x).axpy(w,std::get<crow>(v));
│ │ │ │ - │ │ │ │ -
534 }
│ │ │ │ -
│ │ │ │ -
535
│ │ │ │ -
539 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
540 static void bsorb(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ -
541 TVector v;
│ │ │ │ -
542 v=x; //use latest x values in right side calculation
│ │ │ │ - │ │ │ │ -
544
│ │ │ │ -
545 }
│ │ │ │ -
│ │ │ │ -
546 template <typename TVector, typename TMatrix, typename K> //recursion over all matrix rows (A)
│ │ │ │ -
│ │ │ │ -
547 static void bsorb(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ -
548 auto rhs = std::get<crow> (b);
│ │ │ │ -
549
│ │ │ │ -
550 MultiTypeBlockMatrix_Solver_Col<I,crow,0, TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ -
551 //solve on blocklevel I-1
│ │ │ │ -
552 using M =
│ │ │ │ -
553 typename std::remove_cv<
│ │ │ │ -
554 typename std::remove_reference<
│ │ │ │ -
555 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ -
556 >::type
│ │ │ │ -
557 >::type;
│ │ │ │ -
558 algmeta_itsteps<I-1,M>::bsorb(std::get<crow>( std::get<crow>(A)), std::get<crow>(v),rhs,w);
│ │ │ │ -
559 std::get<crow>(x).axpy(w,std::get<crow>(v));
│ │ │ │ - │ │ │ │ -
561 }
│ │ │ │ -
│ │ │ │ -
562
│ │ │ │ -
563
│ │ │ │ -
567 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
568 static void dbjac(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ -
569 TVector v(x);
│ │ │ │ -
570 v=0; //calc new x in v
│ │ │ │ - │ │ │ │ -
572 x.axpy(w,v); //improve x
│ │ │ │ -
573 }
│ │ │ │ -
│ │ │ │ -
574 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
575 static void dbjac(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ -
576 auto rhs = std::get<crow> (b);
│ │ │ │ -
577
│ │ │ │ -
578 MultiTypeBlockMatrix_Solver_Col<I,crow,0, TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ -
579 //solve on blocklevel I-1
│ │ │ │ -
580 using M =
│ │ │ │ -
581 typename std::remove_cv<
│ │ │ │ -
582 typename std::remove_reference<
│ │ │ │ -
583 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ -
584 >::type
│ │ │ │ -
585 >::type;
│ │ │ │ -
586 algmeta_itsteps<I-1,M>::dbjac(std::get<crow>( std::get<crow>(A)), std::get<crow>(v),rhs,w);
│ │ │ │ - │ │ │ │ -
588 }
│ │ │ │ -
│ │ │ │ -
589
│ │ │ │ -
590
│ │ │ │ -
591
│ │ │ │ -
592
│ │ │ │ -
593 };
│ │ │ │ -
│ │ │ │ -
594 template<int I, int crow> //recursion end for remain_row = 0
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
596 public:
│ │ │ │ -
597 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
598 static void dbgs(const TMatrix&, TVector&, TVector&,
│ │ │ │ -
599 const TVector&, const K&) {}
│ │ │ │ -
│ │ │ │ -
600
│ │ │ │ -
601 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
602 static void bsorf(const TMatrix&, TVector&, TVector&,
│ │ │ │ -
603 const TVector&, const K&) {}
│ │ │ │ -
│ │ │ │ -
604
│ │ │ │ -
605 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
606 static void bsorb(const TMatrix&, TVector&, TVector&,
│ │ │ │ -
607 const TVector&, const K&) {}
│ │ │ │ -
│ │ │ │ -
608
│ │ │ │ -
609 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ -
│ │ │ │ -
610 static void dbjac(const TMatrix&, TVector&, TVector&,
│ │ │ │ -
611 const TVector&, const K&) {}
│ │ │ │ -
│ │ │ │ -
612 };
│ │ │ │ -
│ │ │ │ -
613
│ │ │ │ -
614} // end namespace Dune
│ │ │ │ -
615
│ │ │ │ -
616namespace std
│ │ │ │ -
617{
│ │ │ │ -
622 template <size_t i, typename... Args>
│ │ │ │ -
│ │ │ │ -
623 struct tuple_element<i,Dune::MultiTypeBlockMatrix<Args...> >
│ │ │ │ -
624 {
│ │ │ │ -
625 using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
│ │ │ │ -
626 };
│ │ │ │ -
│ │ │ │ -
627}
│ │ │ │ -
628#endif
│ │ │ │ -
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ - │ │ │ │ -
MultiTypeBlockMatrix< FirstRow, Args... > type
Definition multitypeblockmatrix.hh:56
│ │ │ │ -
static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:568
│ │ │ │ -
MultiTypeBlockMatrix & operator+=(const MultiTypeBlockMatrix &b)
Add the entries of another matrix to this one.
Definition multitypeblockmatrix.hh:168
│ │ │ │ -
void mv(const X &x, Y &y) const
y = A x
Definition multitypeblockmatrix.hh:196
│ │ │ │ -
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition multitypeblockmatrix.hh:276
│ │ │ │ -
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition multitypeblockmatrix.hh:321
│ │ │ │ -
static void dbgs(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:598
│ │ │ │ -
static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:484
│ │ │ │ -
static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:540
│ │ │ │ -
void usmhv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition multitypeblockmatrix.hh:336
│ │ │ │ -
FirstRow::field_type field_type
Definition multitypeblockmatrix.hh:61
│ │ │ │ -
void usmv(const AlphaType &alpha, const X &x, Y &y) const
y += alpha A x
Definition multitypeblockmatrix.hh:236
│ │ │ │ -
MultiTypeBlockMatrix & operator/=(const field_type &k)
vector space division by scalar
Definition multitypeblockmatrix.hh:152
│ │ │ │ -
typename std::tuple_element< i, std::tuple< Args... > >::type type
Definition multitypeblockmatrix.hh:625
│ │ │ │ -
static void dbgs(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:492
│ │ │ │ -
static void bsorf(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:520
│ │ │ │ -
void umhv(const X &x, Y &y) const
y += A^H x
Definition multitypeblockmatrix.hh:306
│ │ │ │ -
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition multitypeblockmatrix.hh:369
│ │ │ │ -
static constexpr size_type N()
Return the number of matrix rows.
Definition multitypeblockmatrix.hh:64
│ │ │ │ -
void usmtv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition multitypeblockmatrix.hh:291
│ │ │ │ -
void operator=(const T &newval)
Definition multitypeblockmatrix.hh:127
│ │ │ │ -
static void calc_rhs(const TMatrix &, TVector &, TVector &, Trhs &, const K &)
Definition multitypeblockmatrix.hh:465
│ │ │ │ -
void umv(const X &x, Y &y) const
y += A x
Definition multitypeblockmatrix.hh:206
│ │ │ │ -
static void calc_rhs(const TMatrix &A, TVector &x, TVector &v, Trhs &b, const K &w)
Definition multitypeblockmatrix.hh:455
│ │ │ │ -
static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:513
│ │ │ │ -
static constexpr size_type size()
Return the number of matrix rows.
Definition multitypeblockmatrix.hh:75
│ │ │ │ -
static void dbjac(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:610
│ │ │ │ -
auto infinity_norm_real() const
Bastardized version of the infinity-norm / row-sum norm.
Definition multitypeblockmatrix.hh:396
│ │ │ │ -
auto frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition multitypeblockmatrix.hh:352
│ │ │ │ -
std::size_t size_type
Type used for sizes.
Definition multitypeblockmatrix.hh:59
│ │ │ │ -
auto infinity_norm() const
Bastardized version of the infinity-norm / row-sum norm.
Definition multitypeblockmatrix.hh:375
│ │ │ │ -
static void bsorb(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:606
│ │ │ │ -
MultiTypeBlockMatrix & operator-=(const MultiTypeBlockMatrix &b)
Subtract the entries of another matrix from this one.
Definition multitypeblockmatrix.hh:183
│ │ │ │ -
auto operator[](const std::integral_constant< size_type, index > indexVariable) -> decltype(std::get< index >(*this))
Random-access operator.
Definition multitypeblockmatrix.hh:104
│ │ │ │ -
static void dbjac(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:575
│ │ │ │ -
static void bsorf(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:602
│ │ │ │ -
void mtv(const X &x, Y &y) const
y = A^T x
Definition multitypeblockmatrix.hh:251
│ │ │ │ -
static constexpr size_type M()
Return the number of matrix columns.
Definition multitypeblockmatrix.hh:81
│ │ │ │ -
void mmv(const X &x, Y &y) const
y -= A x
Definition multitypeblockmatrix.hh:221
│ │ │ │ -
void umtv(const X &x, Y &y) const
y += A^T x
Definition multitypeblockmatrix.hh:261
│ │ │ │ -
static void bsorb(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:547
│ │ │ │ -
MultiTypeBlockMatrix & operator*=(const field_type &k)
vector space multiplication with scalar
Definition multitypeblockmatrix.hh:141
│ │ │ │ -
STL namespace.
│ │ │ │ +
318 initializer.allocate();
│ │ │ │ +
319
│ │ │ │ +
320 for(Iter row=mrs.begin(); row!= mrs.end(); ++row)
│ │ │ │ +
321 for(CIter col=row->begin(); col != row->end(); ++col) {
│ │ │ │ +
322 if(subMatrixIndex[col.index()]!=std::numeric_limits<size_type>::max())
│ │ │ │ +
323 // This column is in our subset (use submatrix column index)
│ │ │ │ +
324 initializer.countEntries(subMatrixIndex[col.index()]);
│ │ │ │ +
325 }
│ │ │ │ +
326
│ │ │ │ +
327 initializer.calcColstart();
│ │ │ │ +
328
│ │ │ │ +
329 for(Iter row=mrs.begin(); row!= mrs.end(); ++row)
│ │ │ │ +
330 for(CIter col=row->begin(); col != row->end(); ++col) {
│ │ │ │ +
331 if(subMatrixIndex[col.index()]!=std::numeric_limits<size_type>::max())
│ │ │ │ +
332 // This value is in our submatrix -> copy (use submatrix indices
│ │ │ │ +
333 initializer.copyValue(col, subMatrixIndex[row.index()], subMatrixIndex[col.index()]);
│ │ │ │ +
334 }
│ │ │ │ +
335 initializer.createMatrix();
│ │ │ │ +
336 }
│ │ │ │ +
337
│ │ │ │ +
338}
│ │ │ │ +
339#endif
│ │ │ │ + │ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
std::size_t countEntries(const BlockVector< T, A > &vector)
Definition matrixmarket.hh:1076
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:590
│ │ │ │ -
A Matrix class to support different block types.
Definition multitypeblockmatrix.hh:46
│ │ │ │ -
static void bsorb(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:461
│ │ │ │ -
static void bsorf(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:418
│ │ │ │ -
static void dbjac(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:504
│ │ │ │ -
static void dbgs(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:378
│ │ │ │ -
solver for MultiTypeBlockVector & MultiTypeBlockMatrix types
Definition multitypeblockmatrix.hh:477
│ │ │ │ -
part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types
Definition multitypeblockmatrix.hh:449
│ │ │ │ +
Initializer for SuperLU Matrices representing the subdomains.
Definition overlappingschwarz.hh:47
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,756 +1,353 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -multitypeblockmatrix.hh │ │ │ │ │ +bccsmatrixinitializer.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 (C) 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_MULTITYPEBLOCKMATRIX_HH │ │ │ │ │ -6#define DUNE_ISTL_MULTITYPEBLOCKMATRIX_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_BCCSMATRIX_INITIALIZER_HH │ │ │ │ │ +6#define DUNE_ISTL_BCCSMATRIX_INITIALIZER_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11 │ │ │ │ │ -12#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ 13 │ │ │ │ │ -14#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ 15 │ │ │ │ │ -16// forward declaration │ │ │ │ │ -17namespace _D_u_n_e │ │ │ │ │ -18{ │ │ │ │ │ -19 template │ │ │ │ │ -20 class MultiTypeBlockMatrix; │ │ │ │ │ +16namespace _D_u_n_e │ │ │ │ │ +17{ │ │ │ │ │ +18 template │ │ │ │ │ +19 class OverlappingSchwarzInitializer; │ │ │ │ │ +20} │ │ │ │ │ 21 │ │ │ │ │ -22 template │ │ │ │ │ -23 class MultiTypeBlockMatrix_Solver; │ │ │ │ │ -24} │ │ │ │ │ -25 │ │ │ │ │ -26#include "_g_s_e_t_c_._h_h" │ │ │ │ │ -27 │ │ │ │ │ -28namespace _D_u_n_e { │ │ │ │ │ -29 │ │ │ │ │ -43 template │ │ │ │ │ -_4_4 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ -45 : public std::tuple │ │ │ │ │ -46 { │ │ │ │ │ -47 using ParentType = std::tuple; │ │ │ │ │ -48 public: │ │ │ │ │ -49 │ │ │ │ │ -51 using ParentType::ParentType; │ │ │ │ │ -52 │ │ │ │ │ -_5_6 typedef _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x _t_y_p_e; │ │ │ │ │ -57 │ │ │ │ │ -_5_9 using _s_i_z_e___t_y_p_e = std::size_t; │ │ │ │ │ -60 │ │ │ │ │ -_6_1 typedef typename FirstRow::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -62 │ │ │ │ │ -_6_4 static constexpr _s_i_z_e___t_y_p_e _N() │ │ │ │ │ -65 { │ │ │ │ │ -66 return 1+sizeof...(Args); │ │ │ │ │ -67 } │ │ │ │ │ +22namespace Dune::ISTL::Impl │ │ │ │ │ +23{ │ │ │ │ │ +31 template │ │ │ │ │ +32 class MatrixRowSubset │ │ │ │ │ +33 { │ │ │ │ │ +34 public: │ │ │ │ │ +36 typedef M Matrix; │ │ │ │ │ +38 typedef S RowIndexSet; │ │ │ │ │ +39 │ │ │ │ │ +45 MatrixRowSubset(const Matrix& m, const RowIndexSet& s) │ │ │ │ │ +46 : m_(m), s_(s) │ │ │ │ │ +47 {} │ │ │ │ │ +48 │ │ │ │ │ +49 const Matrix& matrix() const │ │ │ │ │ +50 { │ │ │ │ │ +51 return m_; │ │ │ │ │ +52 } │ │ │ │ │ +53 │ │ │ │ │ +54 const RowIndexSet& rowIndexSet() const │ │ │ │ │ +55 { │ │ │ │ │ +56 return s_; │ │ │ │ │ +57 } │ │ │ │ │ +58 │ │ │ │ │ +60 class const_iterator │ │ │ │ │ +61 : public ForwardIteratorFacade │ │ │ │ │ +62 { │ │ │ │ │ +63 public: │ │ │ │ │ +64 const_iterator(typename Matrix::const_iterator firstRow, │ │ │ │ │ +65 typename RowIndexSet::const_iterator pos) │ │ │ │ │ +66 : firstRow_(firstRow), pos_(pos) │ │ │ │ │ +67 {} │ │ │ │ │ 68 │ │ │ │ │ -74 [[deprecated("Use method 'N' instead")]] │ │ │ │ │ -_7_5 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e() │ │ │ │ │ -76 { │ │ │ │ │ -77 return 1+sizeof...(Args); │ │ │ │ │ -78 } │ │ │ │ │ -79 │ │ │ │ │ -_8_1 static constexpr _s_i_z_e___t_y_p_e _M() │ │ │ │ │ -82 { │ │ │ │ │ -83 return FirstRow::size(); │ │ │ │ │ -84 } │ │ │ │ │ -85 │ │ │ │ │ -102 template< size_type index > │ │ │ │ │ -103 auto │ │ │ │ │ -_1_0_4 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ -> indexVariable) │ │ │ │ │ -105 -> decltype(std::get(*this)) │ │ │ │ │ -106 { │ │ │ │ │ -107 return std::get(*this); │ │ │ │ │ -108 } │ │ │ │ │ -109 │ │ │ │ │ -115 template< size_type index > │ │ │ │ │ -116 auto │ │ │ │ │ -_1_1_7 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ -> indexVariable) const │ │ │ │ │ -118 -> decltype(std::get(*this)) │ │ │ │ │ -119 { │ │ │ │ │ -120 return std::get(*this); │ │ │ │ │ -121 } │ │ │ │ │ -122 │ │ │ │ │ -126 template │ │ │ │ │ -_1_2_7 void _o_p_e_r_a_t_o_r_=_ (const T& newval) { │ │ │ │ │ -128 using namespace Dune::Hybrid; │ │ │ │ │ -129 auto _s_i_z_e = index_constant<1+sizeof...(Args)>(); │ │ │ │ │ -130 // Since Dune::Hybrid::size(MultiTypeBlockMatrix) is not implemented, │ │ │ │ │ -131 // we cannot use a plain forEach(*this, ...). This could be achieved, │ │ │ │ │ -132 // e.g., by implementing a static size() method. │ │ │ │ │ -133 forEach(integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ -134 (*this)[i] = newval; │ │ │ │ │ -135 }); │ │ │ │ │ -136 } │ │ │ │ │ -137 │ │ │ │ │ -138 //===== vector space arithmetic │ │ │ │ │ -139 │ │ │ │ │ -_1_4_1 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ -142 { │ │ │ │ │ -143 auto _s_i_z_e = index_constant(); │ │ │ │ │ -144 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ -145 (*this)[i] *= k; │ │ │ │ │ -146 }); │ │ │ │ │ +69 │ │ │ │ │ +70 const typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e& dereference() const │ │ │ │ │ +71 { │ │ │ │ │ +72 return *(firstRow_+ *pos_); │ │ │ │ │ +73 } │ │ │ │ │ +74 bool equals(const const_iterator& o) const │ │ │ │ │ +75 { │ │ │ │ │ +76 return pos_==o.pos_; │ │ │ │ │ +77 } │ │ │ │ │ +78 void increment() │ │ │ │ │ +79 { │ │ │ │ │ +80 ++pos_; │ │ │ │ │ +81 } │ │ │ │ │ +82 typename RowIndexSet::value_type index() const │ │ │ │ │ +83 { │ │ │ │ │ +84 return *pos_; │ │ │ │ │ +85 } │ │ │ │ │ +86 │ │ │ │ │ +87 private: │ │ │ │ │ +89 typename Matrix::const_iterator firstRow_; │ │ │ │ │ +91 typename RowIndexSet::const_iterator pos_; │ │ │ │ │ +92 }; │ │ │ │ │ +93 │ │ │ │ │ +95 const_iterator begin() const │ │ │ │ │ +96 { │ │ │ │ │ +97 return const_iterator(m_.begin(), s_.begin()); │ │ │ │ │ +98 } │ │ │ │ │ +100 const_iterator end() const │ │ │ │ │ +101 { │ │ │ │ │ +102 return const_iterator(m_.begin(), s_.end()); │ │ │ │ │ +103 } │ │ │ │ │ +104 │ │ │ │ │ +105 private: │ │ │ │ │ +107 const Matrix& m_; │ │ │ │ │ +109 const RowIndexSet& s_; │ │ │ │ │ +110 }; │ │ │ │ │ +111 │ │ │ │ │ +118 template │ │ │ │ │ +119 class BCCSMatrixInitializer │ │ │ │ │ +120 { │ │ │ │ │ +121 template │ │ │ │ │ +122 friend class _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ │ +123 public: │ │ │ │ │ +124 using Matrix = M; │ │ │ │ │ +125 using Index = I; │ │ │ │ │ +126 typedef Dune::ISTL::Impl::BCCSMatrix │ │ │ │ │ +OutputMatrix; │ │ │ │ │ +127 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ +128 │ │ │ │ │ +131 BCCSMatrixInitializer(OutputMatrix& mat_) │ │ │ │ │ +132 : _m_a_t(&mat_), cols(mat_.M()) │ │ │ │ │ +133 { │ │ │ │ │ +134 if constexpr (Dune::IsNumber::value) │ │ │ │ │ +135 { │ │ │ │ │ +136 n = m = 1; │ │ │ │ │ +137 } │ │ │ │ │ +138 else │ │ │ │ │ +139 { │ │ │ │ │ +140 // WARNING: This assumes that all blocks are dense and identical │ │ │ │ │ +141 n = M::block_type::rows; │ │ │ │ │ +142 m = M::block_type::cols; │ │ │ │ │ +143 } │ │ │ │ │ +144 │ │ │ │ │ +145 _m_a_t->Nnz_=0; │ │ │ │ │ +146 } │ │ │ │ │ 147 │ │ │ │ │ -148 return *this; │ │ │ │ │ -149 } │ │ │ │ │ -150 │ │ │ │ │ -_1_5_2 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_/_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ -153 { │ │ │ │ │ -154 auto _s_i_z_e = index_constant(); │ │ │ │ │ -155 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ -156 (*this)[i] /= k; │ │ │ │ │ -157 }); │ │ │ │ │ -158 │ │ │ │ │ -159 return *this; │ │ │ │ │ -160 } │ │ │ │ │ -161 │ │ │ │ │ -162 │ │ │ │ │ -_1_6_8 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& b) │ │ │ │ │ -169 { │ │ │ │ │ -170 auto _s_i_z_e = index_constant(); │ │ │ │ │ -171 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ -172 (*this)[i] += b[i]; │ │ │ │ │ -173 }); │ │ │ │ │ -174 │ │ │ │ │ -175 return *this; │ │ │ │ │ -176 } │ │ │ │ │ -177 │ │ │ │ │ -_1_8_3 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& b) │ │ │ │ │ -184 { │ │ │ │ │ -185 auto _s_i_z_e = index_constant(); │ │ │ │ │ -186 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ -187 (*this)[i] -= b[i]; │ │ │ │ │ -188 }); │ │ │ │ │ +148 BCCSMatrixInitializer() │ │ │ │ │ +149 : _m_a_t(0), cols(0), n(0), m(0) │ │ │ │ │ +150 {} │ │ │ │ │ +151 │ │ │ │ │ +152 virtual ~BCCSMatrixInitializer() │ │ │ │ │ +153 {} │ │ │ │ │ +154 │ │ │ │ │ +155 template │ │ │ │ │ +156 void addRowNnz(const Iter& row) const │ │ │ │ │ +157 { │ │ │ │ │ +158 _m_a_t->Nnz_+=row->getsize(); │ │ │ │ │ +159 } │ │ │ │ │ +160 │ │ │ │ │ +161 template │ │ │ │ │ +162 void addRowNnz(const Iter& row, const std::set& indices) │ │ │ │ │ +const │ │ │ │ │ +163 { │ │ │ │ │ +164 auto siter =indices.begin(); │ │ │ │ │ +165 for (auto entry=row->begin(); entry!=row->end(); ++entry) │ │ │ │ │ +166 { │ │ │ │ │ +167 for(; siter!=indices.end() && *siterNnz_; │ │ │ │ │ +173 } │ │ │ │ │ +174 } │ │ │ │ │ +175 │ │ │ │ │ +176 template │ │ │ │ │ +177 void addRowNnz(const Iter& row, const std::vector& indices) │ │ │ │ │ +const │ │ │ │ │ +178 { │ │ │ │ │ +179 for (auto entry=row->begin(); entry!=row->end(); ++entry) │ │ │ │ │ +180 if (indices[entry.index()]!=std::numeric_limits::max()) │ │ │ │ │ +181 ++_m_a_t->Nnz_; │ │ │ │ │ +182 } │ │ │ │ │ +183 │ │ │ │ │ +184 void allocate() │ │ │ │ │ +185 { │ │ │ │ │ +186 allocateMatrixStorage(); │ │ │ │ │ +187 allocateMarker(); │ │ │ │ │ +188 } │ │ │ │ │ 189 │ │ │ │ │ -190 return *this; │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -195 template │ │ │ │ │ -_1_9_6 void _m_v (const X& x, Y& y) const { │ │ │ │ │ -197 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ -198 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ -199 y = 0; //reset y (for mv uses umv) │ │ │ │ │ -200 _u_m_v(x,y); │ │ │ │ │ -201 } │ │ │ │ │ -202 │ │ │ │ │ -205 template │ │ │ │ │ -_2_0_6 void _u_m_v (const X& x, Y& y) const { │ │ │ │ │ -207 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ -208 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ -209 using namespace Dune::Hybrid; │ │ │ │ │ -210 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -211 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -212 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -213 (*this)[i][j].umv(x[j], y[i]); │ │ │ │ │ -214 }); │ │ │ │ │ -215 }); │ │ │ │ │ -216 } │ │ │ │ │ -217 │ │ │ │ │ -220 template │ │ │ │ │ -_2_2_1 void _m_m_v (const X& x, Y& y) const { │ │ │ │ │ -222 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ -223 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ -224 using namespace Dune::Hybrid; │ │ │ │ │ -225 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -226 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -227 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -228 (*this)[i][j].mmv(x[j], y[i]); │ │ │ │ │ -229 }); │ │ │ │ │ -230 }); │ │ │ │ │ +190 template │ │ │ │ │ +191 void _c_o_u_n_t_E_n_t_r_i_e_s([[maybe_unused]] const Iter& row, const CIter& _c_o_l) const │ │ │ │ │ +192 { │ │ │ │ │ +193 _c_o_u_n_t_E_n_t_r_i_e_s(_c_o_l.index()); │ │ │ │ │ +194 } │ │ │ │ │ +195 │ │ │ │ │ +196 void _c_o_u_n_t_E_n_t_r_i_e_s(size_type colindex) const │ │ │ │ │ +197 { │ │ │ │ │ +198 for(size_type i=0; i < m; ++i) │ │ │ │ │ +199 { │ │ │ │ │ +200 assert(colindex*m+icolstart[0]=0; │ │ │ │ │ +208 for(size_type i=0; i < cols; ++i) { │ │ │ │ │ +209 assert(icolstart[i+1]=_m_a_t->colstart[i]+marker[i]; │ │ │ │ │ +211 marker[i]=_m_a_t->colstart[i]; │ │ │ │ │ +212 } │ │ │ │ │ +213 } │ │ │ │ │ +214 │ │ │ │ │ +215 template │ │ │ │ │ +216 void copyValue(const Iter& row, const CIter& _c_o_l) const │ │ │ │ │ +217 { │ │ │ │ │ +218 copyValue(_c_o_l, row.index(), _c_o_l.index()); │ │ │ │ │ +219 } │ │ │ │ │ +220 │ │ │ │ │ +221 template │ │ │ │ │ +222 void copyValue(const CIter& _c_o_l, size_type rowindex, size_type colindex) │ │ │ │ │ +const │ │ │ │ │ +223 { │ │ │ │ │ +224 for(size_type i=0; icolstart[colindex*m+j+1]); │ │ │ │ │ +227 assert((size_type)marker[colindex*m+j]<_m_a_t->Nnz_); │ │ │ │ │ +228 _m_a_t->rowindex[marker[colindex*m+j]]=rowindex*n+i; │ │ │ │ │ +229 _m_a_t->values[marker[colindex*m+j]] = Dune::Impl::asMatrix(*_c_o_l)[i][j]; │ │ │ │ │ +230 ++marker[colindex*m+j]; // index for next entry in column │ │ │ │ │ 231 } │ │ │ │ │ -232 │ │ │ │ │ -235 template │ │ │ │ │ -_2_3_6 void _u_s_m_v (const AlphaType& alpha, const X& x, Y& y) const { │ │ │ │ │ -237 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ -238 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ -239 using namespace Dune::Hybrid; │ │ │ │ │ -240 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -241 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -242 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -243 (*this)[i][j].usmv(alpha, x[j], y[i]); │ │ │ │ │ -244 }); │ │ │ │ │ -245 }); │ │ │ │ │ -246 } │ │ │ │ │ -247 │ │ │ │ │ -250 template │ │ │ │ │ -_2_5_1 void _m_t_v (const X& x, Y& y) const { │ │ │ │ │ -252 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ -rows"); │ │ │ │ │ -253 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ -columns"); │ │ │ │ │ -254 y = 0; │ │ │ │ │ -255 _u_m_t_v(x,y); │ │ │ │ │ -256 } │ │ │ │ │ -257 │ │ │ │ │ -260 template │ │ │ │ │ -_2_6_1 void _u_m_t_v (const X& x, Y& y) const { │ │ │ │ │ -262 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ -rows"); │ │ │ │ │ -263 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ -columns"); │ │ │ │ │ -264 using namespace Dune::Hybrid; │ │ │ │ │ -265 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -266 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -267 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -268 (*this)[j][i].umtv(x[j], y[i]); │ │ │ │ │ -269 }); │ │ │ │ │ -270 }); │ │ │ │ │ -271 } │ │ │ │ │ +232 } │ │ │ │ │ +233 } │ │ │ │ │ +234 │ │ │ │ │ +235 virtual void createMatrix() const │ │ │ │ │ +236 { │ │ │ │ │ +237 marker.clear(); │ │ │ │ │ +238 } │ │ │ │ │ +239 │ │ │ │ │ +240 protected: │ │ │ │ │ +241 │ │ │ │ │ +242 void allocateMatrixStorage() const │ │ │ │ │ +243 { │ │ │ │ │ +244 _m_a_t->Nnz_*=n*m; │ │ │ │ │ +245 // initialize data │ │ │ │ │ +246 _m_a_t->values=new typename M::field_type[_m_a_t->Nnz_]; │ │ │ │ │ +247 _m_a_t->rowindex=new I[_m_a_t->Nnz_]; │ │ │ │ │ +248 _m_a_t->colstart=new I[cols+1]; │ │ │ │ │ +249 } │ │ │ │ │ +250 │ │ │ │ │ +251 void allocateMarker() │ │ │ │ │ +252 { │ │ │ │ │ +253 marker.resize(cols); │ │ │ │ │ +254 std::fill(marker.begin(), marker.end(), 0); │ │ │ │ │ +255 } │ │ │ │ │ +256 │ │ │ │ │ +257 OutputMatrix* _m_a_t; │ │ │ │ │ +258 size_type cols; │ │ │ │ │ +259 │ │ │ │ │ +260 // Number of rows/columns of the matrix entries │ │ │ │ │ +261 // (assumed to be scalars or dense matrices) │ │ │ │ │ +262 size_type n, m; │ │ │ │ │ +263 │ │ │ │ │ +264 mutable std::vector marker; │ │ │ │ │ +265 }; │ │ │ │ │ +266 │ │ │ │ │ +267 template │ │ │ │ │ +268 void copyToBCCSMatrix(F& initializer, const Matrix& matrix) │ │ │ │ │ +269 { │ │ │ │ │ +270 for (auto row=matrix.begin(); row!= matrix.end(); ++row) │ │ │ │ │ +271 initializer.addRowNnz(row); │ │ │ │ │ 272 │ │ │ │ │ -275 template │ │ │ │ │ -_2_7_6 void _m_m_t_v (const X& x, Y& y) const { │ │ │ │ │ -277 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ -rows"); │ │ │ │ │ -278 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ -columns"); │ │ │ │ │ -279 using namespace Dune::Hybrid; │ │ │ │ │ -280 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -281 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -282 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -283 (*this)[j][i].mmtv(x[j], y[i]); │ │ │ │ │ -284 }); │ │ │ │ │ -285 }); │ │ │ │ │ +273 initializer.allocate(); │ │ │ │ │ +274 │ │ │ │ │ +275 for (auto row=matrix.begin(); row!= matrix.end(); ++row) { │ │ │ │ │ +276 │ │ │ │ │ +277 for (auto _c_o_l=row->begin(); _c_o_l != row->end(); ++_c_o_l) │ │ │ │ │ +278 initializer.countEntries(row, _c_o_l); │ │ │ │ │ +279 } │ │ │ │ │ +280 │ │ │ │ │ +281 initializer.calcColstart(); │ │ │ │ │ +282 │ │ │ │ │ +283 for (auto row=matrix.begin(); row!= matrix.end(); ++row) { │ │ │ │ │ +284 for (auto _c_o_l=row->begin(); _c_o_l != row->end(); ++_c_o_l) { │ │ │ │ │ +285 initializer.copyValue(row, _c_o_l); │ │ │ │ │ 286 } │ │ │ │ │ 287 │ │ │ │ │ -290 template │ │ │ │ │ -_2_9_1 void _u_s_m_t_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const { │ │ │ │ │ -292 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ -rows"); │ │ │ │ │ -293 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ -columns"); │ │ │ │ │ -294 using namespace Dune::Hybrid; │ │ │ │ │ -295 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -296 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -297 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -298 (*this)[j][i].usmtv(alpha, x[j], y[i]); │ │ │ │ │ -299 }); │ │ │ │ │ -300 }); │ │ │ │ │ -301 } │ │ │ │ │ -302 │ │ │ │ │ -305 template │ │ │ │ │ -_3_0_6 void _u_m_h_v (const X& x, Y& y) const { │ │ │ │ │ -307 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ -rows"); │ │ │ │ │ -308 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ -columns"); │ │ │ │ │ -309 using namespace Dune::Hybrid; │ │ │ │ │ -310 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -311 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -312 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -313 (*this)[j][i].umhv(x[j], y[i]); │ │ │ │ │ -314 }); │ │ │ │ │ -315 }); │ │ │ │ │ -316 } │ │ │ │ │ +288 } │ │ │ │ │ +289 initializer.createMatrix(); │ │ │ │ │ +290 } │ │ │ │ │ +291 │ │ │ │ │ +292 template │ │ │ │ │ +293 void copyToBCCSMatrix(F& initializer, const MatrixRowSubset& mrs) │ │ │ │ │ +294 { │ │ │ │ │ +295 typedef MatrixRowSubset MRS; │ │ │ │ │ +296 typedef typename MRS::RowIndexSet SIS; │ │ │ │ │ +297 typedef typename SIS::const_iterator SIter; │ │ │ │ │ +298 typedef typename MRS::const_iterator Iter; │ │ │ │ │ +299 typedef typename std::iterator_traits::value_type row_type; │ │ │ │ │ +300 typedef typename row_type::const_iterator CIter; │ │ │ │ │ +301 │ │ │ │ │ +302 typedef typename MRS::Matrix::size_type size_type; │ │ │ │ │ +303 │ │ │ │ │ +304 // A vector containing the corresponding indices in │ │ │ │ │ +305 // the to create submatrix. │ │ │ │ │ +306 // If an entry is the maximum of size_type then this index will not appear │ │ │ │ │ +in │ │ │ │ │ +307 // the submatrix. │ │ │ │ │ +308 std::vector subMatrixIndex(mrs.matrix().N(), │ │ │ │ │ +309 std::numeric_limits::max()); │ │ │ │ │ +310 size_type s=0; │ │ │ │ │ +311 for(SIter index = mrs.rowIndexSet().begin(); index!=mrs.rowIndexSet().end │ │ │ │ │ +(); ++index) │ │ │ │ │ +312 subMatrixIndex[*index]=s++; │ │ │ │ │ +313 │ │ │ │ │ +314 // Calculate upper Bound for nonzeros │ │ │ │ │ +315 for(Iter row=mrs.begin(); row!= mrs.end(); ++row) │ │ │ │ │ +316 initializer.addRowNnz(row, subMatrixIndex); │ │ │ │ │ 317 │ │ │ │ │ -320 template │ │ │ │ │ -_3_2_1 void _m_m_h_v (const X& x, Y& y) const { │ │ │ │ │ -322 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ -rows"); │ │ │ │ │ -323 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ -columns"); │ │ │ │ │ -324 using namespace Dune::Hybrid; │ │ │ │ │ -325 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -326 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -327 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -328 (*this)[j][i].mmhv(x[j], y[i]); │ │ │ │ │ -329 }); │ │ │ │ │ -330 }); │ │ │ │ │ -331 } │ │ │ │ │ -332 │ │ │ │ │ -335 template │ │ │ │ │ -_3_3_6 void _u_s_m_h_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const { │ │ │ │ │ -337 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ -rows"); │ │ │ │ │ -338 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ -columns"); │ │ │ │ │ -339 using namespace Dune::Hybrid; │ │ │ │ │ -340 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ -341 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -342 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ -343 (*this)[j][i].usmhv(alpha, x[j], y[i]); │ │ │ │ │ -344 }); │ │ │ │ │ -345 }); │ │ │ │ │ -346 } │ │ │ │ │ -347 │ │ │ │ │ -348 │ │ │ │ │ -349 //===== norms │ │ │ │ │ -350 │ │ │ │ │ -_3_5_2 auto _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ -353 { │ │ │ │ │ -354 using field_type_00 = typename std::decay_t_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -355 typename FieldTraits::real_type sum=0; │ │ │ │ │ -356 │ │ │ │ │ -357 auto rows = index_constant(); │ │ │ │ │ -358 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) { │ │ │ │ │ -359 auto cols = index_constant::M()>(); │ │ │ │ │ -360 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) { │ │ │ │ │ -361 sum += (*this)[i][j].frobenius_norm2(); │ │ │ │ │ -362 }); │ │ │ │ │ -363 }); │ │ │ │ │ -364 │ │ │ │ │ -365 return sum; │ │ │ │ │ -366 } │ │ │ │ │ -367 │ │ │ │ │ -_3_6_9 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ │ -370 { │ │ │ │ │ -371 return sqrt(_f_r_o_b_e_n_i_u_s___n_o_r_m_2()); │ │ │ │ │ -372 } │ │ │ │ │ -373 │ │ │ │ │ -_3_7_5 auto _i_n_f_i_n_i_t_y___n_o_r_m () const │ │ │ │ │ -376 { │ │ │ │ │ -377 using field_type_00 = typename std::decay_t_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -378 using std::max; │ │ │ │ │ -379 typename FieldTraits::real_type norm=0; │ │ │ │ │ -380 │ │ │ │ │ -381 auto rows = index_constant(); │ │ │ │ │ -382 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) { │ │ │ │ │ -383 │ │ │ │ │ -384 typename FieldTraits::real_type sum=0; │ │ │ │ │ -385 auto cols = index_constant::M()>(); │ │ │ │ │ -386 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) { │ │ │ │ │ -387 sum += (*this)[i][j].infinity_norm(); │ │ │ │ │ -388 }); │ │ │ │ │ -389 norm = max(sum, norm); │ │ │ │ │ -390 }); │ │ │ │ │ -391 │ │ │ │ │ -392 return norm; │ │ │ │ │ -393 } │ │ │ │ │ -394 │ │ │ │ │ -_3_9_6 auto _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l () const │ │ │ │ │ -397 { │ │ │ │ │ -398 using field_type_00 = typename std::decay_t_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -399 using std::max; │ │ │ │ │ -400 typename FieldTraits::real_type norm=0; │ │ │ │ │ -401 │ │ │ │ │ -402 auto rows = index_constant(); │ │ │ │ │ -403 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) { │ │ │ │ │ -404 │ │ │ │ │ -405 typename FieldTraits::real_type sum=0; │ │ │ │ │ -406 auto cols = index_constant::M()>(); │ │ │ │ │ -407 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) { │ │ │ │ │ -408 sum += (*this)[i][j].infinity_norm_real(); │ │ │ │ │ -409 }); │ │ │ │ │ -410 norm = max(sum, norm); │ │ │ │ │ -411 }); │ │ │ │ │ -412 │ │ │ │ │ -413 return norm; │ │ │ │ │ -414 } │ │ │ │ │ -415 │ │ │ │ │ -416 }; │ │ │ │ │ -417 │ │ │ │ │ -423 template │ │ │ │ │ -_4_2_4 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_M_a_t_r_i_x_<_T_1_,_A_r_g_s_._._._>& m) { │ │ │ │ │ -425 auto N = index_constant::N()>(); │ │ │ │ │ -426 auto M = index_constant::M()>(); │ │ │ │ │ -427 using namespace Dune::Hybrid; │ │ │ │ │ -428 forEach(integralRange(N), [&](auto&& i) { │ │ │ │ │ -429 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -430 forEach(integralRange(M), [&](auto&& j) { │ │ │ │ │ -431 s << "\t(" << i << ", " << j << "): \n" << m[i][j]; │ │ │ │ │ -432 }); │ │ │ │ │ -433 }); │ │ │ │ │ -434 s << std::endl; │ │ │ │ │ -435 return s; │ │ │ │ │ -436 } │ │ │ │ │ -437 │ │ │ │ │ -438 //make algmeta_itsteps known │ │ │ │ │ -439 template │ │ │ │ │ -440 struct algmeta_itsteps; │ │ │ │ │ -441 │ │ │ │ │ -448 template // │ │ │ │ │ -MultiTypeBlockMatrix_Solver_Col: iterating over one row │ │ │ │ │ -_4_4_9 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l { //calculating b- A[i][j]*x[j] │ │ │ │ │ -450 public: │ │ │ │ │ -454 template │ │ │ │ │ -_4_5_5 static void _c_a_l_c___r_h_s(const TMatrix& A, TVector& x, TVector& v, Trhs& b, │ │ │ │ │ -const K& w) { │ │ │ │ │ -456 std::get( std::get(A) ).mmv( std::get(x), b ); │ │ │ │ │ -457 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_I_,_ _c_r_o_w_,_ _c_c_o_l_+_1_,_ _r_e_m_a_i_n___c_o_l_-_1_>_:_:_c_a_l_c___r_h_s │ │ │ │ │ -(A,x,v,b,w); //next column element │ │ │ │ │ -458 } │ │ │ │ │ -459 │ │ │ │ │ -460 }; │ │ │ │ │ -461 template //MultiTypeBlockMatrix_Solver_Col │ │ │ │ │ -recursion end │ │ │ │ │ -_4_6_2 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l { │ │ │ │ │ -463 public: │ │ │ │ │ -464 template │ │ │ │ │ -_4_6_5 static void _c_a_l_c___r_h_s(const TMatrix&, TVector&, TVector&, Trhs&, const K&) │ │ │ │ │ -{} │ │ │ │ │ -466 }; │ │ │ │ │ -467 │ │ │ │ │ -468 │ │ │ │ │ -469 │ │ │ │ │ -476 template │ │ │ │ │ -_4_7_7 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r { │ │ │ │ │ -478 public: │ │ │ │ │ -479 │ │ │ │ │ -483 template │ │ │ │ │ -_4_8_4 static void _d_b_g_s(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ -w) { │ │ │ │ │ -485 TVector xold(x); │ │ │ │ │ -486 xold=x; //store old x values │ │ │ │ │ -487 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_d_b_g_s(A,x,x,b,w); │ │ │ │ │ -488 x *= w; │ │ │ │ │ -489 x.axpy(1-w,xold); //improve x │ │ │ │ │ -490 } │ │ │ │ │ -491 template │ │ │ │ │ -_4_9_2 static void _d_b_g_s(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ -b, const K& w) { │ │ │ │ │ -493 auto rhs = std::get (b); │ │ │ │ │ -494 │ │ │ │ │ -495 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ -(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ -496 //solve on blocklevel I-1 │ │ │ │ │ -497 using M = │ │ │ │ │ -498 typename std::remove_cv< │ │ │ │ │ -499 typename std::remove_reference< │ │ │ │ │ -500 decltype(std::get( std::get(A))) │ │ │ │ │ -501 >::type │ │ │ │ │ -502 >::type; │ │ │ │ │ -503 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_d_b_g_s(std::get( std::get(A)), std:: │ │ │ │ │ -get(x),rhs,w); │ │ │ │ │ -504 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_+_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_d_b_g_s(A,x,v,b,w); //next │ │ │ │ │ -row │ │ │ │ │ -505 } │ │ │ │ │ -506 │ │ │ │ │ -507 │ │ │ │ │ -508 │ │ │ │ │ -512 template │ │ │ │ │ -_5_1_3 static void _b_s_o_r_f(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ -w) { │ │ │ │ │ -514 TVector v; │ │ │ │ │ -515 v=x; //use latest x values in right side calculation │ │ │ │ │ -516 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_b_s_o_r_f(A,x,v,b,w); │ │ │ │ │ -517 │ │ │ │ │ -518 } │ │ │ │ │ -519 template //recursion over │ │ │ │ │ -all matrix rows (A) │ │ │ │ │ -_5_2_0 static void _b_s_o_r_f(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ -b, const K& w) { │ │ │ │ │ -521 auto rhs = std::get (b); │ │ │ │ │ -522 │ │ │ │ │ -523 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ -(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ -524 //solve on blocklevel I-1 │ │ │ │ │ -525 using M = │ │ │ │ │ -526 typename std::remove_cv< │ │ │ │ │ -527 typename std::remove_reference< │ │ │ │ │ -528 decltype(std::get( std::get(A))) │ │ │ │ │ -529 >::type │ │ │ │ │ -530 >::type; │ │ │ │ │ -531 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_b_s_o_r_f(std::get( std::get(A)), std:: │ │ │ │ │ -get(v),rhs,w); │ │ │ │ │ -532 std::get(x).axpy(w,std::get(v)); │ │ │ │ │ -533 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_+_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_b_s_o_r_f(A,x,v,b,w); // │ │ │ │ │ -next row │ │ │ │ │ -534 } │ │ │ │ │ -535 │ │ │ │ │ -539 template │ │ │ │ │ -_5_4_0 static void _b_s_o_r_b(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ -w) { │ │ │ │ │ -541 TVector v; │ │ │ │ │ -542 v=x; //use latest x values in right side calculation │ │ │ │ │ -543 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_b_s_o_r_b(A,x,v,b,w); │ │ │ │ │ -544 │ │ │ │ │ -545 } │ │ │ │ │ -546 template //recursion over │ │ │ │ │ -all matrix rows (A) │ │ │ │ │ -_5_4_7 static void _b_s_o_r_b(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ -b, const K& w) { │ │ │ │ │ -548 auto rhs = std::get (b); │ │ │ │ │ -549 │ │ │ │ │ -550 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ -(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ -551 //solve on blocklevel I-1 │ │ │ │ │ -552 using M = │ │ │ │ │ -553 typename std::remove_cv< │ │ │ │ │ -554 typename std::remove_reference< │ │ │ │ │ -555 decltype(std::get( std::get(A))) │ │ │ │ │ -556 >::type │ │ │ │ │ -557 >::type; │ │ │ │ │ -558 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_b_s_o_r_b(std::get( std::get(A)), std:: │ │ │ │ │ -get(v),rhs,w); │ │ │ │ │ -559 std::get(x).axpy(w,std::get(v)); │ │ │ │ │ -560 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_-_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_b_s_o_r_b(A,x,v,b,w); // │ │ │ │ │ -next row │ │ │ │ │ -561 } │ │ │ │ │ -562 │ │ │ │ │ -563 │ │ │ │ │ -567 template │ │ │ │ │ -_5_6_8 static void _d_b_j_a_c(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ -w) { │ │ │ │ │ -569 TVector v(x); │ │ │ │ │ -570 v=0; //calc new x in v │ │ │ │ │ -571 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_d_b_j_a_c(A,x,v,b,w); │ │ │ │ │ -572 x.axpy(w,v); //improve x │ │ │ │ │ -573 } │ │ │ │ │ -574 template │ │ │ │ │ -_5_7_5 static void _d_b_j_a_c(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ -b, const K& w) { │ │ │ │ │ -576 auto rhs = std::get (b); │ │ │ │ │ -577 │ │ │ │ │ -578 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ -(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ -579 //solve on blocklevel I-1 │ │ │ │ │ -580 using M = │ │ │ │ │ -581 typename std::remove_cv< │ │ │ │ │ -582 typename std::remove_reference< │ │ │ │ │ -583 decltype(std::get( std::get(A))) │ │ │ │ │ -584 >::type │ │ │ │ │ -585 >::type; │ │ │ │ │ -586 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_d_b_j_a_c(std::get( std::get(A)), std:: │ │ │ │ │ -get(v),rhs,w); │ │ │ │ │ -587 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_+_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_d_b_j_a_c(A,x,v,b,w); // │ │ │ │ │ -next row │ │ │ │ │ -588 } │ │ │ │ │ -589 │ │ │ │ │ -590 │ │ │ │ │ -591 │ │ │ │ │ -592 │ │ │ │ │ -593 }; │ │ │ │ │ -594 template //recursion end for remain_row = 0 │ │ │ │ │ -_5_9_5 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r { │ │ │ │ │ -596 public: │ │ │ │ │ -597 template │ │ │ │ │ -_5_9_8 static void _d_b_g_s(const TMatrix&, TVector&, TVector&, │ │ │ │ │ -599 const TVector&, const K&) {} │ │ │ │ │ -600 │ │ │ │ │ -601 template │ │ │ │ │ -_6_0_2 static void _b_s_o_r_f(const TMatrix&, TVector&, TVector&, │ │ │ │ │ -603 const TVector&, const K&) {} │ │ │ │ │ -604 │ │ │ │ │ -605 template │ │ │ │ │ -_6_0_6 static void _b_s_o_r_b(const TMatrix&, TVector&, TVector&, │ │ │ │ │ -607 const TVector&, const K&) {} │ │ │ │ │ -608 │ │ │ │ │ -609 template │ │ │ │ │ -_6_1_0 static void _d_b_j_a_c(const TMatrix&, TVector&, TVector&, │ │ │ │ │ -611 const TVector&, const K&) {} │ │ │ │ │ -612 }; │ │ │ │ │ -613 │ │ │ │ │ -614} // end namespace Dune │ │ │ │ │ -615 │ │ │ │ │ -616namespace _s_t_d │ │ │ │ │ -617{ │ │ │ │ │ -622 template │ │ │ │ │ -_6_2_3 struct tuple_element > │ │ │ │ │ -624 { │ │ │ │ │ -_6_2_5 using _t_y_p_e = typename std::tuple_element >::type; │ │ │ │ │ -626 }; │ │ │ │ │ -627} │ │ │ │ │ -628#endif │ │ │ │ │ -_g_s_e_t_c_._h_h │ │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ -generic way. │ │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_t_y_p_e │ │ │ │ │ -MultiTypeBlockMatrix< FirstRow, Args... > type │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:568 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ -MultiTypeBlockMatrix & operator+=(const MultiTypeBlockMatrix &b) │ │ │ │ │ -Add the entries of another matrix to this one. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:168 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ -void mv(const X &x, Y &y) const │ │ │ │ │ -y = A x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:196 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ -void mmtv(const X &x, Y &y) const │ │ │ │ │ -y -= A^T x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ -void mmhv(const X &x, Y &y) const │ │ │ │ │ -y -= A^H x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:321 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ -K &) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:598 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:484 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:540 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ -void usmhv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^H x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:336 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -FirstRow::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ -void usmv(const AlphaType &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:236 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ -MultiTypeBlockMatrix & operator/=(const field_type &k) │ │ │ │ │ -vector space division by scalar │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:152 │ │ │ │ │ -_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_M_a_t_r_i_x_<_ _A_r_g_s_._._._ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -typename std::tuple_element< i, std::tuple< Args... > >::type type │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:625 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ -const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:492 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ -const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:520 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ -void umhv(const X &x, Y &y) const │ │ │ │ │ -y += A^H x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:306 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ -frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:369 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_N │ │ │ │ │ -static constexpr size_type N() │ │ │ │ │ -Return the number of matrix rows. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ -void usmtv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^T x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:291 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -void operator=(const T &newval) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:127 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_ _I_,_ _c_r_o_w_,_ _c_c_o_l_,_ _0_ _>_:_:_c_a_l_c___r_h_s │ │ │ │ │ -static void calc_rhs(const TMatrix &, TVector &, TVector &, Trhs &, const K &) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:465 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ -void umv(const X &x, Y &y) const │ │ │ │ │ -y += A x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:206 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_:_:_c_a_l_c___r_h_s │ │ │ │ │ -static void calc_rhs(const TMatrix &A, TVector &x, TVector &v, Trhs &b, const K │ │ │ │ │ -&w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:455 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:513 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_s_i_z_e │ │ │ │ │ -static constexpr size_type size() │ │ │ │ │ -Return the number of matrix rows. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ -K &) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:610 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ -auto infinity_norm_real() const │ │ │ │ │ -Bastardized version of the infinity-norm / row-sum norm. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:396 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ -auto frobenius_norm2() const │ │ │ │ │ -square of frobenius norm, need for block recursion │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:352 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -Type used for sizes. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ -auto infinity_norm() const │ │ │ │ │ -Bastardized version of the infinity-norm / row-sum norm. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:375 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ -K &) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:606 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ -MultiTypeBlockMatrix & operator-=(const MultiTypeBlockMatrix &b) │ │ │ │ │ -Subtract the entries of another matrix from this one. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:183 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -auto operator[](const std::integral_constant< size_type, index > indexVariable) │ │ │ │ │ --> decltype(std::get< index >(*this)) │ │ │ │ │ -Random-access operator. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ -const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:575 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ -K &) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:602 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ -void mtv(const X &x, Y &y) const │ │ │ │ │ -y = A^T x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:251 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_M │ │ │ │ │ -static constexpr size_type M() │ │ │ │ │ -Return the number of matrix columns. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ -void mmv(const X &x, Y &y) const │ │ │ │ │ -y -= A x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:221 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ -void umtv(const X &x, Y &y) const │ │ │ │ │ -y += A^T x │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ -const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:547 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ -MultiTypeBlockMatrix & operator*=(const field_type &k) │ │ │ │ │ -vector space multiplication with scalar │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:141 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +318 initializer.allocate(); │ │ │ │ │ +319 │ │ │ │ │ +320 for(Iter row=mrs.begin(); row!= mrs.end(); ++row) │ │ │ │ │ +321 for(CIter _c_o_l=row->begin(); _c_o_l != row->end(); ++_c_o_l) { │ │ │ │ │ +322 if(subMatrixIndex[_c_o_l.index()]!=std::numeric_limits::max()) │ │ │ │ │ +323 // This column is in our subset (use submatrix column index) │ │ │ │ │ +324 initializer.countEntries(subMatrixIndex[_c_o_l.index()]); │ │ │ │ │ +325 } │ │ │ │ │ +326 │ │ │ │ │ +327 initializer.calcColstart(); │ │ │ │ │ +328 │ │ │ │ │ +329 for(Iter row=mrs.begin(); row!= mrs.end(); ++row) │ │ │ │ │ +330 for(CIter _c_o_l=row->begin(); _c_o_l != row->end(); ++_c_o_l) { │ │ │ │ │ +331 if(subMatrixIndex[_c_o_l.index()]!=std::numeric_limits::max()) │ │ │ │ │ +332 // This value is in our submatrix -> copy (use submatrix indices │ │ │ │ │ +333 initializer.copyValue(_c_o_l, subMatrixIndex[row.index()], subMatrixIndex │ │ │ │ │ +[_c_o_l.index()]); │ │ │ │ │ +334 } │ │ │ │ │ +335 initializer.createMatrix(); │ │ │ │ │ +336 } │ │ │ │ │ +337 │ │ │ │ │ +338} │ │ │ │ │ +339#endif │ │ │ │ │ +_b_c_c_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_c_o_u_n_t_E_n_t_r_i_e_s │ │ │ │ │ +std::size_t countEntries(const BlockVector< T, A > &vector) │ │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1076 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_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:590 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ -A Matrix class to support different block types. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:461 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:418 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:504 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:378 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r │ │ │ │ │ -solver for MultiTypeBlockVector & MultiTypeBlockMatrix types │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:477 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l │ │ │ │ │ -part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ +Initializer for SuperLU Matrices representing the subdomains. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixredistribute.hh File Reference │ │ │ │ +dune-istl: btdmatrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,86 +71,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
matrixredistribute.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
btdmatrix.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Functionality for redistributing a sparse matrix. │ │ │ │ +

Implementation of the BTDMatrix class. │ │ │ │ More...

│ │ │ │ -
#include <memory>
│ │ │ │ -#include "repartition.hh"
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/parallel/indexset.hh>
│ │ │ │ -#include <dune/istl/owneroverlapcopy.hh>
│ │ │ │ -#include <dune/istl/paamg/pinfo.hh>
│ │ │ │ +
#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::RedistributeInformation< T >
class  Dune::BTDMatrix< B, A >
 A block-tridiagonal matrix. More...
 
class  Dune::RedistributeInformation< OwnerOverlapCopyCommunication< T, T1 > >
 
struct  Dune::CommMatrixRowSize< M, RI >
 Utility class to communicate and set the row sizes of a redistributed matrix. More...
 
struct  Dune::CommMatrixSparsityPattern< M, I >
 Utility class to communicate and build the sparsity pattern of a redistributed matrix. More...
 
struct  Dune::CommPolicy< CommMatrixSparsityPattern< M, I > >
 
struct  Dune::CommMatrixRow< M, I >
 Utility class for comunicating the matrix entries. More...
 
struct  Dune::CommPolicy< CommMatrixRow< M, I > >
 
struct  Dune::MatrixRowSizeGatherScatter< M, I, RI >
 
struct  Dune::MatrixCopyRowSizeGatherScatter< M, I, RI >
 
struct  Dune::MatrixSparsityPatternGatherScatter< M, I >
 
struct  Dune::MatrixRowGatherScatter< M, I >
struct  Dune::FieldTraits< BTDMatrix< B, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<typename M , typename C >
void Dune::redistributeSparsityPattern (M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
 
template<typename M , typename C >
void Dune::redistributeMatrixEntries (M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
 
template<typename M , typename C >
void Dune::redistributeMatrix (M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
 Redistribute a matrix according to given domain decompositions.
 
template<typename M >
void Dune::redistributeMatrixEntries (M &origMatrix, M &newMatrix, Dune::Amg::SequentialInformation &origComm, Dune::Amg::SequentialInformation &newComm, RedistributeInformation< Dune::Amg::SequentialInformation > &ri)
 
template<typename M >
void Dune::redistributeMatrix (M &origMatrix, M &newMatrix, Dune::Amg::SequentialInformation &origComm, Dune::Amg::SequentialInformation &newComm, RedistributeInformation< Dune::Amg::SequentialInformation > &ri)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Functionality for redistributing a sparse matrix.

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

Implementation of the BTDMatrix class.

│ │ │ │ +
Author
Oliver Sander
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,80 +1,30 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -matrixredistribute.hh File Reference │ │ │ │ │ -Functionality for redistributing a sparse matrix. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include "_r_e_p_a_r_t_i_t_i_o_n_._h_h" │ │ │ │ │ -#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_/_p_i_n_f_o_._h_h> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +btdmatrix.hh File Reference │ │ │ │ │ +Implementation of the BTDMatrix class. _M_o_r_e_._._. │ │ │ │ │ +#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_l_o_c_k_l_e_v_e_l_._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_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_ _T_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _> │ │ │ │ │ +  A block-tridiagonal matrix. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ - class   _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_<_ _O_w_n_e_r_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_ _> │ │ │ │ │ - _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_ _M_,_ _R_I_ _> │ │ │ │ │ -  Utility class to communicate and set the row sizes of a redistributed │ │ │ │ │ - matrix. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _> │ │ │ │ │ -  Utility class to communicate and build the sparsity pattern of a │ │ │ │ │ - redistributed matrix. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _> │ │ │ │ │ -  Utility class for comunicating the matrix entries. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_,_ _R_I_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_,_ _R_I_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _M_,_ _I_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n (M &origMatrix, M &newMatrix, C │ │ │ │ │ - &origComm, 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) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _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 (M &origMatrix, M &newMatrix, C │ │ │ │ │ - &origComm, 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) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (M &origMatrix, M &newMatrix, C &origComm, 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) │ │ │ │ │ -  Redistribute a matrix according to given domain decompositions. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _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 (M &origMatrix, M &newMatrix, _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 &origComm, _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 │ │ │ │ │ - &newComm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< _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 > │ │ │ │ │ - &ri) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (M &origMatrix, M &newMatrix, _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 &origComm, _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 │ │ │ │ │ - &newComm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< _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 > │ │ │ │ │ - &ri) │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Functionality for redistributing a sparse matrix. │ │ │ │ │ +Implementation of the BTDMatrix class. │ │ │ │ │ Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ + Oliver Sander │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixredistribute.hh Source File │ │ │ │ +dune-istl: btdmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,996 +74,240 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
matrixredistribute.hh
│ │ │ │ +
btdmatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_MATRIXREDISTRIBUTE_HH
│ │ │ │ -
6#define DUNE_ISTL_MATRIXREDISTRIBUTE_HH
│ │ │ │ -
7#include <memory>
│ │ │ │ -
8#include "repartition.hh"
│ │ │ │ -
9#include <dune/common/exceptions.hh>
│ │ │ │ -
10#include <dune/common/parallel/indexset.hh>
│ │ │ │ - │ │ │ │ - │ │ │ │ -
18namespace Dune
│ │ │ │ -
19{
│ │ │ │ -
20 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
22 {
│ │ │ │ -
│ │ │ │ -
23 bool isSetup() const
│ │ │ │ -
24 {
│ │ │ │ -
25 return false;
│ │ │ │ -
26 }
│ │ │ │ -
│ │ │ │ -
27 template<class D>
│ │ │ │ -
│ │ │ │ -
28 void redistribute([[maybe_unused]] const D& from, [[maybe_unused]] D& to) const
│ │ │ │ -
29 {}
│ │ │ │ -
│ │ │ │ -
30
│ │ │ │ -
31 template<class D>
│ │ │ │ -
│ │ │ │ -
32 void redistributeBackward([[maybe_unused]] D& from, [[maybe_unused]]const D& to) const
│ │ │ │ -
33 {}
│ │ │ │ -
│ │ │ │ -
34
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
36 {}
│ │ │ │ -
│ │ │ │ -
37
│ │ │ │ -
│ │ │ │ -
38 void setNoRows([[maybe_unused]] std::size_t size)
│ │ │ │ -
39 {}
│ │ │ │ -
│ │ │ │ -
40
│ │ │ │ -
│ │ │ │ -
41 void setNoCopyRows([[maybe_unused]] std::size_t size)
│ │ │ │ -
42 {}
│ │ │ │ -
│ │ │ │ -
43
│ │ │ │ -
│ │ │ │ -
44 void setNoBackwardsCopyRows([[maybe_unused]] std::size_t size)
│ │ │ │ -
45 {}
│ │ │ │ -
│ │ │ │ -
46
│ │ │ │ -
│ │ │ │ -
47 std::size_t getRowSize([[maybe_unused]] std::size_t index) const
│ │ │ │ -
48 {
│ │ │ │ -
49 return -1;
│ │ │ │ -
50 }
│ │ │ │ -
│ │ │ │ -
51
│ │ │ │ -
│ │ │ │ -
52 std::size_t getCopyRowSize([[maybe_unused]] std::size_t index) const
│ │ │ │ -
53 {
│ │ │ │ -
54 return -1;
│ │ │ │ -
55 }
│ │ │ │ -
│ │ │ │ -
56
│ │ │ │ -
│ │ │ │ -
57 std::size_t getBackwardsCopyRowSize([[maybe_unused]] std::size_t index) const
│ │ │ │ -
58 {
│ │ │ │ -
59 return -1;
│ │ │ │ -
60 }
│ │ │ │ -
│ │ │ │ -
61
│ │ │ │ -
62 };
│ │ │ │ -
│ │ │ │ -
63
│ │ │ │ -
64#if HAVE_MPI
│ │ │ │ -
65 template<typename T, typename T1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
67 {
│ │ │ │ -
68 public:
│ │ │ │ - │ │ │ │ -
70
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
72 : interface(), setup_(false)
│ │ │ │ -
73 {}
│ │ │ │ -
│ │ │ │ -
74
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
76 {
│ │ │ │ -
77 return interface;
│ │ │ │ +
5#ifndef DUNE_ISTL_BTDMATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_BTDMATRIX_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <dune/common/fmatrix.hh>
│ │ │ │ +
9#include <dune/common/scalarvectorview.hh>
│ │ │ │ +
10#include <dune/common/scalarmatrixview.hh>
│ │ │ │ + │ │ │ │ + │ │ │ │ +
13
│ │ │ │ +
19namespace Dune {
│ │ │ │ +
29 template <class B, class A=std::allocator<B> >
│ │ │ │ +
│ │ │ │ +
30 class BTDMatrix : public BCRSMatrix<B,A>
│ │ │ │ +
31 {
│ │ │ │ +
32 public:
│ │ │ │ +
33
│ │ │ │ +
34 //===== type definitions and constants
│ │ │ │ +
35
│ │ │ │ +
37 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
38
│ │ │ │ +
40 typedef B block_type;
│ │ │ │ +
41
│ │ │ │ +
43 typedef A allocator_type;
│ │ │ │ +
44
│ │ │ │ +
46 //typedef BCRSMatrix<B,A>::row_type row_type;
│ │ │ │ +
47
│ │ │ │ +
49 typedef typename A::size_type size_type;
│ │ │ │ +
50
│ │ │ │ +
52 [[deprecated("Use free blockLevel function. Will be removed after 2.8.")]]
│ │ │ │ +
53 static constexpr auto blocklevel = blockLevel<B>()+1;
│ │ │ │ +
54
│ │ │ │ +
56 BTDMatrix() : BCRSMatrix<B,A>() {}
│ │ │ │ +
57
│ │ │ │ +
│ │ │ │ +
58 explicit BTDMatrix(size_type size)
│ │ │ │ +
59 : BCRSMatrix<B,A>(size, size, BCRSMatrix<B,A>::random)
│ │ │ │ +
60 {
│ │ │ │ +
61 // Set number of entries for each row
│ │ │ │ +
62 // All rows get three entries, except for the first and the last one
│ │ │ │ +
63 for (size_t i=0; i<size; i++)
│ │ │ │ +
64 this->BCRSMatrix<B,A>::setrowsize(i, 3 - (i==0) - (i==(size-1)));
│ │ │ │ +
65
│ │ │ │ + │ │ │ │ +
67
│ │ │ │ +
68 // The actual entries for each row
│ │ │ │ +
69 for (size_t i=0; i<size; i++) {
│ │ │ │ +
70 if (i>0)
│ │ │ │ +
71 this->BCRSMatrix<B,A>::addindex(i, i-1);
│ │ │ │ +
72 this->BCRSMatrix<B,A>::addindex(i, i );
│ │ │ │ +
73 if (i<size-1)
│ │ │ │ +
74 this->BCRSMatrix<B,A>::addindex(i, i+1);
│ │ │ │ +
75 }
│ │ │ │ +
76
│ │ │ │ + │ │ │ │
78 }
│ │ │ │
│ │ │ │ -
79 template<typename IS>
│ │ │ │ -
│ │ │ │ -
80 void checkInterface(const IS& source,
│ │ │ │ -
81 const IS& target, MPI_Comm comm)
│ │ │ │ +
79
│ │ │ │ +
│ │ │ │ +
81 void setSize(size_type size)
│ │ │ │
82 {
│ │ │ │ -
83 auto ri = std::make_unique<RemoteIndices<IS> >(source, target, comm);
│ │ │ │ -
84 ri->template rebuild<true>();
│ │ │ │ -
85 Interface inf;
│ │ │ │ - │ │ │ │ -
87 int rank;
│ │ │ │ -
88 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ -
89 inf.free();
│ │ │ │ -
90 inf.build(*ri, flags, flags);
│ │ │ │ -
91
│ │ │ │ +
83 auto nonZeros = (size==0) ? 0 : size + 2*(size-1);
│ │ │ │ +
84 this->BCRSMatrix<B,A>::setSize(size, // rows
│ │ │ │ +
85 size, // columns
│ │ │ │ +
86 nonZeros);
│ │ │ │ +
87
│ │ │ │ +
88 // Set number of entries for each row
│ │ │ │ +
89 // All rows get three entries, except for the first and the last one
│ │ │ │ +
90 for (size_t i=0; i<size; i++)
│ │ │ │ +
91 this->BCRSMatrix<B,A>::setrowsize(i, 3 - (i==0) - (i==(size-1)));
│ │ │ │
92
│ │ │ │ -
93#ifdef DEBUG_REPART
│ │ │ │ -
94 if(inf!=interface) {
│ │ │ │ -
95
│ │ │ │ -
96 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ -
97 if(rank==0)
│ │ │ │ -
98 std::cout<<"Interfaces do not match!"<<std::endl;
│ │ │ │ -
99 std::cout<<rank<<": redist interface new :"<<inf<<std::endl;
│ │ │ │ -
100 std::cout<<rank<<": redist interface :"<<interface<<std::endl;
│ │ │ │ -
101
│ │ │ │ -
102 throw "autsch!";
│ │ │ │ -
103 }
│ │ │ │ -
104#endif
│ │ │ │ + │ │ │ │ +
94
│ │ │ │ +
95 // The actual entries for each row
│ │ │ │ +
96 for (size_t i=0; i<size; i++) {
│ │ │ │ +
97 if (i>0)
│ │ │ │ +
98 this->BCRSMatrix<B,A>::addindex(i, i-1);
│ │ │ │ +
99 this->BCRSMatrix<B,A>::addindex(i, i );
│ │ │ │ +
100 if (i<size-1)
│ │ │ │ +
101 this->BCRSMatrix<B,A>::addindex(i, i+1);
│ │ │ │ +
102 }
│ │ │ │ +
103
│ │ │ │ + │ │ │ │
105 }
│ │ │ │
│ │ │ │ -
│ │ │ │ -
106 void setSetup()
│ │ │ │ -
107 {
│ │ │ │ -
108 setup_=true;
│ │ │ │ -
109 interface.strip();
│ │ │ │ -
110 }
│ │ │ │ -
│ │ │ │ -
111
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
113 {
│ │ │ │ -
114 setup_=false;
│ │ │ │ -
115 }
│ │ │ │ -
│ │ │ │ -
116
│ │ │ │ -
117 template<class GatherScatter, class D>
│ │ │ │ -
│ │ │ │ -
118 void redistribute(const D& from, D& to) const
│ │ │ │ -
119 {
│ │ │ │ -
120 BufferedCommunicator communicator;
│ │ │ │ -
121 communicator.template build<D>(from,to, interface);
│ │ │ │ -
122 communicator.template forward<GatherScatter>(from, to);
│ │ │ │ -
123 communicator.free();
│ │ │ │ -
124 }
│ │ │ │ -
│ │ │ │ -
125 template<class GatherScatter, class D>
│ │ │ │ -
│ │ │ │ -
126 void redistributeBackward(D& from, const D& to) const
│ │ │ │ -
127 {
│ │ │ │ -
128
│ │ │ │ -
129 BufferedCommunicator communicator;
│ │ │ │ -
130 communicator.template build<D>(from,to, interface);
│ │ │ │ -
131 communicator.template backward<GatherScatter>(from, to);
│ │ │ │ -
132 communicator.free();
│ │ │ │ -
133 }
│ │ │ │ -
│ │ │ │ +
106
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
109 this->BCRSMatrix<B,A>::operator=(other);
│ │ │ │ +
110 return *this;
│ │ │ │ +
111 }
│ │ │ │ +
│ │ │ │ +
112
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
116 return *this;
│ │ │ │ +
117 }
│ │ │ │ +
│ │ │ │ +
118
│ │ │ │ +
124 template <class V>
│ │ │ │ +
│ │ │ │ +
125 void solve (V& x, const V& rhs) const {
│ │ │ │ +
126
│ │ │ │ +
127 // special handling for 1x1 matrices. The generic algorithm doesn't work for them
│ │ │ │ +
128 if (this->N()==1) {
│ │ │ │ +
129 auto&& x0 = Impl::asVector(x[0]);
│ │ │ │ +
130 auto&& rhs0 = Impl::asVector(rhs[0]);
│ │ │ │ +
131 Impl::asMatrix((*this)[0][0]).solve(x0, rhs0);
│ │ │ │ +
132 return;
│ │ │ │ +
133 }
│ │ │ │
134
│ │ │ │ -
135 template<class D>
│ │ │ │ -
│ │ │ │ -
136 void redistribute(const D& from, D& to) const
│ │ │ │ -
137 {
│ │ │ │ -
138 redistribute<CopyGatherScatter<D> >(from,to);
│ │ │ │ -
139 }
│ │ │ │ -
│ │ │ │ -
140 template<class D>
│ │ │ │ -
│ │ │ │ -
141 void redistributeBackward(D& from, const D& to) const
│ │ │ │ -
142 {
│ │ │ │ -
143 redistributeBackward<CopyGatherScatter<D> >(from,to);
│ │ │ │ -
144 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
145 bool isSetup() const
│ │ │ │ -
146 {
│ │ │ │ -
147 return setup_;
│ │ │ │ -
148 }
│ │ │ │ -
│ │ │ │ +
135 // Make copies of the rhs and the right matrix band
│ │ │ │ +
136 V d = rhs;
│ │ │ │ +
137 std::vector<block_type> c(this->N()-1);
│ │ │ │ +
138 for (size_t i=0; i<this->N()-1; i++)
│ │ │ │ +
139 c[i] = (*this)[i][i+1];
│ │ │ │ +
140
│ │ │ │ +
141 /* Modify the coefficients. */
│ │ │ │ +
142 block_type a_00_inv = (*this)[0][0];
│ │ │ │ +
143 Impl::asMatrix(a_00_inv).invert();
│ │ │ │ +
144
│ │ │ │ +
145 //c[0] /= (*this)[0][0]; /* Division by zero risk. */
│ │ │ │ +
146 block_type tmp = a_00_inv;
│ │ │ │ +
147 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[0]));
│ │ │ │ +
148 c[0] = tmp;
│ │ │ │
149
│ │ │ │ -
│ │ │ │ -
150 void reserve(std::size_t size)
│ │ │ │ -
151 {}
│ │ │ │ -
│ │ │ │ -
152
│ │ │ │ -
│ │ │ │ -
153 std::size_t& getRowSize(std::size_t index)
│ │ │ │ -
154 {
│ │ │ │ -
155 return rowSize[index];
│ │ │ │ -
156 }
│ │ │ │ -
│ │ │ │ -
157
│ │ │ │ -
│ │ │ │ -
158 std::size_t getRowSize(std::size_t index) const
│ │ │ │ -
159 {
│ │ │ │ -
160 return rowSize[index];
│ │ │ │ -
161 }
│ │ │ │ -
│ │ │ │ -
162
│ │ │ │ -
│ │ │ │ -
163 std::size_t& getCopyRowSize(std::size_t index)
│ │ │ │ -
164 {
│ │ │ │ -
165 return copyrowSize[index];
│ │ │ │ -
166 }
│ │ │ │ -
│ │ │ │ -
167
│ │ │ │ -
│ │ │ │ -
168 std::size_t getCopyRowSize(std::size_t index) const
│ │ │ │ -
169 {
│ │ │ │ -
170 return copyrowSize[index];
│ │ │ │ -
171 }
│ │ │ │ -
│ │ │ │ -
172
│ │ │ │ -
│ │ │ │ -
173 std::size_t& getBackwardsCopyRowSize(std::size_t index)
│ │ │ │ -
174 {
│ │ │ │ -
175 return backwardscopyrowSize[index];
│ │ │ │ -
176 }
│ │ │ │ -
│ │ │ │ -
177
│ │ │ │ -
│ │ │ │ -
178 std::size_t getBackwardsCopyRowSize(std::size_t index) const
│ │ │ │ -
179 {
│ │ │ │ -
180 return backwardscopyrowSize[index];
│ │ │ │ -
181 }
│ │ │ │ -
│ │ │ │ -
182
│ │ │ │ -
│ │ │ │ -
183 void setNoRows(std::size_t rows)
│ │ │ │ -
184 {
│ │ │ │ -
185 rowSize.resize(rows, 0);
│ │ │ │ +
150 // d = a^{-1} d /* Division by zero would imply a singular matrix. */
│ │ │ │ +
151 auto d_0_tmp = d[0];
│ │ │ │ +
152 auto&& d_0 = Impl::asVector(d[0]);
│ │ │ │ +
153 Impl::asMatrix(a_00_inv).mv(Impl::asVector(d_0_tmp),d_0);
│ │ │ │ +
154
│ │ │ │ +
155 for (unsigned int i = 1; i < this->N(); i++) {
│ │ │ │ +
156
│ │ │ │ +
157 // id = ( a_ii - c_{i-1} a_{i, i-1} ) ^{-1}
│ │ │ │ +
158 block_type tmp;
│ │ │ │ +
159 tmp = (*this)[i][i-1];
│ │ │ │ +
160 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[i-1]));
│ │ │ │ +
161
│ │ │ │ +
162 block_type id = (*this)[i][i];
│ │ │ │ +
163 id -= tmp;
│ │ │ │ +
164 Impl::asMatrix(id).invert(); /* Division by zero risk. */
│ │ │ │ +
165
│ │ │ │ +
166 if (i<c.size()) {
│ │ │ │ +
167 Impl::asMatrix(c[i]).leftmultiply(Impl::asMatrix(id)); /* Last value calculated is redundant. */
│ │ │ │ +
168 }
│ │ │ │ +
169
│ │ │ │ +
170 // d[i] = (d[i] - d[i-1] * (*this)[i][i-1]) * id;
│ │ │ │ +
171 auto&& d_i = Impl::asVector(d[i]);
│ │ │ │ +
172 Impl::asMatrix((*this)[i][i-1]).mmv(Impl::asVector(d[i-1]), d_i);
│ │ │ │ +
173 auto tmpVec = d[i];
│ │ │ │ +
174 Impl::asMatrix(id).mv(Impl::asVector(tmpVec), d_i);
│ │ │ │ +
175 }
│ │ │ │ +
176
│ │ │ │ +
177 /* Now back substitute. */
│ │ │ │ +
178 x[this->N() - 1] = d[this->N() - 1];
│ │ │ │ +
179 for (int i = this->N() - 2; i >= 0; i--) {
│ │ │ │ +
180 //x[i] = d[i] - c[i] * x[i + 1];
│ │ │ │ +
181 x[i] = d[i];
│ │ │ │ +
182 auto&& x_i = Impl::asVector(x[i]);
│ │ │ │ +
183 Impl::asMatrix(c[i]).mmv(Impl::asVector(x[i+1]), x_i);
│ │ │ │ +
184 }
│ │ │ │ +
185
│ │ │ │
186 }
│ │ │ │
│ │ │ │
187
│ │ │ │ -
│ │ │ │ -
188 void setNoCopyRows(std::size_t rows)
│ │ │ │ -
189 {
│ │ │ │ -
190 copyrowSize.resize(rows, 0);
│ │ │ │ -
191 }
│ │ │ │ -
│ │ │ │ -
192
│ │ │ │ -
│ │ │ │ -
193 void setNoBackwardsCopyRows(std::size_t rows)
│ │ │ │ -
194 {
│ │ │ │ -
195 backwardscopyrowSize.resize(rows, 0);
│ │ │ │ -
196 }
│ │ │ │ -
│ │ │ │ -
197
│ │ │ │ -
198 private:
│ │ │ │ -
199 std::vector<std::size_t> rowSize;
│ │ │ │ -
200 std::vector<std::size_t> copyrowSize;
│ │ │ │ -
201 std::vector<std::size_t> backwardscopyrowSize;
│ │ │ │ -
202 RedistributeInterface interface;
│ │ │ │ -
203 bool setup_;
│ │ │ │ -
204 };
│ │ │ │ -
│ │ │ │ -
205
│ │ │ │ -
214 template<class M, class RI>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
216 {
│ │ │ │ -
217 // Make the default communication policy work.
│ │ │ │ -
218 typedef typename M::size_type value_type;
│ │ │ │ -
219 typedef typename M::size_type size_type;
│ │ │ │ -
220
│ │ │ │ -
│ │ │ │ -
226 CommMatrixRowSize(const M& m_, RI& rowsize_)
│ │ │ │ -
227 : matrix(m_), rowsize(rowsize_)
│ │ │ │ -
228 {}
│ │ │ │ -
│ │ │ │ -
229 const M& matrix;
│ │ │ │ - │ │ │ │ -
231
│ │ │ │ -
232 };
│ │ │ │ -
│ │ │ │ -
233
│ │ │ │ -
234
│ │ │ │ -
243 template<class M, class I>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
245 {
│ │ │ │ -
246 typedef typename M::size_type size_type;
│ │ │ │ -
247
│ │ │ │ -
│ │ │ │ -
254 CommMatrixSparsityPattern(const M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_)
│ │ │ │ -
255 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), rowsize()
│ │ │ │ -
256 {}
│ │ │ │ -
│ │ │ │ -
257
│ │ │ │ -
│ │ │ │ -
265 CommMatrixSparsityPattern(const M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_,
│ │ │ │ -
266 const std::vector<typename M::size_type>& rowsize_)
│ │ │ │ -
267 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), sparsity(aggidxset_.size()), rowsize(&rowsize_)
│ │ │ │ -
268 {}
│ │ │ │ -
│ │ │ │ -
269
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
277 {
│ │ │ │ -
278 // insert diagonal to overlap rows
│ │ │ │ -
279 typedef typename Dune::GlobalLookupIndexSet<I>::const_iterator IIter;
│ │ │ │ - │ │ │ │ -
281 std::size_t nnz=0;
│ │ │ │ -
282#ifdef DEBUG_REPART
│ │ │ │ -
283 int rank;
│ │ │ │ -
284
│ │ │ │ -
285 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
│ │ │ │ -
286#endif
│ │ │ │ -
287 for(IIter i= aggidxset.begin(), end=aggidxset.end(); i!=end; ++i) {
│ │ │ │ -
288 if(!OwnerSet::contains(i->local().attribute())) {
│ │ │ │ -
289#ifdef DEBUG_REPART
│ │ │ │ -
290 std::cout<<rank<<" Inserting diagonal for"<<i->local()<<std::endl;
│ │ │ │ -
291#endif
│ │ │ │ -
292 sparsity[i->local()].insert(i->local());
│ │ │ │ -
293 }
│ │ │ │ -
294
│ │ │ │ -
295 nnz+=sparsity[i->local()].size();
│ │ │ │ -
296 }
│ │ │ │ -
297 assert( aggidxset.size()==sparsity.size());
│ │ │ │ -
298
│ │ │ │ -
299 if(nnz>0) {
│ │ │ │ -
300 m.setSize(aggidxset.size(), aggidxset.size(), nnz);
│ │ │ │ -
301 m.setBuildMode(M::row_wise);
│ │ │ │ -
302 typename M::CreateIterator citer=m.createbegin();
│ │ │ │ -
303#ifdef DEBUG_REPART
│ │ │ │ -
304 std::size_t idx=0;
│ │ │ │ -
305 bool correct=true;
│ │ │ │ -
306 Dune::GlobalLookupIndexSet<I> global(aggidxset);
│ │ │ │ -
307#endif
│ │ │ │ -
308 typedef typename std::vector<std::set<size_type> >::const_iterator Iter;
│ │ │ │ -
309 for(Iter i=sparsity.begin(), end=sparsity.end(); i!=end; ++i, ++citer)
│ │ │ │ -
310 {
│ │ │ │ -
311 typedef typename std::set<size_type>::const_iterator SIter;
│ │ │ │ -
312 for(SIter si=i->begin(), send=i->end(); si!=send; ++si)
│ │ │ │ -
313 citer.insert(*si);
│ │ │ │ -
314#ifdef DEBUG_REPART
│ │ │ │ -
315 if(i->find(idx)==i->end()) {
│ │ │ │ -
316 const typename I::IndexPair* gi=global.pair(idx);
│ │ │ │ -
317 assert(gi);
│ │ │ │ -
318 std::cout<<rank<<": row "<<idx<<" is missing a diagonal entry! global="<<gi->global()<<" attr="<<gi->local().attribute()<<" "<<
│ │ │ │ -
319 OwnerSet::contains(gi->local().attribute())<<
│ │ │ │ -
320 " row size="<<i->size()<<std::endl;
│ │ │ │ -
321 correct=false;
│ │ │ │ -
322 }
│ │ │ │ -
323 ++idx;
│ │ │ │ -
324#endif
│ │ │ │ -
325 }
│ │ │ │ -
326#ifdef DEBUG_REPART
│ │ │ │ -
327 if(!correct)
│ │ │ │ -
328 throw "bla";
│ │ │ │ -
329#endif
│ │ │ │ -
330 }
│ │ │ │ -
331 }
│ │ │ │ -
│ │ │ │ -
332
│ │ │ │ -
│ │ │ │ -
340 void completeSparsityPattern(std::vector<std::set<size_type> > add_sparsity)
│ │ │ │ -
341 {
│ │ │ │ -
342 for (unsigned int i = 0; i != sparsity.size(); ++i) {
│ │ │ │ -
343 if (add_sparsity[i].size() != 0) {
│ │ │ │ -
344 typedef std::set<size_type> Set;
│ │ │ │ -
345 Set tmp_set;
│ │ │ │ -
346 std::insert_iterator<Set> tmp_insert (tmp_set, tmp_set.begin());
│ │ │ │ -
347 std::set_union(add_sparsity[i].begin(), add_sparsity[i].end(),
│ │ │ │ -
348 sparsity[i].begin(), sparsity[i].end(), tmp_insert);
│ │ │ │ -
349 sparsity[i].swap(tmp_set);
│ │ │ │ -
350 }
│ │ │ │ -
351 }
│ │ │ │ -
352 }
│ │ │ │ -
│ │ │ │ -
353
│ │ │ │ -
354 const M& matrix;
│ │ │ │ -
355 typedef Dune::GlobalLookupIndexSet<I> LookupIndexSet;
│ │ │ │ -
356 const Dune::GlobalLookupIndexSet<I>& idxset;
│ │ │ │ -
357 const I& aggidxset;
│ │ │ │ -
358 std::vector<std::set<size_type> > sparsity;
│ │ │ │ -
359 const std::vector<size_type>* rowsize;
│ │ │ │ -
360 };
│ │ │ │ -
│ │ │ │ -
361
│ │ │ │ -
362 template<class M, class I>
│ │ │ │ -
│ │ │ │ -
363 struct CommPolicy<CommMatrixSparsityPattern<M,I> >
│ │ │ │ -
364 {
│ │ │ │ - │ │ │ │ -
366
│ │ │ │ -
371 typedef typename I::GlobalIndex IndexedType;
│ │ │ │ -
372
│ │ │ │ -
374 typedef VariableSize IndexedTypeFlag;
│ │ │ │ -
375
│ │ │ │ -
│ │ │ │ -
376 static typename M::size_type getSize(const Type& t, std::size_t i)
│ │ │ │ -
377 {
│ │ │ │ -
378 if(!t.rowsize)
│ │ │ │ -
379 return t.matrix[i].size();
│ │ │ │ -
380 else
│ │ │ │ -
381 {
│ │ │ │ -
382 assert((*t.rowsize)[i]>0);
│ │ │ │ -
383 return (*t.rowsize)[i];
│ │ │ │ -
384 }
│ │ │ │ -
385 }
│ │ │ │ -
│ │ │ │ -
386 };
│ │ │ │ -
│ │ │ │ -
387
│ │ │ │ -
394 template<class M, class I>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
396 {
│ │ │ │ -
│ │ │ │ -
405 CommMatrixRow(M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_)
│ │ │ │ -
406 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), rowsize()
│ │ │ │ -
407 {}
│ │ │ │ -
│ │ │ │ -
408
│ │ │ │ -
│ │ │ │ -
412 CommMatrixRow(M& m_, const Dune::GlobalLookupIndexSet<I>& idxset_, const I& aggidxset_,
│ │ │ │ -
413 std::vector<size_t>& rowsize_)
│ │ │ │ -
414 : matrix(m_), idxset(idxset_), aggidxset(aggidxset_), rowsize(&rowsize_)
│ │ │ │ -
415 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
422 {
│ │ │ │ -
423 typedef typename Dune::GlobalLookupIndexSet<I>::const_iterator Iter;
│ │ │ │ - │ │ │ │ -
425
│ │ │ │ -
426 for(Iter i= aggidxset.begin(), end=aggidxset.end(); i!=end; ++i)
│ │ │ │ -
427 if(!OwnerSet::contains(i->local().attribute())) {
│ │ │ │ -
428 // Set to Dirchlet
│ │ │ │ -
429 typedef typename M::ColIterator CIter;
│ │ │ │ -
430 for(CIter c=matrix[i->local()].begin(), cend= matrix[i->local()].end();
│ │ │ │ -
431 c!= cend; ++c)
│ │ │ │ -
432 {
│ │ │ │ -
433 *c=0;
│ │ │ │ -
434 if(c.index()==i->local()) {
│ │ │ │ -
435 auto setDiagonal = [](auto&& scalarOrMatrix, const auto& value) {
│ │ │ │ -
436 auto&& matrixView = Dune::Impl::asMatrix(scalarOrMatrix);
│ │ │ │ -
437 for (auto rowIt = matrixView.begin(); rowIt != matrixView.end(); ++rowIt)
│ │ │ │ -
438 (*rowIt)[rowIt.index()] = value;
│ │ │ │ -
439 };
│ │ │ │ -
440 setDiagonal(*c, 1);
│ │ │ │ -
441 }
│ │ │ │ -
442 }
│ │ │ │ -
443 }
│ │ │ │ -
444 }
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
448 const Dune::GlobalLookupIndexSet<I>& idxset;
│ │ │ │ -
450 const I& aggidxset;
│ │ │ │ -
452 std::vector<size_t>* rowsize; // row sizes differ from sender side in overlap!
│ │ │ │ -
453 };
│ │ │ │ -
│ │ │ │ -
454
│ │ │ │ -
455 template<class M, class I>
│ │ │ │ -
│ │ │ │ -
456 struct CommPolicy<CommMatrixRow<M,I> >
│ │ │ │ -
457 {
│ │ │ │ - │ │ │ │ -
459
│ │ │ │ -
464 typedef std::pair<typename I::GlobalIndex,typename M::block_type> IndexedType;
│ │ │ │ -
465
│ │ │ │ -
467 typedef VariableSize IndexedTypeFlag;
│ │ │ │ -
468
│ │ │ │ -
│ │ │ │ -
469 static std::size_t getSize(const Type& t, std::size_t i)
│ │ │ │ -
470 {
│ │ │ │ -
471 if(!t.rowsize)
│ │ │ │ -
472 return t.matrix[i].size();
│ │ │ │ -
473 else
│ │ │ │ -
474 {
│ │ │ │ -
475 assert((*t.rowsize)[i]>0);
│ │ │ │ -
476 return (*t.rowsize)[i];
│ │ │ │ -
477 }
│ │ │ │ -
478 }
│ │ │ │ -
│ │ │ │ -
479 };
│ │ │ │ -
│ │ │ │ -
480
│ │ │ │ -
481 template<class M, class I, class RI>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
483 {
│ │ │ │ - │ │ │ │ -
485
│ │ │ │ -
│ │ │ │ -
486 static const typename M::size_type gather(const Container& cont, std::size_t i)
│ │ │ │ -
487 {
│ │ │ │ -
488 return cont.matrix[i].size();
│ │ │ │ -
489 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
490 static void scatter(Container& cont, const typename M::size_type& rowsize, std::size_t i)
│ │ │ │ -
491 {
│ │ │ │ -
492 assert(rowsize);
│ │ │ │ -
493 cont.rowsize.getRowSize(i)=rowsize;
│ │ │ │ -
494 }
│ │ │ │ -
│ │ │ │ -
495
│ │ │ │ -
496 };
│ │ │ │ -
│ │ │ │ -
497
│ │ │ │ -
498 template<class M, class I, class RI>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
500 {
│ │ │ │ - │ │ │ │ -
502
│ │ │ │ -
│ │ │ │ -
503 static const typename M::size_type gather(const Container& cont, std::size_t i)
│ │ │ │ -
504 {
│ │ │ │ -
505 return cont.matrix[i].size();
│ │ │ │ -
506 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
507 static void scatter(Container& cont, const typename M::size_type& rowsize, std::size_t i)
│ │ │ │ -
508 {
│ │ │ │ -
509 assert(rowsize);
│ │ │ │ -
510 if (rowsize > cont.rowsize.getCopyRowSize(i))
│ │ │ │ -
511 cont.rowsize.getCopyRowSize(i)=rowsize;
│ │ │ │ -
512 }
│ │ │ │ -
│ │ │ │ -
513
│ │ │ │ -
514 };
│ │ │ │ -
│ │ │ │ -
515
│ │ │ │ -
516 template<class M, class I>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
518 {
│ │ │ │ -
519 typedef typename I::GlobalIndex GlobalIndex;
│ │ │ │ - │ │ │ │ -
521 typedef typename M::ConstColIterator ColIter;
│ │ │ │ -
522
│ │ │ │ -
523 static ColIter col;
│ │ │ │ - │ │ │ │ -
525
│ │ │ │ -
│ │ │ │ -
526 static const GlobalIndex& gather(const Container& cont, std::size_t i, std::size_t j)
│ │ │ │ -
527 {
│ │ │ │ -
528 if(j==0)
│ │ │ │ -
529 col=cont.matrix[i].begin();
│ │ │ │ -
530 else if (col!=cont.matrix[i].end())
│ │ │ │ -
531 ++col;
│ │ │ │ -
532
│ │ │ │ -
533 //copy communication: different row sizes for copy rows with the same global index
│ │ │ │ -
534 //are possible. If all values of current matrix row are sent, send
│ │ │ │ -
535 //std::numeric_limits<GlobalIndex>::max()
│ │ │ │ -
536 //and receiver will ignore it.
│ │ │ │ -
537 if (col==cont.matrix[i].end()) {
│ │ │ │ -
538 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ -
539 return numlimits;
│ │ │ │ -
540 }
│ │ │ │ -
541 else {
│ │ │ │ -
542 const typename I::IndexPair* index=cont.idxset.pair(col.index());
│ │ │ │ -
543 assert(index);
│ │ │ │ -
544 // Only send index if col is no ghost
│ │ │ │ -
545 if ( index->local().attribute() != 2)
│ │ │ │ -
546 return index->global();
│ │ │ │ -
547 else {
│ │ │ │ -
548 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ -
549 return numlimits;
│ │ │ │ -
550 }
│ │ │ │ -
551 }
│ │ │ │ -
552 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
553 static void scatter(Container& cont, const GlobalIndex& gi, std::size_t i, [[maybe_unused]] std::size_t j)
│ │ │ │ -
554 {
│ │ │ │ -
555 try{
│ │ │ │ -
556 if (gi != std::numeric_limits<GlobalIndex>::max()) {
│ │ │ │ -
557 const typename I::IndexPair& ip=cont.aggidxset.at(gi);
│ │ │ │ -
558 assert(ip.global()==gi);
│ │ │ │ -
559 std::size_t column = ip.local();
│ │ │ │ -
560 cont.sparsity[i].insert(column);
│ │ │ │ -
561
│ │ │ │ - │ │ │ │ -
563 if(!OwnerSet::contains(ip.local().attribute()))
│ │ │ │ -
564 // preserve symmetry for overlap
│ │ │ │ -
565 cont.sparsity[column].insert(i);
│ │ │ │ -
566 }
│ │ │ │ -
567 }
│ │ │ │ -
568 catch(const Dune::RangeError&) {
│ │ │ │ -
569 // Entry not present in the new index set. Ignore!
│ │ │ │ -
570#ifdef DEBUG_REPART
│ │ │ │ -
571 typedef typename Container::LookupIndexSet GlobalLookup;
│ │ │ │ -
572 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ │ - │ │ │ │ -
574
│ │ │ │ -
575 GlobalLookup lookup(cont.aggidxset);
│ │ │ │ -
576 const IndexPair* pi=lookup.pair(i);
│ │ │ │ -
577 assert(pi);
│ │ │ │ -
578 if(OwnerSet::contains(pi->local().attribute())) {
│ │ │ │ -
579 int rank;
│ │ │ │ -
580 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
│ │ │ │ -
581 std::cout<<rank<<cont.aggidxset<<std::endl;
│ │ │ │ -
582 std::cout<<rank<<": row "<<i<<" (global="<<gi <<") not in index set for owner index "<<pi->global()<<std::endl;
│ │ │ │ -
583 throw;
│ │ │ │ -
584 }
│ │ │ │ -
585#endif
│ │ │ │ -
586 }
│ │ │ │ -
587 }
│ │ │ │ -
│ │ │ │ -
588
│ │ │ │ -
589 };
│ │ │ │ -
│ │ │ │ -
590 template<class M, class I>
│ │ │ │ - │ │ │ │ -
592
│ │ │ │ -
593 template<class M, class I>
│ │ │ │ - │ │ │ │ -
595
│ │ │ │ -
596
│ │ │ │ -
597 template<class M, class I>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
599 {
│ │ │ │ -
600 typedef typename I::GlobalIndex GlobalIndex;
│ │ │ │ - │ │ │ │ -
602 typedef typename M::ConstColIterator ColIter;
│ │ │ │ -
603 typedef typename std::pair<GlobalIndex,typename M::block_type> Data;
│ │ │ │ -
604 static ColIter col;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
607
│ │ │ │ -
│ │ │ │ -
608 static const Data& gather(const Container& cont, std::size_t i, std::size_t j)
│ │ │ │ -
609 {
│ │ │ │ -
610 if(j==0)
│ │ │ │ -
611 col=cont.matrix[i].begin();
│ │ │ │ -
612 else if (col!=cont.matrix[i].end())
│ │ │ │ -
613 ++col;
│ │ │ │ -
614 // copy communication: different row sizes for copy rows with the same global index
│ │ │ │ -
615 // are possible. If all values of current matrix row are sent, send
│ │ │ │ -
616 // std::numeric_limits<GlobalIndex>::max()
│ │ │ │ -
617 // and receiver will ignore it.
│ │ │ │ -
618 if (col==cont.matrix[i].end()) {
│ │ │ │ -
619 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ - │ │ │ │ -
621 return datastore;
│ │ │ │ -
622 }
│ │ │ │ -
623 else {
│ │ │ │ -
624 // convert local column index to global index
│ │ │ │ -
625 const typename I::IndexPair* index=cont.idxset.pair(col.index());
│ │ │ │ -
626 assert(index);
│ │ │ │ -
627 // Store the data to prevent reference to temporary
│ │ │ │ -
628 // Only send index if col is no ghost
│ │ │ │ -
629 if ( index->local().attribute() != 2)
│ │ │ │ -
630 datastore = Data(index->global(),*col);
│ │ │ │ -
631 else {
│ │ │ │ -
632 numlimits = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ - │ │ │ │ -
634 }
│ │ │ │ -
635 return datastore;
│ │ │ │ -
636 }
│ │ │ │ -
637 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
638 static void scatter(Container& cont, const Data& data, std::size_t i, [[maybe_unused]] std::size_t j)
│ │ │ │ -
639 {
│ │ │ │ -
640 try{
│ │ │ │ -
641 if (data.first != std::numeric_limits<GlobalIndex>::max()) {
│ │ │ │ -
642 typename M::size_type column=cont.aggidxset.at(data.first).local();
│ │ │ │ -
643 cont.matrix[i][column]=data.second;
│ │ │ │ -
644 }
│ │ │ │ -
645 }
│ │ │ │ -
646 catch(const Dune::RangeError&) {
│ │ │ │ -
647 // This an overlap row and might therefore lack some entries!
│ │ │ │ -
648 }
│ │ │ │ -
649
│ │ │ │ -
650 }
│ │ │ │ -
│ │ │ │ -
651 };
│ │ │ │ -
│ │ │ │ -
652
│ │ │ │ -
653 template<class M, class I>
│ │ │ │ - │ │ │ │ -
655
│ │ │ │ -
656 template<class M, class I>
│ │ │ │ - │ │ │ │ -
658
│ │ │ │ -
659 template<class M, class I>
│ │ │ │ - │ │ │ │ -
661
│ │ │ │ -
662 template<typename M, typename C>
│ │ │ │ -
│ │ │ │ -
663 void redistributeSparsityPattern(M& origMatrix, M& newMatrix, C& origComm, C& newComm,
│ │ │ │ - │ │ │ │ -
665 {
│ │ │ │ -
666 typename C::CopySet copyflags;
│ │ │ │ -
667 typename C::OwnerSet ownerflags;
│ │ │ │ -
668 typedef typename C::ParallelIndexSet IndexSet;
│ │ │ │ - │ │ │ │ -
670 std::vector<typename M::size_type> rowsize(newComm.indexSet().size(), 0);
│ │ │ │ -
671 std::vector<typename M::size_type> copyrowsize(newComm.indexSet().size(), 0);
│ │ │ │ -
672 std::vector<typename M::size_type> backwardscopyrowsize(origComm.indexSet().size(), 0);
│ │ │ │ -
673
│ │ │ │ -
674 // get owner rowsizes
│ │ │ │ -
675 CommMatrixRowSize<M,RI> commRowSize(origMatrix, ri);
│ │ │ │ -
676 ri.template redistribute<MatrixRowSizeGatherScatter<M,IndexSet,RI> >(commRowSize,commRowSize);
│ │ │ │ -
677
│ │ │ │ -
678 origComm.buildGlobalLookup();
│ │ │ │ -
679
│ │ │ │ -
680 for (std::size_t i=0; i < newComm.indexSet().size(); i++) {
│ │ │ │ -
681 rowsize[i] = ri.getRowSize(i);
│ │ │ │ -
682 }
│ │ │ │ -
683 // get sparsity pattern from owner rows
│ │ │ │ - │ │ │ │ -
685 origsp(origMatrix, origComm.globalLookup(), newComm.indexSet());
│ │ │ │ - │ │ │ │ -
687 newsp(origMatrix, origComm.globalLookup(), newComm.indexSet(), rowsize);
│ │ │ │ -
688
│ │ │ │ -
689 ri.template redistribute<MatrixSparsityPatternGatherScatter<M,IndexSet> >(origsp,newsp);
│ │ │ │ -
690
│ │ │ │ -
691 // build copy to owner interface to get missing matrix values for novlp case
│ │ │ │ - │ │ │ │ -
693 RemoteIndices<IndexSet> *ris = new RemoteIndices<IndexSet>(origComm.indexSet(),
│ │ │ │ -
694 newComm.indexSet(),
│ │ │ │ -
695 origComm.communicator());
│ │ │ │ -
696 ris->template rebuild<true>();
│ │ │ │ -
697
│ │ │ │ -
698 ri.getInterface().free();
│ │ │ │ -
699 ri.getInterface().build(*ris,copyflags,ownerflags);
│ │ │ │ -
700
│ │ │ │ -
701 // get copy rowsizes
│ │ │ │ -
702 CommMatrixRowSize<M,RI> commRowSize_copy(origMatrix, ri);
│ │ │ │ -
703 ri.template redistribute<MatrixCopyRowSizeGatherScatter<M,IndexSet,RI> >(commRowSize_copy,
│ │ │ │ -
704 commRowSize_copy);
│ │ │ │ -
705
│ │ │ │ -
706 for (std::size_t i=0; i < newComm.indexSet().size(); i++) {
│ │ │ │ -
707 copyrowsize[i] = ri.getCopyRowSize(i);
│ │ │ │ -
708 }
│ │ │ │ -
709 //get copy rowsizes for sender
│ │ │ │ -
710 ri.redistributeBackward(backwardscopyrowsize,copyrowsize);
│ │ │ │ -
711 for (std::size_t i=0; i < origComm.indexSet().size(); i++) {
│ │ │ │ -
712 ri.getBackwardsCopyRowSize(i) = backwardscopyrowsize[i];
│ │ │ │ -
713 }
│ │ │ │ -
714
│ │ │ │ -
715 // get sparsity pattern from copy rows
│ │ │ │ -
716 CommMatrixSparsityPattern<M,IndexSet> origsp_copy(origMatrix,
│ │ │ │ -
717 origComm.globalLookup(),
│ │ │ │ -
718 newComm.indexSet(),
│ │ │ │ -
719 backwardscopyrowsize);
│ │ │ │ -
720 CommMatrixSparsityPattern<M,IndexSet> newsp_copy(origMatrix, origComm.globalLookup(),
│ │ │ │ -
721 newComm.indexSet(), copyrowsize);
│ │ │ │ -
722 ri.template redistribute<MatrixSparsityPatternGatherScatter<M,IndexSet> >(origsp_copy,
│ │ │ │ -
723 newsp_copy);
│ │ │ │ -
724
│ │ │ │ -
725 newsp.completeSparsityPattern(newsp_copy.sparsity);
│ │ │ │ -
726 newsp.storeSparsityPattern(newMatrix);
│ │ │ │ -
727 }
│ │ │ │ -
728 else
│ │ │ │ -
729 newsp.storeSparsityPattern(newMatrix);
│ │ │ │ -
730
│ │ │ │ -
731#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
732 // Check for symmetry
│ │ │ │ -
733 int ret=0;
│ │ │ │ -
734 typedef typename M::ConstRowIterator RIter;
│ │ │ │ -
735 for(RIter row=newMatrix.begin(), rend=newMatrix.end(); row != rend; ++row) {
│ │ │ │ -
736 typedef typename M::ConstColIterator CIter;
│ │ │ │ -
737 for(CIter col=row->begin(), cend=row->end(); col!=cend; ++col)
│ │ │ │ -
738 {
│ │ │ │ -
739 try{
│ │ │ │ -
740 newMatrix[col.index()][row.index()];
│ │ │ │ -
741 }catch(const Dune::ISTLError&) {
│ │ │ │ -
742 std::cerr<<newComm.communicator().rank()<<": entry ("
│ │ │ │ -
743 <<col.index()<<","<<row.index()<<") missing! for symmetry!"<<std::endl;
│ │ │ │ -
744 ret=1;
│ │ │ │ -
745
│ │ │ │ -
746 }
│ │ │ │ -
747
│ │ │ │ -
748 }
│ │ │ │ -
749 }
│ │ │ │ -
750
│ │ │ │ -
751 if(ret)
│ │ │ │ -
752 DUNE_THROW(ISTLError, "Matrix not symmetric!");
│ │ │ │ -
753#endif
│ │ │ │ -
754 }
│ │ │ │ -
│ │ │ │ -
755
│ │ │ │ -
756 template<typename M, typename C>
│ │ │ │ -
│ │ │ │ -
757 void redistributeMatrixEntries(M& origMatrix, M& newMatrix, C& origComm, C& newComm,
│ │ │ │ - │ │ │ │ -
759 {
│ │ │ │ -
760 typedef typename C::ParallelIndexSet IndexSet;
│ │ │ │ -
761 typename C::OwnerSet ownerflags;
│ │ │ │ -
762 std::vector<typename M::size_type> rowsize(newComm.indexSet().size(), 0);
│ │ │ │ -
763 std::vector<typename M::size_type> copyrowsize(newComm.indexSet().size(), 0);
│ │ │ │ -
764 std::vector<typename M::size_type> backwardscopyrowsize(origComm.indexSet().size(), 0);
│ │ │ │ -
765
│ │ │ │ -
766 for (std::size_t i=0; i < newComm.indexSet().size(); i++) {
│ │ │ │ -
767 rowsize[i] = ri.getRowSize(i);
│ │ │ │ - │ │ │ │ -
769 copyrowsize[i] = ri.getCopyRowSize(i);
│ │ │ │ -
770 }
│ │ │ │ -
771 }
│ │ │ │ -
772
│ │ │ │ -
773 for (std::size_t i=0; i < origComm.indexSet().size(); i++)
│ │ │ │ - │ │ │ │ -
775 backwardscopyrowsize[i] = ri.getBackwardsCopyRowSize(i);
│ │ │ │ -
776
│ │ │ │ -
777
│ │ │ │ - │ │ │ │ -
779 // fill sparsity pattern from copy rows
│ │ │ │ -
780 CommMatrixRow<M,IndexSet> origrow_copy(origMatrix, origComm.globalLookup(),
│ │ │ │ -
781 newComm.indexSet(), backwardscopyrowsize);
│ │ │ │ -
782 CommMatrixRow<M,IndexSet> newrow_copy(newMatrix, origComm.globalLookup(),
│ │ │ │ -
783 newComm.indexSet(),copyrowsize);
│ │ │ │ -
784 ri.template redistribute<MatrixRowGatherScatter<M,IndexSet> >(origrow_copy,
│ │ │ │ -
785 newrow_copy);
│ │ │ │ -
786 ri.getInterface().free();
│ │ │ │ -
787 RemoteIndices<IndexSet> *ris = new RemoteIndices<IndexSet>(origComm.indexSet(),
│ │ │ │ -
788 newComm.indexSet(),
│ │ │ │ -
789 origComm.communicator());
│ │ │ │ -
790 ris->template rebuild<true>();
│ │ │ │ -
791 ri.getInterface().build(*ris,ownerflags,ownerflags);
│ │ │ │ -
792 }
│ │ │ │ -
793
│ │ │ │ - │ │ │ │ -
795 origrow(origMatrix, origComm.globalLookup(), newComm.indexSet());
│ │ │ │ - │ │ │ │ -
797 newrow(newMatrix, origComm.globalLookup(), newComm.indexSet(),rowsize);
│ │ │ │ -
798 ri.template redistribute<MatrixRowGatherScatter<M,IndexSet> >(origrow,newrow);
│ │ │ │ -
799 if (SolverCategory::category(origComm) != static_cast<int>(SolverCategory::nonoverlapping))
│ │ │ │ - │ │ │ │ -
801 }
│ │ │ │ -
│ │ │ │ -
802
│ │ │ │ -
819 template<typename M, typename C>
│ │ │ │ -
│ │ │ │ -
820 void redistributeMatrix(M& origMatrix, M& newMatrix, C& origComm, C& newComm,
│ │ │ │ - │ │ │ │ -
822 {
│ │ │ │ -
823 ri.setNoRows(newComm.indexSet().size());
│ │ │ │ -
824 ri.setNoCopyRows(newComm.indexSet().size());
│ │ │ │ -
825 ri.setNoBackwardsCopyRows(origComm.indexSet().size());
│ │ │ │ -
826 redistributeSparsityPattern(origMatrix, newMatrix, origComm, newComm, ri);
│ │ │ │ -
827 redistributeMatrixEntries(origMatrix, newMatrix, origComm, newComm, ri);
│ │ │ │ -
828 }
│ │ │ │ -
│ │ │ │ -
829#endif
│ │ │ │ -
830
│ │ │ │ -
831template<typename M>
│ │ │ │ -
│ │ │ │ -
832 void redistributeMatrixEntries(M& origMatrix, M& newMatrix,
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
836 {
│ │ │ │ -
837 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential program!");
│ │ │ │ -
838 }
│ │ │ │ -
│ │ │ │ -
839 template<typename M>
│ │ │ │ -
│ │ │ │ -
840 void redistributeMatrix(M& origMatrix, M& newMatrix,
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
844 {
│ │ │ │ -
845 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential program!");
│ │ │ │ -
846 }
│ │ │ │ -
│ │ │ │ -
847}
│ │ │ │ -
848#endif
│ │ │ │ -
Functionality for redistributing a parallel index set using graph partitioning.
│ │ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ - │ │ │ │ +
188 private:
│ │ │ │ +
189
│ │ │ │ +
190 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ +
191 // The following methods from the base class should now actually be called
│ │ │ │ +
192 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ +
193
│ │ │ │ +
194 // createbegin and createend should be in there, too, but I can't get it to compile
│ │ │ │ +
195 // BCRSMatrix<B,A>::CreateIterator createbegin () {}
│ │ │ │ +
196 // BCRSMatrix<B,A>::CreateIterator createend () {}
│ │ │ │ +
197 void setrowsize (size_type i, size_type s) {}
│ │ │ │ +
198 void incrementrowsize (size_type i) {}
│ │ │ │ +
199 void endrowsizes () {}
│ │ │ │ +
200 void addindex (size_type row, size_type col) {}
│ │ │ │ +
201 void endindices () {}
│ │ │ │ +
202 };
│ │ │ │ +
│ │ │ │ +
203
│ │ │ │ +
204 template<typename B, typename A>
│ │ │ │ +
│ │ │ │ +
205 struct FieldTraits< BTDMatrix<B, A> >
│ │ │ │ +
206 {
│ │ │ │ + │ │ │ │ +
208 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
209 };
│ │ │ │ +
│ │ │ │ +
210
│ │ │ │ +
213} // end namespace Dune
│ │ │ │ +
214
│ │ │ │ +
215#endif
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │
Col col
Definition matrixmatrix.hh:351
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
void redistributeMatrixEntries(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Definition matrixredistribute.hh:757
│ │ │ │ -
void redistributeSparsityPattern(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Definition matrixredistribute.hh:663
│ │ │ │ -
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
│ │ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
Definition matrixredistribute.hh:22
│ │ │ │ -
void setNoBackwardsCopyRows(std::size_t size)
Definition matrixredistribute.hh:44
│ │ │ │ -
void redistribute(const D &from, D &to) const
Definition matrixredistribute.hh:28
│ │ │ │ -
void resetSetup()
Definition matrixredistribute.hh:35
│ │ │ │ -
void setNoCopyRows(std::size_t size)
Definition matrixredistribute.hh:41
│ │ │ │ -
bool isSetup() const
Definition matrixredistribute.hh:23
│ │ │ │ -
void setNoRows(std::size_t size)
Definition matrixredistribute.hh:38
│ │ │ │ -
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:32
│ │ │ │ -
std::size_t getBackwardsCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:57
│ │ │ │ -
std::size_t getRowSize(std::size_t index) const
Definition matrixredistribute.hh:47
│ │ │ │ -
std::size_t getCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:52
│ │ │ │ -
std::size_t getRowSize(std::size_t index) const
Definition matrixredistribute.hh:158
│ │ │ │ -
std::size_t & getBackwardsCopyRowSize(std::size_t index)
Definition matrixredistribute.hh:173
│ │ │ │ -
RedistributeInterface & getInterface()
Definition matrixredistribute.hh:75
│ │ │ │ -
void redistribute(const D &from, D &to) const
Definition matrixredistribute.hh:136
│ │ │ │ -
void setNoBackwardsCopyRows(std::size_t rows)
Definition matrixredistribute.hh:193
│ │ │ │ -
std::size_t & getCopyRowSize(std::size_t index)
Definition matrixredistribute.hh:163
│ │ │ │ - │ │ │ │ -
std::size_t getCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:168
│ │ │ │ -
void setNoRows(std::size_t rows)
Definition matrixredistribute.hh:183
│ │ │ │ -
void reserve(std::size_t size)
Definition matrixredistribute.hh:150
│ │ │ │ -
OwnerOverlapCopyCommunication< T, T1 > Comm
Definition matrixredistribute.hh:69
│ │ │ │ -
void setNoCopyRows(std::size_t rows)
Definition matrixredistribute.hh:188
│ │ │ │ -
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:141
│ │ │ │ - │ │ │ │ -
std::size_t getBackwardsCopyRowSize(std::size_t index) const
Definition matrixredistribute.hh:178
│ │ │ │ -
void redistribute(const D &from, D &to) const
Definition matrixredistribute.hh:118
│ │ │ │ - │ │ │ │ -
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:126
│ │ │ │ -
void checkInterface(const IS &source, const IS &target, MPI_Comm comm)
Definition matrixredistribute.hh:80
│ │ │ │ -
bool isSetup() const
Definition matrixredistribute.hh:145
│ │ │ │ -
std::size_t & getRowSize(std::size_t index)
Definition matrixredistribute.hh:153
│ │ │ │ -
Utility class to communicate and set the row sizes of a redistributed matrix.
Definition matrixredistribute.hh:216
│ │ │ │ -
M::size_type size_type
Definition matrixredistribute.hh:219
│ │ │ │ -
M::size_type value_type
Definition matrixredistribute.hh:218
│ │ │ │ -
RI & rowsize
Definition matrixredistribute.hh:230
│ │ │ │ -
const M & matrix
Definition matrixredistribute.hh:229
│ │ │ │ -
CommMatrixRowSize(const M &m_, RI &rowsize_)
Constructor.
Definition matrixredistribute.hh:226
│ │ │ │ -
Utility class to communicate and build the sparsity pattern of a redistributed matrix.
Definition matrixredistribute.hh:245
│ │ │ │ -
M::size_type size_type
Definition matrixredistribute.hh:246
│ │ │ │ -
const Dune::GlobalLookupIndexSet< I > & idxset
Definition matrixredistribute.hh:356
│ │ │ │ -
void storeSparsityPattern(M &m)
Creates and stores the sparsity pattern of the redistributed matrix.
Definition matrixredistribute.hh:276
│ │ │ │ -
const I & aggidxset
Definition matrixredistribute.hh:357
│ │ │ │ -
const std::vector< size_type > * rowsize
Definition matrixredistribute.hh:359
│ │ │ │ -
void completeSparsityPattern(std::vector< std::set< size_type > > add_sparsity)
Completes the sparsity pattern of the redistributed matrix with data from copy rows for the novlp cas...
Definition matrixredistribute.hh:340
│ │ │ │ -
CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_)
Constructor for the original side.
Definition matrixredistribute.hh:254
│ │ │ │ -
const M & matrix
Definition matrixredistribute.hh:354
│ │ │ │ -
CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_, const std::vector< typename M::size_type > &rowsize_)
Constructor for the redistruted side.
Definition matrixredistribute.hh:265
│ │ │ │ -
std::vector< std::set< size_type > > sparsity
Definition matrixredistribute.hh:358
│ │ │ │ -
Dune::GlobalLookupIndexSet< I > LookupIndexSet
Definition matrixredistribute.hh:355
│ │ │ │ -
static M::size_type getSize(const Type &t, std::size_t i)
Definition matrixredistribute.hh:376
│ │ │ │ -
CommMatrixSparsityPattern< M, I > Type
Definition matrixredistribute.hh:365
│ │ │ │ -
I::GlobalIndex IndexedType
The indexed type we send. This is the global index indentitfying the column.
Definition matrixredistribute.hh:371
│ │ │ │ -
VariableSize IndexedTypeFlag
Each row varies in size.
Definition matrixredistribute.hh:374
│ │ │ │ -
Utility class for comunicating the matrix entries.
Definition matrixredistribute.hh:396
│ │ │ │ -
std::vector< size_t > * rowsize
row size information for the receiving side.
Definition matrixredistribute.hh:452
│ │ │ │ -
M & matrix
The matrix to communicate the values of.
Definition matrixredistribute.hh:446
│ │ │ │ -
CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_, std::vector< size_t > &rowsize_)
Constructor.
Definition matrixredistribute.hh:412
│ │ │ │ -
const Dune::GlobalLookupIndexSet< I > & idxset
Index set for the original matrix.
Definition matrixredistribute.hh:448
│ │ │ │ -
void setOverlapRowsToDirichlet()
Sets the non-owner rows correctly as Dirichlet boundaries.
Definition matrixredistribute.hh:421
│ │ │ │ -
const I & aggidxset
Index set for the redistributed matrix.
Definition matrixredistribute.hh:450
│ │ │ │ -
CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_)
Constructor.
Definition matrixredistribute.hh:405
│ │ │ │ -
std::pair< typename I::GlobalIndex, typename M::block_type > IndexedType
The indexed type we send. This is the pair of global index indentitfying the column and the value its...
Definition matrixredistribute.hh:464
│ │ │ │ -
CommMatrixRow< M, I > Type
Definition matrixredistribute.hh:458
│ │ │ │ -
static std::size_t getSize(const Type &t, std::size_t i)
Definition matrixredistribute.hh:469
│ │ │ │ -
VariableSize IndexedTypeFlag
Each row varies in size.
Definition matrixredistribute.hh:467
│ │ │ │ -
Definition matrixredistribute.hh:483
│ │ │ │ -
static void scatter(Container &cont, const typename M::size_type &rowsize, std::size_t i)
Definition matrixredistribute.hh:490
│ │ │ │ -
static const M::size_type gather(const Container &cont, std::size_t i)
Definition matrixredistribute.hh:486
│ │ │ │ -
CommMatrixRowSize< M, RI > Container
Definition matrixredistribute.hh:484
│ │ │ │ -
Definition matrixredistribute.hh:500
│ │ │ │ -
static const M::size_type gather(const Container &cont, std::size_t i)
Definition matrixredistribute.hh:503
│ │ │ │ -
static void scatter(Container &cont, const typename M::size_type &rowsize, std::size_t i)
Definition matrixredistribute.hh:507
│ │ │ │ -
CommMatrixRowSize< M, RI > Container
Definition matrixredistribute.hh:501
│ │ │ │ -
Definition matrixredistribute.hh:518
│ │ │ │ -
M::ConstColIterator ColIter
Definition matrixredistribute.hh:521
│ │ │ │ -
static void scatter(Container &cont, const GlobalIndex &gi, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:553
│ │ │ │ -
CommMatrixSparsityPattern< M, I > Container
Definition matrixredistribute.hh:520
│ │ │ │ -
static GlobalIndex numlimits
Definition matrixredistribute.hh:524
│ │ │ │ -
static ColIter col
Definition matrixredistribute.hh:523
│ │ │ │ -
I::GlobalIndex GlobalIndex
Definition matrixredistribute.hh:519
│ │ │ │ -
static const GlobalIndex & gather(const Container &cont, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:526
│ │ │ │ -
Definition matrixredistribute.hh:599
│ │ │ │ -
I::GlobalIndex GlobalIndex
Definition matrixredistribute.hh:600
│ │ │ │ -
static Data datastore
Definition matrixredistribute.hh:605
│ │ │ │ -
static GlobalIndex numlimits
Definition matrixredistribute.hh:606
│ │ │ │ -
M::ConstColIterator ColIter
Definition matrixredistribute.hh:602
│ │ │ │ -
static const Data & gather(const Container &cont, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:608
│ │ │ │ -
std::pair< GlobalIndex, typename M::block_type > Data
Definition matrixredistribute.hh:603
│ │ │ │ -
static void scatter(Container &cont, const Data &data, std::size_t i, std::size_t j)
Definition matrixredistribute.hh:638
│ │ │ │ -
static ColIter col
Definition matrixredistribute.hh:604
│ │ │ │ -
CommMatrixRow< M, I > Container
Definition matrixredistribute.hh:601
│ │ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ -
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet
Definition owneroverlapcopy.hh:194
│ │ │ │ -
Definition pinfo.hh:28
│ │ │ │ -
Definition repartition.hh:260
│ │ │ │ -
@ 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
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1149
│ │ │ │ +
@ random
Build entries randomly.
Definition bcrsmatrix.hh:530
│ │ │ │ +
void addindex(size_type row, size_type col)
add index (row,col) to the matrix
Definition bcrsmatrix.hh:1191
│ │ │ │ +
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1248
│ │ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ +
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:861
│ │ │ │ +
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:911
│ │ │ │ +
A block-tridiagonal matrix.
Definition btdmatrix.hh:31
│ │ │ │ +
static constexpr auto blocklevel
increment block level counter
Definition btdmatrix.hh:53
│ │ │ │ +
BTDMatrix(size_type size)
Definition btdmatrix.hh:58
│ │ │ │ +
void solve(V &x, const V &rhs) const
Use the Thomas algorithm to solve the system Ax=b in O(n) time.
Definition btdmatrix.hh:125
│ │ │ │ +
A::size_type size_type
implement row_type with compressed vector
Definition btdmatrix.hh:49
│ │ │ │ +
A allocator_type
export the allocator type
Definition btdmatrix.hh:43
│ │ │ │ +
B block_type
export the type representing the components
Definition btdmatrix.hh:40
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition btdmatrix.hh:37
│ │ │ │ +
BTDMatrix & operator=(const BTDMatrix &other)
assignment
Definition btdmatrix.hh:108
│ │ │ │ +
BTDMatrix()
Default constructor.
Definition btdmatrix.hh:56
│ │ │ │ +
void setSize(size_type size)
Resize the matrix. Invalidates the content!
Definition btdmatrix.hh:81
│ │ │ │ +
typename FieldTraits< field_type >::real_type real_type
Definition btdmatrix.hh:208
│ │ │ │ +
typename BTDMatrix< B, A >::field_type field_type
Definition btdmatrix.hh:207
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1173 +1,288 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -matrixredistribute.hh │ │ │ │ │ +btdmatrix.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 (C) 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_MATRIXREDISTRIBUTE_HH │ │ │ │ │ -6#define DUNE_ISTL_MATRIXREDISTRIBUTE_HH │ │ │ │ │ -7#include │ │ │ │ │ -8#include "_r_e_p_a_r_t_i_t_i_o_n_._h_h" │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -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_/_p_i_n_f_o_._h_h> │ │ │ │ │ -18namespace _D_u_n_e │ │ │ │ │ -19{ │ │ │ │ │ -20 template │ │ │ │ │ -_2_1 struct _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -22 { │ │ │ │ │ -_2_3 bool _i_s_S_e_t_u_p() const │ │ │ │ │ -24 { │ │ │ │ │ -25 return false; │ │ │ │ │ -26 } │ │ │ │ │ -27 template │ │ │ │ │ -_2_8 void _r_e_d_i_s_t_r_i_b_u_t_e([[maybe_unused]] const D& from, [[maybe_unused]] D& to) │ │ │ │ │ -const │ │ │ │ │ -29 {} │ │ │ │ │ -30 │ │ │ │ │ -31 template │ │ │ │ │ -_3_2 void _r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d([[maybe_unused]] D& from, [[maybe_unused]]const D& │ │ │ │ │ -to) const │ │ │ │ │ -33 {} │ │ │ │ │ -34 │ │ │ │ │ -_3_5 void _r_e_s_e_t_S_e_t_u_p() │ │ │ │ │ -36 {} │ │ │ │ │ -37 │ │ │ │ │ -_3_8 void _s_e_t_N_o_R_o_w_s([[maybe_unused]] std::size_t size) │ │ │ │ │ -39 {} │ │ │ │ │ -40 │ │ │ │ │ -_4_1 void _s_e_t_N_o_C_o_p_y_R_o_w_s([[maybe_unused]] std::size_t size) │ │ │ │ │ -42 {} │ │ │ │ │ -43 │ │ │ │ │ -_4_4 void _s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s([[maybe_unused]] std::size_t size) │ │ │ │ │ -45 {} │ │ │ │ │ -46 │ │ │ │ │ -_4_7 std::size_t _g_e_t_R_o_w_S_i_z_e([[maybe_unused]] std::size_t index) const │ │ │ │ │ -48 { │ │ │ │ │ -49 return -1; │ │ │ │ │ -50 } │ │ │ │ │ -51 │ │ │ │ │ -_5_2 std::size_t _g_e_t_C_o_p_y_R_o_w_S_i_z_e([[maybe_unused]] std::size_t index) const │ │ │ │ │ -53 { │ │ │ │ │ -54 return -1; │ │ │ │ │ -55 } │ │ │ │ │ -56 │ │ │ │ │ -_5_7 std::size_t _g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e([[maybe_unused]] std::size_t index) │ │ │ │ │ -const │ │ │ │ │ -58 { │ │ │ │ │ -59 return -1; │ │ │ │ │ -60 } │ │ │ │ │ -61 │ │ │ │ │ -62 }; │ │ │ │ │ -63 │ │ │ │ │ -64#if HAVE_MPI │ │ │ │ │ -65 template │ │ │ │ │ -_6_6 class _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 > │ │ │ │ │ -67 { │ │ │ │ │ -68 public: │ │ │ │ │ -_6_9 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_,_T_1_> _C_o_m_m; │ │ │ │ │ -70 │ │ │ │ │ -_7_1 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() │ │ │ │ │ -72 : interface(), setup_(false) │ │ │ │ │ -73 {} │ │ │ │ │ -74 │ │ │ │ │ -_7_5 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& _g_e_t_I_n_t_e_r_f_a_c_e() │ │ │ │ │ -76 { │ │ │ │ │ -77 return interface; │ │ │ │ │ +5#ifndef DUNE_ISTL_BTDMATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_BTDMATRIX_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +13 │ │ │ │ │ +19namespace _D_u_n_e { │ │ │ │ │ +29 template > │ │ │ │ │ +_3_0 class _B_T_D_M_a_t_r_i_x : public _B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +31 { │ │ │ │ │ +32 public: │ │ │ │ │ +33 │ │ │ │ │ +34 //===== type definitions and constants │ │ │ │ │ +35 │ │ │ │ │ +_3_7 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ +38 │ │ │ │ │ +_4_0 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +41 │ │ │ │ │ +_4_3 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +44 │ │ │ │ │ +46 //typedef BCRSMatrix::row_type row_type; │ │ │ │ │ +47 │ │ │ │ │ +_4_9 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +50 │ │ │ │ │ +52 [[deprecated("Use free blockLevel function. Will be removed after 2.8.")]] │ │ │ │ │ +_5_3 static constexpr auto _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ +54 │ │ │ │ │ +_5_6 _B_T_D_M_a_t_r_i_x() : _B_C_R_S_M_a_t_r_i_x() {} │ │ │ │ │ +57 │ │ │ │ │ +_5_8 explicit _B_T_D_M_a_t_r_i_x(_s_i_z_e___t_y_p_e size) │ │ │ │ │ +59 : _B_C_R_S_M_a_t_r_i_x(size, size, _B_C_R_S_M_a_t_r_i_x::_r_a_n_d_o_m) │ │ │ │ │ +60 { │ │ │ │ │ +61 // Set number of entries for each row │ │ │ │ │ +62 // All rows get three entries, except for the first and the last one │ │ │ │ │ +63 for (size_t i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 3 - (i==0) - (i==(size-1))); │ │ │ │ │ +65 │ │ │ │ │ +66 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ +67 │ │ │ │ │ +68 // The actual entries for each row │ │ │ │ │ +69 for (size_t i=0; i0) │ │ │ │ │ +71 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i-1); │ │ │ │ │ +72 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i ); │ │ │ │ │ +73 if (i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i+1); │ │ │ │ │ +75 } │ │ │ │ │ +76 │ │ │ │ │ +77 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ 78 } │ │ │ │ │ -79 template │ │ │ │ │ -_8_0 void _c_h_e_c_k_I_n_t_e_r_f_a_c_e(const IS& source, │ │ │ │ │ -81 const IS& target, MPI_Comm comm) │ │ │ │ │ +79 │ │ │ │ │ +_8_1 void _s_e_t_S_i_z_e(size_type size) │ │ │ │ │ 82 { │ │ │ │ │ -83 auto ri = std::make_unique >(source, target, comm); │ │ │ │ │ -84 ri->template rebuild(); │ │ │ │ │ -85 Interface inf; │ │ │ │ │ -86 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t flags; │ │ │ │ │ -87 int rank; │ │ │ │ │ -88 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ -89 inf.free(); │ │ │ │ │ -90 inf.build(*ri, flags, flags); │ │ │ │ │ -91 │ │ │ │ │ +83 auto nonZeros = (size==0) ? 0 : size + 2*(size-1); │ │ │ │ │ +84 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_S_i_z_e(size, // rows │ │ │ │ │ +85 size, // columns │ │ │ │ │ +86 nonZeros); │ │ │ │ │ +87 │ │ │ │ │ +88 // Set number of entries for each row │ │ │ │ │ +89 // All rows get three entries, except for the first and the last one │ │ │ │ │ +90 for (size_t i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 3 - (i==0) - (i==(size-1))); │ │ │ │ │ 92 │ │ │ │ │ -93#ifdef DEBUG_REPART │ │ │ │ │ -94 if(inf!=interface) { │ │ │ │ │ -95 │ │ │ │ │ -96 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ -97 if(rank==0) │ │ │ │ │ -98 std::cout<<"Interfaces do not match!"<_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ +94 │ │ │ │ │ +95 // The actual entries for each row │ │ │ │ │ +96 for (size_t i=0; i0) │ │ │ │ │ +98 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i-1); │ │ │ │ │ +99 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i ); │ │ │ │ │ +100 if (i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i+1); │ │ │ │ │ +102 } │ │ │ │ │ +103 │ │ │ │ │ +104 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ 105 } │ │ │ │ │ -_1_0_6 void _s_e_t_S_e_t_u_p() │ │ │ │ │ -107 { │ │ │ │ │ -108 setup_=true; │ │ │ │ │ -109 interface.strip(); │ │ │ │ │ -110 } │ │ │ │ │ -111 │ │ │ │ │ -_1_1_2 void _r_e_s_e_t_S_e_t_u_p() │ │ │ │ │ -113 { │ │ │ │ │ -114 setup_=false; │ │ │ │ │ -115 } │ │ │ │ │ -116 │ │ │ │ │ -117 template │ │ │ │ │ -_1_1_8 void _r_e_d_i_s_t_r_i_b_u_t_e(const D& from, D& to) const │ │ │ │ │ -119 { │ │ │ │ │ -120 BufferedCommunicator communicator; │ │ │ │ │ -121 communicator.template build(from,to, interface); │ │ │ │ │ -122 communicator.template forward(from, to); │ │ │ │ │ -123 communicator.free(); │ │ │ │ │ -124 } │ │ │ │ │ -125 template │ │ │ │ │ -_1_2_6 void _r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(D& from, const D& to) const │ │ │ │ │ -127 { │ │ │ │ │ -128 │ │ │ │ │ -129 BufferedCommunicator communicator; │ │ │ │ │ -130 communicator.template build(from,to, interface); │ │ │ │ │ -131 communicator.template backward(from, to); │ │ │ │ │ -132 communicator.free(); │ │ │ │ │ +106 │ │ │ │ │ +_1_0_8 _B_T_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _B_T_D_M_a_t_r_i_x& other) { │ │ │ │ │ +109 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(other); │ │ │ │ │ +110 return *this; │ │ │ │ │ +111 } │ │ │ │ │ +112 │ │ │ │ │ +_1_1_4 _B_T_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) { │ │ │ │ │ +115 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(k); │ │ │ │ │ +116 return *this; │ │ │ │ │ +117 } │ │ │ │ │ +118 │ │ │ │ │ +124 template │ │ │ │ │ +_1_2_5 void _s_o_l_v_e (V& x, const V& rhs) const { │ │ │ │ │ +126 │ │ │ │ │ +127 // special handling for 1x1 matrices. The generic algorithm doesn't work │ │ │ │ │ +for them │ │ │ │ │ +128 if (this->_N()==1) { │ │ │ │ │ +129 auto&& x0 = Impl::asVector(x[0]); │ │ │ │ │ +130 auto&& rhs0 = Impl::asVector(rhs[0]); │ │ │ │ │ +131 Impl::asMatrix((*this)[0][0]).solve(x0, rhs0); │ │ │ │ │ +132 return; │ │ │ │ │ 133 } │ │ │ │ │ 134 │ │ │ │ │ -135 template │ │ │ │ │ -_1_3_6 void _r_e_d_i_s_t_r_i_b_u_t_e(const D& from, D& to) const │ │ │ │ │ -137 { │ │ │ │ │ -138 redistribute >(from,to); │ │ │ │ │ -139 } │ │ │ │ │ -140 template │ │ │ │ │ -_1_4_1 void _r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(D& from, const D& to) const │ │ │ │ │ -142 { │ │ │ │ │ -143 redistributeBackward >(from,to); │ │ │ │ │ -144 } │ │ │ │ │ -_1_4_5 bool _i_s_S_e_t_u_p() const │ │ │ │ │ -146 { │ │ │ │ │ -147 return setup_; │ │ │ │ │ -148 } │ │ │ │ │ +135 // Make copies of the rhs and the right matrix band │ │ │ │ │ +136 V d = rhs; │ │ │ │ │ +137 std::vector c(this->_N()-1); │ │ │ │ │ +138 for (size_t i=0; i_N()-1; i++) │ │ │ │ │ +139 c[i] = (*this)[i][i+1]; │ │ │ │ │ +140 │ │ │ │ │ +141 /* Modify the coefficients. */ │ │ │ │ │ +142 _b_l_o_c_k___t_y_p_e a_00_inv = (*this)[0][0]; │ │ │ │ │ +143 Impl::asMatrix(a_00_inv).invert(); │ │ │ │ │ +144 │ │ │ │ │ +145 //c[0] /= (*this)[0][0]; /* Division by zero risk. */ │ │ │ │ │ +146 _b_l_o_c_k___t_y_p_e tmp = a_00_inv; │ │ │ │ │ +147 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[0])); │ │ │ │ │ +148 c[0] = tmp; │ │ │ │ │ 149 │ │ │ │ │ -_1_5_0 void _r_e_s_e_r_v_e(std::size_t size) │ │ │ │ │ -151 {} │ │ │ │ │ -152 │ │ │ │ │ -_1_5_3 std::size_t& _g_e_t_R_o_w_S_i_z_e(std::size_t index) │ │ │ │ │ -154 { │ │ │ │ │ -155 return rowSize[index]; │ │ │ │ │ -156 } │ │ │ │ │ -157 │ │ │ │ │ -_1_5_8 std::size_t _g_e_t_R_o_w_S_i_z_e(std::size_t index) const │ │ │ │ │ -159 { │ │ │ │ │ -160 return rowSize[index]; │ │ │ │ │ -161 } │ │ │ │ │ -162 │ │ │ │ │ -_1_6_3 std::size_t& _g_e_t_C_o_p_y_R_o_w_S_i_z_e(std::size_t index) │ │ │ │ │ -164 { │ │ │ │ │ -165 return copyrowSize[index]; │ │ │ │ │ -166 } │ │ │ │ │ -167 │ │ │ │ │ -_1_6_8 std::size_t _g_e_t_C_o_p_y_R_o_w_S_i_z_e(std::size_t index) const │ │ │ │ │ -169 { │ │ │ │ │ -170 return copyrowSize[index]; │ │ │ │ │ -171 } │ │ │ │ │ -172 │ │ │ │ │ -_1_7_3 std::size_t& _g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e(std::size_t index) │ │ │ │ │ -174 { │ │ │ │ │ -175 return backwardscopyrowSize[index]; │ │ │ │ │ -176 } │ │ │ │ │ -177 │ │ │ │ │ -_1_7_8 std::size_t _g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e(std::size_t index) const │ │ │ │ │ -179 { │ │ │ │ │ -180 return backwardscopyrowSize[index]; │ │ │ │ │ -181 } │ │ │ │ │ -182 │ │ │ │ │ -_1_8_3 void _s_e_t_N_o_R_o_w_s(std::size_t rows) │ │ │ │ │ -184 { │ │ │ │ │ -185 rowSize.resize(rows, 0); │ │ │ │ │ +150 // d = a^{-1} d /* Division by zero would imply a singular matrix. */ │ │ │ │ │ +151 auto d_0_tmp = d[0]; │ │ │ │ │ +152 auto&& d_0 = Impl::asVector(d[0]); │ │ │ │ │ +153 Impl::asMatrix(a_00_inv).mv(Impl::asVector(d_0_tmp),d_0); │ │ │ │ │ +154 │ │ │ │ │ +155 for (unsigned int i = 1; i < this->_N(); i++) { │ │ │ │ │ +156 │ │ │ │ │ +157 // id = ( a_ii - c_{i-1} a_{i, i-1} ) ^{-1} │ │ │ │ │ +158 _b_l_o_c_k___t_y_p_e tmp; │ │ │ │ │ +159 tmp = (*this)[i][i-1]; │ │ │ │ │ +160 Impl::asMatrix(tmp).rightmultiply(Impl::asMatrix(c[i-1])); │ │ │ │ │ +161 │ │ │ │ │ +162 _b_l_o_c_k___t_y_p_e id = (*this)[i][i]; │ │ │ │ │ +163 id -= tmp; │ │ │ │ │ +164 Impl::asMatrix(id).invert(); /* Division by zero risk. */ │ │ │ │ │ +165 │ │ │ │ │ +166 if (i_N() - 1] = d[this->_N() - 1]; │ │ │ │ │ +179 for (int i = this->_N() - 2; i >= 0; i--) { │ │ │ │ │ +180 //x[i] = d[i] - c[i] * x[i + 1]; │ │ │ │ │ +181 x[i] = d[i]; │ │ │ │ │ +182 auto&& x_i = Impl::asVector(x[i]); │ │ │ │ │ +183 Impl::asMatrix(c[i]).mmv(Impl::asVector(x[i+1]), x_i); │ │ │ │ │ +184 } │ │ │ │ │ +185 │ │ │ │ │ 186 } │ │ │ │ │ 187 │ │ │ │ │ -_1_8_8 void _s_e_t_N_o_C_o_p_y_R_o_w_s(std::size_t rows) │ │ │ │ │ -189 { │ │ │ │ │ -190 copyrowSize.resize(rows, 0); │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -_1_9_3 void _s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s(std::size_t rows) │ │ │ │ │ -194 { │ │ │ │ │ -195 backwardscopyrowSize.resize(rows, 0); │ │ │ │ │ -196 } │ │ │ │ │ -197 │ │ │ │ │ -198 private: │ │ │ │ │ -199 std::vector rowSize; │ │ │ │ │ -200 std::vector copyrowSize; │ │ │ │ │ -201 std::vector backwardscopyrowSize; │ │ │ │ │ -202 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e interface; │ │ │ │ │ -203 bool setup_; │ │ │ │ │ -204 }; │ │ │ │ │ -205 │ │ │ │ │ -214 template │ │ │ │ │ -_2_1_5 struct _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e │ │ │ │ │ -216 { │ │ │ │ │ -217 // Make the default communication policy work. │ │ │ │ │ -_2_1_8 typedef typename M::size_type _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_2_1_9 typedef typename M::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -220 │ │ │ │ │ -_2_2_6 _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e(const M& m_, RI& rowsize_) │ │ │ │ │ -227 : _m_a_t_r_i_x(m_), _r_o_w_s_i_z_e(rowsize_) │ │ │ │ │ -228 {} │ │ │ │ │ -_2_2_9 const M& _m_a_t_r_i_x; │ │ │ │ │ -_2_3_0 RI& _r_o_w_s_i_z_e; │ │ │ │ │ -231 │ │ │ │ │ -232 }; │ │ │ │ │ -233 │ │ │ │ │ -234 │ │ │ │ │ -243 template │ │ │ │ │ -_2_4_4 struct _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ -245 { │ │ │ │ │ -_2_4_6 typedef typename M::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -247 │ │ │ │ │ -_2_5_4 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(const M& m_, const Dune::GlobalLookupIndexSet& │ │ │ │ │ -idxset_, const I& aggidxset_) │ │ │ │ │ -255 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _r_o_w_s_i_z_e() │ │ │ │ │ -256 {} │ │ │ │ │ -257 │ │ │ │ │ -_2_6_5 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(const M& m_, const Dune::GlobalLookupIndexSet& │ │ │ │ │ -idxset_, const I& aggidxset_, │ │ │ │ │ -266 const std::vector& rowsize_) │ │ │ │ │ -267 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _s_p_a_r_s_i_t_y │ │ │ │ │ -(aggidxset_.size()), _r_o_w_s_i_z_e(&rowsize_) │ │ │ │ │ -268 {} │ │ │ │ │ -269 │ │ │ │ │ -_2_7_6 void _s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(M& m) │ │ │ │ │ -277 { │ │ │ │ │ -278 // insert diagonal to overlap rows │ │ │ │ │ -279 typedef typename Dune::GlobalLookupIndexSet::const_iterator IIter; │ │ │ │ │ -280 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ -OwnerSet; │ │ │ │ │ -281 std::size_t nnz=0; │ │ │ │ │ -282#ifdef DEBUG_REPART │ │ │ │ │ -283 int rank; │ │ │ │ │ -284 │ │ │ │ │ -285 MPI_Comm_rank(MPI_COMM_WORLD, &rank); │ │ │ │ │ -286#endif │ │ │ │ │ -287 for(IIter i= _a_g_g_i_d_x_s_e_t.begin(), end=_a_g_g_i_d_x_s_e_t.end(); i!=end; ++i) { │ │ │ │ │ -288 if(!OwnerSet::contains(i->local().attribute())) { │ │ │ │ │ -289#ifdef DEBUG_REPART │ │ │ │ │ -290 std::cout<local()<local()].insert(i->local()); │ │ │ │ │ -293 } │ │ │ │ │ -294 │ │ │ │ │ -295 nnz+=_s_p_a_r_s_i_t_y[i->local()].size(); │ │ │ │ │ -296 } │ │ │ │ │ -297 assert( _a_g_g_i_d_x_s_e_t.size()==_s_p_a_r_s_i_t_y.size()); │ │ │ │ │ -298 │ │ │ │ │ -299 if(nnz>0) { │ │ │ │ │ -300 m.setSize(_a_g_g_i_d_x_s_e_t.size(), _a_g_g_i_d_x_s_e_t.size(), nnz); │ │ │ │ │ -301 m.setBuildMode(M::row_wise); │ │ │ │ │ -302 typename M::CreateIterator citer=m.createbegin(); │ │ │ │ │ -303#ifdef DEBUG_REPART │ │ │ │ │ -304 std::size_t idx=0; │ │ │ │ │ -305 bool correct=true; │ │ │ │ │ -306 Dune::GlobalLookupIndexSet global(_a_g_g_i_d_x_s_e_t); │ │ │ │ │ -307#endif │ │ │ │ │ -308 typedef typename std::vector >::const_iterator Iter; │ │ │ │ │ -309 for(Iter i=_s_p_a_r_s_i_t_y.begin(), end=_s_p_a_r_s_i_t_y.end(); i!=end; ++i, ++citer) │ │ │ │ │ -310 { │ │ │ │ │ -311 typedef typename std::set::const_iterator SIter; │ │ │ │ │ -312 for(SIter si=i->begin(), send=i->end(); si!=send; ++si) │ │ │ │ │ -313 citer.insert(*si); │ │ │ │ │ -314#ifdef DEBUG_REPART │ │ │ │ │ -315 if(i->find(idx)==i->end()) { │ │ │ │ │ -316 const typename I::IndexPair* gi=global.pair(idx); │ │ │ │ │ -317 assert(gi); │ │ │ │ │ -318 std::cout<local().attribute())<< │ │ │ │ │ -320 " row size="<size()< > │ │ │ │ │ -add_sparsity) │ │ │ │ │ -341 { │ │ │ │ │ -342 for (unsigned int i = 0; i != _s_p_a_r_s_i_t_y.size(); ++i) { │ │ │ │ │ -343 if (add_sparsity[i].size() != 0) { │ │ │ │ │ -344 typedef std::set Set; │ │ │ │ │ -345 Set tmp_set; │ │ │ │ │ -346 std::insert_iterator tmp_insert (tmp_set, tmp_set.begin()); │ │ │ │ │ -347 std::set_union(add_sparsity[i].begin(), add_sparsity[i].end(), │ │ │ │ │ -348 _s_p_a_r_s_i_t_y[i].begin(), _s_p_a_r_s_i_t_y[i].end(), tmp_insert); │ │ │ │ │ -349 _s_p_a_r_s_i_t_y[i].swap(tmp_set); │ │ │ │ │ -350 } │ │ │ │ │ -351 } │ │ │ │ │ -352 } │ │ │ │ │ -353 │ │ │ │ │ -_3_5_4 const M& _m_a_t_r_i_x; │ │ │ │ │ -_3_5_5 typedef Dune::GlobalLookupIndexSet _L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ │ -_3_5_6 const Dune::GlobalLookupIndexSet& _i_d_x_s_e_t; │ │ │ │ │ -_3_5_7 const I& _a_g_g_i_d_x_s_e_t; │ │ │ │ │ -_3_5_8 std::vector > _s_p_a_r_s_i_t_y; │ │ │ │ │ -_3_5_9 const std::vector* _r_o_w_s_i_z_e; │ │ │ │ │ -360 }; │ │ │ │ │ -361 │ │ │ │ │ -362 template │ │ │ │ │ -_3_6_3 struct CommPolicy<_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n > │ │ │ │ │ -364 { │ │ │ │ │ -_3_6_5 typedef _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_> _T_y_p_e; │ │ │ │ │ -366 │ │ │ │ │ -_3_7_1 typedef typename I::GlobalIndex _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -372 │ │ │ │ │ -_3_7_4 typedef VariableSize _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ -375 │ │ │ │ │ -_3_7_6 static typename M::size_type _g_e_t_S_i_z_e(const _T_y_p_e& t, std::size_t i) │ │ │ │ │ -377 { │ │ │ │ │ -378 if(!t._r_o_w_s_i_z_e) │ │ │ │ │ -379 return t._m_a_t_r_i_x[i].size(); │ │ │ │ │ -380 else │ │ │ │ │ -381 { │ │ │ │ │ -382 assert((*t._r_o_w_s_i_z_e)[i]>0); │ │ │ │ │ -383 return (*t._r_o_w_s_i_z_e)[i]; │ │ │ │ │ -384 } │ │ │ │ │ -385 } │ │ │ │ │ -386 }; │ │ │ │ │ -387 │ │ │ │ │ -394 template │ │ │ │ │ -_3_9_5 struct _C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ -396 { │ │ │ │ │ -_4_0_5 _C_o_m_m_M_a_t_r_i_x_R_o_w(M& m_, const Dune::GlobalLookupIndexSet& idxset_, const I& │ │ │ │ │ -aggidxset_) │ │ │ │ │ -406 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _r_o_w_s_i_z_e() │ │ │ │ │ -407 {} │ │ │ │ │ -408 │ │ │ │ │ -_4_1_2 _C_o_m_m_M_a_t_r_i_x_R_o_w(M& m_, const Dune::GlobalLookupIndexSet& idxset_, const I& │ │ │ │ │ -aggidxset_, │ │ │ │ │ -413 std::vector& rowsize_) │ │ │ │ │ -414 : _m_a_t_r_i_x(m_), _i_d_x_s_e_t(idxset_), _a_g_g_i_d_x_s_e_t(aggidxset_), _r_o_w_s_i_z_e(&rowsize_) │ │ │ │ │ -415 {} │ │ │ │ │ -_4_2_1 void _s_e_t_O_v_e_r_l_a_p_R_o_w_s_T_o_D_i_r_i_c_h_l_e_t() │ │ │ │ │ -422 { │ │ │ │ │ -423 typedef typename Dune::GlobalLookupIndexSet::const_iterator Iter; │ │ │ │ │ -424 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ -OwnerSet; │ │ │ │ │ -425 │ │ │ │ │ -426 for(Iter i= _a_g_g_i_d_x_s_e_t.begin(), end=_a_g_g_i_d_x_s_e_t.end(); i!=end; ++i) │ │ │ │ │ -427 if(!OwnerSet::contains(i->local().attribute())) { │ │ │ │ │ -428 // Set to Dirchlet │ │ │ │ │ -429 typedef typename M::ColIterator CIter; │ │ │ │ │ -430 for(CIter c=_m_a_t_r_i_x[i->local()].begin(), cend= _m_a_t_r_i_x[i->local()].end(); │ │ │ │ │ -431 c!= cend; ++c) │ │ │ │ │ -432 { │ │ │ │ │ -433 *c=0; │ │ │ │ │ -434 if(c.index()==i->local()) { │ │ │ │ │ -435 auto setDiagonal = [](auto&& scalarOrMatrix, const auto& value) { │ │ │ │ │ -436 auto&& matrixView = Dune::Impl::asMatrix(scalarOrMatrix); │ │ │ │ │ -437 for (auto rowIt = matrixView.begin(); rowIt != matrixView.end(); ++rowIt) │ │ │ │ │ -438 (*rowIt)[rowIt.index()] = value; │ │ │ │ │ -439 }; │ │ │ │ │ -440 setDiagonal(*c, 1); │ │ │ │ │ -441 } │ │ │ │ │ -442 } │ │ │ │ │ -443 } │ │ │ │ │ -444 } │ │ │ │ │ -_4_4_6 M& _m_a_t_r_i_x; │ │ │ │ │ -_4_4_8 const Dune::GlobalLookupIndexSet& _i_d_x_s_e_t; │ │ │ │ │ -_4_5_0 const I& _a_g_g_i_d_x_s_e_t; │ │ │ │ │ -_4_5_2 std::vector* _r_o_w_s_i_z_e; // row sizes differ from sender side in │ │ │ │ │ -overlap! │ │ │ │ │ -453 }; │ │ │ │ │ -454 │ │ │ │ │ -455 template │ │ │ │ │ -_4_5_6 struct CommPolicy<_C_o_m_m_M_a_t_r_i_x_R_o_w > │ │ │ │ │ -457 { │ │ │ │ │ -_4_5_8 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_> _T_y_p_e; │ │ │ │ │ -459 │ │ │ │ │ -_4_6_4 typedef std::pair │ │ │ │ │ -_I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -465 │ │ │ │ │ -_4_6_7 typedef VariableSize _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ -468 │ │ │ │ │ -_4_6_9 static std::size_t _g_e_t_S_i_z_e(const _T_y_p_e& t, std::size_t i) │ │ │ │ │ -470 { │ │ │ │ │ -471 if(!t._r_o_w_s_i_z_e) │ │ │ │ │ -472 return t._m_a_t_r_i_x[i].size(); │ │ │ │ │ -473 else │ │ │ │ │ -474 { │ │ │ │ │ -475 assert((*t._r_o_w_s_i_z_e)[i]>0); │ │ │ │ │ -476 return (*t._r_o_w_s_i_z_e)[i]; │ │ │ │ │ -477 } │ │ │ │ │ -478 } │ │ │ │ │ -479 }; │ │ │ │ │ -480 │ │ │ │ │ -481 template │ │ │ │ │ -_4_8_2 struct _M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -483 { │ │ │ │ │ -_4_8_4 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ -485 │ │ │ │ │ -_4_8_6 static const typename M::size_type _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std:: │ │ │ │ │ -size_t i) │ │ │ │ │ -487 { │ │ │ │ │ -488 return cont._m_a_t_r_i_x[i].size(); │ │ │ │ │ -489 } │ │ │ │ │ -_4_9_0 static void _s_c_a_t_t_e_r(_C_o_n_t_a_i_n_e_r& cont, const typename M::size_type& rowsize, │ │ │ │ │ -std::size_t i) │ │ │ │ │ -491 { │ │ │ │ │ -492 assert(rowsize); │ │ │ │ │ -493 cont._r_o_w_s_i_z_e.getRowSize(i)=rowsize; │ │ │ │ │ -494 } │ │ │ │ │ -495 │ │ │ │ │ -496 }; │ │ │ │ │ -497 │ │ │ │ │ -498 template │ │ │ │ │ -_4_9_9 struct _M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -500 { │ │ │ │ │ -_5_0_1 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ -502 │ │ │ │ │ -_5_0_3 static const typename M::size_type _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std:: │ │ │ │ │ -size_t i) │ │ │ │ │ -504 { │ │ │ │ │ -505 return cont._m_a_t_r_i_x[i].size(); │ │ │ │ │ -506 } │ │ │ │ │ -_5_0_7 static void _s_c_a_t_t_e_r(_C_o_n_t_a_i_n_e_r& cont, const typename M::size_type& rowsize, │ │ │ │ │ -std::size_t i) │ │ │ │ │ -508 { │ │ │ │ │ -509 assert(rowsize); │ │ │ │ │ -510 if (rowsize > cont._r_o_w_s_i_z_e.getCopyRowSize(i)) │ │ │ │ │ -511 cont._r_o_w_s_i_z_e.getCopyRowSize(i)=rowsize; │ │ │ │ │ -512 } │ │ │ │ │ -513 │ │ │ │ │ -514 }; │ │ │ │ │ -515 │ │ │ │ │ -516 template │ │ │ │ │ -_5_1_7 struct _M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -518 { │ │ │ │ │ -_5_1_9 typedef typename I::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -_5_2_0 typedef _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ -_5_2_1 typedef typename M::ConstColIterator _C_o_l_I_t_e_r; │ │ │ │ │ -522 │ │ │ │ │ -_5_2_3 static _C_o_l_I_t_e_r _c_o_l; │ │ │ │ │ -_5_2_4 static _G_l_o_b_a_l_I_n_d_e_x _n_u_m_l_i_m_i_t_s; │ │ │ │ │ -525 │ │ │ │ │ -_5_2_6 static const _G_l_o_b_a_l_I_n_d_e_x& _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std::size_t i, │ │ │ │ │ -std::size_t j) │ │ │ │ │ -527 { │ │ │ │ │ -528 if(j==0) │ │ │ │ │ -529 _c_o_l=cont._m_a_t_r_i_x[i].begin(); │ │ │ │ │ -530 else if (_c_o_l!=cont._m_a_t_r_i_x[i].end()) │ │ │ │ │ -531 ++_c_o_l; │ │ │ │ │ -532 │ │ │ │ │ -533 //copy communication: different row sizes for copy rows with the same │ │ │ │ │ -global index │ │ │ │ │ -534 //are possible. If all values of current matrix row are sent, send │ │ │ │ │ -535 //std::numeric_limits::max() │ │ │ │ │ -536 //and receiver will ignore it. │ │ │ │ │ -537 if (_c_o_l==cont._m_a_t_r_i_x[i].end()) { │ │ │ │ │ -538 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ -539 return _n_u_m_l_i_m_i_t_s; │ │ │ │ │ -540 } │ │ │ │ │ -541 else { │ │ │ │ │ -542 const typename I::IndexPair* index=cont._i_d_x_s_e_t.pair(_c_o_l.index()); │ │ │ │ │ -543 assert(index); │ │ │ │ │ -544 // Only send index if col is no ghost │ │ │ │ │ -545 if ( index->local().attribute() != 2) │ │ │ │ │ -546 return index->global(); │ │ │ │ │ -547 else { │ │ │ │ │ -548 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ -549 return _n_u_m_l_i_m_i_t_s; │ │ │ │ │ -550 } │ │ │ │ │ -551 } │ │ │ │ │ -552 } │ │ │ │ │ -_5_5_3 static void _s_c_a_t_t_e_r(_C_o_n_t_a_i_n_e_r& cont, const _G_l_o_b_a_l_I_n_d_e_x& gi, std::size_t i, │ │ │ │ │ -[[maybe_unused]] std::size_t j) │ │ │ │ │ -554 { │ │ │ │ │ -555 try{ │ │ │ │ │ -556 if (gi != std::numeric_limits::max()) { │ │ │ │ │ -557 const typename I::IndexPair& ip=cont._a_g_g_i_d_x_s_e_t.at(gi); │ │ │ │ │ -558 assert(ip.global()==gi); │ │ │ │ │ -559 std::size_t column = ip.local(); │ │ │ │ │ -560 cont._s_p_a_r_s_i_t_y[i].insert(column); │ │ │ │ │ -561 │ │ │ │ │ -562 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ -OwnerSet; │ │ │ │ │ -563 if(!OwnerSet::contains(ip.local().attribute())) │ │ │ │ │ -564 // preserve symmetry for overlap │ │ │ │ │ -565 cont._s_p_a_r_s_i_t_y[column].insert(i); │ │ │ │ │ -566 } │ │ │ │ │ -567 } │ │ │ │ │ -568 catch(const Dune::RangeError&) { │ │ │ │ │ -569 // Entry not present in the new index set. Ignore! │ │ │ │ │ -570#ifdef DEBUG_REPART │ │ │ │ │ -571 typedef typename _C_o_n_t_a_i_n_e_r_:_:_L_o_o_k_u_p_I_n_d_e_x_S_e_t GlobalLookup; │ │ │ │ │ -572 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ │ -573 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_<_i_n_t_>_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ -OwnerSet; │ │ │ │ │ -574 │ │ │ │ │ -575 GlobalLookup lookup(cont._a_g_g_i_d_x_s_e_t); │ │ │ │ │ -576 const IndexPair* pi=lookup.pair(i); │ │ │ │ │ -577 assert(pi); │ │ │ │ │ -578 if(OwnerSet::contains(pi->local().attribute())) { │ │ │ │ │ -579 int rank; │ │ │ │ │ -580 MPI_Comm_rank(MPI_COMM_WORLD,&rank); │ │ │ │ │ -581 std::cout<global()< │ │ │ │ │ -591 typename _M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_C_o_l_I_t_e_r │ │ │ │ │ -_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_c_o_l; │ │ │ │ │ -592 │ │ │ │ │ -593 template │ │ │ │ │ -594 typename _M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_n_u_m_l_i_m_i_t_s; │ │ │ │ │ -595 │ │ │ │ │ -596 │ │ │ │ │ -597 template │ │ │ │ │ -_5_9_8 struct _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -599 { │ │ │ │ │ -_6_0_0 typedef typename I::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -_6_0_1 typedef _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_> _C_o_n_t_a_i_n_e_r; │ │ │ │ │ -_6_0_2 typedef typename M::ConstColIterator _C_o_l_I_t_e_r; │ │ │ │ │ -_6_0_3 typedef typename std::pair _D_a_t_a; │ │ │ │ │ -_6_0_4 static _C_o_l_I_t_e_r _c_o_l; │ │ │ │ │ -_6_0_5 static _D_a_t_a _d_a_t_a_s_t_o_r_e; │ │ │ │ │ -_6_0_6 static _G_l_o_b_a_l_I_n_d_e_x _n_u_m_l_i_m_i_t_s; │ │ │ │ │ -607 │ │ │ │ │ -_6_0_8 static const _D_a_t_a& _g_a_t_h_e_r(const _C_o_n_t_a_i_n_e_r& cont, std::size_t i, std::size_t │ │ │ │ │ -j) │ │ │ │ │ -609 { │ │ │ │ │ -610 if(j==0) │ │ │ │ │ -611 _c_o_l=cont._m_a_t_r_i_x[i].begin(); │ │ │ │ │ -612 else if (_c_o_l!=cont._m_a_t_r_i_x[i].end()) │ │ │ │ │ -613 ++_c_o_l; │ │ │ │ │ -614 // copy communication: different row sizes for copy rows with the same │ │ │ │ │ -global index │ │ │ │ │ -615 // are possible. If all values of current matrix row are sent, send │ │ │ │ │ -616 // std::numeric_limits::max() │ │ │ │ │ -617 // and receiver will ignore it. │ │ │ │ │ -618 if (_c_o_l==cont._m_a_t_r_i_x[i].end()) { │ │ │ │ │ -619 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ -620 _d_a_t_a_s_t_o_r_e = _D_a_t_a(_n_u_m_l_i_m_i_t_s,*_c_o_l); │ │ │ │ │ -621 return _d_a_t_a_s_t_o_r_e; │ │ │ │ │ -622 } │ │ │ │ │ -623 else { │ │ │ │ │ -624 // convert local column index to global index │ │ │ │ │ -625 const typename I::IndexPair* index=cont._i_d_x_s_e_t.pair(_c_o_l.index()); │ │ │ │ │ -626 assert(index); │ │ │ │ │ -627 // Store the data to prevent reference to temporary │ │ │ │ │ -628 // Only send index if col is no ghost │ │ │ │ │ -629 if ( index->local().attribute() != 2) │ │ │ │ │ -630 _d_a_t_a_s_t_o_r_e = _D_a_t_a(index->global(),*_c_o_l); │ │ │ │ │ -631 else { │ │ │ │ │ -632 _n_u_m_l_i_m_i_t_s = std::numeric_limits::max(); │ │ │ │ │ -633 _d_a_t_a_s_t_o_r_e = _D_a_t_a(_n_u_m_l_i_m_i_t_s,*_c_o_l); │ │ │ │ │ -634 } │ │ │ │ │ -635 return _d_a_t_a_s_t_o_r_e; │ │ │ │ │ -636 } │ │ │ │ │ -637 } │ │ │ │ │ -_6_3_8 static void _s_c_a_t_t_e_r(_C_o_n_t_a_i_n_e_r& cont, const _D_a_t_a& data, std::size_t i, [ │ │ │ │ │ -[maybe_unused]] std::size_t j) │ │ │ │ │ -639 { │ │ │ │ │ -640 try{ │ │ │ │ │ -641 if (data.first != std::numeric_limits::max()) { │ │ │ │ │ -642 typename M::size_type column=cont._a_g_g_i_d_x_s_e_t.at(data.first).local(); │ │ │ │ │ -643 cont._m_a_t_r_i_x[i][column]=data.second; │ │ │ │ │ -644 } │ │ │ │ │ -645 } │ │ │ │ │ -646 catch(const Dune::RangeError&) { │ │ │ │ │ -647 // This an overlap row and might therefore lack some entries! │ │ │ │ │ -648 } │ │ │ │ │ -649 │ │ │ │ │ -650 } │ │ │ │ │ -651 }; │ │ │ │ │ -652 │ │ │ │ │ -653 template │ │ │ │ │ -654 typename _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_C_o_l_I_t_e_r _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_: │ │ │ │ │ -_c_o_l; │ │ │ │ │ -655 │ │ │ │ │ -656 template │ │ │ │ │ -657 typename _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_D_a_t_a _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_: │ │ │ │ │ -_d_a_t_a_s_t_o_r_e; │ │ │ │ │ -658 │ │ │ │ │ -659 template │ │ │ │ │ -660 typename _M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_<_M_,_I_>_:_:_n_u_m_l_i_m_i_t_s; │ │ │ │ │ -661 │ │ │ │ │ -662 template │ │ │ │ │ -_6_6_3 void _r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(M& origMatrix, M& newMatrix, C& origComm, │ │ │ │ │ -C& newComm, │ │ │ │ │ -664 _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) │ │ │ │ │ -665 { │ │ │ │ │ -666 typename C::CopySet copyflags; │ │ │ │ │ -667 typename C::OwnerSet ownerflags; │ │ │ │ │ -668 typedef typename C::ParallelIndexSet IndexSet; │ │ │ │ │ -669 typedef _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; │ │ │ │ │ -670 std::vector rowsize(newComm.indexSet().size(), 0); │ │ │ │ │ -671 std::vector copyrowsize(newComm.indexSet().size(), │ │ │ │ │ -0); │ │ │ │ │ -672 std::vector backwardscopyrowsize(origComm.indexSet │ │ │ │ │ -().size(), 0); │ │ │ │ │ -673 │ │ │ │ │ -674 // get owner rowsizes │ │ │ │ │ -675 _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> commRowSize(origMatrix, ri); │ │ │ │ │ -676 ri.template redistribute > │ │ │ │ │ -(commRowSize,commRowSize); │ │ │ │ │ -677 │ │ │ │ │ -678 origComm.buildGlobalLookup(); │ │ │ │ │ -679 │ │ │ │ │ -680 for (std::size_t i=0; i < newComm.indexSet().size(); i++) { │ │ │ │ │ -681 rowsize[i] = ri._g_e_t_R_o_w_S_i_z_e(i); │ │ │ │ │ -682 } │ │ │ │ │ -683 // get sparsity pattern from owner rows │ │ │ │ │ -684 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ -685 origsp(origMatrix, origComm.globalLookup(), newComm.indexSet()); │ │ │ │ │ -686 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ -687 newsp(origMatrix, origComm.globalLookup(), newComm.indexSet(), rowsize); │ │ │ │ │ -688 │ │ │ │ │ -689 ri.template redistribute > │ │ │ │ │ -(origsp,newsp); │ │ │ │ │ -690 │ │ │ │ │ -691 // build copy to owner interface to get missing matrix values for novlp │ │ │ │ │ -case │ │ │ │ │ -692 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) == _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) { │ │ │ │ │ -693 RemoteIndices *ris = new RemoteIndices │ │ │ │ │ -(origComm.indexSet(), │ │ │ │ │ -694 newComm.indexSet(), │ │ │ │ │ -695 origComm.communicator()); │ │ │ │ │ -696 ris->template rebuild(); │ │ │ │ │ -697 │ │ │ │ │ -698 ri.getInterface().free(); │ │ │ │ │ -699 ri.getInterface().build(*ris,copyflags,ownerflags); │ │ │ │ │ -700 │ │ │ │ │ -701 // get copy rowsizes │ │ │ │ │ -702 _C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_<_M_,_R_I_> commRowSize_copy(origMatrix, ri); │ │ │ │ │ -703 ri.template redistribute > │ │ │ │ │ -(commRowSize_copy, │ │ │ │ │ -704 commRowSize_copy); │ │ │ │ │ -705 │ │ │ │ │ -706 for (std::size_t i=0; i < newComm.indexSet().size(); i++) { │ │ │ │ │ -707 copyrowsize[i] = ri._g_e_t_C_o_p_y_R_o_w_S_i_z_e(i); │ │ │ │ │ -708 } │ │ │ │ │ -709 //get copy rowsizes for sender │ │ │ │ │ -710 ri._r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(backwardscopyrowsize,copyrowsize); │ │ │ │ │ -711 for (std::size_t i=0; i < origComm.indexSet().size(); i++) { │ │ │ │ │ -712 ri._g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e(i) = backwardscopyrowsize[i]; │ │ │ │ │ -713 } │ │ │ │ │ -714 │ │ │ │ │ -715 // get sparsity pattern from copy rows │ │ │ │ │ -716 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> origsp_copy(origMatrix, │ │ │ │ │ -717 origComm.globalLookup(), │ │ │ │ │ -718 newComm.indexSet(), │ │ │ │ │ -719 backwardscopyrowsize); │ │ │ │ │ -720 _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_M_,_I_n_d_e_x_S_e_t_> newsp_copy(origMatrix, │ │ │ │ │ -origComm.globalLookup(), │ │ │ │ │ -721 newComm.indexSet(), copyrowsize); │ │ │ │ │ -722 ri.template redistribute > │ │ │ │ │ -(origsp_copy, │ │ │ │ │ -723 newsp_copy); │ │ │ │ │ -724 │ │ │ │ │ -725 newsp._c_o_m_p_l_e_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(newsp_copy._s_p_a_r_s_i_t_y); │ │ │ │ │ -726 newsp._s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(newMatrix); │ │ │ │ │ -727 } │ │ │ │ │ -728 else │ │ │ │ │ -729 newsp._s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(newMatrix); │ │ │ │ │ -730 │ │ │ │ │ -731#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -732 // Check for symmetry │ │ │ │ │ -733 int ret=0; │ │ │ │ │ -734 typedef typename M::ConstRowIterator RIter; │ │ │ │ │ -735 for(RIter row=newMatrix.begin(), rend=newMatrix.end(); row != rend; ++row) │ │ │ │ │ -{ │ │ │ │ │ -736 typedef typename M::ConstColIterator CIter; │ │ │ │ │ -737 for(CIter _c_o_l=row->begin(), cend=row->end(); _c_o_l!=cend; ++_c_o_l) │ │ │ │ │ -738 { │ │ │ │ │ -739 try{ │ │ │ │ │ -740 newMatrix[_c_o_l.index()][row.index()]; │ │ │ │ │ -741 }catch(const _D_u_n_e_:_:_I_S_T_L_E_r_r_o_r&) { │ │ │ │ │ -742 std::cerr< │ │ │ │ │ -_7_5_7 void _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(M& origMatrix, M& newMatrix, C& origComm, C& │ │ │ │ │ -newComm, │ │ │ │ │ -758 _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) │ │ │ │ │ -759 { │ │ │ │ │ -760 typedef typename C::ParallelIndexSet IndexSet; │ │ │ │ │ -761 typename C::OwnerSet ownerflags; │ │ │ │ │ -762 std::vector rowsize(newComm.indexSet().size(), 0); │ │ │ │ │ -763 std::vector copyrowsize(newComm.indexSet().size(), │ │ │ │ │ -0); │ │ │ │ │ -764 std::vector backwardscopyrowsize(origComm.indexSet │ │ │ │ │ -().size(), 0); │ │ │ │ │ -765 │ │ │ │ │ -766 for (std::size_t i=0; i < newComm.indexSet().size(); i++) { │ │ │ │ │ -767 rowsize[i] = ri._g_e_t_R_o_w_S_i_z_e(i); │ │ │ │ │ -768 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) == _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) { │ │ │ │ │ -769 copyrowsize[i] = ri._g_e_t_C_o_p_y_R_o_w_S_i_z_e(i); │ │ │ │ │ -770 } │ │ │ │ │ -771 } │ │ │ │ │ -772 │ │ │ │ │ -773 for (std::size_t i=0; i < origComm.indexSet().size(); i++) │ │ │ │ │ -774 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) == _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) │ │ │ │ │ -775 backwardscopyrowsize[i] = ri._g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e(i); │ │ │ │ │ -776 │ │ │ │ │ -777 │ │ │ │ │ -778 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) == _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) { │ │ │ │ │ -779 // fill sparsity pattern from copy rows │ │ │ │ │ -780 _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_n_d_e_x_S_e_t_> origrow_copy(origMatrix, origComm.globalLookup(), │ │ │ │ │ -781 newComm.indexSet(), backwardscopyrowsize); │ │ │ │ │ -782 _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_n_d_e_x_S_e_t_> newrow_copy(newMatrix, origComm.globalLookup(), │ │ │ │ │ -783 newComm.indexSet(),copyrowsize); │ │ │ │ │ -784 ri.template redistribute >(origrow_copy, │ │ │ │ │ -785 newrow_copy); │ │ │ │ │ -786 ri.getInterface().free(); │ │ │ │ │ -787 RemoteIndices *ris = new RemoteIndices │ │ │ │ │ -(origComm.indexSet(), │ │ │ │ │ -788 newComm.indexSet(), │ │ │ │ │ -789 origComm.communicator()); │ │ │ │ │ -790 ris->template rebuild(); │ │ │ │ │ -791 ri.getInterface().build(*ris,ownerflags,ownerflags); │ │ │ │ │ -792 } │ │ │ │ │ -793 │ │ │ │ │ -794 _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ -795 origrow(origMatrix, origComm.globalLookup(), newComm.indexSet()); │ │ │ │ │ -796 _C_o_m_m_M_a_t_r_i_x_R_o_w_<_M_,_I_n_d_e_x_S_e_t_> │ │ │ │ │ -797 newrow(newMatrix, origComm.globalLookup(), newComm.indexSet(),rowsize); │ │ │ │ │ -798 ri.template redistribute > │ │ │ │ │ -(origrow,newrow); │ │ │ │ │ -799 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(origComm) != 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)) │ │ │ │ │ -800 newrow._s_e_t_O_v_e_r_l_a_p_R_o_w_s_T_o_D_i_r_i_c_h_l_e_t(); │ │ │ │ │ -801 } │ │ │ │ │ -802 │ │ │ │ │ -819 template │ │ │ │ │ -_8_2_0 void _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(M& origMatrix, M& newMatrix, C& origComm, C& │ │ │ │ │ -newComm, │ │ │ │ │ -821 _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) │ │ │ │ │ -822 { │ │ │ │ │ -823 ri._s_e_t_N_o_R_o_w_s(newComm.indexSet().size()); │ │ │ │ │ -824 ri._s_e_t_N_o_C_o_p_y_R_o_w_s(newComm.indexSet().size()); │ │ │ │ │ -825 ri._s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s(origComm.indexSet().size()); │ │ │ │ │ -826 _r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n(origMatrix, newMatrix, origComm, newComm, ri); │ │ │ │ │ -827 _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(origMatrix, newMatrix, origComm, newComm, ri); │ │ │ │ │ -828 } │ │ │ │ │ -829#endif │ │ │ │ │ -830 │ │ │ │ │ -831template │ │ │ │ │ -_8_3_2 void _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(M& origMatrix, M& newMatrix, │ │ │ │ │ -833 _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& origComm, │ │ │ │ │ -834 _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& newComm, │ │ │ │ │ -835 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_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_>& ri) │ │ │ │ │ -836 { │ │ │ │ │ -837 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential │ │ │ │ │ -program!"); │ │ │ │ │ -838 } │ │ │ │ │ -839 template │ │ │ │ │ -_8_4_0 void _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(M& origMatrix, M& newMatrix, │ │ │ │ │ -841 _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& origComm, │ │ │ │ │ -842 _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& newComm, │ │ │ │ │ -843 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_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_>& ri) │ │ │ │ │ -844 { │ │ │ │ │ -845 DUNE_THROW(InvalidStateException, "Trying to redistribute in sequential │ │ │ │ │ -program!"); │ │ │ │ │ -846 } │ │ │ │ │ -847} │ │ │ │ │ -848#endif │ │ │ │ │ -_r_e_p_a_r_t_i_t_i_o_n_._h_h │ │ │ │ │ -Functionality for redistributing a parallel index set using graph partitioning. │ │ │ │ │ -_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 │ │ │ │ │ +188 private: │ │ │ │ │ +189 │ │ │ │ │ +190 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ +//// │ │ │ │ │ +191 // The following methods from the base class should now actually be called │ │ │ │ │ +192 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ +//// │ │ │ │ │ +193 │ │ │ │ │ +194 // createbegin and createend should be in there, too, but I can't get it to │ │ │ │ │ +compile │ │ │ │ │ +195 // BCRSMatrix::CreateIterator createbegin () {} │ │ │ │ │ +196 // BCRSMatrix::CreateIterator createend () {} │ │ │ │ │ +197 void setrowsize (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s) {} │ │ │ │ │ +198 void incrementrowsize (_s_i_z_e___t_y_p_e i) {} │ │ │ │ │ +199 void endrowsizes () {} │ │ │ │ │ +200 void addindex (_s_i_z_e___t_y_p_e row, _s_i_z_e___t_y_p_e _c_o_l) {} │ │ │ │ │ +201 void endindices () {} │ │ │ │ │ +202 }; │ │ │ │ │ +203 │ │ │ │ │ +204 template │ │ │ │ │ +_2_0_5 struct FieldTraits< _B_T_D_M_a_t_r_i_x > │ │ │ │ │ +206 { │ │ │ │ │ +_2_0_7 using _f_i_e_l_d___t_y_p_e = typename _B_T_D_M_a_t_r_i_x_<_B_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_0_8 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ +209 }; │ │ │ │ │ +210 │ │ │ │ │ +213} // end namespace Dune │ │ │ │ │ +214 │ │ │ │ │ +215#endif │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ _c_o_l │ │ │ │ │ Col col │ │ │ │ │ DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_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_:_:_r_e_d_i_s_t_r_i_b_u_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ -void redistributeSparsityPattern(M &origMatrix, M &newMatrix, C &origComm, C │ │ │ │ │ -&newComm, RedistributeInformation< C > &ri) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:663 │ │ │ │ │ -_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_:_:_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_:_:_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_:_:_s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s │ │ │ │ │ -void setNoBackwardsCopyRows(std::size_t size) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:44 │ │ │ │ │ -_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 │ │ │ │ │ -void redistribute(const D &from, D &to) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:28 │ │ │ │ │ -_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_s_e_t_S_e_t_u_p │ │ │ │ │ -void resetSetup() │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:35 │ │ │ │ │ -_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_:_:_s_e_t_N_o_C_o_p_y_R_o_w_s │ │ │ │ │ -void setNoCopyRows(std::size_t size) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:41 │ │ │ │ │ -_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_:_:_i_s_S_e_t_u_p │ │ │ │ │ -bool isSetup() const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:23 │ │ │ │ │ -_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_:_:_s_e_t_N_o_R_o_w_s │ │ │ │ │ -void setNoRows(std::size_t size) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:38 │ │ │ │ │ -_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_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_:_:_g_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t getBackwardsCopyRowSize(std::size_t index) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:57 │ │ │ │ │ -_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_:_:_g_e_t_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t getRowSize(std::size_t index) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:47 │ │ │ │ │ -_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_:_:_g_e_t_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t getCopyRowSize(std::size_t index) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:52 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_e_t_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t getRowSize(std::size_t index) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:158 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t & getBackwardsCopyRowSize(std::size_t index) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:173 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_e_t_I_n_t_e_r_f_a_c_e │ │ │ │ │ -RedistributeInterface & getInterface() │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:75 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_d_i_s_t_r_i_b_u_t_e │ │ │ │ │ -void redistribute(const D &from, D &to) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:136 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ -_s_e_t_N_o_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_s │ │ │ │ │ -void setNoBackwardsCopyRows(std::size_t rows) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:193 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_e_t_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t & getCopyRowSize(std::size_t index) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:163 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -RedistributeInformation() │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:71 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_e_t_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t getCopyRowSize(std::size_t index) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:168 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ -_s_e_t_N_o_R_o_w_s │ │ │ │ │ -void setNoRows(std::size_t rows) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:183 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_s_e_r_v_e │ │ │ │ │ -void reserve(std::size_t size) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:150 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_m_m │ │ │ │ │ -OwnerOverlapCopyCommunication< T, T1 > Comm │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:69 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ -_s_e_t_N_o_C_o_p_y_R_o_w_s │ │ │ │ │ -void setNoCopyRows(std::size_t rows) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:188 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_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:141 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_ _>_ _>_:_: │ │ │ │ │ -_s_e_t_S_e_t_u_p │ │ │ │ │ -void setSetup() │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:106 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_e_t_B_a_c_k_w_a_r_d_s_C_o_p_y_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t getBackwardsCopyRowSize(std::size_t index) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:178 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_d_i_s_t_r_i_b_u_t_e │ │ │ │ │ -void redistribute(const D &from, D &to) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:118 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_s_e_t_S_e_t_u_p │ │ │ │ │ -void resetSetup() │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:112 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_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:126 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_h_e_c_k_I_n_t_e_r_f_a_c_e │ │ │ │ │ -void checkInterface(const IS &source, const IS &target, MPI_Comm comm) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:80 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_s_S_e_t_u_p │ │ │ │ │ -bool isSetup() const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:145 │ │ │ │ │ -_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_<_ _O_w_n_e_r_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_e_t_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t & getRowSize(std::size_t index) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e │ │ │ │ │ -Utility class to communicate and set the row sizes of a redistributed matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -M::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:219 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -M::size_type value_type │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:218 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_r_o_w_s_i_z_e │ │ │ │ │ -RI & rowsize │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_m_a_t_r_i_x │ │ │ │ │ -const M & matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:229 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_S_i_z_e │ │ │ │ │ -CommMatrixRowSize(const M &m_, RI &rowsize_) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:226 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ -Utility class to communicate and build the sparsity pattern of a redistributed │ │ │ │ │ -matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:245 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -M::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:246 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_i_d_x_s_e_t │ │ │ │ │ -const Dune::GlobalLookupIndexSet< I > & idxset │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:356 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_s_t_o_r_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ -void storeSparsityPattern(M &m) │ │ │ │ │ -Creates and stores the sparsity pattern of the redistributed matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_a_g_g_i_d_x_s_e_t │ │ │ │ │ -const I & aggidxset │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:357 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_r_o_w_s_i_z_e │ │ │ │ │ -const std::vector< size_type > * rowsize │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:359 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_c_o_m_p_l_e_t_e_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ -void completeSparsityPattern(std::vector< std::set< size_type > > add_sparsity) │ │ │ │ │ -Completes the sparsity pattern of the redistributed matrix with data from copy │ │ │ │ │ -rows for the novlp cas... │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:340 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ -CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > │ │ │ │ │ -&idxset_, const I &aggidxset_) │ │ │ │ │ -Constructor for the original side. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:254 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_m_a_t_r_i_x │ │ │ │ │ -const M & matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:354 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n │ │ │ │ │ -CommMatrixSparsityPattern(const M &m_, const Dune::GlobalLookupIndexSet< I > │ │ │ │ │ -&idxset_, const I &aggidxset_, const std::vector< typename M::size_type > │ │ │ │ │ -&rowsize_) │ │ │ │ │ -Constructor for the redistruted side. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_s_p_a_r_s_i_t_y │ │ │ │ │ -std::vector< std::set< size_type > > sparsity │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:358 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_:_:_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -Dune::GlobalLookupIndexSet< I > LookupIndexSet │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:355 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_g_e_t_S_i_z_e │ │ │ │ │ -static M::size_type getSize(const Type &t, std::size_t i) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:376 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_T_y_p_e │ │ │ │ │ -CommMatrixSparsityPattern< M, I > Type │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:365 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ -I::GlobalIndex IndexedType │ │ │ │ │ -The indexed type we send. This is the global index indentitfying the column. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:371 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ -VariableSize IndexedTypeFlag │ │ │ │ │ -Each row varies in size. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:374 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ -Utility class for comunicating the matrix entries. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:396 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_r_o_w_s_i_z_e │ │ │ │ │ -std::vector< size_t > * rowsize │ │ │ │ │ -row size information for the receiving side. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:452 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_m_a_t_r_i_x │ │ │ │ │ -M & matrix │ │ │ │ │ -The matrix to communicate the values of. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:446 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ -CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I │ │ │ │ │ -&aggidxset_, std::vector< size_t > &rowsize_) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:412 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_i_d_x_s_e_t │ │ │ │ │ -const Dune::GlobalLookupIndexSet< I > & idxset │ │ │ │ │ -Index set for the original matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:448 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_s_e_t_O_v_e_r_l_a_p_R_o_w_s_T_o_D_i_r_i_c_h_l_e_t │ │ │ │ │ -void setOverlapRowsToDirichlet() │ │ │ │ │ -Sets the non-owner rows correctly as Dirichlet boundaries. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:421 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_a_g_g_i_d_x_s_e_t │ │ │ │ │ -const I & aggidxset │ │ │ │ │ -Index set for the redistributed matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:450 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w_:_:_C_o_m_m_M_a_t_r_i_x_R_o_w │ │ │ │ │ -CommMatrixRow(M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I │ │ │ │ │ -&aggidxset_) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:405 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ -std::pair< typename I::GlobalIndex, typename M::block_type > IndexedType │ │ │ │ │ -The indexed type we send. This is the pair of global index indentitfying the │ │ │ │ │ -column and the value its... │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:464 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_T_y_p_e │ │ │ │ │ -CommMatrixRow< M, I > Type │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:458 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_g_e_t_S_i_z_e │ │ │ │ │ -static std::size_t getSize(const Type &t, std::size_t i) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:469 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _C_o_m_m_M_a_t_r_i_x_R_o_w_<_ _M_,_ _I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ -VariableSize IndexedTypeFlag │ │ │ │ │ -Each row varies in size. │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:467 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:483 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ -static void scatter(Container &cont, const typename M::size_type &rowsize, │ │ │ │ │ -std::size_t i) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:490 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ -static const M::size_type gather(const Container &cont, std::size_t i) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:486 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ -CommMatrixRowSize< M, RI > Container │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:484 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:500 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ -static const M::size_type gather(const Container &cont, std::size_t i) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:503 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ -static void scatter(Container &cont, const typename M::size_type &rowsize, │ │ │ │ │ -std::size_t i) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:507 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_C_o_p_y_R_o_w_S_i_z_e_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ -CommMatrixRowSize< M, RI > Container │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:501 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:518 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_l_I_t_e_r │ │ │ │ │ -M::ConstColIterator ColIter │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:521 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ -static void scatter(Container &cont, const GlobalIndex &gi, std::size_t i, │ │ │ │ │ -std::size_t j) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:553 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ -CommMatrixSparsityPattern< M, I > Container │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:520 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_n_u_m_l_i_m_i_t_s │ │ │ │ │ -static GlobalIndex numlimits │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:524 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_c_o_l │ │ │ │ │ -static ColIter col │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:523 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -I::GlobalIndex GlobalIndex │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:519 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ -static const GlobalIndex & gather(const Container &cont, std::size_t i, std:: │ │ │ │ │ -size_t j) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:526 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:599 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ │ -I::GlobalIndex GlobalIndex │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:600 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_d_a_t_a_s_t_o_r_e │ │ │ │ │ -static Data datastore │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:605 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_n_u_m_l_i_m_i_t_s │ │ │ │ │ -static GlobalIndex numlimits │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:606 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_l_I_t_e_r │ │ │ │ │ -M::ConstColIterator ColIter │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:602 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ │ -static const Data & gather(const Container &cont, std::size_t i, std::size_t j) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:608 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_D_a_t_a │ │ │ │ │ -std::pair< GlobalIndex, typename M::block_type > Data │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:603 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ -static void scatter(Container &cont, const Data &data, std::size_t i, std:: │ │ │ │ │ -size_t j) │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:638 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_c_o_l │ │ │ │ │ -static ColIter col │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:604 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_R_o_w_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ -CommMatrixRow< M, I > Container │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:601 │ │ │ │ │ -_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_:_:_O_w_n_e_r_S_e_t │ │ │ │ │ -EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:194 │ │ │ │ │ -_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_:_:_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_:_:_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_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_r_o_w_s_i_z_e_s │ │ │ │ │ +void endrowsizes() │ │ │ │ │ +indicate that size of all rows is defined │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1149 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_a_n_d_o_m │ │ │ │ │ +@ random │ │ │ │ │ +Build entries randomly. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:530 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_d_d_i_n_d_e_x │ │ │ │ │ +void addindex(size_type row, size_type col) │ │ │ │ │ +add index (row,col) to the matrix │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1191 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_i_n_d_i_c_e_s │ │ │ │ │ +void endindices() │ │ │ │ │ +indicate that all indices are defined, check consistency │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1248 │ │ │ │ │ +_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:1972 │ │ │ │ │ +_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:861 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BCRSMatrix & operator=(const BCRSMatrix &Mat) │ │ │ │ │ +assignment │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:911 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x │ │ │ │ │ +A block-tridiagonal matrix. │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ +static constexpr auto blocklevel │ │ │ │ │ +increment block level counter │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_B_T_D_M_a_t_r_i_x │ │ │ │ │ +BTDMatrix(size_type size) │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ │ +void solve(V &x, const V &rhs) const │ │ │ │ │ +Use the Thomas algorithm to solve the system Ax=b in O(n) time. │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:125 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +implement row_type with compressed vector │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +A allocator_type │ │ │ │ │ +export the allocator type │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +B block_type │ │ │ │ │ +export the type representing the components │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BTDMatrix & operator=(const BTDMatrix &other) │ │ │ │ │ +assignment │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:108 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_B_T_D_M_a_t_r_i_x │ │ │ │ │ +BTDMatrix() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_B_T_D_M_a_t_r_i_x_:_:_s_e_t_S_i_z_e │ │ │ │ │ +void setSize(size_type size) │ │ │ │ │ +Resize the matrix. Invalidates the content! │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:208 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_T_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename BTDMatrix< B, A >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn btdmatrix.hh:207 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: allocator.hh File Reference │ │ │ │ +dune-istl: gsetc.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,49 +72,195 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Typedefs
│ │ │ │ -
allocator.hh File Reference
│ │ │ │ +Enumerations | │ │ │ │ +Functions
│ │ │ │ +
gsetc.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <memory>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ + │ │ │ │ +

Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way. │ │ │ │ +More...

│ │ │ │ +
#include <cmath>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <iomanip>
│ │ │ │ +#include <string>
│ │ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ │ +#include "multitypeblockvector.hh"
│ │ │ │ +#include "multitypeblockmatrix.hh"
│ │ │ │ +#include "istlexception.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::exists< T >
struct  Dune::BL< l >
 compile-time parameter for block recursion depth More...
 
struct  Dune::algmeta_btsolve< I, diag, relax >
 
struct  Dune::algmeta_btsolve< 0, withdiag, withrelax >
 
struct  Dune::algmeta_btsolve< 0, withdiag, norelax >
 
struct  Dune::algmeta_btsolve< 0, nodiag, withrelax >
 
struct  Dune::DefaultAllocatorTraits< T, typename >
struct  Dune::algmeta_btsolve< 0, nodiag, norelax >
 
struct  Dune::DefaultAllocatorTraits< T, std::void_t< typename T::allocator_type > >
struct  Dune::algmeta_bdsolve< I, relax >
 
struct  Dune::AllocatorTraits< T >
struct  Dune::algmeta_bdsolve< 0, withrelax >
 
struct  Dune::algmeta_bdsolve< 0, norelax >
 
struct  Dune::algmeta_itsteps< I, M >
 
struct  Dune::algmeta_itsteps< 0, M >
 
struct  Dune::algmeta_itsteps< I, MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ -Typedefs

template<typename T >
using Dune::AllocatorType = typename AllocatorTraits< T >::type
 
template<typename T , typename X >
using Dune::ReboundAllocatorType = typename std::allocator_traits< typename AllocatorTraits< T >::type >::template rebind_alloc< X >
 

│ │ │ │ +Enumerations

enum  Dune::WithDiagType { Dune::withdiag =1 │ │ │ │ +, Dune::nodiag =0 │ │ │ │ + }
 
enum  Dune::WithRelaxType { Dune::withrelax =1 │ │ │ │ +, Dune::norelax =0 │ │ │ │ + }
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

template<class M , class X , class Y >
void Dune::bltsolve (const M &A, X &v, const Y &d)
 block lower triangular solve
 
template<class M , class X , class Y , class K >
void Dune::bltsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed block lower triangular solve
 
template<class M , class X , class Y >
void Dune::ubltsolve (const M &A, X &v, const Y &d)
 unit block lower triangular solve
 
template<class M , class X , class Y , class K >
void Dune::ubltsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed unit block lower triangular solve
 
template<class M , class X , class Y >
void Dune::butsolve (const M &A, X &v, const Y &d)
 block upper triangular solve
 
template<class M , class X , class Y , class K >
void Dune::butsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed block upper triangular solve
 
template<class M , class X , class Y >
void Dune::ubutsolve (const M &A, X &v, const Y &d)
 unit block upper triangular solve
 
template<class M , class X , class Y , class K >
void Dune::ubutsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed unit block upper triangular solve
 
template<class M , class X , class Y , int l>
void Dune::bltsolve (const M &A, X &v, const Y &d, BL< l >)
 block lower triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::bltsolve (const M &A, X &v, const Y &d, const K &w, BL< l >)
 relaxed block lower triangular solve
 
template<class M , class X , class Y , int l>
void Dune::ubltsolve (const M &A, X &v, const Y &d, BL< l >)
 unit block lower triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::ubltsolve (const M &A, X &v, const Y &d, const K &w, BL< l >)
 relaxed unit block lower triangular solve
 
template<class M , class X , class Y , int l>
void Dune::butsolve (const M &A, X &v, const Y &d, BL< l > bl)
 block upper triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::butsolve (const M &A, X &v, const Y &d, const K &w, BL< l > bl)
 relaxed block upper triangular solve
 
template<class M , class X , class Y , int l>
void Dune::ubutsolve (const M &A, X &v, const Y &d, BL< l > bl)
 unit block upper triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::ubutsolve (const M &A, X &v, const Y &d, const K &w, BL< l > bl)
 relaxed unit block upper triangular solve
 
template<class M , class X , class Y >
void Dune::bdsolve (const M &A, X &v, const Y &d)
 block diagonal solve, no relaxation
 
template<class M , class X , class Y , class K >
void Dune::bdsolve (const M &A, X &v, const Y &d, const K &w)
 block diagonal solve, with relaxation
 
template<class M , class X , class Y , int l>
void Dune::bdsolve (const M &A, X &v, const Y &d, BL< l >)
 block diagonal solve, no relaxation
 
template<class M , class X , class Y , class K , int l>
void Dune::bdsolve (const M &A, X &v, const Y &d, const K &w, BL< l >)
 block diagonal solve, with relaxation
 
template<class M , class X , class Y , class K >
void Dune::dbgs (const M &A, X &x, const Y &b, const K &w)
 GS step.
 
template<class M , class X , class Y , class K , int l>
void Dune::dbgs (const M &A, X &x, const Y &b, const K &w, BL< l >)
 GS step.
 
template<class M , class X , class Y , class K >
void Dune::bsorf (const M &A, X &x, const Y &b, const K &w)
 SOR step.
 
template<class M , class X , class Y , class K , int l>
void Dune::bsorf (const M &A, X &x, const Y &b, const K &w, BL< l >)
 SOR step.
 
template<class M , class X , class Y , class K >
void Dune::bsorb (const M &A, X &x, const Y &b, const K &w)
 SSOR step.
 
template<class M , class X , class Y , class K , int l>
void Dune::bsorb (const M &A, X &x, const Y &b, const K &w, BL< l >)
 Backward SOR step.
 
template<class M , class X , class Y , class K >
void Dune::dbjac (const M &A, X &x, const Y &b, const K &w)
 Jacobi step.
 
template<class M , class X , class Y , class K , int l>
void Dune::dbjac (const M &A, X &x, const Y &b, const K &w, BL< l >)
 Jacobi step.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,173 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -allocator.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_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 │ │ │ │ │ +gsetc.hh File Reference │ │ │ │ │ +Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ +generic way. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h" │ │ │ │ │ +#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._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 │ │ │ │ │ -struct   _D_u_n_e_:_:_e_x_i_s_t_s_<_ _T_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_B_L_<_ _l_ _> │ │ │ │ │ +  compile-time parameter for block recursion depth _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_,_ _t_y_p_e_n_a_m_e_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _I_,_ _d_i_a_g_,_ _r_e_l_a_x_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _t_y_p_e_n_a_m_e_ _T_:_: │ │ │ │ │ - _a_l_l_o_c_a_t_o_r___t_y_p_e_ _>_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _n_o_r_e_l_a_x_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _n_o_r_e_l_a_x_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _I_,_ _r_e_l_a_x_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _w_i_t_h_r_e_l_a_x_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _n_o_r_e_l_a_x_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_, │ │ │ │ │ + _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_A_l_l_o_c_a_t_o_r_T_y_p_e = typename _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s< T >::type │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _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 │ │ │ │ │ - _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s< T >::type >::template rebind_alloc< X > │ │ │ │ │ +EEnnuummeerraattiioonnss │ │ │ │ │ +enum   _D_u_n_e_:_:_W_i_t_h_D_i_a_g_T_y_p_e { _D_u_n_e_:_:_w_i_t_h_d_i_a_g =1 , _D_u_n_e_:_:_n_o_d_i_a_g =0 } │ │ │ │ │ +  │ │ │ │ │ +enum   _D_u_n_e_:_:_W_i_t_h_R_e_l_a_x_T_y_p_e { _D_u_n_e_:_:_w_i_t_h_r_e_l_a_x =1 , _D_u_n_e_:_:_n_o_r_e_l_a_x =0 } │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ +  block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +  relaxed block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ +  unit block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +  relaxed unit block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ +  block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +  relaxed block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ +  unit block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +  relaxed unit block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l >) │ │ │ │ │ +  block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l >) │ │ │ │ │ +  relaxed block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l >) │ │ │ │ │ +  unit block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l >) │ │ │ │ │ +  relaxed unit block lower triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l > bl) │ │ │ │ │ +  block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l > bl) │ │ │ │ │ +  relaxed block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l > bl) │ │ │ │ │ +  unit block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l > bl) │ │ │ │ │ +  relaxed unit block upper triangular solve │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ +  block diagonal solve, no relaxation │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +  block diagonal solve, with relaxation │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l >) │ │ │ │ │ +  block diagonal solve, no relaxation │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l >) │ │ │ │ │ +  block diagonal solve, with relaxation │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_d_b_g_s (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +  GS step. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_d_b_g_s (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ +  GS step. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_s_o_r_f (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +  SOR step. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_s_o_r_f (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ +  SOR step. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_s_o_r_b (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +  SSOR step. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_b_s_o_r_b (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ +  Backward SOR step. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_d_b_j_a_c (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +  Jacobi step. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_d_b_j_a_c (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ +  Jacobi step. │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ +generic way. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: allocator.hh Source File │ │ │ │ +dune-istl: gsetc.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,76 +74,835 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
allocator.hh
│ │ │ │ +
gsetc.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
3#ifndef DUNE_ISTL_ALLOCATOR_HH
│ │ │ │ -
4#define DUNE_ISTL_ALLOCATOR_HH
│ │ │ │ -
5
│ │ │ │ -
6#include <memory>
│ │ │ │ -
7#include <type_traits>
│ │ │ │ -
8
│ │ │ │ -
9#include <dune/common/typetraits.hh>
│ │ │ │ -
10
│ │ │ │ -
│ │ │ │ -
11namespace Dune {
│ │ │ │ -
12
│ │ │ │ -
13 template<typename T>
│ │ │ │ -
│ │ │ │ -
14 struct exists{
│ │ │ │ -
15 static const bool value = true;
│ │ │ │ -
16 };
│ │ │ │ -
│ │ │ │ -
17
│ │ │ │ -
18 template<typename T, typename = void>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
20 {
│ │ │ │ -
21 using type = std::allocator<T>;
│ │ │ │ -
22 };
│ │ │ │ -
│ │ │ │ -
23
│ │ │ │ -
24 template<typename T>
│ │ │ │ -
│ │ │ │ -
25 struct DefaultAllocatorTraits<T, std::void_t<typename T::allocator_type> >
│ │ │ │ -
26 {
│ │ │ │ -
27 using type = typename T::allocator_type;
│ │ │ │ -
28 };
│ │ │ │ -
│ │ │ │ -
29
│ │ │ │ -
30 template<typename T>
│ │ │ │ - │ │ │ │ -
32
│ │ │ │ -
33 template<typename T>
│ │ │ │ - │ │ │ │ -
35
│ │ │ │ -
36 template<typename T, typename X>
│ │ │ │ -
37 using ReboundAllocatorType = typename std::allocator_traits<typename AllocatorTraits<T>::type>::template rebind_alloc<X>;
│ │ │ │ -
38
│ │ │ │ -
39} // end namespace Dune
│ │ │ │ -
│ │ │ │ -
40
│ │ │ │ -
41#endif // DUNE_ISTL_ALLOCATOR_HH
│ │ │ │ -
STL namespace.
│ │ │ │ +
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_GSETC_HH
│ │ │ │ +
6#define DUNE_ISTL_GSETC_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <cmath>
│ │ │ │ +
9#include <complex>
│ │ │ │ +
10#include <iostream>
│ │ │ │ +
11#include <iomanip>
│ │ │ │ +
12#include <string>
│ │ │ │ +
13
│ │ │ │ +
14#include <dune/common/hybridutilities.hh>
│ │ │ │ +
15
│ │ │ │ + │ │ │ │ + │ │ │ │ +
18
│ │ │ │ +
19#include "istlexception.hh"
│ │ │ │ +
20
│ │ │ │ +
21
│ │ │ │ +
27namespace Dune {
│ │ │ │ +
28
│ │ │ │ +
39 //============================================================
│ │ │ │ +
40 // parameter types
│ │ │ │ +
41 //============================================================
│ │ │ │ +
42
│ │ │ │ +
44 template<int l>
│ │ │ │ +
│ │ │ │ +
45 struct BL {
│ │ │ │ +
46 enum {recursion_level = l};
│ │ │ │ +
47 };
│ │ │ │ +
│ │ │ │ +
48
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
51 nodiag=0
│ │ │ │ +
52 };
│ │ │ │ +
│ │ │ │ +
53
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
56 norelax=0
│ │ │ │ +
57 };
│ │ │ │ +
│ │ │ │ +
58
│ │ │ │ +
59 //============================================================
│ │ │ │ +
60 // generic triangular solves
│ │ │ │ +
61 // consider block decomposition A = L + D + U
│ │ │ │ +
62 // we can invert L, L+D, U, U+D
│ │ │ │ +
63 // we can apply relaxation or not
│ │ │ │ +
64 // we can recurse over a fixed number of levels
│ │ │ │ +
65 //============================================================
│ │ │ │ +
66
│ │ │ │ +
67 // template meta program for triangular solves
│ │ │ │ +
68 template<int I, WithDiagType diag, WithRelaxType relax>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
70 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
71 static void bltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
72 {
│ │ │ │ +
73 // iterator types
│ │ │ │ +
74 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
75 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
76 typedef typename Y::block_type bblock;
│ │ │ │ +
77
│ │ │ │ +
78 // local solve at each block and immediate update
│ │ │ │ +
79 rowiterator endi=A.end();
│ │ │ │ +
80 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
81 {
│ │ │ │ +
82 bblock rhs(d[i.index()]);
│ │ │ │ +
83 coliterator j;
│ │ │ │ +
84 for (j=(*i).begin(); j.index()<i.index(); ++j)
│ │ │ │ +
85 (*j).mmv(v[j.index()],rhs);
│ │ │ │ +
86 algmeta_btsolve<I-1,diag,relax>::bltsolve(*j,v[i.index()],rhs,w);
│ │ │ │ +
87 }
│ │ │ │ +
88 }
│ │ │ │ +
│ │ │ │ +
89 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
90 static void butsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
91 {
│ │ │ │ +
92 // iterator types
│ │ │ │ +
93 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
94 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
95 typedef typename Y::block_type bblock;
│ │ │ │ +
96
│ │ │ │ +
97 // local solve at each block and immediate update
│ │ │ │ +
98 rowiterator rendi=A.beforeBegin();
│ │ │ │ +
99 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
│ │ │ │ +
100 {
│ │ │ │ +
101 bblock rhs(d[i.index()]);
│ │ │ │ +
102 coliterator j;
│ │ │ │ +
103 for (j=(*i).beforeEnd(); j.index()>i.index(); --j)
│ │ │ │ +
104 (*j).mmv(v[j.index()],rhs);
│ │ │ │ +
105 algmeta_btsolve<I-1,diag,relax>::butsolve(*j,v[i.index()],rhs,w);
│ │ │ │ +
106 }
│ │ │ │ +
107 }
│ │ │ │ +
│ │ │ │ +
108 };
│ │ │ │ +
│ │ │ │ +
109
│ │ │ │ +
110 // recursion end ...
│ │ │ │ +
111 template<>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
113 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
114 static void bltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
115 {
│ │ │ │ +
116 A.solve(v,d);
│ │ │ │ +
117 v *= w;
│ │ │ │ +
118 }
│ │ │ │ +
│ │ │ │ +
119 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
120 static void butsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
121 {
│ │ │ │ +
122 A.solve(v,d);
│ │ │ │ +
123 v *= w;
│ │ │ │ +
124 }
│ │ │ │ +
│ │ │ │ +
125 };
│ │ │ │ +
│ │ │ │ +
126 template<>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
128 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
129 static void bltsolve (const M& A, X& v, const Y& d, const K& /*w*/)
│ │ │ │ +
130 {
│ │ │ │ +
131 A.solve(v,d);
│ │ │ │ +
132 }
│ │ │ │ +
│ │ │ │ +
133 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
134 static void butsolve (const M& A, X& v, const Y& d, const K& /*w*/)
│ │ │ │ +
135 {
│ │ │ │ +
136 A.solve(v,d);
│ │ │ │ +
137 }
│ │ │ │ +
│ │ │ │ +
138 };
│ │ │ │ +
│ │ │ │ +
139 template<>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
141 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
142 static void bltsolve (const M& /*A*/, X& v, const Y& d, const K& w)
│ │ │ │ +
143 {
│ │ │ │ +
144 v = d;
│ │ │ │ +
145 v *= w;
│ │ │ │ +
146 }
│ │ │ │ +
│ │ │ │ +
147 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
148 static void butsolve (const M& /*A*/, X& v, const Y& d, const K& w)
│ │ │ │ +
149 {
│ │ │ │ +
150 v = d;
│ │ │ │ +
151 v *= w;
│ │ │ │ +
152 }
│ │ │ │ +
│ │ │ │ +
153 };
│ │ │ │ +
│ │ │ │ +
154 template<>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
156 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
157 static void bltsolve (const M& /*A*/, X& v, const Y& d, const K& /*w*/)
│ │ │ │ +
158 {
│ │ │ │ +
159 v = d;
│ │ │ │ +
160 }
│ │ │ │ +
│ │ │ │ +
161 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
162 static void butsolve (const M& /*A*/, X& v, const Y& d, const K& /*w*/)
│ │ │ │ +
163 {
│ │ │ │ +
164 v = d;
│ │ │ │ +
165 }
│ │ │ │ +
│ │ │ │ +
166 };
│ │ │ │ +
│ │ │ │ +
167
│ │ │ │ +
168
│ │ │ │ +
169 // user calls
│ │ │ │ +
170
│ │ │ │ +
171 // default block recursion level = 1
│ │ │ │ +
172
│ │ │ │ +
174 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
175 void bltsolve (const M& A, X& v, const Y& d)
│ │ │ │ +
176 {
│ │ │ │ +
177 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
179 }
│ │ │ │ +
│ │ │ │ +
181 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
182 void bltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
183 {
│ │ │ │ + │ │ │ │ +
185 }
│ │ │ │ +
│ │ │ │ +
187 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
188 void ubltsolve (const M& A, X& v, const Y& d)
│ │ │ │ +
189 {
│ │ │ │ +
190 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
192 }
│ │ │ │ +
│ │ │ │ +
194 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
195 void ubltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
196 {
│ │ │ │ + │ │ │ │ +
198 }
│ │ │ │ +
│ │ │ │ +
199
│ │ │ │ +
201 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
202 void butsolve (const M& A, X& v, const Y& d)
│ │ │ │ +
203 {
│ │ │ │ +
204 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
206 }
│ │ │ │ +
│ │ │ │ +
208 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
209 void butsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
210 {
│ │ │ │ + │ │ │ │ +
212 }
│ │ │ │ +
│ │ │ │ +
214 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
215 void ubutsolve (const M& A, X& v, const Y& d)
│ │ │ │ +
216 {
│ │ │ │ +
217 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
219 }
│ │ │ │ +
│ │ │ │ +
221 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
222 void ubutsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
223 {
│ │ │ │ + │ │ │ │ +
225 }
│ │ │ │ +
│ │ │ │ +
226
│ │ │ │ +
227 // general block recursion level >= 0
│ │ │ │ +
228
│ │ │ │ +
230 template<class M, class X, class Y, int l>
│ │ │ │ +
│ │ │ │ +
231 void bltsolve (const M& A, X& v, const Y& d, BL<l> /*bl*/)
│ │ │ │ +
232 {
│ │ │ │ +
233 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
235 }
│ │ │ │ +
│ │ │ │ +
237 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
238 void bltsolve (const M& A, X& v, const Y& d, const K& w, BL<l> /*bl*/)
│ │ │ │ +
239 {
│ │ │ │ + │ │ │ │ +
241 }
│ │ │ │ +
│ │ │ │ +
243 template<class M, class X, class Y, int l>
│ │ │ │ +
│ │ │ │ +
244 void ubltsolve (const M& A, X& v, const Y& d, BL<l> /*bl*/)
│ │ │ │ +
245 {
│ │ │ │ +
246 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
248 }
│ │ │ │ +
│ │ │ │ +
250 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
251 void ubltsolve (const M& A, X& v, const Y& d, const K& w, BL<l> /*bl*/)
│ │ │ │ +
252 {
│ │ │ │ + │ │ │ │ +
254 }
│ │ │ │ +
│ │ │ │ +
255
│ │ │ │ +
257 template<class M, class X, class Y, int l>
│ │ │ │ +
│ │ │ │ +
258 void butsolve (const M& A, X& v, const Y& d, BL<l> bl)
│ │ │ │ +
259 {
│ │ │ │ +
260 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
262 }
│ │ │ │ +
│ │ │ │ +
264 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
265 void butsolve (const M& A, X& v, const Y& d, const K& w, BL<l> bl)
│ │ │ │ +
266 {
│ │ │ │ + │ │ │ │ +
268 }
│ │ │ │ +
│ │ │ │ +
270 template<class M, class X, class Y, int l>
│ │ │ │ +
│ │ │ │ +
271 void ubutsolve (const M& A, X& v, const Y& d, BL<l> bl)
│ │ │ │ +
272 {
│ │ │ │ +
273 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
275 }
│ │ │ │ +
│ │ │ │ +
277 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
278 void ubutsolve (const M& A, X& v, const Y& d, const K& w, BL<l> bl)
│ │ │ │ +
279 {
│ │ │ │ + │ │ │ │ +
281 }
│ │ │ │ +
│ │ │ │ +
282
│ │ │ │ +
283
│ │ │ │ +
284
│ │ │ │ +
285 //============================================================
│ │ │ │ +
286 // generic block diagonal solves
│ │ │ │ +
287 // consider block decomposition A = L + D + U
│ │ │ │ +
288 // we can apply relaxation or not
│ │ │ │ +
289 // we can recurse over a fixed number of levels
│ │ │ │ +
290 //============================================================
│ │ │ │ +
291
│ │ │ │ +
292 // template meta program for diagonal solves
│ │ │ │ +
293 template<int I, WithRelaxType relax>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
295 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
296 static void bdsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
297 {
│ │ │ │ +
298 // iterator types
│ │ │ │ +
299 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
300 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
301
│ │ │ │ +
302 // local solve at each block and immediate update
│ │ │ │ +
303 rowiterator rendi=A.beforeBegin();
│ │ │ │ +
304 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
│ │ │ │ +
305 {
│ │ │ │ +
306 coliterator ii=(*i).find(i.index());
│ │ │ │ +
307 algmeta_bdsolve<I-1,relax>::bdsolve(*ii,v[i.index()],d[i.index()],w);
│ │ │ │ +
308 }
│ │ │ │ +
309 }
│ │ │ │ +
│ │ │ │ +
310 };
│ │ │ │ +
│ │ │ │ +
311
│ │ │ │ +
312 // recursion end ...
│ │ │ │ +
313 template<>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
315 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
316 static void bdsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
317 {
│ │ │ │ +
318 A.solve(v,d);
│ │ │ │ +
319 v *= w;
│ │ │ │ +
320 }
│ │ │ │ +
│ │ │ │ +
321 };
│ │ │ │ +
│ │ │ │ +
322 template<>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
324 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
325 static void bdsolve (const M& A, X& v, const Y& d, const K& /*w*/)
│ │ │ │ +
326 {
│ │ │ │ +
327 A.solve(v,d);
│ │ │ │ +
328 }
│ │ │ │ +
│ │ │ │ +
329 };
│ │ │ │ +
│ │ │ │ +
330
│ │ │ │ +
331 // user calls
│ │ │ │ +
332
│ │ │ │ +
333 // default block recursion level = 1
│ │ │ │ +
334
│ │ │ │ +
336 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
337 void bdsolve (const M& A, X& v, const Y& d)
│ │ │ │ +
338 {
│ │ │ │ +
339 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
341 }
│ │ │ │ +
│ │ │ │ +
343 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
344 void bdsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
345 {
│ │ │ │ + │ │ │ │ +
347 }
│ │ │ │ +
│ │ │ │ +
348
│ │ │ │ +
349 // general block recursion level >= 0
│ │ │ │ +
350
│ │ │ │ +
352 template<class M, class X, class Y, int l>
│ │ │ │ +
│ │ │ │ +
353 void bdsolve (const M& A, X& v, const Y& d, BL<l> /*bl*/)
│ │ │ │ +
354 {
│ │ │ │ +
355 typename X::field_type w=1;
│ │ │ │ + │ │ │ │ +
357 }
│ │ │ │ +
│ │ │ │ +
359 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
360 void bdsolve (const M& A, X& v, const Y& d, const K& w, BL<l> /*bl*/)
│ │ │ │ +
361 {
│ │ │ │ + │ │ │ │ +
363 }
│ │ │ │ +
│ │ │ │ +
364
│ │ │ │ +
365
│ │ │ │ +
366 //============================================================
│ │ │ │ +
367 // generic steps of iteration methods
│ │ │ │ +
368 // Jacobi, Gauss-Seidel, SOR, SSOR
│ │ │ │ +
369 // work directly on Ax=b, ie solve M(x^{i+1}-x^i) = w (b-Ax^i)
│ │ │ │ +
370 // we can recurse over a fixed number of levels
│ │ │ │ +
371 //============================================================
│ │ │ │ +
372
│ │ │ │ +
373 // template meta program for iterative solver steps
│ │ │ │ +
374 template<int I, typename M>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
376
│ │ │ │ +
377 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
378 static void dbgs (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
379 {
│ │ │ │ +
380 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
381 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
382 typedef typename Y::block_type bblock;
│ │ │ │ +
383 bblock rhs;
│ │ │ │ +
384
│ │ │ │ +
385 X xold(x); // remember old x
│ │ │ │ +
386
│ │ │ │ +
387 rowiterator endi=A.end();
│ │ │ │ +
388 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
389 {
│ │ │ │ +
390 rhs = b[i.index()]; // rhs = b_i
│ │ │ │ +
391 coliterator endj=(*i).end();
│ │ │ │ +
392 coliterator j=(*i).begin();
│ │ │ │ +
393 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ +
394 {
│ │ │ │ +
395 for (; j.index()<i.index(); ++j)
│ │ │ │ +
396 rhs -= (*j) * x[j.index()];
│ │ │ │ +
397 coliterator diag=j++; // *diag = a_ii and increment coliterator j from a_ii to a_i+1,i to skip diagonal
│ │ │ │ +
398 for (; j != endj; ++j)
│ │ │ │ +
399 rhs -= (*j) * x[j.index()];
│ │ │ │ +
400 x[i.index()] = rhs / (*diag);
│ │ │ │ +
401 }
│ │ │ │ +
402 else
│ │ │ │ +
403 {
│ │ │ │ +
404 for (; j.index()<i.index(); ++j) // iterate over a_ij with j < i
│ │ │ │ +
405 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ +
406 coliterator diag=j++; // *diag = a_ii and increment coliterator j from a_ii to a_i+1,i to skip diagonal
│ │ │ │ +
407 for (; j != endj; ++j) // iterate over a_ij with j > i
│ │ │ │ +
408 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j>i} a_ij * xold_j
│ │ │ │ +
409 algmeta_itsteps<I-1,typename M::block_type>::dbgs(*diag,x[i.index()],rhs,w); // if I==1: xnew_i = rhs/a_ii
│ │ │ │ +
410 }
│ │ │ │ +
411 }
│ │ │ │ +
412 // next two lines: xnew_i = w / a_ii * (b_i - sum_{j<i} a_ij * xnew_j - sum_{j>=i} a_ij * xold_j) + (1-w)*xold;
│ │ │ │ +
413 x *= w;
│ │ │ │ +
414 x.axpy(K(1)-w,xold);
│ │ │ │ +
415 }
│ │ │ │ +
│ │ │ │ +
416
│ │ │ │ +
417 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
418 static void bsorf (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
419 {
│ │ │ │ +
420 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
421 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
422 typedef typename Y::block_type bblock;
│ │ │ │ +
423 typedef typename X::block_type xblock;
│ │ │ │ +
424 bblock rhs;
│ │ │ │ +
425 xblock v;
│ │ │ │ +
426
│ │ │ │ +
427 // Initialize nested data structure if there are entries
│ │ │ │ +
428 if(A.begin()!=A.end())
│ │ │ │ +
429 v=x[0];
│ │ │ │ +
430
│ │ │ │ +
431 rowiterator endi=A.end();
│ │ │ │ +
432 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
433 {
│ │ │ │ +
434 rhs = b[i.index()]; // rhs = b_i
│ │ │ │ +
435 coliterator endj=(*i).end(); // iterate over a_ij with j < i
│ │ │ │ +
436 coliterator j=(*i).begin();
│ │ │ │ +
437 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ +
438 {
│ │ │ │ +
439 for (; j.index()<i.index(); ++j)
│ │ │ │ +
440 rhs -= (*j) * x[j.index()]; // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ +
441 coliterator diag=j; // *diag = a_ii
│ │ │ │ +
442 for (; j!=endj; ++j)
│ │ │ │ +
443 rhs -= (*j) * x[j.index()]; // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ +
444 v = rhs / (*diag);
│ │ │ │ +
445 x[i.index()] += w*v; // x_i = w / a_ii * (b_i - sum_{j<i} a_ij * xnew_j - sum_{j>=i} a_ij * xold_j)
│ │ │ │ +
446 }
│ │ │ │ +
447 else
│ │ │ │ +
448 {
│ │ │ │ +
449 for (; j.index()<i.index(); ++j)
│ │ │ │ +
450 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ +
451 coliterator diag=j; // *diag = a_ii
│ │ │ │ +
452 for (; j!=endj; ++j)
│ │ │ │ +
453 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ +
454 algmeta_itsteps<I-1,typename M::block_type>::bsorf(*diag,v,rhs,w); // if blocksize I==1: v = rhs/a_ii
│ │ │ │ +
455 x[i.index()].axpy(w,v); // x_i = w / a_ii * (b_i - sum_{j<i} a_ij * xnew_j - sum_{j>=i} a_ij * xold_j)
│ │ │ │ +
456 }
│ │ │ │ +
457 }
│ │ │ │ +
458 }
│ │ │ │ +
│ │ │ │ +
459
│ │ │ │ +
460 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
461 static void bsorb (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
462 {
│ │ │ │ +
463 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
464 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
465 typedef typename Y::block_type bblock;
│ │ │ │ +
466 typedef typename X::block_type xblock;
│ │ │ │ +
467 bblock rhs;
│ │ │ │ +
468 xblock v;
│ │ │ │ +
469
│ │ │ │ +
470 // Initialize nested data structure if there are entries
│ │ │ │ +
471 if(A.begin()!=A.end())
│ │ │ │ +
472 v=x[0];
│ │ │ │ +
473
│ │ │ │ +
474 rowiterator endi=A.beforeBegin();
│ │ │ │ +
475 for (rowiterator i=A.beforeEnd(); i!=endi; --i)
│ │ │ │ +
476 {
│ │ │ │ +
477 rhs = b[i.index()];
│ │ │ │ +
478 coliterator endj=(*i).end();
│ │ │ │ +
479 coliterator j=(*i).begin();
│ │ │ │ +
480 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ +
481 {
│ │ │ │ +
482 for (; j.index()<i.index(); ++j)
│ │ │ │ +
483 rhs -= (*j) * x[j.index()];
│ │ │ │ +
484 coliterator diag=j;
│ │ │ │ +
485 for (; j!=endj; ++j)
│ │ │ │ +
486 rhs -= (*j) * x[j.index()];
│ │ │ │ +
487 v = rhs / (*diag);
│ │ │ │ +
488 x[i.index()] += w*v;
│ │ │ │ +
489 }
│ │ │ │ +
490 else
│ │ │ │ +
491 {
│ │ │ │ +
492 for (; j.index()<i.index(); ++j)
│ │ │ │ +
493 j->mmv(x[j.index()],rhs);
│ │ │ │ +
494 coliterator diag=j;
│ │ │ │ +
495 for (; j!=endj; ++j)
│ │ │ │ +
496 j->mmv(x[j.index()],rhs);
│ │ │ │ + │ │ │ │ +
498 x[i.index()].axpy(w,v);
│ │ │ │ +
499 }
│ │ │ │ +
500 }
│ │ │ │ +
501 }
│ │ │ │ +
│ │ │ │ +
502
│ │ │ │ +
503 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
504 static void dbjac (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
505 {
│ │ │ │ +
506 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
507 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
508 typedef typename Y::block_type bblock;
│ │ │ │ +
509 bblock rhs;
│ │ │ │ +
510
│ │ │ │ +
511 X v(x); // allocate with same size
│ │ │ │ +
512
│ │ │ │ +
513 rowiterator endi=A.end();
│ │ │ │ +
514 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
515 {
│ │ │ │ +
516 rhs = b[i.index()];
│ │ │ │ +
517 coliterator endj=(*i).end();
│ │ │ │ +
518 coliterator j=(*i).begin();
│ │ │ │ +
519 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ +
520 {
│ │ │ │ +
521 for (; j.index()<i.index(); ++j)
│ │ │ │ +
522 rhs -= (*j) * x[j.index()];
│ │ │ │ +
523 coliterator diag=j;
│ │ │ │ +
524 for (; j!=endj; ++j)
│ │ │ │ +
525 rhs -= (*j) * x[j.index()];
│ │ │ │ +
526 v[i.index()] = rhs / (*diag);
│ │ │ │ +
527 }
│ │ │ │ +
528 else
│ │ │ │ +
529 {
│ │ │ │ +
530 for (; j.index()<i.index(); ++j)
│ │ │ │ +
531 j->mmv(x[j.index()],rhs);
│ │ │ │ +
532 coliterator diag=j;
│ │ │ │ +
533 for (; j!=endj; ++j)
│ │ │ │ +
534 j->mmv(x[j.index()],rhs);
│ │ │ │ + │ │ │ │ +
536 }
│ │ │ │ +
537 }
│ │ │ │ +
538 x.axpy(w,v);
│ │ │ │ +
539 }
│ │ │ │ +
│ │ │ │ +
540 };
│ │ │ │ +
│ │ │ │ +
541 // end of recursion
│ │ │ │ +
542 template<typename M>
│ │ │ │ +
│ │ │ │ +
543 struct algmeta_itsteps<0,M> {
│ │ │ │ +
544 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
545 static void dbgs (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ +
546 {
│ │ │ │ +
547 A.solve(x,b);
│ │ │ │ +
548 }
│ │ │ │ +
│ │ │ │ +
549 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
550 static void bsorf (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ +
551 {
│ │ │ │ +
552 A.solve(x,b);
│ │ │ │ +
553 }
│ │ │ │ +
│ │ │ │ +
554 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
555 static void bsorb (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ +
556 {
│ │ │ │ +
557 A.solve(x,b);
│ │ │ │ +
558 }
│ │ │ │ +
│ │ │ │ +
559 template<class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
560 static void dbjac (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ +
561 {
│ │ │ │ +
562 A.solve(x,b);
│ │ │ │ +
563 }
│ │ │ │ +
│ │ │ │ +
564 };
│ │ │ │ +
│ │ │ │ +
565
│ │ │ │ +
566 template<int I, typename T1, typename... MultiTypeMatrixArgs>
│ │ │ │ +
│ │ │ │ +
567 struct algmeta_itsteps<I,MultiTypeBlockMatrix<T1, MultiTypeMatrixArgs...>> {
│ │ │ │ +
568 template<
│ │ │ │ +
569 typename... MultiTypeVectorArgs,
│ │ │ │ +
570 class K>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
574 const K& w)
│ │ │ │ +
575 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
578 }
│ │ │ │ +
│ │ │ │ +
579
│ │ │ │ +
580 template<
│ │ │ │ +
581 typename... MultiTypeVectorArgs,
│ │ │ │ +
582 class K>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
586 const K& w)
│ │ │ │ +
587 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
590 }
│ │ │ │ +
│ │ │ │ +
591
│ │ │ │ +
592 template<
│ │ │ │ +
593 typename... MultiTypeVectorArgs,
│ │ │ │ +
594 class K>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
598 const K& w)
│ │ │ │ +
599 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
602 }
│ │ │ │ +
│ │ │ │ +
603
│ │ │ │ +
604 template<
│ │ │ │ +
605 typename... MultiTypeVectorArgs,
│ │ │ │ +
606 class K
│ │ │ │ +
607 >
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
611 const K& w)
│ │ │ │ +
612 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
615 }
│ │ │ │ +
│ │ │ │ +
616 };
│ │ │ │ +
│ │ │ │ +
617
│ │ │ │ +
618 // user calls
│ │ │ │ +
619
│ │ │ │ +
621 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
622 void dbgs (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
623 {
│ │ │ │ + │ │ │ │ +
625 }
│ │ │ │ +
│ │ │ │ +
627 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
628 void dbgs (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ +
629 {
│ │ │ │ + │ │ │ │ +
631 }
│ │ │ │ +
│ │ │ │ +
633 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
634 void bsorf (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
635 {
│ │ │ │ + │ │ │ │ +
637 }
│ │ │ │ +
│ │ │ │ +
639 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
640 void bsorf (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ +
641 {
│ │ │ │ + │ │ │ │ +
643 }
│ │ │ │ +
│ │ │ │ +
645 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
646 void bsorb (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
647 {
│ │ │ │ + │ │ │ │ +
649 }
│ │ │ │ +
│ │ │ │ +
651 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
652 void bsorb (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ +
653 {
│ │ │ │ + │ │ │ │ +
655 }
│ │ │ │ +
│ │ │ │ +
657 template<class M, class X, class Y, class K>
│ │ │ │ +
│ │ │ │ +
658 void dbjac (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ +
659 {
│ │ │ │ + │ │ │ │ +
661 }
│ │ │ │ +
│ │ │ │ +
663 template<class M, class X, class Y, class K, int l>
│ │ │ │ +
│ │ │ │ +
664 void dbjac (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ +
665 {
│ │ │ │ + │ │ │ │ +
667 }
│ │ │ │ +
│ │ │ │ +
668
│ │ │ │ +
669
│ │ │ │ +
672} // end namespace
│ │ │ │ +
673
│ │ │ │ +
674#endif
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:568
│ │ │ │ +
static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:484
│ │ │ │ +
static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:540
│ │ │ │ +
static constexpr size_type N()
Return the number of matrix rows.
Definition multitypeblockmatrix.hh:64
│ │ │ │ +
static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:513
│ │ │ │ +
void bltsolve(const M &A, X &v, const Y &d)
block lower triangular solve
Definition gsetc.hh:175
│ │ │ │ +
WithDiagType
Definition gsetc.hh:49
│ │ │ │ +
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition gsetc.hh:646
│ │ │ │ +
void ubltsolve(const M &A, X &v, const Y &d)
unit block lower triangular solve
Definition gsetc.hh:188
│ │ │ │ +
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition gsetc.hh:658
│ │ │ │ +
void dbgs(const M &A, X &x, const Y &b, const K &w)
GS step.
Definition gsetc.hh:622
│ │ │ │ +
WithRelaxType
Definition gsetc.hh:54
│ │ │ │ +
void bdsolve(const M &A, X &v, const Y &d)
block diagonal solve, no relaxation
Definition gsetc.hh:337
│ │ │ │ +
void butsolve(const M &A, X &v, const Y &d)
block upper triangular solve
Definition gsetc.hh:202
│ │ │ │ +
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition gsetc.hh:634
│ │ │ │ +
void ubutsolve(const M &A, X &v, const Y &d)
unit block upper triangular solve
Definition gsetc.hh:215
│ │ │ │ +
@ nodiag
Definition gsetc.hh:51
│ │ │ │ +
@ withdiag
Definition gsetc.hh:50
│ │ │ │ +
@ norelax
Definition gsetc.hh:56
│ │ │ │ +
@ withrelax
Definition gsetc.hh:55
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
typename std::allocator_traits< typename AllocatorTraits< T >::type >::template rebind_alloc< X > ReboundAllocatorType
Definition allocator.hh:37
│ │ │ │ -
typename AllocatorTraits< T >::type AllocatorType
Definition allocator.hh:34
│ │ │ │ -
Definition allocator.hh:14
│ │ │ │ -
static const bool value
Definition allocator.hh:15
│ │ │ │ -
Definition allocator.hh:20
│ │ │ │ -
std::allocator< T > type
Definition allocator.hh:21
│ │ │ │ -
typename T::allocator_type type
Definition allocator.hh:27
│ │ │ │ -
Definition allocator.hh:31
│ │ │ │ +
A Vector class to support different block types.
Definition multitypeblockvector.hh:59
│ │ │ │ +
A Matrix class to support different block types.
Definition multitypeblockmatrix.hh:46
│ │ │ │ +
compile-time parameter for block recursion depth
Definition gsetc.hh:45
│ │ │ │ +
@ recursion_level
Definition gsetc.hh:46
│ │ │ │ +
Definition gsetc.hh:69
│ │ │ │ +
static void butsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:90
│ │ │ │ +
static void bltsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:71
│ │ │ │ +
static void bltsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:114
│ │ │ │ +
static void butsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:120
│ │ │ │ +
static void bltsolve(const M &A, X &v, const Y &d, const K &)
Definition gsetc.hh:129
│ │ │ │ +
static void butsolve(const M &A, X &v, const Y &d, const K &)
Definition gsetc.hh:134
│ │ │ │ +
static void bltsolve(const M &, X &v, const Y &d, const K &w)
Definition gsetc.hh:142
│ │ │ │ +
static void butsolve(const M &, X &v, const Y &d, const K &w)
Definition gsetc.hh:148
│ │ │ │ +
static void bltsolve(const M &, X &v, const Y &d, const K &)
Definition gsetc.hh:157
│ │ │ │ +
static void butsolve(const M &, X &v, const Y &d, const K &)
Definition gsetc.hh:162
│ │ │ │ +
Definition gsetc.hh:294
│ │ │ │ +
static void bdsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:296
│ │ │ │ +
static void bdsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:316
│ │ │ │ +
static void bdsolve(const M &A, X &v, const Y &d, const K &)
Definition gsetc.hh:325
│ │ │ │ +
Definition gsetc.hh:375
│ │ │ │ +
static void bsorb(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:461
│ │ │ │ +
static void bsorf(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:418
│ │ │ │ +
static void dbjac(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:504
│ │ │ │ +
static void dbgs(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:378
│ │ │ │ +
static void dbgs(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:545
│ │ │ │ +
static void dbjac(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:560
│ │ │ │ +
static void bsorf(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:550
│ │ │ │ +
static void bsorb(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:555
│ │ │ │ +
static void dbgs(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:571
│ │ │ │ +
static void dbjac(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:608
│ │ │ │ +
static void bsorf(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:583
│ │ │ │ +
static void bsorb(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:595
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,80 +1,832 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -allocator.hh │ │ │ │ │ +gsetc.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -3#ifndef DUNE_ISTL_ALLOCATOR_HH │ │ │ │ │ -4#define DUNE_ISTL_ALLOCATOR_HH │ │ │ │ │ -5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -_1_1namespace _D_u_n_e { │ │ │ │ │ -12 │ │ │ │ │ -13 template │ │ │ │ │ -_1_4 struct _e_x_i_s_t_s{ │ │ │ │ │ -_1_5 static const bool _v_a_l_u_e = true; │ │ │ │ │ -16 }; │ │ │ │ │ -17 │ │ │ │ │ -18 template │ │ │ │ │ -_1_9 struct _D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s │ │ │ │ │ -20 { │ │ │ │ │ -_2_1 using _t_y_p_e = std::allocator; │ │ │ │ │ -22 }; │ │ │ │ │ -23 │ │ │ │ │ -24 template │ │ │ │ │ -_2_5 struct _D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s > │ │ │ │ │ -26 { │ │ │ │ │ -_2_7 using _t_y_p_e = typename T::allocator_type; │ │ │ │ │ -28 }; │ │ │ │ │ -29 │ │ │ │ │ -30 template │ │ │ │ │ -_3_1 struct _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s : public _D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s {}; │ │ │ │ │ -32 │ │ │ │ │ -33 template │ │ │ │ │ -_3_4 using _A_l_l_o_c_a_t_o_r_T_y_p_e = typename _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_T_>_:_:_t_y_p_e; │ │ │ │ │ -35 │ │ │ │ │ -36 template │ │ │ │ │ -_3_7 using _R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e = typename std::allocator_traits::type>::template rebind_alloc; │ │ │ │ │ -38 │ │ │ │ │ -39} // end namespace Dune │ │ │ │ │ -40 │ │ │ │ │ -41#endif // DUNE_ISTL_ALLOCATOR_HH │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +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_GSETC_HH │ │ │ │ │ +6#define DUNE_ISTL_GSETC_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13 │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h" │ │ │ │ │ +17#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h" │ │ │ │ │ +18 │ │ │ │ │ +19#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +20 │ │ │ │ │ +21 │ │ │ │ │ +27namespace _D_u_n_e { │ │ │ │ │ +28 │ │ │ │ │ +39 //============================================================ │ │ │ │ │ +40 // parameter types │ │ │ │ │ +41 //============================================================ │ │ │ │ │ +42 │ │ │ │ │ +44 template │ │ │ │ │ +_4_5 struct _B_L { │ │ │ │ │ +_4_6 enum {_r_e_c_u_r_s_i_o_n___l_e_v_e_l = l}; │ │ │ │ │ +47 }; │ │ │ │ │ +48 │ │ │ │ │ +_4_9 enum _W_i_t_h_D_i_a_g_T_y_p_e { │ │ │ │ │ +_5_0 _w_i_t_h_d_i_a_g=1, │ │ │ │ │ +51 _n_o_d_i_a_g=0 │ │ │ │ │ +_5_2 }; │ │ │ │ │ +53 │ │ │ │ │ +_5_4 enum _W_i_t_h_R_e_l_a_x_T_y_p_e { │ │ │ │ │ +_5_5 _w_i_t_h_r_e_l_a_x=1, │ │ │ │ │ +56 _n_o_r_e_l_a_x=0 │ │ │ │ │ +_5_7 }; │ │ │ │ │ +58 │ │ │ │ │ +59 //============================================================ │ │ │ │ │ +60 // generic triangular solves │ │ │ │ │ +61 // consider block decomposition A = L + D + U │ │ │ │ │ +62 // we can invert L, L+D, U, U+D │ │ │ │ │ +63 // we can apply relaxation or not │ │ │ │ │ +64 // we can recurse over a fixed number of levels │ │ │ │ │ +65 //============================================================ │ │ │ │ │ +66 │ │ │ │ │ +67 // template meta program for triangular solves │ │ │ │ │ +68 template │ │ │ │ │ +_6_9 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e { │ │ │ │ │ +70 template │ │ │ │ │ +_7_1 static void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +72 { │ │ │ │ │ +73 // iterator types │ │ │ │ │ +74 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +75 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +76 typedef typename Y::block_type bblock; │ │ │ │ │ +77 │ │ │ │ │ +78 // local solve at each block and immediate update │ │ │ │ │ +79 rowiterator endi=A.end(); │ │ │ │ │ +80 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +81 { │ │ │ │ │ +82 bblock rhs(d[i.index()]); │ │ │ │ │ +83 coliterator j; │ │ │ │ │ +84 for (j=(*i).begin(); j.index()_:_:_b_l_t_s_o_l_v_e(*j,v[i.index()],rhs,w); │ │ │ │ │ +87 } │ │ │ │ │ +88 } │ │ │ │ │ +89 template │ │ │ │ │ +_9_0 static void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +91 { │ │ │ │ │ +92 // iterator types │ │ │ │ │ +93 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +94 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +95 typedef typename Y::block_type bblock; │ │ │ │ │ +96 │ │ │ │ │ +97 // local solve at each block and immediate update │ │ │ │ │ +98 rowiterator rendi=A.beforeBegin(); │ │ │ │ │ +99 for (rowiterator i=A.beforeEnd(); i!=rendi; --i) │ │ │ │ │ +100 { │ │ │ │ │ +101 bblock rhs(d[i.index()]); │ │ │ │ │ +102 coliterator j; │ │ │ │ │ +103 for (j=(*i).beforeEnd(); j.index()>i.index(); --j) │ │ │ │ │ +104 (*j).mmv(v[j.index()],rhs); │ │ │ │ │ +105 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_I_-_1_,_d_i_a_g_,_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(*j,v[i.index()],rhs,w); │ │ │ │ │ +106 } │ │ │ │ │ +107 } │ │ │ │ │ +108 }; │ │ │ │ │ +109 │ │ │ │ │ +110 // recursion end ... │ │ │ │ │ +111 template<> │ │ │ │ │ +_1_1_2 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_w_i_t_h_d_i_a_g,_w_i_t_h_r_e_l_a_x> { │ │ │ │ │ +113 template │ │ │ │ │ +_1_1_4 static void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +115 { │ │ │ │ │ +116 A.solve(v,d); │ │ │ │ │ +117 v *= w; │ │ │ │ │ +118 } │ │ │ │ │ +119 template │ │ │ │ │ +_1_2_0 static void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +121 { │ │ │ │ │ +122 A.solve(v,d); │ │ │ │ │ +123 v *= w; │ │ │ │ │ +124 } │ │ │ │ │ +125 }; │ │ │ │ │ +126 template<> │ │ │ │ │ +_1_2_7 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_w_i_t_h_d_i_a_g,_n_o_r_e_l_a_x> { │ │ │ │ │ +128 template │ │ │ │ │ +_1_2_9 static void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ +130 { │ │ │ │ │ +131 A.solve(v,d); │ │ │ │ │ +132 } │ │ │ │ │ +133 template │ │ │ │ │ +_1_3_4 static void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ +135 { │ │ │ │ │ +136 A.solve(v,d); │ │ │ │ │ +137 } │ │ │ │ │ +138 }; │ │ │ │ │ +139 template<> │ │ │ │ │ +_1_4_0 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_n_o_d_i_a_g,_w_i_t_h_r_e_l_a_x> { │ │ │ │ │ +141 template │ │ │ │ │ +_1_4_2 static void _b_l_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& w) │ │ │ │ │ +143 { │ │ │ │ │ +144 v = d; │ │ │ │ │ +145 v *= w; │ │ │ │ │ +146 } │ │ │ │ │ +147 template │ │ │ │ │ +_1_4_8 static void _b_u_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& w) │ │ │ │ │ +149 { │ │ │ │ │ +150 v = d; │ │ │ │ │ +151 v *= w; │ │ │ │ │ +152 } │ │ │ │ │ +153 }; │ │ │ │ │ +154 template<> │ │ │ │ │ +_1_5_5 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_n_o_d_i_a_g,_n_o_r_e_l_a_x> { │ │ │ │ │ +156 template │ │ │ │ │ +_1_5_7 static void _b_l_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ +158 { │ │ │ │ │ +159 v = d; │ │ │ │ │ +160 } │ │ │ │ │ +161 template │ │ │ │ │ +_1_6_2 static void _b_u_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ +163 { │ │ │ │ │ +164 v = d; │ │ │ │ │ +165 } │ │ │ │ │ +166 }; │ │ │ │ │ +167 │ │ │ │ │ +168 │ │ │ │ │ +169 // user calls │ │ │ │ │ +170 │ │ │ │ │ +171 // default block recursion level = 1 │ │ │ │ │ +172 │ │ │ │ │ +174 template │ │ │ │ │ +_1_7_5 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ +176 { │ │ │ │ │ +177 typename X::field_type w=1; │ │ │ │ │ +178 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +179 } │ │ │ │ │ +181 template │ │ │ │ │ +_1_8_2 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +183 { │ │ │ │ │ +184 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +185 } │ │ │ │ │ +187 template │ │ │ │ │ +_1_8_8 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ +189 { │ │ │ │ │ +190 typename X::field_type w=1; │ │ │ │ │ +191 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +192 } │ │ │ │ │ +194 template │ │ │ │ │ +_1_9_5 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +196 { │ │ │ │ │ +197 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +198 } │ │ │ │ │ +199 │ │ │ │ │ +201 template │ │ │ │ │ +_2_0_2 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ +203 { │ │ │ │ │ +204 typename X::field_type w=1; │ │ │ │ │ +205 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +206 } │ │ │ │ │ +208 template │ │ │ │ │ +_2_0_9 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +210 { │ │ │ │ │ +211 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +212 } │ │ │ │ │ +214 template │ │ │ │ │ +_2_1_5 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ +216 { │ │ │ │ │ +217 typename X::field_type w=1; │ │ │ │ │ +218 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +219 } │ │ │ │ │ +221 template │ │ │ │ │ +_2_2_2 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +223 { │ │ │ │ │ +224 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +225 } │ │ │ │ │ +226 │ │ │ │ │ +227 // general block recursion level >= 0 │ │ │ │ │ +228 │ │ │ │ │ +230 template │ │ │ │ │ +_2_3_1 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> /*bl*/) │ │ │ │ │ +232 { │ │ │ │ │ +233 typename X::field_type w=1; │ │ │ │ │ +234 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +235 } │ │ │ │ │ +237 template │ │ │ │ │ +_2_3_8 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ +239 { │ │ │ │ │ +240 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +241 } │ │ │ │ │ +243 template │ │ │ │ │ +_2_4_4 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> /*bl*/) │ │ │ │ │ +245 { │ │ │ │ │ +246 typename X::field_type w=1; │ │ │ │ │ +247 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +248 } │ │ │ │ │ +250 template │ │ │ │ │ +_2_5_1 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ +252 { │ │ │ │ │ +253 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +254 } │ │ │ │ │ +255 │ │ │ │ │ +257 template │ │ │ │ │ +_2_5_8 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> bl) │ │ │ │ │ +259 { │ │ │ │ │ +260 typename X::field_type w=1; │ │ │ │ │ +261 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +262 } │ │ │ │ │ +264 template │ │ │ │ │ +_2_6_5 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> bl) │ │ │ │ │ +266 { │ │ │ │ │ +267 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +268 } │ │ │ │ │ +270 template │ │ │ │ │ +_2_7_1 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> bl) │ │ │ │ │ +272 { │ │ │ │ │ +273 typename X::field_type w=1; │ │ │ │ │ +274 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +275 } │ │ │ │ │ +277 template │ │ │ │ │ +_2_7_8 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> bl) │ │ │ │ │ +279 { │ │ │ │ │ +280 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +281 } │ │ │ │ │ +282 │ │ │ │ │ +283 │ │ │ │ │ +284 │ │ │ │ │ +285 //============================================================ │ │ │ │ │ +286 // generic block diagonal solves │ │ │ │ │ +287 // consider block decomposition A = L + D + U │ │ │ │ │ +288 // we can apply relaxation or not │ │ │ │ │ +289 // we can recurse over a fixed number of levels │ │ │ │ │ +290 //============================================================ │ │ │ │ │ +291 │ │ │ │ │ +292 // template meta program for diagonal solves │ │ │ │ │ +293 template │ │ │ │ │ +_2_9_4 struct _a_l_g_m_e_t_a___b_d_s_o_l_v_e { │ │ │ │ │ +295 template │ │ │ │ │ +_2_9_6 static void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +297 { │ │ │ │ │ +298 // iterator types │ │ │ │ │ +299 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +300 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +301 │ │ │ │ │ +302 // local solve at each block and immediate update │ │ │ │ │ +303 rowiterator rendi=A.beforeBegin(); │ │ │ │ │ +304 for (rowiterator i=A.beforeEnd(); i!=rendi; --i) │ │ │ │ │ +305 { │ │ │ │ │ +306 coliterator ii=(*i).find(i.index()); │ │ │ │ │ +307 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_I_-_1_,_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(*ii,v[i.index()],d[i.index()],w); │ │ │ │ │ +308 } │ │ │ │ │ +309 } │ │ │ │ │ +310 }; │ │ │ │ │ +311 │ │ │ │ │ +312 // recursion end ... │ │ │ │ │ +313 template<> │ │ │ │ │ +_3_1_4 struct _a_l_g_m_e_t_a___b_d_s_o_l_v_e<0,_w_i_t_h_r_e_l_a_x> { │ │ │ │ │ +315 template │ │ │ │ │ +_3_1_6 static void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +317 { │ │ │ │ │ +318 A.solve(v,d); │ │ │ │ │ +319 v *= w; │ │ │ │ │ +320 } │ │ │ │ │ +321 }; │ │ │ │ │ +322 template<> │ │ │ │ │ +_3_2_3 struct _a_l_g_m_e_t_a___b_d_s_o_l_v_e<0,_n_o_r_e_l_a_x> { │ │ │ │ │ +324 template │ │ │ │ │ +_3_2_5 static void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ +326 { │ │ │ │ │ +327 A.solve(v,d); │ │ │ │ │ +328 } │ │ │ │ │ +329 }; │ │ │ │ │ +330 │ │ │ │ │ +331 // user calls │ │ │ │ │ +332 │ │ │ │ │ +333 // default block recursion level = 1 │ │ │ │ │ +334 │ │ │ │ │ +336 template │ │ │ │ │ +_3_3_7 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ +338 { │ │ │ │ │ +339 typename X::field_type w=1; │ │ │ │ │ +340 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_1_,_n_o_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +341 } │ │ │ │ │ +343 template │ │ │ │ │ +_3_4_4 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +345 { │ │ │ │ │ +346 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_1_,_w_i_t_h_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +347 } │ │ │ │ │ +348 │ │ │ │ │ +349 // general block recursion level >= 0 │ │ │ │ │ +350 │ │ │ │ │ +352 template │ │ │ │ │ +_3_5_3 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> /*bl*/) │ │ │ │ │ +354 { │ │ │ │ │ +355 typename X::field_type w=1; │ │ │ │ │ +356 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_l_,_n_o_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +357 } │ │ │ │ │ +359 template │ │ │ │ │ +_3_6_0 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ +361 { │ │ │ │ │ +362 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_l_,_w_i_t_h_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ +363 } │ │ │ │ │ +364 │ │ │ │ │ +365 │ │ │ │ │ +366 //============================================================ │ │ │ │ │ +367 // generic steps of iteration methods │ │ │ │ │ +368 // Jacobi, Gauss-Seidel, SOR, SSOR │ │ │ │ │ +369 // work directly on Ax=b, ie solve M(x^{i+1}-x^i) = w (b-Ax^i) │ │ │ │ │ +370 // we can recurse over a fixed number of levels │ │ │ │ │ +371 //============================================================ │ │ │ │ │ +372 │ │ │ │ │ +373 // template meta program for iterative solver steps │ │ │ │ │ +374 template │ │ │ │ │ +_3_7_5 struct _a_l_g_m_e_t_a___i_t_s_t_e_p_s { │ │ │ │ │ +376 │ │ │ │ │ +377 template │ │ │ │ │ +_3_7_8 static void _d_b_g_s (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +379 { │ │ │ │ │ +380 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +381 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +382 typedef typename Y::block_type bblock; │ │ │ │ │ +383 bblock rhs; │ │ │ │ │ +384 │ │ │ │ │ +385 X xold(x); // remember old x │ │ │ │ │ +386 │ │ │ │ │ +387 rowiterator endi=A.end(); │ │ │ │ │ +388 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +389 { │ │ │ │ │ +390 rhs = b[i.index()]; // rhs = b_i │ │ │ │ │ +391 coliterator endj=(*i).end(); │ │ │ │ │ +392 coliterator j=(*i).begin(); │ │ │ │ │ +393 if constexpr (IsNumber()) │ │ │ │ │ +394 { │ │ │ │ │ +395 for (; j.index() i │ │ │ │ │ +408 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j>i} a_ij * xold_j │ │ │ │ │ +409 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_t_y_p_e_n_a_m_e_ _M_:_:_b_l_o_c_k___t_y_p_e_>_:_:_d_b_g_s(*diag,x[i.index │ │ │ │ │ +()],rhs,w); // if I==1: xnew_i = rhs/a_ii │ │ │ │ │ +410 } │ │ │ │ │ +411 } │ │ │ │ │ +412 // next two lines: xnew_i = w / a_ii * (b_i - sum_{j=i} a_ij * xold_j) + (1-w)*xold; │ │ │ │ │ +413 x *= w; │ │ │ │ │ +414 x.axpy(K(1)-w,xold); │ │ │ │ │ +415 } │ │ │ │ │ +416 │ │ │ │ │ +417 template │ │ │ │ │ +_4_1_8 static void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +419 { │ │ │ │ │ +420 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +421 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +422 typedef typename Y::block_type bblock; │ │ │ │ │ +423 typedef typename X::block_type xblock; │ │ │ │ │ +424 bblock rhs; │ │ │ │ │ +425 xblock v; │ │ │ │ │ +426 │ │ │ │ │ +427 // Initialize nested data structure if there are entries │ │ │ │ │ +428 if(A.begin()!=A.end()) │ │ │ │ │ +429 v=x[0]; │ │ │ │ │ +430 │ │ │ │ │ +431 rowiterator endi=A.end(); │ │ │ │ │ +432 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +433 { │ │ │ │ │ +434 rhs = b[i.index()]; // rhs = b_i │ │ │ │ │ +435 coliterator endj=(*i).end(); // iterate over a_ij with j < i │ │ │ │ │ +436 coliterator j=(*i).begin(); │ │ │ │ │ +437 if constexpr (IsNumber()) │ │ │ │ │ +438 { │ │ │ │ │ +439 for (; j.index()=i} a_ij * xold_j) │ │ │ │ │ +446 } │ │ │ │ │ +447 else │ │ │ │ │ +448 { │ │ │ │ │ +449 for (; j.index()_:_:_b_s_o_r_f(*diag,v,rhs,w); // if │ │ │ │ │ +blocksize I==1: v = rhs/a_ii │ │ │ │ │ +455 x[i.index()].axpy(w,v); // x_i = w / a_ii * (b_i - sum_{j=i} a_ij * xold_j) │ │ │ │ │ +456 } │ │ │ │ │ +457 } │ │ │ │ │ +458 } │ │ │ │ │ +459 │ │ │ │ │ +460 template │ │ │ │ │ +_4_6_1 static void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +462 { │ │ │ │ │ +463 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +464 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +465 typedef typename Y::block_type bblock; │ │ │ │ │ +466 typedef typename X::block_type xblock; │ │ │ │ │ +467 bblock rhs; │ │ │ │ │ +468 xblock v; │ │ │ │ │ +469 │ │ │ │ │ +470 // Initialize nested data structure if there are entries │ │ │ │ │ +471 if(A.begin()!=A.end()) │ │ │ │ │ +472 v=x[0]; │ │ │ │ │ +473 │ │ │ │ │ +474 rowiterator endi=A.beforeBegin(); │ │ │ │ │ +475 for (rowiterator i=A.beforeEnd(); i!=endi; --i) │ │ │ │ │ +476 { │ │ │ │ │ +477 rhs = b[i.index()]; │ │ │ │ │ +478 coliterator endj=(*i).end(); │ │ │ │ │ +479 coliterator j=(*i).begin(); │ │ │ │ │ +480 if constexpr (IsNumber()) │ │ │ │ │ +481 { │ │ │ │ │ +482 for (; j.index()mmv(x[j.index()],rhs); │ │ │ │ │ +494 coliterator diag=j; │ │ │ │ │ +495 for (; j!=endj; ++j) │ │ │ │ │ +496 j->mmv(x[j.index()],rhs); │ │ │ │ │ +497 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_t_y_p_e_n_a_m_e_ _M_:_:_b_l_o_c_k___t_y_p_e_>_:_:_b_s_o_r_b(*diag,v,rhs,w); │ │ │ │ │ +498 x[i.index()].axpy(w,v); │ │ │ │ │ +499 } │ │ │ │ │ +500 } │ │ │ │ │ +501 } │ │ │ │ │ +502 │ │ │ │ │ +503 template │ │ │ │ │ +_5_0_4 static void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +505 { │ │ │ │ │ +506 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +507 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +508 typedef typename Y::block_type bblock; │ │ │ │ │ +509 bblock rhs; │ │ │ │ │ +510 │ │ │ │ │ +511 X v(x); // allocate with same size │ │ │ │ │ +512 │ │ │ │ │ +513 rowiterator endi=A.end(); │ │ │ │ │ +514 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +515 { │ │ │ │ │ +516 rhs = b[i.index()]; │ │ │ │ │ +517 coliterator endj=(*i).end(); │ │ │ │ │ +518 coliterator j=(*i).begin(); │ │ │ │ │ +519 if constexpr (IsNumber()) │ │ │ │ │ +520 { │ │ │ │ │ +521 for (; j.index()mmv(x[j.index()],rhs); │ │ │ │ │ +532 coliterator diag=j; │ │ │ │ │ +533 for (; j!=endj; ++j) │ │ │ │ │ +534 j->mmv(x[j.index()],rhs); │ │ │ │ │ +535 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_t_y_p_e_n_a_m_e_ _M_:_:_b_l_o_c_k___t_y_p_e_>_:_:_d_b_j_a_c(*diag,v[i.index │ │ │ │ │ +()],rhs,w); │ │ │ │ │ +536 } │ │ │ │ │ +537 } │ │ │ │ │ +538 x.axpy(w,v); │ │ │ │ │ +539 } │ │ │ │ │ +540 }; │ │ │ │ │ +541 // end of recursion │ │ │ │ │ +542 template │ │ │ │ │ +_5_4_3 struct _a_l_g_m_e_t_a___i_t_s_t_e_p_s<0,M> { │ │ │ │ │ +544 template │ │ │ │ │ +_5_4_5 static void _d_b_g_s (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ +546 { │ │ │ │ │ +547 A.solve(x,b); │ │ │ │ │ +548 } │ │ │ │ │ +549 template │ │ │ │ │ +_5_5_0 static void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ +551 { │ │ │ │ │ +552 A.solve(x,b); │ │ │ │ │ +553 } │ │ │ │ │ +554 template │ │ │ │ │ +_5_5_5 static void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ +556 { │ │ │ │ │ +557 A.solve(x,b); │ │ │ │ │ +558 } │ │ │ │ │ +559 template │ │ │ │ │ +_5_6_0 static void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ +561 { │ │ │ │ │ +562 A.solve(x,b); │ │ │ │ │ +563 } │ │ │ │ │ +564 }; │ │ │ │ │ +565 │ │ │ │ │ +566 template │ │ │ │ │ +_5_6_7 struct _a_l_g_m_e_t_a___i_t_s_t_e_p_s> │ │ │ │ │ +{ │ │ │ │ │ +568 template< │ │ │ │ │ +569 typename... MultiTypeVectorArgs, │ │ │ │ │ +570 class K> │ │ │ │ │ +_5_7_1 static void _d_b_g_s (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ +A, │ │ │ │ │ +572 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ +573 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ +574 const K& w) │ │ │ │ │ +575 { │ │ │ │ │ +576 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ +577 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_0_,_N_>_:_:_d_b_g_s(A, x, b, w); │ │ │ │ │ +578 } │ │ │ │ │ +579 │ │ │ │ │ +580 template< │ │ │ │ │ +581 typename... MultiTypeVectorArgs, │ │ │ │ │ +582 class K> │ │ │ │ │ +_5_8_3 static void _b_s_o_r_f (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ +A, │ │ │ │ │ +584 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ +585 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ +586 const K& w) │ │ │ │ │ +587 { │ │ │ │ │ +588 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ +589 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_0_,_N_>_:_:_b_s_o_r_f(A, x, b, w); │ │ │ │ │ +590 } │ │ │ │ │ +591 │ │ │ │ │ +592 template< │ │ │ │ │ +593 typename... MultiTypeVectorArgs, │ │ │ │ │ +594 class K> │ │ │ │ │ +_5_9_5 static void _b_s_o_r_b (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ +A, │ │ │ │ │ +596 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ +597 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ +598 const K& w) │ │ │ │ │ +599 { │ │ │ │ │ +600 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ +601 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_N_-_1_,_N_>_:_:_b_s_o_r_b(A, x, b, w); │ │ │ │ │ +602 } │ │ │ │ │ +603 │ │ │ │ │ +604 template< │ │ │ │ │ +605 typename... MultiTypeVectorArgs, │ │ │ │ │ +606 class K │ │ │ │ │ +607 > │ │ │ │ │ +_6_0_8 static void _d_b_j_a_c (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ +A, │ │ │ │ │ +609 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ +610 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ +611 const K& w) │ │ │ │ │ +612 { │ │ │ │ │ +613 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ +614 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_0_,_N_>_:_:_d_b_j_a_c(A, x, b, w); │ │ │ │ │ +615 } │ │ │ │ │ +616 }; │ │ │ │ │ +617 │ │ │ │ │ +618 // user calls │ │ │ │ │ +619 │ │ │ │ │ +621 template │ │ │ │ │ +_6_2_2 void _d_b_g_s (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +623 { │ │ │ │ │ +624 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_d_b_g_s(A,x,b,w); │ │ │ │ │ +625 } │ │ │ │ │ +627 template │ │ │ │ │ +_6_2_8 void _d_b_g_s (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ +629 { │ │ │ │ │ +630 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_M_>_:_:_d_b_g_s(A,x,b,w); │ │ │ │ │ +631 } │ │ │ │ │ +633 template │ │ │ │ │ +_6_3_4 void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +635 { │ │ │ │ │ +636 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_b_s_o_r_f(A,x,b,w); │ │ │ │ │ +637 } │ │ │ │ │ +639 template │ │ │ │ │ +_6_4_0 void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ +641 { │ │ │ │ │ +642 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_M_>_:_:_b_s_o_r_f(A,x,b,w); │ │ │ │ │ +643 } │ │ │ │ │ +645 template │ │ │ │ │ +_6_4_6 void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +647 { │ │ │ │ │ +648 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_b_s_o_r_b(A,x,b,w); │ │ │ │ │ +649 } │ │ │ │ │ +651 template │ │ │ │ │ +_6_5_2 void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ +653 { │ │ │ │ │ +654 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_t_y_p_e_n_a_m_e_ _s_t_d_:_:_r_e_m_o_v_e___c_v_<_M_>_:_:_t_y_p_e>_:_:_b_s_o_r_b(A,x,b,w); │ │ │ │ │ +655 } │ │ │ │ │ +657 template │ │ │ │ │ +_6_5_8 void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ +659 { │ │ │ │ │ +660 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_d_b_j_a_c(A,x,b,w); │ │ │ │ │ +661 } │ │ │ │ │ +663 template │ │ │ │ │ +_6_6_4 void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ +665 { │ │ │ │ │ +666 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_M_>_:_:_d_b_j_a_c(A,x,b,w); │ │ │ │ │ +667 } │ │ │ │ │ +668 │ │ │ │ │ +669 │ │ │ │ │ +672} // end namespace │ │ │ │ │ +673 │ │ │ │ │ +674#endif │ │ │ │ │ +_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h │ │ │ │ │ +_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h │ │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:568 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:484 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:540 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_N │ │ │ │ │ +static constexpr size_type N() │ │ │ │ │ +Return the number of matrix rows. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:513 │ │ │ │ │ +_D_u_n_e_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ +void bltsolve(const M &A, X &v, const Y &d) │ │ │ │ │ +block lower triangular solve │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_W_i_t_h_D_i_a_g_T_y_p_e │ │ │ │ │ +WithDiagType │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:49 │ │ │ │ │ +_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_:_:_u_b_l_t_s_o_l_v_e │ │ │ │ │ +void ubltsolve(const M &A, X &v, const Y &d) │ │ │ │ │ +unit block lower triangular solve │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:188 │ │ │ │ │ +_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_:_:_d_b_g_s │ │ │ │ │ +void dbgs(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +GS step. │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:622 │ │ │ │ │ +_D_u_n_e_:_:_W_i_t_h_R_e_l_a_x_T_y_p_e │ │ │ │ │ +WithRelaxType │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_b_d_s_o_l_v_e │ │ │ │ │ +void bdsolve(const M &A, X &v, const Y &d) │ │ │ │ │ +block diagonal solve, no relaxation │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:337 │ │ │ │ │ +_D_u_n_e_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ +void butsolve(const M &A, X &v, const Y &d) │ │ │ │ │ +block upper triangular solve │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:202 │ │ │ │ │ +_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_:_:_u_b_u_t_s_o_l_v_e │ │ │ │ │ +void ubutsolve(const M &A, X &v, const Y &d) │ │ │ │ │ +unit block upper triangular solve │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:215 │ │ │ │ │ +_D_u_n_e_:_:_n_o_d_i_a_g │ │ │ │ │ +@ nodiag │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_w_i_t_h_d_i_a_g │ │ │ │ │ +@ withdiag │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_n_o_r_e_l_a_x │ │ │ │ │ +@ norelax │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_w_i_t_h_r_e_l_a_x │ │ │ │ │ +@ withrelax │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:55 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_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_:_:_A_l_l_o_c_a_t_o_r_T_y_p_e │ │ │ │ │ -typename AllocatorTraits< T >::type AllocatorType │ │ │ │ │ -DDeeffiinniittiioonn allocator.hh:34 │ │ │ │ │ -_D_u_n_e_:_:_e_x_i_s_t_s │ │ │ │ │ -DDeeffiinniittiioonn allocator.hh:14 │ │ │ │ │ -_D_u_n_e_:_:_e_x_i_s_t_s_:_:_v_a_l_u_e │ │ │ │ │ -static const bool value │ │ │ │ │ -DDeeffiinniittiioonn allocator.hh:15 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn allocator.hh:20 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ -std::allocator< T > type │ │ │ │ │ -DDeeffiinniittiioonn allocator.hh:21 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _t_y_p_e_n_a_m_e_ _T_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e_ _>_ _>_:_: │ │ │ │ │ -_t_y_p_e │ │ │ │ │ -typename T::allocator_type type │ │ │ │ │ -DDeeffiinniittiioonn allocator.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn allocator.hh:31 │ │ │ │ │ +_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 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ +A Matrix class to support different block types. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_B_L │ │ │ │ │ +compile-time parameter for block recursion depth │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_B_L_:_:_r_e_c_u_r_s_i_o_n___l_e_v_e_l │ │ │ │ │ +@ recursion_level │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ +static void butsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ +static void bltsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ +static void bltsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:114 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ +static void butsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ +static void bltsolve(const M &A, X &v, const Y &d, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ +static void butsolve(const M &A, X &v, const Y &d, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:134 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ +static void bltsolve(const M &, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ +static void butsolve(const M &, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:148 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ +static void bltsolve(const M &, X &v, const Y &d, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ +static void butsolve(const M &, X &v, const Y &d, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:162 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:294 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_:_:_b_d_s_o_l_v_e │ │ │ │ │ +static void bdsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:296 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_d_s_o_l_v_e │ │ │ │ │ +static void bdsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:316 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _n_o_r_e_l_a_x_ _>_:_:_b_d_s_o_l_v_e │ │ │ │ │ +static void bdsolve(const M &A, X &v, const Y &d, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:325 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:375 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:461 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:418 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:504 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:378 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:545 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:550 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:555 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ +_>_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ +MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ +MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:571 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ +_>_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ +MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ +MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:608 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ +_>_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ +MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ +MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:583 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ +_>_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ +MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ +MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:595 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvercategory.hh File Reference │ │ │ │ +dune-istl: ldl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,35 +71,65 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
solvercategory.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#include <dune/common/exceptions.hh>
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#include <iostream>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/istl/bccsmatrixinitializer.hh>
│ │ │ │ +#include <dune/istl/solvers.hh>
│ │ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ │ +#include <dune/istl/solverfactory.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::SolverCategory
 Categories for the solvers. More...
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 > > >
 
class  Dune::InvalidSolverCategory
struct  Dune::LDLCreator
 
struct  Dune::LDLCreator::isValidBlock< F >
 
struct  Dune::LDLCreator::isValidBlock< FieldVector< double, k > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

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

Detailed Description

│ │ │ │ +

Class for using LDL with ISTL matrices.

│ │ │ │ +
Author
Marco Agnese, Andrea Sacconi
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,21 +1,50 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -solvercategory.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 │ │ │ │ │ +ldl.hh File Reference │ │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) │ │ │ │ │ +Class for using LDL with ISTL matrices. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_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_:_:_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_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ │ + class   _D_u_n_e_:_:_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_ _>_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _d_o_u_b_l_e_,_ _k_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("ldl", _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r()) │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Class for using LDL with ISTL matrices. │ │ │ │ │ + Author │ │ │ │ │ + Marco Agnese, Andrea Sacconi │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ │ @@ -21,873 +21,4947 @@ │ │ │ │ 00000140: 2267 656e 6572 6174 6f72 2220 636f 6e74 "generator" cont │ │ │ │ 00000150: 656e 743d 2244 6f78 7967 656e 2031 2e39 ent="Doxygen 1.9 │ │ │ │ 00000160: 2e38 222f 3e0a 3c6d 6574 6120 6e61 6d65 .8"/>..dune-istl: so │ │ │ │ -000001c0: 6c76 6572 6361 7465 676f 7279 2e68 6820 lvercategory.hh │ │ │ │ -000001d0: 536f 7572 6365 2046 696c 653c 2f74 6974 Source File.... │ │ │ │ -00000350: 3c2f 7363 7269 7074 3e0a 3c6c 696e 6b20 ...< │ │ │ │ -000003a0: 626f 6479 3e0a 3c64 6976 2069 643d 2274 body>.
... . . . .
.
dune │ │ │ │ -00000480: 2d69 7374 6c3c 7370 616e 2069 643d 2270 -istl&# │ │ │ │ -000004a0: 3136 303b 322e 392e 303c 2f73 7061 6e3e 160;2.9.0 │ │ │ │ -000004b0: 0a20 2020 3c2f 6469 763e 0a20 203c 2f74 .
. .
.
.. │ │ │ │ -00000520: 0a3c 7363 7269 7074 2074 7970 653d 2274 ..< │ │ │ │ -00000630: 2f73 6372 6970 743e 0a3c 7363 7269 7074 /script>.. │ │ │ │ -00000670: 3c73 6372 6970 7420 7479 7065 3d22 7465 .< │ │ │ │ +00000280: 2f73 6372 6970 743e 0a3c 6c69 6e6b 2068 /script>...< │ │ │ │ +00000310: 7363 7269 7074 2074 7970 653d 2274 6578 script type="tex │ │ │ │ +00000320: 742f 6a61 7661 7363 7269 7074 2220 7372 t/javascript" sr │ │ │ │ +00000330: 633d 2273 6561 7263 682f 7365 6172 6368 c="search/search │ │ │ │ +00000340: 2e6a 7322 3e3c 2f73 6372 6970 743e 0a3c .js">.< │ │ │ │ +00000350: 6c69 6e6b 2068 7265 663d 2264 6f78 7967 link href="doxyg │ │ │ │ +00000360: 656e 2e63 7373 2220 7265 6c3d 2273 7479 en.css" rel="sty │ │ │ │ +00000370: 6c65 7368 6565 7422 2074 7970 653d 2274 lesheet" type="t │ │ │ │ +00000380: 6578 742f 6373 7322 202f 3e0a 3c2f 6865 ext/css" />...
.... │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Enumerations | │ │ │ │ -Functions
│ │ │ │ -
gsetc.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way. │ │ │ │ +

Define general, extensible interface for operators. The available implementation wraps a matrix. │ │ │ │ More...

│ │ │ │
#include <cmath>
│ │ │ │ #include <complex>
│ │ │ │ #include <iostream>
│ │ │ │ #include <iomanip>
│ │ │ │ #include <string>
│ │ │ │ -#include <dune/common/hybridutilities.hh>
│ │ │ │ -#include "multitypeblockvector.hh"
│ │ │ │ -#include "multitypeblockmatrix.hh"
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/shared_ptr.hh>
│ │ │ │ +#include "solvercategory.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::BL< l >
 compile-time parameter for block recursion depth More...
class  Dune::LinearOperator< X, Y >
 A linear operator. More...
 
struct  Dune::algmeta_btsolve< I, diag, relax >
class  Dune::AssembledLinearOperator< M, X, Y >
 A linear operator exporting itself in matrix form. More...
 
struct  Dune::algmeta_btsolve< 0, withdiag, withrelax >
 
struct  Dune::algmeta_btsolve< 0, withdiag, norelax >
 
struct  Dune::algmeta_btsolve< 0, nodiag, withrelax >
 
struct  Dune::algmeta_btsolve< 0, nodiag, norelax >
 
struct  Dune::algmeta_bdsolve< I, relax >
 
struct  Dune::algmeta_bdsolve< 0, withrelax >
 
struct  Dune::algmeta_bdsolve< 0, norelax >
 
struct  Dune::algmeta_itsteps< I, M >
 
struct  Dune::algmeta_itsteps< 0, M >
 
struct  Dune::algmeta_itsteps< I, MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > >
class  Dune::MatrixAdapter< M, X, Y >
 Adapter to turn a matrix into a linear operator. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Enumerations

enum  Dune::WithDiagType { Dune::withdiag =1 │ │ │ │ -, Dune::nodiag =0 │ │ │ │ - }
 
enum  Dune::WithRelaxType { Dune::withrelax =1 │ │ │ │ -, Dune::norelax =0 │ │ │ │ - }
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

template<class M , class X , class Y >
void Dune::bltsolve (const M &A, X &v, const Y &d)
 block lower triangular solve
 
template<class M , class X , class Y , class K >
void Dune::bltsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed block lower triangular solve
 
template<class M , class X , class Y >
void Dune::ubltsolve (const M &A, X &v, const Y &d)
 unit block lower triangular solve
 
template<class M , class X , class Y , class K >
void Dune::ubltsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed unit block lower triangular solve
 
template<class M , class X , class Y >
void Dune::butsolve (const M &A, X &v, const Y &d)
 block upper triangular solve
 
template<class M , class X , class Y , class K >
void Dune::butsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed block upper triangular solve
 
template<class M , class X , class Y >
void Dune::ubutsolve (const M &A, X &v, const Y &d)
 unit block upper triangular solve
 
template<class M , class X , class Y , class K >
void Dune::ubutsolve (const M &A, X &v, const Y &d, const K &w)
 relaxed unit block upper triangular solve
 
template<class M , class X , class Y , int l>
void Dune::bltsolve (const M &A, X &v, const Y &d, BL< l >)
 block lower triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::bltsolve (const M &A, X &v, const Y &d, const K &w, BL< l >)
 relaxed block lower triangular solve
 
template<class M , class X , class Y , int l>
void Dune::ubltsolve (const M &A, X &v, const Y &d, BL< l >)
 unit block lower triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::ubltsolve (const M &A, X &v, const Y &d, const K &w, BL< l >)
 relaxed unit block lower triangular solve
 
template<class M , class X , class Y , int l>
void Dune::butsolve (const M &A, X &v, const Y &d, BL< l > bl)
 block upper triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::butsolve (const M &A, X &v, const Y &d, const K &w, BL< l > bl)
 relaxed block upper triangular solve
 
template<class M , class X , class Y , int l>
void Dune::ubutsolve (const M &A, X &v, const Y &d, BL< l > bl)
 unit block upper triangular solve
 
template<class M , class X , class Y , class K , int l>
void Dune::ubutsolve (const M &A, X &v, const Y &d, const K &w, BL< l > bl)
 relaxed unit block upper triangular solve
 
template<class M , class X , class Y >
void Dune::bdsolve (const M &A, X &v, const Y &d)
 block diagonal solve, no relaxation
 
template<class M , class X , class Y , class K >
void Dune::bdsolve (const M &A, X &v, const Y &d, const K &w)
 block diagonal solve, with relaxation
 
template<class M , class X , class Y , int l>
void Dune::bdsolve (const M &A, X &v, const Y &d, BL< l >)
 block diagonal solve, no relaxation
 
template<class M , class X , class Y , class K , int l>
void Dune::bdsolve (const M &A, X &v, const Y &d, const K &w, BL< l >)
 block diagonal solve, with relaxation
 
template<class M , class X , class Y , class K >
void Dune::dbgs (const M &A, X &x, const Y &b, const K &w)
 GS step.
 
template<class M , class X , class Y , class K , int l>
void Dune::dbgs (const M &A, X &x, const Y &b, const K &w, BL< l >)
 GS step.
 
template<class M , class X , class Y , class K >
void Dune::bsorf (const M &A, X &x, const Y &b, const K &w)
 SOR step.
 
template<class M , class X , class Y , class K , int l>
void Dune::bsorf (const M &A, X &x, const Y &b, const K &w, BL< l >)
 SOR step.
 
template<class M , class X , class Y , class K >
void Dune::bsorb (const M &A, X &x, const Y &b, const K &w)
 SSOR step.
 
template<class M , class X , class Y , class K , int l>
void Dune::bsorb (const M &A, X &x, const Y &b, const K &w, BL< l >)
 Backward SOR step.
 
template<class M , class X , class Y , class K >
void Dune::dbjac (const M &A, X &x, const Y &b, const K &w)
 Jacobi step.
 
template<class M , class X , class Y , class K , int l>
void Dune::dbjac (const M &A, X &x, const Y &b, const K &w, BL< l >)
 Jacobi step.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.

│ │ │ │ +

Define general, extensible interface for operators. The available implementation wraps a matrix.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,173 +1,39 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 | _E_n_u_m_e_r_a_t_i_o_n_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -gsetc.hh File Reference │ │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ -generic way. _M_o_r_e_._._. │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +operators.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 » _O_p_e_r_a_t_o_r │ │ │ │ │ +_c_o_n_c_e_p_t │ │ │ │ │ +Define general, extensible interface for operators. The available │ │ │ │ │ +implementation wraps a matrix. _M_o_r_e_._._. │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h" │ │ │ │ │ -#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h" │ │ │ │ │ -#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_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 │ │ │ │ │ -struct   _D_u_n_e_:_:_B_L_<_ _l_ _> │ │ │ │ │ -  compile-time parameter for block recursion depth _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_ _X_,_ _Y_ _> │ │ │ │ │ +  A linear operator. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _I_,_ _d_i_a_g_,_ _r_e_l_a_x_ _> │ │ │ │ │ +class   _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_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ +  A linear operator exporting itself in matrix form. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _n_o_r_e_l_a_x_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _n_o_r_e_l_a_x_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _I_,_ _r_e_l_a_x_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _w_i_t_h_r_e_l_a_x_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _n_o_r_e_l_a_x_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_, │ │ │ │ │ - _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ +  Adapter to turn a matrix into a linear operator. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -EEnnuummeerraattiioonnss │ │ │ │ │ -enum   _D_u_n_e_:_:_W_i_t_h_D_i_a_g_T_y_p_e { _D_u_n_e_:_:_w_i_t_h_d_i_a_g =1 , _D_u_n_e_:_:_n_o_d_i_a_g =0 } │ │ │ │ │ -  │ │ │ │ │ -enum   _D_u_n_e_:_:_W_i_t_h_R_e_l_a_x_T_y_p_e { _D_u_n_e_:_:_w_i_t_h_r_e_l_a_x =1 , _D_u_n_e_:_:_n_o_r_e_l_a_x =0 } │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ -  block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -  relaxed block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ -  unit block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -  relaxed unit block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ -  block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -  relaxed block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ -  unit block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -  relaxed unit block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l >) │ │ │ │ │ -  block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l >) │ │ │ │ │ -  relaxed block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l >) │ │ │ │ │ -  unit block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_l_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l >) │ │ │ │ │ -  relaxed unit block lower triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l > bl) │ │ │ │ │ -  block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l > bl) │ │ │ │ │ -  relaxed block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l > bl) │ │ │ │ │ -  unit block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_u_b_u_t_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l > bl) │ │ │ │ │ -  relaxed unit block upper triangular solve │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ -  block diagonal solve, no relaxation │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -  block diagonal solve, with relaxation │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d, _B_L< l >) │ │ │ │ │ -  block diagonal solve, no relaxation │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_d_s_o_l_v_e (const M &A, X &v, const Y &d, const K &w, _B_L< l >) │ │ │ │ │ -  block diagonal solve, with relaxation │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_d_b_g_s (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -  GS step. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_d_b_g_s (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ -  GS step. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_s_o_r_f (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -  SOR step. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_s_o_r_f (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ -  SOR step. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_s_o_r_b (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -  SSOR step. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_b_s_o_r_b (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ -  Backward SOR step. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_d_b_j_a_c (const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -  Jacobi step. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_d_b_j_a_c (const M &A, X &x, const Y &b, const K &w, _B_L< l >) │ │ │ │ │ -  Jacobi step. │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ -generic way. │ │ │ │ │ +Define general, extensible interface for operators. The available │ │ │ │ │ +implementation wraps a matrix. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: gsetc.hh Source File │ │ │ │ +dune-istl: operators.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,835 +74,170 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
gsetc.hh
│ │ │ │ +
operators.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_GSETC_HH
│ │ │ │ -
6#define DUNE_ISTL_GSETC_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_OPERATORS_HH
│ │ │ │ +
6#define DUNE_ISTL_OPERATORS_HH
│ │ │ │
7
│ │ │ │
8#include <cmath>
│ │ │ │
9#include <complex>
│ │ │ │
10#include <iostream>
│ │ │ │
11#include <iomanip>
│ │ │ │
12#include <string>
│ │ │ │
13
│ │ │ │ -
14#include <dune/common/hybridutilities.hh>
│ │ │ │ -
15
│ │ │ │ - │ │ │ │ - │ │ │ │ +
14#include <dune/common/exceptions.hh>
│ │ │ │ +
15#include <dune/common/shared_ptr.hh>
│ │ │ │ +
16
│ │ │ │ +
17#include "solvercategory.hh"
│ │ │ │
18
│ │ │ │ -
19#include "istlexception.hh"
│ │ │ │ -
20
│ │ │ │ +
19
│ │ │ │ +
20namespace Dune {
│ │ │ │
21
│ │ │ │ -
27namespace Dune {
│ │ │ │ -
28
│ │ │ │ -
39 //============================================================
│ │ │ │ -
40 // parameter types
│ │ │ │ -
41 //============================================================
│ │ │ │ -
42
│ │ │ │ -
44 template<int l>
│ │ │ │ -
│ │ │ │ -
45 struct BL {
│ │ │ │ -
46 enum {recursion_level = l};
│ │ │ │ -
47 };
│ │ │ │ -
│ │ │ │ +
44 //=====================================================================
│ │ │ │ +
45 // Abstract operator interface
│ │ │ │ +
46 //=====================================================================
│ │ │ │ +
47
│ │ │ │
48
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
51 nodiag=0
│ │ │ │ -
52 };
│ │ │ │ -
│ │ │ │ -
53
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
56 norelax=0
│ │ │ │ -
57 };
│ │ │ │ -
│ │ │ │ -
58
│ │ │ │ -
59 //============================================================
│ │ │ │ -
60 // generic triangular solves
│ │ │ │ -
61 // consider block decomposition A = L + D + U
│ │ │ │ -
62 // we can invert L, L+D, U, U+D
│ │ │ │ -
63 // we can apply relaxation or not
│ │ │ │ -
64 // we can recurse over a fixed number of levels
│ │ │ │ -
65 //============================================================
│ │ │ │ -
66
│ │ │ │ -
67 // template meta program for triangular solves
│ │ │ │ -
68 template<int I, WithDiagType diag, WithRelaxType relax>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
70 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
71 static void bltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
72 {
│ │ │ │ -
73 // iterator types
│ │ │ │ -
74 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
75 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
76 typedef typename Y::block_type bblock;
│ │ │ │ -
77
│ │ │ │ -
78 // local solve at each block and immediate update
│ │ │ │ -
79 rowiterator endi=A.end();
│ │ │ │ -
80 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
81 {
│ │ │ │ -
82 bblock rhs(d[i.index()]);
│ │ │ │ -
83 coliterator j;
│ │ │ │ -
84 for (j=(*i).begin(); j.index()<i.index(); ++j)
│ │ │ │ -
85 (*j).mmv(v[j.index()],rhs);
│ │ │ │ -
86 algmeta_btsolve<I-1,diag,relax>::bltsolve(*j,v[i.index()],rhs,w);
│ │ │ │ -
87 }
│ │ │ │ -
88 }
│ │ │ │ -
│ │ │ │ -
89 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
90 static void butsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ +
66 template<class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
68 public:
│ │ │ │ +
70 typedef X domain_type;
│ │ │ │ +
72 typedef Y range_type;
│ │ │ │ +
74 typedef typename X::field_type field_type;
│ │ │ │ +
75
│ │ │ │ +
80 virtual void apply (const X& x, Y& y) const = 0;
│ │ │ │ +
81
│ │ │ │ +
83 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const = 0;
│ │ │ │ +
84
│ │ │ │ +
86 virtual ~LinearOperator () {}
│ │ │ │ +
87
│ │ │ │ + │ │ │ │ +
90#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ │
91 {
│ │ │ │ -
92 // iterator types
│ │ │ │ -
93 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
94 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
95 typedef typename Y::block_type bblock;
│ │ │ │ -
96
│ │ │ │ -
97 // local solve at each block and immediate update
│ │ │ │ -
98 rowiterator rendi=A.beforeBegin();
│ │ │ │ -
99 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
│ │ │ │ -
100 {
│ │ │ │ -
101 bblock rhs(d[i.index()]);
│ │ │ │ -
102 coliterator j;
│ │ │ │ -
103 for (j=(*i).beforeEnd(); j.index()>i.index(); --j)
│ │ │ │ -
104 (*j).mmv(v[j.index()],rhs);
│ │ │ │ -
105 algmeta_btsolve<I-1,diag,relax>::butsolve(*j,v[i.index()],rhs,w);
│ │ │ │ -
106 }
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108 };
│ │ │ │ -
│ │ │ │ -
109
│ │ │ │ -
110 // recursion end ...
│ │ │ │ -
111 template<>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
113 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
114 static void bltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
115 {
│ │ │ │ -
116 A.solve(v,d);
│ │ │ │ -
117 v *= w;
│ │ │ │ -
118 }
│ │ │ │ -
│ │ │ │ -
119 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
120 static void butsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
121 {
│ │ │ │ -
122 A.solve(v,d);
│ │ │ │ -
123 v *= w;
│ │ │ │ -
124 }
│ │ │ │ -
│ │ │ │ -
125 };
│ │ │ │ -
│ │ │ │ -
126 template<>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
128 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
129 static void bltsolve (const M& A, X& v, const Y& d, const K& /*w*/)
│ │ │ │ -
130 {
│ │ │ │ -
131 A.solve(v,d);
│ │ │ │ -
132 }
│ │ │ │ -
│ │ │ │ -
133 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
134 static void butsolve (const M& A, X& v, const Y& d, const K& /*w*/)
│ │ │ │ -
135 {
│ │ │ │ -
136 A.solve(v,d);
│ │ │ │ -
137 }
│ │ │ │ -
│ │ │ │ -
138 };
│ │ │ │ -
│ │ │ │ -
139 template<>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
141 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
142 static void bltsolve (const M& /*A*/, X& v, const Y& d, const K& w)
│ │ │ │ -
143 {
│ │ │ │ -
144 v = d;
│ │ │ │ -
145 v *= w;
│ │ │ │ -
146 }
│ │ │ │ -
│ │ │ │ -
147 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
148 static void butsolve (const M& /*A*/, X& v, const Y& d, const K& w)
│ │ │ │ -
149 {
│ │ │ │ -
150 v = d;
│ │ │ │ -
151 v *= w;
│ │ │ │ -
152 }
│ │ │ │ -
│ │ │ │ -
153 };
│ │ │ │ -
│ │ │ │ -
154 template<>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
156 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
157 static void bltsolve (const M& /*A*/, X& v, const Y& d, const K& /*w*/)
│ │ │ │ -
158 {
│ │ │ │ -
159 v = d;
│ │ │ │ -
160 }
│ │ │ │ -
│ │ │ │ -
161 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
162 static void butsolve (const M& /*A*/, X& v, const Y& d, const K& /*w*/)
│ │ │ │ -
163 {
│ │ │ │ -
164 v = d;
│ │ │ │ -
165 }
│ │ │ │ -
│ │ │ │ -
166 };
│ │ │ │ +
92 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
│ │ │ │ +
93 };
│ │ │ │ +
94#else
│ │ │ │ +
95 = 0;
│ │ │ │ +
96#endif
│ │ │ │ +
97 };
│ │ │ │ +
│ │ │ │ +
98
│ │ │ │ +
99
│ │ │ │ +
108 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
110 public:
│ │ │ │ +
112 typedef M matrix_type;
│ │ │ │ +
113 typedef X domain_type;
│ │ │ │ +
114 typedef Y range_type;
│ │ │ │ +
115 typedef typename X::field_type field_type;
│ │ │ │ +
116
│ │ │ │ +
118 virtual const M& getmat () const = 0;
│ │ │ │ +
119
│ │ │ │ + │ │ │ │ +
122 };
│ │ │ │ +
│ │ │ │ +
123
│ │ │ │ +
124
│ │ │ │ +
125
│ │ │ │ +
126 //=====================================================================
│ │ │ │ +
127 // Implementation for ISTL-matrix based operator
│ │ │ │ +
128 //=====================================================================
│ │ │ │ +
129
│ │ │ │ +
135 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
137 {
│ │ │ │ +
138 public:
│ │ │ │ +
140 typedef M matrix_type;
│ │ │ │ +
141 typedef X domain_type;
│ │ │ │ +
142 typedef Y range_type;
│ │ │ │ +
143 typedef typename X::field_type field_type;
│ │ │ │ +
144
│ │ │ │ +
146 explicit MatrixAdapter (const M& A) : _A_(stackobject_to_shared_ptr(A)) {}
│ │ │ │ +
147
│ │ │ │ +
149 explicit MatrixAdapter (std::shared_ptr<const M> A) : _A_(A) {}
│ │ │ │ +
150
│ │ │ │ +
│ │ │ │ +
152 void apply (const X& x, Y& y) const override
│ │ │ │ +
153 {
│ │ │ │ +
154 _A_->mv(x,y);
│ │ │ │ +
155 }
│ │ │ │ +
│ │ │ │ +
156
│ │ │ │ +
│ │ │ │ +
158 void applyscaleadd (field_type alpha, const X& x, Y& y) const override
│ │ │ │ +
159 {
│ │ │ │ +
160 _A_->usmv(alpha,x,y);
│ │ │ │ +
161 }
│ │ │ │ +
│ │ │ │ +
162
│ │ │ │ +
│ │ │ │ +
164 const M& getmat () const override
│ │ │ │ +
165 {
│ │ │ │ +
166 return *_A_;
│ │ │ │ +
167 }
│ │ │ │
│ │ │ │ -
167
│ │ │ │
168
│ │ │ │ -
169 // user calls
│ │ │ │ -
170
│ │ │ │ -
171 // default block recursion level = 1
│ │ │ │ -
172
│ │ │ │ -
174 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
175 void bltsolve (const M& A, X& v, const Y& d)
│ │ │ │ -
176 {
│ │ │ │ -
177 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
179 }
│ │ │ │ -
│ │ │ │ -
181 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
182 void bltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
183 {
│ │ │ │ - │ │ │ │ -
185 }
│ │ │ │ -
│ │ │ │ -
187 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
188 void ubltsolve (const M& A, X& v, const Y& d)
│ │ │ │ -
189 {
│ │ │ │ -
190 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
192 }
│ │ │ │ -
│ │ │ │ -
194 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
195 void ubltsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
196 {
│ │ │ │ - │ │ │ │ -
198 }
│ │ │ │ -
│ │ │ │ -
199
│ │ │ │ -
201 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
202 void butsolve (const M& A, X& v, const Y& d)
│ │ │ │ -
203 {
│ │ │ │ -
204 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
206 }
│ │ │ │ -
│ │ │ │ -
208 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
209 void butsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
210 {
│ │ │ │ - │ │ │ │ -
212 }
│ │ │ │ -
│ │ │ │ -
214 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
215 void ubutsolve (const M& A, X& v, const Y& d)
│ │ │ │ -
216 {
│ │ │ │ -
217 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
219 }
│ │ │ │ -
│ │ │ │ -
221 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
222 void ubutsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
223 {
│ │ │ │ - │ │ │ │ -
225 }
│ │ │ │ -
│ │ │ │ -
226
│ │ │ │ -
227 // general block recursion level >= 0
│ │ │ │ -
228
│ │ │ │ -
230 template<class M, class X, class Y, int l>
│ │ │ │ -
│ │ │ │ -
231 void bltsolve (const M& A, X& v, const Y& d, BL<l> /*bl*/)
│ │ │ │ -
232 {
│ │ │ │ -
233 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
235 }
│ │ │ │ -
│ │ │ │ -
237 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
238 void bltsolve (const M& A, X& v, const Y& d, const K& w, BL<l> /*bl*/)
│ │ │ │ -
239 {
│ │ │ │ - │ │ │ │ -
241 }
│ │ │ │ -
│ │ │ │ -
243 template<class M, class X, class Y, int l>
│ │ │ │ -
│ │ │ │ -
244 void ubltsolve (const M& A, X& v, const Y& d, BL<l> /*bl*/)
│ │ │ │ -
245 {
│ │ │ │ -
246 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
248 }
│ │ │ │ -
│ │ │ │ -
250 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
251 void ubltsolve (const M& A, X& v, const Y& d, const K& w, BL<l> /*bl*/)
│ │ │ │ -
252 {
│ │ │ │ - │ │ │ │ -
254 }
│ │ │ │ -
│ │ │ │ -
255
│ │ │ │ -
257 template<class M, class X, class Y, int l>
│ │ │ │ -
│ │ │ │ -
258 void butsolve (const M& A, X& v, const Y& d, BL<l> bl)
│ │ │ │ -
259 {
│ │ │ │ -
260 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
262 }
│ │ │ │ -
│ │ │ │ -
264 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
265 void butsolve (const M& A, X& v, const Y& d, const K& w, BL<l> bl)
│ │ │ │ -
266 {
│ │ │ │ - │ │ │ │ -
268 }
│ │ │ │ -
│ │ │ │ -
270 template<class M, class X, class Y, int l>
│ │ │ │ -
│ │ │ │ -
271 void ubutsolve (const M& A, X& v, const Y& d, BL<l> bl)
│ │ │ │ -
272 {
│ │ │ │ -
273 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
275 }
│ │ │ │ -
│ │ │ │ -
277 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
278 void ubutsolve (const M& A, X& v, const Y& d, const K& w, BL<l> bl)
│ │ │ │ -
279 {
│ │ │ │ - │ │ │ │ -
281 }
│ │ │ │ -
│ │ │ │ -
282
│ │ │ │ -
283
│ │ │ │ -
284
│ │ │ │ -
285 //============================================================
│ │ │ │ -
286 // generic block diagonal solves
│ │ │ │ -
287 // consider block decomposition A = L + D + U
│ │ │ │ -
288 // we can apply relaxation or not
│ │ │ │ -
289 // we can recurse over a fixed number of levels
│ │ │ │ -
290 //============================================================
│ │ │ │ -
291
│ │ │ │ -
292 // template meta program for diagonal solves
│ │ │ │ -
293 template<int I, WithRelaxType relax>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
295 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
296 static void bdsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
297 {
│ │ │ │ -
298 // iterator types
│ │ │ │ -
299 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
300 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
301
│ │ │ │ -
302 // local solve at each block and immediate update
│ │ │ │ -
303 rowiterator rendi=A.beforeBegin();
│ │ │ │ -
304 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
│ │ │ │ -
305 {
│ │ │ │ -
306 coliterator ii=(*i).find(i.index());
│ │ │ │ -
307 algmeta_bdsolve<I-1,relax>::bdsolve(*ii,v[i.index()],d[i.index()],w);
│ │ │ │ -
308 }
│ │ │ │ -
309 }
│ │ │ │ -
│ │ │ │ -
310 };
│ │ │ │ -
│ │ │ │ -
311
│ │ │ │ -
312 // recursion end ...
│ │ │ │ -
313 template<>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
315 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
316 static void bdsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
317 {
│ │ │ │ -
318 A.solve(v,d);
│ │ │ │ -
319 v *= w;
│ │ │ │ -
320 }
│ │ │ │ -
│ │ │ │ -
321 };
│ │ │ │ -
│ │ │ │ -
322 template<>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
324 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
325 static void bdsolve (const M& A, X& v, const Y& d, const K& /*w*/)
│ │ │ │ -
326 {
│ │ │ │ -
327 A.solve(v,d);
│ │ │ │ -
328 }
│ │ │ │ -
│ │ │ │ -
329 };
│ │ │ │ -
│ │ │ │ -
330
│ │ │ │ -
331 // user calls
│ │ │ │ -
332
│ │ │ │ -
333 // default block recursion level = 1
│ │ │ │ -
334
│ │ │ │ -
336 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
337 void bdsolve (const M& A, X& v, const Y& d)
│ │ │ │ -
338 {
│ │ │ │ -
339 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
341 }
│ │ │ │ -
│ │ │ │ -
343 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
344 void bdsolve (const M& A, X& v, const Y& d, const K& w)
│ │ │ │ -
345 {
│ │ │ │ - │ │ │ │ -
347 }
│ │ │ │ -
│ │ │ │ -
348
│ │ │ │ -
349 // general block recursion level >= 0
│ │ │ │ -
350
│ │ │ │ -
352 template<class M, class X, class Y, int l>
│ │ │ │ -
│ │ │ │ -
353 void bdsolve (const M& A, X& v, const Y& d, BL<l> /*bl*/)
│ │ │ │ -
354 {
│ │ │ │ -
355 typename X::field_type w=1;
│ │ │ │ - │ │ │ │ -
357 }
│ │ │ │ -
│ │ │ │ -
359 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
360 void bdsolve (const M& A, X& v, const Y& d, const K& w, BL<l> /*bl*/)
│ │ │ │ -
361 {
│ │ │ │ - │ │ │ │ -
363 }
│ │ │ │ -
│ │ │ │ -
364
│ │ │ │ -
365
│ │ │ │ -
366 //============================================================
│ │ │ │ -
367 // generic steps of iteration methods
│ │ │ │ -
368 // Jacobi, Gauss-Seidel, SOR, SSOR
│ │ │ │ -
369 // work directly on Ax=b, ie solve M(x^{i+1}-x^i) = w (b-Ax^i)
│ │ │ │ -
370 // we can recurse over a fixed number of levels
│ │ │ │ -
371 //============================================================
│ │ │ │ -
372
│ │ │ │ -
373 // template meta program for iterative solver steps
│ │ │ │ -
374 template<int I, typename M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
376
│ │ │ │ -
377 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
378 static void dbgs (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
379 {
│ │ │ │ -
380 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
381 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
382 typedef typename Y::block_type bblock;
│ │ │ │ -
383 bblock rhs;
│ │ │ │ -
384
│ │ │ │ -
385 X xold(x); // remember old x
│ │ │ │ -
386
│ │ │ │ -
387 rowiterator endi=A.end();
│ │ │ │ -
388 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
389 {
│ │ │ │ -
390 rhs = b[i.index()]; // rhs = b_i
│ │ │ │ -
391 coliterator endj=(*i).end();
│ │ │ │ -
392 coliterator j=(*i).begin();
│ │ │ │ -
393 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ -
394 {
│ │ │ │ -
395 for (; j.index()<i.index(); ++j)
│ │ │ │ -
396 rhs -= (*j) * x[j.index()];
│ │ │ │ -
397 coliterator diag=j++; // *diag = a_ii and increment coliterator j from a_ii to a_i+1,i to skip diagonal
│ │ │ │ -
398 for (; j != endj; ++j)
│ │ │ │ -
399 rhs -= (*j) * x[j.index()];
│ │ │ │ -
400 x[i.index()] = rhs / (*diag);
│ │ │ │ -
401 }
│ │ │ │ -
402 else
│ │ │ │ -
403 {
│ │ │ │ -
404 for (; j.index()<i.index(); ++j) // iterate over a_ij with j < i
│ │ │ │ -
405 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ -
406 coliterator diag=j++; // *diag = a_ii and increment coliterator j from a_ii to a_i+1,i to skip diagonal
│ │ │ │ -
407 for (; j != endj; ++j) // iterate over a_ij with j > i
│ │ │ │ -
408 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j>i} a_ij * xold_j
│ │ │ │ -
409 algmeta_itsteps<I-1,typename M::block_type>::dbgs(*diag,x[i.index()],rhs,w); // if I==1: xnew_i = rhs/a_ii
│ │ │ │ -
410 }
│ │ │ │ -
411 }
│ │ │ │ -
412 // next two lines: xnew_i = w / a_ii * (b_i - sum_{j<i} a_ij * xnew_j - sum_{j>=i} a_ij * xold_j) + (1-w)*xold;
│ │ │ │ -
413 x *= w;
│ │ │ │ -
414 x.axpy(K(1)-w,xold);
│ │ │ │ -
415 }
│ │ │ │ -
│ │ │ │ -
416
│ │ │ │ -
417 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
418 static void bsorf (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
419 {
│ │ │ │ -
420 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
421 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
422 typedef typename Y::block_type bblock;
│ │ │ │ -
423 typedef typename X::block_type xblock;
│ │ │ │ -
424 bblock rhs;
│ │ │ │ -
425 xblock v;
│ │ │ │ -
426
│ │ │ │ -
427 // Initialize nested data structure if there are entries
│ │ │ │ -
428 if(A.begin()!=A.end())
│ │ │ │ -
429 v=x[0];
│ │ │ │ -
430
│ │ │ │ -
431 rowiterator endi=A.end();
│ │ │ │ -
432 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
433 {
│ │ │ │ -
434 rhs = b[i.index()]; // rhs = b_i
│ │ │ │ -
435 coliterator endj=(*i).end(); // iterate over a_ij with j < i
│ │ │ │ -
436 coliterator j=(*i).begin();
│ │ │ │ -
437 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ -
438 {
│ │ │ │ -
439 for (; j.index()<i.index(); ++j)
│ │ │ │ -
440 rhs -= (*j) * x[j.index()]; // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ -
441 coliterator diag=j; // *diag = a_ii
│ │ │ │ -
442 for (; j!=endj; ++j)
│ │ │ │ -
443 rhs -= (*j) * x[j.index()]; // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ -
444 v = rhs / (*diag);
│ │ │ │ -
445 x[i.index()] += w*v; // x_i = w / a_ii * (b_i - sum_{j<i} a_ij * xnew_j - sum_{j>=i} a_ij * xold_j)
│ │ │ │ -
446 }
│ │ │ │ -
447 else
│ │ │ │ -
448 {
│ │ │ │ -
449 for (; j.index()<i.index(); ++j)
│ │ │ │ -
450 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ -
451 coliterator diag=j; // *diag = a_ii
│ │ │ │ -
452 for (; j!=endj; ++j)
│ │ │ │ -
453 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ -
454 algmeta_itsteps<I-1,typename M::block_type>::bsorf(*diag,v,rhs,w); // if blocksize I==1: v = rhs/a_ii
│ │ │ │ -
455 x[i.index()].axpy(w,v); // x_i = w / a_ii * (b_i - sum_{j<i} a_ij * xnew_j - sum_{j>=i} a_ij * xold_j)
│ │ │ │ -
456 }
│ │ │ │ -
457 }
│ │ │ │ -
458 }
│ │ │ │ -
│ │ │ │ -
459
│ │ │ │ -
460 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
461 static void bsorb (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
462 {
│ │ │ │ -
463 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
464 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
465 typedef typename Y::block_type bblock;
│ │ │ │ -
466 typedef typename X::block_type xblock;
│ │ │ │ -
467 bblock rhs;
│ │ │ │ -
468 xblock v;
│ │ │ │ -
469
│ │ │ │ -
470 // Initialize nested data structure if there are entries
│ │ │ │ -
471 if(A.begin()!=A.end())
│ │ │ │ -
472 v=x[0];
│ │ │ │ -
473
│ │ │ │ -
474 rowiterator endi=A.beforeBegin();
│ │ │ │ -
475 for (rowiterator i=A.beforeEnd(); i!=endi; --i)
│ │ │ │ -
476 {
│ │ │ │ -
477 rhs = b[i.index()];
│ │ │ │ -
478 coliterator endj=(*i).end();
│ │ │ │ -
479 coliterator j=(*i).begin();
│ │ │ │ -
480 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ -
481 {
│ │ │ │ -
482 for (; j.index()<i.index(); ++j)
│ │ │ │ -
483 rhs -= (*j) * x[j.index()];
│ │ │ │ -
484 coliterator diag=j;
│ │ │ │ -
485 for (; j!=endj; ++j)
│ │ │ │ -
486 rhs -= (*j) * x[j.index()];
│ │ │ │ -
487 v = rhs / (*diag);
│ │ │ │ -
488 x[i.index()] += w*v;
│ │ │ │ -
489 }
│ │ │ │ -
490 else
│ │ │ │ -
491 {
│ │ │ │ -
492 for (; j.index()<i.index(); ++j)
│ │ │ │ -
493 j->mmv(x[j.index()],rhs);
│ │ │ │ -
494 coliterator diag=j;
│ │ │ │ -
495 for (; j!=endj; ++j)
│ │ │ │ -
496 j->mmv(x[j.index()],rhs);
│ │ │ │ - │ │ │ │ -
498 x[i.index()].axpy(w,v);
│ │ │ │ -
499 }
│ │ │ │ -
500 }
│ │ │ │ -
501 }
│ │ │ │ -
│ │ │ │ -
502
│ │ │ │ -
503 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
504 static void dbjac (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
505 {
│ │ │ │ -
506 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
507 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
508 typedef typename Y::block_type bblock;
│ │ │ │ -
509 bblock rhs;
│ │ │ │ -
510
│ │ │ │ -
511 X v(x); // allocate with same size
│ │ │ │ -
512
│ │ │ │ -
513 rowiterator endi=A.end();
│ │ │ │ -
514 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
515 {
│ │ │ │ -
516 rhs = b[i.index()];
│ │ │ │ -
517 coliterator endj=(*i).end();
│ │ │ │ -
518 coliterator j=(*i).begin();
│ │ │ │ -
519 if constexpr (IsNumber<typename M::block_type>())
│ │ │ │ -
520 {
│ │ │ │ -
521 for (; j.index()<i.index(); ++j)
│ │ │ │ -
522 rhs -= (*j) * x[j.index()];
│ │ │ │ -
523 coliterator diag=j;
│ │ │ │ -
524 for (; j!=endj; ++j)
│ │ │ │ -
525 rhs -= (*j) * x[j.index()];
│ │ │ │ -
526 v[i.index()] = rhs / (*diag);
│ │ │ │ -
527 }
│ │ │ │ -
528 else
│ │ │ │ -
529 {
│ │ │ │ -
530 for (; j.index()<i.index(); ++j)
│ │ │ │ -
531 j->mmv(x[j.index()],rhs);
│ │ │ │ -
532 coliterator diag=j;
│ │ │ │ -
533 for (; j!=endj; ++j)
│ │ │ │ -
534 j->mmv(x[j.index()],rhs);
│ │ │ │ - │ │ │ │ -
536 }
│ │ │ │ -
537 }
│ │ │ │ -
538 x.axpy(w,v);
│ │ │ │ -
539 }
│ │ │ │ -
│ │ │ │ -
540 };
│ │ │ │ -
│ │ │ │ -
541 // end of recursion
│ │ │ │ -
542 template<typename M>
│ │ │ │ -
│ │ │ │ -
543 struct algmeta_itsteps<0,M> {
│ │ │ │ -
544 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
545 static void dbgs (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ -
546 {
│ │ │ │ -
547 A.solve(x,b);
│ │ │ │ -
548 }
│ │ │ │ -
│ │ │ │ -
549 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
550 static void bsorf (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ -
551 {
│ │ │ │ -
552 A.solve(x,b);
│ │ │ │ -
553 }
│ │ │ │ -
│ │ │ │ -
554 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
555 static void bsorb (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ -
556 {
│ │ │ │ -
557 A.solve(x,b);
│ │ │ │ -
558 }
│ │ │ │ -
│ │ │ │ -
559 template<class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
560 static void dbjac (const M& A, X& x, const Y& b, const K& /*w*/)
│ │ │ │ -
561 {
│ │ │ │ -
562 A.solve(x,b);
│ │ │ │ -
563 }
│ │ │ │ -
│ │ │ │ -
564 };
│ │ │ │ -
│ │ │ │ -
565
│ │ │ │ -
566 template<int I, typename T1, typename... MultiTypeMatrixArgs>
│ │ │ │ -
│ │ │ │ -
567 struct algmeta_itsteps<I,MultiTypeBlockMatrix<T1, MultiTypeMatrixArgs...>> {
│ │ │ │ -
568 template<
│ │ │ │ -
569 typename... MultiTypeVectorArgs,
│ │ │ │ -
570 class K>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
574 const K& w)
│ │ │ │ -
575 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
578 }
│ │ │ │ -
│ │ │ │ -
579
│ │ │ │ -
580 template<
│ │ │ │ -
581 typename... MultiTypeVectorArgs,
│ │ │ │ -
582 class K>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
586 const K& w)
│ │ │ │ -
587 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
590 }
│ │ │ │ -
│ │ │ │ -
591
│ │ │ │ -
592 template<
│ │ │ │ -
593 typename... MultiTypeVectorArgs,
│ │ │ │ -
594 class K>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
598 const K& w)
│ │ │ │ -
599 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
602 }
│ │ │ │ -
│ │ │ │ -
603
│ │ │ │ -
604 template<
│ │ │ │ -
605 typename... MultiTypeVectorArgs,
│ │ │ │ -
606 class K
│ │ │ │ -
607 >
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
611 const K& w)
│ │ │ │ -
612 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
615 }
│ │ │ │ -
│ │ │ │ -
616 };
│ │ │ │ -
│ │ │ │ -
617
│ │ │ │ -
618 // user calls
│ │ │ │ -
619
│ │ │ │ -
621 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
622 void dbgs (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
623 {
│ │ │ │ - │ │ │ │ -
625 }
│ │ │ │ -
│ │ │ │ -
627 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
628 void dbgs (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ -
629 {
│ │ │ │ - │ │ │ │ -
631 }
│ │ │ │ -
│ │ │ │ -
633 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
634 void bsorf (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
635 {
│ │ │ │ - │ │ │ │ -
637 }
│ │ │ │ -
│ │ │ │ -
639 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
640 void bsorf (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ -
641 {
│ │ │ │ - │ │ │ │ -
643 }
│ │ │ │ -
│ │ │ │ -
645 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
646 void bsorb (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
647 {
│ │ │ │ - │ │ │ │ -
649 }
│ │ │ │ -
│ │ │ │ -
651 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
652 void bsorb (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ -
653 {
│ │ │ │ - │ │ │ │ -
655 }
│ │ │ │ -
│ │ │ │ -
657 template<class M, class X, class Y, class K>
│ │ │ │ -
│ │ │ │ -
658 void dbjac (const M& A, X& x, const Y& b, const K& w)
│ │ │ │ -
659 {
│ │ │ │ - │ │ │ │ -
661 }
│ │ │ │ -
│ │ │ │ -
663 template<class M, class X, class Y, class K, int l>
│ │ │ │ -
│ │ │ │ -
664 void dbjac (const M& A, X& x, const Y& b, const K& w, BL<l> /*bl*/)
│ │ │ │ -
665 {
│ │ │ │ - │ │ │ │ -
667 }
│ │ │ │ -
│ │ │ │ -
668
│ │ │ │ -
669
│ │ │ │ -
672} // end namespace
│ │ │ │ -
673
│ │ │ │ -
674#endif
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:568
│ │ │ │ -
static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:484
│ │ │ │ -
static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:540
│ │ │ │ -
static constexpr size_type N()
Return the number of matrix rows.
Definition multitypeblockmatrix.hh:64
│ │ │ │ -
static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:513
│ │ │ │ -
void bltsolve(const M &A, X &v, const Y &d)
block lower triangular solve
Definition gsetc.hh:175
│ │ │ │ -
WithDiagType
Definition gsetc.hh:49
│ │ │ │ -
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition gsetc.hh:646
│ │ │ │ -
void ubltsolve(const M &A, X &v, const Y &d)
unit block lower triangular solve
Definition gsetc.hh:188
│ │ │ │ -
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition gsetc.hh:658
│ │ │ │ -
void dbgs(const M &A, X &x, const Y &b, const K &w)
GS step.
Definition gsetc.hh:622
│ │ │ │ -
WithRelaxType
Definition gsetc.hh:54
│ │ │ │ -
void bdsolve(const M &A, X &v, const Y &d)
block diagonal solve, no relaxation
Definition gsetc.hh:337
│ │ │ │ -
void butsolve(const M &A, X &v, const Y &d)
block upper triangular solve
Definition gsetc.hh:202
│ │ │ │ -
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition gsetc.hh:634
│ │ │ │ -
void ubutsolve(const M &A, X &v, const Y &d)
unit block upper triangular solve
Definition gsetc.hh:215
│ │ │ │ -
@ nodiag
Definition gsetc.hh:51
│ │ │ │ -
@ withdiag
Definition gsetc.hh:50
│ │ │ │ -
@ norelax
Definition gsetc.hh:56
│ │ │ │ -
@ withrelax
Definition gsetc.hh:55
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
171 {
│ │ │ │ + │ │ │ │ +
173 }
│ │ │ │ +
│ │ │ │ +
174
│ │ │ │ +
175 private:
│ │ │ │ +
176 const std::shared_ptr<const M> _A_;
│ │ │ │ +
177 };
│ │ │ │ +
│ │ │ │ +
178
│ │ │ │ +
181} // end namespace
│ │ │ │ +
182
│ │ │ │ +
183#endif
│ │ │ │ + │ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A Vector class to support different block types.
Definition multitypeblockvector.hh:59
│ │ │ │ -
A Matrix class to support different block types.
Definition multitypeblockmatrix.hh:46
│ │ │ │ -
compile-time parameter for block recursion depth
Definition gsetc.hh:45
│ │ │ │ -
@ recursion_level
Definition gsetc.hh:46
│ │ │ │ -
Definition gsetc.hh:69
│ │ │ │ -
static void butsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:90
│ │ │ │ -
static void bltsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:71
│ │ │ │ -
static void bltsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:114
│ │ │ │ -
static void butsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:120
│ │ │ │ -
static void bltsolve(const M &A, X &v, const Y &d, const K &)
Definition gsetc.hh:129
│ │ │ │ -
static void butsolve(const M &A, X &v, const Y &d, const K &)
Definition gsetc.hh:134
│ │ │ │ -
static void bltsolve(const M &, X &v, const Y &d, const K &w)
Definition gsetc.hh:142
│ │ │ │ -
static void butsolve(const M &, X &v, const Y &d, const K &w)
Definition gsetc.hh:148
│ │ │ │ -
static void bltsolve(const M &, X &v, const Y &d, const K &)
Definition gsetc.hh:157
│ │ │ │ -
static void butsolve(const M &, X &v, const Y &d, const K &)
Definition gsetc.hh:162
│ │ │ │ -
Definition gsetc.hh:294
│ │ │ │ -
static void bdsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:296
│ │ │ │ -
static void bdsolve(const M &A, X &v, const Y &d, const K &w)
Definition gsetc.hh:316
│ │ │ │ -
static void bdsolve(const M &A, X &v, const Y &d, const K &)
Definition gsetc.hh:325
│ │ │ │ -
Definition gsetc.hh:375
│ │ │ │ -
static void bsorb(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:461
│ │ │ │ -
static void bsorf(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:418
│ │ │ │ -
static void dbjac(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:504
│ │ │ │ -
static void dbgs(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:378
│ │ │ │ -
static void dbgs(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:545
│ │ │ │ -
static void dbjac(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:560
│ │ │ │ -
static void bsorf(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:550
│ │ │ │ -
static void bsorb(const M &A, X &x, const Y &b, const K &)
Definition gsetc.hh:555
│ │ │ │ -
static void dbgs(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:571
│ │ │ │ -
static void dbjac(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:608
│ │ │ │ -
static void bsorf(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:583
│ │ │ │ -
static void bsorb(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
Definition gsetc.hh:595
│ │ │ │ +
A linear operator.
Definition operators.hh:67
│ │ │ │ +
virtual ~LinearOperator()
every abstract base class has a virtual destructor
Definition operators.hh:86
│ │ │ │ +
X::field_type field_type
The field type of the operator.
Definition operators.hh:74
│ │ │ │ +
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0
apply operator to x, scale and add:
│ │ │ │ +
virtual SolverCategory::Category category() const =0
Category of the linear operator (see SolverCategory::Category)
│ │ │ │ +
Y range_type
The type of the range of the operator.
Definition operators.hh:72
│ │ │ │ +
virtual void apply(const X &x, Y &y) const =0
apply operator to x: The input vector is consistent and the output must also be consistent on the in...
│ │ │ │ +
X domain_type
The type of the domain of the operator.
Definition operators.hh:70
│ │ │ │ +
A linear operator exporting itself in matrix form.
Definition operators.hh:109
│ │ │ │ +
virtual const M & getmat() const =0
get matrix via *
│ │ │ │ +
X domain_type
Definition operators.hh:113
│ │ │ │ +
X::field_type field_type
Definition operators.hh:115
│ │ │ │ +
Y range_type
Definition operators.hh:114
│ │ │ │ +
M matrix_type
export types, usually they come from the derived class
Definition operators.hh:112
│ │ │ │ +
virtual ~AssembledLinearOperator()
every abstract base class has a virtual destructor
Definition operators.hh:121
│ │ │ │ +
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ +
MatrixAdapter(std::shared_ptr< const M > A)
constructor: store an std::shared_ptr to a matrix
Definition operators.hh:149
│ │ │ │ +
MatrixAdapter(const M &A)
constructor: just store a reference to a matrix
Definition operators.hh:146
│ │ │ │ +
void applyscaleadd(field_type alpha, const X &x, Y &y) const override
apply operator to x, scale and add:
Definition operators.hh:158
│ │ │ │ +
Y range_type
Definition operators.hh:142
│ │ │ │ +
X domain_type
Definition operators.hh:141
│ │ │ │ +
X::field_type field_type
Definition operators.hh:143
│ │ │ │ +
const M & getmat() const override
get matrix via *
Definition operators.hh:164
│ │ │ │ +
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category)
Definition operators.hh:170
│ │ │ │ +
void apply(const X &x, Y &y) const override
apply operator to x:
Definition operators.hh:152
│ │ │ │ +
M matrix_type
export types
Definition operators.hh:140
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,832 +1,223 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -gsetc.hh │ │ │ │ │ +operators.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 (C) 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_GSETC_HH │ │ │ │ │ -6#define DUNE_ISTL_GSETC_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_OPERATORS_HH │ │ │ │ │ +6#define DUNE_ISTL_OPERATORS_HH │ │ │ │ │ 7 │ │ │ │ │ 8#include │ │ │ │ │ 9#include │ │ │ │ │ 10#include │ │ │ │ │ 11#include │ │ │ │ │ 12#include │ │ │ │ │ 13 │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h" │ │ │ │ │ -17#include "_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h" │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +17#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ │ 18 │ │ │ │ │ -19#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -20 │ │ │ │ │ +19 │ │ │ │ │ +20namespace _D_u_n_e { │ │ │ │ │ 21 │ │ │ │ │ -27namespace _D_u_n_e { │ │ │ │ │ -28 │ │ │ │ │ -39 //============================================================ │ │ │ │ │ -40 // parameter types │ │ │ │ │ -41 //============================================================ │ │ │ │ │ -42 │ │ │ │ │ -44 template │ │ │ │ │ -_4_5 struct _B_L { │ │ │ │ │ -_4_6 enum {_r_e_c_u_r_s_i_o_n___l_e_v_e_l = l}; │ │ │ │ │ -47 }; │ │ │ │ │ +44 //===================================================================== │ │ │ │ │ +45 // Abstract operator interface │ │ │ │ │ +46 //===================================================================== │ │ │ │ │ +47 │ │ │ │ │ 48 │ │ │ │ │ -_4_9 enum _W_i_t_h_D_i_a_g_T_y_p_e { │ │ │ │ │ -_5_0 _w_i_t_h_d_i_a_g=1, │ │ │ │ │ -51 _n_o_d_i_a_g=0 │ │ │ │ │ -_5_2 }; │ │ │ │ │ -53 │ │ │ │ │ -_5_4 enum _W_i_t_h_R_e_l_a_x_T_y_p_e { │ │ │ │ │ -_5_5 _w_i_t_h_r_e_l_a_x=1, │ │ │ │ │ -56 _n_o_r_e_l_a_x=0 │ │ │ │ │ -_5_7 }; │ │ │ │ │ -58 │ │ │ │ │ -59 //============================================================ │ │ │ │ │ -60 // generic triangular solves │ │ │ │ │ -61 // consider block decomposition A = L + D + U │ │ │ │ │ -62 // we can invert L, L+D, U, U+D │ │ │ │ │ -63 // we can apply relaxation or not │ │ │ │ │ -64 // we can recurse over a fixed number of levels │ │ │ │ │ -65 //============================================================ │ │ │ │ │ -66 │ │ │ │ │ -67 // template meta program for triangular solves │ │ │ │ │ -68 template │ │ │ │ │ -_6_9 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e { │ │ │ │ │ -70 template │ │ │ │ │ -_7_1 static void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -72 { │ │ │ │ │ -73 // iterator types │ │ │ │ │ -74 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -75 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -76 typedef typename Y::block_type bblock; │ │ │ │ │ -77 │ │ │ │ │ -78 // local solve at each block and immediate update │ │ │ │ │ -79 rowiterator endi=A.end(); │ │ │ │ │ -80 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -81 { │ │ │ │ │ -82 bblock rhs(d[i.index()]); │ │ │ │ │ -83 coliterator j; │ │ │ │ │ -84 for (j=(*i).begin(); j.index()_:_:_b_l_t_s_o_l_v_e(*j,v[i.index()],rhs,w); │ │ │ │ │ -87 } │ │ │ │ │ -88 } │ │ │ │ │ -89 template │ │ │ │ │ -_9_0 static void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ +66 template │ │ │ │ │ +_6_7 class _L_i_n_e_a_r_O_p_e_r_a_t_o_r { │ │ │ │ │ +68 public: │ │ │ │ │ +_7_0 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_7_2 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_7_4 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +75 │ │ │ │ │ +_8_0 virtual void _a_p_p_l_y (const X& x, Y& y) const = 0; │ │ │ │ │ +81 │ │ │ │ │ +_8_3 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (_f_i_e_l_d___t_y_p_e alpha, const X& x, Y& y) const = 0; │ │ │ │ │ +84 │ │ │ │ │ +_8_6 virtual _~_L_i_n_e_a_r_O_p_e_r_a_t_o_r () {} │ │ │ │ │ +87 │ │ │ │ │ +_8_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +90#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ │ 91 { │ │ │ │ │ -92 // iterator types │ │ │ │ │ -93 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -94 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -95 typedef typename Y::block_type bblock; │ │ │ │ │ -96 │ │ │ │ │ -97 // local solve at each block and immediate update │ │ │ │ │ -98 rowiterator rendi=A.beforeBegin(); │ │ │ │ │ -99 for (rowiterator i=A.beforeEnd(); i!=rendi; --i) │ │ │ │ │ -100 { │ │ │ │ │ -101 bblock rhs(d[i.index()]); │ │ │ │ │ -102 coliterator j; │ │ │ │ │ -103 for (j=(*i).beforeEnd(); j.index()>i.index(); --j) │ │ │ │ │ -104 (*j).mmv(v[j.index()],rhs); │ │ │ │ │ -105 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_I_-_1_,_d_i_a_g_,_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(*j,v[i.index()],rhs,w); │ │ │ │ │ -106 } │ │ │ │ │ -107 } │ │ │ │ │ -108 }; │ │ │ │ │ -109 │ │ │ │ │ -110 // recursion end ... │ │ │ │ │ -111 template<> │ │ │ │ │ -_1_1_2 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_w_i_t_h_d_i_a_g,_w_i_t_h_r_e_l_a_x> { │ │ │ │ │ -113 template │ │ │ │ │ -_1_1_4 static void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -115 { │ │ │ │ │ -116 A.solve(v,d); │ │ │ │ │ -117 v *= w; │ │ │ │ │ -118 } │ │ │ │ │ -119 template │ │ │ │ │ -_1_2_0 static void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -121 { │ │ │ │ │ -122 A.solve(v,d); │ │ │ │ │ -123 v *= w; │ │ │ │ │ -124 } │ │ │ │ │ -125 }; │ │ │ │ │ -126 template<> │ │ │ │ │ -_1_2_7 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_w_i_t_h_d_i_a_g,_n_o_r_e_l_a_x> { │ │ │ │ │ -128 template │ │ │ │ │ -_1_2_9 static void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ -130 { │ │ │ │ │ -131 A.solve(v,d); │ │ │ │ │ -132 } │ │ │ │ │ -133 template │ │ │ │ │ -_1_3_4 static void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ -135 { │ │ │ │ │ -136 A.solve(v,d); │ │ │ │ │ -137 } │ │ │ │ │ -138 }; │ │ │ │ │ -139 template<> │ │ │ │ │ -_1_4_0 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_n_o_d_i_a_g,_w_i_t_h_r_e_l_a_x> { │ │ │ │ │ -141 template │ │ │ │ │ -_1_4_2 static void _b_l_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& w) │ │ │ │ │ -143 { │ │ │ │ │ -144 v = d; │ │ │ │ │ -145 v *= w; │ │ │ │ │ -146 } │ │ │ │ │ -147 template │ │ │ │ │ -_1_4_8 static void _b_u_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& w) │ │ │ │ │ -149 { │ │ │ │ │ -150 v = d; │ │ │ │ │ -151 v *= w; │ │ │ │ │ -152 } │ │ │ │ │ -153 }; │ │ │ │ │ -154 template<> │ │ │ │ │ -_1_5_5 struct _a_l_g_m_e_t_a___b_t_s_o_l_v_e<0,_n_o_d_i_a_g,_n_o_r_e_l_a_x> { │ │ │ │ │ -156 template │ │ │ │ │ -_1_5_7 static void _b_l_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ -158 { │ │ │ │ │ -159 v = d; │ │ │ │ │ -160 } │ │ │ │ │ -161 template │ │ │ │ │ -_1_6_2 static void _b_u_t_s_o_l_v_e (const M& /*A*/, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ -163 { │ │ │ │ │ -164 v = d; │ │ │ │ │ -165 } │ │ │ │ │ -166 }; │ │ │ │ │ -167 │ │ │ │ │ +92 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method │ │ │ │ │ +in a derived classes, in the future this method will pure virtual."); │ │ │ │ │ +93 }; │ │ │ │ │ +94#else │ │ │ │ │ +95 = 0; │ │ │ │ │ +96#endif │ │ │ │ │ +97 }; │ │ │ │ │ +98 │ │ │ │ │ +99 │ │ │ │ │ +108 template │ │ │ │ │ +_1_0_9 class _A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r : public _L_i_n_e_a_r_O_p_e_r_a_t_o_r { │ │ │ │ │ +110 public: │ │ │ │ │ +_1_1_2 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_1_1_3 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_1_1_4 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_1_1_5 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +116 │ │ │ │ │ +_1_1_8 virtual const M& _g_e_t_m_a_t () const = 0; │ │ │ │ │ +119 │ │ │ │ │ +_1_2_1 virtual _~_A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r () {} │ │ │ │ │ +122 }; │ │ │ │ │ +123 │ │ │ │ │ +124 │ │ │ │ │ +125 │ │ │ │ │ +126 //===================================================================== │ │ │ │ │ +127 // Implementation for ISTL-matrix based operator │ │ │ │ │ +128 //===================================================================== │ │ │ │ │ +129 │ │ │ │ │ +135 template │ │ │ │ │ +_1_3_6 class _M_a_t_r_i_x_A_d_a_p_t_e_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 │ │ │ │ │ +137 { │ │ │ │ │ +138 public: │ │ │ │ │ +_1_4_0 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_1_4_1 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_1_4_2 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_1_4_3 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +144 │ │ │ │ │ +_1_4_6 explicit _M_a_t_r_i_x_A_d_a_p_t_e_r (const M& A) : _A_(stackobject_to_shared_ptr(A)) {} │ │ │ │ │ +147 │ │ │ │ │ +_1_4_9 explicit _M_a_t_r_i_x_A_d_a_p_t_e_r (std::shared_ptr A) : _A_(A) {} │ │ │ │ │ +150 │ │ │ │ │ +_1_5_2 void _a_p_p_l_y (const X& x, Y& y) const override │ │ │ │ │ +153 { │ │ │ │ │ +154 _A_->mv(x,y); │ │ │ │ │ +155 } │ │ │ │ │ +156 │ │ │ │ │ +_1_5_8 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 │ │ │ │ │ +159 { │ │ │ │ │ +160 _A_->usmv(alpha,x,y); │ │ │ │ │ +161 } │ │ │ │ │ +162 │ │ │ │ │ +_1_6_4 const M& _g_e_t_m_a_t () const override │ │ │ │ │ +165 { │ │ │ │ │ +166 return *_A_; │ │ │ │ │ +167 } │ │ │ │ │ 168 │ │ │ │ │ -169 // user calls │ │ │ │ │ -170 │ │ │ │ │ -171 // default block recursion level = 1 │ │ │ │ │ -172 │ │ │ │ │ -174 template │ │ │ │ │ -_1_7_5 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ -176 { │ │ │ │ │ -177 typename X::field_type w=1; │ │ │ │ │ -178 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -179 } │ │ │ │ │ -181 template │ │ │ │ │ -_1_8_2 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -183 { │ │ │ │ │ -184 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -185 } │ │ │ │ │ -187 template │ │ │ │ │ -_1_8_8 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ -189 { │ │ │ │ │ -190 typename X::field_type w=1; │ │ │ │ │ -191 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -192 } │ │ │ │ │ -194 template │ │ │ │ │ -_1_9_5 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -196 { │ │ │ │ │ -197 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -198 } │ │ │ │ │ -199 │ │ │ │ │ -201 template │ │ │ │ │ -_2_0_2 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ -203 { │ │ │ │ │ -204 typename X::field_type w=1; │ │ │ │ │ -205 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -206 } │ │ │ │ │ -208 template │ │ │ │ │ -_2_0_9 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -210 { │ │ │ │ │ -211 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -212 } │ │ │ │ │ -214 template │ │ │ │ │ -_2_1_5 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ -216 { │ │ │ │ │ -217 typename X::field_type w=1; │ │ │ │ │ -218 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -219 } │ │ │ │ │ -221 template │ │ │ │ │ -_2_2_2 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -223 { │ │ │ │ │ -224 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_1_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -225 } │ │ │ │ │ -226 │ │ │ │ │ -227 // general block recursion level >= 0 │ │ │ │ │ -228 │ │ │ │ │ -230 template │ │ │ │ │ -_2_3_1 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> /*bl*/) │ │ │ │ │ -232 { │ │ │ │ │ -233 typename X::field_type w=1; │ │ │ │ │ -234 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -235 } │ │ │ │ │ -237 template │ │ │ │ │ -_2_3_8 void _b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ -239 { │ │ │ │ │ -240 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -241 } │ │ │ │ │ -243 template │ │ │ │ │ -_2_4_4 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> /*bl*/) │ │ │ │ │ -245 { │ │ │ │ │ -246 typename X::field_type w=1; │ │ │ │ │ -247 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -248 } │ │ │ │ │ -250 template │ │ │ │ │ -_2_5_1 void _u_b_l_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ -252 { │ │ │ │ │ -253 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_l_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -254 } │ │ │ │ │ -255 │ │ │ │ │ -257 template │ │ │ │ │ -_2_5_8 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> bl) │ │ │ │ │ -259 { │ │ │ │ │ -260 typename X::field_type w=1; │ │ │ │ │ -261 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -262 } │ │ │ │ │ -264 template │ │ │ │ │ -_2_6_5 void _b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> bl) │ │ │ │ │ -266 { │ │ │ │ │ -267 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_w_i_t_h_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -268 } │ │ │ │ │ -270 template │ │ │ │ │ -_2_7_1 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> bl) │ │ │ │ │ -272 { │ │ │ │ │ -273 typename X::field_type w=1; │ │ │ │ │ -274 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_n_o_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -275 } │ │ │ │ │ -277 template │ │ │ │ │ -_2_7_8 void _u_b_u_t_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> bl) │ │ │ │ │ -279 { │ │ │ │ │ -280 _a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_l_,_n_o_d_i_a_g_,_w_i_t_h_r_e_l_a_x_>_:_:_b_u_t_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -281 } │ │ │ │ │ -282 │ │ │ │ │ -283 │ │ │ │ │ -284 │ │ │ │ │ -285 //============================================================ │ │ │ │ │ -286 // generic block diagonal solves │ │ │ │ │ -287 // consider block decomposition A = L + D + U │ │ │ │ │ -288 // we can apply relaxation or not │ │ │ │ │ -289 // we can recurse over a fixed number of levels │ │ │ │ │ -290 //============================================================ │ │ │ │ │ -291 │ │ │ │ │ -292 // template meta program for diagonal solves │ │ │ │ │ -293 template │ │ │ │ │ -_2_9_4 struct _a_l_g_m_e_t_a___b_d_s_o_l_v_e { │ │ │ │ │ -295 template │ │ │ │ │ -_2_9_6 static void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -297 { │ │ │ │ │ -298 // iterator types │ │ │ │ │ -299 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -300 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -301 │ │ │ │ │ -302 // local solve at each block and immediate update │ │ │ │ │ -303 rowiterator rendi=A.beforeBegin(); │ │ │ │ │ -304 for (rowiterator i=A.beforeEnd(); i!=rendi; --i) │ │ │ │ │ -305 { │ │ │ │ │ -306 coliterator ii=(*i).find(i.index()); │ │ │ │ │ -307 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_I_-_1_,_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(*ii,v[i.index()],d[i.index()],w); │ │ │ │ │ -308 } │ │ │ │ │ -309 } │ │ │ │ │ -310 }; │ │ │ │ │ -311 │ │ │ │ │ -312 // recursion end ... │ │ │ │ │ -313 template<> │ │ │ │ │ -_3_1_4 struct _a_l_g_m_e_t_a___b_d_s_o_l_v_e<0,_w_i_t_h_r_e_l_a_x> { │ │ │ │ │ -315 template │ │ │ │ │ -_3_1_6 static void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -317 { │ │ │ │ │ -318 A.solve(v,d); │ │ │ │ │ -319 v *= w; │ │ │ │ │ -320 } │ │ │ │ │ -321 }; │ │ │ │ │ -322 template<> │ │ │ │ │ -_3_2_3 struct _a_l_g_m_e_t_a___b_d_s_o_l_v_e<0,_n_o_r_e_l_a_x> { │ │ │ │ │ -324 template │ │ │ │ │ -_3_2_5 static void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& /*w*/) │ │ │ │ │ -326 { │ │ │ │ │ -327 A.solve(v,d); │ │ │ │ │ -328 } │ │ │ │ │ -329 }; │ │ │ │ │ -330 │ │ │ │ │ -331 // user calls │ │ │ │ │ -332 │ │ │ │ │ -333 // default block recursion level = 1 │ │ │ │ │ -334 │ │ │ │ │ -336 template │ │ │ │ │ -_3_3_7 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ -338 { │ │ │ │ │ -339 typename X::field_type w=1; │ │ │ │ │ -340 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_1_,_n_o_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -341 } │ │ │ │ │ -343 template │ │ │ │ │ -_3_4_4 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w) │ │ │ │ │ -345 { │ │ │ │ │ -346 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_1_,_w_i_t_h_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -347 } │ │ │ │ │ -348 │ │ │ │ │ -349 // general block recursion level >= 0 │ │ │ │ │ -350 │ │ │ │ │ -352 template │ │ │ │ │ -_3_5_3 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, _B_L_<_l_> /*bl*/) │ │ │ │ │ -354 { │ │ │ │ │ -355 typename X::field_type w=1; │ │ │ │ │ -356 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_l_,_n_o_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -357 } │ │ │ │ │ -359 template │ │ │ │ │ -_3_6_0 void _b_d_s_o_l_v_e (const M& A, X& v, const Y& d, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ -361 { │ │ │ │ │ -362 _a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_l_,_w_i_t_h_r_e_l_a_x_>_:_:_b_d_s_o_l_v_e(A,v,d,w); │ │ │ │ │ -363 } │ │ │ │ │ -364 │ │ │ │ │ -365 │ │ │ │ │ -366 //============================================================ │ │ │ │ │ -367 // generic steps of iteration methods │ │ │ │ │ -368 // Jacobi, Gauss-Seidel, SOR, SSOR │ │ │ │ │ -369 // work directly on Ax=b, ie solve M(x^{i+1}-x^i) = w (b-Ax^i) │ │ │ │ │ -370 // we can recurse over a fixed number of levels │ │ │ │ │ -371 //============================================================ │ │ │ │ │ -372 │ │ │ │ │ -373 // template meta program for iterative solver steps │ │ │ │ │ -374 template │ │ │ │ │ -_3_7_5 struct _a_l_g_m_e_t_a___i_t_s_t_e_p_s { │ │ │ │ │ -376 │ │ │ │ │ -377 template │ │ │ │ │ -_3_7_8 static void _d_b_g_s (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -379 { │ │ │ │ │ -380 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -381 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -382 typedef typename Y::block_type bblock; │ │ │ │ │ -383 bblock rhs; │ │ │ │ │ -384 │ │ │ │ │ -385 X xold(x); // remember old x │ │ │ │ │ -386 │ │ │ │ │ -387 rowiterator endi=A.end(); │ │ │ │ │ -388 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -389 { │ │ │ │ │ -390 rhs = b[i.index()]; // rhs = b_i │ │ │ │ │ -391 coliterator endj=(*i).end(); │ │ │ │ │ -392 coliterator j=(*i).begin(); │ │ │ │ │ -393 if constexpr (IsNumber()) │ │ │ │ │ -394 { │ │ │ │ │ -395 for (; j.index() i │ │ │ │ │ -408 (*j).mmv(x[j.index()],rhs); // rhs -= sum_{j>i} a_ij * xold_j │ │ │ │ │ -409 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_t_y_p_e_n_a_m_e_ _M_:_:_b_l_o_c_k___t_y_p_e_>_:_:_d_b_g_s(*diag,x[i.index │ │ │ │ │ -()],rhs,w); // if I==1: xnew_i = rhs/a_ii │ │ │ │ │ -410 } │ │ │ │ │ -411 } │ │ │ │ │ -412 // next two lines: xnew_i = w / a_ii * (b_i - sum_{j=i} a_ij * xold_j) + (1-w)*xold; │ │ │ │ │ -413 x *= w; │ │ │ │ │ -414 x.axpy(K(1)-w,xold); │ │ │ │ │ -415 } │ │ │ │ │ -416 │ │ │ │ │ -417 template │ │ │ │ │ -_4_1_8 static void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -419 { │ │ │ │ │ -420 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -421 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -422 typedef typename Y::block_type bblock; │ │ │ │ │ -423 typedef typename X::block_type xblock; │ │ │ │ │ -424 bblock rhs; │ │ │ │ │ -425 xblock v; │ │ │ │ │ -426 │ │ │ │ │ -427 // Initialize nested data structure if there are entries │ │ │ │ │ -428 if(A.begin()!=A.end()) │ │ │ │ │ -429 v=x[0]; │ │ │ │ │ -430 │ │ │ │ │ -431 rowiterator endi=A.end(); │ │ │ │ │ -432 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -433 { │ │ │ │ │ -434 rhs = b[i.index()]; // rhs = b_i │ │ │ │ │ -435 coliterator endj=(*i).end(); // iterate over a_ij with j < i │ │ │ │ │ -436 coliterator j=(*i).begin(); │ │ │ │ │ -437 if constexpr (IsNumber()) │ │ │ │ │ -438 { │ │ │ │ │ -439 for (; j.index()=i} a_ij * xold_j) │ │ │ │ │ -446 } │ │ │ │ │ -447 else │ │ │ │ │ -448 { │ │ │ │ │ -449 for (; j.index()_:_:_b_s_o_r_f(*diag,v,rhs,w); // if │ │ │ │ │ -blocksize I==1: v = rhs/a_ii │ │ │ │ │ -455 x[i.index()].axpy(w,v); // x_i = w / a_ii * (b_i - sum_{j=i} a_ij * xold_j) │ │ │ │ │ -456 } │ │ │ │ │ -457 } │ │ │ │ │ -458 } │ │ │ │ │ -459 │ │ │ │ │ -460 template │ │ │ │ │ -_4_6_1 static void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -462 { │ │ │ │ │ -463 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -464 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -465 typedef typename Y::block_type bblock; │ │ │ │ │ -466 typedef typename X::block_type xblock; │ │ │ │ │ -467 bblock rhs; │ │ │ │ │ -468 xblock v; │ │ │ │ │ -469 │ │ │ │ │ -470 // Initialize nested data structure if there are entries │ │ │ │ │ -471 if(A.begin()!=A.end()) │ │ │ │ │ -472 v=x[0]; │ │ │ │ │ -473 │ │ │ │ │ -474 rowiterator endi=A.beforeBegin(); │ │ │ │ │ -475 for (rowiterator i=A.beforeEnd(); i!=endi; --i) │ │ │ │ │ -476 { │ │ │ │ │ -477 rhs = b[i.index()]; │ │ │ │ │ -478 coliterator endj=(*i).end(); │ │ │ │ │ -479 coliterator j=(*i).begin(); │ │ │ │ │ -480 if constexpr (IsNumber()) │ │ │ │ │ -481 { │ │ │ │ │ -482 for (; j.index()mmv(x[j.index()],rhs); │ │ │ │ │ -494 coliterator diag=j; │ │ │ │ │ -495 for (; j!=endj; ++j) │ │ │ │ │ -496 j->mmv(x[j.index()],rhs); │ │ │ │ │ -497 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_t_y_p_e_n_a_m_e_ _M_:_:_b_l_o_c_k___t_y_p_e_>_:_:_b_s_o_r_b(*diag,v,rhs,w); │ │ │ │ │ -498 x[i.index()].axpy(w,v); │ │ │ │ │ -499 } │ │ │ │ │ -500 } │ │ │ │ │ -501 } │ │ │ │ │ -502 │ │ │ │ │ -503 template │ │ │ │ │ -_5_0_4 static void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -505 { │ │ │ │ │ -506 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -507 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -508 typedef typename Y::block_type bblock; │ │ │ │ │ -509 bblock rhs; │ │ │ │ │ -510 │ │ │ │ │ -511 X v(x); // allocate with same size │ │ │ │ │ -512 │ │ │ │ │ -513 rowiterator endi=A.end(); │ │ │ │ │ -514 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -515 { │ │ │ │ │ -516 rhs = b[i.index()]; │ │ │ │ │ -517 coliterator endj=(*i).end(); │ │ │ │ │ -518 coliterator j=(*i).begin(); │ │ │ │ │ -519 if constexpr (IsNumber()) │ │ │ │ │ -520 { │ │ │ │ │ -521 for (; j.index()mmv(x[j.index()],rhs); │ │ │ │ │ -532 coliterator diag=j; │ │ │ │ │ -533 for (; j!=endj; ++j) │ │ │ │ │ -534 j->mmv(x[j.index()],rhs); │ │ │ │ │ -535 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_t_y_p_e_n_a_m_e_ _M_:_:_b_l_o_c_k___t_y_p_e_>_:_:_d_b_j_a_c(*diag,v[i.index │ │ │ │ │ -()],rhs,w); │ │ │ │ │ -536 } │ │ │ │ │ -537 } │ │ │ │ │ -538 x.axpy(w,v); │ │ │ │ │ -539 } │ │ │ │ │ -540 }; │ │ │ │ │ -541 // end of recursion │ │ │ │ │ -542 template │ │ │ │ │ -_5_4_3 struct _a_l_g_m_e_t_a___i_t_s_t_e_p_s<0,M> { │ │ │ │ │ -544 template │ │ │ │ │ -_5_4_5 static void _d_b_g_s (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ -546 { │ │ │ │ │ -547 A.solve(x,b); │ │ │ │ │ -548 } │ │ │ │ │ -549 template │ │ │ │ │ -_5_5_0 static void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ -551 { │ │ │ │ │ -552 A.solve(x,b); │ │ │ │ │ -553 } │ │ │ │ │ -554 template │ │ │ │ │ -_5_5_5 static void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ -556 { │ │ │ │ │ -557 A.solve(x,b); │ │ │ │ │ -558 } │ │ │ │ │ -559 template │ │ │ │ │ -_5_6_0 static void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& /*w*/) │ │ │ │ │ -561 { │ │ │ │ │ -562 A.solve(x,b); │ │ │ │ │ -563 } │ │ │ │ │ -564 }; │ │ │ │ │ -565 │ │ │ │ │ -566 template │ │ │ │ │ -_5_6_7 struct _a_l_g_m_e_t_a___i_t_s_t_e_p_s> │ │ │ │ │ -{ │ │ │ │ │ -568 template< │ │ │ │ │ -569 typename... MultiTypeVectorArgs, │ │ │ │ │ -570 class K> │ │ │ │ │ -_5_7_1 static void _d_b_g_s (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ -A, │ │ │ │ │ -572 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ -573 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ -574 const K& w) │ │ │ │ │ -575 { │ │ │ │ │ -576 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ -577 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_0_,_N_>_:_:_d_b_g_s(A, x, b, w); │ │ │ │ │ -578 } │ │ │ │ │ -579 │ │ │ │ │ -580 template< │ │ │ │ │ -581 typename... MultiTypeVectorArgs, │ │ │ │ │ -582 class K> │ │ │ │ │ -_5_8_3 static void _b_s_o_r_f (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ -A, │ │ │ │ │ -584 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ -585 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ -586 const K& w) │ │ │ │ │ -587 { │ │ │ │ │ -588 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ -589 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_0_,_N_>_:_:_b_s_o_r_f(A, x, b, w); │ │ │ │ │ -590 } │ │ │ │ │ -591 │ │ │ │ │ -592 template< │ │ │ │ │ -593 typename... MultiTypeVectorArgs, │ │ │ │ │ -594 class K> │ │ │ │ │ -_5_9_5 static void _b_s_o_r_b (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ -A, │ │ │ │ │ -596 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ -597 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ -598 const K& w) │ │ │ │ │ -599 { │ │ │ │ │ -600 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ -601 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_N_-_1_,_N_>_:_:_b_s_o_r_b(A, x, b, w); │ │ │ │ │ -602 } │ │ │ │ │ -603 │ │ │ │ │ -604 template< │ │ │ │ │ -605 typename... MultiTypeVectorArgs, │ │ │ │ │ -606 class K │ │ │ │ │ -607 > │ │ │ │ │ -_6_0_8 static void _d_b_j_a_c (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>& │ │ │ │ │ -A, │ │ │ │ │ -609 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& x, │ │ │ │ │ -610 const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_M_u_l_t_i_T_y_p_e_V_e_c_t_o_r_A_r_g_s_._._._>& b, │ │ │ │ │ -611 const K& w) │ │ │ │ │ -612 { │ │ │ │ │ -613 static const int N = _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._>_:_:_N(); │ │ │ │ │ -614 _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_0_,_N_>_:_:_d_b_j_a_c(A, x, b, w); │ │ │ │ │ -615 } │ │ │ │ │ -616 }; │ │ │ │ │ -617 │ │ │ │ │ -618 // user calls │ │ │ │ │ -619 │ │ │ │ │ -621 template │ │ │ │ │ -_6_2_2 void _d_b_g_s (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -623 { │ │ │ │ │ -624 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_d_b_g_s(A,x,b,w); │ │ │ │ │ -625 } │ │ │ │ │ -627 template │ │ │ │ │ -_6_2_8 void _d_b_g_s (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ -629 { │ │ │ │ │ -630 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_M_>_:_:_d_b_g_s(A,x,b,w); │ │ │ │ │ -631 } │ │ │ │ │ -633 template │ │ │ │ │ -_6_3_4 void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -635 { │ │ │ │ │ -636 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_b_s_o_r_f(A,x,b,w); │ │ │ │ │ -637 } │ │ │ │ │ -639 template │ │ │ │ │ -_6_4_0 void _b_s_o_r_f (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ -641 { │ │ │ │ │ -642 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_M_>_:_:_b_s_o_r_f(A,x,b,w); │ │ │ │ │ -643 } │ │ │ │ │ -645 template │ │ │ │ │ -_6_4_6 void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -647 { │ │ │ │ │ -648 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_b_s_o_r_b(A,x,b,w); │ │ │ │ │ -649 } │ │ │ │ │ -651 template │ │ │ │ │ -_6_5_2 void _b_s_o_r_b (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ -653 { │ │ │ │ │ -654 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_t_y_p_e_n_a_m_e_ _s_t_d_:_:_r_e_m_o_v_e___c_v_<_M_>_:_:_t_y_p_e>_:_:_b_s_o_r_b(A,x,b,w); │ │ │ │ │ -655 } │ │ │ │ │ -657 template │ │ │ │ │ -_6_5_8 void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& w) │ │ │ │ │ -659 { │ │ │ │ │ -660 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_1_,_M_>_:_:_d_b_j_a_c(A,x,b,w); │ │ │ │ │ -661 } │ │ │ │ │ -663 template │ │ │ │ │ -_6_6_4 void _d_b_j_a_c (const M& A, X& x, const Y& b, const K& w, _B_L_<_l_> /*bl*/) │ │ │ │ │ -665 { │ │ │ │ │ -666 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_l_,_M_>_:_:_d_b_j_a_c(A,x,b,w); │ │ │ │ │ -667 } │ │ │ │ │ -668 │ │ │ │ │ -669 │ │ │ │ │ -672} // end namespace │ │ │ │ │ -673 │ │ │ │ │ -674#endif │ │ │ │ │ -_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h │ │ │ │ │ -_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h │ │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:568 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:484 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:540 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_N │ │ │ │ │ -static constexpr size_type N() │ │ │ │ │ -Return the number of matrix rows. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:513 │ │ │ │ │ -_D_u_n_e_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ -void bltsolve(const M &A, X &v, const Y &d) │ │ │ │ │ -block lower triangular solve │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:175 │ │ │ │ │ -_D_u_n_e_:_:_W_i_t_h_D_i_a_g_T_y_p_e │ │ │ │ │ -WithDiagType │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:49 │ │ │ │ │ -_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_:_:_u_b_l_t_s_o_l_v_e │ │ │ │ │ -void ubltsolve(const M &A, X &v, const Y &d) │ │ │ │ │ -unit block lower triangular solve │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:188 │ │ │ │ │ -_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_:_:_d_b_g_s │ │ │ │ │ -void dbgs(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -GS step. │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:622 │ │ │ │ │ -_D_u_n_e_:_:_W_i_t_h_R_e_l_a_x_T_y_p_e │ │ │ │ │ -WithRelaxType │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_b_d_s_o_l_v_e │ │ │ │ │ -void bdsolve(const M &A, X &v, const Y &d) │ │ │ │ │ -block diagonal solve, no relaxation │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:337 │ │ │ │ │ -_D_u_n_e_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ -void butsolve(const M &A, X &v, const Y &d) │ │ │ │ │ -block upper triangular solve │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:202 │ │ │ │ │ -_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_:_:_u_b_u_t_s_o_l_v_e │ │ │ │ │ -void ubutsolve(const M &A, X &v, const Y &d) │ │ │ │ │ -unit block upper triangular solve │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:215 │ │ │ │ │ -_D_u_n_e_:_:_n_o_d_i_a_g │ │ │ │ │ -@ nodiag │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_w_i_t_h_d_i_a_g │ │ │ │ │ -@ withdiag │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_n_o_r_e_l_a_x │ │ │ │ │ -@ norelax │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_w_i_t_h_r_e_l_a_x │ │ │ │ │ -@ withrelax │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:55 │ │ │ │ │ +_1_7_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 │ │ │ │ │ +171 { │ │ │ │ │ +172 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; │ │ │ │ │ +173 } │ │ │ │ │ +174 │ │ │ │ │ +175 private: │ │ │ │ │ +176 const std::shared_ptr _A_; │ │ │ │ │ +177 }; │ │ │ │ │ +178 │ │ │ │ │ +181} // end namespace │ │ │ │ │ +182 │ │ │ │ │ +183#endif │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ -A Matrix class to support different block types. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockmatrix.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_B_L │ │ │ │ │ -compile-time parameter for block recursion depth │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_B_L_:_:_r_e_c_u_r_s_i_o_n___l_e_v_e_l │ │ │ │ │ -@ recursion_level │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ -static void butsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ -static void bltsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ -static void bltsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:114 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ -static void butsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ -static void bltsolve(const M &A, X &v, const Y &d, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:129 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _w_i_t_h_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ -static void butsolve(const M &A, X &v, const Y &d, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:134 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ -static void bltsolve(const M &, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ -static void butsolve(const M &, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:148 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_l_t_s_o_l_v_e │ │ │ │ │ -static void bltsolve(const M &, X &v, const Y &d, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:157 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_t_s_o_l_v_e_<_ _0_,_ _n_o_d_i_a_g_,_ _n_o_r_e_l_a_x_ _>_:_:_b_u_t_s_o_l_v_e │ │ │ │ │ -static void butsolve(const M &, X &v, const Y &d, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:162 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:294 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_:_:_b_d_s_o_l_v_e │ │ │ │ │ -static void bdsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:296 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _w_i_t_h_r_e_l_a_x_ _>_:_:_b_d_s_o_l_v_e │ │ │ │ │ -static void bdsolve(const M &A, X &v, const Y &d, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:316 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___b_d_s_o_l_v_e_<_ _0_,_ _n_o_r_e_l_a_x_ _>_:_:_b_d_s_o_l_v_e │ │ │ │ │ -static void bdsolve(const M &A, X &v, const Y &d, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:325 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:375 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:461 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:418 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:504 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:378 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:545 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:550 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _0_,_ _M_ _>_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const M &A, X &x, const Y &b, const K &) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:555 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ -_>_:_:_d_b_g_s │ │ │ │ │ -static void dbgs(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ -MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ -MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:571 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ -_>_:_:_d_b_j_a_c │ │ │ │ │ -static void dbjac(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ -MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ -MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:608 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ -_>_:_:_b_s_o_r_f │ │ │ │ │ -static void bsorf(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ -MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ -MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:583 │ │ │ │ │ -_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_ _I_,_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _M_u_l_t_i_T_y_p_e_M_a_t_r_i_x_A_r_g_s_._._._ _> │ │ │ │ │ -_>_:_:_b_s_o_r_b │ │ │ │ │ -static void bsorb(const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, │ │ │ │ │ -MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< │ │ │ │ │ -MultiTypeVectorArgs... > &b, const K &w) │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:595 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ +A linear operator. │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_~_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ +virtual ~LinearOperator() │ │ │ │ │ +every abstract base class has a virtual destructor │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 operators.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ +virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0 │ │ │ │ │ +apply operator to x, scale and add: │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 linear operator (see SolverCategory::Category) │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(const X &x, Y &y) const =0 │ │ │ │ │ +apply operator to x: The input vector is consistent and the output must also be │ │ │ │ │ +consistent on the in... │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:70 │ │ │ │ │ +_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:109 │ │ │ │ │ +_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_:_:_g_e_t_m_a_t │ │ │ │ │ +virtual const M & getmat() const =0 │ │ │ │ │ +get matrix via * │ │ │ │ │ +_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:113 │ │ │ │ │ +_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_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:115 │ │ │ │ │ +_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:114 │ │ │ │ │ +_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_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +export types, usually they come from the derived class │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:112 │ │ │ │ │ +_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_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ +virtual ~AssembledLinearOperator() │ │ │ │ │ +every abstract base class has a virtual destructor │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:121 │ │ │ │ │ +_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:137 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ │ +MatrixAdapter(std::shared_ptr< const M > A) │ │ │ │ │ +constructor: store an std::shared_ptr to a matrix │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ │ +MatrixAdapter(const M &A) │ │ │ │ │ +constructor: just store a reference to a matrix │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:146 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_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 operators.hh:158 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:143 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_g_e_t_m_a_t │ │ │ │ │ +const M & getmat() const override │ │ │ │ │ +get matrix via * │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:164 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +SolverCategory::Category category() const override │ │ │ │ │ +Category of the solver (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:170 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_a_p_p_l_y │ │ │ │ │ +void apply(const X &x, Y &y) const override │ │ │ │ │ +apply operator to x: │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:152 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +export types │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:140 │ │ │ │ │ +_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.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioner.hh File Reference │ │ │ │ +dune-istl: allocator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,33 +71,49 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
preconditioner.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Typedefs
│ │ │ │ +
allocator.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <dune/common/exceptions.hh>
│ │ │ │ -#include "solvercategory.hh"
│ │ │ │ +
#include <memory>
│ │ │ │ +#include <type_traits>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Preconditioner< X, Y >
 Base class for matrix free definition of preconditioners. More...
struct  Dune::exists< T >
 
struct  Dune::DefaultAllocatorTraits< T, typename >
 
struct  Dune::DefaultAllocatorTraits< T, std::void_t< typename T::allocator_type > >
 
struct  Dune::AllocatorTraits< T >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Typedefs

template<typename T >
using Dune::AllocatorType = typename AllocatorTraits< T >::type
 
template<typename T , typename X >
using Dune::ReboundAllocatorType = typename std::allocator_traits< typename AllocatorTraits< T >::type >::template rebind_alloc< X >
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,20 +1,35 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 "_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 | _T_y_p_e_d_e_f_s │ │ │ │ │ +allocator.hh File Reference │ │ │ │ │ +#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_:_:_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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_e_x_i_s_t_s_<_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_,_ _t_y_p_e_n_a_m_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _t_y_p_e_n_a_m_e_ _T_:_: │ │ │ │ │ + _a_l_l_o_c_a_t_o_r___t_y_p_e_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_A_l_l_o_c_a_t_o_r_T_y_p_e = typename _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s< T >::type │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _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 │ │ │ │ │ + _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s< T >::type >::template rebind_alloc< X > │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioner.hh Source File │ │ │ │ +dune-istl: allocator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,73 +74,76 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
preconditioner.hh
│ │ │ │ +
allocator.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ -
7
│ │ │ │ -
8#include <dune/common/exceptions.hh>
│ │ │ │ -
9
│ │ │ │ -
10#include "solvercategory.hh"
│ │ │ │ -
11
│ │ │ │ -
12namespace Dune {
│ │ │ │ -
17 //=====================================================================
│ │ │ │ -
30 //=====================================================================
│ │ │ │ -
31 template<class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
33 public:
│ │ │ │ -
35 typedef X domain_type;
│ │ │ │ -
37 typedef Y range_type;
│ │ │ │ -
39 typedef typename X::field_type field_type;
│ │ │ │ +
3#ifndef DUNE_ISTL_ALLOCATOR_HH
│ │ │ │ +
4#define DUNE_ISTL_ALLOCATOR_HH
│ │ │ │ +
5
│ │ │ │ +
6#include <memory>
│ │ │ │ +
7#include <type_traits>
│ │ │ │ +
8
│ │ │ │ +
9#include <dune/common/typetraits.hh>
│ │ │ │ +
10
│ │ │ │ +
│ │ │ │ +
11namespace Dune {
│ │ │ │ +
12
│ │ │ │ +
13 template<typename T>
│ │ │ │ +
│ │ │ │ +
14 struct exists{
│ │ │ │ +
15 static const bool value = true;
│ │ │ │ +
16 };
│ │ │ │ +
│ │ │ │ +
17
│ │ │ │ +
18 template<typename T, typename = void>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
20 {
│ │ │ │ +
21 using type = std::allocator<T>;
│ │ │ │ +
22 };
│ │ │ │ +
│ │ │ │ +
23
│ │ │ │ +
24 template<typename T>
│ │ │ │ +
│ │ │ │ +
25 struct DefaultAllocatorTraits<T, std::void_t<typename T::allocator_type> >
│ │ │ │ +
26 {
│ │ │ │ +
27 using type = typename T::allocator_type;
│ │ │ │ +
28 };
│ │ │ │ +
│ │ │ │ +
29
│ │ │ │ +
30 template<typename T>
│ │ │ │ + │ │ │ │ +
32
│ │ │ │ +
33 template<typename T>
│ │ │ │ + │ │ │ │ +
35
│ │ │ │ +
36 template<typename T, typename X>
│ │ │ │ +
37 using ReboundAllocatorType = typename std::allocator_traits<typename AllocatorTraits<T>::type>::template rebind_alloc<X>;
│ │ │ │ +
38
│ │ │ │ +
39} // end namespace Dune
│ │ │ │ +
│ │ │ │
40
│ │ │ │ -
69 virtual void pre (X& x, Y& b) = 0;
│ │ │ │ -
70
│ │ │ │ -
81 virtual void apply (X& v, const Y& d) = 0;
│ │ │ │ -
82
│ │ │ │ -
91 virtual void post (X& x) = 0;
│ │ │ │ -
92
│ │ │ │ - │ │ │ │ -
95#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ │ -
96 {
│ │ │ │ -
97 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
│ │ │ │ -
98 }
│ │ │ │ -
99#else
│ │ │ │ -
100 = 0;
│ │ │ │ -
101#endif
│ │ │ │ -
102
│ │ │ │ -
104 virtual ~Preconditioner () {}
│ │ │ │ -
105
│ │ │ │ -
106 };
│ │ │ │ -
│ │ │ │ -
107
│ │ │ │ -
111}
│ │ │ │ -
112#endif
│ │ │ │ - │ │ │ │ +
41#endif // DUNE_ISTL_ALLOCATOR_HH
│ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
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:104
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioner.hh:37
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioner.hh:35
│ │ │ │ -
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:39
│ │ │ │ -
virtual void pre(X &x, Y &b)=0
Prepare the preconditioner.
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ +
typename std::allocator_traits< typename AllocatorTraits< T >::type >::template rebind_alloc< X > ReboundAllocatorType
Definition allocator.hh:37
│ │ │ │ +
typename AllocatorTraits< T >::type AllocatorType
Definition allocator.hh:34
│ │ │ │ +
Definition allocator.hh:14
│ │ │ │ +
static const bool value
Definition allocator.hh:15
│ │ │ │ +
Definition allocator.hh:20
│ │ │ │ +
std::allocator< T > type
Definition allocator.hh:21
│ │ │ │ +
typename T::allocator_type type
Definition allocator.hh:27
│ │ │ │ +
Definition allocator.hh:31
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,91 +1,80 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -preconditioner.hh │ │ │ │ │ +allocator.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 (C) 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 │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ │ -11 │ │ │ │ │ -12namespace _D_u_n_e { │ │ │ │ │ -17 //===================================================================== │ │ │ │ │ -30 //===================================================================== │ │ │ │ │ -31 template │ │ │ │ │ -_3_2 class _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ -33 public: │ │ │ │ │ -_3_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_3_7 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_3_9 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +3#ifndef DUNE_ISTL_ALLOCATOR_HH │ │ │ │ │ +4#define DUNE_ISTL_ALLOCATOR_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8 │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +_1_1namespace _D_u_n_e { │ │ │ │ │ +12 │ │ │ │ │ +13 template │ │ │ │ │ +_1_4 struct _e_x_i_s_t_s{ │ │ │ │ │ +_1_5 static const bool _v_a_l_u_e = true; │ │ │ │ │ +16 }; │ │ │ │ │ +17 │ │ │ │ │ +18 template │ │ │ │ │ +_1_9 struct _D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s │ │ │ │ │ +20 { │ │ │ │ │ +_2_1 using _t_y_p_e = std::allocator; │ │ │ │ │ +22 }; │ │ │ │ │ +23 │ │ │ │ │ +24 template │ │ │ │ │ +_2_5 struct _D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s > │ │ │ │ │ +26 { │ │ │ │ │ +_2_7 using _t_y_p_e = typename T::allocator_type; │ │ │ │ │ +28 }; │ │ │ │ │ +29 │ │ │ │ │ +30 template │ │ │ │ │ +_3_1 struct _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s : public _D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s {}; │ │ │ │ │ +32 │ │ │ │ │ +33 template │ │ │ │ │ +_3_4 using _A_l_l_o_c_a_t_o_r_T_y_p_e = typename _A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_T_>_:_:_t_y_p_e; │ │ │ │ │ +35 │ │ │ │ │ +36 template │ │ │ │ │ +_3_7 using _R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e = typename std::allocator_traits::type>::template rebind_alloc; │ │ │ │ │ +38 │ │ │ │ │ +39} // end namespace Dune │ │ │ │ │ 40 │ │ │ │ │ -_6_9 virtual void _p_r_e (X& x, Y& b) = 0; │ │ │ │ │ -70 │ │ │ │ │ -_8_1 virtual void _a_p_p_l_y (X& v, const Y& d) = 0; │ │ │ │ │ -82 │ │ │ │ │ -_9_1 virtual void _p_o_s_t (X& x) = 0; │ │ │ │ │ -92 │ │ │ │ │ -_9_4 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -95#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ │ -96 { │ │ │ │ │ -97 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method │ │ │ │ │ -in a derived classes, in the future this method will pure virtual."); │ │ │ │ │ -98 } │ │ │ │ │ -99#else │ │ │ │ │ -100 = 0; │ │ │ │ │ -101#endif │ │ │ │ │ -102 │ │ │ │ │ -_1_0_4 virtual _~_P_r_e_c_o_n_d_i_t_i_o_n_e_r () {} │ │ │ │ │ -105 │ │ │ │ │ -106 }; │ │ │ │ │ -107 │ │ │ │ │ -111} │ │ │ │ │ -112#endif │ │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ +41#endif // DUNE_ISTL_ALLOCATOR_HH │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _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:32 │ │ │ │ │ -_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:104 │ │ │ │ │ -_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:37 │ │ │ │ │ -_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:35 │ │ │ │ │ -_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:39 │ │ │ │ │ -_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_:_:_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_:_:_A_l_l_o_c_a_t_o_r_T_y_p_e │ │ │ │ │ +typename AllocatorTraits< T >::type AllocatorType │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_e_x_i_s_t_s │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:14 │ │ │ │ │ +_D_u_n_e_:_:_e_x_i_s_t_s_:_:_v_a_l_u_e │ │ │ │ │ +static const bool value │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:15 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:20 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_:_:_t_y_p_e │ │ │ │ │ +std::allocator< T > type │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:21 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s_<_ _T_,_ _s_t_d_:_:_v_o_i_d___t_<_ _t_y_p_e_n_a_m_e_ _T_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e_ _>_ _>_:_: │ │ │ │ │ +_t_y_p_e │ │ │ │ │ +typename T::allocator_type type │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_A_l_l_o_c_a_t_o_r_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:31 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: blocklevel.hh File Reference │ │ │ │ +dune-istl: registry.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,61 +65,94 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ -Functions
│ │ │ │ -
blocklevel.hh File Reference
│ │ │ │ +Macros
│ │ │ │ +
registry.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Helper functions for determining the vector/matrix block level. │ │ │ │ -More...

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <dune/common/indices.hh>
│ │ │ │ -#include <dune/common/typetraits.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.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<typename T >
constexpr std::size_t Dune::maxBlockLevel ()
 Determine the maximum block level of a possibly nested vector/matrix type.
 
template<typename T >
constexpr std::size_t Dune::minBlockLevel ()
 Determine the minimum block level of a possibly nested vector/matrix type.
 
template<typename T >
constexpr bool Dune::hasUniqueBlockLevel ()
 Determine if a vector/matrix has a uniquely determinable block level.
 
template<typename T >
constexpr std::size_t Dune::blockLevel ()
 Determine the block level of a possibly nested vector/matrix type.
 

│ │ │ │ +Macros

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

Detailed Description

│ │ │ │ -

Helper functions for determining the vector/matrix block level.

│ │ │ │ -
│ │ │ │ +

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,43 +1,49 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -blocklevel.hh File Reference │ │ │ │ │ -Helper functions for determining the vector/matrix block level. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ + * _c_o_m_m_o_n │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ │ +registry.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_c_o_u_n_t_e_r_._h_h" │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -constexpr std::size_t  _D_u_n_e_:_:_m_a_x_B_l_o_c_k_L_e_v_e_l () │ │ │ │ │ -  Determine the maximum block level of a possibly nested │ │ │ │ │ - vector/matrix type. │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(Tag, id, ...) │ │ │ │ │   │ │ │ │ │ -template │ │ │ │ │ -constexpr std::size_t  _D_u_n_e_:_:_m_i_n_B_l_o_c_k_L_e_v_e_l () │ │ │ │ │ -  Determine the minimum block level of a possibly nested │ │ │ │ │ - vector/matrix type. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - constexpr bool  _D_u_n_e_:_:_h_a_s_U_n_i_q_u_e_B_l_o_c_k_L_e_v_e_l () │ │ │ │ │ -  Determine if a vector/matrix has a uniquely determinable │ │ │ │ │ - block level. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -constexpr std::size_t  _D_u_n_e_:_:_b_l_o_c_k_L_e_v_e_l () │ │ │ │ │ -  Determine the block level of a possibly nested vector/ │ │ │ │ │ - matrix type. │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__RREEGGIISSTTRRYY__PPUUTT ********** │ │ │ │ │ +#define DUNE_REGISTRY_PUT (   Tag, │ │ │ │ │ +   id, │ │ │ │ │ +   ......  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +namespace { \ │ │ │ │ │ +template<> \ │ │ │ │ │ +struct Registry \ │ │ │ │ │ +{ \ │ │ │ │ │ +static auto getCreator() \ │ │ │ │ │ +{ \ │ │ │ │ │ +return __VA_ARGS__; \ │ │ │ │ │ +} \ │ │ │ │ │ +static std::string name() { return id; } \ │ │ │ │ │ +}; \ │ │ │ │ │ +} \ │ │ │ │ │ +DUNE_INC_COUNTER(Tag) │ │ │ │ │ +_D_U_N_E___G_E_T___C_O_U_N_T_E_R │ │ │ │ │ +#define DUNE_GET_COUNTER(Tag) │ │ │ │ │ +DDeeffiinniittiioonn counter.hh:17 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: blocklevel.hh Source File │ │ │ │ +dune-istl: registry.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,207 +70,106 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
blocklevel.hh
│ │ │ │ +
registry.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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:
│ │ │ │ +
3#ifndef DUNE_ISTL_COMMON_REGISTRY_HH
│ │ │ │ +
4#define DUNE_ISTL_COMMON_REGISTRY_HH
│ │ │ │
5
│ │ │ │ -
6#ifndef DUNE_ISTL_BLOCKLEVEL_HH
│ │ │ │ -
7#define DUNE_ISTL_BLOCKLEVEL_HH
│ │ │ │ -
8
│ │ │ │ -
9#include <algorithm>
│ │ │ │ -
10#include <type_traits>
│ │ │ │ +
6#include <cstddef>
│ │ │ │ +
7#include <iostream>
│ │ │ │ +
8#include <memory>
│ │ │ │ +
9#include <string>
│ │ │ │ +
10#include <utility>
│ │ │ │
11
│ │ │ │ -
12#include <dune/common/indices.hh>
│ │ │ │ -
13#include <dune/common/typetraits.hh>
│ │ │ │ -
14#include <dune/common/hybridutilities.hh>
│ │ │ │ -
15
│ │ │ │ -
21// forward declaration
│ │ │ │ -
22namespace Dune {
│ │ │ │ -
23template<typename... Args>
│ │ │ │ -
24class MultiTypeBlockVector;
│ │ │ │ -
25template<typename FirstRow, typename... Args>
│ │ │ │ -
26class MultiTypeBlockMatrix;
│ │ │ │ -
27} // end namespace Dune
│ │ │ │ -
28
│ │ │ │ -
29namespace Dune { namespace Impl {
│ │ │ │ -
30
│ │ │ │ -
31// forward declaration
│ │ │ │ -
32template<typename T> struct MaxBlockLevel;
│ │ │ │ -
33template<typename T> struct MinBlockLevel;
│ │ │ │ -
34
│ │ │ │ -
36template<typename M, template<typename B> typename BlockLevel, typename Op>
│ │ │ │ -
37constexpr std::size_t blockLevelMultiTypeBlockMatrix(const Op& op)
│ │ │ │ -
38{
│ │ │ │ -
39 // inialize with zeroth diagonal block
│ │ │ │ -
40 using namespace Dune::Indices;
│ │ │ │ -
41 using Block00 = typename std::decay_t<decltype(std::declval<M>()[_0][_0])>;
│ │ │ │ -
42 std::size_t blockLevel = BlockLevel<Block00>::value() + 1;
│ │ │ │ -
43 // iterate over all blocks to determine min/max block level
│ │ │ │ -
44 using namespace Dune::Hybrid;
│ │ │ │ -
45 forEach(integralRange(index_constant<M::N()>()), [&](auto&& i) {
│ │ │ │ -
46 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
47 forEach(integralRange(index_constant<M::M()>()), [&](auto&& j) {
│ │ │ │ -
48 using Block = typename std::decay_t<decltype(std::declval<M>()[i][j])>;
│ │ │ │ -
49 blockLevel = op(blockLevel, BlockLevel<Block>::value() + 1);
│ │ │ │ -
50 });
│ │ │ │ -
51 });
│ │ │ │ -
52 return blockLevel;
│ │ │ │ -
53}
│ │ │ │ +
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
│ │ │ │ -
56template<typename V, template<typename B> typename BlockLevel, typename Op>
│ │ │ │ -
57constexpr std::size_t blockLevelMultiTypeBlockVector(const Op& op)
│ │ │ │ -
58{
│ │ │ │ -
59 // inialize with zeroth block
│ │ │ │ -
60 using namespace Dune::Indices;
│ │ │ │ -
61 using Block0 = typename std::decay_t<decltype(std::declval<V>()[_0])>;
│ │ │ │ -
62 std::size_t blockLevel = BlockLevel<Block0>::value() + 1;
│ │ │ │ -
63 // iterate over all blocks to determine min/max block level
│ │ │ │ -
64 using namespace Dune::Hybrid;
│ │ │ │ -
65 forEach(integralRange(index_constant<V::size()>()), [&](auto&& i) {
│ │ │ │ -
66 using Block = typename std::decay_t<decltype(std::declval<V>()[i])>;
│ │ │ │ -
67 blockLevel = op(blockLevel, BlockLevel<Block>::value() + 1);
│ │ │ │ -
68 });
│ │ │ │ -
69 return blockLevel;
│ │ │ │ -
70}
│ │ │ │ -
71
│ │ │ │ -
72template<typename T>
│ │ │ │ -
73struct MaxBlockLevel
│ │ │ │ -
74{
│ │ │ │ -
75 static constexpr std::size_t value(){
│ │ │ │ -
76 if constexpr (IsNumber<T>::value)
│ │ │ │ -
77 return 0;
│ │ │ │ -
78 else
│ │ │ │ -
79 return MaxBlockLevel<typename T::block_type>::value() + 1;
│ │ │ │ -
80 }
│ │ │ │ -
81};
│ │ │ │ -
82
│ │ │ │ -
83template<typename T>
│ │ │ │ -
84struct MinBlockLevel
│ │ │ │ -
85{
│ │ │ │ -
86 // the default implementation assumes minBlockLevel == maxBlockLevel
│ │ │ │ -
87 static constexpr std::size_t value()
│ │ │ │ -
88 { return MaxBlockLevel<T>::value(); }
│ │ │ │ -
89};
│ │ │ │ -
90
│ │ │ │ -
91// max block level for MultiTypeBlockMatrix
│ │ │ │ -
92template<typename FirstRow, typename... Args>
│ │ │ │ -
93struct MaxBlockLevel<Dune::MultiTypeBlockMatrix<FirstRow, Args...>>
│ │ │ │ -
94{
│ │ │ │ -
95 static constexpr std::size_t value()
│ │ │ │ -
96 {
│ │ │ │ -
97 using M = MultiTypeBlockMatrix<FirstRow, Args...>;
│ │ │ │ -
98 constexpr auto max = [](const auto& a, const auto& b){ return std::max(a,b); };
│ │ │ │ -
99 return blockLevelMultiTypeBlockMatrix<M, MaxBlockLevel>(max);
│ │ │ │ -
100 }
│ │ │ │ -
101};
│ │ │ │ -
102
│ │ │ │ -
103// min block level for MultiTypeBlockMatrix
│ │ │ │ -
104template<typename FirstRow, typename... Args>
│ │ │ │ -
105struct MinBlockLevel<Dune::MultiTypeBlockMatrix<FirstRow, Args...>>
│ │ │ │ -
106{
│ │ │ │ -
107 static constexpr std::size_t value()
│ │ │ │ -
108 {
│ │ │ │ -
109 using M = MultiTypeBlockMatrix<FirstRow, Args...>;
│ │ │ │ -
110 constexpr auto min = [](const auto& a, const auto& b){ return std::min(a,b); };
│ │ │ │ -
111 return blockLevelMultiTypeBlockMatrix<M, MinBlockLevel>(min);
│ │ │ │ -
112 }
│ │ │ │ -
113};
│ │ │ │ -
114
│ │ │ │ -
115// max block level for MultiTypeBlockVector
│ │ │ │ -
116template<typename... Args>
│ │ │ │ -
117struct MaxBlockLevel<Dune::MultiTypeBlockVector<Args...>>
│ │ │ │ -
118{
│ │ │ │ -
119 static constexpr std::size_t value()
│ │ │ │ -
120 {
│ │ │ │ -
121 using V = MultiTypeBlockVector<Args...>;
│ │ │ │ -
122 constexpr auto max = [](const auto& a, const auto& b){ return std::max(a,b); };
│ │ │ │ -
123 return blockLevelMultiTypeBlockVector<V, MaxBlockLevel>(max);
│ │ │ │ -
124 }
│ │ │ │ -
125};
│ │ │ │ -
126
│ │ │ │ -
127// min block level for MultiTypeBlockVector
│ │ │ │ -
128template<typename... Args>
│ │ │ │ -
129struct MinBlockLevel<Dune::MultiTypeBlockVector<Args...>>
│ │ │ │ -
130{
│ │ │ │ -
131 static constexpr std::size_t value()
│ │ │ │ -
132 {
│ │ │ │ -
133 using V = MultiTypeBlockVector<Args...>;
│ │ │ │ -
134 constexpr auto min = [](const auto& a, const auto& b){ return std::min(a,b); };
│ │ │ │ -
135 return blockLevelMultiTypeBlockVector<V, MinBlockLevel>(min);
│ │ │ │ -
136 }
│ │ │ │ -
137};
│ │ │ │ -
138
│ │ │ │ -
139// special case: empty MultiTypeBlockVector
│ │ │ │ -
140template<>
│ │ │ │ -
141struct MaxBlockLevel<Dune::MultiTypeBlockVector<>>
│ │ │ │ -
142{
│ │ │ │ -
143 static constexpr std::size_t value()
│ │ │ │ -
144 { return 0; };
│ │ │ │ -
145};
│ │ │ │ -
146
│ │ │ │ -
147// special case: empty MultiTypeBlockVector
│ │ │ │ -
148template<>
│ │ │ │ -
149struct MinBlockLevel<Dune::MultiTypeBlockVector<>>
│ │ │ │ -
150{
│ │ │ │ -
151 static constexpr std::size_t value()
│ │ │ │ -
152 { return 0; };
│ │ │ │ -
153};
│ │ │ │ -
154
│ │ │ │ -
155}} // end namespace Dune::Impl
│ │ │ │ -
156
│ │ │ │ -
157namespace Dune {
│ │ │ │ -
158
│ │ │ │ -
160template<typename T>
│ │ │ │ -
│ │ │ │ -
161constexpr std::size_t maxBlockLevel()
│ │ │ │ -
162{ return Impl::MaxBlockLevel<T>::value(); }
│ │ │ │ -
│ │ │ │ -
163
│ │ │ │ -
165template<typename T>
│ │ │ │ -
│ │ │ │ -
166constexpr std::size_t minBlockLevel()
│ │ │ │ -
167{ return Impl::MinBlockLevel<T>::value(); }
│ │ │ │ -
│ │ │ │ -
168
│ │ │ │ -
170template<typename T>
│ │ │ │ -
│ │ │ │ -
171constexpr bool hasUniqueBlockLevel()
│ │ │ │ -
172{ return maxBlockLevel<T>() == minBlockLevel<T>(); }
│ │ │ │ -
│ │ │ │ -
173
│ │ │ │ -
175template<typename T>
│ │ │ │ -
│ │ │ │ -
176constexpr std::size_t blockLevel()
│ │ │ │ -
177{
│ │ │ │ -
178 static_assert(hasUniqueBlockLevel<T>(), "Block level cannot be uniquely determined!");
│ │ │ │ -
179 return Impl::MaxBlockLevel<T>::value();
│ │ │ │ -
180}
│ │ │ │ -
│ │ │ │ -
181
│ │ │ │ -
182} // end namespace Dune
│ │ │ │ -
183
│ │ │ │ -
184#endif
│ │ │ │ +
55 /*
│ │ │ │ +
56 Register all creators from the registry in the Parameterizedobjectfactory An
│ │ │ │ +
57 object of V is passed in the creator ans 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 lead to an ICE woth g++-6
│ │ │ │ +
69 using Reg = Registry<Tag, index>;
│ │ │ │ +
70 auto genericcreator = Reg::getCreator();
│ │ │ │ +
71 factory.define(Reg::name(), [genericcreator](Args... args){
│ │ │ │ +
72 return genericcreator(V{}, args...);
│ │ │ │ +
73 });
│ │ │ │ +
74 });
│ │ │ │ +
75 return count;
│ │ │ │ +
76 }
│ │ │ │ +
77 } // end anonymous namespace
│ │ │ │ +
78} // end namespace Dune
│ │ │ │ +
79
│ │ │ │ +
80#endif // DUNE_ISTL_COMMON_REGISTRY_HH
│ │ │ │ + │ │ │ │ +
#define DUNE_GET_COUNTER(Tag)
Definition counter.hh:17
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
constexpr bool hasUniqueBlockLevel()
Determine if a vector/matrix has a uniquely determinable block level.
Definition blocklevel.hh:171
│ │ │ │ -
constexpr std::size_t maxBlockLevel()
Determine the maximum block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:161
│ │ │ │ -
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:176
│ │ │ │ -
constexpr std::size_t minBlockLevel()
Determine the minimum block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:166
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,207 +1,99 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -blocklevel.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 (C) 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: │ │ │ │ │ +3#ifndef DUNE_ISTL_COMMON_REGISTRY_HH │ │ │ │ │ +4#define DUNE_ISTL_COMMON_REGISTRY_HH │ │ │ │ │ 5 │ │ │ │ │ -6#ifndef DUNE_ISTL_BLOCKLEVEL_HH │ │ │ │ │ -7#define DUNE_ISTL_BLOCKLEVEL_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ 11 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -21// forward declaration │ │ │ │ │ -22namespace _D_u_n_e { │ │ │ │ │ -23template │ │ │ │ │ -24class MultiTypeBlockVector; │ │ │ │ │ -25template │ │ │ │ │ -26class MultiTypeBlockMatrix; │ │ │ │ │ -27} // end namespace Dune │ │ │ │ │ -28 │ │ │ │ │ -29namespace _D_u_n_e { namespace Impl { │ │ │ │ │ -30 │ │ │ │ │ -31// forward declaration │ │ │ │ │ -32template struct MaxBlockLevel; │ │ │ │ │ -33template struct MinBlockLevel; │ │ │ │ │ -34 │ │ │ │ │ -36template typename BlockLevel, typename Op> │ │ │ │ │ -37constexpr std::size_t blockLevelMultiTypeBlockMatrix(const Op& op) │ │ │ │ │ -38{ │ │ │ │ │ -39 // inialize with zeroth diagonal block │ │ │ │ │ -40 using namespace Dune::Indices; │ │ │ │ │ -41 using Block00 = typename std::decay_t()[_0][_0])>; │ │ │ │ │ -42 std::size_t _b_l_o_c_k_L_e_v_e_l = BlockLevel::value() + 1; │ │ │ │ │ -43 // iterate over all blocks to determine min/max block level │ │ │ │ │ -44 using namespace Dune::Hybrid; │ │ │ │ │ -45 forEach(integralRange(index_constant()), [&](auto&& i) { │ │ │ │ │ -46 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -47 forEach(integralRange(index_constant()), [&](auto&& j) { │ │ │ │ │ -48 using Block = typename std::decay_t()[i][j])>; │ │ │ │ │ -49 _b_l_o_c_k_L_e_v_e_l = op(_b_l_o_c_k_L_e_v_e_l, BlockLevel::value() + 1); │ │ │ │ │ -50 }); │ │ │ │ │ +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 _b_l_o_c_k_L_e_v_e_l; │ │ │ │ │ -53} │ │ │ │ │ +52 return result; │ │ │ │ │ +53 } │ │ │ │ │ 54 │ │ │ │ │ -56template typename BlockLevel, typename Op> │ │ │ │ │ -57constexpr std::size_t blockLevelMultiTypeBlockVector(const Op& op) │ │ │ │ │ -58{ │ │ │ │ │ -59 // inialize with zeroth block │ │ │ │ │ -60 using namespace Dune::Indices; │ │ │ │ │ -61 using Block0 = typename std::decay_t()[_0])>; │ │ │ │ │ -62 std::size_t _b_l_o_c_k_L_e_v_e_l = BlockLevel::value() + 1; │ │ │ │ │ -63 // iterate over all blocks to determine min/max block level │ │ │ │ │ -64 using namespace Dune::Hybrid; │ │ │ │ │ -65 forEach(integralRange(index_constant()), [&](auto&& i) { │ │ │ │ │ -66 using Block = typename std::decay_t()[i])>; │ │ │ │ │ -67 _b_l_o_c_k_L_e_v_e_l = op(_b_l_o_c_k_L_e_v_e_l, BlockLevel::value() + 1); │ │ │ │ │ -68 }); │ │ │ │ │ -69 return _b_l_o_c_k_L_e_v_e_l; │ │ │ │ │ -70} │ │ │ │ │ -71 │ │ │ │ │ -72template │ │ │ │ │ -73struct MaxBlockLevel │ │ │ │ │ -74{ │ │ │ │ │ -75 static constexpr std::size_t value(){ │ │ │ │ │ -76 if constexpr (IsNumber::value) │ │ │ │ │ -77 return 0; │ │ │ │ │ -78 else │ │ │ │ │ -79 return MaxBlockLevel::value() + 1; │ │ │ │ │ -80 } │ │ │ │ │ -81}; │ │ │ │ │ -82 │ │ │ │ │ -83template │ │ │ │ │ -84struct MinBlockLevel │ │ │ │ │ -85{ │ │ │ │ │ -86 // the default implementation assumes minBlockLevel == maxBlockLevel │ │ │ │ │ -87 static constexpr std::size_t value() │ │ │ │ │ -88 { return MaxBlockLevel::value(); } │ │ │ │ │ -89}; │ │ │ │ │ -90 │ │ │ │ │ -91// max block level for MultiTypeBlockMatrix │ │ │ │ │ -92template │ │ │ │ │ -93struct MaxBlockLevel<_D_u_n_e::MultiTypeBlockMatrix> │ │ │ │ │ -94{ │ │ │ │ │ -95 static constexpr std::size_t value() │ │ │ │ │ -96 { │ │ │ │ │ -97 using M = MultiTypeBlockMatrix; │ │ │ │ │ -98 constexpr auto max = [](const auto& a, const auto& b){ return std::max(a,b); │ │ │ │ │ -}; │ │ │ │ │ -99 return blockLevelMultiTypeBlockMatrix(max); │ │ │ │ │ -100 } │ │ │ │ │ -101}; │ │ │ │ │ -102 │ │ │ │ │ -103// min block level for MultiTypeBlockMatrix │ │ │ │ │ -104template │ │ │ │ │ -105struct MinBlockLevel<_D_u_n_e::MultiTypeBlockMatrix> │ │ │ │ │ -106{ │ │ │ │ │ -107 static constexpr std::size_t value() │ │ │ │ │ -108 { │ │ │ │ │ -109 using M = MultiTypeBlockMatrix; │ │ │ │ │ -110 constexpr auto min = [](const auto& a, const auto& b){ return std::min │ │ │ │ │ -(a,b); }; │ │ │ │ │ -111 return blockLevelMultiTypeBlockMatrix(min); │ │ │ │ │ -112 } │ │ │ │ │ -113}; │ │ │ │ │ -114 │ │ │ │ │ -115// max block level for MultiTypeBlockVector │ │ │ │ │ -116template │ │ │ │ │ -117struct MaxBlockLevel<_D_u_n_e::MultiTypeBlockVector> │ │ │ │ │ -118{ │ │ │ │ │ -119 static constexpr std::size_t value() │ │ │ │ │ -120 { │ │ │ │ │ -121 using V = MultiTypeBlockVector; │ │ │ │ │ -122 constexpr auto max = [](const auto& a, const auto& b){ return std::max │ │ │ │ │ -(a,b); }; │ │ │ │ │ -123 return blockLevelMultiTypeBlockVector(max); │ │ │ │ │ -124 } │ │ │ │ │ -125}; │ │ │ │ │ -126 │ │ │ │ │ -127// min block level for MultiTypeBlockVector │ │ │ │ │ -128template │ │ │ │ │ -129struct MinBlockLevel<_D_u_n_e::MultiTypeBlockVector> │ │ │ │ │ -130{ │ │ │ │ │ -131 static constexpr std::size_t value() │ │ │ │ │ -132 { │ │ │ │ │ -133 using V = MultiTypeBlockVector; │ │ │ │ │ -134 constexpr auto min = [](const auto& a, const auto& b){ return std::min │ │ │ │ │ -(a,b); }; │ │ │ │ │ -135 return blockLevelMultiTypeBlockVector(min); │ │ │ │ │ -136 } │ │ │ │ │ -137}; │ │ │ │ │ -138 │ │ │ │ │ -139// special case: empty MultiTypeBlockVector │ │ │ │ │ -140template<> │ │ │ │ │ -141struct MaxBlockLevel<_D_u_n_e::MultiTypeBlockVector<>> │ │ │ │ │ -142{ │ │ │ │ │ -143 static constexpr std::size_t value() │ │ │ │ │ -144 { return 0; }; │ │ │ │ │ -145}; │ │ │ │ │ -146 │ │ │ │ │ -147// special case: empty MultiTypeBlockVector │ │ │ │ │ -148template<> │ │ │ │ │ -149struct MinBlockLevel<_D_u_n_e::MultiTypeBlockVector<>> │ │ │ │ │ -150{ │ │ │ │ │ -151 static constexpr std::size_t value() │ │ │ │ │ -152 { return 0; }; │ │ │ │ │ -153}; │ │ │ │ │ -154 │ │ │ │ │ -155}} // end namespace Dune::Impl │ │ │ │ │ -156 │ │ │ │ │ -157namespace _D_u_n_e { │ │ │ │ │ -158 │ │ │ │ │ -160template │ │ │ │ │ -_1_6_1constexpr std::size_t _m_a_x_B_l_o_c_k_L_e_v_e_l() │ │ │ │ │ -162{ return Impl::MaxBlockLevel::value(); } │ │ │ │ │ -163 │ │ │ │ │ -165template │ │ │ │ │ -_1_6_6constexpr std::size_t _m_i_n_B_l_o_c_k_L_e_v_e_l() │ │ │ │ │ -167{ return Impl::MinBlockLevel::value(); } │ │ │ │ │ -168 │ │ │ │ │ -170template │ │ │ │ │ -_1_7_1constexpr bool _h_a_s_U_n_i_q_u_e_B_l_o_c_k_L_e_v_e_l() │ │ │ │ │ -172{ return maxBlockLevel() == minBlockLevel(); } │ │ │ │ │ -173 │ │ │ │ │ -175template │ │ │ │ │ -_1_7_6constexpr std::size_t _b_l_o_c_k_L_e_v_e_l() │ │ │ │ │ -177{ │ │ │ │ │ -178 static_assert(hasUniqueBlockLevel(), "Block level cannot be uniquely │ │ │ │ │ -determined!"); │ │ │ │ │ -179 return Impl::MaxBlockLevel::value(); │ │ │ │ │ -180} │ │ │ │ │ -181 │ │ │ │ │ -182} // end namespace Dune │ │ │ │ │ -183 │ │ │ │ │ -184#endif │ │ │ │ │ +55 /* │ │ │ │ │ +56 Register all creators from the registry in the Parameterizedobjectfactory An │ │ │ │ │ +57 object of V is passed in the creator ans 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 lead to an ICE woth g++-6 │ │ │ │ │ +69 using Reg = Registry; │ │ │ │ │ +70 auto genericcreator = Reg::getCreator(); │ │ │ │ │ +71 factory.define(Reg::name(), [genericcreator](Args... args){ │ │ │ │ │ +72 return genericcreator(V{}, args...); │ │ │ │ │ +73 }); │ │ │ │ │ +74 }); │ │ │ │ │ +75 return count; │ │ │ │ │ +76 } │ │ │ │ │ +77 } // end anonymous namespace │ │ │ │ │ +78} // end namespace Dune │ │ │ │ │ +79 │ │ │ │ │ +80#endif // DUNE_ISTL_COMMON_REGISTRY_HH │ │ │ │ │ +_c_o_u_n_t_e_r_._h_h │ │ │ │ │ +_D_U_N_E___G_E_T___C_O_U_N_T_E_R │ │ │ │ │ +#define DUNE_GET_COUNTER(Tag) │ │ │ │ │ +DDeeffiinniittiioonn counter.hh:17 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_h_a_s_U_n_i_q_u_e_B_l_o_c_k_L_e_v_e_l │ │ │ │ │ -constexpr bool hasUniqueBlockLevel() │ │ │ │ │ -Determine if a vector/matrix has a uniquely determinable block level. │ │ │ │ │ -DDeeffiinniittiioonn blocklevel.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_m_a_x_B_l_o_c_k_L_e_v_e_l │ │ │ │ │ -constexpr std::size_t maxBlockLevel() │ │ │ │ │ -Determine the maximum block level of a possibly nested vector/matrix type. │ │ │ │ │ -DDeeffiinniittiioonn blocklevel.hh:161 │ │ │ │ │ -_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_i_n_B_l_o_c_k_L_e_v_e_l │ │ │ │ │ -constexpr std::size_t minBlockLevel() │ │ │ │ │ -Determine the minimum block level of a possibly nested vector/matrix type. │ │ │ │ │ -DDeeffiinniittiioonn blocklevel.hh:166 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixmarket.hh File Reference │ │ │ │ +dune-istl: counter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,271 +65,125 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Enumerations | │ │ │ │ -Functions | │ │ │ │ +Macros | │ │ │ │ Variables
│ │ │ │ - │ │ │ │ +
counter.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

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 <cassert>
│ │ │ │ +#include <typeinfo>
│ │ │ │ #include <iostream>
│ │ │ │ -#include <istream>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <set>
│ │ │ │ -#include <sstream>
│ │ │ │ -#include <string>
│ │ │ │ +#include <memory>
│ │ │ │ #include <tuple>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/hybridutilities.hh>
│ │ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ │ -#include <dune/common/simd/simd.hh>
│ │ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ -#include <dune/istl/bvector.hh>
│ │ │ │ -#include <dune/istl/matrixutils.hh>
│ │ │ │ -#include <dune/istl/owneroverlapcopy.hh>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <dune/common/typeutilities.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

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::MatrixMarketImpl
namespace  Dune::CounterImpl
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

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

│ │ │ │ +Macros

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

│ │ │ │ Variables

static const int Dune::default_precision = -1
 
constexpr std::size_t maxcount = 100
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

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

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

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DUNE_GET_COUNTER

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

◆ DUNE_INC_COUNTER

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

Variable Documentation

│ │ │ │ + │ │ │ │ +

◆ maxcount

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

Implementation of the BCRSMatrix class. │ │ │ │ +More...

│ │ │ │ +
#include <cmath>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <set>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <numeric>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <map>
│ │ │ │ +#include <memory>
│ │ │ │ +#include "istlexception.hh"
│ │ │ │ +#include "bvector.hh"
│ │ │ │ +#include "matrixutils.hh"
│ │ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ │ +#include <dune/common/iteratorfacades.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/ftraits.hh>
│ │ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

struct  Dune::CompressionStatistics< size_type >
 Statistics about compression achieved in implicit mode. More...
 
class  Dune::ImplicitMatrixBuilder< M_ >
 A wrapper for uniform access to the BCRSMatrix during and after the build stage in implicit build mode. More...
 
class  Dune::ImplicitMatrixBuilder< M_ >::row_object
 Proxy row object for entry access. More...
 
class  Dune::BCRSMatrix< B, A >
 A sparse block matrix with compressed row storage. More...
 
class  Dune::BCRSMatrix< B, A >::RealRowIterator< T >
 Iterator access to matrix rows More...
 
class  Dune::BCRSMatrix< B, A >::CreateIterator
 Iterator class for sequential creation of blocks More...
 
struct  Dune::FieldTraits< BCRSMatrix< B, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::ForEach
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

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

Detailed Description

│ │ │ │ +

Implementation of the BCRSMatrix class.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,51 +1,58 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -_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> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +bcrsmatrix.hh File Reference │ │ │ │ │ +Implementation of the BCRSMatrix class. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#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 "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._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_. │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ +CCllaasssseess │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_<_ _s_i_z_e___t_y_p_e_ _> │ │ │ │ │ +  Statistics about compression achieved in implicit mode. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_<_ _M___ _> │ │ │ │ │ +  A wrapper for uniform access to the _B_C_R_S_M_a_t_r_i_x during and after the │ │ │ │ │ + build stage in implicit build mode. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_<_ _M___ _>_:_:_r_o_w___o_b_j_e_c_t │ │ │ │ │ +  Proxy row object for entry access. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _> │ │ │ │ │ +  A sparse block matrix with compressed row storage. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_F_o_r_E_a_c_h │ │ │ │ │ + class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_ _T_ _> │ │ │ │ │ +  Iterator access to matrix rows _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -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. │ │ │ │ │ + class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +  Iterator class for sequential creation of blocks _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: foreach.hh Source File │ │ │ │ +dune-istl: bcrsmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,201 +74,2072 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
foreach.hh
│ │ │ │ +
bcrsmatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
3#pragma once
│ │ │ │ -
4
│ │ │ │ -
5#include<type_traits>
│ │ │ │ -
6#include<utility>
│ │ │ │ -
7#include<cassert>
│ │ │ │ +
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_BCRSMATRIX_HH
│ │ │ │ +
7#define DUNE_ISTL_BCRSMATRIX_HH
│ │ │ │
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{
│ │ │ │ +
9#include <cmath>
│ │ │ │ +
10#include <complex>
│ │ │ │ +
11#include <set>
│ │ │ │ +
12#include <iostream>
│ │ │ │ +
13#include <algorithm>
│ │ │ │ +
14#include <numeric>
│ │ │ │ +
15#include <vector>
│ │ │ │ +
16#include <map>
│ │ │ │ +
17#include <memory>
│ │ │ │
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
│ │ │ │ -
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 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
│ │ │ │ -
│ │ │ │ +
19#include "istlexception.hh"
│ │ │ │ +
20#include "bvector.hh"
│ │ │ │ +
21#include "matrixutils.hh"
│ │ │ │ +
22#include <dune/common/stdstreams.hh>
│ │ │ │ +
23#include <dune/common/iteratorfacades.hh>
│ │ │ │ +
24#include <dune/common/typetraits.hh>
│ │ │ │ +
25#include <dune/common/ftraits.hh>
│ │ │ │ +
26#include <dune/common/scalarvectorview.hh>
│ │ │ │ +
27#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +
28
│ │ │ │ + │ │ │ │ +
30
│ │ │ │ +
35namespace Dune {
│ │ │ │ +
36
│ │ │ │ +
76 template<typename M>
│ │ │ │ +
77 struct MatrixDimension;
│ │ │ │
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 // 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 }();
│ │ │ │ +
86 template<typename size_type>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
88 {
│ │ │ │ +
90 double avg;
│ │ │ │ +
92 size_type maximum;
│ │ │ │ +
94 size_type overflow_total;
│ │ │ │ +
96
│ │ │ │ +
99 double mem_ratio;
│ │ │ │ +
100 };
│ │ │ │ +
│ │ │ │ +
101
│ │ │ │ +
103
│ │ │ │ +
115 template<class M_>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
117 {
│ │ │ │ +
118
│ │ │ │ +
119 public:
│ │ │ │ +
120
│ │ │ │ +
122 typedef M_ Matrix;
│ │ │ │ +
123
│ │ │ │ + │ │ │ │ +
126
│ │ │ │ +
128 typedef typename Matrix::size_type size_type;
│ │ │ │ +
129
│ │ │ │ +
131
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
137 {
│ │ │ │ +
138
│ │ │ │ +
139 public:
│ │ │ │ +
140
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
143 {
│ │ │ │ +
144 return _m.entry(_i,j);
│ │ │ │ +
145 }
│ │ │ │ +
│ │ │ │ +
146
│ │ │ │ +
147#ifndef DOXYGEN
│ │ │ │ +
148
│ │ │ │ + │ │ │ │ +
150 : _m(m)
│ │ │ │ +
151 , _i(i)
│ │ │ │ +
152 {}
│ │ │ │ +
153
│ │ │ │ +
154#endif
│ │ │ │
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 auto [ dummyRows, dummyCols ] = flatMatrixForEach(entry, f, rowOffset + rowIdx*blockRows, colOffset + colIdx*blockCols);
│ │ │ │ -
171 assert( dummyRows == blockRows and dummyCols == blockCols and "we need the same size of each block in this matrix type");
│ │ │ │ -
172 }
│ │ │ │ -
173 }
│ │ │ │ -
174
│ │ │ │ -
175 return { matrix.N()*blockRows, matrix.M()*blockCols };
│ │ │ │ -
176 }
│ │ │ │ -
177 // all other matrix types are accessed index-wise with dynamic flat row/col counting
│ │ │ │ -
178 else
│ │ │ │ -
179 {
│ │ │ │ -
180 std::size_t r = 0, c = 0;
│ │ │ │ -
181 std::size_t nRows, nCols;
│ │ │ │ -
182
│ │ │ │ -
183 Hybrid::forEach(Dune::range(ForEach::rows(matrix)), [&](auto i) {
│ │ │ │ -
184 c = 0;
│ │ │ │ -
185 Hybrid::forEach(Dune::range(ForEach::cols(matrix)), [&](auto j) {
│ │ │ │ -
186 std::tie(nRows,nCols) = flatMatrixForEach(matrix[i][j], f, rowOffset + r, colOffset + c);
│ │ │ │ -
187 c += nCols;
│ │ │ │ -
188 });
│ │ │ │ -
189 r += nRows;
│ │ │ │ -
190 });
│ │ │ │ -
191 return {r,c};
│ │ │ │ -
192 }
│ │ │ │ -
193 }
│ │ │ │ -
194}
│ │ │ │ -
│ │ │ │ -
195
│ │ │ │ -
196} // namespace Dune
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ -
This file implements a quadratic matrix of fixed size which is a multiple of the identity.
│ │ │ │ +
156 private:
│ │ │ │ +
157
│ │ │ │ +
158 Matrix& _m;
│ │ │ │ + │ │ │ │ +
160
│ │ │ │ +
161 };
│ │ │ │ +
│ │ │ │ +
162
│ │ │ │ +
164
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
171 : _m(m)
│ │ │ │ +
172 {
│ │ │ │ +
173 if (m.buildMode() != Matrix::implicit)
│ │ │ │ +
174 DUNE_THROW(BCRSMatrixError,"You can only create an ImplicitBuilder for a matrix in implicit build mode");
│ │ │ │ +
175 if (m.buildStage() != Matrix::building)
│ │ │ │ +
176 DUNE_THROW(BCRSMatrixError,"You can only create an ImplicitBuilder for a matrix with set size that has not been compressed() yet");
│ │ │ │ +
177 }
│ │ │ │ +
│ │ │ │ +
178
│ │ │ │ +
180
│ │ │ │ +
│ │ │ │ +
194 ImplicitMatrixBuilder(Matrix& m, size_type rows, size_type cols, size_type avg_cols_per_row, double overflow_fraction)
│ │ │ │ +
195 : _m(m)
│ │ │ │ +
196 {
│ │ │ │ +
197 if (m.buildStage() != Matrix::notAllocated)
│ │ │ │ +
198 DUNE_THROW(BCRSMatrixError,"You can only set up a matrix for this ImplicitBuilder if it has no memory allocated yet");
│ │ │ │ +
199 m.setBuildMode(Matrix::implicit);
│ │ │ │ +
200 m.setImplicitBuildModeParameters(avg_cols_per_row,overflow_fraction);
│ │ │ │ +
201 m.setSize(rows,cols);
│ │ │ │ +
202 }
│ │ │ │ +
│ │ │ │ +
203
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
206 {
│ │ │ │ +
207 return row_object(_m,i);
│ │ │ │ +
208 }
│ │ │ │ +
│ │ │ │ +
209
│ │ │ │ +
│ │ │ │ +
211 size_type N() const
│ │ │ │ +
212 {
│ │ │ │ +
213 return _m.N();
│ │ │ │ +
214 }
│ │ │ │ +
│ │ │ │ +
215
│ │ │ │ +
│ │ │ │ +
217 size_type M() const
│ │ │ │ +
218 {
│ │ │ │ +
219 return _m.M();
│ │ │ │ +
220 }
│ │ │ │ +
│ │ │ │ +
221
│ │ │ │ +
222 private:
│ │ │ │ +
223
│ │ │ │ +
224 Matrix& _m;
│ │ │ │ +
225
│ │ │ │ +
226 };
│ │ │ │ +
│ │ │ │ +
227
│ │ │ │ +
464 template<class B, class A=std::allocator<B> >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
466 {
│ │ │ │ +
467 friend struct MatrixDimension<BCRSMatrix>;
│ │ │ │ +
468 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
482 built=3
│ │ │ │ +
483 };
│ │ │ │ +
│ │ │ │ +
484
│ │ │ │ +
485 //===== type definitions and constants
│ │ │ │ +
486
│ │ │ │ +
488 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
489
│ │ │ │ +
491 typedef B block_type;
│ │ │ │ +
492
│ │ │ │ +
494 typedef A allocator_type;
│ │ │ │ +
495
│ │ │ │ +
497 typedef Imp::CompressedBlockVectorWindow<B,A> row_type;
│ │ │ │ +
498
│ │ │ │ +
500 typedef typename A::size_type size_type;
│ │ │ │ +
501
│ │ │ │ +
503 typedef ::Dune::CompressionStatistics<size_type> CompressionStatistics;
│ │ │ │ +
504
│ │ │ │ +
506 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
507 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ +
508
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
543 unknown
│ │ │ │ +
544 };
│ │ │ │ +
│ │ │ │ +
545
│ │ │ │ +
546 //===== random access interface to rows of the matrix
│ │ │ │ +
547
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
550 {
│ │ │ │ +
551#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
552 if (build_mode == implicit && ready != built)
│ │ │ │ +
553 DUNE_THROW(BCRSMatrixError,"You cannot use operator[] in implicit build mode before calling compress()");
│ │ │ │ +
554 if (r==0) DUNE_THROW(BCRSMatrixError,"row not initialized yet");
│ │ │ │ +
555 if (i>=n) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
556#endif
│ │ │ │ +
557 return r[i];
│ │ │ │ +
558 }
│ │ │ │ +
│ │ │ │ +
559
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
562 {
│ │ │ │ +
563#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
564 if (build_mode == implicit && ready != built)
│ │ │ │ +
565 DUNE_THROW(BCRSMatrixError,"You cannot use operator[] in implicit build mode before calling compress()");
│ │ │ │ +
566 if (built!=ready) DUNE_THROW(BCRSMatrixError,"row not initialized yet");
│ │ │ │ +
567 if (i>=n) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
568#endif
│ │ │ │ +
569 return r[i];
│ │ │ │ +
570 }
│ │ │ │ +
│ │ │ │ +
571
│ │ │ │ +
572
│ │ │ │ +
573 //===== iterator interface to rows of the matrix
│ │ │ │ +
574
│ │ │ │ +
576 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
578 : public RandomAccessIteratorFacade<RealRowIterator<T>, T>
│ │ │ │ +
579 {
│ │ │ │ +
580
│ │ │ │ +
581 public:
│ │ │ │ +
583 typedef typename std::remove_const<T>::type ValueType;
│ │ │ │ +
584
│ │ │ │ +
585 friend class RandomAccessIteratorFacade<RealRowIterator<const ValueType>, const ValueType>;
│ │ │ │ +
586 friend class RandomAccessIteratorFacade<RealRowIterator<ValueType>, ValueType>;
│ │ │ │ +
587 friend class RealRowIterator<const ValueType>;
│ │ │ │ +
588 friend class RealRowIterator<ValueType>;
│ │ │ │ +
589
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
592 : p(_p), i(_i)
│ │ │ │ +
593 {}
│ │ │ │ +
│ │ │ │ +
594
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
597 : p(0), i(0)
│ │ │ │ +
598 {}
│ │ │ │ +
│ │ │ │ +
599
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
601 : p(it.p), i(it.i)
│ │ │ │ +
602 {}
│ │ │ │ +
│ │ │ │ +
603
│ │ │ │ +
604
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
607 {
│ │ │ │ +
608 return i;
│ │ │ │ +
609 }
│ │ │ │ +
│ │ │ │ +
610
│ │ │ │ +
│ │ │ │ +
611 std::ptrdiff_t distanceTo(const RealRowIterator<ValueType>& other) const
│ │ │ │ +
612 {
│ │ │ │ +
613 assert(other.p==p);
│ │ │ │ +
614 return (other.i-i);
│ │ │ │ +
615 }
│ │ │ │ +
│ │ │ │ +
616
│ │ │ │ +
│ │ │ │ +
617 std::ptrdiff_t distanceTo(const RealRowIterator<const ValueType>& other) const
│ │ │ │ +
618 {
│ │ │ │ +
619 assert(other.p==p);
│ │ │ │ +
620 return (other.i-i);
│ │ │ │ +
621 }
│ │ │ │ +
│ │ │ │ +
622
│ │ │ │ +
│ │ │ │ +
624 bool equals (const RealRowIterator<ValueType>& other) const
│ │ │ │ +
625 {
│ │ │ │ +
626 assert(other.p==p);
│ │ │ │ +
627 return i==other.i;
│ │ │ │ +
628 }
│ │ │ │ +
│ │ │ │ +
629
│ │ │ │ +
│ │ │ │ +
631 bool equals (const RealRowIterator<const ValueType>& other) const
│ │ │ │ +
632 {
│ │ │ │ +
633 assert(other.p==p);
│ │ │ │ +
634 return i==other.i;
│ │ │ │ +
635 }
│ │ │ │ +
│ │ │ │ +
636
│ │ │ │ +
637 private:
│ │ │ │ +
639 void increment()
│ │ │ │ +
640 {
│ │ │ │ +
641 ++i;
│ │ │ │ +
642 }
│ │ │ │ +
643
│ │ │ │ +
645 void decrement()
│ │ │ │ +
646 {
│ │ │ │ +
647 --i;
│ │ │ │ +
648 }
│ │ │ │ +
649
│ │ │ │ +
650 void advance(std::ptrdiff_t diff)
│ │ │ │ +
651 {
│ │ │ │ +
652 i+=diff;
│ │ │ │ +
653 }
│ │ │ │ +
654
│ │ │ │ +
655 T& elementAt(std::ptrdiff_t diff) const
│ │ │ │ +
656 {
│ │ │ │ +
657 return p[i+diff];
│ │ │ │ +
658 }
│ │ │ │ +
659
│ │ │ │ +
661 row_type& dereference () const
│ │ │ │ +
662 {
│ │ │ │ +
663 return p[i];
│ │ │ │ +
664 }
│ │ │ │ +
665
│ │ │ │ +
666 row_type* p;
│ │ │ │ +
667 size_type i;
│ │ │ │ +
668 };
│ │ │ │ +
│ │ │ │ +
669
│ │ │ │ + │ │ │ │ + │ │ │ │ +
673
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
676 {
│ │ │ │ +
677 return Iterator(r,0);
│ │ │ │ +
678 }
│ │ │ │ +
│ │ │ │ +
679
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
682 {
│ │ │ │ +
683 return Iterator(r,n);
│ │ │ │ +
684 }
│ │ │ │ +
│ │ │ │ +
685
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
689 {
│ │ │ │ +
690 return Iterator(r,n-1);
│ │ │ │ +
691 }
│ │ │ │ +
│ │ │ │ +
692
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
696 {
│ │ │ │ +
697 return Iterator(r,-1);
│ │ │ │ +
698 }
│ │ │ │ +
│ │ │ │ +
699
│ │ │ │ + │ │ │ │ +
702
│ │ │ │ +
704 typedef typename row_type::Iterator ColIterator;
│ │ │ │ +
705
│ │ │ │ + │ │ │ │ + │ │ │ │ +
709
│ │ │ │ +
710
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
713 {
│ │ │ │ +
714 return ConstIterator(r,0);
│ │ │ │ +
715 }
│ │ │ │ +
│ │ │ │ +
716
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
719 {
│ │ │ │ +
720 return ConstIterator(r,n);
│ │ │ │ +
721 }
│ │ │ │ +
│ │ │ │ +
722
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
726 {
│ │ │ │ +
727 return ConstIterator(r,n-1);
│ │ │ │ +
728 }
│ │ │ │ +
│ │ │ │ +
729
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
733 {
│ │ │ │ +
734 return ConstIterator(r,-1);
│ │ │ │ +
735 }
│ │ │ │ +
│ │ │ │ +
736
│ │ │ │ + │ │ │ │ +
739
│ │ │ │ +
741 typedef typename row_type::ConstIterator ConstColIterator;
│ │ │ │ +
742
│ │ │ │ +
743 //===== constructors & resizers
│ │ │ │ +
744
│ │ │ │ +
745 // we use a negative compressionBufferSize to indicate that the implicit
│ │ │ │ +
746 // mode parameters have not been set yet
│ │ │ │ +
747
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
750 : build_mode(unknown), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ +
751 allocationSize_(0), r(0), a(0),
│ │ │ │ + │ │ │ │ +
753 {}
│ │ │ │ +
│ │ │ │ +
754
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
757 : build_mode(bm), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ +
758 allocationSize_(0), r(0), a(0),
│ │ │ │ + │ │ │ │ +
760 {
│ │ │ │ +
761 allocate(_n, _m, _nnz,true,false);
│ │ │ │ +
762 }
│ │ │ │ +
│ │ │ │ +
763
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
766 : build_mode(bm), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ +
767 allocationSize_(0), r(0), a(0),
│ │ │ │ + │ │ │ │ +
769 {
│ │ │ │ +
770 allocate(_n, _m,0,true,false);
│ │ │ │ +
771 }
│ │ │ │ +
│ │ │ │ +
772
│ │ │ │ +
774
│ │ │ │ +
│ │ │ │ +
784 BCRSMatrix (size_type _n, size_type _m, size_type _avg, double compressionBufferSize, BuildMode bm)
│ │ │ │ +
785 : build_mode(bm), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ +
786 allocationSize_(0), r(0), a(0),
│ │ │ │ +
787 avg(_avg), compressionBufferSize_(compressionBufferSize)
│ │ │ │ +
788 {
│ │ │ │ +
789 if (bm != implicit)
│ │ │ │ +
790 DUNE_THROW(BCRSMatrixError,"Only call this constructor when using the implicit build mode");
│ │ │ │ +
791 // Prevent user from setting a negative compression buffer size:
│ │ │ │ +
792 // 1) It doesn't make sense
│ │ │ │ +
793 // 2) We use a negative value to indicate that the parameters
│ │ │ │ +
794 // have not been set yet
│ │ │ │ +
795 if (compressionBufferSize_ < 0.0)
│ │ │ │ +
796 DUNE_THROW(BCRSMatrixError,"You cannot set a negative overflow fraction");
│ │ │ │ +
797 implicit_allocate(_n,_m);
│ │ │ │ +
798 }
│ │ │ │ +
│ │ │ │ +
799
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
806 : build_mode(Mat.build_mode), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ +
807 allocationSize_(0), r(0), a(0),
│ │ │ │ + │ │ │ │ +
809 {
│ │ │ │ +
810 if (!(Mat.ready == notAllocated || Mat.ready == built))
│ │ │ │ +
811 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copy-constructed when source matrix is completely empty (size not set) or fully built)");
│ │ │ │ +
812
│ │ │ │ +
813 // deep copy in global array
│ │ │ │ +
814 size_type _nnz = Mat.nonzeroes();
│ │ │ │ +
815
│ │ │ │ +
816 j_ = Mat.j_; // enable column index sharing, release array in case of row-wise allocation
│ │ │ │ +
817 allocate(Mat.n, Mat.m, _nnz, true, true);
│ │ │ │ +
818
│ │ │ │ +
819 // build window structure
│ │ │ │ + │ │ │ │ +
821 }
│ │ │ │ +
│ │ │ │ +
822
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
825 {
│ │ │ │ +
826 deallocate();
│ │ │ │ +
827 }
│ │ │ │ +
│ │ │ │ +
828
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
834 {
│ │ │ │ +
835 if (ready == notAllocated)
│ │ │ │ +
836 {
│ │ │ │ +
837 build_mode = bm;
│ │ │ │ +
838 return;
│ │ │ │ +
839 }
│ │ │ │ +
840 if (ready == building && (build_mode == unknown || build_mode == random || build_mode == row_wise) && (bm == row_wise || bm == random))
│ │ │ │ +
841 build_mode = bm;
│ │ │ │ +
842 else
│ │ │ │ +
843 DUNE_THROW(InvalidStateException, "Matrix structure cannot be changed at this stage anymore (ready == "<<ready<<").");
│ │ │ │ +
844 }
│ │ │ │ +
│ │ │ │ +
845
│ │ │ │ +
│ │ │ │ +
861 void setSize(size_type rows, size_type columns, size_type nnz=0)
│ │ │ │ +
862 {
│ │ │ │ +
863 // deallocate already setup memory
│ │ │ │ +
864 deallocate();
│ │ │ │ +
865
│ │ │ │ +
866 if (build_mode == implicit)
│ │ │ │ +
867 {
│ │ │ │ +
868 if (nnz>0)
│ │ │ │ +
869 DUNE_THROW(Dune::BCRSMatrixError,"number of non-zeroes may not be set in implicit mode, use setImplicitBuildModeParameters() instead");
│ │ │ │ +
870
│ │ │ │ +
871 // implicit allocates differently
│ │ │ │ +
872 implicit_allocate(rows,columns);
│ │ │ │ +
873 }
│ │ │ │ +
874 else
│ │ │ │ +
875 {
│ │ │ │ +
876 // allocate matrix memory
│ │ │ │ +
877 allocate(rows, columns, nnz, true, false);
│ │ │ │ +
878 }
│ │ │ │ +
879 }
│ │ │ │ +
│ │ │ │ +
880
│ │ │ │ +
│ │ │ │ +
889 void setImplicitBuildModeParameters(size_type _avg, double compressionBufferSize)
│ │ │ │ +
890 {
│ │ │ │ +
891 // Prevent user from setting a negative compression buffer size:
│ │ │ │ +
892 // 1) It doesn't make sense
│ │ │ │ +
893 // 2) We use a negative value to indicate that the parameters
│ │ │ │ +
894 // have not been set yet
│ │ │ │ +
895 if (compressionBufferSize < 0.0)
│ │ │ │ +
896 DUNE_THROW(BCRSMatrixError,"You cannot set a negative compressionBufferSize value");
│ │ │ │ +
897
│ │ │ │ +
898 // make sure the parameters aren't changed after memory has been allocated
│ │ │ │ +
899 if (ready != notAllocated)
│ │ │ │ +
900 DUNE_THROW(InvalidStateException,"You cannot modify build mode parameters at this stage anymore");
│ │ │ │ +
901 avg = _avg;
│ │ │ │ +
902 compressionBufferSize_ = compressionBufferSize;
│ │ │ │ +
903 }
│ │ │ │ +
│ │ │ │ +
904
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
912 {
│ │ │ │ +
913 // return immediately when self-assignment
│ │ │ │ +
914 if (&Mat==this) return *this;
│ │ │ │ +
915
│ │ │ │ +
916 if (!((ready == notAllocated || ready == built) && (Mat.ready == notAllocated || Mat.ready == built)))
│ │ │ │ +
917 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copied when both target and source are empty or fully built)");
│ │ │ │ +
918
│ │ │ │ +
919 // make it simple: ALWAYS throw away memory for a and j_
│ │ │ │ +
920 // and deallocate rows only if n != Mat.n
│ │ │ │ +
921 deallocate(n!=Mat.n);
│ │ │ │ +
922
│ │ │ │ +
923 // reallocate the rows if required
│ │ │ │ +
924 if (n>0 && n!=Mat.n) {
│ │ │ │ +
925 // free rows
│ │ │ │ +
926 for(row_type *riter=r+(n-1), *rend=r-1; riter!=rend; --riter)
│ │ │ │ +
927 std::allocator_traits<decltype(rowAllocator_)>::destroy(rowAllocator_, riter);
│ │ │ │ +
928 rowAllocator_.deallocate(r,n);
│ │ │ │ +
929 }
│ │ │ │ +
930
│ │ │ │ +
931 nnz_ = Mat.nonzeroes();
│ │ │ │ +
932
│ │ │ │ +
933 // allocate a, share j_
│ │ │ │ +
934 j_ = Mat.j_;
│ │ │ │ +
935 allocate(Mat.n, Mat.m, nnz_, n!=Mat.n, true);
│ │ │ │ +
936
│ │ │ │ +
937 // build window structure
│ │ │ │ + │ │ │ │ +
939 return *this;
│ │ │ │ +
940 }
│ │ │ │ +
│ │ │ │ +
941
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
944 {
│ │ │ │ +
945
│ │ │ │ +
946 if (!(ready == notAllocated || ready == built))
│ │ │ │ +
947 DUNE_THROW(InvalidStateException,"Scalar assignment only works on fully built BCRSMatrix)");
│ │ │ │ +
948
│ │ │ │ +
949 for (size_type i=0; i<n; i++) r[i] = k;
│ │ │ │ +
950 return *this;
│ │ │ │ +
951 }
│ │ │ │ +
│ │ │ │ +
952
│ │ │ │ +
953 //===== row-wise creation interface
│ │ │ │ +
954
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
957 {
│ │ │ │ +
958 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
961 : Mat(_Mat), i(_i), nnz(0), current_row(nullptr, Mat.j_.get(), 0)
│ │ │ │ +
962 {
│ │ │ │ +
963 if (Mat.build_mode == unknown && Mat.ready == building)
│ │ │ │ +
964 {
│ │ │ │ +
965 Mat.build_mode = row_wise;
│ │ │ │ +
966 }
│ │ │ │ +
967 if (i==0 && Mat.ready != building)
│ │ │ │ +
968 DUNE_THROW(BCRSMatrixError,"creation only allowed for uninitialized matrix");
│ │ │ │ +
969 if(Mat.build_mode!=row_wise)
│ │ │ │ +
970 DUNE_THROW(BCRSMatrixError,"creation only allowed if row wise allocation was requested in the constructor");
│ │ │ │ +
971 if(i==0 && _Mat.N()==0)
│ │ │ │ +
972 // empty Matrix is always built.
│ │ │ │ +
973 Mat.ready = built;
│ │ │ │ +
974 }
│ │ │ │ +
│ │ │ │ +
975
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
978 {
│ │ │ │ +
979 // this should only be called if matrix is in creation
│ │ │ │ +
980 if (Mat.ready != building)
│ │ │ │ +
981 DUNE_THROW(BCRSMatrixError,"matrix already built up");
│ │ │ │ +
982
│ │ │ │ +
983 // row i is defined through the pattern
│ │ │ │ +
984 // get memory for the row and initialize the j_ array
│ │ │ │ +
985 // this depends on the allocation mode
│ │ │ │ +
986
│ │ │ │ +
987 // compute size of the row
│ │ │ │ +
988 size_type s = pattern.size();
│ │ │ │ +
989
│ │ │ │ +
990 if(s>0) {
│ │ │ │ +
991 // update number of nonzeroes including this row
│ │ │ │ +
992 nnz += s;
│ │ │ │ +
993
│ │ │ │ +
994 // alloc memory / set window
│ │ │ │ +
995 if (Mat.nnz_ > 0)
│ │ │ │ +
996 {
│ │ │ │ +
997 // memory is allocated in one long array
│ │ │ │ +
998
│ │ │ │ +
999 // check if that memory is sufficient
│ │ │ │ +
1000 if (nnz > Mat.nnz_)
│ │ │ │ +
1001 DUNE_THROW(BCRSMatrixError,"allocated nnz too small");
│ │ │ │ +
1002
│ │ │ │ +
1003 // set row i
│ │ │ │ +
1004 Mat.r[i].set(s,nullptr,current_row.getindexptr());
│ │ │ │ +
1005 current_row.setindexptr(current_row.getindexptr()+s);
│ │ │ │ +
1006 }else{
│ │ │ │ +
1007 // memory is allocated individually per row
│ │ │ │ +
1008 // allocate and set row i
│ │ │ │ +
1009 B* b = Mat.allocator_.allocate(s);
│ │ │ │ +
1010 // use placement new to call constructor that allocates
│ │ │ │ +
1011 // additional memory.
│ │ │ │ +
1012 new (b) B[s];
│ │ │ │ +
1013 size_type* j = Mat.sizeAllocator_.allocate(s);
│ │ │ │ +
1014 Mat.r[i].set(s,b,j);
│ │ │ │ +
1015 }
│ │ │ │ +
1016 }else
│ │ │ │ +
1017 // setup empty row
│ │ │ │ +
1018 Mat.r[i].set(0,nullptr,nullptr);
│ │ │ │ +
1019
│ │ │ │ +
1020 // initialize the j array for row i from pattern
│ │ │ │ +
1021 std::copy(pattern.cbegin(), pattern.cend(), Mat.r[i].getindexptr());
│ │ │ │ +
1022
│ │ │ │ +
1023 // now go to next row
│ │ │ │ +
1024 i++;
│ │ │ │ +
1025 pattern.clear();
│ │ │ │ +
1026
│ │ │ │ +
1027 // check if this was last row
│ │ │ │ +
1028 if (i==Mat.n)
│ │ │ │ +
1029 {
│ │ │ │ +
1030 Mat.ready = built;
│ │ │ │ +
1031 if(Mat.nnz_ > 0)
│ │ │ │ +
1032 {
│ │ │ │ +
1033 // Set nnz to the exact number of nonzero blocks inserted
│ │ │ │ +
1034 // as some methods rely on it
│ │ │ │ +
1035 Mat.nnz_ = nnz;
│ │ │ │ +
1036 // allocate data array
│ │ │ │ +
1037 Mat.allocateData();
│ │ │ │ +
1038 Mat.setDataPointers();
│ │ │ │ +
1039 }
│ │ │ │ +
1040 }
│ │ │ │ +
1041 // done
│ │ │ │ +
1042 return *this;
│ │ │ │ +
1043 }
│ │ │ │ +
│ │ │ │ +
1044
│ │ │ │ +
│ │ │ │ +
1046 bool operator!= (const CreateIterator& it) const
│ │ │ │ +
1047 {
│ │ │ │ +
1048 return (i!=it.i) || (&Mat!=&it.Mat);
│ │ │ │ +
1049 }
│ │ │ │ +
│ │ │ │ +
1050
│ │ │ │ +
│ │ │ │ +
1052 bool operator== (const CreateIterator& it) const
│ │ │ │ +
1053 {
│ │ │ │ +
1054 return (i==it.i) && (&Mat==&it.Mat);
│ │ │ │ +
1055 }
│ │ │ │ +
│ │ │ │ +
1056
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1059 {
│ │ │ │ +
1060 return i;
│ │ │ │ +
1061 }
│ │ │ │ +
│ │ │ │ +
1062
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1065 {
│ │ │ │ +
1066 pattern.insert(j);
│ │ │ │ +
1067 }
│ │ │ │ +
│ │ │ │ +
1068
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1071 {
│ │ │ │ +
1072 return pattern.find(j) != pattern.end();
│ │ │ │ +
1073 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1080 {
│ │ │ │ +
1081 return pattern.size();
│ │ │ │ +
1082 }
│ │ │ │ +
│ │ │ │ +
1083
│ │ │ │ +
1084 private:
│ │ │ │ +
1085 BCRSMatrix& Mat; // the matrix we are defining
│ │ │ │ +
1086 size_type i; // current row to be defined
│ │ │ │ +
1087 size_type nnz; // count total number of nonzeros
│ │ │ │ +
1088 typedef std::set<size_type,std::less<size_type> > PatternType;
│ │ │ │ +
1089 PatternType pattern; // used to compile entries in a row
│ │ │ │ +
1090 row_type current_row; // row pointing to the current row to setup
│ │ │ │ +
1091 };
│ │ │ │ +
│ │ │ │ +
1092
│ │ │ │ +
1094 friend class CreateIterator;
│ │ │ │ +
1095
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1098 {
│ │ │ │ +
1099 return CreateIterator(*this,0);
│ │ │ │ +
1100 }
│ │ │ │ +
│ │ │ │ +
1101
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1104 {
│ │ │ │ +
1105 return CreateIterator(*this,n);
│ │ │ │ +
1106 }
│ │ │ │ +
│ │ │ │ +
1107
│ │ │ │ +
1108
│ │ │ │ +
1109 //===== random creation interface
│ │ │ │ +
1110
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1118 {
│ │ │ │ +
1119 if (build_mode!=random)
│ │ │ │ +
1120 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ +
1121 if (ready != building)
│ │ │ │ +
1122 DUNE_THROW(BCRSMatrixError,"matrix row sizes already built up");
│ │ │ │ +
1123
│ │ │ │ +
1124 r[i].setsize(s);
│ │ │ │ +
1125 }
│ │ │ │ +
│ │ │ │ +
1126
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1129 {
│ │ │ │ +
1130#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1131 if (r==0) DUNE_THROW(BCRSMatrixError,"row not initialized yet");
│ │ │ │ +
1132 if (i>=n) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1133#endif
│ │ │ │ +
1134 return r[i].getsize();
│ │ │ │ +
1135 }
│ │ │ │ +
│ │ │ │ +
1136
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1139 {
│ │ │ │ +
1140 if (build_mode!=random)
│ │ │ │ +
1141 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ +
1142 if (ready != building)
│ │ │ │ +
1143 DUNE_THROW(BCRSMatrixError,"matrix row sizes already built up");
│ │ │ │ +
1144
│ │ │ │ +
1145 r[i].setsize(r[i].getsize()+s);
│ │ │ │ +
1146 }
│ │ │ │ +
│ │ │ │ +
1147
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1150 {
│ │ │ │ +
1151 if (build_mode!=random)
│ │ │ │ +
1152 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ +
1153 if (ready != building)
│ │ │ │ +
1154 DUNE_THROW(BCRSMatrixError,"matrix row sizes already built up");
│ │ │ │ +
1155
│ │ │ │ +
1156 // compute total size, check positivity
│ │ │ │ +
1157 size_type total=0;
│ │ │ │ +
1158 for (size_type i=0; i<n; i++)
│ │ │ │ +
1159 {
│ │ │ │ +
1160 total += r[i].getsize();
│ │ │ │ +
1161 }
│ │ │ │ +
1162
│ │ │ │ +
1163 if(nnz_ == 0)
│ │ │ │ +
1164 // allocate/check memory
│ │ │ │ +
1165 allocate(n,m,total,false,false);
│ │ │ │ +
1166 else if(nnz_ < total)
│ │ │ │ +
1167 DUNE_THROW(BCRSMatrixError,"Specified number of nonzeros ("<<nnz_<<") not "
│ │ │ │ +
1168 <<"sufficient for calculated nonzeros ("<<total<<"! ");
│ │ │ │ +
1169
│ │ │ │ +
1170 // set the window pointers correctly
│ │ │ │ + │ │ │ │ +
1172
│ │ │ │ +
1173 // initialize j_ array with m (an invalid column index)
│ │ │ │ +
1174 // this indicates an unused entry
│ │ │ │ +
1175 for (size_type k=0; k<nnz_; k++)
│ │ │ │ +
1176 j_.get()[k] = m;
│ │ │ │ + │ │ │ │ +
1178 }
│ │ │ │ +
│ │ │ │ +
1179
│ │ │ │ +
1181
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1192 {
│ │ │ │ +
1193 if (build_mode!=random)
│ │ │ │ +
1194 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ +
1195 if (ready==built)
│ │ │ │ +
1196 DUNE_THROW(BCRSMatrixError,"matrix already built up");
│ │ │ │ +
1197 if (ready==building)
│ │ │ │ +
1198 DUNE_THROW(BCRSMatrixError,"matrix row sizes not built up yet");
│ │ │ │ +
1199 if (ready==notAllocated)
│ │ │ │ +
1200 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ +
1201
│ │ │ │ +
1202 if (col >= m)
│ │ │ │ +
1203 DUNE_THROW(BCRSMatrixError,"column index exceeds matrix size");
│ │ │ │ +
1204
│ │ │ │ +
1205 // get row range
│ │ │ │ +
1206 size_type* const first = r[row].getindexptr();
│ │ │ │ +
1207 size_type* const last = first + r[row].getsize();
│ │ │ │ +
1208
│ │ │ │ +
1209 // find correct insertion position for new column index
│ │ │ │ +
1210 size_type* pos = std::lower_bound(first,last,col);
│ │ │ │ +
1211
│ │ │ │ +
1212 // check if index is already in row
│ │ │ │ +
1213 if (pos!=last && *pos == col) return;
│ │ │ │ +
1214
│ │ │ │ +
1215 // find end of already inserted column indices
│ │ │ │ +
1216 size_type* end = std::lower_bound(pos,last,m);
│ │ │ │ +
1217 if (end==last)
│ │ │ │ +
1218 DUNE_THROW(BCRSMatrixError,"row is too small");
│ │ │ │ +
1219
│ │ │ │ +
1220 // insert new column index at correct position
│ │ │ │ +
1221 std::copy_backward(pos,end,end+1);
│ │ │ │ +
1222 *pos = col;
│ │ │ │ +
1223 }
│ │ │ │ +
│ │ │ │ +
1224
│ │ │ │ +
1226
│ │ │ │ +
1233 template<typename It>
│ │ │ │ +
│ │ │ │ +
1234 void setIndices(size_type row, It begin, It end)
│ │ │ │ +
1235 {
│ │ │ │ +
1236 size_type row_size = r[row].size();
│ │ │ │ +
1237 size_type* col_begin = r[row].getindexptr();
│ │ │ │ +
1238 size_type* col_end;
│ │ │ │ +
1239 // consistency check between allocated row size and number of passed column indices
│ │ │ │ +
1240 if ((col_end = std::copy(begin,end,r[row].getindexptr())) != col_begin + row_size)
│ │ │ │ +
1241 DUNE_THROW(BCRSMatrixError,"Given size of row " << row
│ │ │ │ +
1242 << " (" << row_size
│ │ │ │ +
1243 << ") does not match number of passed entries (" << (col_end - col_begin) << ")");
│ │ │ │ +
1244 std::sort(col_begin,col_end);
│ │ │ │ +
1245 }
│ │ │ │ +
│ │ │ │ +
1246
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1249 {
│ │ │ │ +
1250 if (build_mode!=random)
│ │ │ │ +
1251 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ +
1252 if (ready==built)
│ │ │ │ +
1253 DUNE_THROW(BCRSMatrixError,"matrix already built up");
│ │ │ │ +
1254 if (ready==building)
│ │ │ │ +
1255 DUNE_THROW(BCRSMatrixError,"row sizes are not built up yet");
│ │ │ │ +
1256 if (ready==notAllocated)
│ │ │ │ +
1257 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ +
1258
│ │ │ │ +
1259 // check if there are undefined indices
│ │ │ │ +
1260 RowIterator endi=end();
│ │ │ │ +
1261 for (RowIterator i=begin(); i!=endi; ++i)
│ │ │ │ +
1262 {
│ │ │ │ +
1263 ColIterator endj = (*i).end();
│ │ │ │ +
1264 for (ColIterator j=(*i).begin(); j!=endj; ++j) {
│ │ │ │ +
1265 if (j.index() >= m) {
│ │ │ │ +
1266 dwarn << "WARNING: size of row "<< i.index()<<" is "<<j.offset()<<". But was specified as being "<< (*i).end().offset()
│ │ │ │ +
1267 <<". This means you are wasting valuable space and creating additional cache misses!"<<std::endl;
│ │ │ │ +
1268 nnz_ -= ((*i).end().offset() - j.offset());
│ │ │ │ +
1269 r[i.index()].setsize(j.offset());
│ │ │ │ +
1270 break;
│ │ │ │ +
1271 }
│ │ │ │ +
1272 }
│ │ │ │ +
1273 }
│ │ │ │ +
1274
│ │ │ │ +
1275 allocateData();
│ │ │ │ + │ │ │ │ +
1277
│ │ │ │ +
1278 // if not, set matrix to built
│ │ │ │ +
1279 ready = built;
│ │ │ │ +
1280 }
│ │ │ │ +
│ │ │ │ +
1281
│ │ │ │ +
1282 //===== implicit creation interface
│ │ │ │ +
1283
│ │ │ │ +
1285
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1297 {
│ │ │ │ +
1298#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1299 if (build_mode!=implicit)
│ │ │ │ +
1300 DUNE_THROW(BCRSMatrixError,"requires implicit build mode");
│ │ │ │ +
1301 if (ready==built)
│ │ │ │ +
1302 DUNE_THROW(BCRSMatrixError,"matrix already built up, use operator[] for entry access now");
│ │ │ │ +
1303 if (ready==notAllocated)
│ │ │ │ +
1304 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ +
1305 if (ready!=building)
│ │ │ │ +
1306 DUNE_THROW(InvalidStateException,"You may only use entry() during the 'building' stage");
│ │ │ │ +
1307
│ │ │ │ +
1308 if (row >= n)
│ │ │ │ +
1309 DUNE_THROW(BCRSMatrixError,"row index exceeds matrix size");
│ │ │ │ +
1310 if (col >= m)
│ │ │ │ +
1311 DUNE_THROW(BCRSMatrixError,"column index exceeds matrix size");
│ │ │ │ +
1312#endif
│ │ │ │ +
1313
│ │ │ │ +
1314 size_type* begin = r[row].getindexptr();
│ │ │ │ +
1315 size_type* end = begin + r[row].getsize();
│ │ │ │ +
1316
│ │ │ │ +
1317 size_type* pos = std::find(begin, end, col);
│ │ │ │ +
1318
│ │ │ │ +
1319 //treat the case that there was a match in the array
│ │ │ │ +
1320 if (pos != end)
│ │ │ │ +
1321 if (*pos == col)
│ │ │ │ +
1322 {
│ │ │ │ +
1323 std::ptrdiff_t offset = pos - r[row].getindexptr();
│ │ │ │ +
1324 B* aptr = r[row].getptr() + offset;
│ │ │ │ +
1325
│ │ │ │ +
1326 return *aptr;
│ │ │ │ +
1327 }
│ │ │ │ +
1328
│ │ │ │ +
1329 //determine whether overflow has to be taken into account or not
│ │ │ │ +
1330 if (r[row].getsize() == avg)
│ │ │ │ +
1331 return overflow[std::make_pair(row,col)];
│ │ │ │ +
1332 else
│ │ │ │ +
1333 {
│ │ │ │ +
1334 //modify index array
│ │ │ │ +
1335 *end = col;
│ │ │ │ +
1336
│ │ │ │ +
1337 //do simultaneous operations on data array a
│ │ │ │ +
1338 std::ptrdiff_t offset = end - r[row].getindexptr();
│ │ │ │ +
1339 B* apos = r[row].getptr() + offset;
│ │ │ │ +
1340
│ │ │ │ +
1341 //increase rowsize
│ │ │ │ +
1342 r[row].setsize(r[row].getsize()+1);
│ │ │ │ +
1343
│ │ │ │ +
1344 //return reference to the newly created entry
│ │ │ │ +
1345 return *apos;
│ │ │ │ +
1346 }
│ │ │ │ +
1347 }
│ │ │ │ +
│ │ │ │ +
1348
│ │ │ │ +
1350
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1361 {
│ │ │ │ +
1362 if (build_mode!=implicit)
│ │ │ │ +
1363 DUNE_THROW(BCRSMatrixError,"requires implicit build mode");
│ │ │ │ +
1364 if (ready==built)
│ │ │ │ +
1365 DUNE_THROW(BCRSMatrixError,"matrix already built up, no more need for compression");
│ │ │ │ +
1366 if (ready==notAllocated)
│ │ │ │ +
1367 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ +
1368 if (ready!=building)
│ │ │ │ +
1369 DUNE_THROW(InvalidStateException,"You may only call compress() at the end of the 'building' stage");
│ │ │ │ +
1370
│ │ │ │ +
1371 //calculate statistics
│ │ │ │ + │ │ │ │ +
1373 stats.overflow_total = overflow.size();
│ │ │ │ +
1374 stats.maximum = 0;
│ │ │ │ +
1375
│ │ │ │ +
1376 //get insertion iterators pointing to one before start (for later use of ++it)
│ │ │ │ +
1377 size_type* jiit = j_.get();
│ │ │ │ +
1378 B* aiit = a;
│ │ │ │ +
1379
│ │ │ │ +
1380 //get iterator to the smallest overflow element
│ │ │ │ +
1381 typename OverflowType::iterator oit = overflow.begin();
│ │ │ │ +
1382
│ │ │ │ +
1383 //store a copy of index pointers on which to perform sorting
│ │ │ │ +
1384 std::vector<size_type*> perm;
│ │ │ │ +
1385
│ │ │ │ +
1386 //iterate over all rows and copy elements into their position in the compressed array
│ │ │ │ +
1387 for (size_type i=0; i<n; i++)
│ │ │ │ +
1388 {
│ │ │ │ +
1389 //get old pointers into a and j and size without overflow changes
│ │ │ │ +
1390 size_type* begin = r[i].getindexptr();
│ │ │ │ +
1391 //B* apos = r[i].getptr();
│ │ │ │ +
1392 size_type size = r[i].getsize();
│ │ │ │ +
1393
│ │ │ │ +
1394 perm.resize(size);
│ │ │ │ +
1395
│ │ │ │ +
1396 typename std::vector<size_type*>::iterator it = perm.begin();
│ │ │ │ +
1397 for (size_type* iit = begin; iit < begin + size; ++iit, ++it)
│ │ │ │ +
1398 *it = iit;
│ │ │ │ +
1399
│ │ │ │ +
1400 //sort permutation array
│ │ │ │ +
1401 std::sort(perm.begin(),perm.end(),PointerCompare<size_type>());
│ │ │ │ +
1402
│ │ │ │ +
1403 //change row window pointer to their new positions
│ │ │ │ +
1404 r[i].setindexptr(jiit);
│ │ │ │ +
1405 r[i].setptr(aiit);
│ │ │ │ +
1406
│ │ │ │ +
1407 for (it = perm.begin(); it != perm.end(); ++it)
│ │ │ │ +
1408 {
│ │ │ │ +
1409 //check whether there are elements in the overflow area which take precedence
│ │ │ │ +
1410 while ((oit!=overflow.end()) && (oit->first < std::make_pair(i,**it)))
│ │ │ │ +
1411 {
│ │ │ │ +
1412 //check whether there is enough memory to write to
│ │ │ │ +
1413 if (jiit > begin)
│ │ │ │ + │ │ │ │ +
1415 "Allocated memory for BCRSMatrix exhausted during compress()!"
│ │ │ │ +
1416 "Please increase either the average number of entries per row or the compressionBufferSize value."
│ │ │ │ +
1417 );
│ │ │ │ +
1418 //copy an element from the overflow area to the insertion position in a and j
│ │ │ │ +
1419 *jiit = oit->first.second;
│ │ │ │ +
1420 ++jiit;
│ │ │ │ +
1421 *aiit = oit->second;
│ │ │ │ +
1422 ++aiit;
│ │ │ │ +
1423 ++oit;
│ │ │ │ +
1424 r[i].setsize(r[i].getsize()+1);
│ │ │ │ +
1425 }
│ │ │ │ +
1426
│ │ │ │ +
1427 //check whether there is enough memory to write to
│ │ │ │ +
1428 if (jiit > begin)
│ │ │ │ + │ │ │ │ +
1430 "Allocated memory for BCRSMatrix exhausted during compress()!"
│ │ │ │ +
1431 "Please increase either the average number of entries per row or the compressionBufferSize value."
│ │ │ │ +
1432 );
│ │ │ │ +
1433
│ │ │ │ +
1434 //copy element from array
│ │ │ │ +
1435 *jiit = **it;
│ │ │ │ +
1436 ++jiit;
│ │ │ │ +
1437 B* apos = *it - j_.get() + a;
│ │ │ │ +
1438 *aiit = *apos;
│ │ │ │ +
1439 ++aiit;
│ │ │ │ +
1440 }
│ │ │ │ +
1441
│ │ │ │ +
1442 //copy remaining elements from the overflow area
│ │ │ │ +
1443 while ((oit!=overflow.end()) && (oit->first.first == i))
│ │ │ │ +
1444 {
│ │ │ │ +
1445 //check whether there is enough memory to write to
│ │ │ │ +
1446 if (jiit > begin)
│ │ │ │ + │ │ │ │ +
1448 "Allocated memory for BCRSMatrix exhausted during compress()!"
│ │ │ │ +
1449 "Please increase either the average number of entries per row or the compressionBufferSize value."
│ │ │ │ +
1450 );
│ │ │ │ +
1451
│ │ │ │ +
1452 //copy and element from the overflow area to the insertion position in a and j
│ │ │ │ +
1453 *jiit = oit->first.second;
│ │ │ │ +
1454 ++jiit;
│ │ │ │ +
1455 *aiit = oit->second;
│ │ │ │ +
1456 ++aiit;
│ │ │ │ +
1457 ++oit;
│ │ │ │ +
1458 r[i].setsize(r[i].getsize()+1);
│ │ │ │ +
1459 }
│ │ │ │ +
1460
│ │ │ │ +
1461 // update maximum row size
│ │ │ │ +
1462 if (r[i].getsize()>stats.maximum)
│ │ │ │ +
1463 stats.maximum = r[i].getsize();
│ │ │ │ +
1464 }
│ │ │ │ +
1465
│ │ │ │ +
1466 // overflow area may be cleared
│ │ │ │ +
1467 overflow.clear();
│ │ │ │ +
1468
│ │ │ │ +
1469 //determine average number of entries and memory usage
│ │ │ │ +
1470 std::ptrdiff_t diff = (r[n-1].getindexptr() + r[n-1].getsize() - j_.get());
│ │ │ │ +
1471 nnz_ = diff;
│ │ │ │ +
1472 stats.avg = (double) (nnz_) / (double) n;
│ │ │ │ +
1473 stats.mem_ratio = (double) (nnz_) / (double) allocationSize_;
│ │ │ │ +
1474
│ │ │ │ +
1475 //matrix is now built
│ │ │ │ +
1476 ready = built;
│ │ │ │ +
1477
│ │ │ │ +
1478 return stats;
│ │ │ │ +
1479 }
│ │ │ │ +
│ │ │ │ +
1480
│ │ │ │ +
1481 //===== vector space arithmetic
│ │ │ │ +
1482
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1485 {
│ │ │ │ +
1486#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1487 if (ready != built)
│ │ │ │ +
1488 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1489#endif
│ │ │ │ +
1490
│ │ │ │ +
1491 if (nnz_ > 0)
│ │ │ │ +
1492 {
│ │ │ │ +
1493 // process 1D array
│ │ │ │ +
1494 for (size_type i=0; i<nnz_; i++)
│ │ │ │ +
1495 a[i] *= k;
│ │ │ │ +
1496 }
│ │ │ │ +
1497 else
│ │ │ │ +
1498 {
│ │ │ │ +
1499 RowIterator endi=end();
│ │ │ │ +
1500 for (RowIterator i=begin(); i!=endi; ++i)
│ │ │ │ +
1501 {
│ │ │ │ +
1502 ColIterator endj = (*i).end();
│ │ │ │ +
1503 for (ColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1504 (*j) *= k;
│ │ │ │ +
1505 }
│ │ │ │ +
1506 }
│ │ │ │ +
1507
│ │ │ │ +
1508 return *this;
│ │ │ │ +
1509 }
│ │ │ │ +
│ │ │ │ +
1510
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1513 {
│ │ │ │ +
1514#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1515 if (ready != built)
│ │ │ │ +
1516 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1517#endif
│ │ │ │ +
1518
│ │ │ │ +
1519 if (nnz_ > 0)
│ │ │ │ +
1520 {
│ │ │ │ +
1521 // process 1D array
│ │ │ │ +
1522 for (size_type i=0; i<nnz_; i++)
│ │ │ │ +
1523 a[i] /= k;
│ │ │ │ +
1524 }
│ │ │ │ +
1525 else
│ │ │ │ +
1526 {
│ │ │ │ +
1527 RowIterator endi=end();
│ │ │ │ +
1528 for (RowIterator i=begin(); i!=endi; ++i)
│ │ │ │ +
1529 {
│ │ │ │ +
1530 ColIterator endj = (*i).end();
│ │ │ │ +
1531 for (ColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1532 (*j) /= k;
│ │ │ │ +
1533 }
│ │ │ │ +
1534 }
│ │ │ │ +
1535
│ │ │ │ +
1536 return *this;
│ │ │ │ +
1537 }
│ │ │ │ +
│ │ │ │ +
1538
│ │ │ │ +
1539
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1546 {
│ │ │ │ +
1547#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1548 if (ready != built || b.ready != built)
│ │ │ │ +
1549 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1550 if(N()!=b.N() || M() != b.M())
│ │ │ │ +
1551 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ +
1552#endif
│ │ │ │ +
1553 RowIterator endi=end();
│ │ │ │ +
1554 ConstRowIterator j=b.begin();
│ │ │ │ +
1555 for (RowIterator i=begin(); i!=endi; ++i, ++j) {
│ │ │ │ +
1556 i->operator+=(*j);
│ │ │ │ +
1557 }
│ │ │ │ +
1558
│ │ │ │ +
1559 return *this;
│ │ │ │ +
1560 }
│ │ │ │ +
│ │ │ │ +
1561
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1568 {
│ │ │ │ +
1569#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1570 if (ready != built || b.ready != built)
│ │ │ │ +
1571 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1572 if(N()!=b.N() || M() != b.M())
│ │ │ │ +
1573 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ +
1574#endif
│ │ │ │ +
1575 RowIterator endi=end();
│ │ │ │ +
1576 ConstRowIterator j=b.begin();
│ │ │ │ +
1577 for (RowIterator i=begin(); i!=endi; ++i, ++j) {
│ │ │ │ +
1578 i->operator-=(*j);
│ │ │ │ +
1579 }
│ │ │ │ +
1580
│ │ │ │ +
1581 return *this;
│ │ │ │ +
1582 }
│ │ │ │ +
│ │ │ │ +
1583
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1593 {
│ │ │ │ +
1594#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1595 if (ready != built || b.ready != built)
│ │ │ │ +
1596 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1597 if(N()!=b.N() || M() != b.M())
│ │ │ │ +
1598 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ +
1599#endif
│ │ │ │ +
1600 RowIterator endi=end();
│ │ │ │ +
1601 ConstRowIterator j=b.begin();
│ │ │ │ +
1602 for(RowIterator i=begin(); i!=endi; ++i, ++j)
│ │ │ │ +
1603 i->axpy(alpha, *j);
│ │ │ │ +
1604
│ │ │ │ +
1605 return *this;
│ │ │ │ +
1606 }
│ │ │ │ +
│ │ │ │ +
1607
│ │ │ │ +
1608 //===== linear maps
│ │ │ │ +
1609
│ │ │ │ +
1611 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1612 void mv (const X& x, Y& y) const
│ │ │ │ +
1613 {
│ │ │ │ +
1614#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1615 if (ready != built)
│ │ │ │ +
1616 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1617 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,
│ │ │ │ +
1618 "Size mismatch: M: " << N() << "x" << M() << " x: " << x.N());
│ │ │ │ +
1619 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,
│ │ │ │ +
1620 "Size mismatch: M: " << N() << "x" << M() << " y: " << y.N());
│ │ │ │ +
1621#endif
│ │ │ │ +
1622 ConstRowIterator endi=end();
│ │ │ │ +
1623 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1624 {
│ │ │ │ +
1625 y[i.index()]=0;
│ │ │ │ +
1626 ConstColIterator endj = (*i).end();
│ │ │ │ +
1627 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1628 {
│ │ │ │ +
1629 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ +
1630 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ +
1631 Impl::asMatrix(*j).umv(xj, yi);
│ │ │ │ +
1632 }
│ │ │ │ +
1633 }
│ │ │ │ +
1634 }
│ │ │ │ +
│ │ │ │ +
1635
│ │ │ │ +
1637 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1638 void umv (const X& x, Y& y) const
│ │ │ │ +
1639 {
│ │ │ │ +
1640#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1641 if (ready != built)
│ │ │ │ +
1642 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1643 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1644 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1645#endif
│ │ │ │ +
1646 ConstRowIterator endi=end();
│ │ │ │ +
1647 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1648 {
│ │ │ │ +
1649 ConstColIterator endj = (*i).end();
│ │ │ │ +
1650 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1651 {
│ │ │ │ +
1652 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ +
1653 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ +
1654 Impl::asMatrix(*j).umv(xj,yi);
│ │ │ │ +
1655 }
│ │ │ │ +
1656 }
│ │ │ │ +
1657 }
│ │ │ │ +
│ │ │ │ +
1658
│ │ │ │ +
1660 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1661 void mmv (const X& x, Y& y) const
│ │ │ │ +
1662 {
│ │ │ │ +
1663#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1664 if (ready != built)
│ │ │ │ +
1665 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1666 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1667 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1668#endif
│ │ │ │ +
1669 ConstRowIterator endi=end();
│ │ │ │ +
1670 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1671 {
│ │ │ │ +
1672 ConstColIterator endj = (*i).end();
│ │ │ │ +
1673 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1674 {
│ │ │ │ +
1675 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ +
1676 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ +
1677 Impl::asMatrix(*j).mmv(xj,yi);
│ │ │ │ +
1678 }
│ │ │ │ +
1679 }
│ │ │ │ +
1680 }
│ │ │ │ +
│ │ │ │ +
1681
│ │ │ │ +
1683 template<class X, class Y, class F>
│ │ │ │ +
│ │ │ │ +
1684 void usmv (F&& alpha, const X& x, Y& y) const
│ │ │ │ +
1685 {
│ │ │ │ +
1686#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1687 if (ready != built)
│ │ │ │ +
1688 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1689 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1690 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1691#endif
│ │ │ │ +
1692 ConstRowIterator endi=end();
│ │ │ │ +
1693 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1694 {
│ │ │ │ +
1695 ConstColIterator endj = (*i).end();
│ │ │ │ +
1696 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1697 {
│ │ │ │ +
1698 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ +
1699 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ +
1700 Impl::asMatrix(*j).usmv(alpha,xj,yi);
│ │ │ │ +
1701 }
│ │ │ │ +
1702 }
│ │ │ │ +
1703 }
│ │ │ │ +
│ │ │ │ +
1704
│ │ │ │ +
1706 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1707 void mtv (const X& x, Y& y) const
│ │ │ │ +
1708 {
│ │ │ │ +
1709#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1710 if (ready != built)
│ │ │ │ +
1711 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1712 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1713 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1714#endif
│ │ │ │ +
1715 for(size_type i=0; i<y.N(); ++i)
│ │ │ │ +
1716 y[i]=0;
│ │ │ │ +
1717 umtv(x,y);
│ │ │ │ +
1718 }
│ │ │ │ +
│ │ │ │ +
1719
│ │ │ │ +
1721 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1722 void umtv (const X& x, Y& y) const
│ │ │ │ +
1723 {
│ │ │ │ +
1724#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1725 if (ready != built)
│ │ │ │ +
1726 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1727 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1728 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1729#endif
│ │ │ │ +
1730 ConstRowIterator endi=end();
│ │ │ │ +
1731 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1732 {
│ │ │ │ +
1733 ConstColIterator endj = (*i).end();
│ │ │ │ +
1734 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1735 {
│ │ │ │ +
1736 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ +
1737 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ +
1738 Impl::asMatrix(*j).umtv(xi,yj);
│ │ │ │ +
1739 }
│ │ │ │ +
1740 }
│ │ │ │ +
1741 }
│ │ │ │ +
│ │ │ │ +
1742
│ │ │ │ +
1744 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1745 void mmtv (const X& x, Y& y) const
│ │ │ │ +
1746 {
│ │ │ │ +
1747#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1748 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1749 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1750#endif
│ │ │ │ +
1751 ConstRowIterator endi=end();
│ │ │ │ +
1752 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1753 {
│ │ │ │ +
1754 ConstColIterator endj = (*i).end();
│ │ │ │ +
1755 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1756 {
│ │ │ │ +
1757 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ +
1758 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ +
1759 Impl::asMatrix(*j).mmtv(xi,yj);
│ │ │ │ +
1760 }
│ │ │ │ +
1761 }
│ │ │ │ +
1762 }
│ │ │ │ +
│ │ │ │ +
1763
│ │ │ │ +
1765 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1766 void usmtv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ +
1767 {
│ │ │ │ +
1768#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1769 if (ready != built)
│ │ │ │ +
1770 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1771 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1772 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1773#endif
│ │ │ │ +
1774 ConstRowIterator endi=end();
│ │ │ │ +
1775 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1776 {
│ │ │ │ +
1777 ConstColIterator endj = (*i).end();
│ │ │ │ +
1778 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1779 {
│ │ │ │ +
1780 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ +
1781 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ +
1782 Impl::asMatrix(*j).usmtv(alpha,xi,yj);
│ │ │ │ +
1783 }
│ │ │ │ +
1784 }
│ │ │ │ +
1785 }
│ │ │ │ +
│ │ │ │ +
1786
│ │ │ │ +
1788 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1789 void umhv (const X& x, Y& y) const
│ │ │ │ +
1790 {
│ │ │ │ +
1791#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1792 if (ready != built)
│ │ │ │ +
1793 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1794 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1795 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1796#endif
│ │ │ │ +
1797 ConstRowIterator endi=end();
│ │ │ │ +
1798 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1799 {
│ │ │ │ +
1800 ConstColIterator endj = (*i).end();
│ │ │ │ +
1801 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1802 {
│ │ │ │ +
1803 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ +
1804 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ +
1805 Impl::asMatrix(*j).umhv(xi,yj);
│ │ │ │ +
1806 }
│ │ │ │ +
1807 }
│ │ │ │ +
1808 }
│ │ │ │ +
│ │ │ │ +
1809
│ │ │ │ +
1811 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1812 void mmhv (const X& x, Y& y) const
│ │ │ │ +
1813 {
│ │ │ │ +
1814#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1815 if (ready != built)
│ │ │ │ +
1816 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1817 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1818 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1819#endif
│ │ │ │ +
1820 ConstRowIterator endi=end();
│ │ │ │ +
1821 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1822 {
│ │ │ │ +
1823 ConstColIterator endj = (*i).end();
│ │ │ │ +
1824 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1825 {
│ │ │ │ +
1826 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ +
1827 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ +
1828 Impl::asMatrix(*j).mmhv(xi,yj);
│ │ │ │ +
1829 }
│ │ │ │ +
1830 }
│ │ │ │ +
1831 }
│ │ │ │ +
│ │ │ │ +
1832
│ │ │ │ +
1834 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
1835 void usmhv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ +
1836 {
│ │ │ │ +
1837#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1838 if (ready != built)
│ │ │ │ +
1839 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1840 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1841 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ +
1842#endif
│ │ │ │ +
1843 ConstRowIterator endi=end();
│ │ │ │ +
1844 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ +
1845 {
│ │ │ │ +
1846 ConstColIterator endj = (*i).end();
│ │ │ │ +
1847 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ +
1848 {
│ │ │ │ +
1849 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ +
1850 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ +
1851 Impl::asMatrix(*j).usmhv(alpha,xi,yj);
│ │ │ │ +
1852 }
│ │ │ │ +
1853 }
│ │ │ │ +
1854 }
│ │ │ │ +
│ │ │ │ +
1855
│ │ │ │ +
1856
│ │ │ │ +
1857 //===== norms
│ │ │ │ +
1858
│ │ │ │ +
│ │ │ │ +
1860 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ │ +
1861 {
│ │ │ │ +
1862#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1863 if (ready != built)
│ │ │ │ +
1864 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1865#endif
│ │ │ │ +
1866
│ │ │ │ +
1867 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
1868
│ │ │ │ +
1869 for (auto&& row : (*this))
│ │ │ │ +
1870 for (auto&& entry : row)
│ │ │ │ +
1871 sum += Impl::asMatrix(entry).frobenius_norm2();
│ │ │ │ +
1872
│ │ │ │ +
1873 return sum;
│ │ │ │ +
1874 }
│ │ │ │ +
│ │ │ │ +
1875
│ │ │ │ +
│ │ │ │ +
1877 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ +
1878 {
│ │ │ │ +
1879 return sqrt(frobenius_norm2());
│ │ │ │ +
1880 }
│ │ │ │ +
│ │ │ │ +
1881
│ │ │ │ +
1883 template <typename ft = field_type,
│ │ │ │ +
1884 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
1885 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
1886 if (ready != built)
│ │ │ │ +
1887 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1888
│ │ │ │ +
1889 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
1890 using std::max;
│ │ │ │ +
1891
│ │ │ │ +
1892 real_type norm = 0;
│ │ │ │ +
1893 for (auto const &x : *this) {
│ │ │ │ +
1894 real_type sum = 0;
│ │ │ │ +
1895 for (auto const &y : x)
│ │ │ │ +
1896 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ +
1897 norm = max(sum, norm);
│ │ │ │ +
1898 }
│ │ │ │ +
1899 return norm;
│ │ │ │ +
1900 }
│ │ │ │ +
│ │ │ │ +
1901
│ │ │ │ +
1903 template <typename ft = field_type,
│ │ │ │ +
1904 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
1905 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
1906 if (ready != built)
│ │ │ │ +
1907 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1908
│ │ │ │ +
1909 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
1910 using std::max;
│ │ │ │ +
1911
│ │ │ │ +
1912 real_type norm = 0;
│ │ │ │ +
1913 for (auto const &x : *this) {
│ │ │ │ +
1914 real_type sum = 0;
│ │ │ │ +
1915 for (auto const &y : x)
│ │ │ │ +
1916 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ +
1917 norm = max(sum, norm);
│ │ │ │ +
1918 }
│ │ │ │ +
1919 return norm;
│ │ │ │ +
1920 }
│ │ │ │ +
│ │ │ │ +
1921
│ │ │ │ +
1923 template <typename ft = field_type,
│ │ │ │ +
1924 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
1925 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
1926 if (ready != built)
│ │ │ │ +
1927 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1928
│ │ │ │ +
1929 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
1930 using std::max;
│ │ │ │ +
1931
│ │ │ │ +
1932 real_type norm = 0;
│ │ │ │ +
1933 real_type isNaN = 1;
│ │ │ │ +
1934 for (auto const &x : *this) {
│ │ │ │ +
1935 real_type sum = 0;
│ │ │ │ +
1936 for (auto const &y : x)
│ │ │ │ +
1937 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ +
1938 norm = max(sum, norm);
│ │ │ │ +
1939 isNaN += sum;
│ │ │ │ +
1940 }
│ │ │ │ +
1941
│ │ │ │ +
1942 return norm * (isNaN / isNaN);
│ │ │ │ +
1943 }
│ │ │ │ +
│ │ │ │ +
1944
│ │ │ │ +
1946 template <typename ft = field_type,
│ │ │ │ +
1947 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
│ │ │ │ +
1948 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
1949 if (ready != built)
│ │ │ │ +
1950 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ +
1951
│ │ │ │ +
1952 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
1953 using std::max;
│ │ │ │ +
1954
│ │ │ │ +
1955 real_type norm = 0;
│ │ │ │ +
1956 real_type isNaN = 1;
│ │ │ │ +
1957
│ │ │ │ +
1958 for (auto const &x : *this) {
│ │ │ │ +
1959 real_type sum = 0;
│ │ │ │ +
1960 for (auto const &y : x)
│ │ │ │ +
1961 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ +
1962 norm = max(sum, norm);
│ │ │ │ +
1963 isNaN += sum;
│ │ │ │ +
1964 }
│ │ │ │ +
1965
│ │ │ │ +
1966 return norm * (isNaN / isNaN);
│ │ │ │ +
1967 }
│ │ │ │ +
│ │ │ │ +
1968
│ │ │ │ +
1969 //===== sizes
│ │ │ │ +
1970
│ │ │ │ +
│ │ │ │ +
1972 size_type N () const
│ │ │ │ +
1973 {
│ │ │ │ +
1974 return n;
│ │ │ │ +
1975 }
│ │ │ │ +
│ │ │ │ +
1976
│ │ │ │ +
│ │ │ │ +
1978 size_type M () const
│ │ │ │ +
1979 {
│ │ │ │ +
1980 return m;
│ │ │ │ +
1981 }
│ │ │ │ +
│ │ │ │ +
1982
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1985 {
│ │ │ │ +
1986 // in case of row-wise allocation
│ │ │ │ +
1987 if( nnz_ <= 0 )
│ │ │ │ +
1988 nnz_ = std::accumulate( begin(), end(), size_type( 0 ), [] ( size_type s, const row_type &row ) { return s+row.getsize(); } );
│ │ │ │ +
1989 return nnz_;
│ │ │ │ +
1990 }
│ │ │ │ +
│ │ │ │ +
1991
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1994 {
│ │ │ │ +
1995 return ready;
│ │ │ │ +
1996 }
│ │ │ │ +
│ │ │ │ +
1997
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
2000 {
│ │ │ │ +
2001 return build_mode;
│ │ │ │ +
2002 }
│ │ │ │ +
│ │ │ │ +
2003
│ │ │ │ +
2004 //===== query
│ │ │ │ +
2005
│ │ │ │ +
│ │ │ │ +
2007 bool exists (size_type i, size_type j) const
│ │ │ │ +
2008 {
│ │ │ │ +
2009#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
2010 if (i<0 || i>=n) DUNE_THROW(BCRSMatrixError,"row index out of range");
│ │ │ │ +
2011 if (j<0 || j>=m) DUNE_THROW(BCRSMatrixError,"column index out of range");
│ │ │ │ +
2012#endif
│ │ │ │ +
2013 return (r[i].size() && r[i].find(j) != r[i].end());
│ │ │ │ +
2014 }
│ │ │ │ +
│ │ │ │ +
2015
│ │ │ │ +
2016
│ │ │ │ +
2017 protected:
│ │ │ │ +
2018 // state information
│ │ │ │ +
2019 BuildMode build_mode; // row wise or whole matrix
│ │ │ │ +
2020 BuildStage ready; // indicate the stage the matrix building is in
│ │ │ │ +
2021
│ │ │ │ +
2022 // The allocator used for memory management
│ │ │ │ +
2023 typename std::allocator_traits<A>::template rebind_alloc<B> allocator_;
│ │ │ │ +
2024
│ │ │ │ +
2025 typename std::allocator_traits<A>::template rebind_alloc<row_type> rowAllocator_;
│ │ │ │ +
2026
│ │ │ │ +
2027 typename std::allocator_traits<A>::template rebind_alloc<size_type> sizeAllocator_;
│ │ │ │ +
2028
│ │ │ │ +
2029 // size of the matrix
│ │ │ │ +
2030 size_type n; // number of rows
│ │ │ │ +
2031 size_type m; // number of columns
│ │ │ │ +
2032 mutable size_type nnz_; // number of nonzeroes contained in the matrix
│ │ │ │ +
2033 size_type allocationSize_; //allocated size of a and j arrays, except in implicit mode: nnz_==allocationsSize_
│ │ │ │ +
2034 // zero means that memory is allocated separately for each row.
│ │ │ │ +
2035
│ │ │ │ +
2036 // the rows are dynamically allocated
│ │ │ │ +
2037 row_type* r; // [n] the individual rows having pointers into a,j arrays
│ │ │ │ +
2038
│ │ │ │ +
2039 // dynamically allocated memory
│ │ │ │ +
2040 B* a; // [allocationSize] non-zero entries of the matrix in row-wise ordering
│ │ │ │ +
2041 // If a single array of column indices is used, it can be shared
│ │ │ │ +
2042 // between different matrices with the same sparsity pattern
│ │ │ │ +
2043 std::shared_ptr<size_type> j_; // [allocationSize] column indices of entries
│ │ │ │ +
2044
│ │ │ │ +
2045 // additional data is needed in implicit buildmode
│ │ │ │ + │ │ │ │ + │ │ │ │ +
2048
│ │ │ │ +
2049 typedef std::map<std::pair<size_type,size_type>, B> OverflowType;
│ │ │ │ + │ │ │ │ +
2051
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
2053 {
│ │ │ │ +
2054 row_type current_row(a,j_.get(),0); // Pointers to current row data
│ │ │ │ +
2055 for (size_type i=0; i<n; i++, ++row) {
│ │ │ │ +
2056 // set row i
│ │ │ │ +
2057 size_type s = row->getsize();
│ │ │ │ +
2058
│ │ │ │ +
2059 if (s>0) {
│ │ │ │ +
2060 // setup pointers and size
│ │ │ │ +
2061 r[i].set(s,current_row.getptr(), current_row.getindexptr());
│ │ │ │ +
2062 // update pointer for next row
│ │ │ │ +
2063 current_row.setptr(current_row.getptr()+s);
│ │ │ │ +
2064 current_row.setindexptr(current_row.getindexptr()+s);
│ │ │ │ +
2065 } else{
│ │ │ │ +
2066 // empty row
│ │ │ │ +
2067 r[i].set(0,nullptr,nullptr);
│ │ │ │ +
2068 }
│ │ │ │ +
2069 }
│ │ │ │ +
2070 }
│ │ │ │ +
│ │ │ │ +
2071
│ │ │ │ +
2073
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
2078 {
│ │ │ │ +
2079 size_type* jptr = j_.get();
│ │ │ │ +
2080 for (size_type i=0; i<n; ++i, ++row) {
│ │ │ │ +
2081 // set row i
│ │ │ │ +
2082 size_type s = row->getsize();
│ │ │ │ +
2083
│ │ │ │ +
2084 if (s>0) {
│ │ │ │ +
2085 // setup pointers and size
│ │ │ │ +
2086 r[i].setsize(s);
│ │ │ │ +
2087 r[i].setindexptr(jptr);
│ │ │ │ +
2088 } else{
│ │ │ │ +
2089 // empty row
│ │ │ │ +
2090 r[i].set(0,nullptr,nullptr);
│ │ │ │ +
2091 }
│ │ │ │ +
2092
│ │ │ │ +
2093 // advance position in global array
│ │ │ │ +
2094 jptr += s;
│ │ │ │ +
2095 }
│ │ │ │ +
2096 }
│ │ │ │ +
│ │ │ │ +
2097
│ │ │ │ +
2099
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
2104 {
│ │ │ │ +
2105 B* aptr = a;
│ │ │ │ +
2106 for (size_type i=0; i<n; ++i) {
│ │ │ │ +
2107 // set row i
│ │ │ │ +
2108 if (r[i].getsize() > 0) {
│ │ │ │ +
2109 // setup pointers and size
│ │ │ │ +
2110 r[i].setptr(aptr);
│ │ │ │ +
2111 } else{
│ │ │ │ +
2112 // empty row
│ │ │ │ +
2113 r[i].set(0,nullptr,nullptr);
│ │ │ │ +
2114 }
│ │ │ │ +
2115
│ │ │ │ +
2116 // advance position in global array
│ │ │ │ +
2117 aptr += r[i].getsize();
│ │ │ │ +
2118 }
│ │ │ │ +
2119 }
│ │ │ │ +
│ │ │ │ +
2120
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
2123 {
│ │ │ │ +
2124 setWindowPointers(Mat.begin());
│ │ │ │ +
2125
│ │ │ │ +
2126 // copy data
│ │ │ │ +
2127 for (size_type i=0; i<n; i++) r[i] = Mat.r[i];
│ │ │ │ +
2128
│ │ │ │ +
2129 // finish off
│ │ │ │ +
2130 build_mode = row_wise; // dummy
│ │ │ │ +
2131 ready = built;
│ │ │ │ +
2132 }
│ │ │ │ +
│ │ │ │ +
2133
│ │ │ │ +
│ │ │ │ +
2139 void deallocate(bool deallocateRows=true)
│ │ │ │ +
2140 {
│ │ │ │ +
2141
│ │ │ │ +
2142 if (notAllocated)
│ │ │ │ +
2143 return;
│ │ │ │ +
2144
│ │ │ │ +
2145 if (allocationSize_>0)
│ │ │ │ +
2146 {
│ │ │ │ +
2147 // a,j_ have been allocated as one long vector
│ │ │ │ +
2148 j_.reset();
│ │ │ │ +
2149 if (a)
│ │ │ │ +
2150 {
│ │ │ │ +
2151 for(B *aiter=a+(allocationSize_-1), *aend=a-1; aiter!=aend; --aiter)
│ │ │ │ +
2152 std::allocator_traits<decltype(allocator_)>::destroy(allocator_, aiter);
│ │ │ │ +
2153 allocator_.deallocate(a,allocationSize_);
│ │ │ │ +
2154 a = nullptr;
│ │ │ │ +
2155 }
│ │ │ │ +
2156 }
│ │ │ │ +
2157 else if (r)
│ │ │ │ +
2158 {
│ │ │ │ +
2159 // check if memory for rows have been allocated individually
│ │ │ │ +
2160 for (size_type i=0; i<n; i++)
│ │ │ │ +
2161 if (r[i].getsize()>0)
│ │ │ │ +
2162 {
│ │ │ │ +
2163 for (B *col=r[i].getptr()+(r[i].getsize()-1),
│ │ │ │ +
2164 *colend = r[i].getptr()-1; col!=colend; --col) {
│ │ │ │ +
2165 std::allocator_traits<decltype(allocator_)>::destroy(allocator_, col);
│ │ │ │ +
2166 }
│ │ │ │ +
2167 sizeAllocator_.deallocate(r[i].getindexptr(),1);
│ │ │ │ +
2168 allocator_.deallocate(r[i].getptr(),1);
│ │ │ │ +
2169 // clear out row data in case we don't want to deallocate the rows
│ │ │ │ +
2170 // otherwise we might run into a double free problem here later
│ │ │ │ +
2171 r[i].set(0,nullptr,nullptr);
│ │ │ │ +
2172 }
│ │ │ │ +
2173 }
│ │ │ │ +
2174
│ │ │ │ +
2175 // deallocate the rows
│ │ │ │ +
2176 if (n>0 && deallocateRows && r) {
│ │ │ │ +
2177 for(row_type *riter=r+(n-1), *rend=r-1; riter!=rend; --riter)
│ │ │ │ +
2178 std::allocator_traits<decltype(rowAllocator_)>::destroy(rowAllocator_, riter);
│ │ │ │ +
2179 rowAllocator_.deallocate(r,n);
│ │ │ │ +
2180 r = nullptr;
│ │ │ │ +
2181 }
│ │ │ │ +
2182
│ │ │ │ +
2183 // Mark matrix as not built at all.
│ │ │ │ + │ │ │ │ +
2185
│ │ │ │ +
2186 }
│ │ │ │ +
│ │ │ │ +
2187
│ │ │ │ +
│ │ │ │ +
2205 void allocate(size_type rows, size_type columns, size_type allocationSize, bool allocateRows, bool allocate_data)
│ │ │ │ +
2206 {
│ │ │ │ +
2207 // Store size
│ │ │ │ +
2208 n = rows;
│ │ │ │ +
2209 m = columns;
│ │ │ │ +
2210 nnz_ = allocationSize;
│ │ │ │ +
2211 allocationSize_ = allocationSize;
│ │ │ │ +
2212
│ │ │ │ +
2213 // allocate rows
│ │ │ │ +
2214 if(allocateRows) {
│ │ │ │ +
2215 if (n>0) {
│ │ │ │ +
2216 if (r)
│ │ │ │ +
2217 DUNE_THROW(InvalidStateException,"Rows have already been allocated, cannot allocate a second time");
│ │ │ │ +
2218 r = rowAllocator_.allocate(rows);
│ │ │ │ +
2219 // initialize row entries
│ │ │ │ +
2220 for(row_type* ri=r; ri!=r+rows; ++ri)
│ │ │ │ +
2221 std::allocator_traits<decltype(rowAllocator_)>::construct(rowAllocator_, ri, row_type());
│ │ │ │ +
2222 }else{
│ │ │ │ +
2223 r = 0;
│ │ │ │ +
2224 }
│ │ │ │ +
2225 }
│ │ │ │ +
2226
│ │ │ │ +
2227 // allocate a and j_ array
│ │ │ │ +
2228 if (allocate_data)
│ │ │ │ +
2229 allocateData();
│ │ │ │ +
2230 // allocate column indices only if not yet present (enable sharing)
│ │ │ │ +
2231 if (allocationSize_>0) {
│ │ │ │ +
2232 // we copy allocator and size to the deleter since _j may outlive this class
│ │ │ │ +
2233 if (!j_.get())
│ │ │ │ +
2234 j_.reset(sizeAllocator_.allocate(allocationSize_),
│ │ │ │ +
2235 [alloc = sizeAllocator_, size = allocationSize_](auto ptr) mutable {
│ │ │ │ +
2236 alloc.deallocate(ptr, size);
│ │ │ │ +
2237 });
│ │ │ │ +
2238 }else{
│ │ │ │ +
2239 j_.reset();
│ │ │ │ +
2240 }
│ │ │ │ +
2241
│ │ │ │ +
2242 // Mark the matrix as not built.
│ │ │ │ +
2243 ready = building;
│ │ │ │ +
2244 }
│ │ │ │ +
│ │ │ │ +
2245
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
2247 {
│ │ │ │ +
2248 if (a)
│ │ │ │ +
2249 DUNE_THROW(InvalidStateException,"Cannot allocate data array (already allocated)");
│ │ │ │ +
2250 if (allocationSize_>0) {
│ │ │ │ +
2251 a = allocator_.allocate(allocationSize_);
│ │ │ │ +
2252 // use placement new to call constructor that allocates
│ │ │ │ +
2253 // additional memory.
│ │ │ │ +
2254 new (a) B[allocationSize_];
│ │ │ │ +
2255 } else {
│ │ │ │ +
2256 a = nullptr;
│ │ │ │ +
2257 }
│ │ │ │ +
2258 }
│ │ │ │ +
│ │ │ │ +
2259
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
2266 {
│ │ │ │ +
2267 if (build_mode != implicit)
│ │ │ │ +
2268 DUNE_THROW(InvalidStateException,"implicit_allocate() may only be called in implicit build mode");
│ │ │ │ +
2269 if (ready != notAllocated)
│ │ │ │ +
2270 DUNE_THROW(InvalidStateException,"memory has already been allocated");
│ │ │ │ +
2271
│ │ │ │ +
2272 // check to make sure the user has actually set the parameters
│ │ │ │ +
2273 if (compressionBufferSize_ < 0)
│ │ │ │ +
2274 DUNE_THROW(InvalidStateException,"You have to set the implicit build mode parameters before starting to build the matrix");
│ │ │ │ +
2275 //calculate size of overflow region, add buffer for row sort!
│ │ │ │ + │ │ │ │ +
2277 allocationSize_ = _n*avg + osize;
│ │ │ │ +
2278
│ │ │ │ +
2279 allocate(_n, _m, allocationSize_,true,true);
│ │ │ │ +
2280
│ │ │ │ +
2281 //set row pointers correctly
│ │ │ │ +
2282 size_type* jptr = j_.get() + osize;
│ │ │ │ +
2283 B* aptr = a + osize;
│ │ │ │ +
2284 for (size_type i=0; i<n; i++)
│ │ │ │ +
2285 {
│ │ │ │ +
2286 r[i].set(0,aptr,jptr);
│ │ │ │ +
2287 jptr = jptr + avg;
│ │ │ │ +
2288 aptr = aptr + avg;
│ │ │ │ +
2289 }
│ │ │ │ +
2290
│ │ │ │ +
2291 ready = building;
│ │ │ │ +
2292 }
│ │ │ │ +
│ │ │ │ +
2293 };
│ │ │ │ +
│ │ │ │ +
2294
│ │ │ │ +
2295
│ │ │ │ +
2296 template<class B, class A>
│ │ │ │ +
│ │ │ │ +
2297 struct FieldTraits< BCRSMatrix<B, A> >
│ │ │ │ +
2298 {
│ │ │ │ + │ │ │ │ +
2300 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
2301 };
│ │ │ │ +
│ │ │ │ +
2302
│ │ │ │ +
2305} // end namespace
│ │ │ │ +
2306
│ │ │ │ +
2307#endif
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ +
Some handy generic functions for ISTL matrices.
│ │ │ │ + │ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │
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
│ │ │ │ -
std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0)
Traverse a blocked vector and call a functor at each scalar entry.
Definition foreach.hh:95
│ │ │ │ -
auto rows(Matrix const &matrix)
Definition foreach.hh:69
│ │ │ │ -
auto cols(Matrix const &matrix)
Definition foreach.hh:72
│ │ │ │ -
auto size(Vector const &vector)
Definition foreach.hh:75
│ │ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │ +
Definition matrixutils.hh:211
│ │ │ │ +
Statistics about compression achieved in implicit mode.
Definition bcrsmatrix.hh:88
│ │ │ │ +
size_type overflow_total
total number of elements written to the overflow area during construction.
Definition bcrsmatrix.hh:94
│ │ │ │ +
size_type maximum
maximum number of non-zeroes per row.
Definition bcrsmatrix.hh:92
│ │ │ │ +
double avg
average number of non-zeroes per row.
Definition bcrsmatrix.hh:90
│ │ │ │ +
double mem_ratio
fraction of wasted memory resulting from non-used overflow area.
Definition bcrsmatrix.hh:99
│ │ │ │ +
A wrapper for uniform access to the BCRSMatrix during and after the build stage in implicit build mod...
Definition bcrsmatrix.hh:117
│ │ │ │ +
Matrix::block_type block_type
The block_type of the underlying matrix.
Definition bcrsmatrix.hh:125
│ │ │ │ +
ImplicitMatrixBuilder(Matrix &m)
Creates an ImplicitMatrixBuilder for matrix m.
Definition bcrsmatrix.hh:170
│ │ │ │ +
M_ Matrix
The underlying matrix.
Definition bcrsmatrix.hh:122
│ │ │ │ +
ImplicitMatrixBuilder(Matrix &m, size_type rows, size_type cols, size_type avg_cols_per_row, double overflow_fraction)
Sets up matrix m for implicit construction using the given parameters and creates an ImplicitBmatrixu...
Definition bcrsmatrix.hh:194
│ │ │ │ +
size_type M() const
The number of columns in the matrix.
Definition bcrsmatrix.hh:217
│ │ │ │ +
Matrix::size_type size_type
The size_type of the underlying matrix.
Definition bcrsmatrix.hh:128
│ │ │ │ +
row_object operator[](size_type i) const
Returns a proxy for entries in row i.
Definition bcrsmatrix.hh:205
│ │ │ │ +
size_type N() const
The number of rows in the matrix.
Definition bcrsmatrix.hh:211
│ │ │ │ +
Proxy row object for entry access.
Definition bcrsmatrix.hh:137
│ │ │ │ +
block_type & operator[](size_type j) const
Returns entry in column j.
Definition bcrsmatrix.hh:142
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bcrsmatrix.hh:488
│ │ │ │ +
std::allocator_traits< A >::template rebind_alloc< row_type > rowAllocator_
Definition bcrsmatrix.hh:2025
│ │ │ │ +
bool exists(size_type i, size_type j) const
return true if (i,j) is in pattern
Definition bcrsmatrix.hh:2007
│ │ │ │ +
BuildStage buildStage() const
The current build stage of the matrix.
Definition bcrsmatrix.hh:1993
│ │ │ │ +
Iterator begin()
Get iterator to first row.
Definition bcrsmatrix.hh:675
│ │ │ │ +
void copyWindowStructure(const BCRSMatrix &Mat)
Copy the window structure from another matrix.
Definition bcrsmatrix.hh:2122
│ │ │ │ +
B & entry(size_type row, size_type col)
Returns reference to entry (row,col) of the matrix.
Definition bcrsmatrix.hh:1296
│ │ │ │ +
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition bcrsmatrix.hh:1812
│ │ │ │ +
void usmhv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition bcrsmatrix.hh:1835
│ │ │ │ +
void umtv(const X &x, Y &y) const
y += A^T x
Definition bcrsmatrix.hh:1722
│ │ │ │ +
double compressionBufferSize_
Definition bcrsmatrix.hh:2047
│ │ │ │ +
size_type m
Definition bcrsmatrix.hh:2031
│ │ │ │ +
RealRowIterator< const row_type > const_iterator
The const iterator over the matrix rows.
Definition bcrsmatrix.hh:707
│ │ │ │ +
static constexpr unsigned int blocklevel
increment block level counter
Definition bcrsmatrix.hh:507
│ │ │ │ +
void allocate(size_type rows, size_type columns, size_type allocationSize, bool allocateRows, bool allocate_data)
Allocate memory for the matrix structure.
Definition bcrsmatrix.hh:2205
│ │ │ │ +
BCRSMatrix & axpy(field_type alpha, const BCRSMatrix &b)
Add the scaled entries of another matrix to this one.
Definition bcrsmatrix.hh:1592
│ │ │ │ +
FieldTraits< ft >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition bcrsmatrix.hh:1905
│ │ │ │ +
~BCRSMatrix()
destructor
Definition bcrsmatrix.hh:824
│ │ │ │ +
void allocateData()
Definition bcrsmatrix.hh:2246
│ │ │ │ +
void deallocate(bool deallocateRows=true)
deallocate memory of the matrix.
Definition bcrsmatrix.hh:2139
│ │ │ │ +
Iterator RowIterator
rename the iterators for easier access
Definition bcrsmatrix.hh:701
│ │ │ │ +
row_type & operator[](size_type i)
random access to the rows
Definition bcrsmatrix.hh:549
│ │ │ │ +
BCRSMatrix()
an empty matrix
Definition bcrsmatrix.hh:749
│ │ │ │ +
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1149
│ │ │ │ +
void incrementrowsize(size_type i, size_type s=1)
increment size of row i by s (1 by default)
Definition bcrsmatrix.hh:1138
│ │ │ │ +
void mtv(const X &x, Y &y) const
y = A^T x
Definition bcrsmatrix.hh:1707
│ │ │ │ +
void umhv(const X &x, Y &y) const
y += A^H x
Definition bcrsmatrix.hh:1789
│ │ │ │ +
size_type nonzeroes() const
number of blocks that are stored (the number of blocks that possibly are nonzero)
Definition bcrsmatrix.hh:1984
│ │ │ │ +
size_type allocationSize_
Definition bcrsmatrix.hh:2033
│ │ │ │ +
ConstIterator ConstRowIterator
rename the const row iterator for easier access
Definition bcrsmatrix.hh:738
│ │ │ │ +
BuildStage ready
Definition bcrsmatrix.hh:2020
│ │ │ │ +
BuildMode build_mode
Definition bcrsmatrix.hh:2019
│ │ │ │ +
void setrowsize(size_type i, size_type s)
Set number of indices in row i to s.
Definition bcrsmatrix.hh:1117
│ │ │ │ +
RealRowIterator< row_type > Iterator
Definition bcrsmatrix.hh:672
│ │ │ │ +
size_type nnz_
Definition bcrsmatrix.hh:2032
│ │ │ │ +
BCRSMatrix & operator*=(const field_type &k)
vector space multiplication with scalar
Definition bcrsmatrix.hh:1484
│ │ │ │ +
std::allocator_traits< A >::template rebind_alloc< size_type > sizeAllocator_
Definition bcrsmatrix.hh:2027
│ │ │ │ +
RealRowIterator< row_type > iterator
The iterator over the (mutable matrix rows.
Definition bcrsmatrix.hh:671
│ │ │ │ +
void usmtv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition bcrsmatrix.hh:1766
│ │ │ │ +
ConstIterator beforeBegin() const
Definition bcrsmatrix.hh:732
│ │ │ │ +
RealRowIterator< const row_type > ConstIterator
Definition bcrsmatrix.hh:708
│ │ │ │ +
Iterator beforeBegin()
Definition bcrsmatrix.hh:695
│ │ │ │ +
B * a
Definition bcrsmatrix.hh:2040
│ │ │ │ +
BuildMode
we support two modes
Definition bcrsmatrix.hh:510
│ │ │ │ +
@ implicit
Build entries randomly with an educated guess for the number of entries per row.
Definition bcrsmatrix.hh:539
│ │ │ │ +
@ unknown
Build mode not set!
Definition bcrsmatrix.hh:543
│ │ │ │ +
@ random
Build entries randomly.
Definition bcrsmatrix.hh:530
│ │ │ │ +
@ row_wise
Build in a row-wise manner.
Definition bcrsmatrix.hh:521
│ │ │ │ +
BCRSMatrix(size_type _n, size_type _m, size_type _nnz, BuildMode bm)
matrix with known number of nonzeroes
Definition bcrsmatrix.hh:756
│ │ │ │ +
::Dune::CompressionStatistics< size_type > CompressionStatistics
The type for the statistics object returned by compress()
Definition bcrsmatrix.hh:503
│ │ │ │ +
BCRSMatrix & operator-=(const BCRSMatrix &b)
Subtract the entries of another matrix from this one.
Definition bcrsmatrix.hh:1567
│ │ │ │ +
BCRSMatrix(const BCRSMatrix &Mat)
copy constructor
Definition bcrsmatrix.hh:805
│ │ │ │ +
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:681
│ │ │ │ +
row_type * r
Definition bcrsmatrix.hh:2037
│ │ │ │ +
void setIndices(size_type row, It begin, It end)
Set all column indices for row from the given iterator range.
Definition bcrsmatrix.hh:1234
│ │ │ │ +
void addindex(size_type row, size_type col)
add index (row,col) to the matrix
Definition bcrsmatrix.hh:1191
│ │ │ │ +
std::map< std::pair< size_type, size_type >, B > OverflowType
Definition bcrsmatrix.hh:2049
│ │ │ │ +
row_type::Iterator ColIterator
Iterator for the entries of each row.
Definition bcrsmatrix.hh:704
│ │ │ │ +
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition bcrsmatrix.hh:1877
│ │ │ │ +
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ +
BCRSMatrix & operator/=(const field_type &k)
vector space division by scalar
Definition bcrsmatrix.hh:1512
│ │ │ │ +
OverflowType overflow
Definition bcrsmatrix.hh:2050
│ │ │ │ +
BCRSMatrix & operator+=(const BCRSMatrix &b)
Add the entries of another matrix to this one.
Definition bcrsmatrix.hh:1545
│ │ │ │ +
BCRSMatrix(size_type _n, size_type _m, size_type _avg, double compressionBufferSize, BuildMode bm)
construct matrix with a known average number of entries per row
Definition bcrsmatrix.hh:784
│ │ │ │ +
CreateIterator createend()
get create iterator pointing to one after the last block
Definition bcrsmatrix.hh:1103
│ │ │ │ +
FieldTraits< field_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition bcrsmatrix.hh:1860
│ │ │ │ +
Iterator beforeEnd()
Definition bcrsmatrix.hh:688
│ │ │ │ +
row_type::ConstIterator ConstColIterator
Const iterator to the entries of a row.
Definition bcrsmatrix.hh:741
│ │ │ │ +
void usmv(F &&alpha, const X &x, Y &y) const
y += alpha A x
Definition bcrsmatrix.hh:1684
│ │ │ │ +
size_type getrowsize(size_type i) const
get current number of indices in row i
Definition bcrsmatrix.hh:1128
│ │ │ │ +
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:1978
│ │ │ │ +
size_type n
Definition bcrsmatrix.hh:2030
│ │ │ │ +
Imp::CompressedBlockVectorWindow< B, A > row_type
implement row_type with compressed vector
Definition bcrsmatrix.hh:497
│ │ │ │ +
CreateIterator createbegin()
get initial create iterator
Definition bcrsmatrix.hh:1097
│ │ │ │ +
BuildStage
Definition bcrsmatrix.hh:469
│ │ │ │ +
@ rowSizesBuilt
The row sizes of the matrix are known.
Definition bcrsmatrix.hh:480
│ │ │ │ +
@ built
The matrix structure is fully built.
Definition bcrsmatrix.hh:482
│ │ │ │ +
@ notbuilt
Matrix is not built at all, no memory has been allocated, build mode and size can still be set.
Definition bcrsmatrix.hh:471
│ │ │ │ +
@ notAllocated
Matrix is not built at all, no memory has been allocated, build mode and size can still be set.
Definition bcrsmatrix.hh:473
│ │ │ │ +
@ building
Matrix is currently being built, some memory has been allocated, build mode and size are fixed.
Definition bcrsmatrix.hh:475
│ │ │ │ +
BuildMode buildMode() const
The currently selected build mode of the matrix.
Definition bcrsmatrix.hh:1999
│ │ │ │ +
void mmv(const X &x, Y &y) const
y -= A x
Definition bcrsmatrix.hh:1661
│ │ │ │ +
FieldTraits< ft >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition bcrsmatrix.hh:1885
│ │ │ │ +
void mv(const X &x, Y &y) const
y = A x
Definition bcrsmatrix.hh:1612
│ │ │ │ +
B block_type
export the type representing the components
Definition bcrsmatrix.hh:491
│ │ │ │ +
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition bcrsmatrix.hh:1745
│ │ │ │ +
size_type avg
Definition bcrsmatrix.hh:2046
│ │ │ │ +
void umv(const X &x, Y &y) const
y += A x
Definition bcrsmatrix.hh:1638
│ │ │ │ +
void implicit_allocate(size_type _n, size_type _m)
organizes allocation implicit mode calculates correct array size to be allocated and sets the the win...
Definition bcrsmatrix.hh:2265
│ │ │ │ +
void setImplicitBuildModeParameters(size_type _avg, double compressionBufferSize)
Set parameters needed for creation in implicit build mode.
Definition bcrsmatrix.hh:889
│ │ │ │ +
BCRSMatrix(size_type _n, size_type _m, BuildMode bm)
matrix with unknown number of nonzeroes
Definition bcrsmatrix.hh:765
│ │ │ │ +
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1248
│ │ │ │ +
CompressionStatistics compress()
Finishes the buildstage in implicit mode.
Definition bcrsmatrix.hh:1360
│ │ │ │ +
void setDataPointers()
Set data pointers for all rows.
Definition bcrsmatrix.hh:2103
│ │ │ │ +
std::allocator_traits< A >::template rebind_alloc< B > allocator_
Definition bcrsmatrix.hh:2023
│ │ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ +
void setBuildMode(BuildMode bm)
Sets the build mode of the matrix.
Definition bcrsmatrix.hh:833
│ │ │ │ +
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:861
│ │ │ │ +
std::shared_ptr< size_type > j_
Definition bcrsmatrix.hh:2043
│ │ │ │ +
void setWindowPointers(ConstRowIterator row)
Definition bcrsmatrix.hh:2052
│ │ │ │ +
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:911
│ │ │ │ +
void setColumnPointers(ConstRowIterator row)
Copy row sizes from iterator range starting at row and set column index pointers for all rows.
Definition bcrsmatrix.hh:2077
│ │ │ │ +
ConstIterator end() const
Get const iterator to one beyond last row.
Definition bcrsmatrix.hh:718
│ │ │ │ +
ConstIterator begin() const
Get const iterator to first row.
Definition bcrsmatrix.hh:712
│ │ │ │ +
A allocator_type
export the allocator type
Definition bcrsmatrix.hh:494
│ │ │ │ +
ConstIterator beforeEnd() const
Definition bcrsmatrix.hh:725
│ │ │ │ +
Iterator access to matrix rows
Definition bcrsmatrix.hh:579
│ │ │ │ +
RealRowIterator()
empty constructor, use with care!
Definition bcrsmatrix.hh:596
│ │ │ │ +
bool equals(const RealRowIterator< ValueType > &other) const
equality
Definition bcrsmatrix.hh:624
│ │ │ │ +
std::remove_const< T >::type ValueType
The unqualified value type.
Definition bcrsmatrix.hh:583
│ │ │ │ +
RealRowIterator(const RealRowIterator< ValueType > &it)
Definition bcrsmatrix.hh:600
│ │ │ │ +
bool equals(const RealRowIterator< const ValueType > &other) const
equality
Definition bcrsmatrix.hh:631
│ │ │ │ +
RealRowIterator(row_type *_p, size_type _i)
constructor
Definition bcrsmatrix.hh:591
│ │ │ │ +
std::ptrdiff_t distanceTo(const RealRowIterator< const ValueType > &other) const
Definition bcrsmatrix.hh:617
│ │ │ │ +
size_type index() const
return index
Definition bcrsmatrix.hh:606
│ │ │ │ +
std::ptrdiff_t distanceTo(const RealRowIterator< ValueType > &other) const
Definition bcrsmatrix.hh:611
│ │ │ │ +
Iterator class for sequential creation of blocks
Definition bcrsmatrix.hh:957
│ │ │ │ +
bool operator==(const CreateIterator &it) const
equality
Definition bcrsmatrix.hh:1052
│ │ │ │ +
CreateIterator & operator++()
prefix increment
Definition bcrsmatrix.hh:977
│ │ │ │ +
size_type index() const
The number of the row that the iterator currently points to.
Definition bcrsmatrix.hh:1058
│ │ │ │ +
bool operator!=(const CreateIterator &it) const
inequality
Definition bcrsmatrix.hh:1046
│ │ │ │ +
CreateIterator(BCRSMatrix &_Mat, size_type _i)
constructor
Definition bcrsmatrix.hh:960
│ │ │ │ +
void insert(size_type j)
put column index in row
Definition bcrsmatrix.hh:1064
│ │ │ │ +
bool contains(size_type j)
return true if column index is in row
Definition bcrsmatrix.hh:1070
│ │ │ │ +
size_type size() const
Get the current row size.
Definition bcrsmatrix.hh:1079
│ │ │ │ +
typename BCRSMatrix< B, A >::field_type field_type
Definition bcrsmatrix.hh:2299
│ │ │ │ +
typename FieldTraits< field_type >::real_type real_type
Definition bcrsmatrix.hh:2300
│ │ │ │ +
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
│ │ │ │
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ -
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │ +
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ │ +
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ +
Definition matrixutils.hh:538
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,233 +1,2387 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -foreach.hh │ │ │ │ │ +bcrsmatrix.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -3#pragma once │ │ │ │ │ -4 │ │ │ │ │ -5#include │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ +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_BCRSMATRIX_HH │ │ │ │ │ +7#define DUNE_ISTL_BCRSMATRIX_HH │ │ │ │ │ 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{ │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ -60 template │ │ │ │ │ -61 auto size(Vector const& vector, PriorityTag<1>) -> decltype(vector.size()) │ │ │ │ │ -{ return vector.size(); } │ │ │ │ │ -62 │ │ │ │ │ -63 │ │ │ │ │ -64 } // end namespace Impl │ │ │ │ │ -65 │ │ │ │ │ -_6_6namespace ForEach{ │ │ │ │ │ -67 │ │ │ │ │ -68 template │ │ │ │ │ -_6_9 auto _r_o_w_s(_M_a_t_r_i_x const& matrix) { return Impl::rows(matrix, PriorityTag<5> │ │ │ │ │ -{}); } │ │ │ │ │ -70 │ │ │ │ │ -71 template │ │ │ │ │ -_7_2 auto _c_o_l_s(_M_a_t_r_i_x const& matrix) { return Impl::cols(matrix, PriorityTag<5> │ │ │ │ │ -{}); } │ │ │ │ │ -73 │ │ │ │ │ -74 template │ │ │ │ │ -_7_5 auto _s_i_z_e(Vector const& vector) { return Impl::size(vector, PriorityTag<5> │ │ │ │ │ -{}); } │ │ │ │ │ -76 │ │ │ │ │ -77} // namespace ForEach │ │ │ │ │ +19#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +20#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ +21#include "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ │ +22#include │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26#include │ │ │ │ │ +27#include │ │ │ │ │ +28 │ │ │ │ │ +29#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +30 │ │ │ │ │ +35namespace _D_u_n_e { │ │ │ │ │ +36 │ │ │ │ │ +76 template │ │ │ │ │ +77 struct MatrixDimension; │ │ │ │ │ 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 // 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 }(); │ │ │ │ │ +86 template │ │ │ │ │ +_8_7 struct _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s │ │ │ │ │ +88 { │ │ │ │ │ +_9_0 double _a_v_g; │ │ │ │ │ +_9_2 size_type _m_a_x_i_m_u_m; │ │ │ │ │ +_9_4 size_type _o_v_e_r_f_l_o_w___t_o_t_a_l; │ │ │ │ │ +96 │ │ │ │ │ +_9_9 double _m_e_m___r_a_t_i_o; │ │ │ │ │ +100 }; │ │ │ │ │ +101 │ │ │ │ │ +103 │ │ │ │ │ +115 template │ │ │ │ │ +_1_1_6 class _I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ +117 { │ │ │ │ │ +118 │ │ │ │ │ +119 public: │ │ │ │ │ +120 │ │ │ │ │ +_1_2_2 typedef M_ _M_a_t_r_i_x; │ │ │ │ │ +123 │ │ │ │ │ +_1_2_5 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +126 │ │ │ │ │ +_1_2_8 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +129 │ │ │ │ │ +131 │ │ │ │ │ +_1_3_6 class _r_o_w___o_b_j_e_c_t │ │ │ │ │ +137 { │ │ │ │ │ +138 │ │ │ │ │ +139 public: │ │ │ │ │ +140 │ │ │ │ │ +_1_4_2 _b_l_o_c_k___t_y_p_e& _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e j) const │ │ │ │ │ +143 { │ │ │ │ │ +144 return _m.entry(_i,j); │ │ │ │ │ +145 } │ │ │ │ │ +146 │ │ │ │ │ +147#ifndef DOXYGEN │ │ │ │ │ +148 │ │ │ │ │ +149 _r_o_w___o_b_j_e_c_t(_M_a_t_r_i_x& m, _s_i_z_e___t_y_p_e i) │ │ │ │ │ +150 : _m(m) │ │ │ │ │ +151 , _i(i) │ │ │ │ │ +152 {} │ │ │ │ │ +153 │ │ │ │ │ +154#endif │ │ │ │ │ 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 auto [ dummyRows, dummyCols ] = _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); │ │ │ │ │ -171 assert( dummyRows == blockRows and dummyCols == blockCols and "we need the │ │ │ │ │ -same size of each block in this matrix type"); │ │ │ │ │ -172 } │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -175 return { matrix.N()*blockRows, matrix.M()*blockCols }; │ │ │ │ │ -176 } │ │ │ │ │ -177 // all other matrix types are accessed index-wise with dynamic flat row/col │ │ │ │ │ -counting │ │ │ │ │ -178 else │ │ │ │ │ -179 { │ │ │ │ │ -180 std::size_t r = 0, c = 0; │ │ │ │ │ -181 std::size_t nRows, nCols; │ │ │ │ │ -182 │ │ │ │ │ -183 Hybrid::forEach(Dune::range(_F_o_r_E_a_c_h_:_:_r_o_w_s(matrix)), [&](auto i) { │ │ │ │ │ -184 c = 0; │ │ │ │ │ -185 Hybrid::forEach(Dune::range(_F_o_r_E_a_c_h_:_:_c_o_l_s(matrix)), [&](auto j) { │ │ │ │ │ -186 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); │ │ │ │ │ -187 c += nCols; │ │ │ │ │ -188 }); │ │ │ │ │ -189 r += nRows; │ │ │ │ │ -190 }); │ │ │ │ │ -191 return {r,c}; │ │ │ │ │ -192 } │ │ │ │ │ -193 } │ │ │ │ │ -194} │ │ │ │ │ -195 │ │ │ │ │ -196} // 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. │ │ │ │ │ +156 private: │ │ │ │ │ +157 │ │ │ │ │ +158 _M_a_t_r_i_x& _m; │ │ │ │ │ +_1_5_9 _s_i_z_e___t_y_p_e _i; │ │ │ │ │ +160 │ │ │ │ │ +161 }; │ │ │ │ │ +162 │ │ │ │ │ +164 │ │ │ │ │ +_1_7_0 _I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r(_M_a_t_r_i_x& m) │ │ │ │ │ +171 : _m(m) │ │ │ │ │ +172 { │ │ │ │ │ +173 if (m.buildMode() != Matrix::implicit) │ │ │ │ │ +174 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only create an ImplicitBuilder for a │ │ │ │ │ +matrix in implicit build mode"); │ │ │ │ │ +175 if (m.buildStage() != Matrix::building) │ │ │ │ │ +176 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only create an ImplicitBuilder for a │ │ │ │ │ +matrix with set size that has not been compressed() yet"); │ │ │ │ │ +177 } │ │ │ │ │ +178 │ │ │ │ │ +180 │ │ │ │ │ +_1_9_4 _I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r(_M_a_t_r_i_x& m, _s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e cols, _s_i_z_e___t_y_p_e │ │ │ │ │ +avg_cols_per_row, double overflow_fraction) │ │ │ │ │ +195 : _m(m) │ │ │ │ │ +196 { │ │ │ │ │ +197 if (m.buildStage() != Matrix::notAllocated) │ │ │ │ │ +198 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only set up a matrix for this │ │ │ │ │ +ImplicitBuilder if it has no memory allocated yet"); │ │ │ │ │ +199 m.setBuildMode(Matrix::implicit); │ │ │ │ │ +200 m.setImplicitBuildModeParameters(avg_cols_per_row,overflow_fraction); │ │ │ │ │ +201 m.setSize(rows,cols); │ │ │ │ │ +202 } │ │ │ │ │ +203 │ │ │ │ │ +_2_0_5 _r_o_w___o_b_j_e_c_t _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +206 { │ │ │ │ │ +207 return _r_o_w___o_b_j_e_c_t(_m,i); │ │ │ │ │ +208 } │ │ │ │ │ +209 │ │ │ │ │ +_2_1_1 _s_i_z_e___t_y_p_e _N() const │ │ │ │ │ +212 { │ │ │ │ │ +213 return _m.N(); │ │ │ │ │ +214 } │ │ │ │ │ +215 │ │ │ │ │ +_2_1_7 _s_i_z_e___t_y_p_e _M() const │ │ │ │ │ +218 { │ │ │ │ │ +219 return _m.M(); │ │ │ │ │ +220 } │ │ │ │ │ +221 │ │ │ │ │ +222 private: │ │ │ │ │ +223 │ │ │ │ │ +224 _M_a_t_r_i_x& _m; │ │ │ │ │ +225 │ │ │ │ │ +226 }; │ │ │ │ │ +227 │ │ │ │ │ +464 template > │ │ │ │ │ +_4_6_5 class _B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +466 { │ │ │ │ │ +467 friend struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_B_C_R_S_M_a_t_r_i_x>; │ │ │ │ │ +468 public: │ │ │ │ │ +_4_6_9 enum _B_u_i_l_d_S_t_a_g_e { │ │ │ │ │ +_4_7_1 _n_o_t_b_u_i_l_t=0, │ │ │ │ │ +_4_7_3 _n_o_t_A_l_l_o_c_a_t_e_d=0, │ │ │ │ │ +_4_7_5 _b_u_i_l_d_i_n_g=1, │ │ │ │ │ +_4_8_0 _r_o_w_S_i_z_e_s_B_u_i_l_t=2, │ │ │ │ │ +482 _b_u_i_l_t=3 │ │ │ │ │ +_4_8_3 }; │ │ │ │ │ +484 │ │ │ │ │ +485 //===== type definitions and constants │ │ │ │ │ +486 │ │ │ │ │ +_4_8_8 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ +489 │ │ │ │ │ +_4_9_1 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +492 │ │ │ │ │ +_4_9_4 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +495 │ │ │ │ │ +_4_9_7 typedef Imp::CompressedBlockVectorWindow _r_o_w___t_y_p_e; │ │ │ │ │ +498 │ │ │ │ │ +_5_0_0 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +501 │ │ │ │ │ +_5_0_3 typedef ::Dune::CompressionStatistics _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s; │ │ │ │ │ +504 │ │ │ │ │ +506 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ +2.8.")]] │ │ │ │ │ +_5_0_7 static constexpr unsigned int _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ +508 │ │ │ │ │ +_5_1_0 enum _B_u_i_l_d_M_o_d_e { │ │ │ │ │ +_5_2_1 _r_o_w___w_i_s_e, │ │ │ │ │ +_5_3_0 _r_a_n_d_o_m, │ │ │ │ │ +_5_3_9 _i_m_p_l_i_c_i_t, │ │ │ │ │ +543 _u_n_k_n_o_w_n │ │ │ │ │ +_5_4_4 }; │ │ │ │ │ +545 │ │ │ │ │ +546 //===== random access interface to rows of the matrix │ │ │ │ │ +547 │ │ │ │ │ +_5_4_9 _r_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) │ │ │ │ │ +550 { │ │ │ │ │ +551#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +552 if (_b_u_i_l_d___m_o_d_e == _i_m_p_l_i_c_i_t && _r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +553 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot use operator[] in implicit build │ │ │ │ │ +mode before calling compress()"); │ │ │ │ │ +554 if (_r==0) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row not initialized yet"); │ │ │ │ │ +555 if (i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +556#endif │ │ │ │ │ +557 return _r[i]; │ │ │ │ │ +558 } │ │ │ │ │ +559 │ │ │ │ │ +_5_6_1 const _r_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +562 { │ │ │ │ │ +563#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +564 if (_b_u_i_l_d___m_o_d_e == _i_m_p_l_i_c_i_t && _r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +565 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot use operator[] in implicit build │ │ │ │ │ +mode before calling compress()"); │ │ │ │ │ +566 if (_b_u_i_l_t!=_r_e_a_d_y) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row not initialized yet"); │ │ │ │ │ +567 if (i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +568#endif │ │ │ │ │ +569 return _r[i]; │ │ │ │ │ +570 } │ │ │ │ │ +571 │ │ │ │ │ +572 │ │ │ │ │ +573 //===== iterator interface to rows of the matrix │ │ │ │ │ +574 │ │ │ │ │ +576 template │ │ │ │ │ +_5_7_7 class _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +578 : public RandomAccessIteratorFacade, T> │ │ │ │ │ +579 { │ │ │ │ │ +580 │ │ │ │ │ +581 public: │ │ │ │ │ +_5_8_3 typedef typename std::remove_const::type _V_a_l_u_e_T_y_p_e; │ │ │ │ │ +584 │ │ │ │ │ +585 friend class RandomAccessIteratorFacade<_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r, │ │ │ │ │ +const _V_a_l_u_e_T_y_p_e>; │ │ │ │ │ +586 friend class RandomAccessIteratorFacade<_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r<_V_a_l_u_e_T_y_p_e>, │ │ │ │ │ +_V_a_l_u_e_T_y_p_e>; │ │ │ │ │ +587 friend class _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ +588 friend class _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r<_V_a_l_u_e_T_y_p_e>; │ │ │ │ │ +589 │ │ │ │ │ +_5_9_1 _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r (_r_o_w___t_y_p_e* _p, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ +592 : p(_p), i(_i) │ │ │ │ │ +593 {} │ │ │ │ │ +594 │ │ │ │ │ +_5_9_6 _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r () │ │ │ │ │ +597 : p(0), i(0) │ │ │ │ │ +598 {} │ │ │ │ │ +599 │ │ │ │ │ +_6_0_0 _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r(const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_V_a_l_u_e_T_y_p_e_>& it) │ │ │ │ │ +601 : p(it.p), i(it.i) │ │ │ │ │ +602 {} │ │ │ │ │ +603 │ │ │ │ │ +604 │ │ │ │ │ +_6_0_6 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ +607 { │ │ │ │ │ +608 return i; │ │ │ │ │ +609 } │ │ │ │ │ +610 │ │ │ │ │ +_6_1_1 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_V_a_l_u_e_T_y_p_e_>& other) const │ │ │ │ │ +612 { │ │ │ │ │ +613 assert(other.p==p); │ │ │ │ │ +614 return (other.i-i); │ │ │ │ │ +615 } │ │ │ │ │ +616 │ │ │ │ │ +_6_1_7 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _V_a_l_u_e_T_y_p_e_>& other) │ │ │ │ │ +const │ │ │ │ │ +618 { │ │ │ │ │ +619 assert(other.p==p); │ │ │ │ │ +620 return (other.i-i); │ │ │ │ │ +621 } │ │ │ │ │ +622 │ │ │ │ │ +_6_2_4 bool _e_q_u_a_l_s (const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_V_a_l_u_e_T_y_p_e_>& other) const │ │ │ │ │ +625 { │ │ │ │ │ +626 assert(other.p==p); │ │ │ │ │ +627 return i==other.i; │ │ │ │ │ +628 } │ │ │ │ │ +629 │ │ │ │ │ +_6_3_1 bool _e_q_u_a_l_s (const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _V_a_l_u_e_T_y_p_e_>& other) const │ │ │ │ │ +632 { │ │ │ │ │ +633 assert(other.p==p); │ │ │ │ │ +634 return i==other.i; │ │ │ │ │ +635 } │ │ │ │ │ +636 │ │ │ │ │ +637 private: │ │ │ │ │ +639 void increment() │ │ │ │ │ +640 { │ │ │ │ │ +641 ++i; │ │ │ │ │ +642 } │ │ │ │ │ +643 │ │ │ │ │ +645 void decrement() │ │ │ │ │ +646 { │ │ │ │ │ +647 --i; │ │ │ │ │ +648 } │ │ │ │ │ +649 │ │ │ │ │ +650 void advance(std::ptrdiff_t diff) │ │ │ │ │ +651 { │ │ │ │ │ +652 i+=diff; │ │ │ │ │ +653 } │ │ │ │ │ +654 │ │ │ │ │ +655 T& elementAt(std::ptrdiff_t diff) const │ │ │ │ │ +656 { │ │ │ │ │ +657 return p[i+diff]; │ │ │ │ │ +658 } │ │ │ │ │ +659 │ │ │ │ │ +661 _r_o_w___t_y_p_e& dereference () const │ │ │ │ │ +662 { │ │ │ │ │ +663 return p[i]; │ │ │ │ │ +664 } │ │ │ │ │ +665 │ │ │ │ │ +666 _r_o_w___t_y_p_e* p; │ │ │ │ │ +667 _s_i_z_e___t_y_p_e i; │ │ │ │ │ +668 }; │ │ │ │ │ +669 │ │ │ │ │ +_6_7_1 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_r_o_w___t_y_p_e_> _i_t_e_r_a_t_o_r; │ │ │ │ │ +_6_7_2 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_r_o_w___t_y_p_e_> _I_t_e_r_a_t_o_r; │ │ │ │ │ +673 │ │ │ │ │ +_6_7_5 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ +676 { │ │ │ │ │ +677 return _I_t_e_r_a_t_o_r(_r,0); │ │ │ │ │ +678 } │ │ │ │ │ +679 │ │ │ │ │ +_6_8_1 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ +682 { │ │ │ │ │ +683 return _I_t_e_r_a_t_o_r(_r,_n); │ │ │ │ │ +684 } │ │ │ │ │ +685 │ │ │ │ │ +_6_8_8 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ +689 { │ │ │ │ │ +690 return _I_t_e_r_a_t_o_r(_r,_n-1); │ │ │ │ │ +691 } │ │ │ │ │ +692 │ │ │ │ │ +_6_9_5 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ +696 { │ │ │ │ │ +697 return _I_t_e_r_a_t_o_r(_r,-1); │ │ │ │ │ +698 } │ │ │ │ │ +699 │ │ │ │ │ +_7_0_1 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ +702 │ │ │ │ │ +_7_0_4 typedef typename row_type::Iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +705 │ │ │ │ │ +_7_0_7 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _r_o_w___t_y_p_e_> _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +_7_0_8 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _r_o_w___t_y_p_e_> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +709 │ │ │ │ │ +710 │ │ │ │ │ +_7_1_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ +713 { │ │ │ │ │ +714 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,0); │ │ │ │ │ +715 } │ │ │ │ │ +716 │ │ │ │ │ +_7_1_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ +719 { │ │ │ │ │ +720 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,_n); │ │ │ │ │ +721 } │ │ │ │ │ +722 │ │ │ │ │ +_7_2_5 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ +726 { │ │ │ │ │ +727 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,_n-1); │ │ │ │ │ +728 } │ │ │ │ │ +729 │ │ │ │ │ +_7_3_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 │ │ │ │ │ +733 { │ │ │ │ │ +734 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,-1); │ │ │ │ │ +735 } │ │ │ │ │ +736 │ │ │ │ │ +_7_3_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; │ │ │ │ │ +739 │ │ │ │ │ +_7_4_1 typedef typename row_type::ConstIterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +742 │ │ │ │ │ +743 //===== constructors & resizers │ │ │ │ │ +744 │ │ │ │ │ +745 // we use a negative compressionBufferSize to indicate that the implicit │ │ │ │ │ +746 // mode parameters have not been set yet │ │ │ │ │ +747 │ │ │ │ │ +_7_4_9 _B_C_R_S_M_a_t_r_i_x () │ │ │ │ │ +750 : _b_u_i_l_d___m_o_d_e(_u_n_k_n_o_w_n), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ +751 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ +752 _a_v_g(0), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(-1.0) │ │ │ │ │ +753 {} │ │ │ │ │ +754 │ │ │ │ │ +_7_5_6 _B_C_R_S_M_a_t_r_i_x (_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m, _s_i_z_e___t_y_p_e _nnz, _B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ +757 : _b_u_i_l_d___m_o_d_e(bm), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ +758 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ +759 _a_v_g(0), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(-1.0) │ │ │ │ │ +760 { │ │ │ │ │ +761 _a_l_l_o_c_a_t_e(_n, _m, _nnz,true,false); │ │ │ │ │ +762 } │ │ │ │ │ +763 │ │ │ │ │ +_7_6_5 _B_C_R_S_M_a_t_r_i_x (_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m, _B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ +766 : _b_u_i_l_d___m_o_d_e(bm), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ +767 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ +768 _a_v_g(0), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(-1.0) │ │ │ │ │ +769 { │ │ │ │ │ +770 _a_l_l_o_c_a_t_e(_n, _m,0,true,false); │ │ │ │ │ +771 } │ │ │ │ │ +772 │ │ │ │ │ +774 │ │ │ │ │ +_7_8_4 _B_C_R_S_M_a_t_r_i_x (_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m, _s_i_z_e___t_y_p_e _avg, double │ │ │ │ │ +compressionBufferSize, _B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ +785 : _b_u_i_l_d___m_o_d_e(bm), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ +786 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ +787 _a_v_g(_avg), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(compressionBufferSize) │ │ │ │ │ +788 { │ │ │ │ │ +789 if (bm != _i_m_p_l_i_c_i_t) │ │ │ │ │ +790 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"Only call this constructor when using the │ │ │ │ │ +implicit build mode"); │ │ │ │ │ +791 // Prevent user from setting a negative compression buffer size: │ │ │ │ │ +792 // 1) It doesn't make sense │ │ │ │ │ +793 // 2) We use a negative value to indicate that the parameters │ │ │ │ │ +794 // have not been set yet │ │ │ │ │ +795 if (_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ < 0.0) │ │ │ │ │ +796 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot set a negative overflow fraction"); │ │ │ │ │ +797 _i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e(_n,_m); │ │ │ │ │ +798 } │ │ │ │ │ +799 │ │ │ │ │ +_8_0_5 _B_C_R_S_M_a_t_r_i_x (const _B_C_R_S_M_a_t_r_i_x& Mat) │ │ │ │ │ +806 : _b_u_i_l_d___m_o_d_e(Mat._b_u_i_l_d___m_o_d_e), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ +807 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ +808 _a_v_g(Mat._a_v_g), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(Mat._c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__) │ │ │ │ │ +809 { │ │ │ │ │ +810 if (!(Mat._r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d || Mat._r_e_a_d_y == _b_u_i_l_t)) │ │ │ │ │ +811 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copy-constructed │ │ │ │ │ +when source matrix is completely empty (size not set) or fully built)"); │ │ │ │ │ +812 │ │ │ │ │ +813 // deep copy in global array │ │ │ │ │ +814 _s_i_z_e___t_y_p_e _nnz = Mat._n_o_n_z_e_r_o_e_s(); │ │ │ │ │ +815 │ │ │ │ │ +816 _j__ = Mat._j__; // enable column index sharing, release array in case of row- │ │ │ │ │ +wise allocation │ │ │ │ │ +817 _a_l_l_o_c_a_t_e(Mat._n, Mat._m, _nnz, true, true); │ │ │ │ │ +818 │ │ │ │ │ +819 // build window structure │ │ │ │ │ +820 _c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e(Mat); │ │ │ │ │ +821 } │ │ │ │ │ +822 │ │ │ │ │ +_8_2_4 _~_B_C_R_S_M_a_t_r_i_x () │ │ │ │ │ +825 { │ │ │ │ │ +826 _d_e_a_l_l_o_c_a_t_e(); │ │ │ │ │ +827 } │ │ │ │ │ +828 │ │ │ │ │ +_8_3_3 void _s_e_t_B_u_i_l_d_M_o_d_e(_B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ +834 { │ │ │ │ │ +835 if (_r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ +836 { │ │ │ │ │ +837 _b_u_i_l_d___m_o_d_e = bm; │ │ │ │ │ +838 return; │ │ │ │ │ +839 } │ │ │ │ │ +840 if (_r_e_a_d_y == _b_u_i_l_d_i_n_g && (_b_u_i_l_d___m_o_d_e == _u_n_k_n_o_w_n || _b_u_i_l_d___m_o_d_e == _r_a_n_d_o_m || │ │ │ │ │ +_b_u_i_l_d___m_o_d_e == _r_o_w___w_i_s_e) && (bm == _r_o_w___w_i_s_e || bm == _r_a_n_d_o_m)) │ │ │ │ │ +841 _b_u_i_l_d___m_o_d_e = bm; │ │ │ │ │ +842 else │ │ │ │ │ +843 DUNE_THROW(InvalidStateException, "Matrix structure cannot be changed at │ │ │ │ │ +this stage anymore (ready == "<<_r_e_a_d_y<<")."); │ │ │ │ │ +844 } │ │ │ │ │ +845 │ │ │ │ │ +_8_6_1 void _s_e_t_S_i_z_e(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e nnz=0) │ │ │ │ │ +862 { │ │ │ │ │ +863 // deallocate already setup memory │ │ │ │ │ +864 _d_e_a_l_l_o_c_a_t_e(); │ │ │ │ │ +865 │ │ │ │ │ +866 if (_b_u_i_l_d___m_o_d_e == _i_m_p_l_i_c_i_t) │ │ │ │ │ +867 { │ │ │ │ │ +868 if (nnz>0) │ │ │ │ │ +869 DUNE_THROW(_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"number of non-zeroes may not be set in │ │ │ │ │ +implicit mode, use setImplicitBuildModeParameters() instead"); │ │ │ │ │ +870 │ │ │ │ │ +871 // implicit allocates differently │ │ │ │ │ +872 _i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e(rows,columns); │ │ │ │ │ +873 } │ │ │ │ │ +874 else │ │ │ │ │ +875 { │ │ │ │ │ +876 // allocate matrix memory │ │ │ │ │ +877 _a_l_l_o_c_a_t_e(rows, columns, nnz, true, false); │ │ │ │ │ +878 } │ │ │ │ │ +879 } │ │ │ │ │ +880 │ │ │ │ │ +_8_8_9 void _s_e_t_I_m_p_l_i_c_i_t_B_u_i_l_d_M_o_d_e_P_a_r_a_m_e_t_e_r_s(_s_i_z_e___t_y_p_e _avg, double │ │ │ │ │ +compressionBufferSize) │ │ │ │ │ +890 { │ │ │ │ │ +891 // Prevent user from setting a negative compression buffer size: │ │ │ │ │ +892 // 1) It doesn't make sense │ │ │ │ │ +893 // 2) We use a negative value to indicate that the parameters │ │ │ │ │ +894 // have not been set yet │ │ │ │ │ +895 if (compressionBufferSize < 0.0) │ │ │ │ │ +896 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot set a negative compressionBufferSize │ │ │ │ │ +value"); │ │ │ │ │ +897 │ │ │ │ │ +898 // make sure the parameters aren't changed after memory has been allocated │ │ │ │ │ +899 if (_r_e_a_d_y != _n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ +900 DUNE_THROW(InvalidStateException,"You cannot modify build mode parameters │ │ │ │ │ +at this stage anymore"); │ │ │ │ │ +901 _a_v_g = _avg; │ │ │ │ │ +902 _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ = compressionBufferSize; │ │ │ │ │ +903 } │ │ │ │ │ +904 │ │ │ │ │ +_9_1_1 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _B_C_R_S_M_a_t_r_i_x& Mat) │ │ │ │ │ +912 { │ │ │ │ │ +913 // return immediately when self-assignment │ │ │ │ │ +914 if (&Mat==this) return *this; │ │ │ │ │ +915 │ │ │ │ │ +916 if (!((_r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d || _r_e_a_d_y == _b_u_i_l_t) && (Mat._r_e_a_d_y == │ │ │ │ │ +_n_o_t_A_l_l_o_c_a_t_e_d || Mat._r_e_a_d_y == _b_u_i_l_t))) │ │ │ │ │ +917 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copied when both │ │ │ │ │ +target and source are empty or fully built)"); │ │ │ │ │ +918 │ │ │ │ │ +919 // make it simple: ALWAYS throw away memory for a and j_ │ │ │ │ │ +920 // and deallocate rows only if n != Mat.n │ │ │ │ │ +921 _d_e_a_l_l_o_c_a_t_e(_n!=Mat._n); │ │ │ │ │ +922 │ │ │ │ │ +923 // reallocate the rows if required │ │ │ │ │ +924 if (_n>0 && _n!=Mat._n) { │ │ │ │ │ +925 // free rows │ │ │ │ │ +926 for(_r_o_w___t_y_p_e *riter=_r+(_n-1), *rend=_r-1; riter!=rend; --riter) │ │ │ │ │ +927 std::allocator_traits::destroy(_r_o_w_A_l_l_o_c_a_t_o_r__, │ │ │ │ │ +riter); │ │ │ │ │ +928 _r_o_w_A_l_l_o_c_a_t_o_r__.deallocate(_r,_n); │ │ │ │ │ +929 } │ │ │ │ │ +930 │ │ │ │ │ +931 _n_n_z__ = Mat._n_o_n_z_e_r_o_e_s(); │ │ │ │ │ +932 │ │ │ │ │ +933 // allocate a, share j_ │ │ │ │ │ +934 _j__ = Mat._j__; │ │ │ │ │ +935 _a_l_l_o_c_a_t_e(Mat._n, Mat._m, _n_n_z__, _n!=Mat._n, true); │ │ │ │ │ +936 │ │ │ │ │ +937 // build window structure │ │ │ │ │ +938 _c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e(Mat); │ │ │ │ │ +939 return *this; │ │ │ │ │ +940 } │ │ │ │ │ +941 │ │ │ │ │ +_9_4_3 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +944 { │ │ │ │ │ +945 │ │ │ │ │ +946 if (!(_r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d || _r_e_a_d_y == _b_u_i_l_t)) │ │ │ │ │ +947 DUNE_THROW(InvalidStateException,"Scalar assignment only works on fully │ │ │ │ │ +built BCRSMatrix)"); │ │ │ │ │ +948 │ │ │ │ │ +949 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) _r[i] = k; │ │ │ │ │ +950 return *this; │ │ │ │ │ +951 } │ │ │ │ │ +952 │ │ │ │ │ +953 //===== row-wise creation interface │ │ │ │ │ +954 │ │ │ │ │ +_9_5_6 class _C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +957 { │ │ │ │ │ +958 public: │ │ │ │ │ +_9_6_0 _C_r_e_a_t_e_I_t_e_r_a_t_o_r (_B_C_R_S_M_a_t_r_i_x& _Mat, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ +961 : Mat(_Mat), i(_i), nnz(0), current_row(nullptr, Mat._j__._g_e_t(), 0) │ │ │ │ │ +962 { │ │ │ │ │ +963 if (Mat._b_u_i_l_d___m_o_d_e == _u_n_k_n_o_w_n && Mat._r_e_a_d_y == _b_u_i_l_d_i_n_g) │ │ │ │ │ +964 { │ │ │ │ │ +965 Mat._b_u_i_l_d___m_o_d_e = _r_o_w___w_i_s_e; │ │ │ │ │ +966 } │ │ │ │ │ +967 if (i==0 && Mat._r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ +968 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"creation only allowed for uninitialized │ │ │ │ │ +matrix"); │ │ │ │ │ +969 if(Mat._b_u_i_l_d___m_o_d_e!=_r_o_w___w_i_s_e) │ │ │ │ │ +970 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"creation only allowed if row wise allocation │ │ │ │ │ +was requested in the constructor"); │ │ │ │ │ +971 if(i==0 && _Mat._N()==0) │ │ │ │ │ +972 // empty Matrix is always built. │ │ │ │ │ +973 Mat._r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ +974 } │ │ │ │ │ +975 │ │ │ │ │ +_9_7_7 _C_r_e_a_t_e_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +978 { │ │ │ │ │ +979 // this should only be called if matrix is in creation │ │ │ │ │ +980 if (Mat._r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ +981 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix already built up"); │ │ │ │ │ +982 │ │ │ │ │ +983 // row i is defined through the pattern │ │ │ │ │ +984 // get memory for the row and initialize the j_ array │ │ │ │ │ +985 // this depends on the allocation mode │ │ │ │ │ +986 │ │ │ │ │ +987 // compute size of the row │ │ │ │ │ +988 _s_i_z_e___t_y_p_e s = pattern.size(); │ │ │ │ │ +989 │ │ │ │ │ +990 if(s>0) { │ │ │ │ │ +991 // update number of nonzeroes including this row │ │ │ │ │ +992 nnz += s; │ │ │ │ │ +993 │ │ │ │ │ +994 // alloc memory / set window │ │ │ │ │ +995 if (Mat._n_n_z__ > 0) │ │ │ │ │ +996 { │ │ │ │ │ +997 // memory is allocated in one long array │ │ │ │ │ +998 │ │ │ │ │ +999 // check if that memory is sufficient │ │ │ │ │ +1000 if (nnz > Mat._n_n_z__) │ │ │ │ │ +1001 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"allocated nnz too small"); │ │ │ │ │ +1002 │ │ │ │ │ +1003 // set row i │ │ │ │ │ +1004 Mat._r[i].set(s,nullptr,current_row.getindexptr()); │ │ │ │ │ +1005 current_row.setindexptr(current_row.getindexptr()+s); │ │ │ │ │ +1006 }else{ │ │ │ │ │ +1007 // memory is allocated individually per row │ │ │ │ │ +1008 // allocate and set row i │ │ │ │ │ +1009 B* b = Mat._a_l_l_o_c_a_t_o_r__.allocate(s); │ │ │ │ │ +1010 // use placement new to call constructor that allocates │ │ │ │ │ +1011 // additional memory. │ │ │ │ │ +1012 new (b) B[s]; │ │ │ │ │ +1013 _s_i_z_e___t_y_p_e* j = Mat._s_i_z_e_A_l_l_o_c_a_t_o_r__.allocate(s); │ │ │ │ │ +1014 Mat._r[i].set(s,b,j); │ │ │ │ │ +1015 } │ │ │ │ │ +1016 }else │ │ │ │ │ +1017 // setup empty row │ │ │ │ │ +1018 Mat._r[i].set(0,nullptr,nullptr); │ │ │ │ │ +1019 │ │ │ │ │ +1020 // initialize the j array for row i from pattern │ │ │ │ │ +1021 std::copy(pattern.cbegin(), pattern.cend(), Mat._r[i].getindexptr()); │ │ │ │ │ +1022 │ │ │ │ │ +1023 // now go to next row │ │ │ │ │ +1024 i++; │ │ │ │ │ +1025 pattern.clear(); │ │ │ │ │ +1026 │ │ │ │ │ +1027 // check if this was last row │ │ │ │ │ +1028 if (i==Mat._n) │ │ │ │ │ +1029 { │ │ │ │ │ +1030 Mat._r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ +1031 if(Mat._n_n_z__ > 0) │ │ │ │ │ +1032 { │ │ │ │ │ +1033 // Set nnz to the exact number of nonzero blocks inserted │ │ │ │ │ +1034 // as some methods rely on it │ │ │ │ │ +1035 Mat._n_n_z__ = nnz; │ │ │ │ │ +1036 // allocate data array │ │ │ │ │ +1037 Mat._a_l_l_o_c_a_t_e_D_a_t_a(); │ │ │ │ │ +1038 Mat._s_e_t_D_a_t_a_P_o_i_n_t_e_r_s(); │ │ │ │ │ +1039 } │ │ │ │ │ +1040 } │ │ │ │ │ +1041 // done │ │ │ │ │ +1042 return *this; │ │ │ │ │ +1043 } │ │ │ │ │ +1044 │ │ │ │ │ +_1_0_4_6 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 │ │ │ │ │ +1047 { │ │ │ │ │ +1048 return (i!=it.i) || (&Mat!=&it.Mat); │ │ │ │ │ +1049 } │ │ │ │ │ +1050 │ │ │ │ │ +_1_0_5_2 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 │ │ │ │ │ +1053 { │ │ │ │ │ +1054 return (i==it.i) && (&Mat==&it.Mat); │ │ │ │ │ +1055 } │ │ │ │ │ +1056 │ │ │ │ │ +_1_0_5_8 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ +1059 { │ │ │ │ │ +1060 return i; │ │ │ │ │ +1061 } │ │ │ │ │ +1062 │ │ │ │ │ +_1_0_6_4 void _i_n_s_e_r_t (_s_i_z_e___t_y_p_e j) │ │ │ │ │ +1065 { │ │ │ │ │ +1066 pattern.insert(j); │ │ │ │ │ +1067 } │ │ │ │ │ +1068 │ │ │ │ │ +_1_0_7_0 bool _c_o_n_t_a_i_n_s (_s_i_z_e___t_y_p_e j) │ │ │ │ │ +1071 { │ │ │ │ │ +1072 return pattern.find(j) != pattern.end(); │ │ │ │ │ +1073 } │ │ │ │ │ +_1_0_7_9 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ +1080 { │ │ │ │ │ +1081 return pattern.size(); │ │ │ │ │ +1082 } │ │ │ │ │ +1083 │ │ │ │ │ +1084 private: │ │ │ │ │ +1085 _B_C_R_S_M_a_t_r_i_x& Mat; // the matrix we are defining │ │ │ │ │ +1086 _s_i_z_e___t_y_p_e i; // current row to be defined │ │ │ │ │ +1087 _s_i_z_e___t_y_p_e nnz; // count total number of nonzeros │ │ │ │ │ +1088 typedef std::set > PatternType; │ │ │ │ │ +1089 PatternType pattern; // used to compile entries in a row │ │ │ │ │ +1090 _r_o_w___t_y_p_e current_row; // row pointing to the current row to setup │ │ │ │ │ +1091 }; │ │ │ │ │ +1092 │ │ │ │ │ +_1_0_9_4 friend class _C_r_e_a_t_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +1095 │ │ │ │ │ +_1_0_9_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 () │ │ │ │ │ +1098 { │ │ │ │ │ +1099 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ +1100 } │ │ │ │ │ +1101 │ │ │ │ │ +_1_1_0_3 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _c_r_e_a_t_e_e_n_d () │ │ │ │ │ +1104 { │ │ │ │ │ +1105 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this,_n); │ │ │ │ │ +1106 } │ │ │ │ │ +1107 │ │ │ │ │ +1108 │ │ │ │ │ +1109 //===== random creation interface │ │ │ │ │ +1110 │ │ │ │ │ +_1_1_1_7 void _s_e_t_r_o_w_s_i_z_e (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s) │ │ │ │ │ +1118 { │ │ │ │ │ +1119 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ +1120 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ +1121 if (_r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ +1122 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix row sizes already built up"); │ │ │ │ │ +1123 │ │ │ │ │ +1124 _r[i].setsize(s); │ │ │ │ │ +1125 } │ │ │ │ │ +1126 │ │ │ │ │ +_1_1_2_8 _s_i_z_e___t_y_p_e _g_e_t_r_o_w_s_i_z_e (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +1129 { │ │ │ │ │ +1130#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1131 if (_r==0) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row not initialized yet"); │ │ │ │ │ +1132 if (i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1133#endif │ │ │ │ │ +1134 return _r[i].getsize(); │ │ │ │ │ +1135 } │ │ │ │ │ +1136 │ │ │ │ │ +_1_1_3_8 void _i_n_c_r_e_m_e_n_t_r_o_w_s_i_z_e (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s = 1) │ │ │ │ │ +1139 { │ │ │ │ │ +1140 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ +1141 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ +1142 if (_r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ +1143 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix row sizes already built up"); │ │ │ │ │ +1144 │ │ │ │ │ +1145 _r[i].setsize(_r[i].getsize()+s); │ │ │ │ │ +1146 } │ │ │ │ │ +1147 │ │ │ │ │ +_1_1_4_9 void _e_n_d_r_o_w_s_i_z_e_s () │ │ │ │ │ +1150 { │ │ │ │ │ +1151 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ +1152 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ +1153 if (_r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ +1154 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix row sizes already built up"); │ │ │ │ │ +1155 │ │ │ │ │ +1156 // compute total size, check positivity │ │ │ │ │ +1157 _s_i_z_e___t_y_p_e total=0; │ │ │ │ │ +1158 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ +1159 { │ │ │ │ │ +1160 total += _r[i].getsize(); │ │ │ │ │ +1161 } │ │ │ │ │ +1162 │ │ │ │ │ +1163 if(_n_n_z__ == 0) │ │ │ │ │ +1164 // allocate/check memory │ │ │ │ │ +1165 _a_l_l_o_c_a_t_e(_n,_m,total,false,false); │ │ │ │ │ +1166 else if(_n_n_z__ < total) │ │ │ │ │ +1167 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"Specified number of nonzeros ("<<_n_n_z__<<") not │ │ │ │ │ +" │ │ │ │ │ +1168 <<"sufficient for calculated nonzeros ("<= _m) │ │ │ │ │ +1203 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"column index exceeds matrix size"); │ │ │ │ │ +1204 │ │ │ │ │ +1205 // get row range │ │ │ │ │ +1206 _s_i_z_e___t_y_p_e* const first = _r[row].getindexptr(); │ │ │ │ │ +1207 _s_i_z_e___t_y_p_e* const last = first + _r[row].getsize(); │ │ │ │ │ +1208 │ │ │ │ │ +1209 // find correct insertion position for new column index │ │ │ │ │ +1210 _s_i_z_e___t_y_p_e* pos = std::lower_bound(first,last,_c_o_l); │ │ │ │ │ +1211 │ │ │ │ │ +1212 // check if index is already in row │ │ │ │ │ +1213 if (pos!=last && *pos == _c_o_l) return; │ │ │ │ │ +1214 │ │ │ │ │ +1215 // find end of already inserted column indices │ │ │ │ │ +1216 _s_i_z_e___t_y_p_e* _e_n_d = std::lower_bound(pos,last,_m); │ │ │ │ │ +1217 if (_e_n_d==last) │ │ │ │ │ +1218 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row is too small"); │ │ │ │ │ +1219 │ │ │ │ │ +1220 // insert new column index at correct position │ │ │ │ │ +1221 std::copy_backward(pos,_e_n_d,_e_n_d+1); │ │ │ │ │ +1222 *pos = _c_o_l; │ │ │ │ │ +1223 } │ │ │ │ │ +1224 │ │ │ │ │ +1226 │ │ │ │ │ +1233 template │ │ │ │ │ +_1_2_3_4 void _s_e_t_I_n_d_i_c_e_s(_s_i_z_e___t_y_p_e row, It _b_e_g_i_n, It _e_n_d) │ │ │ │ │ +1235 { │ │ │ │ │ +1236 _s_i_z_e___t_y_p_e row_size = _r[row].size(); │ │ │ │ │ +1237 _s_i_z_e___t_y_p_e* col_begin = _r[row].getindexptr(); │ │ │ │ │ +1238 _s_i_z_e___t_y_p_e* col_end; │ │ │ │ │ +1239 // consistency check between allocated row size and number of passed │ │ │ │ │ +column indices │ │ │ │ │ +1240 if ((col_end = std::copy(_b_e_g_i_n,_e_n_d,_r[row].getindexptr())) != col_begin + │ │ │ │ │ +row_size) │ │ │ │ │ +1241 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"Given size of row " << row │ │ │ │ │ +1242 << " (" << row_size │ │ │ │ │ +1243 << ") does not match number of passed entries (" << (col_end - col_begin) │ │ │ │ │ +<< ")"); │ │ │ │ │ +1244 std::sort(col_begin,col_end); │ │ │ │ │ +1245 } │ │ │ │ │ +1246 │ │ │ │ │ +_1_2_4_8 void _e_n_d_i_n_d_i_c_e_s () │ │ │ │ │ +1249 { │ │ │ │ │ +1250 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ +1251 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ +1252 if (_r_e_a_d_y==_b_u_i_l_t) │ │ │ │ │ +1253 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix already built up"); │ │ │ │ │ +1254 if (_r_e_a_d_y==_b_u_i_l_d_i_n_g) │ │ │ │ │ +1255 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row sizes are not built up yet"); │ │ │ │ │ +1256 if (_r_e_a_d_y==_n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ +1257 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix size not set and no memory allocated │ │ │ │ │ +yet"); │ │ │ │ │ +1258 │ │ │ │ │ +1259 // check if there are undefined indices │ │ │ │ │ +1260 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1261 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1262 { │ │ │ │ │ +1263 _C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1264 for (_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) { │ │ │ │ │ +1265 if (j.index() >= _m) { │ │ │ │ │ +1266 dwarn << "WARNING: size of row "<< i.index()<<" is "<= _n) │ │ │ │ │ +1309 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row index exceeds matrix size"); │ │ │ │ │ +1310 if (_c_o_l >= _m) │ │ │ │ │ +1311 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"column index exceeds matrix size"); │ │ │ │ │ +1312#endif │ │ │ │ │ +1313 │ │ │ │ │ +1314 _s_i_z_e___t_y_p_e* _b_e_g_i_n = _r[row].getindexptr(); │ │ │ │ │ +1315 _s_i_z_e___t_y_p_e* _e_n_d = _b_e_g_i_n + _r[row].getsize(); │ │ │ │ │ +1316 │ │ │ │ │ +1317 _s_i_z_e___t_y_p_e* pos = std::find(_b_e_g_i_n, _e_n_d, _c_o_l); │ │ │ │ │ +1318 │ │ │ │ │ +1319 //treat the case that there was a match in the array │ │ │ │ │ +1320 if (pos != _e_n_d) │ │ │ │ │ +1321 if (*pos == _c_o_l) │ │ │ │ │ +1322 { │ │ │ │ │ +1323 std::ptrdiff_t offset = pos - _r[row].getindexptr(); │ │ │ │ │ +1324 B* aptr = _r[row].getptr() + offset; │ │ │ │ │ +1325 │ │ │ │ │ +1326 return *aptr; │ │ │ │ │ +1327 } │ │ │ │ │ +1328 │ │ │ │ │ +1329 //determine whether overflow has to be taken into account or not │ │ │ │ │ +1330 if (_r[row].getsize() == _a_v_g) │ │ │ │ │ +1331 return _o_v_e_r_f_l_o_w[std::make_pair(row,_c_o_l)]; │ │ │ │ │ +1332 else │ │ │ │ │ +1333 { │ │ │ │ │ +1334 //modify index array │ │ │ │ │ +1335 *_e_n_d = _c_o_l; │ │ │ │ │ +1336 │ │ │ │ │ +1337 //do simultaneous operations on data array a │ │ │ │ │ +1338 std::ptrdiff_t offset = _e_n_d - _r[row].getindexptr(); │ │ │ │ │ +1339 B* apos = _r[row].getptr() + offset; │ │ │ │ │ +1340 │ │ │ │ │ +1341 //increase rowsize │ │ │ │ │ +1342 _r[row].setsize(_r[row].getsize()+1); │ │ │ │ │ +1343 │ │ │ │ │ +1344 //return reference to the newly created entry │ │ │ │ │ +1345 return *apos; │ │ │ │ │ +1346 } │ │ │ │ │ +1347 } │ │ │ │ │ +1348 │ │ │ │ │ +1350 │ │ │ │ │ +_1_3_6_0 _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s _c_o_m_p_r_e_s_s() │ │ │ │ │ +1361 { │ │ │ │ │ +1362 if (_b_u_i_l_d___m_o_d_e!=_i_m_p_l_i_c_i_t) │ │ │ │ │ +1363 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires implicit build mode"); │ │ │ │ │ +1364 if (_r_e_a_d_y==_b_u_i_l_t) │ │ │ │ │ +1365 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix already built up, no more need for │ │ │ │ │ +compression"); │ │ │ │ │ +1366 if (_r_e_a_d_y==_n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ +1367 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix size not set and no memory allocated │ │ │ │ │ +yet"); │ │ │ │ │ +1368 if (_r_e_a_d_y!=_b_u_i_l_d_i_n_g) │ │ │ │ │ +1369 DUNE_THROW(InvalidStateException,"You may only call compress() at the end │ │ │ │ │ +of the 'building' stage"); │ │ │ │ │ +1370 │ │ │ │ │ +1371 //calculate statistics │ │ │ │ │ +1372 _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s stats; │ │ │ │ │ +1373 stats._o_v_e_r_f_l_o_w___t_o_t_a_l = _o_v_e_r_f_l_o_w.size(); │ │ │ │ │ +1374 stats._m_a_x_i_m_u_m = 0; │ │ │ │ │ +1375 │ │ │ │ │ +1376 //get insertion iterators pointing to one before start (for later use of │ │ │ │ │ +++it) │ │ │ │ │ +1377 _s_i_z_e___t_y_p_e* jiit = _j__.get(); │ │ │ │ │ +1378 B* aiit = _a; │ │ │ │ │ +1379 │ │ │ │ │ +1380 //get iterator to the smallest overflow element │ │ │ │ │ +1381 typename OverflowType::iterator oit = _o_v_e_r_f_l_o_w.begin(); │ │ │ │ │ +1382 │ │ │ │ │ +1383 //store a copy of index pointers on which to perform sorting │ │ │ │ │ +1384 std::vector perm; │ │ │ │ │ +1385 │ │ │ │ │ +1386 //iterate over all rows and copy elements into their position in the │ │ │ │ │ +compressed array │ │ │ │ │ +1387 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ +1388 { │ │ │ │ │ +1389 //get old pointers into a and j and size without overflow changes │ │ │ │ │ +1390 _s_i_z_e___t_y_p_e* _b_e_g_i_n = _r[i].getindexptr(); │ │ │ │ │ +1391 //B* apos = r[i].getptr(); │ │ │ │ │ +1392 _s_i_z_e___t_y_p_e size = _r[i].getsize(); │ │ │ │ │ +1393 │ │ │ │ │ +1394 perm.resize(size); │ │ │ │ │ +1395 │ │ │ │ │ +1396 typename std::vector::iterator it = perm.begin(); │ │ │ │ │ +1397 for (_s_i_z_e___t_y_p_e* iit = _b_e_g_i_n; iit < _b_e_g_i_n + size; ++iit, ++it) │ │ │ │ │ +1398 *it = iit; │ │ │ │ │ +1399 │ │ │ │ │ +1400 //sort permutation array │ │ │ │ │ +1401 std::sort(perm.begin(),perm.end(),_P_o_i_n_t_e_r_C_o_m_p_a_r_e_<_s_i_z_e___t_y_p_e_>()); │ │ │ │ │ +1402 │ │ │ │ │ +1403 //change row window pointer to their new positions │ │ │ │ │ +1404 _r[i].setindexptr(jiit); │ │ │ │ │ +1405 _r[i].setptr(aiit); │ │ │ │ │ +1406 │ │ │ │ │ +1407 for (it = perm.begin(); it != perm.end(); ++it) │ │ │ │ │ +1408 { │ │ │ │ │ +1409 //check whether there are elements in the overflow area which take │ │ │ │ │ +precedence │ │ │ │ │ +1410 while ((oit!=_o_v_e_r_f_l_o_w.end()) && (oit->first < std::make_pair(i,**it))) │ │ │ │ │ +1411 { │ │ │ │ │ +1412 //check whether there is enough memory to write to │ │ │ │ │ +1413 if (jiit > _b_e_g_i_n) │ │ │ │ │ +1414 DUNE_THROW(_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, │ │ │ │ │ +1415 "Allocated memory for BCRSMatrix exhausted during compress()!" │ │ │ │ │ +1416 "Please increase either the average number of entries per row or the │ │ │ │ │ +compressionBufferSize value." │ │ │ │ │ +1417 ); │ │ │ │ │ +1418 //copy an element from the overflow area to the insertion position in a │ │ │ │ │ +and j │ │ │ │ │ +1419 *jiit = oit->first.second; │ │ │ │ │ +1420 ++jiit; │ │ │ │ │ +1421 *aiit = oit->second; │ │ │ │ │ +1422 ++aiit; │ │ │ │ │ +1423 ++oit; │ │ │ │ │ +1424 _r[i].setsize(_r[i].getsize()+1); │ │ │ │ │ +1425 } │ │ │ │ │ +1426 │ │ │ │ │ +1427 //check whether there is enough memory to write to │ │ │ │ │ +1428 if (jiit > _b_e_g_i_n) │ │ │ │ │ +1429 DUNE_THROW(_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, │ │ │ │ │ +1430 "Allocated memory for BCRSMatrix exhausted during compress()!" │ │ │ │ │ +1431 "Please increase either the average number of entries per row or the │ │ │ │ │ +compressionBufferSize value." │ │ │ │ │ +1432 ); │ │ │ │ │ +1433 │ │ │ │ │ +1434 //copy element from array │ │ │ │ │ +1435 *jiit = **it; │ │ │ │ │ +1436 ++jiit; │ │ │ │ │ +1437 B* apos = *it - _j__.get() + _a; │ │ │ │ │ +1438 *aiit = *apos; │ │ │ │ │ +1439 ++aiit; │ │ │ │ │ +1440 } │ │ │ │ │ +1441 │ │ │ │ │ +1442 //copy remaining elements from the overflow area │ │ │ │ │ +1443 while ((oit!=_o_v_e_r_f_l_o_w.end()) && (oit->first.first == i)) │ │ │ │ │ +1444 { │ │ │ │ │ +1445 //check whether there is enough memory to write to │ │ │ │ │ +1446 if (jiit > _b_e_g_i_n) │ │ │ │ │ +1447 DUNE_THROW(_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, │ │ │ │ │ +1448 "Allocated memory for BCRSMatrix exhausted during compress()!" │ │ │ │ │ +1449 "Please increase either the average number of entries per row or the │ │ │ │ │ +compressionBufferSize value." │ │ │ │ │ +1450 ); │ │ │ │ │ +1451 │ │ │ │ │ +1452 //copy and element from the overflow area to the insertion position in a │ │ │ │ │ +and j │ │ │ │ │ +1453 *jiit = oit->first.second; │ │ │ │ │ +1454 ++jiit; │ │ │ │ │ +1455 *aiit = oit->second; │ │ │ │ │ +1456 ++aiit; │ │ │ │ │ +1457 ++oit; │ │ │ │ │ +1458 _r[i].setsize(_r[i].getsize()+1); │ │ │ │ │ +1459 } │ │ │ │ │ +1460 │ │ │ │ │ +1461 // update maximum row size │ │ │ │ │ +1462 if (_r[i].getsize()>stats._m_a_x_i_m_u_m) │ │ │ │ │ +1463 stats._m_a_x_i_m_u_m = _r[i].getsize(); │ │ │ │ │ +1464 } │ │ │ │ │ +1465 │ │ │ │ │ +1466 // overflow area may be cleared │ │ │ │ │ +1467 _o_v_e_r_f_l_o_w.clear(); │ │ │ │ │ +1468 │ │ │ │ │ +1469 //determine average number of entries and memory usage │ │ │ │ │ +1470 std::ptrdiff_t diff = (_r[_n-1].getindexptr() + _r[_n-1].getsize() - _j__.get │ │ │ │ │ +()); │ │ │ │ │ +1471 _n_n_z__ = diff; │ │ │ │ │ +1472 stats._a_v_g = (double) (_n_n_z__) / (double) _n; │ │ │ │ │ +1473 stats._m_e_m___r_a_t_i_o = (double) (_n_n_z__) / (double) _a_l_l_o_c_a_t_i_o_n_S_i_z_e__; │ │ │ │ │ +1474 │ │ │ │ │ +1475 //matrix is now built │ │ │ │ │ +1476 _r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ +1477 │ │ │ │ │ +1478 return stats; │ │ │ │ │ +1479 } │ │ │ │ │ +1480 │ │ │ │ │ +1481 //===== vector space arithmetic │ │ │ │ │ +1482 │ │ │ │ │ +_1_4_8_4 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +1485 { │ │ │ │ │ +1486#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1487 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1488 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1489#endif │ │ │ │ │ +1490 │ │ │ │ │ +1491 if (_n_n_z__ > 0) │ │ │ │ │ +1492 { │ │ │ │ │ +1493 // process 1D array │ │ │ │ │ +1494 for (_s_i_z_e___t_y_p_e i=0; i<_n_n_z__; i++) │ │ │ │ │ +1495 _a[i] *= k; │ │ │ │ │ +1496 } │ │ │ │ │ +1497 else │ │ │ │ │ +1498 { │ │ │ │ │ +1499 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1500 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1501 { │ │ │ │ │ +1502 _C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1503 for (_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1504 (*j) *= k; │ │ │ │ │ +1505 } │ │ │ │ │ +1506 } │ │ │ │ │ +1507 │ │ │ │ │ +1508 return *this; │ │ │ │ │ +1509 } │ │ │ │ │ +1510 │ │ │ │ │ +_1_5_1_2 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_/_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +1513 { │ │ │ │ │ +1514#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1515 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1516 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1517#endif │ │ │ │ │ +1518 │ │ │ │ │ +1519 if (_n_n_z__ > 0) │ │ │ │ │ +1520 { │ │ │ │ │ +1521 // process 1D array │ │ │ │ │ +1522 for (_s_i_z_e___t_y_p_e i=0; i<_n_n_z__; i++) │ │ │ │ │ +1523 _a[i] /= k; │ │ │ │ │ +1524 } │ │ │ │ │ +1525 else │ │ │ │ │ +1526 { │ │ │ │ │ +1527 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1528 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1529 { │ │ │ │ │ +1530 _C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1531 for (_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1532 (*j) /= k; │ │ │ │ │ +1533 } │ │ │ │ │ +1534 } │ │ │ │ │ +1535 │ │ │ │ │ +1536 return *this; │ │ │ │ │ +1537 } │ │ │ │ │ +1538 │ │ │ │ │ +1539 │ │ │ │ │ +_1_5_4_5 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _B_C_R_S_M_a_t_r_i_x& b) │ │ │ │ │ +1546 { │ │ │ │ │ +1547#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1548 if (_r_e_a_d_y != _b_u_i_l_t || b._r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1549 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1550 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ +1551 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ +1552#endif │ │ │ │ │ +1553 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1554 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r j=b._b_e_g_i_n(); │ │ │ │ │ +1555 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i, ++j) { │ │ │ │ │ +1556 i->operator+=(*j); │ │ │ │ │ +1557 } │ │ │ │ │ +1558 │ │ │ │ │ +1559 return *this; │ │ │ │ │ +1560 } │ │ │ │ │ +1561 │ │ │ │ │ +_1_5_6_7 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _B_C_R_S_M_a_t_r_i_x& b) │ │ │ │ │ +1568 { │ │ │ │ │ +1569#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1570 if (_r_e_a_d_y != _b_u_i_l_t || b._r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1571 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1572 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ +1573 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ +1574#endif │ │ │ │ │ +1575 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1576 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r j=b._b_e_g_i_n(); │ │ │ │ │ +1577 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i, ++j) { │ │ │ │ │ +1578 i->operator-=(*j); │ │ │ │ │ +1579 } │ │ │ │ │ +1580 │ │ │ │ │ +1581 return *this; │ │ │ │ │ +1582 } │ │ │ │ │ +1583 │ │ │ │ │ +_1_5_9_2 _B_C_R_S_M_a_t_r_i_x& _a_x_p_y(_f_i_e_l_d___t_y_p_e alpha, const _B_C_R_S_M_a_t_r_i_x& b) │ │ │ │ │ +1593 { │ │ │ │ │ +1594#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1595 if (_r_e_a_d_y != _b_u_i_l_t || b._r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1596 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1597 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ +1598 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ +1599#endif │ │ │ │ │ +1600 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1601 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r j=b._b_e_g_i_n(); │ │ │ │ │ +1602 for(_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i, ++j) │ │ │ │ │ +1603 i->axpy(alpha, *j); │ │ │ │ │ +1604 │ │ │ │ │ +1605 return *this; │ │ │ │ │ +1606 } │ │ │ │ │ +1607 │ │ │ │ │ +1608 //===== linear maps │ │ │ │ │ +1609 │ │ │ │ │ +1611 template │ │ │ │ │ +_1_6_1_2 void _m_v (const X& x, Y& y) const │ │ │ │ │ +1613 { │ │ │ │ │ +1614#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1615 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1616 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1617 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r, │ │ │ │ │ +1618 "Size mismatch: M: " << _N() << "x" << _M() << " x: " << x.N()); │ │ │ │ │ +1619 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r, │ │ │ │ │ +1620 "Size mismatch: M: " << _N() << "x" << _M() << " y: " << y.N()); │ │ │ │ │ +1621#endif │ │ │ │ │ +1622 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1623 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1624 { │ │ │ │ │ +1625 y[i.index()]=0; │ │ │ │ │ +1626 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1627 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1628 { │ │ │ │ │ +1629 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ +1630 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ +1631 Impl::asMatrix(*j).umv(xj, yi); │ │ │ │ │ +1632 } │ │ │ │ │ +1633 } │ │ │ │ │ +1634 } │ │ │ │ │ +1635 │ │ │ │ │ +1637 template │ │ │ │ │ +_1_6_3_8 void _u_m_v (const X& x, Y& y) const │ │ │ │ │ +1639 { │ │ │ │ │ +1640#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1641 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1642 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1643 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1644 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1645#endif │ │ │ │ │ +1646 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1647 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1648 { │ │ │ │ │ +1649 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1650 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1651 { │ │ │ │ │ +1652 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ +1653 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ +1654 Impl::asMatrix(*j).umv(xj,yi); │ │ │ │ │ +1655 } │ │ │ │ │ +1656 } │ │ │ │ │ +1657 } │ │ │ │ │ +1658 │ │ │ │ │ +1660 template │ │ │ │ │ +_1_6_6_1 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ +1662 { │ │ │ │ │ +1663#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1664 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1665 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1666 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1667 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1668#endif │ │ │ │ │ +1669 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1670 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1671 { │ │ │ │ │ +1672 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1673 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1674 { │ │ │ │ │ +1675 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ +1676 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ +1677 Impl::asMatrix(*j).mmv(xj,yi); │ │ │ │ │ +1678 } │ │ │ │ │ +1679 } │ │ │ │ │ +1680 } │ │ │ │ │ +1681 │ │ │ │ │ +1683 template │ │ │ │ │ +_1_6_8_4 void _u_s_m_v (F&& alpha, const X& x, Y& y) const │ │ │ │ │ +1685 { │ │ │ │ │ +1686#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1687 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1688 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1689 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1690 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1691#endif │ │ │ │ │ +1692 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1693 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1694 { │ │ │ │ │ +1695 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1696 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1697 { │ │ │ │ │ +1698 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ +1699 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ +1700 Impl::asMatrix(*j).usmv(alpha,xj,yi); │ │ │ │ │ +1701 } │ │ │ │ │ +1702 } │ │ │ │ │ +1703 } │ │ │ │ │ +1704 │ │ │ │ │ +1706 template │ │ │ │ │ +_1_7_0_7 void _m_t_v (const X& x, Y& y) const │ │ │ │ │ +1708 { │ │ │ │ │ +1709#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1710 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1711 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1712 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1713 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1714#endif │ │ │ │ │ +1715 for(_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_1_7_2_2 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ +1723 { │ │ │ │ │ +1724#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1725 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1726 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1727 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1728 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1729#endif │ │ │ │ │ +1730 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1731 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1732 { │ │ │ │ │ +1733 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1734 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1735 { │ │ │ │ │ +1736 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ +1737 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ +1738 Impl::asMatrix(*j).umtv(xi,yj); │ │ │ │ │ +1739 } │ │ │ │ │ +1740 } │ │ │ │ │ +1741 } │ │ │ │ │ +1742 │ │ │ │ │ +1744 template │ │ │ │ │ +_1_7_4_5 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ +1746 { │ │ │ │ │ +1747#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1748 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1749 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1750#endif │ │ │ │ │ +1751 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1752 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1753 { │ │ │ │ │ +1754 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1755 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1756 { │ │ │ │ │ +1757 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ +1758 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ +1759 Impl::asMatrix(*j).mmtv(xi,yj); │ │ │ │ │ +1760 } │ │ │ │ │ +1761 } │ │ │ │ │ +1762 } │ │ │ │ │ +1763 │ │ │ │ │ +1765 template │ │ │ │ │ +_1_7_6_6 void _u_s_m_t_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ +1767 { │ │ │ │ │ +1768#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1769 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1770 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1771 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1772 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1773#endif │ │ │ │ │ +1774 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1775 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1776 { │ │ │ │ │ +1777 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1778 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1779 { │ │ │ │ │ +1780 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ +1781 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ +1782 Impl::asMatrix(*j).usmtv(alpha,xi,yj); │ │ │ │ │ +1783 } │ │ │ │ │ +1784 } │ │ │ │ │ +1785 } │ │ │ │ │ +1786 │ │ │ │ │ +1788 template │ │ │ │ │ +_1_7_8_9 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ +1790 { │ │ │ │ │ +1791#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1792 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1793 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1794 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1795 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1796#endif │ │ │ │ │ +1797 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1798 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1799 { │ │ │ │ │ +1800 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1801 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1802 { │ │ │ │ │ +1803 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ +1804 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ +1805 Impl::asMatrix(*j).umhv(xi,yj); │ │ │ │ │ +1806 } │ │ │ │ │ +1807 } │ │ │ │ │ +1808 } │ │ │ │ │ +1809 │ │ │ │ │ +1811 template │ │ │ │ │ +_1_8_1_2 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ +1813 { │ │ │ │ │ +1814#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1815 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1816 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1817 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1818 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1819#endif │ │ │ │ │ +1820 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1821 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1822 { │ │ │ │ │ +1823 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1824 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1825 { │ │ │ │ │ +1826 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ +1827 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ +1828 Impl::asMatrix(*j).mmhv(xi,yj); │ │ │ │ │ +1829 } │ │ │ │ │ +1830 } │ │ │ │ │ +1831 } │ │ │ │ │ +1832 │ │ │ │ │ +1834 template │ │ │ │ │ +_1_8_3_5 void _u_s_m_h_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ +1836 { │ │ │ │ │ +1837#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1838 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1839 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1840 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1841 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ +1842#endif │ │ │ │ │ +1843 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ +1844 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ +1845 { │ │ │ │ │ +1846 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ +1847 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ +1848 { │ │ │ │ │ +1849 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ +1850 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ +1851 Impl::asMatrix(*j).usmhv(alpha,xi,yj); │ │ │ │ │ +1852 } │ │ │ │ │ +1853 } │ │ │ │ │ +1854 } │ │ │ │ │ +1855 │ │ │ │ │ +1856 │ │ │ │ │ +1857 //===== norms │ │ │ │ │ +1858 │ │ │ │ │ +_1_8_6_0 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ +1861 { │ │ │ │ │ +1862#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1863 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1864 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1865#endif │ │ │ │ │ +1866 │ │ │ │ │ +1867 typename FieldTraits::real_type sum=0; │ │ │ │ │ +1868 │ │ │ │ │ +1869 for (auto&& row : (*this)) │ │ │ │ │ +1870 for (auto&& _e_n_t_r_y : row) │ │ │ │ │ +1871 sum += Impl::asMatrix(_e_n_t_r_y).frobenius_norm2(); │ │ │ │ │ +1872 │ │ │ │ │ +1873 return sum; │ │ │ │ │ +1874 } │ │ │ │ │ +1875 │ │ │ │ │ +_1_8_7_7 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ │ +1878 { │ │ │ │ │ +1879 return sqrt(_f_r_o_b_e_n_i_u_s___n_o_r_m_2()); │ │ │ │ │ +1880 } │ │ │ │ │ +1881 │ │ │ │ │ +1883 template ::value, int>::type = 0> │ │ │ │ │ +_1_8_8_5 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +1886 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1887 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1888 │ │ │ │ │ +1889 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1890 using std::max; │ │ │ │ │ +1891 │ │ │ │ │ +1892 real_type norm = 0; │ │ │ │ │ +1893 for (auto const &x : *this) { │ │ │ │ │ +1894 real_type sum = 0; │ │ │ │ │ +1895 for (auto const &y : x) │ │ │ │ │ +1896 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ +1897 norm = max(sum, norm); │ │ │ │ │ +1898 } │ │ │ │ │ +1899 return norm; │ │ │ │ │ +1900 } │ │ │ │ │ +1901 │ │ │ │ │ +1903 template ::value, int>::type = 0> │ │ │ │ │ +_1_9_0_5 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +1906 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1907 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1908 │ │ │ │ │ +1909 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1910 using std::max; │ │ │ │ │ +1911 │ │ │ │ │ +1912 real_type norm = 0; │ │ │ │ │ +1913 for (auto const &x : *this) { │ │ │ │ │ +1914 real_type sum = 0; │ │ │ │ │ +1915 for (auto const &y : x) │ │ │ │ │ +1916 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ +1917 norm = max(sum, norm); │ │ │ │ │ +1918 } │ │ │ │ │ +1919 return norm; │ │ │ │ │ +1920 } │ │ │ │ │ +1921 │ │ │ │ │ +1923 template ::value, int>::type = 0> │ │ │ │ │ +_1_9_2_5 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ +1926 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1927 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1928 │ │ │ │ │ +1929 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1930 using std::max; │ │ │ │ │ +1931 │ │ │ │ │ +1932 real_type norm = 0; │ │ │ │ │ +1933 real_type isNaN = 1; │ │ │ │ │ +1934 for (auto const &x : *this) { │ │ │ │ │ +1935 real_type sum = 0; │ │ │ │ │ +1936 for (auto const &y : x) │ │ │ │ │ +1937 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ +1938 norm = max(sum, norm); │ │ │ │ │ +1939 isNaN += sum; │ │ │ │ │ +1940 } │ │ │ │ │ +1941 │ │ │ │ │ +1942 return norm * (isNaN / isNaN); │ │ │ │ │ +1943 } │ │ │ │ │ +1944 │ │ │ │ │ +1946 template ::value, int>::type = 0> │ │ │ │ │ +_1_9_4_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +1949 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ +1950 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ +fully built BCRSMatrix instances"); │ │ │ │ │ +1951 │ │ │ │ │ +1952 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1953 using std::max; │ │ │ │ │ +1954 │ │ │ │ │ +1955 real_type norm = 0; │ │ │ │ │ +1956 real_type isNaN = 1; │ │ │ │ │ +1957 │ │ │ │ │ +1958 for (auto const &x : *this) { │ │ │ │ │ +1959 real_type sum = 0; │ │ │ │ │ +1960 for (auto const &y : x) │ │ │ │ │ +1961 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ +1962 norm = max(sum, norm); │ │ │ │ │ +1963 isNaN += sum; │ │ │ │ │ +1964 } │ │ │ │ │ +1965 │ │ │ │ │ +1966 return norm * (isNaN / isNaN); │ │ │ │ │ +1967 } │ │ │ │ │ +1968 │ │ │ │ │ +1969 //===== sizes │ │ │ │ │ +1970 │ │ │ │ │ +_1_9_7_2 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ +1973 { │ │ │ │ │ +1974 return _n; │ │ │ │ │ +1975 } │ │ │ │ │ +1976 │ │ │ │ │ +_1_9_7_8 _s_i_z_e___t_y_p_e _M () const │ │ │ │ │ +1979 { │ │ │ │ │ +1980 return _m; │ │ │ │ │ +1981 } │ │ │ │ │ +1982 │ │ │ │ │ +_1_9_8_4 _s_i_z_e___t_y_p_e _n_o_n_z_e_r_o_e_s () const │ │ │ │ │ +1985 { │ │ │ │ │ +1986 // in case of row-wise allocation │ │ │ │ │ +1987 if( _n_n_z__ <= 0 ) │ │ │ │ │ +1988 _n_n_z__ = std::accumulate( _b_e_g_i_n(), _e_n_d(), _s_i_z_e___t_y_p_e( 0 ), [] ( _s_i_z_e___t_y_p_e s, │ │ │ │ │ +const _r_o_w___t_y_p_e &row ) { return s+row.getsize(); } ); │ │ │ │ │ +1989 return _n_n_z__; │ │ │ │ │ +1990 } │ │ │ │ │ +1991 │ │ │ │ │ +_1_9_9_3 _B_u_i_l_d_S_t_a_g_e _b_u_i_l_d_S_t_a_g_e() const │ │ │ │ │ +1994 { │ │ │ │ │ +1995 return _r_e_a_d_y; │ │ │ │ │ +1996 } │ │ │ │ │ +1997 │ │ │ │ │ +_1_9_9_9 _B_u_i_l_d_M_o_d_e _b_u_i_l_d_M_o_d_e() const │ │ │ │ │ +2000 { │ │ │ │ │ +2001 return _b_u_i_l_d___m_o_d_e; │ │ │ │ │ +2002 } │ │ │ │ │ +2003 │ │ │ │ │ +2004 //===== query │ │ │ │ │ +2005 │ │ │ │ │ +_2_0_0_7 bool _e_x_i_s_t_s (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e j) const │ │ │ │ │ +2008 { │ │ │ │ │ +2009#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +2010 if (i<0 || i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row index out of range"); │ │ │ │ │ +2011 if (j<0 || j>=_m) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"column index out of range"); │ │ │ │ │ +2012#endif │ │ │ │ │ +2013 return (_r[i].size() && _r[i].find(j) != _r[i]._e_n_d()); │ │ │ │ │ +2014 } │ │ │ │ │ +2015 │ │ │ │ │ +2016 │ │ │ │ │ +2017 protected: │ │ │ │ │ +2018 // state information │ │ │ │ │ +_2_0_1_9 _B_u_i_l_d_M_o_d_e _b_u_i_l_d___m_o_d_e; // row wise or whole matrix │ │ │ │ │ +_2_0_2_0 _B_u_i_l_d_S_t_a_g_e _r_e_a_d_y; // indicate the stage the matrix building is in │ │ │ │ │ +2021 │ │ │ │ │ +2022 // The allocator used for memory management │ │ │ │ │ +_2_0_2_3 typename std::allocator_traits::template rebind_alloc _a_l_l_o_c_a_t_o_r__; │ │ │ │ │ +2024 │ │ │ │ │ +_2_0_2_5 typename std::allocator_traits::template rebind_alloc │ │ │ │ │ +_r_o_w_A_l_l_o_c_a_t_o_r__; │ │ │ │ │ +2026 │ │ │ │ │ +_2_0_2_7 typename std::allocator_traits::template rebind_alloc │ │ │ │ │ +_s_i_z_e_A_l_l_o_c_a_t_o_r__; │ │ │ │ │ +2028 │ │ │ │ │ +2029 // size of the matrix │ │ │ │ │ +_2_0_3_0 _s_i_z_e___t_y_p_e _n; // number of rows │ │ │ │ │ +_2_0_3_1 _s_i_z_e___t_y_p_e _m; // number of columns │ │ │ │ │ +_2_0_3_2 mutable _s_i_z_e___t_y_p_e _n_n_z__; // number of nonzeroes contained in the matrix │ │ │ │ │ +_2_0_3_3 _s_i_z_e___t_y_p_e _a_l_l_o_c_a_t_i_o_n_S_i_z_e__; //allocated size of a and j arrays, except in │ │ │ │ │ +implicit mode: nnz_==allocationsSize_ │ │ │ │ │ +2034 // zero means that memory is allocated separately for each row. │ │ │ │ │ +2035 │ │ │ │ │ +2036 // the rows are dynamically allocated │ │ │ │ │ +_2_0_3_7 _r_o_w___t_y_p_e* _r; // [n] the individual rows having pointers into a,j arrays │ │ │ │ │ +2038 │ │ │ │ │ +2039 // dynamically allocated memory │ │ │ │ │ +_2_0_4_0 B* _a; // [allocationSize] non-zero entries of the matrix in row-wise │ │ │ │ │ +ordering │ │ │ │ │ +2041 // If a single array of column indices is used, it can be shared │ │ │ │ │ +2042 // between different matrices with the same sparsity pattern │ │ │ │ │ +_2_0_4_3 std::shared_ptr _j__; // [allocationSize] column indices of │ │ │ │ │ +entries │ │ │ │ │ +2044 │ │ │ │ │ +2045 // additional data is needed in implicit buildmode │ │ │ │ │ +_2_0_4_6 _s_i_z_e___t_y_p_e _a_v_g; │ │ │ │ │ +_2_0_4_7 double _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__; │ │ │ │ │ +2048 │ │ │ │ │ +_2_0_4_9 typedef std::map, B> _O_v_e_r_f_l_o_w_T_y_p_e; │ │ │ │ │ +_2_0_5_0 _O_v_e_r_f_l_o_w_T_y_p_e _o_v_e_r_f_l_o_w; │ │ │ │ │ +2051 │ │ │ │ │ +_2_0_5_2 void _s_e_t_W_i_n_d_o_w_P_o_i_n_t_e_r_s(_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r row) │ │ │ │ │ +2053 { │ │ │ │ │ +2054 _r_o_w___t_y_p_e current_row(_a,_j__.get(),0); // Pointers to current row data │ │ │ │ │ +2055 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++, ++row) { │ │ │ │ │ +2056 // set row i │ │ │ │ │ +2057 _s_i_z_e___t_y_p_e s = row->getsize(); │ │ │ │ │ +2058 │ │ │ │ │ +2059 if (s>0) { │ │ │ │ │ +2060 // setup pointers and size │ │ │ │ │ +2061 _r[i].set(s,current_row.getptr(), current_row.getindexptr()); │ │ │ │ │ +2062 // update pointer for next row │ │ │ │ │ +2063 current_row.setptr(current_row.getptr()+s); │ │ │ │ │ +2064 current_row.setindexptr(current_row.getindexptr()+s); │ │ │ │ │ +2065 } else{ │ │ │ │ │ +2066 // empty row │ │ │ │ │ +2067 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ +2068 } │ │ │ │ │ +2069 } │ │ │ │ │ +2070 } │ │ │ │ │ +2071 │ │ │ │ │ +2073 │ │ │ │ │ +_2_0_7_7 void _s_e_t_C_o_l_u_m_n_P_o_i_n_t_e_r_s(_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r row) │ │ │ │ │ +2078 { │ │ │ │ │ +2079 _s_i_z_e___t_y_p_e* jptr = _j__.get(); │ │ │ │ │ +2080 for (_s_i_z_e___t_y_p_e i=0; i<_n; ++i, ++row) { │ │ │ │ │ +2081 // set row i │ │ │ │ │ +2082 _s_i_z_e___t_y_p_e s = row->getsize(); │ │ │ │ │ +2083 │ │ │ │ │ +2084 if (s>0) { │ │ │ │ │ +2085 // setup pointers and size │ │ │ │ │ +2086 _r[i].setsize(s); │ │ │ │ │ +2087 _r[i].setindexptr(jptr); │ │ │ │ │ +2088 } else{ │ │ │ │ │ +2089 // empty row │ │ │ │ │ +2090 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ +2091 } │ │ │ │ │ +2092 │ │ │ │ │ +2093 // advance position in global array │ │ │ │ │ +2094 jptr += s; │ │ │ │ │ +2095 } │ │ │ │ │ +2096 } │ │ │ │ │ +2097 │ │ │ │ │ +2099 │ │ │ │ │ +_2_1_0_3 void _s_e_t_D_a_t_a_P_o_i_n_t_e_r_s() │ │ │ │ │ +2104 { │ │ │ │ │ +2105 B* aptr = _a; │ │ │ │ │ +2106 for (_s_i_z_e___t_y_p_e i=0; i<_n; ++i) { │ │ │ │ │ +2107 // set row i │ │ │ │ │ +2108 if (_r[i].getsize() > 0) { │ │ │ │ │ +2109 // setup pointers and size │ │ │ │ │ +2110 _r[i].setptr(aptr); │ │ │ │ │ +2111 } else{ │ │ │ │ │ +2112 // empty row │ │ │ │ │ +2113 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ +2114 } │ │ │ │ │ +2115 │ │ │ │ │ +2116 // advance position in global array │ │ │ │ │ +2117 aptr += _r[i].getsize(); │ │ │ │ │ +2118 } │ │ │ │ │ +2119 } │ │ │ │ │ +2120 │ │ │ │ │ +_2_1_2_2 void _c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e(const _B_C_R_S_M_a_t_r_i_x& Mat) │ │ │ │ │ +2123 { │ │ │ │ │ +2124 _s_e_t_W_i_n_d_o_w_P_o_i_n_t_e_r_s(Mat._b_e_g_i_n()); │ │ │ │ │ +2125 │ │ │ │ │ +2126 // copy data │ │ │ │ │ +2127 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) _r[i] = Mat._r[i]; │ │ │ │ │ +2128 │ │ │ │ │ +2129 // finish off │ │ │ │ │ +2130 _b_u_i_l_d___m_o_d_e = _r_o_w___w_i_s_e; // dummy │ │ │ │ │ +2131 _r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ +2132 } │ │ │ │ │ +2133 │ │ │ │ │ +_2_1_3_9 void _d_e_a_l_l_o_c_a_t_e(bool deallocateRows=true) │ │ │ │ │ +2140 { │ │ │ │ │ +2141 │ │ │ │ │ +2142 if (_n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ +2143 return; │ │ │ │ │ +2144 │ │ │ │ │ +2145 if (_a_l_l_o_c_a_t_i_o_n_S_i_z_e__>0) │ │ │ │ │ +2146 { │ │ │ │ │ +2147 // a,j_ have been allocated as one long vector │ │ │ │ │ +2148 _j__.reset(); │ │ │ │ │ +2149 if (_a) │ │ │ │ │ +2150 { │ │ │ │ │ +2151 for(B *aiter=_a+(_a_l_l_o_c_a_t_i_o_n_S_i_z_e__-1), *aend=_a-1; aiter!=aend; --aiter) │ │ │ │ │ +2152 std::allocator_traits::destroy(_a_l_l_o_c_a_t_o_r__, aiter); │ │ │ │ │ +2153 _a_l_l_o_c_a_t_o_r__.deallocate(_a,_a_l_l_o_c_a_t_i_o_n_S_i_z_e__); │ │ │ │ │ +2154 _a = nullptr; │ │ │ │ │ +2155 } │ │ │ │ │ +2156 } │ │ │ │ │ +2157 else if (_r) │ │ │ │ │ +2158 { │ │ │ │ │ +2159 // check if memory for rows have been allocated individually │ │ │ │ │ +2160 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ +2161 if (_r[i].getsize()>0) │ │ │ │ │ +2162 { │ │ │ │ │ +2163 for (B *_c_o_l=_r[i].getptr()+(_r[i].getsize()-1), │ │ │ │ │ +2164 *colend = _r[i].getptr()-1; _c_o_l!=colend; --_c_o_l) { │ │ │ │ │ +2165 std::allocator_traits::destroy(_a_l_l_o_c_a_t_o_r__, _c_o_l); │ │ │ │ │ +2166 } │ │ │ │ │ +2167 _s_i_z_e_A_l_l_o_c_a_t_o_r__.deallocate(_r[i].getindexptr(),1); │ │ │ │ │ +2168 _a_l_l_o_c_a_t_o_r__.deallocate(_r[i].getptr(),1); │ │ │ │ │ +2169 // clear out row data in case we don't want to deallocate the rows │ │ │ │ │ +2170 // otherwise we might run into a double free problem here later │ │ │ │ │ +2171 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ +2172 } │ │ │ │ │ +2173 } │ │ │ │ │ +2174 │ │ │ │ │ +2175 // deallocate the rows │ │ │ │ │ +2176 if (_n>0 && deallocateRows && _r) { │ │ │ │ │ +2177 for(_r_o_w___t_y_p_e *riter=_r+(_n-1), *rend=_r-1; riter!=rend; --riter) │ │ │ │ │ +2178 std::allocator_traits::destroy(_r_o_w_A_l_l_o_c_a_t_o_r__, │ │ │ │ │ +riter); │ │ │ │ │ +2179 _r_o_w_A_l_l_o_c_a_t_o_r__.deallocate(_r,_n); │ │ │ │ │ +2180 _r = nullptr; │ │ │ │ │ +2181 } │ │ │ │ │ +2182 │ │ │ │ │ +2183 // Mark matrix as not built at all. │ │ │ │ │ +2184 _r_e_a_d_y=_n_o_t_A_l_l_o_c_a_t_e_d; │ │ │ │ │ +2185 │ │ │ │ │ +2186 } │ │ │ │ │ +2187 │ │ │ │ │ +_2_2_0_5 void _a_l_l_o_c_a_t_e(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e allocationSize, │ │ │ │ │ +bool allocateRows, bool allocate_data) │ │ │ │ │ +2206 { │ │ │ │ │ +2207 // Store size │ │ │ │ │ +2208 _n = rows; │ │ │ │ │ +2209 _m = columns; │ │ │ │ │ +2210 _n_n_z__ = allocationSize; │ │ │ │ │ +2211 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__ = allocationSize; │ │ │ │ │ +2212 │ │ │ │ │ +2213 // allocate rows │ │ │ │ │ +2214 if(allocateRows) { │ │ │ │ │ +2215 if (_n>0) { │ │ │ │ │ +2216 if (_r) │ │ │ │ │ +2217 DUNE_THROW(InvalidStateException,"Rows have already been allocated, cannot │ │ │ │ │ +allocate a second time"); │ │ │ │ │ +2218 _r = _r_o_w_A_l_l_o_c_a_t_o_r__.allocate(rows); │ │ │ │ │ +2219 // initialize row entries │ │ │ │ │ +2220 for(_r_o_w___t_y_p_e* ri=_r; ri!=_r+rows; ++ri) │ │ │ │ │ +2221 std::allocator_traits::construct(_r_o_w_A_l_l_o_c_a_t_o_r__, │ │ │ │ │ +ri, _r_o_w___t_y_p_e()); │ │ │ │ │ +2222 }else{ │ │ │ │ │ +2223 _r = 0; │ │ │ │ │ +2224 } │ │ │ │ │ +2225 } │ │ │ │ │ +2226 │ │ │ │ │ +2227 // allocate a and j_ array │ │ │ │ │ +2228 if (allocate_data) │ │ │ │ │ +2229 _a_l_l_o_c_a_t_e_D_a_t_a(); │ │ │ │ │ +2230 // allocate column indices only if not yet present (enable sharing) │ │ │ │ │ +2231 if (_a_l_l_o_c_a_t_i_o_n_S_i_z_e__>0) { │ │ │ │ │ +2232 // we copy allocator and size to the deleter since _j may outlive this │ │ │ │ │ +class │ │ │ │ │ +2233 if (!_j__.get()) │ │ │ │ │ +2234 _j__.reset(_s_i_z_e_A_l_l_o_c_a_t_o_r__.allocate(_a_l_l_o_c_a_t_i_o_n_S_i_z_e__), │ │ │ │ │ +2235 [alloc = _s_i_z_e_A_l_l_o_c_a_t_o_r__, size = _a_l_l_o_c_a_t_i_o_n_S_i_z_e__](auto ptr) mutable { │ │ │ │ │ +2236 alloc.deallocate(ptr, size); │ │ │ │ │ +2237 }); │ │ │ │ │ +2238 }else{ │ │ │ │ │ +2239 _j__.reset(); │ │ │ │ │ +2240 } │ │ │ │ │ +2241 │ │ │ │ │ +2242 // Mark the matrix as not built. │ │ │ │ │ +2243 _r_e_a_d_y = _b_u_i_l_d_i_n_g; │ │ │ │ │ +2244 } │ │ │ │ │ +2245 │ │ │ │ │ +_2_2_4_6 void _a_l_l_o_c_a_t_e_D_a_t_a() │ │ │ │ │ +2247 { │ │ │ │ │ +2248 if (_a) │ │ │ │ │ +2249 DUNE_THROW(InvalidStateException,"Cannot allocate data array (already │ │ │ │ │ +allocated)"); │ │ │ │ │ +2250 if (_a_l_l_o_c_a_t_i_o_n_S_i_z_e__>0) { │ │ │ │ │ +2251 _a = _a_l_l_o_c_a_t_o_r__.allocate(_a_l_l_o_c_a_t_i_o_n_S_i_z_e__); │ │ │ │ │ +2252 // use placement new to call constructor that allocates │ │ │ │ │ +2253 // additional memory. │ │ │ │ │ +2254 new (_a) B[_a_l_l_o_c_a_t_i_o_n_S_i_z_e__]; │ │ │ │ │ +2255 } else { │ │ │ │ │ +2256 _a = nullptr; │ │ │ │ │ +2257 } │ │ │ │ │ +2258 } │ │ │ │ │ +2259 │ │ │ │ │ +_2_2_6_5 void _i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e(_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m) │ │ │ │ │ +2266 { │ │ │ │ │ +2267 if (_b_u_i_l_d___m_o_d_e != _i_m_p_l_i_c_i_t) │ │ │ │ │ +2268 DUNE_THROW(InvalidStateException,"implicit_allocate() may only be called │ │ │ │ │ +in implicit build mode"); │ │ │ │ │ +2269 if (_r_e_a_d_y != _n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ +2270 DUNE_THROW(InvalidStateException,"memory has already been allocated"); │ │ │ │ │ +2271 │ │ │ │ │ +2272 // check to make sure the user has actually set the parameters │ │ │ │ │ +2273 if (_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ < 0) │ │ │ │ │ +2274 DUNE_THROW(InvalidStateException,"You have to set the implicit build mode │ │ │ │ │ +parameters before starting to build the matrix"); │ │ │ │ │ +2275 //calculate size of overflow region, add buffer for row sort! │ │ │ │ │ +2276 _s_i_z_e___t_y_p_e osize = (_s_i_z_e___t_y_p_e) (_n*_a_v_g)*_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ + 4*_a_v_g; │ │ │ │ │ +2277 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__ = _n*_a_v_g + osize; │ │ │ │ │ +2278 │ │ │ │ │ +2279 _a_l_l_o_c_a_t_e(_n, _m, _a_l_l_o_c_a_t_i_o_n_S_i_z_e__,true,true); │ │ │ │ │ +2280 │ │ │ │ │ +2281 //set row pointers correctly │ │ │ │ │ +2282 _s_i_z_e___t_y_p_e* jptr = _j__.get() + osize; │ │ │ │ │ +2283 B* aptr = _a + osize; │ │ │ │ │ +2284 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ +2285 { │ │ │ │ │ +2286 _r[i].set(0,aptr,jptr); │ │ │ │ │ +2287 jptr = jptr + _a_v_g; │ │ │ │ │ +2288 aptr = aptr + _a_v_g; │ │ │ │ │ +2289 } │ │ │ │ │ +2290 │ │ │ │ │ +2291 _r_e_a_d_y = _b_u_i_l_d_i_n_g; │ │ │ │ │ +2292 } │ │ │ │ │ +2293 }; │ │ │ │ │ +2294 │ │ │ │ │ +2295 │ │ │ │ │ +2296 template │ │ │ │ │ +_2_2_9_7 struct FieldTraits< _B_C_R_S_M_a_t_r_i_x > │ │ │ │ │ +2298 { │ │ │ │ │ +_2_2_9_9 using _f_i_e_l_d___t_y_p_e = typename _B_C_R_S_M_a_t_r_i_x_<_B_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_3_0_0 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ +2301 }; │ │ │ │ │ +2302 │ │ │ │ │ +2305} // end namespace │ │ │ │ │ +2306 │ │ │ │ │ +2307#endif │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ +_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 │ │ │ │ │ +_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... │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ _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_:_:_f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h │ │ │ │ │ -std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0) │ │ │ │ │ -Traverse a blocked vector and call a functor at each scalar entry. │ │ │ │ │ -DDeeffiinniittiioonn foreach.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_r_o_w_s │ │ │ │ │ -auto rows(Matrix const &matrix) │ │ │ │ │ -DDeeffiinniittiioonn foreach.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_c_o_l_s │ │ │ │ │ -auto cols(Matrix const &matrix) │ │ │ │ │ -DDeeffiinniittiioonn foreach.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_s_i_z_e │ │ │ │ │ -auto size(Vector const &vector) │ │ │ │ │ -DDeeffiinniittiioonn foreach.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ │ +PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ +VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ +Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s │ │ │ │ │ +Statistics about compression achieved in implicit mode. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_o_v_e_r_f_l_o_w___t_o_t_a_l │ │ │ │ │ +size_type overflow_total │ │ │ │ │ +total number of elements written to the overflow area during construction. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_m_a_x_i_m_u_m │ │ │ │ │ +size_type maximum │ │ │ │ │ +maximum number of non-zeroes per row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_a_v_g │ │ │ │ │ +double avg │ │ │ │ │ +average number of non-zeroes per row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:90 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_m_e_m___r_a_t_i_o │ │ │ │ │ +double mem_ratio │ │ │ │ │ +fraction of wasted memory resulting from non-used overflow area. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ +A wrapper for uniform access to the BCRSMatrix during and after the build stage │ │ │ │ │ +in implicit build mod... │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:117 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +Matrix::block_type block_type │ │ │ │ │ +The block_type of the underlying matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:125 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ +ImplicitMatrixBuilder(Matrix &m) │ │ │ │ │ +Creates an ImplicitMatrixBuilder for matrix m. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:170 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ +M_ Matrix │ │ │ │ │ +The underlying matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:122 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ +ImplicitMatrixBuilder(Matrix &m, size_type rows, size_type cols, size_type │ │ │ │ │ +avg_cols_per_row, double overflow_fraction) │ │ │ │ │ +Sets up matrix m for implicit construction using the given parameters and │ │ │ │ │ +creates an ImplicitBmatrixu... │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_M │ │ │ │ │ +size_type M() const │ │ │ │ │ +The number of columns in the matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:217 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +The size_type of the underlying matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:128 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +row_object operator[](size_type i) const │ │ │ │ │ +Returns a proxy for entries in row i. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:205 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_N │ │ │ │ │ +size_type N() const │ │ │ │ │ +The number of rows in the matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_r_o_w___o_b_j_e_c_t │ │ │ │ │ +Proxy row object for entry access. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:137 │ │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_r_o_w___o_b_j_e_c_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +block_type & operator[](size_type j) const │ │ │ │ │ +Returns entry in column j. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:488 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_o_w_A_l_l_o_c_a_t_o_r__ │ │ │ │ │ +std::allocator_traits< A >::template rebind_alloc< row_type > rowAllocator_ │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2025 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_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 pattern │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2007 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d_S_t_a_g_e │ │ │ │ │ +BuildStage buildStage() const │ │ │ │ │ +The current build stage of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1993 │ │ │ │ │ +_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:675 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e │ │ │ │ │ +void copyWindowStructure(const BCRSMatrix &Mat) │ │ │ │ │ +Copy the window structure from another matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2122 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_t_r_y │ │ │ │ │ +B & entry(size_type row, size_type col) │ │ │ │ │ +Returns reference to entry (row,col) of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1296 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ +void mmhv(const X &x, Y &y) const │ │ │ │ │ +y -= A^H x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1812 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ +void usmhv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^H x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1835 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ +void umtv(const X &x, Y &y) const │ │ │ │ │ +y += A^T x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1722 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ │ │ │ │ │ +double compressionBufferSize_ │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2047 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m │ │ │ │ │ +size_type m │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2031 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +RealRowIterator< const row_type > const_iterator │ │ │ │ │ +The const iterator over the matrix rows. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:707 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ +static constexpr unsigned int blocklevel │ │ │ │ │ +increment block level counter │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:507 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ +void allocate(size_type rows, size_type columns, size_type allocationSize, bool │ │ │ │ │ +allocateRows, bool allocate_data) │ │ │ │ │ +Allocate memory for the matrix structure. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2205 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_x_p_y │ │ │ │ │ +BCRSMatrix & axpy(field_type alpha, const BCRSMatrix &b) │ │ │ │ │ +Add the scaled entries of another matrix to this one. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1592 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ +FieldTraits< ft >::real_type infinity_norm_real() const │ │ │ │ │ +simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1905 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_~_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +~BCRSMatrix() │ │ │ │ │ +destructor │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:824 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_e_D_a_t_a │ │ │ │ │ +void allocateData() │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2246 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_d_e_a_l_l_o_c_a_t_e │ │ │ │ │ +void deallocate(bool deallocateRows=true) │ │ │ │ │ +deallocate memory of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2139 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_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 bcrsmatrix.hh:701 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +row_type & operator[](size_type i) │ │ │ │ │ +random access to the rows │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:549 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix() │ │ │ │ │ +an empty matrix │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:749 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_r_o_w_s_i_z_e_s │ │ │ │ │ +void endrowsizes() │ │ │ │ │ +indicate that size of all rows is defined │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1149 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_n_c_r_e_m_e_n_t_r_o_w_s_i_z_e │ │ │ │ │ +void incrementrowsize(size_type i, size_type s=1) │ │ │ │ │ +increment size of row i by s (1 by default) │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1138 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ +void mtv(const X &x, Y &y) const │ │ │ │ │ +y = A^T x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1707 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ +void umhv(const X &x, Y &y) const │ │ │ │ │ +y += A^H x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1789 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_o_n_z_e_r_o_e_s │ │ │ │ │ +size_type nonzeroes() const │ │ │ │ │ +number of blocks that are stored (the number of blocks that possibly are │ │ │ │ │ +nonzero) │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1984 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_i_o_n_S_i_z_e__ │ │ │ │ │ +size_type allocationSize_ │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2033 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_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 const row iterator for easier access │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:738 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_e_a_d_y │ │ │ │ │ +BuildStage ready │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2020 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d___m_o_d_e │ │ │ │ │ +BuildMode build_mode │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2019 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_r_o_w_s_i_z_e │ │ │ │ │ +void setrowsize(size_type i, size_type s) │ │ │ │ │ +Set number of indices in row i to s. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1117 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +RealRowIterator< row_type > Iterator │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:672 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_n_z__ │ │ │ │ │ +size_type nnz_ │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2032 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ +BCRSMatrix & operator*=(const field_type &k) │ │ │ │ │ +vector space multiplication with scalar │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1484 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e_A_l_l_o_c_a_t_o_r__ │ │ │ │ │ +std::allocator_traits< A >::template rebind_alloc< size_type > sizeAllocator_ │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2027 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +RealRowIterator< row_type > iterator │ │ │ │ │ +The iterator over the (mutable matrix rows. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:671 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ +void usmtv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^T x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1766 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +ConstIterator beforeBegin() const │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:732 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +RealRowIterator< const row_type > ConstIterator │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:708 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +Iterator beforeBegin() │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:695 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a │ │ │ │ │ +B * a │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2040 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_u_i_l_d_M_o_d_e │ │ │ │ │ +BuildMode │ │ │ │ │ +we support two modes │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:510 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_m_p_l_i_c_i_t │ │ │ │ │ +@ implicit │ │ │ │ │ +Build entries randomly with an educated guess for the number of entries per │ │ │ │ │ +row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:539 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_n_k_n_o_w_n │ │ │ │ │ +@ unknown │ │ │ │ │ +Build mode not set! │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:543 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_a_n_d_o_m │ │ │ │ │ +@ random │ │ │ │ │ +Build entries randomly. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:530 │ │ │ │ │ +_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:521 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix(size_type _n, size_type _m, size_type _nnz, BuildMode bm) │ │ │ │ │ +matrix with known number of nonzeroes │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:756 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s │ │ │ │ │ +::Dune::CompressionStatistics< size_type > CompressionStatistics │ │ │ │ │ +The type for the statistics object returned by compress() │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:503 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ +BCRSMatrix & operator-=(const BCRSMatrix &b) │ │ │ │ │ +Subtract the entries of another matrix from this one. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1567 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix(const BCRSMatrix &Mat) │ │ │ │ │ +copy constructor │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:805 │ │ │ │ │ +_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:681 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r │ │ │ │ │ +row_type * r │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2037 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_I_n_d_i_c_e_s │ │ │ │ │ +void setIndices(size_type row, It begin, It end) │ │ │ │ │ +Set all column indices for row from the given iterator range. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1234 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_d_d_i_n_d_e_x │ │ │ │ │ +void addindex(size_type row, size_type col) │ │ │ │ │ +add index (row,col) to the matrix │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1191 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_O_v_e_r_f_l_o_w_T_y_p_e │ │ │ │ │ +std::map< std::pair< size_type, size_type >, B > OverflowType │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2049 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::Iterator ColIterator │ │ │ │ │ +Iterator for the entries of each row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:704 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ +FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ +frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1877 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The type for the index access and the size. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ +BCRSMatrix & operator/=(const field_type &k) │ │ │ │ │ +vector space division by scalar │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1512 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_v_e_r_f_l_o_w │ │ │ │ │ +OverflowType overflow │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2050 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ +BCRSMatrix & operator+=(const BCRSMatrix &b) │ │ │ │ │ +Add the entries of another matrix to this one. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1545 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix(size_type _n, size_type _m, size_type _avg, double │ │ │ │ │ +compressionBufferSize, BuildMode bm) │ │ │ │ │ +construct matrix with a known average number of entries per row │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:784 │ │ │ │ │ +_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_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ +FieldTraits< field_type >::real_type frobenius_norm2() const │ │ │ │ │ +square of frobenius norm, need for block recursion │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1860 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +Iterator beforeEnd() │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:688 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::ConstIterator ConstColIterator │ │ │ │ │ +Const iterator to the entries of a row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:741 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ +void usmv(F &&alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1684 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_g_e_t_r_o_w_s_i_z_e │ │ │ │ │ +size_type getrowsize(size_type i) const │ │ │ │ │ +get current number of indices in row i │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1128 │ │ │ │ │ +_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:1978 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n │ │ │ │ │ +size_type n │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2030 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ +Imp::CompressedBlockVectorWindow< B, A > row_type │ │ │ │ │ +implement row_type with compressed vector │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:497 │ │ │ │ │ +_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_:_:_B_u_i_l_d_S_t_a_g_e │ │ │ │ │ +BuildStage │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:469 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_o_w_S_i_z_e_s_B_u_i_l_t │ │ │ │ │ +@ rowSizesBuilt │ │ │ │ │ +The row sizes of the matrix are known. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:480 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_t │ │ │ │ │ +@ built │ │ │ │ │ +The matrix structure is fully built. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:482 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_o_t_b_u_i_l_t │ │ │ │ │ +@ notbuilt │ │ │ │ │ +Matrix is not built at all, no memory has been allocated, build mode and size │ │ │ │ │ +can still be set. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:471 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_o_t_A_l_l_o_c_a_t_e_d │ │ │ │ │ +@ notAllocated │ │ │ │ │ +Matrix is not built at all, no memory has been allocated, build mode and size │ │ │ │ │ +can still be set. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:473 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d_i_n_g │ │ │ │ │ +@ building │ │ │ │ │ +Matrix is currently being built, some memory has been allocated, build mode and │ │ │ │ │ +size are fixed. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:475 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d_M_o_d_e │ │ │ │ │ +BuildMode buildMode() const │ │ │ │ │ +The currently selected build mode of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1999 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ +void mmv(const X &x, Y &y) const │ │ │ │ │ +y -= A x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1661 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ +FieldTraits< ft >::real_type infinity_norm() const │ │ │ │ │ +infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1885 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ +void mv(const X &x, Y &y) const │ │ │ │ │ +y = A x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1612 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +B block_type │ │ │ │ │ +export the type representing the components │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:491 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ +void mmtv(const X &x, Y &y) const │ │ │ │ │ +y -= A^T x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1745 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_v_g │ │ │ │ │ +size_type avg │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2046 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ +void umv(const X &x, Y &y) const │ │ │ │ │ +y += A x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1638 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e │ │ │ │ │ +void implicit_allocate(size_type _n, size_type _m) │ │ │ │ │ +organizes allocation implicit mode calculates correct array size to be │ │ │ │ │ +allocated and sets the the win... │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2265 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_I_m_p_l_i_c_i_t_B_u_i_l_d_M_o_d_e_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +void setImplicitBuildModeParameters(size_type _avg, double │ │ │ │ │ +compressionBufferSize) │ │ │ │ │ +Set parameters needed for creation in implicit build mode. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:889 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix(size_type _n, size_type _m, BuildMode bm) │ │ │ │ │ +matrix with unknown number of nonzeroes │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:765 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_i_n_d_i_c_e_s │ │ │ │ │ +void endindices() │ │ │ │ │ +indicate that all indices are defined, check consistency │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1248 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_m_p_r_e_s_s │ │ │ │ │ +CompressionStatistics compress() │ │ │ │ │ +Finishes the buildstage in implicit mode. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1360 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_D_a_t_a_P_o_i_n_t_e_r_s │ │ │ │ │ +void setDataPointers() │ │ │ │ │ +Set data pointers for all rows. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2103 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r__ │ │ │ │ │ +std::allocator_traits< A >::template rebind_alloc< B > allocator_ │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2023 │ │ │ │ │ +_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:1972 │ │ │ │ │ +_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:833 │ │ │ │ │ +_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:861 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_j__ │ │ │ │ │ +std::shared_ptr< size_type > j_ │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2043 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_W_i_n_d_o_w_P_o_i_n_t_e_r_s │ │ │ │ │ +void setWindowPointers(ConstRowIterator row) │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2052 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BCRSMatrix & operator=(const BCRSMatrix &Mat) │ │ │ │ │ +assignment │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:911 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_C_o_l_u_m_n_P_o_i_n_t_e_r_s │ │ │ │ │ +void setColumnPointers(ConstRowIterator row) │ │ │ │ │ +Copy row sizes from iterator range starting at row and set column index │ │ │ │ │ +pointers for all rows. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2077 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +ConstIterator end() const │ │ │ │ │ +Get const iterator to one beyond last row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:718 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ +ConstIterator begin() const │ │ │ │ │ +Get const iterator to first row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:712 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +A allocator_type │ │ │ │ │ +export the allocator type │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:494 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +ConstIterator beforeEnd() const │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:725 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator access to matrix rows │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:579 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +RealRowIterator() │ │ │ │ │ +empty constructor, use with care! │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:596 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const RealRowIterator< ValueType > &other) const │ │ │ │ │ +equality │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:624 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ +std::remove_const< T >::type ValueType │ │ │ │ │ +The unqualified value type. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:583 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +RealRowIterator(const RealRowIterator< ValueType > &it) │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:600 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const RealRowIterator< const ValueType > &other) const │ │ │ │ │ +equality │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:631 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +RealRowIterator(row_type *_p, size_type _i) │ │ │ │ │ +constructor │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:591 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +std::ptrdiff_t distanceTo(const RealRowIterator< const ValueType > &other) │ │ │ │ │ +const │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:617 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ +size_type index() const │ │ │ │ │ +return index │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:606 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +std::ptrdiff_t distanceTo(const RealRowIterator< ValueType > &other) const │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:611 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator class for sequential creation of blocks │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:957 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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 bcrsmatrix.hh:1052 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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 bcrsmatrix.hh:977 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ +size_type index() const │ │ │ │ │ +The number of the row that the iterator currently points to. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1058 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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 bcrsmatrix.hh:1046 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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(BCRSMatrix &_Mat, size_type _i) │ │ │ │ │ +constructor │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:960 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_n_s_e_r_t │ │ │ │ │ +void insert(size_type j) │ │ │ │ │ +put column index in row │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1064 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ +bool contains(size_type j) │ │ │ │ │ +return true if column index is in row │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1070 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_s_i_z_e │ │ │ │ │ +size_type size() const │ │ │ │ │ +Get the current row size. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1079 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename BCRSMatrix< B, A >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2299 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2300 │ │ │ │ │ +_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_:_:_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:700 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ -size_type N() const │ │ │ │ │ -Return the number of rows. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ +_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_:_:_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_:_:_P_o_i_n_t_e_r_C_o_m_p_a_r_e │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:538 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverregistry.hh File Reference │ │ │ │ +dune-istl: overlappingschwarz.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,143 +72,132 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ -Functions
│ │ │ │ -
solverregistry.hh File Reference
│ │ │ │ +Typedefs
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#include <dune/istl/common/registry.hh>
│ │ │ │ -#include <dune/istl/preconditioner.hh>
│ │ │ │ -#include <dune/istl/solver.hh>
│ │ │ │ + │ │ │ │ +

Contains one level overlapping Schwarz preconditioners. │ │ │ │ +More...

│ │ │ │ +
#include <cassert>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <functional>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <set>
│ │ │ │ +#include <dune/common/dynmatrix.hh>
│ │ │ │ +#include <dune/common/sllist.hh>
│ │ │ │ +#include <dune/istl/bccsmatrixinitializer.hh>
│ │ │ │ +#include "preconditioners.hh"
│ │ │ │ +#include "superlu.hh"
│ │ │ │ +#include "umfpack.hh"
│ │ │ │ +#include "bvector.hh"
│ │ │ │ +#include "bcrsmatrix.hh"
│ │ │ │ +#include "ilusubdomainsolver.hh"
│ │ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::UnsupportedType
class  Dune::OverlappingSchwarzInitializer< I, S, D >
 Initializer for SuperLU Matrices representing the subdomains. More...
 
struct  Dune::AdditiveSchwarzMode
 Tag that the tells the Schwarz method to be additive. More...
 
struct  Dune::MultiplicativeSchwarzMode
 Tag that tells the Schwarz method to be multiplicative. More...
 
struct  Dune::SymmetricMultiplicativeSchwarzMode
 Tag that tells the Schwarz method to be multiplicative and symmetric. More...
 
class  Dune::DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >
 
class  Dune::OverlappingAssignerHelper< T, tag >
 
class  Dune::OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >, false >
 
struct  Dune::OverlappingAssignerHelper< S< BCRSMatrix< T, A > >, true >
 
class  Dune::OverlappingAssignerILUBase< M, X, Y >
 
class  Dune::OverlappingAssignerHelper< ILU0SubdomainSolver< M, X, Y >, false >
 
class  Dune::OverlappingAssignerHelper< ILUNSubdomainSolver< M, X, Y >, false >
 
struct  Dune::AdditiveAdder< S, T >
 
struct  Dune::AdditiveAdder< S, BlockVector< T, A > >
 
struct  Dune::MultiplicativeAdder< S, T >
 
struct  Dune::MultiplicativeAdder< S, BlockVector< T, A > >
 
struct  Dune::AdderSelector< T, X, S >
 template meta program for choosing how to add the correction. More...
 
struct  Dune::AdderSelector< AdditiveSchwarzMode, X, S >
 
struct  Dune::AdderSelector< MultiplicativeSchwarzMode, X, S >
 
struct  Dune::AdderSelector< SymmetricMultiplicativeSchwarzMode, X, S >
 
struct  Dune::IteratorDirectionSelector< T1, T2, forward >
 Helper template meta program for application of overlapping Schwarz. More...
 
struct  Dune::IteratorDirectionSelector< T1, T2, false >
 
struct  Dune::SeqOverlappingSchwarzApplier< T >
 Helper template meta program for application of overlapping Schwarz. More...
 
class  Dune::InvalidSolverFactoryConfiguration
struct  Dune::SeqOverlappingSchwarzApplier< SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< T, tag >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >, false >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< S< BCRSMatrix< T, A > >, true >
 
struct  Dune::SeqOverlappingSchwarzAssemblerILUBase< M, X, Y >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< ILU0SubdomainSolver< M, X, Y >, false >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< ILUNSubdomainSolver< M, X, Y >, false >
 
class  Dune::SeqOverlappingSchwarz< M, X, TM, TD, TA >
 Sequential overlapping Schwarz preconditioner. More...
 
struct  Dune::SeqOverlappingSchwarzDomainSize< M >
 
struct  Dune::SeqOverlappingSchwarzDomainSize< BCRSMatrix< T, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ -Macros

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

│ │ │ │ -Functions

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

│ │ │ │ +Typedefs

template<typename T >
using Dune::OverlappingAssigner = OverlappingAssignerHelper< T, Dune::StoresColumnCompressed< T >::value >
 
template<class T >
using Dune::SeqOverlappingSchwarzAssembler = SeqOverlappingSchwarzAssemblerHelper< T, Dune::StoresColumnCompressed< T >::value >
 
│ │ │ │ -

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ DUNE_REGISTER_DIRECT_SOLVER

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

◆ DUNE_REGISTER_ITERATIVE_SOLVER

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

◆ DUNE_REGISTER_PRECONDITIONER

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

Detailed Description

│ │ │ │ +

Contains one level overlapping Schwarz preconditioners.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,60 +1,130 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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> │ │ │ │ │ +_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 │ │ │ │ │ +overlappingschwarz.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 │ │ │ │ │ +Contains one level overlapping Schwarz preconditioners. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#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 "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ │ +#include "_s_u_p_e_r_l_u_._h_h" │ │ │ │ │ +#include "_u_m_f_p_a_c_k_._h_h" │ │ │ │ │ +#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ +#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ │ +#include "_i_l_u_s_u_b_d_o_m_a_i_n_s_o_l_v_e_r_._h_h" │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._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_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ │ + class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_<_ _I_,_ _S_,_ _D_ _> │ │ │ │ │ +  Initializer for _S_u_p_e_r_L_U Matrices representing the subdomains. _M_o_r_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 │ │ │ │ │ +struct   _D_u_n_e_:_:_A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e │ │ │ │ │ +  Tag that the tells the Schwarz method to be additive. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_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 │ │ │ │ │ +  Tag that tells the Schwarz method to be multiplicative. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_y_m_m_e_t_r_i_c_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 │ │ │ │ │ +  Tag that tells the Schwarz method to be multiplicative and symmetric. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _T_,_ _t_a_g_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_< │ │ │ │ │ + _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e │ │ │ │ │ + _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e │ │ │ │ │ + _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _T_,_ _X_,_ _S_ _> │ │ │ │ │ +  template meta program for choosing how to add the correction. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_ _X_,_ _S_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _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_,_ _X_,_ _S_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _S_y_m_m_e_t_r_i_c_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_,_ _X_,_ _S_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_o_r_w_a_r_d_ _> │ │ │ │ │ +  Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_p_p_l_i_e_r_<_ _T_ _> │ │ │ │ │ +  Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _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_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_, │ │ │ │ │ + _S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_<_ _T_,_ _t_a_g_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_< │ │ │ │ │ + _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_, │ │ │ │ │ + _t_r_u_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_I_L_U_B_a_s_e_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_<_ _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_, │ │ │ │ │ + _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_<_ _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_, │ │ │ │ │ + _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _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_<_ _M_,_ _X_,_ _T_M_,_ _T_D_,_ _T_A_ _> │ │ │ │ │ +  Sequential overlapping Schwarz preconditioner. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _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_D_o_m_a_i_n_S_i_z_e_<_ _M_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _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_D_o_m_a_i_n_S_i_z_e_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ - (DirectSolverTag, name, __VA_ARGS__) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ - (PreconditionerTag, name, __VA_ARGS__) │ │ │ │ │ -  │ │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ - (IterativeSolverTag, name, __VA_ARGS__) │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -templateclass Preconditioner, int │ │ │ │ │ -blockLevel = 1> │ │ │ │ │ -auto  _D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r () │ │ │ │ │ -  │ │ │ │ │ -templateclass Preconditioner> │ │ │ │ │ -auto  _D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r () │ │ │ │ │ -  │ │ │ │ │ -templateclass Solver> │ │ │ │ │ -auto  _D_u_n_e_:_:_d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r () │ │ │ │ │ -  │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__DDIIRREECCTT__SSOOLLVVEERR ********** │ │ │ │ │ -#define DUNE_REGISTER_DIRECT_SOLVER (   name, │ │ │ │ │ -   ......  │ │ │ │ │ - )     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(DirectSolverTag, │ │ │ │ │ - name, __VA_ARGS__) │ │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__IITTEERRAATTIIVVEE__SSOOLLVVEERR ********** │ │ │ │ │ -#define DUNE_REGISTER_ITERATIVE_SOLVER (   name, │ │ │ │ │ -   ......  │ │ │ │ │ -     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ - ) (IterativeSolverTag, name, │ │ │ │ │ - __VA_ARGS__) │ │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__PPRREECCOONNDDIITTIIOONNEERR ********** │ │ │ │ │ -#define DUNE_REGISTER_PRECONDITIONER (   name, │ │ │ │ │ -   ......  │ │ │ │ │ - )     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ - (PreconditionerTag, name, __VA_ARGS__) │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r = _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r< T, _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< T >::value > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _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 = │ │ │ │ │ + _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< T, _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< T │ │ │ │ │ + >::value > │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Contains one level overlapping Schwarz preconditioners. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverregistry.hh Source File │ │ │ │ +dune-istl: overlappingschwarz.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,118 +74,1666 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
solverregistry.hh
│ │ │ │ +
overlappingschwarz.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
5
│ │ │ │ -
6#ifndef DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ │ -
7#define DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ │ -
8
│ │ │ │ - │ │ │ │ - │ │ │ │ -
11#include <dune/istl/solver.hh>
│ │ │ │ -
12
│ │ │ │ -
│ │ │ │ -
13#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \
│ │ │ │ -
14 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__)
│ │ │ │ -
│ │ │ │ +
5#ifndef DUNE_ISTL_OVERLAPPINGSCHWARZ_HH
│ │ │ │ +
6#define DUNE_ISTL_OVERLAPPINGSCHWARZ_HH
│ │ │ │ +
7#include <cassert>
│ │ │ │ +
8#include <algorithm>
│ │ │ │ +
9#include <functional>
│ │ │ │ +
10#include <memory>
│ │ │ │ +
11#include <vector>
│ │ │ │ +
12#include <set>
│ │ │ │ +
13#include <dune/common/dynmatrix.hh>
│ │ │ │ +
14#include <dune/common/sllist.hh>
│ │ │ │
15
│ │ │ │ -
│ │ │ │ -
16#define DUNE_REGISTER_PRECONDITIONER(name, ...) \
│ │ │ │ -
17 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
│ │ │ │ -
│ │ │ │ -
18
│ │ │ │ -
│ │ │ │ -
19#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \
│ │ │ │ -
20 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__)
│ │ │ │ -
│ │ │ │ -
21
│ │ │ │ -
22namespace Dune{
│ │ │ │ -
27 namespace {
│ │ │ │ -
28 struct DirectSolverTag {};
│ │ │ │ -
29 struct PreconditionerTag {};
│ │ │ │ -
30 struct IterativeSolverTag {};
│ │ │ │ -
31 }
│ │ │ │ -
32 template<template<class,class,class,int>class Preconditioner, int blockLevel=1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
34 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& config)
│ │ │ │ -
35 {
│ │ │ │ -
36 using Matrix = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ │ -
37 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ │ -
38 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type;
│ │ │ │ -
39 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
│ │ │ │ -
40 = std::make_shared<Preconditioner<Matrix, Domain, Range, blockLevel>>(matrix, config);
│ │ │ │ -
41 return preconditioner;
│ │ │ │ -
42 };
│ │ │ │ -
43 }
│ │ │ │ -
│ │ │ │ -
44
│ │ │ │ -
45 template<template<class,class,class>class Preconditioner>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
47 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& config)
│ │ │ │ -
48 {
│ │ │ │ -
49 using Matrix = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ │ -
50 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ │ -
51 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type;
│ │ │ │ -
52 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
│ │ │ │ -
53 = std::make_shared<Preconditioner<Matrix, Domain, Range>>(matrix, config);
│ │ │ │ -
54 return preconditioner;
│ │ │ │ -
55 };
│ │ │ │ -
56 }
│ │ │ │ -
│ │ │ │ + │ │ │ │ +
17#include "preconditioners.hh"
│ │ │ │ +
18#include "superlu.hh"
│ │ │ │ +
19#include "umfpack.hh"
│ │ │ │ +
20#include "bvector.hh"
│ │ │ │ +
21#include "bcrsmatrix.hh"
│ │ │ │ +
22#include "ilusubdomainsolver.hh"
│ │ │ │ + │ │ │ │ +
24
│ │ │ │ +
25namespace Dune
│ │ │ │ +
26{
│ │ │ │ +
27
│ │ │ │ +
39 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ +
40 class SeqOverlappingSchwarz;
│ │ │ │ +
41
│ │ │ │ +
45 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
47 {
│ │ │ │ +
48 public:
│ │ │ │ + │ │ │ │ +
51
│ │ │ │ +
52 typedef I InitializerList;
│ │ │ │ +
53 typedef typename InitializerList::value_type AtomInitializer;
│ │ │ │ +
54 typedef typename AtomInitializer::Matrix Matrix;
│ │ │ │ +
55 typedef typename Matrix::const_iterator Iter;
│ │ │ │ +
56 typedef typename Matrix::row_type::const_iterator CIter;
│ │ │ │
57
│ │ │ │ -
58 template<template<class...>class Solver>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
60 return [](auto typeList,
│ │ │ │ -
61 const auto& linearOperator,
│ │ │ │ -
62 const auto& scalarProduct,
│ │ │ │ -
63 const auto& preconditioner,
│ │ │ │ -
64 const Dune::ParameterTree& config)
│ │ │ │ -
65 {
│ │ │ │ -
66 using Domain = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ │ -
67 using Range = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ │ -
68 std::shared_ptr<Dune::InverseOperator<Domain, Range>> solver
│ │ │ │ -
69 = std::make_shared<Solver<Domain>>(linearOperator, scalarProduct, preconditioner, config);
│ │ │ │ -
70 return solver;
│ │ │ │ -
71 };
│ │ │ │ -
72 }
│ │ │ │ -
│ │ │ │ +
58 typedef S IndexSet;
│ │ │ │ +
59 typedef typename IndexSet::size_type size_type;
│ │ │ │ +
60
│ │ │ │ + │ │ │ │ +
62 const IndexSet& indices,
│ │ │ │ +
63 const subdomain_vector& domains);
│ │ │ │ +
64
│ │ │ │ +
65
│ │ │ │ +
66 void addRowNnz(const Iter& row);
│ │ │ │ +
67
│ │ │ │ +
68 void allocate();
│ │ │ │ +
69
│ │ │ │ +
70 void countEntries(const Iter& row, const CIter& col) const;
│ │ │ │ +
71
│ │ │ │ +
72 void calcColstart() const;
│ │ │ │
73
│ │ │ │ -
74 /* This exception is thrown, when the requested solver is in the factory but
│ │ │ │ -
75 cannot be instantiated for the required template parameters
│ │ │ │ -
76 */
│ │ │ │ -
77 class UnsupportedType : public NotImplemented {};
│ │ │ │ -
78
│ │ │ │ -
79 class InvalidSolverFactoryConfiguration : public InvalidStateException{};
│ │ │ │ -
80} // end namespace Dune
│ │ │ │ -
81
│ │ │ │ -
82#endif // DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ │ -
auto defaultIterativeSolverCreator()
Definition solverregistry.hh:59
│ │ │ │ -
auto defaultPreconditionerBlockLevelCreator()
Definition solverregistry.hh:33
│ │ │ │ -
auto defaultPreconditionerCreator()
Definition solverregistry.hh:46
│ │ │ │ +
74 void copyValue(const Iter& row, const CIter& col) const;
│ │ │ │ +
75
│ │ │ │ +
76 void createMatrix() const;
│ │ │ │ +
77 private:
│ │ │ │ +
78 class IndexMap
│ │ │ │ +
79 {
│ │ │ │ +
80 public:
│ │ │ │ +
81 typedef typename S::size_type size_type;
│ │ │ │ +
82 typedef std::map<size_type,size_type> Map;
│ │ │ │ +
83 typedef typename Map::iterator iterator;
│ │ │ │ +
84 typedef typename Map::const_iterator const_iterator;
│ │ │ │ +
85
│ │ │ │ +
86 IndexMap();
│ │ │ │ +
87
│ │ │ │ +
88 void insert(size_type grow);
│ │ │ │ +
89
│ │ │ │ +
90 const_iterator find(size_type grow) const;
│ │ │ │ +
91
│ │ │ │ +
92 iterator find(size_type grow);
│ │ │ │ +
93
│ │ │ │ +
94 iterator begin();
│ │ │ │ +
95
│ │ │ │ +
96 const_iterator begin() const;
│ │ │ │ +
97
│ │ │ │ +
98 iterator end();
│ │ │ │ +
99
│ │ │ │ +
100 const_iterator end() const;
│ │ │ │ +
101
│ │ │ │ +
102 private:
│ │ │ │ +
103 std::map<size_type,size_type> map_;
│ │ │ │ +
104 size_type row;
│ │ │ │ +
105 };
│ │ │ │ +
106
│ │ │ │ +
107
│ │ │ │ +
108 typedef typename InitializerList::iterator InitIterator;
│ │ │ │ +
109 typedef typename IndexSet::const_iterator IndexIteratur;
│ │ │ │ +
110 InitializerList* initializers;
│ │ │ │ +
111 const IndexSet *indices;
│ │ │ │ +
112 mutable std::vector<IndexMap> indexMaps;
│ │ │ │ +
113 const subdomain_vector& domains;
│ │ │ │ +
114 };
│ │ │ │ +
│ │ │ │ +
115
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
120 {};
│ │ │ │ +
│ │ │ │ +
121
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
126 {};
│ │ │ │ +
│ │ │ │ +
127
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
133 {};
│ │ │ │ +
│ │ │ │ +
134
│ │ │ │ +
139 template<class M, class X, class Y>
│ │ │ │ + │ │ │ │ +
141
│ │ │ │ +
142 // Specialization for BCRSMatrix
│ │ │ │ +
143 template<class K, class Al, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
145 {
│ │ │ │ +
146 typedef BCRSMatrix< K, Al> M;
│ │ │ │ +
147 public:
│ │ │ │ +
149 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ │ +
150 typedef typename X::field_type field_type;
│ │ │ │ +
151 typedef typename std::remove_const<M>::type rilu_type;
│ │ │ │ +
153 typedef X domain_type;
│ │ │ │ +
155 typedef Y range_type;
│ │ │ │ +
156 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<K>()))>::rows;
│ │ │ │ +
157
│ │ │ │ +
│ │ │ │ +
162 void apply (DynamicVector<field_type>& v, DynamicVector<field_type>& d)
│ │ │ │ +
163 {
│ │ │ │ +
164 assert(v.size() > 0);
│ │ │ │ +
165 assert(v.size() == d.size());
│ │ │ │ +
166 assert(A.rows() <= v.size());
│ │ │ │ +
167 assert(A.cols() <= v.size());
│ │ │ │ +
168 size_t sz = A.rows();
│ │ │ │ +
169 v.resize(sz);
│ │ │ │ +
170 d.resize(sz);
│ │ │ │ +
171 A.solve(v,d);
│ │ │ │ +
172 v.resize(v.capacity());
│ │ │ │ +
173 d.resize(d.capacity());
│ │ │ │ +
174 }
│ │ │ │ +
│ │ │ │ +
175
│ │ │ │ +
183 template<class S>
│ │ │ │ +
│ │ │ │ +
184 void setSubMatrix(const M& BCRS, S& rowset)
│ │ │ │ +
185 {
│ │ │ │ +
186 size_t sz = rowset.size();
│ │ │ │ +
187 A.resize(sz*n,sz*n);
│ │ │ │ +
188 typedef typename S::const_iterator SIter;
│ │ │ │ +
189 size_t r = 0, c = 0;
│ │ │ │ +
190 for(SIter rowIdx = rowset.begin(), rowEnd=rowset.end();
│ │ │ │ +
191 rowIdx!= rowEnd; ++rowIdx, r++)
│ │ │ │ +
192 {
│ │ │ │ +
193 c = 0;
│ │ │ │ +
194 for(SIter colIdx = rowset.begin(), colEnd=rowset.end();
│ │ │ │ +
195 colIdx!= colEnd; ++colIdx, c++)
│ │ │ │ +
196 {
│ │ │ │ +
197 if (BCRS[*rowIdx].find(*colIdx) == BCRS[*rowIdx].end())
│ │ │ │ +
198 continue;
│ │ │ │ +
199 for (size_t i=0; i<n; i++)
│ │ │ │ +
200 {
│ │ │ │ +
201 for (size_t j=0; j<n; j++)
│ │ │ │ +
202 {
│ │ │ │ +
203 A[r*n+i][c*n+j] = Impl::asMatrix(BCRS[*rowIdx][*colIdx])[i][j];
│ │ │ │ +
204 }
│ │ │ │ +
205 }
│ │ │ │ +
206 }
│ │ │ │ +
207 }
│ │ │ │ +
208 }
│ │ │ │ +
│ │ │ │ +
209 private:
│ │ │ │ +
210 DynamicMatrix<K> A;
│ │ │ │ +
211 };
│ │ │ │ +
│ │ │ │ +
212
│ │ │ │ +
213 template<typename T, bool tag>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
215 {};
│ │ │ │ +
│ │ │ │ +
216
│ │ │ │ +
217 template<typename T>
│ │ │ │ + │ │ │ │ +
219
│ │ │ │ +
220 // specialization for DynamicMatrix
│ │ │ │ +
221 template<class K, class Al, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
223 {
│ │ │ │ +
224 public:
│ │ │ │ + │ │ │ │ +
226 typedef typename X::field_type field_type;
│ │ │ │ +
227 typedef Y range_type;
│ │ │ │ +
228 typedef typename range_type::block_type block_type;
│ │ │ │ + │ │ │ │ +
230 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<K>()))>::rows;
│ │ │ │ +
238 OverlappingAssignerHelper(std::size_t maxlength, const BCRSMatrix<K, Al>& mat_, const X& b_, Y& x_);
│ │ │ │ +
239
│ │ │ │ +
243 inline
│ │ │ │ +
244 void deallocate();
│ │ │ │ +
245
│ │ │ │ +
249 inline
│ │ │ │ +
250 void resetIndexForNextDomain();
│ │ │ │ +
251
│ │ │ │ +
256 inline
│ │ │ │ +
257 DynamicVector<field_type> & lhs();
│ │ │ │ +
258
│ │ │ │ +
263 inline
│ │ │ │ +
264 DynamicVector<field_type> & rhs();
│ │ │ │ +
265
│ │ │ │ +
270 inline
│ │ │ │ +
271 void relaxResult(field_type relax);
│ │ │ │ +
272
│ │ │ │ +
277 void operator()(const size_type& domainIndex);
│ │ │ │ +
278
│ │ │ │ +
286 inline
│ │ │ │ +
287 void assignResult(block_type& res);
│ │ │ │ +
288
│ │ │ │ +
289 private:
│ │ │ │ +
293 const matrix_type* mat;
│ │ │ │ +
295 // we need a pointer, because we have to avoid deep copies
│ │ │ │ +
296 DynamicVector<field_type> * rhs_;
│ │ │ │ +
298 // we need a pointer, because we have to avoid deep copies
│ │ │ │ +
299 DynamicVector<field_type> * lhs_;
│ │ │ │ +
301 const range_type* b;
│ │ │ │ +
303 range_type* x;
│ │ │ │ +
305 std::size_t i;
│ │ │ │ +
307 std::size_t maxlength_;
│ │ │ │ +
308 };
│ │ │ │ +
│ │ │ │ +
309
│ │ │ │ +
310#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
311 template<template<class> class S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
313 {
│ │ │ │ + │ │ │ │ +
315 typedef typename S<BCRSMatrix<T, A>>::range_type range_type;
│ │ │ │ +
316 typedef typename range_type::field_type field_type;
│ │ │ │ +
317 typedef typename range_type::block_type block_type;
│ │ │ │ +
318
│ │ │ │ + │ │ │ │ +
320
│ │ │ │ +
321 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::rows;
│ │ │ │ +
322 static constexpr size_t m = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::cols;
│ │ │ │ +
330 OverlappingAssignerHelper(std::size_t maxlength, const matrix_type& mat,
│ │ │ │ +
331 const range_type& b, range_type& x);
│ │ │ │ +
337 void deallocate();
│ │ │ │ +
338
│ │ │ │ +
339 /*
│ │ │ │ +
340 * @brief Resets the local index to zero.
│ │ │ │ +
341 */
│ │ │ │ +
342 void resetIndexForNextDomain();
│ │ │ │ +
343
│ │ │ │ +
348 field_type* lhs();
│ │ │ │ +
349
│ │ │ │ +
354 field_type* rhs();
│ │ │ │ +
355
│ │ │ │ +
360 void relaxResult(field_type relax);
│ │ │ │ +
361
│ │ │ │ +
366 void operator()(const size_type& domain);
│ │ │ │ +
367
│ │ │ │ +
375 void assignResult(block_type& res);
│ │ │ │ +
376
│ │ │ │ +
377 private:
│ │ │ │ +
381 const matrix_type* mat;
│ │ │ │ +
383 field_type* rhs_;
│ │ │ │ +
385 field_type* lhs_;
│ │ │ │ +
387 const range_type* b;
│ │ │ │ +
389 range_type* x;
│ │ │ │ +
391 std::size_t i;
│ │ │ │ +
393 std::size_t maxlength_;
│ │ │ │ +
394 };
│ │ │ │ +
│ │ │ │ +
395
│ │ │ │ +
396#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
397
│ │ │ │ +
398 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
400 {
│ │ │ │ +
401 public:
│ │ │ │ +
402 typedef M matrix_type;
│ │ │ │ +
403
│ │ │ │ +
404 typedef typename Y::field_type field_type;
│ │ │ │ +
405
│ │ │ │ +
406 typedef typename Y::block_type block_type;
│ │ │ │ +
407
│ │ │ │ +
408 typedef typename matrix_type::size_type size_type;
│ │ │ │ +
416 OverlappingAssignerILUBase(std::size_t maxlength, const M& mat,
│ │ │ │ +
417 const Y& b, X& x);
│ │ │ │ +
423 void deallocate();
│ │ │ │ +
424
│ │ │ │ + │ │ │ │ +
429
│ │ │ │ +
434 X& lhs();
│ │ │ │ +
435
│ │ │ │ +
440 Y& rhs();
│ │ │ │ +
441
│ │ │ │ +
446 void relaxResult(field_type relax);
│ │ │ │ +
447
│ │ │ │ +
452 void operator()(const size_type& domain);
│ │ │ │ +
453
│ │ │ │ +
461 void assignResult(block_type& res);
│ │ │ │ +
462
│ │ │ │ +
463 private:
│ │ │ │ +
467 const M* mat;
│ │ │ │ +
469 X* lhs_;
│ │ │ │ +
471 Y* rhs_;
│ │ │ │ +
473 const Y* b;
│ │ │ │ +
475 X* x;
│ │ │ │ +
477 size_type i;
│ │ │ │ +
478 };
│ │ │ │ +
│ │ │ │ +
479
│ │ │ │ +
480 // specialization for ILU0
│ │ │ │ +
481 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
483 : public OverlappingAssignerILUBase<M,X,Y>
│ │ │ │ +
484 {
│ │ │ │ +
485 public:
│ │ │ │ +
│ │ │ │ +
493 OverlappingAssignerHelper(std::size_t maxlength, const M& mat,
│ │ │ │ +
494 const Y& b, X& x)
│ │ │ │ +
495 : OverlappingAssignerILUBase<M,X,Y>(maxlength, mat,b,x)
│ │ │ │ +
496 {}
│ │ │ │ +
│ │ │ │ +
497 };
│ │ │ │ +
│ │ │ │ +
498
│ │ │ │ +
499 // specialization for ILUN
│ │ │ │ +
500 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
502 : public OverlappingAssignerILUBase<M,X,Y>
│ │ │ │ +
503 {
│ │ │ │ +
504 public:
│ │ │ │ +
│ │ │ │ +
512 OverlappingAssignerHelper(std::size_t maxlength, const M& mat,
│ │ │ │ +
513 const Y& b, X& x)
│ │ │ │ +
514 : OverlappingAssignerILUBase<M,X,Y>(maxlength, mat,b,x)
│ │ │ │ +
515 {}
│ │ │ │ +
│ │ │ │ +
516 };
│ │ │ │ +
│ │ │ │ +
517
│ │ │ │ +
518 template<typename S, typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
520 {};
│ │ │ │ +
│ │ │ │ +
521
│ │ │ │ +
522 template<typename S, typename T, typename A>
│ │ │ │ +
│ │ │ │ +
523 struct AdditiveAdder<S, BlockVector<T,A> >
│ │ │ │ +
524 {
│ │ │ │ +
525 typedef typename A::size_type size_type;
│ │ │ │ +
526 typedef typename std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::field_type field_type;
│ │ │ │ + │ │ │ │ +
528 OverlappingAssigner<S>& assigner, const field_type& relax_);
│ │ │ │ +
529 void operator()(const size_type& domain);
│ │ │ │ +
530 void axpy();
│ │ │ │ +
531 static constexpr size_t n = std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::dimension;
│ │ │ │ +
532
│ │ │ │ +
533 private:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
536 OverlappingAssigner<S>* assigner;
│ │ │ │ +
537 field_type relax;
│ │ │ │ +
538 };
│ │ │ │ +
│ │ │ │ +
539
│ │ │ │ +
540 template<typename S,typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
542 {};
│ │ │ │ +
│ │ │ │ +
543
│ │ │ │ +
544 template<typename S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
546 {
│ │ │ │ +
547 typedef typename A::size_type size_type;
│ │ │ │ +
548 typedef typename std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::field_type field_type;
│ │ │ │ + │ │ │ │ +
550 OverlappingAssigner<S>& assigner_, const field_type& relax_);
│ │ │ │ +
551 void operator()(const size_type& domain);
│ │ │ │ +
552 void axpy();
│ │ │ │ +
553 static constexpr size_t n = std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::dimension;
│ │ │ │ +
554
│ │ │ │ +
555 private:
│ │ │ │ + │ │ │ │ +
557 OverlappingAssigner<S>* assigner;
│ │ │ │ +
558 field_type relax;
│ │ │ │ +
559 };
│ │ │ │ +
│ │ │ │ +
560
│ │ │ │ +
570 template<typename T, class X, class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
572 {};
│ │ │ │ +
│ │ │ │ +
573
│ │ │ │ +
574 template<class X, class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
576 {
│ │ │ │ + │ │ │ │ +
578 };
│ │ │ │ +
│ │ │ │ +
579
│ │ │ │ +
580 template<class X, class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
582 {
│ │ │ │ + │ │ │ │ +
584 };
│ │ │ │ +
│ │ │ │ +
585
│ │ │ │ +
586 template<class X, class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
588 {
│ │ │ │ + │ │ │ │ +
590 };
│ │ │ │ +
│ │ │ │ +
591
│ │ │ │ +
603 template<typename T1, typename T2, bool forward>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
605 {
│ │ │ │ +
606 typedef T1 solver_vector;
│ │ │ │ +
607 typedef typename solver_vector::iterator solver_iterator;
│ │ │ │ + │ │ │ │ +
609 typedef typename subdomain_vector::const_iterator domain_iterator;
│ │ │ │ +
610
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
612 {
│ │ │ │ +
613 return sv.begin();
│ │ │ │ +
614 }
│ │ │ │ +
│ │ │ │ +
615
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
617 {
│ │ │ │ +
618 return sv.end();
│ │ │ │ +
619 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
621 {
│ │ │ │ +
622 return sv.begin();
│ │ │ │ +
623 }
│ │ │ │ +
│ │ │ │ +
624
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
626 {
│ │ │ │ +
627 return sv.end();
│ │ │ │ +
628 }
│ │ │ │ +
│ │ │ │ +
629 };
│ │ │ │ +
│ │ │ │ +
630
│ │ │ │ +
631 template<typename T1, typename T2>
│ │ │ │ +
│ │ │ │ +
632 struct IteratorDirectionSelector<T1,T2,false>
│ │ │ │ +
633 {
│ │ │ │ +
634 typedef T1 solver_vector;
│ │ │ │ +
635 typedef typename solver_vector::reverse_iterator solver_iterator;
│ │ │ │ + │ │ │ │ +
637 typedef typename subdomain_vector::const_reverse_iterator domain_iterator;
│ │ │ │ +
638
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
640 {
│ │ │ │ +
641 return sv.rbegin();
│ │ │ │ +
642 }
│ │ │ │ +
│ │ │ │ +
643
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
645 {
│ │ │ │ +
646 return sv.rend();
│ │ │ │ +
647 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
649 {
│ │ │ │ +
650 return sv.rbegin();
│ │ │ │ +
651 }
│ │ │ │ +
│ │ │ │ +
652
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
654 {
│ │ │ │ +
655 return sv.rend();
│ │ │ │ +
656 }
│ │ │ │ +
│ │ │ │ +
657 };
│ │ │ │ +
│ │ │ │ +
658
│ │ │ │ +
667 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
669 {
│ │ │ │ +
670 typedef T smoother;
│ │ │ │ +
671 typedef typename smoother::range_type range_type;
│ │ │ │ +
672
│ │ │ │ +
│ │ │ │ +
673 static void apply(smoother& sm, range_type& v, const range_type& b)
│ │ │ │ +
674 {
│ │ │ │ +
675 sm.template apply<true>(v, b);
│ │ │ │ +
676 }
│ │ │ │ +
│ │ │ │ +
677 };
│ │ │ │ +
│ │ │ │ +
678
│ │ │ │ +
679 template<class M, class X, class TD, class TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
681 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
684
│ │ │ │ +
│ │ │ │ +
685 static void apply(smoother& sm, range_type& v, const range_type& b)
│ │ │ │ +
686 {
│ │ │ │ +
687 sm.template apply<true>(v, b);
│ │ │ │ +
688 sm.template apply<false>(v, b);
│ │ │ │ +
689 }
│ │ │ │ +
│ │ │ │ +
690 };
│ │ │ │ +
│ │ │ │ +
691
│ │ │ │ +
692 template<class T, bool tag>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
694 {};
│ │ │ │ +
│ │ │ │ +
695
│ │ │ │ +
696 template<class T>
│ │ │ │ + │ │ │ │ +
698
│ │ │ │ +
699 template<class K, class Al, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
701 {
│ │ │ │ + │ │ │ │ +
703 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<K>()))>::rows;
│ │ │ │ +
704 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ +
705 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, const matrix_type& mat,
│ │ │ │ +
706 Solvers& solvers, const SubDomains& domains,
│ │ │ │ +
707 bool onTheFly);
│ │ │ │ +
708 };
│ │ │ │ +
│ │ │ │ +
709
│ │ │ │ +
710 template<template<class> class S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
712 {
│ │ │ │ + │ │ │ │ +
714 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::rows;
│ │ │ │ +
715 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ +
716 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, const matrix_type& mat,
│ │ │ │ +
717 Solvers& solvers, const SubDomains& domains,
│ │ │ │ +
718 bool onTheFly);
│ │ │ │ +
719 };
│ │ │ │ +
│ │ │ │ +
720
│ │ │ │ +
721 template<class M,class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
723 {
│ │ │ │ +
724 typedef M matrix_type;
│ │ │ │ +
725 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ +
726 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, const matrix_type& mat,
│ │ │ │ +
727 Solvers& solvers, const SubDomains& domains,
│ │ │ │ +
728 bool onTheFly);
│ │ │ │ +
729 };
│ │ │ │ +
│ │ │ │ +
730
│ │ │ │ +
731 template<class M,class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
734 {};
│ │ │ │ +
│ │ │ │ +
735
│ │ │ │ +
736 template<class M,class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
739 {};
│ │ │ │ +
│ │ │ │ +
740
│ │ │ │ +
751 template<class M, class X, class TM=AdditiveSchwarzMode,
│ │ │ │ +
752 class TD=ILU0SubdomainSolver<M,X,X>, class TA=std::allocator<X> >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
754 : public Preconditioner<X,X>
│ │ │ │ +
755 {
│ │ │ │ +
756 public:
│ │ │ │ +
760 typedef M matrix_type;
│ │ │ │ +
761
│ │ │ │ +
765 typedef X domain_type;
│ │ │ │ +
766
│ │ │ │ +
770 typedef X range_type;
│ │ │ │ +
771
│ │ │ │ +
778 typedef TM Mode;
│ │ │ │ +
779
│ │ │ │ +
783 typedef typename X::field_type field_type;
│ │ │ │ +
784
│ │ │ │ +
786 typedef typename matrix_type::size_type size_type;
│ │ │ │ +
787
│ │ │ │ +
789 typedef TA allocator;
│ │ │ │ +
790
│ │ │ │ +
792 typedef std::set<size_type, std::less<size_type>,
│ │ │ │ +
793 typename std::allocator_traits<TA>::template rebind_alloc<size_type> >
│ │ │ │ + │ │ │ │ +
795
│ │ │ │ +
797 typedef std::vector<subdomain_type, typename std::allocator_traits<TA>::template rebind_alloc<subdomain_type> > subdomain_vector;
│ │ │ │ +
798
│ │ │ │ + │ │ │ │ +
801
│ │ │ │ +
803 typedef std::vector<subdomain_list, typename std::allocator_traits<TA>::template rebind_alloc<subdomain_list> > rowtodomain_vector;
│ │ │ │ +
804
│ │ │ │ +
806 typedef TD slu;
│ │ │ │ +
807
│ │ │ │ +
809 typedef std::vector<slu, typename std::allocator_traits<TA>::template rebind_alloc<slu> > slu_vector;
│ │ │ │ +
810
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
825 field_type relaxationFactor=1, bool onTheFly_=true);
│ │ │ │ +
826
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
839 field_type relaxationFactor=1, bool onTheFly_=true);
│ │ │ │ +
840
│ │ │ │ +
│ │ │ │ +
846 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] X& b)
│ │ │ │ +
847 {}
│ │ │ │ +
│ │ │ │ +
848
│ │ │ │ +
│ │ │ │ +
854 virtual void apply (X& v, const X& d);
│ │ │ │ +
855
│ │ │ │ +
│ │ │ │ +
861 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ +
862 {}
│ │ │ │ +
│ │ │ │ +
863
│ │ │ │ +
864 template<bool forward>
│ │ │ │ +
│ │ │ │ +
865 void apply(X& v, const X& d);
│ │ │ │ +
866
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
869 {
│ │ │ │ + │ │ │ │ +
871 }
│ │ │ │ +
│ │ │ │ +
872
│ │ │ │ +
873 private:
│ │ │ │ +
874 const M& mat;
│ │ │ │ +
875 slu_vector solvers;
│ │ │ │ +
876 subdomain_vector subDomains;
│ │ │ │ +
877 field_type relax;
│ │ │ │ +
878
│ │ │ │ +
879 typename M::size_type maxlength;
│ │ │ │ +
880
│ │ │ │ +
881 bool onTheFly;
│ │ │ │ +
882 };
│ │ │ │ +
883
│ │ │ │ +
884
│ │ │ │ +
885
│ │ │ │ +
886 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
888 const IndexSet& idx,
│ │ │ │ +
889 const subdomain_vector& domains_)
│ │ │ │ +
890 : initializers(&il), indices(&idx), indexMaps(il.size()), domains(domains_)
│ │ │ │ +
891 {}
│ │ │ │ +
│ │ │ │ +
892
│ │ │ │ +
893
│ │ │ │ +
894 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
896 {
│ │ │ │ +
897 typedef typename IndexSet::value_type::const_iterator iterator;
│ │ │ │ +
898 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices)[row.index()].end(); ++domain) {
│ │ │ │ +
899 (*initializers)[*domain].addRowNnz(row, domains[*domain]);
│ │ │ │ +
900 indexMaps[*domain].insert(row.index());
│ │ │ │ +
901 }
│ │ │ │ +
902 }
│ │ │ │ +
│ │ │ │ +
903
│ │ │ │ +
904 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
906 {
│ │ │ │ +
907 for(auto&& i: *initializers)
│ │ │ │ +
908 i.allocateMatrixStorage();
│ │ │ │ +
909 for(auto&& i: *initializers)
│ │ │ │ +
910 i.allocateMarker();
│ │ │ │ +
911 }
│ │ │ │ +
│ │ │ │ +
912
│ │ │ │ +
913 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
915 {
│ │ │ │ +
916 typedef typename IndexSet::value_type::const_iterator iterator;
│ │ │ │ +
917 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices)[row.index()].end(); ++domain) {
│ │ │ │ +
918 typename std::map<size_type,size_type>::const_iterator v = indexMaps[*domain].find(col.index());
│ │ │ │ +
919 if(v!= indexMaps[*domain].end()) {
│ │ │ │ +
920 (*initializers)[*domain].countEntries(indexMaps[*domain].find(col.index())->second);
│ │ │ │ +
921 }
│ │ │ │ +
922 }
│ │ │ │ +
923 }
│ │ │ │ +
│ │ │ │ +
924
│ │ │ │ +
925 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
927 {
│ │ │ │ +
928 for(auto&& i : *initializers)
│ │ │ │ +
929 i.calcColstart();
│ │ │ │ +
930 }
│ │ │ │ +
│ │ │ │ +
931
│ │ │ │ +
932 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
934 {
│ │ │ │ +
935 typedef typename IndexSet::value_type::const_iterator iterator;
│ │ │ │ +
936 for(iterator domain=(*indices)[row.index()].begin(); domain!= (*indices)[row.index()].end(); ++domain) {
│ │ │ │ +
937 typename std::map<size_type,size_type>::const_iterator v = indexMaps[*domain].find(col.index());
│ │ │ │ +
938 if(v!= indexMaps[*domain].end()) {
│ │ │ │ +
939 assert(indexMaps[*domain].end()!=indexMaps[*domain].find(row.index()));
│ │ │ │ +
940 (*initializers)[*domain].copyValue(col, indexMaps[*domain].find(row.index())->second,
│ │ │ │ +
941 v->second);
│ │ │ │ +
942 }
│ │ │ │ +
943 }
│ │ │ │ +
944 }
│ │ │ │ +
│ │ │ │ +
945
│ │ │ │ +
946 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
948 {
│ │ │ │ +
949 std::vector<IndexMap>().swap(indexMaps);
│ │ │ │ +
950 for(auto&& i: *initializers)
│ │ │ │ +
951 i.createMatrix();
│ │ │ │ +
952 }
│ │ │ │ +
│ │ │ │ +
953
│ │ │ │ +
954 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
956 : row(0)
│ │ │ │ +
957 {}
│ │ │ │ +
│ │ │ │ +
958
│ │ │ │ +
959 template<class I, class S, class D>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
961 {
│ │ │ │ +
962 assert(map_.find(grow)==map_.end());
│ │ │ │ +
963 map_.insert(std::make_pair(grow, row++));
│ │ │ │ +
964 }
│ │ │ │ +
│ │ │ │ +
965
│ │ │ │ +
966 template<class I, class S, class D>
│ │ │ │ +
967 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
969 {
│ │ │ │ +
970 return map_.find(grow);
│ │ │ │ +
971 }
│ │ │ │ +
│ │ │ │ +
972
│ │ │ │ +
973 template<class I, class S, class D>
│ │ │ │ +
974 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
976 {
│ │ │ │ +
977 return map_.find(grow);
│ │ │ │ +
978 }
│ │ │ │ +
│ │ │ │ +
979
│ │ │ │ +
980 template<class I, class S, class D>
│ │ │ │ +
981 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
983 {
│ │ │ │ +
984 return map_.end();
│ │ │ │ +
985 }
│ │ │ │ +
│ │ │ │ +
986
│ │ │ │ +
987 template<class I, class S, class D>
│ │ │ │ +
988 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
990 {
│ │ │ │ +
991 return map_.end();
│ │ │ │ +
992 }
│ │ │ │ +
│ │ │ │ +
993
│ │ │ │ +
994 template<class I, class S, class D>
│ │ │ │ +
995 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
997 {
│ │ │ │ +
998 return map_.begin();
│ │ │ │ +
999 }
│ │ │ │ +
│ │ │ │ +
1000
│ │ │ │ +
1001 template<class I, class S, class D>
│ │ │ │ +
1002 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1004 {
│ │ │ │ +
1005 return map_.begin();
│ │ │ │ +
1006 }
│ │ │ │ +
│ │ │ │ +
1007
│ │ │ │ +
1008 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1010 field_type relaxationFactor, bool fly)
│ │ │ │ +
1011 : mat(mat_), relax(relaxationFactor), onTheFly(fly)
│ │ │ │ +
1012 {
│ │ │ │ +
1013 typedef typename rowtodomain_vector::const_iterator RowDomainIterator;
│ │ │ │ +
1014 typedef typename subdomain_list::const_iterator DomainIterator;
│ │ │ │ +
1015#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1016 assert(rowToDomain.size()==mat.N());
│ │ │ │ +
1017 assert(rowToDomain.size()==mat.M());
│ │ │ │ +
1018
│ │ │ │ +
1019 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter)
│ │ │ │ +
1020 assert(iter->size()>0);
│ │ │ │ +
1021
│ │ │ │ +
1022#endif
│ │ │ │ +
1023 // calculate the number of domains
│ │ │ │ +
1024 size_type domains=0;
│ │ │ │ +
1025 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter)
│ │ │ │ +
1026 for(DomainIterator d=iter->begin(); d != iter->end(); ++d)
│ │ │ │ +
1027 domains=std::max(domains, *d);
│ │ │ │ +
1028 ++domains;
│ │ │ │ +
1029
│ │ │ │ +
1030 solvers.resize(domains);
│ │ │ │ +
1031 subDomains.resize(domains);
│ │ │ │ +
1032
│ │ │ │ +
1033 // initialize subdomains to row mapping from row to subdomain mapping
│ │ │ │ +
1034 size_type row=0;
│ │ │ │ +
1035 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter, ++row)
│ │ │ │ +
1036 for(DomainIterator d=iter->begin(); d != iter->end(); ++d)
│ │ │ │ +
1037 subDomains[*d].insert(row);
│ │ │ │ +
1038
│ │ │ │ +
1039#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1040 size_type i=0;
│ │ │ │ +
1041 typedef typename subdomain_vector::const_iterator iterator;
│ │ │ │ +
1042 for(iterator iter=subDomains.begin(); iter != subDomains.end(); ++iter) {
│ │ │ │ +
1043 typedef typename subdomain_type::const_iterator entry_iterator;
│ │ │ │ +
1044 Dune::dvverb<<"domain "<<i++<<":";
│ │ │ │ +
1045 for(entry_iterator entry = iter->begin(); entry != iter->end(); ++entry) {
│ │ │ │ +
1046 Dune::dvverb<<" "<<*entry;
│ │ │ │ +
1047 }
│ │ │ │ +
1048 Dune::dvverb<<std::endl;
│ │ │ │ +
1049 }
│ │ │ │ +
1050#endif
│ │ │ │ + │ │ │ │ +
1052 ::assembleLocalProblems(rowToDomain, mat, solvers, subDomains, onTheFly);
│ │ │ │ +
1053 }
│ │ │ │ +
│ │ │ │ +
1054
│ │ │ │ +
1055 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1057 const subdomain_vector& sd,
│ │ │ │ +
1058 field_type relaxationFactor,
│ │ │ │ +
1059 bool fly)
│ │ │ │ +
1060 : mat(mat_), solvers(sd.size()), subDomains(sd), relax(relaxationFactor),
│ │ │ │ +
1061 onTheFly(fly)
│ │ │ │ +
1062 {
│ │ │ │ +
1063 typedef typename subdomain_vector::const_iterator DomainIterator;
│ │ │ │ +
1064
│ │ │ │ +
1065#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1066 size_type i=0;
│ │ │ │ +
1067
│ │ │ │ +
1068 for(DomainIterator d=sd.begin(); d != sd.end(); ++d,++i) {
│ │ │ │ +
1069 //std::cout<<i<<": "<<d->size()<<std::endl;
│ │ │ │ +
1070 assert(d->size()>0);
│ │ │ │ +
1071 typedef typename DomainIterator::value_type::const_iterator entry_iterator;
│ │ │ │ +
1072 Dune::dvverb<<"domain "<<i<<":";
│ │ │ │ +
1073 for(entry_iterator entry = d->begin(); entry != d->end(); ++entry) {
│ │ │ │ +
1074 Dune::dvverb<<" "<<*entry;
│ │ │ │ +
1075 }
│ │ │ │ +
1076 Dune::dvverb<<std::endl;
│ │ │ │ +
1077 }
│ │ │ │ +
1078
│ │ │ │ +
1079#endif
│ │ │ │ +
1080
│ │ │ │ +
1081 // Create a row to subdomain mapping
│ │ │ │ + │ │ │ │ +
1083
│ │ │ │ + │ │ │ │ +
1085
│ │ │ │ +
1086 for(DomainIterator domain=sd.begin(); domain != sd.end(); ++domain, ++domainId) {
│ │ │ │ +
1087 typedef typename subdomain_type::const_iterator iterator;
│ │ │ │ +
1088 for(iterator row=domain->begin(); row != domain->end(); ++row)
│ │ │ │ +
1089 rowToDomain[*row].push_back(domainId);
│ │ │ │ +
1090 }
│ │ │ │ +
1091
│ │ │ │ + │ │ │ │ +
1093 ::assembleLocalProblems(rowToDomain, mat, solvers, subDomains, onTheFly);
│ │ │ │ +
1094 }
│ │ │ │ +
│ │ │ │ +
1095
│ │ │ │ +
1102 template<class M>
│ │ │ │ + │ │ │ │ +
1104
│ │ │ │ +
1105 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1107 {
│ │ │ │ +
1108 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::rows;
│ │ │ │ +
1109 static constexpr size_t m = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::cols;
│ │ │ │ +
1110 template<class Domain>
│ │ │ │ +
│ │ │ │ +
1111 static int size(const Domain & d)
│ │ │ │ +
1112 {
│ │ │ │ +
1113 assert(n==m);
│ │ │ │ +
1114 return m*d.size();
│ │ │ │ +
1115 }
│ │ │ │ +
│ │ │ │ +
1116 };
│ │ │ │ +
│ │ │ │ +
1117
│ │ │ │ +
1118 template<class K, class Al, class X, class Y>
│ │ │ │ +
1119 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ +
1120 std::size_t
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1122 assembleLocalProblems([[maybe_unused]] const RowToDomain& rowToDomain,
│ │ │ │ +
1123 [[maybe_unused]] const matrix_type& mat,
│ │ │ │ +
1124 [[maybe_unused]] Solvers& solvers,
│ │ │ │ +
1125 const SubDomains& subDomains,
│ │ │ │ +
1126 [[maybe_unused]] bool onTheFly)
│ │ │ │ +
1127 {
│ │ │ │ +
1128 typedef typename SubDomains::const_iterator DomainIterator;
│ │ │ │ +
1129 std::size_t maxlength = 0;
│ │ │ │ +
1130
│ │ │ │ +
1131 assert(onTheFly);
│ │ │ │ +
1132
│ │ │ │ +
1133 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
│ │ │ │ +
1134 maxlength=std::max(maxlength, domain->size());
│ │ │ │ +
1135 maxlength*=n;
│ │ │ │ +
1136
│ │ │ │ +
1137 return maxlength;
│ │ │ │ +
1138 }
│ │ │ │ +
│ │ │ │ +
1139
│ │ │ │ +
1140#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
1141 template<template<class> class S, typename T, typename A>
│ │ │ │ +
1142 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ +
│ │ │ │ +
1143 std::size_t SeqOverlappingSchwarzAssemblerHelper<S<BCRSMatrix<T,A>>,true>::assembleLocalProblems(const RowToDomain& rowToDomain,
│ │ │ │ +
1144 const matrix_type& mat,
│ │ │ │ +
1145 Solvers& solvers,
│ │ │ │ +
1146 const SubDomains& subDomains,
│ │ │ │ +
1147 bool onTheFly)
│ │ │ │ +
1148 {
│ │ │ │ +
1149 typedef typename S<BCRSMatrix<T,A>>::MatrixInitializer MatrixInitializer;
│ │ │ │ +
1150 typedef typename std::vector<MatrixInitializer>::iterator InitializerIterator;
│ │ │ │ +
1151 typedef typename SubDomains::const_iterator DomainIterator;
│ │ │ │ +
1152 typedef typename Solvers::iterator SolverIterator;
│ │ │ │ +
1153 std::size_t maxlength = 0;
│ │ │ │ +
1154
│ │ │ │ +
1155 if(onTheFly) {
│ │ │ │ +
1156 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
│ │ │ │ +
1157 maxlength=std::max(maxlength, domain->size());
│ │ │ │ +
1158 maxlength*=Impl::asMatrix(*mat[0].begin()).N();
│ │ │ │ +
1159 }else{
│ │ │ │ +
1160 // initialize the initializers
│ │ │ │ +
1161 DomainIterator domain=subDomains.begin();
│ │ │ │ +
1162
│ │ │ │ +
1163 // Create the initializers list.
│ │ │ │ +
1164 std::vector<MatrixInitializer> initializers(subDomains.size());
│ │ │ │ +
1165
│ │ │ │ +
1166 SolverIterator solver=solvers.begin();
│ │ │ │ +
1167 for(InitializerIterator initializer=initializers.begin(); initializer!=initializers.end();
│ │ │ │ +
1168 ++initializer, ++solver, ++domain) {
│ │ │ │ +
1169 solver->getInternalMatrix().N_=SeqOverlappingSchwarzDomainSize<matrix_type>::size(*domain);
│ │ │ │ +
1170 solver->getInternalMatrix().M_=SeqOverlappingSchwarzDomainSize<matrix_type>::size(*domain);
│ │ │ │ +
1171 //solver->setVerbosity(true);
│ │ │ │ +
1172 *initializer=MatrixInitializer(solver->getInternalMatrix());
│ │ │ │ +
1173 }
│ │ │ │ +
1174
│ │ │ │ +
1175 // Set up the supermatrices according to the subdomains
│ │ │ │ + │ │ │ │ +
1177 RowToDomain, SubDomains> Initializer;
│ │ │ │ +
1178
│ │ │ │ +
1179 Initializer initializer(initializers, rowToDomain, subDomains);
│ │ │ │ +
1180 copyToBCCSMatrix(initializer, mat);
│ │ │ │ +
1181
│ │ │ │ +
1182 // Calculate the LU decompositions
│ │ │ │ +
1183 for(auto&& s: solvers)
│ │ │ │ +
1184 s.decompose();
│ │ │ │ +
1185 for (SolverIterator solverIt = solvers.begin(); solverIt != solvers.end(); ++solverIt)
│ │ │ │ +
1186 {
│ │ │ │ +
1187 assert(solverIt->getInternalMatrix().N() == solverIt->getInternalMatrix().M());
│ │ │ │ +
1188 maxlength = std::max(maxlength, solverIt->getInternalMatrix().N());
│ │ │ │ +
1189 }
│ │ │ │ +
1190 }
│ │ │ │ +
1191 return maxlength;
│ │ │ │ +
1192 }
│ │ │ │ +
│ │ │ │ +
1193
│ │ │ │ +
1194#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
1195
│ │ │ │ +
1196 template<class M,class X,class Y>
│ │ │ │ +
1197 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ +
│ │ │ │ +
1198 std::size_t SeqOverlappingSchwarzAssemblerILUBase<M,X,Y>::assembleLocalProblems([[maybe_unused]] const RowToDomain& rowToDomain,
│ │ │ │ +
1199 const matrix_type& mat,
│ │ │ │ +
1200 Solvers& solvers,
│ │ │ │ +
1201 const SubDomains& subDomains,
│ │ │ │ +
1202 bool onTheFly)
│ │ │ │ +
1203 {
│ │ │ │ +
1204 typedef typename SubDomains::const_iterator DomainIterator;
│ │ │ │ +
1205 typedef typename Solvers::iterator SolverIterator;
│ │ │ │ +
1206 std::size_t maxlength = 0;
│ │ │ │ +
1207
│ │ │ │ +
1208 if(onTheFly) {
│ │ │ │ +
1209 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
│ │ │ │ +
1210 maxlength=std::max(maxlength, domain->size());
│ │ │ │ +
1211 }else{
│ │ │ │ +
1212 // initialize the solvers of the local prolems.
│ │ │ │ +
1213 SolverIterator solver=solvers.begin();
│ │ │ │ +
1214 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end();
│ │ │ │ +
1215 ++domain, ++solver) {
│ │ │ │ +
1216 solver->setSubMatrix(mat, *domain);
│ │ │ │ +
1217 maxlength=std::max(maxlength, domain->size());
│ │ │ │ +
1218 }
│ │ │ │ +
1219 }
│ │ │ │ +
1220
│ │ │ │ +
1221 return maxlength;
│ │ │ │ +
1222
│ │ │ │ +
1223 }
│ │ │ │ +
│ │ │ │ +
1224
│ │ │ │ +
1225
│ │ │ │ +
1226 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1228 {
│ │ │ │ + │ │ │ │ +
1230 }
│ │ │ │ +
│ │ │ │ +
1231
│ │ │ │ +
1232 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ +
1233 template<bool forward>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1235 {
│ │ │ │ +
1236 typedef slu_vector solver_vector;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
1239 domain_iterator;
│ │ │ │ +
1240
│ │ │ │ +
1241 OverlappingAssigner<TD> assigner(maxlength, mat, b, x);
│ │ │ │ +
1242
│ │ │ │ + │ │ │ │ + │ │ │ │ +
1245 X v(x); // temporary for the update
│ │ │ │ +
1246 v=0;
│ │ │ │ +
1247
│ │ │ │ +
1248 typedef typename AdderSelector<TM,X,TD >::Adder Adder;
│ │ │ │ +
1249 Adder adder(v, x, assigner, relax);
│ │ │ │ +
1250
│ │ │ │ + │ │ │ │ +
1252 //Copy rhs to C-array for SuperLU
│ │ │ │ +
1253 std::for_each(domain->begin(), domain->end(), assigner);
│ │ │ │ +
1254 assigner.resetIndexForNextDomain();
│ │ │ │ +
1255 if(onTheFly) {
│ │ │ │ +
1256 // Create the subdomain solver
│ │ │ │ +
1257 slu sdsolver;
│ │ │ │ +
1258 sdsolver.setSubMatrix(mat, *domain);
│ │ │ │ +
1259 // Apply
│ │ │ │ +
1260 sdsolver.apply(assigner.lhs(), assigner.rhs());
│ │ │ │ +
1261 }else{
│ │ │ │ +
1262 solver->apply(assigner.lhs(), assigner.rhs());
│ │ │ │ +
1263 ++solver;
│ │ │ │ +
1264 }
│ │ │ │ +
1265
│ │ │ │ +
1266 //Add relaxed correction to from SuperLU to v
│ │ │ │ +
1267 std::for_each(domain->begin(), domain->end(), adder);
│ │ │ │ +
1268 assigner.resetIndexForNextDomain();
│ │ │ │ +
1269
│ │ │ │ +
1270 }
│ │ │ │ +
1271
│ │ │ │ +
1272 adder.axpy();
│ │ │ │ +
1273 assigner.deallocate();
│ │ │ │ +
1274 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
1275
│ │ │ │ +
1276 template<class K, class Al, class X, class Y>
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1278 ::OverlappingAssignerHelper(std::size_t maxlength, const BCRSMatrix<K, Al>& mat_,
│ │ │ │ +
1279 const X& b_, Y& x_) :
│ │ │ │ +
1280 mat(&mat_),
│ │ │ │ +
1281 rhs_( new DynamicVector<field_type>(maxlength, 42) ),
│ │ │ │ +
1282 lhs_( new DynamicVector<field_type>(maxlength, -42) ),
│ │ │ │ +
1283 b(&b_),
│ │ │ │ +
1284 x(&x_),
│ │ │ │ +
1285 i(0),
│ │ │ │ +
1286 maxlength_(maxlength)
│ │ │ │ +
1287 {}
│ │ │ │ +
│ │ │ │ +
1288
│ │ │ │ +
1289 template<class K, class Al, class X, class Y>
│ │ │ │ +
1290 void
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1292 ::deallocate()
│ │ │ │ +
1293 {
│ │ │ │ +
1294 delete rhs_;
│ │ │ │ +
1295 delete lhs_;
│ │ │ │ +
1296 }
│ │ │ │ +
│ │ │ │ +
1297
│ │ │ │ +
1298 template<class K, class Al, class X, class Y>
│ │ │ │ +
1299 void
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1301 ::resetIndexForNextDomain()
│ │ │ │ +
1302 {
│ │ │ │ +
1303 i=0;
│ │ │ │ +
1304 }
│ │ │ │ +
│ │ │ │ +
1305
│ │ │ │ +
1306 template<class K, class Al, class X, class Y>
│ │ │ │ +
1307 DynamicVector<typename X::field_type> &
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1309 ::lhs()
│ │ │ │ +
1310 {
│ │ │ │ +
1311 return *lhs_;
│ │ │ │ +
1312 }
│ │ │ │ +
│ │ │ │ +
1313
│ │ │ │ +
1314 template<class K, class Al, class X, class Y>
│ │ │ │ +
1315 DynamicVector<typename X::field_type> &
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1317 ::rhs()
│ │ │ │ +
1318 {
│ │ │ │ +
1319 return *rhs_;
│ │ │ │ +
1320 }
│ │ │ │ +
│ │ │ │ +
1321
│ │ │ │ +
1322 template<class K, class Al, class X, class Y>
│ │ │ │ +
1323 void
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1325 ::relaxResult(field_type relax)
│ │ │ │ +
1326 {
│ │ │ │ +
1327 lhs() *= relax;
│ │ │ │ +
1328 }
│ │ │ │ +
│ │ │ │ +
1329
│ │ │ │ +
1330 template<class K, class Al, class X, class Y>
│ │ │ │ +
1331 void
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1333 ::operator()(const size_type& domainIndex)
│ │ │ │ +
1334 {
│ │ │ │ +
1335 lhs() = 0.0;
│ │ │ │ +
1336#if 0
│ │ │ │ +
1337 //assign right hand side of current domainindex block
│ │ │ │ +
1338 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ +
1339 assert(i<maxlength_);
│ │ │ │ +
1340 rhs()[i]=(*b)[domainIndex][j];
│ │ │ │ +
1341 }
│ │ │ │ +
1342
│ │ │ │ +
1343 // loop over all Matrix row entries and calculate defect.
│ │ │ │ +
1344 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ +
1345
│ │ │ │ +
1346 // calculate defect for current row index block
│ │ │ │ +
1347 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ +
1348 block_type tmp(0.0);
│ │ │ │ +
1349 (*col).mv((*x)[col.index()], tmp);
│ │ │ │ +
1350 i-=n;
│ │ │ │ +
1351 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ +
1352 assert(i<maxlength_);
│ │ │ │ +
1353 rhs()[i]-=tmp[j];
│ │ │ │ +
1354 }
│ │ │ │ +
1355 }
│ │ │ │ +
1356#else
│ │ │ │ +
1357 //assign right hand side of current domainindex block
│ │ │ │ +
1358 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ +
1359 assert(i<maxlength_);
│ │ │ │ +
1360 rhs()[i]=Impl::asVector((*b)[domainIndex])[j];
│ │ │ │ +
1361
│ │ │ │ +
1362 // loop over all Matrix row entries and calculate defect.
│ │ │ │ +
1363 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ +
1364
│ │ │ │ +
1365 // calculate defect for current row index block
│ │ │ │ +
1366 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ +
1367 for(size_type k=0; k<n; ++k) {
│ │ │ │ +
1368 rhs()[i]-=Impl::asMatrix(*col)[j][k] * Impl::asVector((*x)[col.index()])[k];
│ │ │ │ +
1369 }
│ │ │ │ +
1370 }
│ │ │ │ +
1371 }
│ │ │ │ +
1372#endif
│ │ │ │ +
1373 }
│ │ │ │ +
│ │ │ │ +
1374
│ │ │ │ +
1375 template<class K, class Al, class X, class Y>
│ │ │ │ +
1376 void
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1378 ::assignResult(block_type& res)
│ │ │ │ +
1379 {
│ │ │ │ +
1380 // assign the result of the local solve to the global vector
│ │ │ │ +
1381 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ +
1382 assert(i<maxlength_);
│ │ │ │ +
1383 Impl::asVector(res)[j]+=lhs()[i];
│ │ │ │ +
1384 }
│ │ │ │ +
1385 }
│ │ │ │ +
│ │ │ │ +
1386
│ │ │ │ +
1387#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
1388
│ │ │ │ +
1389 template<template<class> class S, typename T, typename A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1391 ::OverlappingAssignerHelper(std::size_t maxlength,
│ │ │ │ +
1392 const BCRSMatrix<T,A>& mat_,
│ │ │ │ +
1393 const range_type& b_,
│ │ │ │ +
1394 range_type& x_)
│ │ │ │ +
1395 : mat(&mat_),
│ │ │ │ +
1396 b(&b_),
│ │ │ │ +
1397 x(&x_), i(0), maxlength_(maxlength)
│ │ │ │ +
1398 {
│ │ │ │ +
1399 rhs_ = new field_type[maxlength];
│ │ │ │ +
1400 lhs_ = new field_type[maxlength];
│ │ │ │ +
1401
│ │ │ │ +
1402 }
│ │ │ │ +
│ │ │ │ +
1403
│ │ │ │ +
1404 template<template<class> class S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1406 {
│ │ │ │ +
1407 delete[] rhs_;
│ │ │ │ +
1408 delete[] lhs_;
│ │ │ │ +
1409 }
│ │ │ │ +
│ │ │ │ +
1410
│ │ │ │ +
1411 template<template<class> class S, typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1412 void OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::operator()(const size_type& domainIndex)
│ │ │ │ +
1413 {
│ │ │ │ +
1414 //assign right hand side of current domainindex block
│ │ │ │ +
1415 // rhs is an array of doubles!
│ │ │ │ +
1416 // rhs[starti] = b[domainindex]
│ │ │ │ +
1417 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ +
1418 assert(i<maxlength_);
│ │ │ │ +
1419 rhs_[i]=Impl::asVector((*b)[domainIndex])[j];
│ │ │ │ +
1420 }
│ │ │ │ +
1421
│ │ │ │ +
1422
│ │ │ │ +
1423 // loop over all Matrix row entries and calculate defect.
│ │ │ │ +
1424 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ +
1425
│ │ │ │ +
1426 // calculate defect for current row index block
│ │ │ │ +
1427 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ +
1428 block_type tmp;
│ │ │ │ +
1429 Impl::asMatrix(*col).mv((*x)[col.index()], tmp);
│ │ │ │ +
1430 i-=n;
│ │ │ │ +
1431 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ +
1432 assert(i<maxlength_);
│ │ │ │ +
1433 rhs_[i]-=Impl::asVector(tmp)[j];
│ │ │ │ +
1434 }
│ │ │ │ +
1435
│ │ │ │ +
1436 }
│ │ │ │ +
1437
│ │ │ │ +
1438 }
│ │ │ │ +
│ │ │ │ +
1439
│ │ │ │ +
1440 template<template<class> class S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1442 {
│ │ │ │ +
1443 for(size_type j=i+n; i<j; ++i) {
│ │ │ │ +
1444 assert(i<maxlength_);
│ │ │ │ +
1445 lhs_[i]*=relax;
│ │ │ │ +
1446 }
│ │ │ │ +
1447 i-=n;
│ │ │ │ +
1448 }
│ │ │ │ +
│ │ │ │ +
1449
│ │ │ │ +
1450 template<template<class> class S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1452 {
│ │ │ │ +
1453 // assign the result of the local solve to the global vector
│ │ │ │ +
1454 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ +
1455 assert(i<maxlength_);
│ │ │ │ +
1456 Impl::asVector(res)[j]+=lhs_[i];
│ │ │ │ +
1457 }
│ │ │ │ +
1458 }
│ │ │ │ +
│ │ │ │ +
1459
│ │ │ │ +
1460 template<template<class> class S, typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1461 void OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::resetIndexForNextDomain()
│ │ │ │ +
1462 {
│ │ │ │ +
1463 i=0;
│ │ │ │ +
1464 }
│ │ │ │ +
│ │ │ │ +
1465
│ │ │ │ +
1466 template<template<class> class S, typename T, typename A>
│ │ │ │ +
1467 typename OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::field_type*
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1469 {
│ │ │ │ +
1470 return lhs_;
│ │ │ │ +
1471 }
│ │ │ │ +
│ │ │ │ +
1472
│ │ │ │ +
1473 template<template<class> class S, typename T, typename A>
│ │ │ │ +
1474 typename OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::field_type*
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1476 {
│ │ │ │ +
1477 return rhs_;
│ │ │ │ +
1478 }
│ │ │ │ +
│ │ │ │ +
1479
│ │ │ │ +
1480#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
1481
│ │ │ │ +
1482 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1484 const M& mat_,
│ │ │ │ +
1485 const Y& b_,
│ │ │ │ +
1486 X& x_)
│ │ │ │ +
1487 : mat(&mat_),
│ │ │ │ +
1488 b(&b_),
│ │ │ │ +
1489 x(&x_), i(0)
│ │ │ │ +
1490 {
│ │ │ │ +
1491 rhs_= new Y(maxlength);
│ │ │ │ +
1492 lhs_ = new X(maxlength);
│ │ │ │ +
1493 }
│ │ │ │ +
│ │ │ │ +
1494
│ │ │ │ +
1495 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1497 {
│ │ │ │ +
1498 delete rhs_;
│ │ │ │ +
1499 delete lhs_;
│ │ │ │ +
1500 }
│ │ │ │ +
│ │ │ │ +
1501
│ │ │ │ +
1502 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1504 {
│ │ │ │ +
1505 (*rhs_)[i]=(*b)[domainIndex];
│ │ │ │ +
1506
│ │ │ │ +
1507 // loop over all Matrix row entries and calculate defect.
│ │ │ │ +
1508 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ +
1509
│ │ │ │ +
1510 // calculate defect for current row index block
│ │ │ │ +
1511 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ +
1512 Impl::asMatrix(*col).mmv((*x)[col.index()], (*rhs_)[i]);
│ │ │ │ +
1513 }
│ │ │ │ +
1514 // Goto next local index
│ │ │ │ +
1515 ++i;
│ │ │ │ +
1516 }
│ │ │ │ +
│ │ │ │ +
1517
│ │ │ │ +
1518 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1520 {
│ │ │ │ +
1521 (*lhs_)[i]*=relax;
│ │ │ │ +
1522 }
│ │ │ │ +
│ │ │ │ +
1523
│ │ │ │ +
1524 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1526 {
│ │ │ │ +
1527 res+=(*lhs_)[i++];
│ │ │ │ +
1528 }
│ │ │ │ +
│ │ │ │ +
1529
│ │ │ │ +
1530 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1532 {
│ │ │ │ +
1533 return *lhs_;
│ │ │ │ +
1534 }
│ │ │ │ +
│ │ │ │ +
1535
│ │ │ │ +
1536 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1538 {
│ │ │ │ +
1539 return *rhs_;
│ │ │ │ +
1540 }
│ │ │ │ +
│ │ │ │ +
1541
│ │ │ │ +
1542 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1544 {
│ │ │ │ +
1545 i=0;
│ │ │ │ +
1546 }
│ │ │ │ +
│ │ │ │ +
1547
│ │ │ │ +
1548 template<typename S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1550 BlockVector<T,A>& x_,
│ │ │ │ +
1551 OverlappingAssigner<S>& assigner_,
│ │ │ │ +
1552 const field_type& relax_)
│ │ │ │ +
1553 : v(&v_), x(&x_), assigner(&assigner_), relax(relax_)
│ │ │ │ +
1554 {}
│ │ │ │ +
│ │ │ │ +
1555
│ │ │ │ +
1556 template<typename S, typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1557 void AdditiveAdder<S,BlockVector<T,A> >::operator()(const size_type& domainIndex)
│ │ │ │ +
1558 {
│ │ │ │ +
1559 // add the result of the local solve to the current update
│ │ │ │ +
1560 assigner->assignResult((*v)[domainIndex]);
│ │ │ │ +
1561 }
│ │ │ │ +
│ │ │ │ +
1562
│ │ │ │ +
1563
│ │ │ │ +
1564 template<typename S, typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1566 {
│ │ │ │ +
1567 // relax the update and add it to the current guess.
│ │ │ │ +
1568 x->axpy(relax,*v);
│ │ │ │ +
1569 }
│ │ │ │ +
│ │ │ │ +
1570
│ │ │ │ +
1571
│ │ │ │ +
1572 template<typename S, typename T, typename A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
1574 ::MultiplicativeAdder([[maybe_unused]] BlockVector<T,A>& v_,
│ │ │ │ +
1575 BlockVector<T,A>& x_,
│ │ │ │ +
1576 OverlappingAssigner<S>& assigner_, const field_type& relax_)
│ │ │ │ +
1577 : x(&x_), assigner(&assigner_), relax(relax_)
│ │ │ │ +
1578 {}
│ │ │ │ +
│ │ │ │ +
1579
│ │ │ │ +
1580
│ │ │ │ +
1581 template<typename S,typename T, typename A>
│ │ │ │ +
│ │ │ │ +
1582 void MultiplicativeAdder<S,BlockVector<T,A> >::operator()(const size_type& domainIndex)
│ │ │ │ +
1583 {
│ │ │ │ +
1584 // add the result of the local solve to the current guess
│ │ │ │ +
1585 assigner->relaxResult(relax);
│ │ │ │ +
1586 assigner->assignResult((*x)[domainIndex]);
│ │ │ │ +
1587 }
│ │ │ │ +
│ │ │ │ +
1588
│ │ │ │ +
1589
│ │ │ │ +
1590 template<typename S,typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1592 {
│ │ │ │ +
1593 // nothing to do, as the corrections already relaxed and added in operator()
│ │ │ │ +
1594 }
│ │ │ │ +
│ │ │ │ +
1595
│ │ │ │ +
1596
│ │ │ │ +
1598}
│ │ │ │ +
1599
│ │ │ │ +
1600#endif
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
Define general preconditioner interface.
│ │ │ │ +
Classes for using SuperLU with ISTL matrices.
│ │ │ │ + │ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
Templates characterizing the type of a solver.
│ │ │ │ +
Classes for using UMFPack with ISTL matrices.
│ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ +
Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
void addRowNnz(const Iter &row)
Definition overlappingschwarz.hh:895
│ │ │ │ +
void apply(X &v, const X &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition overlappingschwarz.hh:1234
│ │ │ │ +
X & lhs()
Get the local left hand side.
Definition overlappingschwarz.hh:1531
│ │ │ │ +
void calcColstart() const
Definition overlappingschwarz.hh:926
│ │ │ │ +
Y & rhs()
Get the local right hand side.
Definition overlappingschwarz.hh:1537
│ │ │ │ +
iterator end()
Definition overlappingschwarz.hh:989
│ │ │ │ +
void resetIndexForNextDomain()
Resets the local index to zero.
Definition overlappingschwarz.hh:1543
│ │ │ │ +
void copyValue(const Iter &row, const CIter &col) const
Definition overlappingschwarz.hh:933
│ │ │ │ +
void createMatrix() const
Definition overlappingschwarz.hh:947
│ │ │ │ +
iterator begin()
Definition overlappingschwarz.hh:1003
│ │ │ │ +
OverlappingSchwarzInitializer(InitializerList &il, const IndexSet &indices, const subdomain_vector &domains)
Definition overlappingschwarz.hh:887
│ │ │ │ +
IndexMap()
Definition overlappingschwarz.hh:955
│ │ │ │ +
virtual void apply(X &v, const X &d)
Apply the precondtioner.
Definition overlappingschwarz.hh:1227
│ │ │ │ +
OverlappingAssignerILUBase(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition overlappingschwarz.hh:1483
│ │ │ │ +
const_iterator find(size_type grow) const
Definition overlappingschwarz.hh:968
│ │ │ │ +
void operator()(const size_type &domain)
calculate one entry of the local defect.
Definition overlappingschwarz.hh:1503
│ │ │ │ +
SeqOverlappingSchwarz(const matrix_type &mat, const subdomain_vector &subDomains, field_type relaxationFactor=1, bool onTheFly_=true)
Construct the overlapping Schwarz method.
Definition overlappingschwarz.hh:1056
│ │ │ │ +
void allocate()
Definition overlappingschwarz.hh:905
│ │ │ │ +
void deallocate()
Deallocates memory of the local vector.
Definition overlappingschwarz.hh:1496
│ │ │ │ +
void insert(size_type grow)
Definition overlappingschwarz.hh:960
│ │ │ │ +
void countEntries(const Iter &row, const CIter &col) const
Definition overlappingschwarz.hh:914
│ │ │ │ +
static std::size_t assembleLocalProblems(const RowToDomain &rowToDomain, const matrix_type &mat, Solvers &solvers, const SubDomains &domains, bool onTheFly)
Definition overlappingschwarz.hh:1198
│ │ │ │ +
void relaxResult(field_type relax)
relax the result.
Definition overlappingschwarz.hh:1519
│ │ │ │ +
void assignResult(block_type &res)
Assigns the block to the current local index. At the same time the local defect is calculated for the...
Definition overlappingschwarz.hh:1525
│ │ │ │ +
SeqOverlappingSchwarz(const matrix_type &mat, const rowtodomain_vector &rowToDomain, field_type relaxationFactor=1, bool onTheFly_=true)
Definition overlappingschwarz.hh:1009
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:176
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
Definition solverregistry.hh:77
│ │ │ │ -
Definition solverregistry.hh:79
│ │ │ │ +
Initializer for SuperLU Matrices representing the subdomains.
Definition overlappingschwarz.hh:47
│ │ │ │ +
Matrix::row_type::const_iterator CIter
Definition overlappingschwarz.hh:56
│ │ │ │ +
S IndexSet
Definition overlappingschwarz.hh:58
│ │ │ │ +
Matrix::const_iterator Iter
Definition overlappingschwarz.hh:55
│ │ │ │ +
IndexSet::size_type size_type
Definition overlappingschwarz.hh:59
│ │ │ │ +
I InitializerList
Definition overlappingschwarz.hh:52
│ │ │ │ +
AtomInitializer::Matrix Matrix
Definition overlappingschwarz.hh:54
│ │ │ │ +
InitializerList::value_type AtomInitializer
Definition overlappingschwarz.hh:53
│ │ │ │ +
D subdomain_vector
The vector type containing the subdomain to row index mapping.
Definition overlappingschwarz.hh:50
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:681
│ │ │ │ +
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ +
row_type::ConstIterator ConstColIterator
Const iterator to the entries of a row.
Definition bcrsmatrix.hh:741
│ │ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ +
Exact subdomain solver using ILU(p) with appropriate p.
Definition ilusubdomainsolver.hh:78
│ │ │ │ +
Definition ilusubdomainsolver.hh:111
│ │ │ │ +
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition overlappingschwarz.hh:783
│ │ │ │ +
SLList< size_type, typename std::allocator_traits< TA >::template rebind_alloc< size_type > > subdomain_list
The type for the row to subdomain mapping.
Definition overlappingschwarz.hh:800
│ │ │ │ +
std::vector< slu, typename std::allocator_traits< TA >::template rebind_alloc< slu > > slu_vector
The vector type containing subdomain solvers.
Definition overlappingschwarz.hh:809
│ │ │ │ +
M matrix_type
The type of the matrix to precondition.
Definition overlappingschwarz.hh:760
│ │ │ │ +
TM Mode
The mode (additive or multiplicative) of the Schwarz method.
Definition overlappingschwarz.hh:778
│ │ │ │ +
X range_type
The range type of the preconditioner.
Definition overlappingschwarz.hh:770
│ │ │ │ +
std::set< size_type, std::less< size_type >, typename std::allocator_traits< TA >::template rebind_alloc< size_type > > subdomain_type
The type for the subdomain to row index mapping.
Definition overlappingschwarz.hh:794
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition overlappingschwarz.hh:765
│ │ │ │ +
TD slu
The type for the subdomain solver in use.
Definition overlappingschwarz.hh:806
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition overlappingschwarz.hh:868
│ │ │ │ +
virtual void pre(X &x, X &b)
Prepare the preconditioner.
Definition overlappingschwarz.hh:846
│ │ │ │ +
virtual void post(X &x)
Postprocess the preconditioner.
Definition overlappingschwarz.hh:861
│ │ │ │ +
TA allocator
The allocator to use.
Definition overlappingschwarz.hh:789
│ │ │ │ +
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
│ │ │ │ +
std::vector< subdomain_list, typename std::allocator_traits< TA >::template rebind_alloc< subdomain_list > > rowtodomain_vector
The vector type containing the row index to subdomain mapping.
Definition overlappingschwarz.hh:803
│ │ │ │ +
matrix_type::size_type size_type
The return type of the size method.
Definition overlappingschwarz.hh:786
│ │ │ │ +
Definition overlappingschwarz.hh:694
│ │ │ │ +
Tag that the tells the Schwarz method to be additive.
Definition overlappingschwarz.hh:120
│ │ │ │ +
Tag that tells the Schwarz method to be multiplicative.
Definition overlappingschwarz.hh:126
│ │ │ │ +
Tag that tells the Schwarz method to be multiplicative and symmetric.
Definition overlappingschwarz.hh:133
│ │ │ │ +
Exact subdomain solver using Dune::DynamicMatrix<T>::solve.
Definition overlappingschwarz.hh:140
│ │ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition overlappingschwarz.hh:149
│ │ │ │ +
X::field_type field_type
Definition overlappingschwarz.hh:150
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition overlappingschwarz.hh:153
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition overlappingschwarz.hh:155
│ │ │ │ +
void setSubMatrix(const M &BCRS, S &rowset)
Set the data of the local problem.
Definition overlappingschwarz.hh:184
│ │ │ │ +
void apply(DynamicVector< field_type > &v, DynamicVector< field_type > &d)
Apply the subdomain solver.
Definition overlappingschwarz.hh:162
│ │ │ │ +
std::remove_const< M >::type rilu_type
Definition overlappingschwarz.hh:151
│ │ │ │ +
Definition overlappingschwarz.hh:215
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
S< BCRSMatrix< T, A > >::range_type range_type
Definition overlappingschwarz.hh:315
│ │ │ │ +
range_type::block_type block_type
Definition overlappingschwarz.hh:317
│ │ │ │ +
range_type::field_type field_type
Definition overlappingschwarz.hh:316
│ │ │ │ +
matrix_type::size_type size_type
Definition overlappingschwarz.hh:319
│ │ │ │ +
BCRSMatrix< T, A > matrix_type
Definition overlappingschwarz.hh:314
│ │ │ │ +
Definition overlappingschwarz.hh:400
│ │ │ │ +
matrix_type::size_type size_type
Definition overlappingschwarz.hh:408
│ │ │ │ +
Y::field_type field_type
Definition overlappingschwarz.hh:404
│ │ │ │ +
Y::block_type block_type
Definition overlappingschwarz.hh:406
│ │ │ │ +
M matrix_type
Definition overlappingschwarz.hh:402
│ │ │ │ +
OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition overlappingschwarz.hh:493
│ │ │ │ +
OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition overlappingschwarz.hh:512
│ │ │ │ +
Definition overlappingschwarz.hh:520
│ │ │ │ +
std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type field_type
Definition overlappingschwarz.hh:526
│ │ │ │ +
A::size_type size_type
Definition overlappingschwarz.hh:525
│ │ │ │ +
Definition overlappingschwarz.hh:542
│ │ │ │ +
A::size_type size_type
Definition overlappingschwarz.hh:547
│ │ │ │ +
std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type field_type
Definition overlappingschwarz.hh:548
│ │ │ │ +
template meta program for choosing how to add the correction.
Definition overlappingschwarz.hh:572
│ │ │ │ +
AdditiveAdder< S, X > Adder
Definition overlappingschwarz.hh:577
│ │ │ │ +
MultiplicativeAdder< S, X > Adder
Definition overlappingschwarz.hh:583
│ │ │ │ +
MultiplicativeAdder< S, X > Adder
Definition overlappingschwarz.hh:589
│ │ │ │ +
Helper template meta program for application of overlapping Schwarz.
Definition overlappingschwarz.hh:605
│ │ │ │ +
static solver_iterator begin(solver_vector &sv)
Definition overlappingschwarz.hh:611
│ │ │ │ +
solver_vector::iterator solver_iterator
Definition overlappingschwarz.hh:607
│ │ │ │ +
static domain_iterator end(const subdomain_vector &sv)
Definition overlappingschwarz.hh:625
│ │ │ │ +
subdomain_vector::const_iterator domain_iterator
Definition overlappingschwarz.hh:609
│ │ │ │ +
T1 solver_vector
Definition overlappingschwarz.hh:606
│ │ │ │ +
static domain_iterator begin(const subdomain_vector &sv)
Definition overlappingschwarz.hh:620
│ │ │ │ +
T2 subdomain_vector
Definition overlappingschwarz.hh:608
│ │ │ │ +
static solver_iterator end(solver_vector &sv)
Definition overlappingschwarz.hh:616
│ │ │ │ +
T2 subdomain_vector
Definition overlappingschwarz.hh:636
│ │ │ │ +
static solver_iterator end(solver_vector &sv)
Definition overlappingschwarz.hh:644
│ │ │ │ +
solver_vector::reverse_iterator solver_iterator
Definition overlappingschwarz.hh:635
│ │ │ │ +
subdomain_vector::const_reverse_iterator domain_iterator
Definition overlappingschwarz.hh:637
│ │ │ │ +
static solver_iterator begin(solver_vector &sv)
Definition overlappingschwarz.hh:639
│ │ │ │ +
T1 solver_vector
Definition overlappingschwarz.hh:634
│ │ │ │ +
static domain_iterator begin(const subdomain_vector &sv)
Definition overlappingschwarz.hh:648
│ │ │ │ +
static domain_iterator end(const subdomain_vector &sv)
Definition overlappingschwarz.hh:653
│ │ │ │ +
Helper template meta program for application of overlapping Schwarz.
Definition overlappingschwarz.hh:669
│ │ │ │ +
smoother::range_type range_type
Definition overlappingschwarz.hh:671
│ │ │ │ +
T smoother
Definition overlappingschwarz.hh:670
│ │ │ │ +
static void apply(smoother &sm, range_type &v, const range_type &b)
Definition overlappingschwarz.hh:673
│ │ │ │ +
static void apply(smoother &sm, range_type &v, const range_type &b)
Definition overlappingschwarz.hh:685
│ │ │ │ +
SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > smoother
Definition overlappingschwarz.hh:682
│ │ │ │ + │ │ │ │ + │ │ │ │ +
BCRSMatrix< T, A > matrix_type
Definition overlappingschwarz.hh:713
│ │ │ │ +
Definition overlappingschwarz.hh:723
│ │ │ │ +
M matrix_type
Definition overlappingschwarz.hh:724
│ │ │ │ +
Definition overlappingschwarz.hh:1103
│ │ │ │ +
static int size(const Domain &d)
Definition overlappingschwarz.hh:1111
│ │ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,120 +1,1878 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -solverregistry.hh │ │ │ │ │ +overlappingschwarz.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -5 │ │ │ │ │ -6#ifndef DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ │ -7#define DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include <_d_u_n_e_/_i_s_t_l_/_c_o_m_m_o_n_/_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ │ -10#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h> │ │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ -12 │ │ │ │ │ -_1_3#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \ │ │ │ │ │ -14 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__) │ │ │ │ │ +5#ifndef DUNE_ISTL_OVERLAPPINGSCHWARZ_HH │ │ │ │ │ +6#define DUNE_ISTL_OVERLAPPINGSCHWARZ_HH │ │ │ │ │ +7#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ 15 │ │ │ │ │ -_1_6#define DUNE_REGISTER_PRECONDITIONER(name, ...) \ │ │ │ │ │ -17 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__) │ │ │ │ │ -18 │ │ │ │ │ -_1_9#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \ │ │ │ │ │ -20 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__) │ │ │ │ │ -21 │ │ │ │ │ -22namespace _D_u_n_e{ │ │ │ │ │ -27 namespace { │ │ │ │ │ -28 struct DirectSolverTag {}; │ │ │ │ │ -29 struct PreconditionerTag {}; │ │ │ │ │ -30 struct IterativeSolverTag {}; │ │ │ │ │ -31 } │ │ │ │ │ -32 templateclass Preconditioner, int │ │ │ │ │ -_b_l_o_c_k_L_e_v_e_l=1> │ │ │ │ │ -_3_3 auto _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r(){ │ │ │ │ │ -34 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& │ │ │ │ │ -config) │ │ │ │ │ -35 { │ │ │ │ │ -36 using _M_a_t_r_i_x = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ │ -37 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ │ -38 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type; │ │ │ │ │ -39 std::shared_ptr> preconditioner │ │ │ │ │ -40 = std::make_shared> │ │ │ │ │ -(matrix, config); │ │ │ │ │ -41 return preconditioner; │ │ │ │ │ -42 }; │ │ │ │ │ -43 } │ │ │ │ │ -44 │ │ │ │ │ -45 templateclass Preconditioner> │ │ │ │ │ -_4_6 auto _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r(){ │ │ │ │ │ -47 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& │ │ │ │ │ -config) │ │ │ │ │ -48 { │ │ │ │ │ -49 using _M_a_t_r_i_x = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ │ -50 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ │ -51 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type; │ │ │ │ │ -52 std::shared_ptr> preconditioner │ │ │ │ │ -53 = std::make_shared>(matrix, config); │ │ │ │ │ -54 return preconditioner; │ │ │ │ │ -55 }; │ │ │ │ │ -56 } │ │ │ │ │ +16#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> │ │ │ │ │ +17#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ │ +18#include "_s_u_p_e_r_l_u_._h_h" │ │ │ │ │ +19#include "_u_m_f_p_a_c_k_._h_h" │ │ │ │ │ +20#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ +21#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ │ +22#include "_i_l_u_s_u_b_d_o_m_a_i_n_s_o_l_v_e_r_._h_h" │ │ │ │ │ +23#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ +24 │ │ │ │ │ +25namespace _D_u_n_e │ │ │ │ │ +26{ │ │ │ │ │ +27 │ │ │ │ │ +39 template │ │ │ │ │ +40 class SeqOverlappingSchwarz; │ │ │ │ │ +41 │ │ │ │ │ +45 template │ │ │ │ │ +_4_6 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 │ │ │ │ │ +47 { │ │ │ │ │ +48 public: │ │ │ │ │ +_5_0 typedef D _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ +51 │ │ │ │ │ +_5_2 typedef I _I_n_i_t_i_a_l_i_z_e_r_L_i_s_t; │ │ │ │ │ +_5_3 typedef typename InitializerList::value_type _A_t_o_m_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ │ +_5_4 typedef typename AtomInitializer::Matrix _M_a_t_r_i_x; │ │ │ │ │ +_5_5 typedef typename Matrix::const_iterator _I_t_e_r; │ │ │ │ │ +_5_6 typedef typename Matrix::row_type::const_iterator _C_I_t_e_r; │ │ │ │ │ 57 │ │ │ │ │ -58 templateclass Solver> │ │ │ │ │ -_5_9 auto _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r(){ │ │ │ │ │ -60 return [](auto typeList, │ │ │ │ │ -61 const auto& linearOperator, │ │ │ │ │ -62 const auto& scalarProduct, │ │ │ │ │ -63 const auto& preconditioner, │ │ │ │ │ -64 const Dune::ParameterTree& config) │ │ │ │ │ -65 { │ │ │ │ │ -66 using Domain = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ │ -67 using Range = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ │ -68 std::shared_ptr> solver │ │ │ │ │ -69 = std::make_shared>(linearOperator, scalarProduct, │ │ │ │ │ -preconditioner, config); │ │ │ │ │ -70 return solver; │ │ │ │ │ -71 }; │ │ │ │ │ -72 } │ │ │ │ │ +_5_8 typedef S _I_n_d_e_x_S_e_t; │ │ │ │ │ +_5_9 typedef typename IndexSet::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +60 │ │ │ │ │ +61 _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(_I_n_i_t_i_a_l_i_z_e_r_L_i_s_t& il, │ │ │ │ │ +62 const _I_n_d_e_x_S_e_t& indices, │ │ │ │ │ +63 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& domains); │ │ │ │ │ +64 │ │ │ │ │ +65 │ │ │ │ │ +66 void _a_d_d_R_o_w_N_n_z(const _I_t_e_r& row); │ │ │ │ │ +67 │ │ │ │ │ +68 void _a_l_l_o_c_a_t_e(); │ │ │ │ │ +69 │ │ │ │ │ +70 void _c_o_u_n_t_E_n_t_r_i_e_s(const _I_t_e_r& row, const _C_I_t_e_r& _c_o_l) const; │ │ │ │ │ +71 │ │ │ │ │ +72 void _c_a_l_c_C_o_l_s_t_a_r_t() const; │ │ │ │ │ 73 │ │ │ │ │ -74 /* This exception is thrown, when the requested solver is in the factory but │ │ │ │ │ -75 cannot be instantiated for the required template parameters │ │ │ │ │ -76 */ │ │ │ │ │ -_7_7 class _U_n_s_u_p_p_o_r_t_e_d_T_y_p_e : public NotImplemented {}; │ │ │ │ │ -78 │ │ │ │ │ -_7_9 class _I_n_v_a_l_i_d_S_o_l_v_e_r_F_a_c_t_o_r_y_C_o_n_f_i_g_u_r_a_t_i_o_n : public InvalidStateException{}; │ │ │ │ │ -80} // end namespace Dune │ │ │ │ │ -81 │ │ │ │ │ -82#endif // DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ │ -_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 │ │ │ │ │ -_s_o_l_v_e_r_._h_h │ │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ │ -_D_u_n_e_:_:_d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r │ │ │ │ │ -auto defaultIterativeSolverCreator() │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r │ │ │ │ │ -auto defaultPreconditionerBlockLevelCreator() │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r │ │ │ │ │ -auto defaultPreconditionerCreator() │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:46 │ │ │ │ │ +74 void _c_o_p_y_V_a_l_u_e(const _I_t_e_r& row, const _C_I_t_e_r& _c_o_l) const; │ │ │ │ │ +75 │ │ │ │ │ +76 void _c_r_e_a_t_e_M_a_t_r_i_x() const; │ │ │ │ │ +77 private: │ │ │ │ │ +78 class IndexMap │ │ │ │ │ +79 { │ │ │ │ │ +80 public: │ │ │ │ │ +81 typedef typename S::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +82 typedef std::map Map; │ │ │ │ │ +83 typedef typename Map::iterator iterator; │ │ │ │ │ +84 typedef typename Map::const_iterator const_iterator; │ │ │ │ │ +85 │ │ │ │ │ +86 _I_n_d_e_x_M_a_p(); │ │ │ │ │ +87 │ │ │ │ │ +88 void _i_n_s_e_r_t(_s_i_z_e___t_y_p_e grow); │ │ │ │ │ +89 │ │ │ │ │ +90 const_iterator _f_i_n_d(_s_i_z_e___t_y_p_e grow) const; │ │ │ │ │ +91 │ │ │ │ │ +92 iterator _f_i_n_d(_s_i_z_e___t_y_p_e grow); │ │ │ │ │ +93 │ │ │ │ │ +94 iterator _b_e_g_i_n(); │ │ │ │ │ +95 │ │ │ │ │ +96 const_iterator _b_e_g_i_n() const; │ │ │ │ │ +97 │ │ │ │ │ +98 iterator _e_n_d(); │ │ │ │ │ +99 │ │ │ │ │ +100 const_iterator _e_n_d() const; │ │ │ │ │ +101 │ │ │ │ │ +102 private: │ │ │ │ │ +103 std::map map_; │ │ │ │ │ +104 _s_i_z_e___t_y_p_e row; │ │ │ │ │ +105 }; │ │ │ │ │ +106 │ │ │ │ │ +107 │ │ │ │ │ +108 typedef typename InitializerList::iterator InitIterator; │ │ │ │ │ +109 typedef typename IndexSet::const_iterator IndexIteratur; │ │ │ │ │ +110 _I_n_i_t_i_a_l_i_z_e_r_L_i_s_t* initializers; │ │ │ │ │ +111 const _I_n_d_e_x_S_e_t *indices; │ │ │ │ │ +112 mutable std::vector indexMaps; │ │ │ │ │ +113 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& domains; │ │ │ │ │ +114 }; │ │ │ │ │ +115 │ │ │ │ │ +_1_1_9 struct _A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e │ │ │ │ │ +120 {}; │ │ │ │ │ +121 │ │ │ │ │ +_1_2_5 struct _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 │ │ │ │ │ +126 {}; │ │ │ │ │ +127 │ │ │ │ │ +_1_3_2 struct _S_y_m_m_e_t_r_i_c_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 │ │ │ │ │ +133 {}; │ │ │ │ │ +134 │ │ │ │ │ +139 template │ │ │ │ │ +_1_4_0 class _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r; │ │ │ │ │ +141 │ │ │ │ │ +142 // Specialization for BCRSMatrix │ │ │ │ │ +143 template │ │ │ │ │ +_1_4_4 class _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r< _B_C_R_S_M_a_t_r_i_x< K, Al>, X, Y > │ │ │ │ │ +145 { │ │ │ │ │ +146 typedef _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_> _M; │ │ │ │ │ +147 public: │ │ │ │ │ +_1_4_9 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_1_5_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_5_1 typedef typename std::remove_const::type _r_i_l_u___t_y_p_e; │ │ │ │ │ +_1_5_3 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_1_5_5 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_1_5_6 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ +157 │ │ │ │ │ +_1_6_2 void _a_p_p_l_y (DynamicVector& v, DynamicVector& d) │ │ │ │ │ +163 { │ │ │ │ │ +164 assert(v.size() > 0); │ │ │ │ │ +165 assert(v.size() == d.size()); │ │ │ │ │ +166 assert(A.rows() <= v.size()); │ │ │ │ │ +167 assert(A.cols() <= v.size()); │ │ │ │ │ +168 size_t sz = A.rows(); │ │ │ │ │ +169 v.resize(sz); │ │ │ │ │ +170 d.resize(sz); │ │ │ │ │ +171 A.solve(v,d); │ │ │ │ │ +172 v.resize(v.capacity()); │ │ │ │ │ +173 d.resize(d.capacity()); │ │ │ │ │ +174 } │ │ │ │ │ +175 │ │ │ │ │ +183 template │ │ │ │ │ +_1_8_4 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M& BCRS, S& rowset) │ │ │ │ │ +185 { │ │ │ │ │ +186 size_t sz = rowset.size(); │ │ │ │ │ +187 A.resize(sz*n,sz*n); │ │ │ │ │ +188 typedef typename S::const_iterator SIter; │ │ │ │ │ +189 size_t r = 0, c = 0; │ │ │ │ │ +190 for(SIter rowIdx = rowset.begin(), rowEnd=rowset.end(); │ │ │ │ │ +191 rowIdx!= rowEnd; ++rowIdx, r++) │ │ │ │ │ +192 { │ │ │ │ │ +193 c = 0; │ │ │ │ │ +194 for(SIter colIdx = rowset.begin(), colEnd=rowset.end(); │ │ │ │ │ +195 colIdx!= colEnd; ++colIdx, c++) │ │ │ │ │ +196 { │ │ │ │ │ +197 if (BCRS[*rowIdx].find(*colIdx) == BCRS[*rowIdx]._e_n_d()) │ │ │ │ │ +198 continue; │ │ │ │ │ +199 for (size_t i=0; i A; │ │ │ │ │ +211 }; │ │ │ │ │ +212 │ │ │ │ │ +213 template │ │ │ │ │ +_2_1_4 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ +215 {}; │ │ │ │ │ +216 │ │ │ │ │ +217 template │ │ │ │ │ +_2_1_8 using _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r = _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_T_,_ _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_<_T_>_:_:_v_a_l_u_e>; │ │ │ │ │ +219 │ │ │ │ │ +220 // specialization for DynamicMatrix │ │ │ │ │ +221 template │ │ │ │ │ +_2_2_2 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r< _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r< │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x, X, Y >,false> │ │ │ │ │ +223 { │ │ │ │ │ +224 public: │ │ │ │ │ +_2_2_5 typedef _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_2_2_6 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_2_7 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_2_2_8 typedef typename range_type::block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +_2_2_9 typedef typename _m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +_2_3_0 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ +238 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const _B_C_R_S_M_a_t_r_i_x_<_K_,_ _A_l_>& │ │ │ │ │ +mat_, const X& b_, Y& x_); │ │ │ │ │ +239 │ │ │ │ │ +243 inline │ │ │ │ │ +244 void deallocate(); │ │ │ │ │ +245 │ │ │ │ │ +249 inline │ │ │ │ │ +250 void resetIndexForNextDomain(); │ │ │ │ │ +251 │ │ │ │ │ +256 inline │ │ │ │ │ +257 DynamicVector & lhs(); │ │ │ │ │ +258 │ │ │ │ │ +263 inline │ │ │ │ │ +264 DynamicVector & rhs(); │ │ │ │ │ +265 │ │ │ │ │ +270 inline │ │ │ │ │ +271 void relaxResult(_f_i_e_l_d___t_y_p_e relax); │ │ │ │ │ +272 │ │ │ │ │ +277 void operator()(const _s_i_z_e___t_y_p_e& domainIndex); │ │ │ │ │ +278 │ │ │ │ │ +286 inline │ │ │ │ │ +287 void assignResult(_b_l_o_c_k___t_y_p_e& res); │ │ │ │ │ +288 │ │ │ │ │ +289 private: │ │ │ │ │ +293 const _m_a_t_r_i_x___t_y_p_e* _m_a_t; │ │ │ │ │ +295 // we need a pointer, because we have to avoid deep copies │ │ │ │ │ +296 DynamicVector * rhs_; │ │ │ │ │ +298 // we need a pointer, because we have to avoid deep copies │ │ │ │ │ +299 DynamicVector * lhs_; │ │ │ │ │ +301 const _r_a_n_g_e___t_y_p_e* b; │ │ │ │ │ +303 _r_a_n_g_e___t_y_p_e* x; │ │ │ │ │ +305 std::size_t i; │ │ │ │ │ +307 std::size_t maxlength_; │ │ │ │ │ +308 }; │ │ │ │ │ +309 │ │ │ │ │ +310#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +311 template class S, typename T, typename A> │ │ │ │ │ +_3_1_2 struct _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r>, true> │ │ │ │ │ +313 { │ │ │ │ │ +_3_1_4 typedef _B_C_R_S_M_a_t_r_i_x_<_T_,_ _A_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_3_1_5 typedef typename S>::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_3_1_6 typedef typename range_type::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_3_1_7 typedef typename range_type::block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +318 │ │ │ │ │ +_3_1_9 typedef typename _m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +320 │ │ │ │ │ +_3_2_1 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ +_3_2_2 static constexpr size_t m = std::decay_t()))>::cols; │ │ │ │ │ +330 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ +331 const _r_a_n_g_e___t_y_p_e& b, _r_a_n_g_e___t_y_p_e& x); │ │ │ │ │ +337 void deallocate(); │ │ │ │ │ +338 │ │ │ │ │ +339 /* │ │ │ │ │ +340 * @brief Resets the local index to zero. │ │ │ │ │ +341 */ │ │ │ │ │ +342 void resetIndexForNextDomain(); │ │ │ │ │ +343 │ │ │ │ │ +348 _f_i_e_l_d___t_y_p_e* lhs(); │ │ │ │ │ +349 │ │ │ │ │ +354 _f_i_e_l_d___t_y_p_e* rhs(); │ │ │ │ │ +355 │ │ │ │ │ +360 void relaxResult(_f_i_e_l_d___t_y_p_e relax); │ │ │ │ │ +361 │ │ │ │ │ +366 void operator()(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ +367 │ │ │ │ │ +375 void assignResult(_b_l_o_c_k___t_y_p_e& res); │ │ │ │ │ +376 │ │ │ │ │ +377 private: │ │ │ │ │ +381 const _m_a_t_r_i_x___t_y_p_e* _m_a_t; │ │ │ │ │ +383 _f_i_e_l_d___t_y_p_e* rhs_; │ │ │ │ │ +385 _f_i_e_l_d___t_y_p_e* lhs_; │ │ │ │ │ +387 const _r_a_n_g_e___t_y_p_e* b; │ │ │ │ │ +389 _r_a_n_g_e___t_y_p_e* x; │ │ │ │ │ +391 std::size_t i; │ │ │ │ │ +393 std::size_t maxlength_; │ │ │ │ │ +394 }; │ │ │ │ │ +395 │ │ │ │ │ +396#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +397 │ │ │ │ │ +398 template │ │ │ │ │ +_3_9_9 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ +400 { │ │ │ │ │ +401 public: │ │ │ │ │ +_4_0_2 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +403 │ │ │ │ │ +_4_0_4 typedef typename Y::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +405 │ │ │ │ │ +_4_0_6 typedef typename Y::block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +407 │ │ │ │ │ +_4_0_8 typedef typename matrix_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +416 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(std::size_t maxlength, const M& mat, │ │ │ │ │ +417 const Y& b, X& x); │ │ │ │ │ +423 void _d_e_a_l_l_o_c_a_t_e(); │ │ │ │ │ +424 │ │ │ │ │ +428 void _r_e_s_e_t_I_n_d_e_x_F_o_r_N_e_x_t_D_o_m_a_i_n(); │ │ │ │ │ +429 │ │ │ │ │ +434 X& _l_h_s(); │ │ │ │ │ +435 │ │ │ │ │ +440 Y& _r_h_s(); │ │ │ │ │ +441 │ │ │ │ │ +446 void _r_e_l_a_x_R_e_s_u_l_t(_f_i_e_l_d___t_y_p_e relax); │ │ │ │ │ +447 │ │ │ │ │ +452 void _o_p_e_r_a_t_o_r_(_)(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ +453 │ │ │ │ │ +461 void _a_s_s_i_g_n_R_e_s_u_l_t(_b_l_o_c_k___t_y_p_e& res); │ │ │ │ │ +462 │ │ │ │ │ +463 private: │ │ │ │ │ +467 const M* mat; │ │ │ │ │ +469 X* lhs_; │ │ │ │ │ +471 Y* rhs_; │ │ │ │ │ +473 const Y* b; │ │ │ │ │ +475 X* x; │ │ │ │ │ +477 _s_i_z_e___t_y_p_e i; │ │ │ │ │ +478 }; │ │ │ │ │ +479 │ │ │ │ │ +480 // specialization for ILU0 │ │ │ │ │ +481 template │ │ │ │ │ +_4_8_2 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r<_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r, false> │ │ │ │ │ +483 : public _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ +484 { │ │ │ │ │ +485 public: │ │ │ │ │ +_4_9_3 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const M& _m_a_t, │ │ │ │ │ +494 const Y& b, X& x) │ │ │ │ │ +495 : _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(maxlength, _m_a_t,b,x) │ │ │ │ │ +496 {} │ │ │ │ │ +497 }; │ │ │ │ │ +498 │ │ │ │ │ +499 // specialization for ILUN │ │ │ │ │ +500 template │ │ │ │ │ +_5_0_1 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r<_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r,false> │ │ │ │ │ +502 : public _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ +503 { │ │ │ │ │ +504 public: │ │ │ │ │ +_5_1_2 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const M& _m_a_t, │ │ │ │ │ +513 const Y& b, X& x) │ │ │ │ │ +514 : _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(maxlength, _m_a_t,b,x) │ │ │ │ │ +515 {} │ │ │ │ │ +516 }; │ │ │ │ │ +517 │ │ │ │ │ +518 template │ │ │ │ │ +_5_1_9 struct _A_d_d_i_t_i_v_e_A_d_d_e_r │ │ │ │ │ +520 {}; │ │ │ │ │ +521 │ │ │ │ │ +522 template │ │ │ │ │ +_5_2_3 struct _A_d_d_i_t_i_v_e_A_d_d_e_r > │ │ │ │ │ +524 { │ │ │ │ │ +_5_2_5 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +_5_2_6 typedef typename std::decay_t │ │ │ │ │ +()))>::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +527 _A_d_d_i_t_i_v_e_A_d_d_e_r(_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v, _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x, │ │ │ │ │ +528 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner, const _f_i_e_l_d___t_y_p_e& relax_); │ │ │ │ │ +529 void operator()(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ +530 void axpy(); │ │ │ │ │ +_5_3_1 static constexpr size_t n = std::decay_t()))>::dimension; │ │ │ │ │ +532 │ │ │ │ │ +533 private: │ │ │ │ │ +534 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>* v; │ │ │ │ │ +535 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>* x; │ │ │ │ │ +536 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>* assigner; │ │ │ │ │ +537 _f_i_e_l_d___t_y_p_e relax; │ │ │ │ │ +538 }; │ │ │ │ │ +539 │ │ │ │ │ +540 template │ │ │ │ │ +_5_4_1 struct _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r │ │ │ │ │ +542 {}; │ │ │ │ │ +543 │ │ │ │ │ +544 template │ │ │ │ │ +_5_4_5 struct _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r > │ │ │ │ │ +546 { │ │ │ │ │ +_5_4_7 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +_5_4_8 typedef typename std::decay_t │ │ │ │ │ +()))>::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +549 _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r(_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v, _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x, │ │ │ │ │ +550 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner_, const _f_i_e_l_d___t_y_p_e& relax_); │ │ │ │ │ +551 void operator()(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ +552 void axpy(); │ │ │ │ │ +_5_5_3 static constexpr size_t n = std::decay_t()))>::dimension; │ │ │ │ │ +554 │ │ │ │ │ +555 private: │ │ │ │ │ +556 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>* x; │ │ │ │ │ +557 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>* assigner; │ │ │ │ │ +558 _f_i_e_l_d___t_y_p_e relax; │ │ │ │ │ +559 }; │ │ │ │ │ +560 │ │ │ │ │ +570 template │ │ │ │ │ +_5_7_1 struct _A_d_d_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ +572 {}; │ │ │ │ │ +573 │ │ │ │ │ +574 template │ │ │ │ │ +_5_7_5 struct _A_d_d_e_r_S_e_l_e_c_t_o_r<_A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e,X,S> │ │ │ │ │ +576 { │ │ │ │ │ +_5_7_7 typedef _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_X_> _A_d_d_e_r; │ │ │ │ │ +578 }; │ │ │ │ │ +579 │ │ │ │ │ +580 template │ │ │ │ │ +_5_8_1 struct _A_d_d_e_r_S_e_l_e_c_t_o_r<_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,X,S> │ │ │ │ │ +582 { │ │ │ │ │ +_5_8_3 typedef _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_X_> _A_d_d_e_r; │ │ │ │ │ +584 }; │ │ │ │ │ +585 │ │ │ │ │ +586 template │ │ │ │ │ +_5_8_7 struct _A_d_d_e_r_S_e_l_e_c_t_o_r<_S_y_m_m_e_t_r_i_c_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,X,S> │ │ │ │ │ +588 { │ │ │ │ │ +_5_8_9 typedef _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_X_> _A_d_d_e_r; │ │ │ │ │ +590 }; │ │ │ │ │ +591 │ │ │ │ │ +603 template │ │ │ │ │ +_6_0_4 struct _I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r │ │ │ │ │ +605 { │ │ │ │ │ +_6_0_6 typedef T1 _s_o_l_v_e_r___v_e_c_t_o_r; │ │ │ │ │ +_6_0_7 typedef typename solver_vector::iterator _s_o_l_v_e_r___i_t_e_r_a_t_o_r; │ │ │ │ │ +_6_0_8 typedef T2 _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ +_6_0_9 typedef typename subdomain_vector::const_iterator _d_o_m_a_i_n___i_t_e_r_a_t_o_r; │ │ │ │ │ +610 │ │ │ │ │ +_6_1_1 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _b_e_g_i_n(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ +612 { │ │ │ │ │ +613 return sv.begin(); │ │ │ │ │ +614 } │ │ │ │ │ +615 │ │ │ │ │ +_6_1_6 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _e_n_d(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ +617 { │ │ │ │ │ +618 return sv.end(); │ │ │ │ │ +619 } │ │ │ │ │ +_6_2_0 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _b_e_g_i_n(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ +621 { │ │ │ │ │ +622 return sv.begin(); │ │ │ │ │ +623 } │ │ │ │ │ +624 │ │ │ │ │ +_6_2_5 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _e_n_d(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ +626 { │ │ │ │ │ +627 return sv.end(); │ │ │ │ │ +628 } │ │ │ │ │ +629 }; │ │ │ │ │ +630 │ │ │ │ │ +631 template │ │ │ │ │ +_6_3_2 struct _I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r │ │ │ │ │ +633 { │ │ │ │ │ +_6_3_4 typedef T1 _s_o_l_v_e_r___v_e_c_t_o_r; │ │ │ │ │ +_6_3_5 typedef typename solver_vector::reverse_iterator _s_o_l_v_e_r___i_t_e_r_a_t_o_r; │ │ │ │ │ +_6_3_6 typedef T2 _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ +_6_3_7 typedef typename subdomain_vector::const_reverse_iterator _d_o_m_a_i_n___i_t_e_r_a_t_o_r; │ │ │ │ │ +638 │ │ │ │ │ +_6_3_9 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _b_e_g_i_n(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ +640 { │ │ │ │ │ +641 return sv.rbegin(); │ │ │ │ │ +642 } │ │ │ │ │ +643 │ │ │ │ │ +_6_4_4 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _e_n_d(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ +645 { │ │ │ │ │ +646 return sv.rend(); │ │ │ │ │ +647 } │ │ │ │ │ +_6_4_8 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _b_e_g_i_n(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ +649 { │ │ │ │ │ +650 return sv.rbegin(); │ │ │ │ │ +651 } │ │ │ │ │ +652 │ │ │ │ │ +_6_5_3 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _e_n_d(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ +654 { │ │ │ │ │ +655 return sv.rend(); │ │ │ │ │ +656 } │ │ │ │ │ +657 }; │ │ │ │ │ +658 │ │ │ │ │ +667 template │ │ │ │ │ +_6_6_8 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_p_p_l_i_e_r │ │ │ │ │ +669 { │ │ │ │ │ +_6_7_0 typedef T _s_m_o_o_t_h_e_r; │ │ │ │ │ +_6_7_1 typedef typename smoother::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +672 │ │ │ │ │ +_6_7_3 static void _a_p_p_l_y(_s_m_o_o_t_h_e_r& sm, _r_a_n_g_e___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& b) │ │ │ │ │ +674 { │ │ │ │ │ +675 sm.template apply(v, b); │ │ │ │ │ +676 } │ │ │ │ │ +677 }; │ │ │ │ │ +678 │ │ │ │ │ +679 template │ │ │ │ │ +_6_8_0 struct │ │ │ │ │ +_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_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 │ │ │ │ │ +> │ │ │ │ │ +681 { │ │ │ │ │ +_6_8_2 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_S_y_m_m_e_t_r_i_c_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_,_T_D_,_T_A_> │ │ │ │ │ +_s_m_o_o_t_h_e_r; │ │ │ │ │ +_6_8_3 typedef typename _s_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +684 │ │ │ │ │ +_6_8_5 static void _a_p_p_l_y(_s_m_o_o_t_h_e_r& sm, _r_a_n_g_e___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& b) │ │ │ │ │ +686 { │ │ │ │ │ +687 sm.template apply(v, b); │ │ │ │ │ +688 sm.template apply(v, b); │ │ │ │ │ +689 } │ │ │ │ │ +690 }; │ │ │ │ │ +691 │ │ │ │ │ +692 template │ │ │ │ │ +_6_9_3 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 │ │ │ │ │ +694 {}; │ │ │ │ │ +695 │ │ │ │ │ +696 template │ │ │ │ │ +_6_9_7 using _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 = │ │ │ │ │ +_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_<_T_,_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_<_T_>_:_:_v_a_l_u_e>; │ │ │ │ │ +698 │ │ │ │ │ +699 template │ │ │ │ │ +_7_0_0 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< _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r< │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x< K, Al>, X, Y >,false> │ │ │ │ │ +701 { │ │ │ │ │ +_7_0_2 typedef _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_7_0_3 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ +704 template │ │ │ │ │ +705 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, │ │ │ │ │ +const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ +706 Solvers& solvers, const SubDomains& domains, │ │ │ │ │ +707 bool onTheFly); │ │ │ │ │ +708 }; │ │ │ │ │ +709 │ │ │ │ │ +710 template class S, typename T, typename A> │ │ │ │ │ +_7_1_1 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>,true> │ │ │ │ │ +712 { │ │ │ │ │ +_7_1_3 typedef _B_C_R_S_M_a_t_r_i_x_<_T_,_A_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_7_1_4 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ +715 template │ │ │ │ │ +716 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, │ │ │ │ │ +const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ +717 Solvers& solvers, const SubDomains& domains, │ │ │ │ │ +718 bool onTheFly); │ │ │ │ │ +719 }; │ │ │ │ │ +720 │ │ │ │ │ +721 template │ │ │ │ │ +_7_2_2 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_I_L_U_B_a_s_e │ │ │ │ │ +723 { │ │ │ │ │ +_7_2_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +725 template │ │ │ │ │ +726 static std::size_t _a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s(const RowToDomain& rowToDomain, │ │ │ │ │ +const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ +727 Solvers& solvers, const SubDomains& domains, │ │ │ │ │ +728 bool onTheFly); │ │ │ │ │ +729 }; │ │ │ │ │ +730 │ │ │ │ │ +731 template │ │ │ │ │ +_7_3_2 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<_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r,false> │ │ │ │ │ +733 : public _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_I_L_U_B_a_s_e │ │ │ │ │ +734 {}; │ │ │ │ │ +735 │ │ │ │ │ +736 template │ │ │ │ │ +_7_3_7 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<_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r,false> │ │ │ │ │ +738 : public _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_I_L_U_B_a_s_e │ │ │ │ │ +739 {}; │ │ │ │ │ +740 │ │ │ │ │ +751 template, class TA=std::allocator > │ │ │ │ │ +_7_5_3 class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ +754 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +755 { │ │ │ │ │ +756 public: │ │ │ │ │ +_7_6_0 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +761 │ │ │ │ │ +_7_6_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +766 │ │ │ │ │ +_7_7_0 typedef X _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +771 │ │ │ │ │ +_7_7_8 typedef _T_M _M_o_d_e; │ │ │ │ │ +779 │ │ │ │ │ +_7_8_3 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +784 │ │ │ │ │ +_7_8_6 typedef typename matrix_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +787 │ │ │ │ │ +_7_8_9 typedef _T_A _a_l_l_o_c_a_t_o_r; │ │ │ │ │ +790 │ │ │ │ │ +792 typedef std::set, │ │ │ │ │ +793 typename std::allocator_traits::template _r_e_b_i_n_d___a_l_l_o_c_<_s_i_z_e___t_y_p_e_> > │ │ │ │ │ +_7_9_4 _s_u_b_d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +795 │ │ │ │ │ +_7_9_7 typedef std::vector:: │ │ │ │ │ +template _r_e_b_i_n_d___a_l_l_o_c_<_s_u_b_d_o_m_a_i_n___t_y_p_e_> > _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ +798 │ │ │ │ │ +_8_0_0 typedef _S_L_L_i_s_t_<_s_i_z_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_a_l_l_o_c_a_t_o_r___t_r_a_i_t_s_<_T_A_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ │ +_r_e_b_i_n_d___a_l_l_o_c_<_s_i_z_e___t_y_p_e_> > _s_u_b_d_o_m_a_i_n___l_i_s_t; │ │ │ │ │ +801 │ │ │ │ │ +_8_0_3 typedef std::vector:: │ │ │ │ │ +template _r_e_b_i_n_d___a_l_l_o_c_<_s_u_b_d_o_m_a_i_n___l_i_s_t_> > _r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ +804 │ │ │ │ │ +_8_0_6 typedef _T_D _s_l_u; │ │ │ │ │ +807 │ │ │ │ │ +_8_0_9 typedef std::vector::template │ │ │ │ │ +_r_e_b_i_n_d___a_l_l_o_c_<_s_l_u_> > _s_l_u___v_e_c_t_o_r; │ │ │ │ │ +810 │ │ │ │ │ +_8_2_4 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const _m_a_t_r_i_x___t_y_p_e& mat, const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& │ │ │ │ │ +subDomains, │ │ │ │ │ +825 _f_i_e_l_d___t_y_p_e relaxationFactor=1, bool _o_n_T_h_e_F_l_y__=true); │ │ │ │ │ +826 │ │ │ │ │ +_8_3_8 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const _m_a_t_r_i_x___t_y_p_e& mat, const _r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r& │ │ │ │ │ +_r_o_w_T_o_D_o_m_a_i_n, │ │ │ │ │ +839 _f_i_e_l_d___t_y_p_e relaxationFactor=1, bool _o_n_T_h_e_F_l_y__=true); │ │ │ │ │ +840 │ │ │ │ │ +_8_4_6 virtual void _p_r_e ([[_m_a_y_b_e___u_n_u_s_e_d]] X& x, [[_m_a_y_b_e___u_n_u_s_e_d]] X& b) │ │ │ │ │ +847 {} │ │ │ │ │ +848 │ │ │ │ │ +_8_5_4 virtual void _a_p_p_l_y (X& v, const X& _d); │ │ │ │ │ +855 │ │ │ │ │ +_8_6_1 virtual void _p_o_s_t ([[_m_a_y_b_e___u_n_u_s_e_d]] X& x) │ │ │ │ │ +862 {} │ │ │ │ │ +863 │ │ │ │ │ +864 template │ │ │ │ │ +_8_6_5 void _a_p_p_l_y(X& v, const X& _d); │ │ │ │ │ +866 │ │ │ │ │ +_8_6_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 │ │ │ │ │ +869 { │ │ │ │ │ +870 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; │ │ │ │ │ +871 } │ │ │ │ │ +872 │ │ │ │ │ +873 private: │ │ │ │ │ +874 const M& mat; │ │ │ │ │ +875 _s_l_u___v_e_c_t_o_r solvers; │ │ │ │ │ +876 _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r subDomains; │ │ │ │ │ +877 _f_i_e_l_d___t_y_p_e relax; │ │ │ │ │ +878 │ │ │ │ │ +879 typename M::size_type maxlength; │ │ │ │ │ +880 │ │ │ │ │ +881 bool onTheFly; │ │ │ │ │ +882 }; │ │ │ │ │ +883 │ │ │ │ │ +884 │ │ │ │ │ +885 │ │ │ │ │ +886 template │ │ │ │ │ +_8_8_7 _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_<_I_,_S_,_D_>_:_:_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 │ │ │ │ │ +(_I_n_i_t_i_a_l_i_z_e_r_L_i_s_t& il, │ │ │ │ │ +888 const _I_n_d_e_x_S_e_t& idx, │ │ │ │ │ +889 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& domains_) │ │ │ │ │ +890 : initializers(&il), indices(&idx), indexMaps(il.size()), domains(domains_) │ │ │ │ │ +891 {} │ │ │ │ │ +892 │ │ │ │ │ +893 │ │ │ │ │ +894 template │ │ │ │ │ +_8_9_5 void _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_<_I_,_S_,_D_>_:_:_a_d_d_R_o_w_N_n_z(const _I_t_e_r& row) │ │ │ │ │ +896 { │ │ │ │ │ +897 typedef typename IndexSet::value_type::const_iterator iterator; │ │ │ │ │ +898 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices) │ │ │ │ │ +[row.index()].end(); ++domain) { │ │ │ │ │ +899 (*initializers)[*domain].addRowNnz(row, domains[*domain]); │ │ │ │ │ +900 indexMaps[*domain].insert(row.index()); │ │ │ │ │ +901 } │ │ │ │ │ +902 } │ │ │ │ │ +903 │ │ │ │ │ +904 template │ │ │ │ │ +_9_0_5 void _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_<_I_,_S_,_D_>_:_:_a_l_l_o_c_a_t_e() │ │ │ │ │ +906 { │ │ │ │ │ +907 for(auto&& i: *initializers) │ │ │ │ │ +908 i.allocateMatrixStorage(); │ │ │ │ │ +909 for(auto&& i: *initializers) │ │ │ │ │ +910 i.allocateMarker(); │ │ │ │ │ +911 } │ │ │ │ │ +912 │ │ │ │ │ +913 template │ │ │ │ │ +_9_1_4 void _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_<_I_,_S_,_D_>_:_:_c_o_u_n_t_E_n_t_r_i_e_s(const _I_t_e_r& row, │ │ │ │ │ +const _C_I_t_e_r& _c_o_l) const │ │ │ │ │ +915 { │ │ │ │ │ +916 typedef typename IndexSet::value_type::const_iterator iterator; │ │ │ │ │ +917 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices) │ │ │ │ │ +[row.index()].end(); ++domain) { │ │ │ │ │ +918 typename std::map::const_iterator v = indexMaps │ │ │ │ │ +[*domain].find(_c_o_l.index()); │ │ │ │ │ +919 if(v!= indexMaps[*domain].end()) { │ │ │ │ │ +920 (*initializers)[*domain].countEntries(indexMaps[*domain].find(_c_o_l.index())- │ │ │ │ │ +>second); │ │ │ │ │ +921 } │ │ │ │ │ +922 } │ │ │ │ │ +923 } │ │ │ │ │ +924 │ │ │ │ │ +925 template │ │ │ │ │ +_9_2_6 void _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_<_I_,_S_,_D_>_:_:_c_a_l_c_C_o_l_s_t_a_r_t() const │ │ │ │ │ +927 { │ │ │ │ │ +928 for(auto&& i : *initializers) │ │ │ │ │ +929 i.calcColstart(); │ │ │ │ │ +930 } │ │ │ │ │ +931 │ │ │ │ │ +932 template │ │ │ │ │ +_9_3_3 void _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_<_I_,_S_,_D_>_:_:_c_o_p_y_V_a_l_u_e(const _I_t_e_r& row, const │ │ │ │ │ +_C_I_t_e_r& _c_o_l) const │ │ │ │ │ +934 { │ │ │ │ │ +935 typedef typename IndexSet::value_type::const_iterator iterator; │ │ │ │ │ +936 for(iterator domain=(*indices)[row.index()].begin(); domain!= (*indices) │ │ │ │ │ +[row.index()].end(); ++domain) { │ │ │ │ │ +937 typename std::map::const_iterator v = indexMaps │ │ │ │ │ +[*domain].find(_c_o_l.index()); │ │ │ │ │ +938 if(v!= indexMaps[*domain].end()) { │ │ │ │ │ +939 assert(indexMaps[*domain].end()!=indexMaps[*domain].find(row.index())); │ │ │ │ │ +940 (*initializers)[*domain].copyValue(_c_o_l, indexMaps[*domain].find(row.index │ │ │ │ │ +())->second, │ │ │ │ │ +941 v->second); │ │ │ │ │ +942 } │ │ │ │ │ +943 } │ │ │ │ │ +944 } │ │ │ │ │ +945 │ │ │ │ │ +946 template │ │ │ │ │ +_9_4_7 void _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_<_I_,_S_,_D_>_:_:_c_r_e_a_t_e_M_a_t_r_i_x() const │ │ │ │ │ +948 { │ │ │ │ │ +949 std::vector().swap(indexMaps); │ │ │ │ │ +950 for(auto&& i: *initializers) │ │ │ │ │ +951 i.createMatrix(); │ │ │ │ │ +952 } │ │ │ │ │ +953 │ │ │ │ │ +954 template │ │ │ │ │ +_9_5_5 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_I_n_d_e_x_M_a_p() │ │ │ │ │ +956 : row(0) │ │ │ │ │ +957 {} │ │ │ │ │ +958 │ │ │ │ │ +959 template │ │ │ │ │ +_9_6_0 void _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_i_n_s_e_r_t(size_type grow) │ │ │ │ │ +961 { │ │ │ │ │ +962 assert(map_.find(grow)==map_.end()); │ │ │ │ │ +963 map_.insert(std::make_pair(grow, row++)); │ │ │ │ │ +964 } │ │ │ │ │ +965 │ │ │ │ │ +966 template │ │ │ │ │ +967 typename OverlappingSchwarzInitializer::IndexMap::const_iterator │ │ │ │ │ +_9_6_8 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_f_i_n_d(size_type grow) const │ │ │ │ │ +969 { │ │ │ │ │ +970 return map_.find(grow); │ │ │ │ │ +971 } │ │ │ │ │ +972 │ │ │ │ │ +973 template │ │ │ │ │ +974 typename OverlappingSchwarzInitializer::IndexMap::iterator │ │ │ │ │ +_9_7_5 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_f_i_n_d(size_type grow) │ │ │ │ │ +976 { │ │ │ │ │ +977 return map_.find(grow); │ │ │ │ │ +978 } │ │ │ │ │ +979 │ │ │ │ │ +980 template │ │ │ │ │ +981 typename OverlappingSchwarzInitializer::IndexMap::const_iterator │ │ │ │ │ +_9_8_2 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_e_n_d() const │ │ │ │ │ +983 { │ │ │ │ │ +984 return map_.end(); │ │ │ │ │ +985 } │ │ │ │ │ +986 │ │ │ │ │ +987 template │ │ │ │ │ +988 typename OverlappingSchwarzInitializer::IndexMap::iterator │ │ │ │ │ +_9_8_9 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_e_n_d() │ │ │ │ │ +990 { │ │ │ │ │ +991 return map_.end(); │ │ │ │ │ +992 } │ │ │ │ │ +993 │ │ │ │ │ +994 template │ │ │ │ │ +995 typename OverlappingSchwarzInitializer::IndexMap::const_iterator │ │ │ │ │ +_9_9_6 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_b_e_g_i_n() const │ │ │ │ │ +997 { │ │ │ │ │ +998 return map_.begin(); │ │ │ │ │ +999 } │ │ │ │ │ +1000 │ │ │ │ │ +1001 template │ │ │ │ │ +1002 typename OverlappingSchwarzInitializer::IndexMap::iterator │ │ │ │ │ +_1_0_0_3 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_b_e_g_i_n() │ │ │ │ │ +1004 { │ │ │ │ │ +1005 return map_.begin(); │ │ │ │ │ +1006 } │ │ │ │ │ +1007 │ │ │ │ │ +1008 template │ │ │ │ │ +_1_0_0_9 _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_D_,_T_A_>_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const │ │ │ │ │ +_m_a_t_r_i_x___t_y_p_e& _m_a_t__, const _r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r& _r_o_w_T_o_D_o_m_a_i_n, │ │ │ │ │ +1010 _f_i_e_l_d___t_y_p_e relaxationFactor, bool _f_l_y) │ │ │ │ │ +1011 : _m_a_t(_m_a_t__), relax(relaxationFactor), onTheFly(_f_l_y) │ │ │ │ │ +1012 { │ │ │ │ │ +1013 typedef typename rowtodomain_vector::const_iterator _R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r; │ │ │ │ │ +1014 typedef typename subdomain_list::const_iterator _D_o_m_a_i_n_I_t_e_r_a_t_o_r; │ │ │ │ │ +1015#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1016 _a_s_s_e_r_t(_r_o_w_T_o_D_o_m_a_i_n.size()==mat.N()); │ │ │ │ │ +1017 _a_s_s_e_r_t(_r_o_w_T_o_D_o_m_a_i_n.size()==mat.M()); │ │ │ │ │ +1018 │ │ │ │ │ +1019 for(_R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r _i_t_e_r=_r_o_w_T_o_D_o_m_a_i_n.begin(); _i_t_e_r != _r_o_w_T_o_D_o_m_a_i_n.end(); │ │ │ │ │ +++_i_t_e_r) │ │ │ │ │ +1020 _a_s_s_e_r_t(_i_t_e_r->size()>0); │ │ │ │ │ +1021 │ │ │ │ │ +1022#endif │ │ │ │ │ +1023 // calculate the number of domains │ │ │ │ │ +1024 _s_i_z_e___t_y_p_e domains=0; │ │ │ │ │ +1025 for(_R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r _i_t_e_r=_r_o_w_T_o_D_o_m_a_i_n.begin(); _i_t_e_r != _r_o_w_T_o_D_o_m_a_i_n.end(); │ │ │ │ │ +++_i_t_e_r) │ │ │ │ │ +1026 for(_D_o_m_a_i_n_I_t_e_r_a_t_o_r _d=_i_t_e_r->begin(); _d != _i_t_e_r->end(); ++_d) │ │ │ │ │ +1027 domains=std::max(domains, *_d); │ │ │ │ │ +1028 ++domains; │ │ │ │ │ +1029 │ │ │ │ │ +1030 solvers.resize(domains); │ │ │ │ │ +1031 subDomains.resize(domains); │ │ │ │ │ +1032 │ │ │ │ │ +1033 // initialize subdomains to row mapping from row to subdomain mapping │ │ │ │ │ +1034 _s_i_z_e___t_y_p_e row=0; │ │ │ │ │ +1035 for(_R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r _i_t_e_r=_r_o_w_T_o_D_o_m_a_i_n.begin(); _i_t_e_r != _r_o_w_T_o_D_o_m_a_i_n.end(); │ │ │ │ │ +++_i_t_e_r, ++row) │ │ │ │ │ +1036 for(_D_o_m_a_i_n_I_t_e_r_a_t_o_r _d=_i_t_e_r->begin(); _d != _i_t_e_r->end(); ++_d) │ │ │ │ │ +1037 subDomains[*_d].insert(row); │ │ │ │ │ +1038 │ │ │ │ │ +1039#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1040 _s_i_z_e___t_y_p_e i=0; │ │ │ │ │ +1041 typedef typename subdomain_vector::const_iterator iterator; │ │ │ │ │ +1042 for(iterator _i_t_e_r=subDomains.begin(); _i_t_e_r != subDomains.end(); ++_i_t_e_r) { │ │ │ │ │ +1043 typedef typename subdomain_type::const_iterator _e_n_t_r_y___i_t_e_r_a_t_o_r; │ │ │ │ │ +1044 Dune::dvverb<<"domain "<begin(); entry != _i_t_e_r->end(); ++entry) { │ │ │ │ │ +1046 Dune::dvverb<<" "<<*entry; │ │ │ │ │ +1047 } │ │ │ │ │ +1048 Dune::dvverb< │ │ │ │ │ +1052_ _:_:_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s(_r_o_w_T_o_D_o_m_a_i_n, mat, solvers, subDomains, onTheFly); │ │ │ │ │ +1053 } │ │ │ │ │ +1054 │ │ │ │ │ +1055 template │ │ │ │ │ +_1_0_5_6 _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_D_,_T_A_>_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const │ │ │ │ │ +_m_a_t_r_i_x___t_y_p_e& _m_a_t__, │ │ │ │ │ +1057 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& _s_d, │ │ │ │ │ +1058 _f_i_e_l_d___t_y_p_e relaxationFactor, │ │ │ │ │ +1059 bool _f_l_y) │ │ │ │ │ +1060 : _m_a_t(_m_a_t__), solvers(_s_d.size()), subDomains(_s_d), relax(relaxationFactor), │ │ │ │ │ +1061 onTheFly(_f_l_y) │ │ │ │ │ +1062 { │ │ │ │ │ +1063 typedef typename subdomain_vector::const_iterator _D_o_m_a_i_n_I_t_e_r_a_t_o_r; │ │ │ │ │ +1064 │ │ │ │ │ +1065#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1066 _s_i_z_e___t_y_p_e i=0; │ │ │ │ │ +1067 │ │ │ │ │ +1068 for(_D_o_m_a_i_n_I_t_e_r_a_t_o_r _d=_s_d.begin(); _d != _s_d.end(); ++_d,++i) { │ │ │ │ │ +1069 //std::cout<size()<size()>0); │ │ │ │ │ +1071 typedef typename DomainIterator::value_type::const_iterator │ │ │ │ │ +_e_n_t_r_y___i_t_e_r_a_t_o_r; │ │ │ │ │ +1072 Dune::dvverb<<"domain "<begin(); entry != _d->end(); ++entry) { │ │ │ │ │ +1074 Dune::dvverb<<" "<<*entry; │ │ │ │ │ +1075 } │ │ │ │ │ +1076 Dune::dvverb<begin(); row != _d_o_m_a_i_n->end(); ++row) │ │ │ │ │ +1089 _r_o_w_T_o_D_o_m_a_i_n[*row].push_back(_d_o_m_a_i_n_I_d); │ │ │ │ │ +1090 } │ │ │ │ │ +1091 │ │ │ │ │ +1092 maxlength = _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_<_s_l_u_> │ │ │ │ │ +1093_ _:_:_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s(_r_o_w_T_o_D_o_m_a_i_n, mat, solvers, subDomains, onTheFly); │ │ │ │ │ +1094 } │ │ │ │ │ +1095 │ │ │ │ │ +1102 template │ │ │ │ │ +_1_1_0_3 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e {}; │ │ │ │ │ +1104 │ │ │ │ │ +1105 template │ │ │ │ │ +_1_1_0_6 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ │ +1107 { │ │ │ │ │ +_1_1_0_8 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ +_1_1_0_9 static constexpr size_t m = std::decay_t()))>::cols; │ │ │ │ │ +1110 template │ │ │ │ │ +_1_1_1_1 static int _s_i_z_e(const Domain & d) │ │ │ │ │ +1112 { │ │ │ │ │ +1113 assert(n==m); │ │ │ │ │ +1114 return m*d.size(); │ │ │ │ │ +1115 } │ │ │ │ │ +1116 }; │ │ │ │ │ +1117 │ │ │ │ │ +1118 template │ │ │ │ │ +1119 template │ │ │ │ │ +1120 std::size_t │ │ │ │ │ +_1_1_2_1 _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_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_< │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_>, X, Y >,false>:: │ │ │ │ │ +1122 assembleLocalProblems([[maybe_unused]] const RowToDomain& rowToDomain, │ │ │ │ │ +1123 [[maybe_unused]] const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ +1124 [[maybe_unused]] Solvers& solvers, │ │ │ │ │ +1125 const SubDomains& subDomains, │ │ │ │ │ +1126 [[maybe_unused]] bool onTheFly) │ │ │ │ │ +1127 { │ │ │ │ │ +1128 typedef typename SubDomains::const_iterator DomainIterator; │ │ │ │ │ +1129 std::size_t maxlength = 0; │ │ │ │ │ +1130 │ │ │ │ │ +1131 assert(onTheFly); │ │ │ │ │ +1132 │ │ │ │ │ +1133 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ +++domain) │ │ │ │ │ +1134 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ +1135 maxlength*=n; │ │ │ │ │ +1136 │ │ │ │ │ +1137 return maxlength; │ │ │ │ │ +1138 } │ │ │ │ │ +1139 │ │ │ │ │ +1140#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +1141 template class S, typename T, typename A> │ │ │ │ │ +1142 template │ │ │ │ │ +_1_1_4_3 std::size_t │ │ │ │ │ +_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_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>:: │ │ │ │ │ +assembleLocalProblems(const RowToDomain& rowToDomain, │ │ │ │ │ +1144 const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ +1145 Solvers& solvers, │ │ │ │ │ +1146 const SubDomains& subDomains, │ │ │ │ │ +1147 bool onTheFly) │ │ │ │ │ +1148 { │ │ │ │ │ +1149 typedef typename S>::MatrixInitializer MatrixInitializer; │ │ │ │ │ +1150 typedef typename std::vector::iterator │ │ │ │ │ +InitializerIterator; │ │ │ │ │ +1151 typedef typename SubDomains::const_iterator DomainIterator; │ │ │ │ │ +1152 typedef typename Solvers::iterator SolverIterator; │ │ │ │ │ +1153 std::size_t maxlength = 0; │ │ │ │ │ +1154 │ │ │ │ │ +1155 if(onTheFly) { │ │ │ │ │ +1156 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ +++domain) │ │ │ │ │ +1157 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ +1158 maxlength*=Impl::asMatrix(*_m_a_t[0].begin()).N(); │ │ │ │ │ +1159 }else{ │ │ │ │ │ +1160 // initialize the initializers │ │ │ │ │ +1161 DomainIterator domain=subDomains.begin(); │ │ │ │ │ +1162 │ │ │ │ │ +1163 // Create the initializers list. │ │ │ │ │ +1164 std::vector initializers(subDomains.size()); │ │ │ │ │ +1165 │ │ │ │ │ +1166 SolverIterator solver=solvers.begin(); │ │ │ │ │ +1167 for(InitializerIterator initializer=initializers.begin(); │ │ │ │ │ +initializer!=initializers.end(); │ │ │ │ │ +1168 ++initializer, ++solver, ++domain) { │ │ │ │ │ +1169 solver->getInternalMatrix │ │ │ │ │ +().N_=_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e_<_m_a_t_r_i_x___t_y_p_e_>_:_:_s_i_z_e(*domain); │ │ │ │ │ +1170 solver->getInternalMatrix │ │ │ │ │ +().M_=_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e_<_m_a_t_r_i_x___t_y_p_e_>_:_:_s_i_z_e(*domain); │ │ │ │ │ +1171 //solver->setVerbosity(true); │ │ │ │ │ +1172 *initializer=MatrixInitializer(solver->getInternalMatrix()); │ │ │ │ │ +1173 } │ │ │ │ │ +1174 │ │ │ │ │ +1175 // Set up the supermatrices according to the subdomains │ │ │ │ │ +1176 typedef _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_<_s_t_d_:_:_v_e_c_t_o_r_<_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_>, │ │ │ │ │ +1177 RowToDomain, SubDomains> Initializer; │ │ │ │ │ +1178 │ │ │ │ │ +1179 Initializer initializer(initializers, rowToDomain, subDomains); │ │ │ │ │ +1180 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ │ +1181 │ │ │ │ │ +1182 // Calculate the LU decompositions │ │ │ │ │ +1183 for(auto&& s: solvers) │ │ │ │ │ +1184 s.decompose(); │ │ │ │ │ +1185 for (SolverIterator solverIt = solvers.begin(); solverIt != solvers.end(); │ │ │ │ │ +++solverIt) │ │ │ │ │ +1186 { │ │ │ │ │ +1187 assert(solverIt->getInternalMatrix().N() == solverIt->getInternalMatrix │ │ │ │ │ +().M()); │ │ │ │ │ +1188 maxlength = std::max(maxlength, solverIt->getInternalMatrix().N()); │ │ │ │ │ +1189 } │ │ │ │ │ +1190 } │ │ │ │ │ +1191 return maxlength; │ │ │ │ │ +1192 } │ │ │ │ │ +1193 │ │ │ │ │ +1194#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +1195 │ │ │ │ │ +1196 template │ │ │ │ │ +1197 template │ │ │ │ │ +_1_1_9_8 std::size_t _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_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_: │ │ │ │ │ +_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s([[maybe_unused]] const RowToDomain& rowToDomain, │ │ │ │ │ +1199 const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ +1200 Solvers& solvers, │ │ │ │ │ +1201 const SubDomains& subDomains, │ │ │ │ │ +1202 bool onTheFly) │ │ │ │ │ +1203 { │ │ │ │ │ +1204 typedef typename SubDomains::const_iterator DomainIterator; │ │ │ │ │ +1205 typedef typename Solvers::iterator SolverIterator; │ │ │ │ │ +1206 std::size_t maxlength = 0; │ │ │ │ │ +1207 │ │ │ │ │ +1208 if(onTheFly) { │ │ │ │ │ +1209 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ +++domain) │ │ │ │ │ +1210 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ +1211 }else{ │ │ │ │ │ +1212 // initialize the solvers of the local prolems. │ │ │ │ │ +1213 SolverIterator solver=solvers.begin(); │ │ │ │ │ +1214 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ +1215 ++domain, ++solver) { │ │ │ │ │ +1216 solver->setSubMatrix(_m_a_t, *domain); │ │ │ │ │ +1217 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ +1218 } │ │ │ │ │ +1219 } │ │ │ │ │ +1220 │ │ │ │ │ +1221 return maxlength; │ │ │ │ │ +1222 │ │ │ │ │ +1223 } │ │ │ │ │ +1224 │ │ │ │ │ +1225 │ │ │ │ │ +1226 template │ │ │ │ │ +_1_2_2_7 void _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_D_,_T_A_>_:_:_a_p_p_l_y(X& x, const X& b) │ │ │ │ │ +1228 { │ │ │ │ │ +1229 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_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_>_:_:_a_p_p_l_y(*this, x, b); │ │ │ │ │ +1230 } │ │ │ │ │ +1231 │ │ │ │ │ +1232 template │ │ │ │ │ +1233 template │ │ │ │ │ +_1_2_3_4 void _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_D_,_T_A_>_:_:_a_p_p_l_y(X& x, const X& b) │ │ │ │ │ +1235 { │ │ │ │ │ +1236 typedef _s_l_u___v_e_c_t_o_r solver_vector; │ │ │ │ │ +1237 typedef typename │ │ │ │ │ +_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_: │ │ │ │ │ +_s_o_l_v_e_r___i_t_e_r_a_t_o_r iterator; │ │ │ │ │ +1238 typedef typename │ │ │ │ │ +_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_: │ │ │ │ │ +_d_o_m_a_i_n___i_t_e_r_a_t_o_r │ │ │ │ │ +1239 domain_iterator; │ │ │ │ │ +1240 │ │ │ │ │ +1241 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_T_D_> assigner(maxlength, _m_a_t, b, x); │ │ │ │ │ +1242 │ │ │ │ │ +1243 domain_iterator │ │ │ │ │ +_d_o_m_a_i_n=_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_:_b_e_g_i_n │ │ │ │ │ +(subDomains); │ │ │ │ │ +1244 iterator solver = │ │ │ │ │ +_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_:_b_e_g_i_n │ │ │ │ │ +(solvers); │ │ │ │ │ +1245 X v(x); // temporary for the update │ │ │ │ │ +1246 v=0; │ │ │ │ │ +1247 │ │ │ │ │ +1248 typedef typename _A_d_d_e_r_S_e_l_e_c_t_o_r_<_T_M_,_X_,_T_D_ _>_:_:_A_d_d_e_r Adder; │ │ │ │ │ +1249 Adder adder(v, x, assigner, relax); │ │ │ │ │ +1250 │ │ │ │ │ +1251 for(; _d_o_m_a_i_n != │ │ │ │ │ +_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_:_e_n_d │ │ │ │ │ +(subDomains); ++_d_o_m_a_i_n) { │ │ │ │ │ +1252 //Copy rhs to C-array for SuperLU │ │ │ │ │ +1253 std::for_each(_d_o_m_a_i_n->begin(), _d_o_m_a_i_n->end(), assigner); │ │ │ │ │ +1254 assigner.resetIndexForNextDomain(); │ │ │ │ │ +1255 if(onTheFly) { │ │ │ │ │ +1256 // Create the subdomain solver │ │ │ │ │ +1257 _s_l_u _s_d_s_o_l_v_e_r; │ │ │ │ │ +1258 _s_d_s_o_l_v_e_r.setSubMatrix(_m_a_t, *_d_o_m_a_i_n); │ │ │ │ │ +1259 // Apply │ │ │ │ │ +1260 _s_d_s_o_l_v_e_r.apply(assigner.lhs(), assigner.rhs()); │ │ │ │ │ +1261 }else{ │ │ │ │ │ +1262 solver->apply(assigner.lhs(), assigner.rhs()); │ │ │ │ │ +1263 ++solver; │ │ │ │ │ +1264 } │ │ │ │ │ +1265 │ │ │ │ │ +1266 //Add relaxed correction to from SuperLU to v │ │ │ │ │ +1267 std::for_each(_d_o_m_a_i_n->begin(), _d_o_m_a_i_n->end(), adder); │ │ │ │ │ +1268 assigner.resetIndexForNextDomain(); │ │ │ │ │ +1269 │ │ │ │ │ +1270 } │ │ │ │ │ +1271 │ │ │ │ │ +1272 adder.axpy(); │ │ │ │ │ +1273 assigner.deallocate(); │ │ │ │ │ +1274 } │ │ │ │ │ +1275 │ │ │ │ │ +1276 template │ │ │ │ │ +1277 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_2_7_8 ::OverlappingAssignerHelper(std::size_t maxlength, const _B_C_R_S_M_a_t_r_i_x_<_K_, │ │ │ │ │ +_A_l_>& mat_, │ │ │ │ │ +1279 const X& b_, Y& x_) : │ │ │ │ │ +1280 _m_a_t(&mat_), │ │ │ │ │ +1281 rhs_( new DynamicVector<_f_i_e_l_d___t_y_p_e>(maxlength, 42) ), │ │ │ │ │ +1282 lhs_( new DynamicVector<_f_i_e_l_d___t_y_p_e>(maxlength, -42) ), │ │ │ │ │ +1283 b(&b_), │ │ │ │ │ +1284 x(&x_), │ │ │ │ │ +1285 i(0), │ │ │ │ │ +1286 maxlength_(maxlength) │ │ │ │ │ +1287 {} │ │ │ │ │ +1288 │ │ │ │ │ +1289 template │ │ │ │ │ +1290 void │ │ │ │ │ +1291 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_2_9_2 ::deallocate() │ │ │ │ │ +1293 { │ │ │ │ │ +1294 delete rhs_; │ │ │ │ │ +1295 delete lhs_; │ │ │ │ │ +1296 } │ │ │ │ │ +1297 │ │ │ │ │ +1298 template │ │ │ │ │ +1299 void │ │ │ │ │ +1300 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_3_0_1 ::resetIndexForNextDomain() │ │ │ │ │ +1302 { │ │ │ │ │ +1303 i=0; │ │ │ │ │ +1304 } │ │ │ │ │ +1305 │ │ │ │ │ +1306 template │ │ │ │ │ +1307 DynamicVector & │ │ │ │ │ +1308 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_3_0_9 ::lhs() │ │ │ │ │ +1310 { │ │ │ │ │ +1311 return *lhs_; │ │ │ │ │ +1312 } │ │ │ │ │ +1313 │ │ │ │ │ +1314 template │ │ │ │ │ +1315 DynamicVector & │ │ │ │ │ +1316 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_3_1_7 ::rhs() │ │ │ │ │ +1318 { │ │ │ │ │ +1319 return *rhs_; │ │ │ │ │ +1320 } │ │ │ │ │ +1321 │ │ │ │ │ +1322 template │ │ │ │ │ +1323 void │ │ │ │ │ +1324 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_3_2_5 ::relaxResult(_f_i_e_l_d___t_y_p_e relax) │ │ │ │ │ +1326 { │ │ │ │ │ +1327 lhs() *= relax; │ │ │ │ │ +1328 } │ │ │ │ │ +1329 │ │ │ │ │ +1330 template │ │ │ │ │ +1331 void │ │ │ │ │ +1332 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_3_3_3 ::operator()(const _s_i_z_e___t_y_p_e& domainIndex) │ │ │ │ │ +1334 { │ │ │ │ │ +1335 lhs() = 0.0; │ │ │ │ │ +1336#if 0 │ │ │ │ │ +1337 //assign right hand side of current domainindex block │ │ │ │ │ +1338 for(_s_i_z_e___t_y_p_e j=0; j │ │ │ │ │ +1376 void │ │ │ │ │ +1377 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_>, X, Y >,false> │ │ │ │ │ +_1_3_7_8 ::assignResult(_b_l_o_c_k___t_y_p_e& res) │ │ │ │ │ +1379 { │ │ │ │ │ +1380 // assign the result of the local solve to the global vector │ │ │ │ │ +1381 for(_s_i_z_e___t_y_p_e j=0; j class S, typename T, typename A> │ │ │ │ │ +1390 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true> │ │ │ │ │ +_1_3_9_1 ::OverlappingAssignerHelper(std::size_t maxlength, │ │ │ │ │ +1392 const _B_C_R_S_M_a_t_r_i_x_<_T_,_A_>& mat_, │ │ │ │ │ +1393 const _r_a_n_g_e___t_y_p_e& b_, │ │ │ │ │ +1394 _r_a_n_g_e___t_y_p_e& x_) │ │ │ │ │ +1395 : _m_a_t(&mat_), │ │ │ │ │ +1396 b(&b_), │ │ │ │ │ +1397 x(&x_), i(0), maxlength_(maxlength) │ │ │ │ │ +1398 { │ │ │ │ │ +1399 rhs_ = new _f_i_e_l_d___t_y_p_e[maxlength]; │ │ │ │ │ +1400 lhs_ = new _f_i_e_l_d___t_y_p_e[maxlength]; │ │ │ │ │ +1401 │ │ │ │ │ +1402 } │ │ │ │ │ +1403 │ │ │ │ │ +1404 template class S, typename T, typename A> │ │ │ │ │ +_1_4_0_5 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_> >,true>::deallocate() │ │ │ │ │ +1406 { │ │ │ │ │ +1407 delete[] rhs_; │ │ │ │ │ +1408 delete[] lhs_; │ │ │ │ │ +1409 } │ │ │ │ │ +1410 │ │ │ │ │ +1411 template class S, typename T, typename A> │ │ │ │ │ +_1_4_1_2 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::operator()(const │ │ │ │ │ +_s_i_z_e___t_y_p_e& domainIndex) │ │ │ │ │ +1413 { │ │ │ │ │ +1414 //assign right hand side of current domainindex block │ │ │ │ │ +1415 // rhs is an array of doubles! │ │ │ │ │ +1416 // rhs[starti] = b[domainindex] │ │ │ │ │ +1417 for(_s_i_z_e___t_y_p_e j=0; j class S, typename T, typename A> │ │ │ │ │ +_1_4_4_1 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::relaxResult │ │ │ │ │ +(_f_i_e_l_d___t_y_p_e relax) │ │ │ │ │ +1442 { │ │ │ │ │ +1443 for(_s_i_z_e___t_y_p_e j=i+n; i class S, typename T, typename A> │ │ │ │ │ +_1_4_5_1 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::assignResult │ │ │ │ │ +(_b_l_o_c_k___t_y_p_e& res) │ │ │ │ │ +1452 { │ │ │ │ │ +1453 // assign the result of the local solve to the global vector │ │ │ │ │ +1454 for(_s_i_z_e___t_y_p_e j=0; j class S, typename T, typename A> │ │ │ │ │ +_1_4_6_1 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>:: │ │ │ │ │ +resetIndexForNextDomain() │ │ │ │ │ +1462 { │ │ │ │ │ +1463 i=0; │ │ │ │ │ +1464 } │ │ │ │ │ +1465 │ │ │ │ │ +1466 template class S, typename T, typename A> │ │ │ │ │ +1467 typename _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::field_type* │ │ │ │ │ +_1_4_6_8 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::lhs() │ │ │ │ │ +1469 { │ │ │ │ │ +1470 return lhs_; │ │ │ │ │ +1471 } │ │ │ │ │ +1472 │ │ │ │ │ +1473 template class S, typename T, typename A> │ │ │ │ │ +1474 typename _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::field_type* │ │ │ │ │ +_1_4_7_5 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::rhs() │ │ │ │ │ +1476 { │ │ │ │ │ +1477 return rhs_; │ │ │ │ │ +1478 } │ │ │ │ │ +1479 │ │ │ │ │ +1480#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +1481 │ │ │ │ │ +1482 template │ │ │ │ │ +_1_4_8_3 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(std::size_t │ │ │ │ │ +maxlength, │ │ │ │ │ +1484 const M& mat_, │ │ │ │ │ +1485 const Y& b_, │ │ │ │ │ +1486 X& x_) │ │ │ │ │ +1487 : _m_a_t(&mat_), │ │ │ │ │ +1488 b(&b_), │ │ │ │ │ +1489 x(&x_), i(0) │ │ │ │ │ +1490 { │ │ │ │ │ +1491 rhs_= new Y(maxlength); │ │ │ │ │ +1492 lhs_ = new X(maxlength); │ │ │ │ │ +1493 } │ │ │ │ │ +1494 │ │ │ │ │ +1495 template │ │ │ │ │ +_1_4_9_6 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_d_e_a_l_l_o_c_a_t_e() │ │ │ │ │ +1497 { │ │ │ │ │ +1498 delete rhs_; │ │ │ │ │ +1499 delete lhs_; │ │ │ │ │ +1500 } │ │ │ │ │ +1501 │ │ │ │ │ +1502 template │ │ │ │ │ +_1_5_0_3 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_o_p_e_r_a_t_o_r_(_)(const _s_i_z_e___t_y_p_e& │ │ │ │ │ +domainIndex) │ │ │ │ │ +1504 { │ │ │ │ │ +1505 (*rhs_)[i]=(*b)[domainIndex]; │ │ │ │ │ +1506 │ │ │ │ │ +1507 // loop over all Matrix row entries and calculate defect. │ │ │ │ │ +1508 typedef typename matrix_type::ConstColIterator col_iterator; │ │ │ │ │ +1509 │ │ │ │ │ +1510 // calculate defect for current row index block │ │ │ │ │ +1511 for(col_iterator _c_o_l=(*_m_a_t)[domainIndex].begin(); _c_o_l!=(*mat) │ │ │ │ │ +[domainIndex].end(); ++_c_o_l) { │ │ │ │ │ +1512 Impl::asMatrix(*col).mmv((*x)[_c_o_l.index()], (*rhs_)[i]); │ │ │ │ │ +1513 } │ │ │ │ │ +1514 // Goto next local index │ │ │ │ │ +1515 ++i; │ │ │ │ │ +1516 } │ │ │ │ │ +1517 │ │ │ │ │ +1518 template │ │ │ │ │ +_1_5_1_9 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_r_e_l_a_x_R_e_s_u_l_t(_f_i_e_l_d___t_y_p_e relax) │ │ │ │ │ +1520 { │ │ │ │ │ +1521 (*lhs_)[i]*=relax; │ │ │ │ │ +1522 } │ │ │ │ │ +1523 │ │ │ │ │ +1524 template │ │ │ │ │ +_1_5_2_5 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_a_s_s_i_g_n_R_e_s_u_l_t(_b_l_o_c_k___t_y_p_e& res) │ │ │ │ │ +1526 { │ │ │ │ │ +1527 res+=(*lhs_)[i++]; │ │ │ │ │ +1528 } │ │ │ │ │ +1529 │ │ │ │ │ +1530 template │ │ │ │ │ +_1_5_3_1 X& _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_l_h_s() │ │ │ │ │ +1532 { │ │ │ │ │ +1533 return *lhs_; │ │ │ │ │ +1534 } │ │ │ │ │ +1535 │ │ │ │ │ +1536 template │ │ │ │ │ +_1_5_3_7 Y& _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_r_h_s() │ │ │ │ │ +1538 { │ │ │ │ │ +1539 return *rhs_; │ │ │ │ │ +1540 } │ │ │ │ │ +1541 │ │ │ │ │ +1542 template │ │ │ │ │ +_1_5_4_3 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_r_e_s_e_t_I_n_d_e_x_F_o_r_N_e_x_t_D_o_m_a_i_n() │ │ │ │ │ +1544 { │ │ │ │ │ +1545 i=0; │ │ │ │ │ +1546 } │ │ │ │ │ +1547 │ │ │ │ │ +1548 template │ │ │ │ │ +_1_5_4_9 _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::AdditiveAdder(_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v_, │ │ │ │ │ +1550 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x_, │ │ │ │ │ +1551 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner_, │ │ │ │ │ +1552 const _f_i_e_l_d___t_y_p_e& relax_) │ │ │ │ │ +1553 : v(&v_), x(&x_), assigner(&assigner_), relax(relax_) │ │ │ │ │ +1554 {} │ │ │ │ │ +1555 │ │ │ │ │ +1556 template │ │ │ │ │ +_1_5_5_7 void _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::operator()(const _s_i_z_e___t_y_p_e& │ │ │ │ │ +domainIndex) │ │ │ │ │ +1558 { │ │ │ │ │ +1559 // add the result of the local solve to the current update │ │ │ │ │ +1560 assigner->assignResult((*v)[domainIndex]); │ │ │ │ │ +1561 } │ │ │ │ │ +1562 │ │ │ │ │ +1563 │ │ │ │ │ +1564 template │ │ │ │ │ +_1_5_6_5 void _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::axpy() │ │ │ │ │ +1566 { │ │ │ │ │ +1567 // relax the update and add it to the current guess. │ │ │ │ │ +1568 x->axpy(relax,*v); │ │ │ │ │ +1569 } │ │ │ │ │ +1570 │ │ │ │ │ +1571 │ │ │ │ │ +1572 template │ │ │ │ │ +1573 _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> > │ │ │ │ │ +_1_5_7_4 ::MultiplicativeAdder([[maybe_unused]] _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v_, │ │ │ │ │ +1575 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x_, │ │ │ │ │ +1576 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner_, const _f_i_e_l_d___t_y_p_e& relax_) │ │ │ │ │ +1577 : x(&x_), assigner(&assigner_), relax(relax_) │ │ │ │ │ +1578 {} │ │ │ │ │ +1579 │ │ │ │ │ +1580 │ │ │ │ │ +1581 template │ │ │ │ │ +_1_5_8_2 void _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::operator()(const _s_i_z_e___t_y_p_e& │ │ │ │ │ +domainIndex) │ │ │ │ │ +1583 { │ │ │ │ │ +1584 // add the result of the local solve to the current guess │ │ │ │ │ +1585 assigner->relaxResult(relax); │ │ │ │ │ +1586 assigner->assignResult((*x)[domainIndex]); │ │ │ │ │ +1587 } │ │ │ │ │ +1588 │ │ │ │ │ +1589 │ │ │ │ │ +1590 template │ │ │ │ │ +_1_5_9_1 void _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::axpy() │ │ │ │ │ +1592 { │ │ │ │ │ +1593 // nothing to do, as the corrections already relaxed and added in operator │ │ │ │ │ +() │ │ │ │ │ +1594 } │ │ │ │ │ +1595 │ │ │ │ │ +1596 │ │ │ │ │ +1598} │ │ │ │ │ +1599 │ │ │ │ │ +1600#endif │ │ │ │ │ +_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ +Define general preconditioner interface. │ │ │ │ │ +_s_u_p_e_r_l_u_._h_h │ │ │ │ │ +Classes for using SuperLU with ISTL matrices. │ │ │ │ │ +_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ +Templates characterizing the type of a solver. │ │ │ │ │ +_u_m_f_p_a_c_k_._h_h │ │ │ │ │ +Classes for using UMFPack with ISTL matrices. │ │ │ │ │ +_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... │ │ │ │ │ +_i_l_u_s_u_b_d_o_m_a_i_n_s_o_l_v_e_r_._h_h │ │ │ │ │ +Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_a_d_d_R_o_w_N_n_z │ │ │ │ │ +void addRowNnz(const Iter &row) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:895 │ │ │ │ │ +_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_p_p_l_y │ │ │ │ │ +void apply(X &v, const X &d) │ │ │ │ │ +Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1234 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_l_h_s │ │ │ │ │ +X & lhs() │ │ │ │ │ +Get the local left hand side. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1531 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_a_l_c_C_o_l_s_t_a_r_t │ │ │ │ │ +void calcColstart() const │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:926 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_r_h_s │ │ │ │ │ +Y & rhs() │ │ │ │ │ +Get the local right hand side. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1537 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:989 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_r_e_s_e_t_I_n_d_e_x_F_o_r_N_e_x_t_D_o_m_a_i_n │ │ │ │ │ +void resetIndexForNextDomain() │ │ │ │ │ +Resets the local index to zero. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1543 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_o_p_y_V_a_l_u_e │ │ │ │ │ +void copyValue(const Iter &row, const CIter &col) const │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:933 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_r_e_a_t_e_M_a_t_r_i_x │ │ │ │ │ +void createMatrix() const │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:947 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1003 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_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 │ │ │ │ │ +OverlappingSchwarzInitializer(InitializerList &il, const IndexSet &indices, │ │ │ │ │ +const subdomain_vector &domains) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:887 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_I_n_d_e_x_M_a_p │ │ │ │ │ +IndexMap() │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:955 │ │ │ │ │ +_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_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const X &d) │ │ │ │ │ +Apply the precondtioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1227 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ +OverlappingAssignerILUBase(std::size_t maxlength, const M &mat, const Y &b, X │ │ │ │ │ +&x) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1483 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_f_i_n_d │ │ │ │ │ +const_iterator find(size_type grow) const │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:968 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const size_type &domain) │ │ │ │ │ +calculate one entry of the local defect. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1503 │ │ │ │ │ +_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_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ +SeqOverlappingSchwarz(const matrix_type &mat, const subdomain_vector │ │ │ │ │ +&subDomains, field_type relaxationFactor=1, bool onTheFly_=true) │ │ │ │ │ +Construct the overlapping Schwarz method. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1056 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ +void allocate() │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:905 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_d_e_a_l_l_o_c_a_t_e │ │ │ │ │ +void deallocate() │ │ │ │ │ +Deallocates memory of the local vector. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1496 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_i_n_s_e_r_t │ │ │ │ │ +void insert(size_type grow) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:960 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_o_u_n_t_E_n_t_r_i_e_s │ │ │ │ │ +void countEntries(const Iter &row, const CIter &col) const │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:914 │ │ │ │ │ +_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_I_L_U_B_a_s_e_:_:_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s │ │ │ │ │ +static std::size_t assembleLocalProblems(const RowToDomain &rowToDomain, const │ │ │ │ │ +matrix_type &mat, Solvers &solvers, const SubDomains &domains, bool onTheFly) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1198 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_r_e_l_a_x_R_e_s_u_l_t │ │ │ │ │ +void relaxResult(field_type relax) │ │ │ │ │ +relax the result. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1519 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_a_s_s_i_g_n_R_e_s_u_l_t │ │ │ │ │ +void assignResult(block_type &res) │ │ │ │ │ +Assigns the block to the current local index. At the same time the local defect │ │ │ │ │ +is calculated for the... │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1525 │ │ │ │ │ +_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_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ +SeqOverlappingSchwarz(const matrix_type &mat, const rowtodomain_vector │ │ │ │ │ +&rowToDomain, field_type relaxationFactor=1, bool onTheFly_=true) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1009 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_b_l_o_c_k_L_e_v_e_l │ │ │ │ │ -constexpr std::size_t blockLevel() │ │ │ │ │ -Determine the block level of a possibly nested vector/matrix type. │ │ │ │ │ -DDeeffiinniittiioonn blocklevel.hh:176 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_F_a_c_t_o_r_y_C_o_n_f_i_g_u_r_a_t_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:79 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ +Initializer for SuperLU Matrices representing the subdomains. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_C_I_t_e_r │ │ │ │ │ +Matrix::row_type::const_iterator CIter │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_S_e_t │ │ │ │ │ +S IndexSet │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_t_e_r │ │ │ │ │ +Matrix::const_iterator Iter │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +IndexSet::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_i_t_i_a_l_i_z_e_r_L_i_s_t │ │ │ │ │ +I InitializerList │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ +AtomInitializer::Matrix Matrix │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_A_t_o_m_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ +InitializerList::value_type AtomInitializer │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ +D subdomain_vector │ │ │ │ │ +The vector type containing the subdomain to row index mapping. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +Iterator end() │ │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:681 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The type for the index access and the size. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::ConstIterator ConstColIterator │ │ │ │ │ +Const iterator to the entries of a row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:741 │ │ │ │ │ +_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:395 │ │ │ │ │ +_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_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:111 │ │ │ │ │ +_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_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:783 │ │ │ │ │ +_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_:_:_s_u_b_d_o_m_a_i_n___l_i_s_t │ │ │ │ │ +SLList< size_type, typename std::allocator_traits< TA >::template rebind_alloc< │ │ │ │ │ +size_type > > subdomain_list │ │ │ │ │ +The type for the row to subdomain mapping. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:800 │ │ │ │ │ +_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_:_:_s_l_u___v_e_c_t_o_r │ │ │ │ │ +std::vector< slu, typename std::allocator_traits< TA >::template rebind_alloc< │ │ │ │ │ +slu > > slu_vector │ │ │ │ │ +The vector type containing subdomain solvers. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:809 │ │ │ │ │ +_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_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +The type of the matrix to precondition. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:760 │ │ │ │ │ +_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_:_:_M_o_d_e │ │ │ │ │ +TM Mode │ │ │ │ │ +The mode (additive or multiplicative) of the Schwarz method. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:778 │ │ │ │ │ +_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +X range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:770 │ │ │ │ │ +_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_:_:_s_u_b_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +std::set< size_type, std::less< size_type >, typename std::allocator_traits< TA │ │ │ │ │ +>::template rebind_alloc< size_type > > subdomain_type │ │ │ │ │ +The type for the subdomain to row index mapping. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:794 │ │ │ │ │ +_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:765 │ │ │ │ │ +_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_:_:_s_l_u │ │ │ │ │ +TD slu │ │ │ │ │ +The type for the subdomain solver in use. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:806 │ │ │ │ │ +_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:868 │ │ │ │ │ +_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_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, X &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:846 │ │ │ │ │ +_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_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ +Postprocess the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:861 │ │ │ │ │ +_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_l_l_o_c_a_t_o_r │ │ │ │ │ +TA allocator │ │ │ │ │ +The allocator to use. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:789 │ │ │ │ │ +_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_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ +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. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:797 │ │ │ │ │ +_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_:_:_r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ +std::vector< subdomain_list, typename std::allocator_traits< TA >::template │ │ │ │ │ +rebind_alloc< subdomain_list > > rowtodomain_vector │ │ │ │ │ +The vector type containing the row index to subdomain mapping. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:803 │ │ │ │ │ +_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_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +matrix_type::size_type size_type │ │ │ │ │ +The return type of the size method. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:786 │ │ │ │ │ +_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_:_:_A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e │ │ │ │ │ +Tag that the tells the Schwarz method to be additive. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ +Tag that tells the Schwarz method to be multiplicative. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_S_y_m_m_e_t_r_i_c_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 │ │ │ │ │ +Tag that tells the Schwarz method to be multiplicative and symmetric. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:133 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ +Exact subdomain solver using Dune::DynamicMatrix::solve. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_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 overlappingschwarz.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ +void setSubMatrix(const M &BCRS, S &rowset) │ │ │ │ │ +Set the data of the local problem. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:184 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_a_p_p_l_y │ │ │ │ │ +void apply(DynamicVector< field_type > &v, DynamicVector< field_type > &d) │ │ │ │ │ +Apply the subdomain solver. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:162 │ │ │ │ │ +_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_r_i_l_u___t_y_p_e │ │ │ │ │ +std::remove_const< M >::type rilu_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:215 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +matrix_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:226 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +BCRSMatrix< K, Al > matrix_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:225 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:227 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ +_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +range_type::block_type block_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:228 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +S< BCRSMatrix< T, A > >::range_type range_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:315 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +range_type::block_type block_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:317 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +range_type::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:316 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +matrix_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:319 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +BCRSMatrix< T, A > matrix_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:314 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:400 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +matrix_type::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:408 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +Y::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:404 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +Y::block_type block_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:406 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:402 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_: │ │ │ │ │ +_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ +OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X │ │ │ │ │ +&x) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:493 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_: │ │ │ │ │ +_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ +OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X │ │ │ │ │ +&x) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:512 │ │ │ │ │ +_D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type │ │ │ │ │ +field_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:526 │ │ │ │ │ +_D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:525 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:542 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:547 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type │ │ │ │ │ +field_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:548 │ │ │ │ │ +_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ +template meta program for choosing how to add the correction. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:572 │ │ │ │ │ +_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_ _X_,_ _S_ _>_:_:_A_d_d_e_r │ │ │ │ │ +AdditiveAdder< S, X > Adder │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:577 │ │ │ │ │ +_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _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_,_ _X_,_ _S_ _>_:_:_A_d_d_e_r │ │ │ │ │ +MultiplicativeAdder< S, X > Adder │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:583 │ │ │ │ │ +_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _S_y_m_m_e_t_r_i_c_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_,_ _X_,_ _S_ _>_:_:_A_d_d_e_r │ │ │ │ │ +MultiplicativeAdder< S, X > Adder │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:589 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r │ │ │ │ │ +Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:605 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +static solver_iterator begin(solver_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:611 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_s_o_l_v_e_r___i_t_e_r_a_t_o_r │ │ │ │ │ +solver_vector::iterator solver_iterator │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:607 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ +static domain_iterator end(const subdomain_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:625 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_d_o_m_a_i_n___i_t_e_r_a_t_o_r │ │ │ │ │ +subdomain_vector::const_iterator domain_iterator │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:609 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_s_o_l_v_e_r___v_e_c_t_o_r │ │ │ │ │ +T1 solver_vector │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:606 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +static domain_iterator begin(const subdomain_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:620 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ +T2 subdomain_vector │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:608 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ +static solver_iterator end(solver_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:616 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ +T2 subdomain_vector │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:636 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_e_n_d │ │ │ │ │ +static solver_iterator end(solver_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:644 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_s_o_l_v_e_r___i_t_e_r_a_t_o_r │ │ │ │ │ +solver_vector::reverse_iterator solver_iterator │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:635 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_d_o_m_a_i_n___i_t_e_r_a_t_o_r │ │ │ │ │ +subdomain_vector::const_reverse_iterator domain_iterator │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:637 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_b_e_g_i_n │ │ │ │ │ +static solver_iterator begin(solver_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:639 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_s_o_l_v_e_r___v_e_c_t_o_r │ │ │ │ │ +T1 solver_vector │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:634 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_b_e_g_i_n │ │ │ │ │ +static domain_iterator begin(const subdomain_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:648 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_e_n_d │ │ │ │ │ +static domain_iterator end(const subdomain_vector &sv) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:653 │ │ │ │ │ +_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_p_p_l_i_e_r │ │ │ │ │ +Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:669 │ │ │ │ │ +_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_p_p_l_i_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +smoother::range_type range_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:671 │ │ │ │ │ +_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_p_p_l_i_e_r_:_:_s_m_o_o_t_h_e_r │ │ │ │ │ +T smoother │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:670 │ │ │ │ │ +_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_p_p_l_i_e_r_:_:_a_p_p_l_y │ │ │ │ │ +static void apply(smoother &sm, range_type &v, const range_type &b) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:673 │ │ │ │ │ +_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_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_, │ │ │ │ │ +_S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ │ +static void apply(smoother &sm, range_type &v, const range_type &b) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:685 │ │ │ │ │ +_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_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_, │ │ │ │ │ +_S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _>_:_:_s_m_o_o_t_h_e_r │ │ │ │ │ +SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > │ │ │ │ │ +smoother │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:682 │ │ │ │ │ +_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_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_, │ │ │ │ │ +_S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +smoother::range_type range_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:683 │ │ │ │ │ +_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_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_< │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +BCRSMatrix< K, Al > matrix_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:702 │ │ │ │ │ +_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_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_: │ │ │ │ │ +_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +BCRSMatrix< T, A > matrix_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:713 │ │ │ │ │ +_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_I_L_U_B_a_s_e │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:723 │ │ │ │ │ +_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_I_L_U_B_a_s_e_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:724 │ │ │ │ │ +_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_D_o_m_a_i_n_S_i_z_e │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1103 │ │ │ │ │ +_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_D_o_m_a_i_n_S_i_z_e_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_s_i_z_e │ │ │ │ │ +static int size(const Domain &d) │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:1111 │ │ │ │ │ +_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: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 │ │ │ │ │ +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.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: supermatrix.hh File Reference │ │ │ │ +dune-istl: solvers.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,63 +71,111 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
supermatrix.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#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"
│ │ │ │ + │ │ │ │ +

Implementations of the inverse operator interface. │ │ │ │ +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>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::SuperMatrixCreateSparseChooser< T >
 
struct  Dune::SuperMatrixPrinter< T >
class  Dune::LoopSolver< X >
 Preconditioned loop solver. More...
 
struct  Dune::BaseGetSuperLUType< T >
class  Dune::GradientSolver< X >
 gradient method More...
 
struct  Dune::GetSuperLUType< T >
class  Dune::CGSolver< X >
 conjugate gradient method More...
 
struct  Dune::GetSuperLUType< double >
class  Dune::BiCGSTABSolver< X >
 Bi-conjugate Gradient Stabilized (BiCG-STAB) More...
 
struct  Dune::GetSuperLUType< float >
class  Dune::MINRESSolver< X >
 Minimal Residual Method (MINRES) More...
 
struct  Dune::GetSuperLUType< std::complex< double > >
class  Dune::RestartedGMResSolver< X, Y, F >
 implements the Generalized Minimal Residual (GMRes) method More...
 
struct  Dune::GetSuperLUType< std::complex< float > >
class  Dune::RestartedFlexibleGMResSolver< X, Y, F >
 implements the Flexible Generalized Minimal Residual (FGMRes) method (right preconditioned) More...
 
struct  Dune::SuperLUMatrix< M >
 Utility class for converting an ISTL Matrix into a SuperLU Matrix. More...
class  Dune::GeneralizedPCGSolver< X >
 Generalized preconditioned conjugate gradient solver. More...
 
struct  Dune::SuperMatrixInitializer< M >
class  Dune::RestartedFCGSolver< X >
 Accelerated flexible conjugate gradient method. More...
 
class  Dune::SuperLUMatrix< BCRSMatrix< B, TA > >
 Converter for BCRSMatrix to SuperLU Matrix. More...
 
class  Dune::SuperMatrixInitializer< BCRSMatrix< B, A > >
class  Dune::CompleteFCGSolver< X >
 Complete flexible conjugate gradient method. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

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

Detailed Description

│ │ │ │ +

Implementations of the inverse operator interface.

│ │ │ │ +

This file provides various preconditioned Krylov methods.

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

Implementation of the BDMatrix class. │ │ │ │ +More...

│ │ │ │ +
#include <memory>
│ │ │ │ +#include <dune/common/rangeutilities.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::BDMatrix< B, A >
 A block-diagonal matrix. More...
 
struct  Dune::FieldTraits< BDMatrix< B, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Macros

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

│ │ │ │ -Variables

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

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ DUNE_GET_COUNTER

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

◆ DUNE_INC_COUNTER

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

Variable Documentation

│ │ │ │ - │ │ │ │ -

◆ maxcount

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

Detailed Description

│ │ │ │ +

Implementation of the BDMatrix class.

│ │ │ │ +
Author
Oliver Sander
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,56 +1,30 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _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 │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +bdmatrix.hh File Reference │ │ │ │ │ +Implementation of the BDMatrix class. _M_o_r_e_._._. │ │ │ │ │ #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_l_o_c_k_l_e_v_e_l_._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_. │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  │ │ │ │ │ -namespace   _D_u_n_e_:_:_C_o_u_n_t_e_r_I_m_p_l │ │ │ │ │ +CCllaasssseess │ │ │ │ │ + class   _D_u_n_e_:_:_B_D_M_a_t_r_i_x_<_ _B_,_ _A_ _> │ │ │ │ │ +  A block-diagonal matrix. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___G_E_T___C_O_U_N_T_E_R(Tag)    (counterFunc(Dune::PriorityTag<_m_a_x_c_o_u_n_t>{}, │ │ │ │ │ - Tag{}, Dune::CounterImpl::ADLTag{})) │ │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _> │ │ │ │ │   │ │ │ │ │ -#define  _D_U_N_E___I_N_C___C_O_U_N_T_E_R(Tag) │ │ │ │ │ -  │ │ │ │ │ -VVaarriiaabblleess │ │ │ │ │ -constexpr std::size_t  _m_a_x_c_o_u_n_t = 100 │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__GGEETT__CCOOUUNNTTEERR ********** │ │ │ │ │ -#define DUNE_GET_COUNTER (   Tag )     (counterFunc(Dune::PriorityTag<_m_a_x_c_o_u_n_t> │ │ │ │ │ - {}, Tag{}, Dune::CounterImpl::ADLTag{})) │ │ │ │ │ -********** _?◆_? DDUUNNEE__IINNCC__CCOOUUNNTTEERR ********** │ │ │ │ │ -#define DUNE_INC_COUNTER (   Tag ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -namespace { \ │ │ │ │ │ -namespace CounterImpl { \ │ │ │ │ │ -constexpr std::size_t \ │ │ │ │ │ -counterFunc(Dune::PriorityTag<_D_U_N_E___G_E_T___C_O_U_N_T_E_R(Tag)+1> p, Tag, ADLTag) \ │ │ │ │ │ -{ \ │ │ │ │ │ -return p.value; \ │ │ │ │ │ -} \ │ │ │ │ │ -} \ │ │ │ │ │ -} \ │ │ │ │ │ -static_assert(true, "unfudge indentation") │ │ │ │ │ -_D_U_N_E___G_E_T___C_O_U_N_T_E_R │ │ │ │ │ -#define DUNE_GET_COUNTER(Tag) │ │ │ │ │ -DDeeffiinniittiioonn counter.hh:17 │ │ │ │ │ -********** VVaarriiaabbllee DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? mmaaxxccoouunntt ********** │ │ │ │ │ -constexpr std::size_t maxcount = 100 constexpr │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Implementation of the BDMatrix class. │ │ │ │ │ + Author │ │ │ │ │ + Oliver Sander │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: counter.hh Source File │ │ │ │ +dune-istl: bdmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,77 +70,193 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
counter.hh
│ │ │ │ +
bdmatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
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>
│ │ │ │ +
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_BDMATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_BDMATRIX_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <memory>
│ │ │ │ +
9
│ │ │ │ +
10#include <dune/common/rangeutilities.hh>
│ │ │ │ +
11#include <dune/common/scalarmatrixview.hh>
│ │ │ │
12
│ │ │ │ -
13#include <dune/common/typeutilities.hh>
│ │ │ │ -
14
│ │ │ │ -
15constexpr std::size_t maxcount = 100;
│ │ │ │ -
16
│ │ │ │ -
│ │ │ │ -
17#define DUNE_GET_COUNTER(Tag) \
│ │ │ │ -
18 (counterFunc(Dune::PriorityTag<maxcount>{}, Tag{}, Dune::CounterImpl::ADLTag{}))
│ │ │ │ -
│ │ │ │ -
19
│ │ │ │ -
│ │ │ │ -
20#define DUNE_INC_COUNTER(Tag) \
│ │ │ │ -
21 namespace { \
│ │ │ │ -
22 namespace CounterImpl { \
│ │ │ │ -
23 constexpr std::size_t \
│ │ │ │ -
24 counterFunc(Dune::PriorityTag<DUNE_GET_COUNTER(Tag)+1> p, Tag, ADLTag) \
│ │ │ │ -
25 { \
│ │ │ │ -
26 return p.value; \
│ │ │ │ -
27 } \
│ │ │ │ -
28 } \
│ │ │ │ -
29 } \
│ │ │ │ -
30 static_assert(true, "unfudge indentation")
│ │ │ │ -
│ │ │ │ -
31
│ │ │ │ -
32namespace Dune {
│ │ │ │ -
33 namespace {
│ │ │ │ -
34
│ │ │ │ -
│ │ │ │ -
35 namespace CounterImpl {
│ │ │ │ -
36
│ │ │ │ -
37 struct ADLTag {};
│ │ │ │ -
38
│ │ │ │ -
39 template<class Tag>
│ │ │ │ -
40 constexpr std::size_t counterFunc(Dune::PriorityTag<0>, Tag, ADLTag)
│ │ │ │ -
41 {
│ │ │ │ -
42 return 0;
│ │ │ │ -
43 }
│ │ │ │ -
44
│ │ │ │ -
45 } // end namespace CounterImpl
│ │ │ │ -
│ │ │ │ -
46 } // end empty namespace
│ │ │ │ -
47} // end namespace Dune
│ │ │ │ -
48#endif // DUNE_ISTL_COMMON_COUNTER_HH
│ │ │ │ -
constexpr std::size_t maxcount
Definition counter.hh:15
│ │ │ │ + │ │ │ │ + │ │ │ │ +
15
│ │ │ │ +
21namespace Dune {
│ │ │ │ +
31 template <class B, class A=std::allocator<B> >
│ │ │ │ +
│ │ │ │ +
32 class BDMatrix : public BCRSMatrix<B,A>
│ │ │ │ +
33 {
│ │ │ │ +
34 public:
│ │ │ │ +
35
│ │ │ │ +
36 //===== type definitions and constants
│ │ │ │ +
37
│ │ │ │ +
39 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
40
│ │ │ │ +
42 typedef B block_type;
│ │ │ │ +
43
│ │ │ │ +
45 typedef A allocator_type;
│ │ │ │ +
46
│ │ │ │ +
48 //typedef BCRSMatrix<B,A>::row_type row_type;
│ │ │ │ +
49
│ │ │ │ +
51 typedef typename A::size_type size_type;
│ │ │ │ +
52
│ │ │ │ +
54 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
55 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ +
56
│ │ │ │ +
58 BDMatrix() : BCRSMatrix<B,A>() {}
│ │ │ │ +
59
│ │ │ │ +
│ │ │ │ +
60 explicit BDMatrix(int size)
│ │ │ │ +
61 : BCRSMatrix<B,A>(size, size, BCRSMatrix<B,A>::random) {
│ │ │ │ +
62
│ │ │ │ +
63 for (int i=0; i<size; i++)
│ │ │ │ + │ │ │ │ +
65
│ │ │ │ + │ │ │ │ +
67
│ │ │ │ +
68 for (int i=0; i<size; i++)
│ │ │ │ +
69 this->BCRSMatrix<B,A>::addindex(i, i);
│ │ │ │ +
70
│ │ │ │ + │ │ │ │ +
72
│ │ │ │ +
73 }
│ │ │ │ +
│ │ │ │ +
74
│ │ │ │ +
│ │ │ │ +
76 BDMatrix (std::initializer_list<B> const &list)
│ │ │ │ +
77 : BDMatrix(list.size())
│ │ │ │ +
78 {
│ │ │ │ +
79 size_t i=0;
│ │ │ │ +
80 for (auto it = list.begin(); it != list.end(); ++it, ++i)
│ │ │ │ +
81 (*this)[i][i] = *it;
│ │ │ │ +
82 }
│ │ │ │ +
│ │ │ │ +
83
│ │ │ │ +
│ │ │ │ +
85 void setSize(size_type size)
│ │ │ │ +
86 {
│ │ │ │ +
87 this->BCRSMatrix<B,A>::setSize(size, // rows
│ │ │ │ +
88 size, // columns
│ │ │ │ +
89 size); // nonzeros
│ │ │ │ +
90
│ │ │ │ +
91 for (auto i : range(size))
│ │ │ │ + │ │ │ │ +
93
│ │ │ │ + │ │ │ │ +
95
│ │ │ │ +
96 for (auto i : range(size))
│ │ │ │ +
97 this->BCRSMatrix<B,A>::addindex(i, i);
│ │ │ │ +
98
│ │ │ │ + │ │ │ │ +
100 }
│ │ │ │ +
│ │ │ │ +
101
│ │ │ │ +
│ │ │ │ +
103 BDMatrix& operator= (const BDMatrix& other) {
│ │ │ │ +
104 this->BCRSMatrix<B,A>::operator=(other);
│ │ │ │ +
105 return *this;
│ │ │ │ +
106 }
│ │ │ │ +
│ │ │ │ +
107
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
111 return *this;
│ │ │ │ +
112 }
│ │ │ │ +
│ │ │ │ +
113
│ │ │ │ +
119 template <class V>
│ │ │ │ +
│ │ │ │ +
120 void solve (V& x, const V& rhs) const {
│ │ │ │ +
121 for (size_type i=0; i<this->N(); i++)
│ │ │ │ +
122 {
│ │ │ │ +
123 auto&& xv = Impl::asVector(x[i]);
│ │ │ │ +
124 auto&& rhsv = Impl::asVector(rhs[i]);
│ │ │ │ +
125 Impl::asMatrix((*this)[i][i]).solve(xv,rhsv);
│ │ │ │ +
126 }
│ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │ +
128
│ │ │ │ +
│ │ │ │ +
130 void invert() {
│ │ │ │ +
131 for (size_type i=0; i<this->N(); i++)
│ │ │ │ +
132 Impl::asMatrix((*this)[i][i]).invert();
│ │ │ │ +
133 }
│ │ │ │ +
│ │ │ │ +
134
│ │ │ │ +
135 private:
│ │ │ │ +
136
│ │ │ │ +
137 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ +
138 // The following methods from the base class should now actually be called
│ │ │ │ +
139 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ +
140
│ │ │ │ +
141 // createbegin and createend should be in there, too, but I can't get it to compile
│ │ │ │ +
142 // BCRSMatrix<B,A>::CreateIterator createbegin () {}
│ │ │ │ +
143 // BCRSMatrix<B,A>::CreateIterator createend () {}
│ │ │ │ +
144 void setrowsize (size_type i, size_type s) {}
│ │ │ │ +
145 void incrementrowsize (size_type i) {}
│ │ │ │ +
146 void endrowsizes () {}
│ │ │ │ +
147 void addindex (size_type row, size_type col) {}
│ │ │ │ +
148 void endindices () {}
│ │ │ │ +
149 };
│ │ │ │ +
│ │ │ │ +
150
│ │ │ │ +
151 template<typename B, typename A>
│ │ │ │ +
│ │ │ │ +
152 struct FieldTraits< BDMatrix<B, A> >
│ │ │ │ +
153 {
│ │ │ │ + │ │ │ │ +
155 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
156 };
│ │ │ │ +
│ │ │ │ +
159} // end namespace Dune
│ │ │ │ +
160
│ │ │ │ +
161#endif
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │
Definition allocator.hh:11
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1149
│ │ │ │ +
@ random
Build entries randomly.
Definition bcrsmatrix.hh:530
│ │ │ │ +
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1248
│ │ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ +
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:861
│ │ │ │ +
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:911
│ │ │ │ +
A block-diagonal matrix.
Definition bdmatrix.hh:33
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bdmatrix.hh:39
│ │ │ │ +
A::size_type size_type
implement row_type with compressed vector
Definition bdmatrix.hh:51
│ │ │ │ +
BDMatrix()
Default constructor.
Definition bdmatrix.hh:58
│ │ │ │ +
BDMatrix(std::initializer_list< B > const &list)
Construct from a std::initializer_list.
Definition bdmatrix.hh:76
│ │ │ │ +
B block_type
export the type representing the components
Definition bdmatrix.hh:42
│ │ │ │ +
void solve(V &x, const V &rhs) const
Solve the system Ax=b in O(n) time.
Definition bdmatrix.hh:120
│ │ │ │ +
A allocator_type
export the allocator type
Definition bdmatrix.hh:45
│ │ │ │ +
BDMatrix(int size)
Definition bdmatrix.hh:60
│ │ │ │ +
BDMatrix & operator=(const BDMatrix &other)
assignment
Definition bdmatrix.hh:103
│ │ │ │ +
static constexpr unsigned int blocklevel
increment block level counter
Definition bdmatrix.hh:55
│ │ │ │ +
void setSize(size_type size)
Resize the matrix. Invalidates the content!
Definition bdmatrix.hh:85
│ │ │ │ +
void invert()
Inverts the matrix.
Definition bdmatrix.hh:130
│ │ │ │ +
typename BDMatrix< B, A >::field_type field_type
Definition bdmatrix.hh:154
│ │ │ │ +
typename FieldTraits< field_type >::real_type real_type
Definition bdmatrix.hh:155
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,66 +1,234 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _c_o_m_m_o_n │ │ │ │ │ -counter.hh │ │ │ │ │ +bdmatrix.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -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 │ │ │ │ │ +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_BDMATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_BDMATRIX_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ 12 │ │ │ │ │ -13#include │ │ │ │ │ -14 │ │ │ │ │ -_1_5constexpr std::size_t _m_a_x_c_o_u_n_t = 100; │ │ │ │ │ -16 │ │ │ │ │ -_1_7#define DUNE_GET_COUNTER(Tag) \ │ │ │ │ │ -18 (counterFunc(Dune::PriorityTag{}, Tag{}, Dune::CounterImpl::ADLTag │ │ │ │ │ -{})) │ │ │ │ │ -19 │ │ │ │ │ -_2_0#define DUNE_INC_COUNTER(Tag) \ │ │ │ │ │ -21 namespace { \ │ │ │ │ │ -22 namespace CounterImpl { \ │ │ │ │ │ -23 constexpr std::size_t \ │ │ │ │ │ -24 counterFunc(Dune::PriorityTag p, Tag, ADLTag) \ │ │ │ │ │ -25 { \ │ │ │ │ │ -26 return p.value; \ │ │ │ │ │ -27 } \ │ │ │ │ │ -28 } \ │ │ │ │ │ -29 } \ │ │ │ │ │ -30 static_assert(true, "unfudge indentation") │ │ │ │ │ -31 │ │ │ │ │ -32namespace _D_u_n_e { │ │ │ │ │ -33 namespace { │ │ │ │ │ -34 │ │ │ │ │ -_3_5 namespace CounterImpl { │ │ │ │ │ -36 │ │ │ │ │ -37 struct ADLTag {}; │ │ │ │ │ -38 │ │ │ │ │ -39 template │ │ │ │ │ -40 constexpr std::size_t counterFunc(Dune::PriorityTag<0>, Tag, ADLTag) │ │ │ │ │ -41 { │ │ │ │ │ -42 return 0; │ │ │ │ │ -43 } │ │ │ │ │ -44 │ │ │ │ │ -45 } // end namespace CounterImpl │ │ │ │ │ -46 } // end empty namespace │ │ │ │ │ -47} // end namespace Dune │ │ │ │ │ -48#endif // DUNE_ISTL_COMMON_COUNTER_HH │ │ │ │ │ -_m_a_x_c_o_u_n_t │ │ │ │ │ -constexpr std::size_t maxcount │ │ │ │ │ -DDeeffiinniittiioonn counter.hh:15 │ │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +15 │ │ │ │ │ +21namespace _D_u_n_e { │ │ │ │ │ +31 template > │ │ │ │ │ +_3_2 class _B_D_M_a_t_r_i_x : public _B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +33 { │ │ │ │ │ +34 public: │ │ │ │ │ +35 │ │ │ │ │ +36 //===== type definitions and constants │ │ │ │ │ +37 │ │ │ │ │ +_3_9 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ +40 │ │ │ │ │ +_4_2 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +43 │ │ │ │ │ +_4_5 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +46 │ │ │ │ │ +48 //typedef BCRSMatrix::row_type row_type; │ │ │ │ │ +49 │ │ │ │ │ +_5_1 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +52 │ │ │ │ │ +54 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]] │ │ │ │ │ +_5_5 static constexpr unsigned int _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ +56 │ │ │ │ │ +_5_8 _B_D_M_a_t_r_i_x() : _B_C_R_S_M_a_t_r_i_x() {} │ │ │ │ │ +59 │ │ │ │ │ +_6_0 explicit _B_D_M_a_t_r_i_x(int size) │ │ │ │ │ +61 : _B_C_R_S_M_a_t_r_i_x(size, size, _B_C_R_S_M_a_t_r_i_x::_r_a_n_d_o_m) { │ │ │ │ │ +62 │ │ │ │ │ +63 for (int i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 1); │ │ │ │ │ +65 │ │ │ │ │ +66 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ +67 │ │ │ │ │ +68 for (int i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i); │ │ │ │ │ +70 │ │ │ │ │ +71 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ +72 │ │ │ │ │ +73 } │ │ │ │ │ +74 │ │ │ │ │ +_7_6 _B_D_M_a_t_r_i_x (std::initializer_list const &list) │ │ │ │ │ +77 : _B_D_M_a_t_r_i_x(list.size()) │ │ │ │ │ +78 { │ │ │ │ │ +79 size_t i=0; │ │ │ │ │ +80 for (auto it = list.begin(); it != list.end(); ++it, ++i) │ │ │ │ │ +81 (*this)[i][i] = *it; │ │ │ │ │ +82 } │ │ │ │ │ +83 │ │ │ │ │ +_8_5 void _s_e_t_S_i_z_e(_s_i_z_e___t_y_p_e size) │ │ │ │ │ +86 { │ │ │ │ │ +87 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_S_i_z_e(size, // rows │ │ │ │ │ +88 size, // columns │ │ │ │ │ +89 size); // nonzeros │ │ │ │ │ +90 │ │ │ │ │ +91 for (auto i : range(size)) │ │ │ │ │ +92 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 1); │ │ │ │ │ +93 │ │ │ │ │ +94 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ +95 │ │ │ │ │ +96 for (auto i : range(size)) │ │ │ │ │ +97 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i); │ │ │ │ │ +98 │ │ │ │ │ +99 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ +100 } │ │ │ │ │ +101 │ │ │ │ │ +_1_0_3 _B_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _B_D_M_a_t_r_i_x& other) { │ │ │ │ │ +104 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(other); │ │ │ │ │ +105 return *this; │ │ │ │ │ +106 } │ │ │ │ │ +107 │ │ │ │ │ +_1_0_9 _B_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) { │ │ │ │ │ +110 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(k); │ │ │ │ │ +111 return *this; │ │ │ │ │ +112 } │ │ │ │ │ +113 │ │ │ │ │ +119 template │ │ │ │ │ +_1_2_0 void _s_o_l_v_e (V& x, const V& rhs) const { │ │ │ │ │ +121 for (_s_i_z_e___t_y_p_e i=0; i_N(); i++) │ │ │ │ │ +122 { │ │ │ │ │ +123 auto&& xv = Impl::asVector(x[i]); │ │ │ │ │ +124 auto&& rhsv = Impl::asVector(rhs[i]); │ │ │ │ │ +125 Impl::asMatrix((*this)[i][i]).solve(xv,rhsv); │ │ │ │ │ +126 } │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +_1_3_0 void _i_n_v_e_r_t() { │ │ │ │ │ +131 for (_s_i_z_e___t_y_p_e i=0; i_N(); i++) │ │ │ │ │ +132 Impl::asMatrix((*this)[i][i])._i_n_v_e_r_t(); │ │ │ │ │ +133 } │ │ │ │ │ +134 │ │ │ │ │ +135 private: │ │ │ │ │ +136 │ │ │ │ │ +137 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ +//// │ │ │ │ │ +138 // The following methods from the base class should now actually be called │ │ │ │ │ +139 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ +//// │ │ │ │ │ +140 │ │ │ │ │ +141 // createbegin and createend should be in there, too, but I can't get it to │ │ │ │ │ +compile │ │ │ │ │ +142 // BCRSMatrix::CreateIterator createbegin () {} │ │ │ │ │ +143 // BCRSMatrix::CreateIterator createend () {} │ │ │ │ │ +144 void setrowsize (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s) {} │ │ │ │ │ +145 void incrementrowsize (_s_i_z_e___t_y_p_e i) {} │ │ │ │ │ +146 void endrowsizes () {} │ │ │ │ │ +147 void addindex (_s_i_z_e___t_y_p_e row, _s_i_z_e___t_y_p_e _c_o_l) {} │ │ │ │ │ +148 void endindices () {} │ │ │ │ │ +149 }; │ │ │ │ │ +150 │ │ │ │ │ +151 template │ │ │ │ │ +_1_5_2 struct FieldTraits< _B_D_M_a_t_r_i_x > │ │ │ │ │ +153 { │ │ │ │ │ +_1_5_4 using _f_i_e_l_d___t_y_p_e = typename _B_D_M_a_t_r_i_x_<_B_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_5_5 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ +156 }; │ │ │ │ │ +159} // end namespace Dune │ │ │ │ │ +160 │ │ │ │ │ +161#endif │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_r_o_w_s_i_z_e_s │ │ │ │ │ +void endrowsizes() │ │ │ │ │ +indicate that size of all rows is defined │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1149 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_a_n_d_o_m │ │ │ │ │ +@ random │ │ │ │ │ +Build entries randomly. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:530 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_i_n_d_i_c_e_s │ │ │ │ │ +void endindices() │ │ │ │ │ +indicate that all indices are defined, check consistency │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1248 │ │ │ │ │ +_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:1972 │ │ │ │ │ +_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:861 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BCRSMatrix & operator=(const BCRSMatrix &Mat) │ │ │ │ │ +assignment │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:911 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ +A block-diagonal matrix. │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +implement row_type with compressed vector │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ +BDMatrix() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ +BDMatrix(std::initializer_list< B > const &list) │ │ │ │ │ +Construct from a std::initializer_list. │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +B block_type │ │ │ │ │ +export the type representing the components │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:42 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ │ +void solve(V &x, const V &rhs) const │ │ │ │ │ +Solve the system Ax=b in O(n) time. │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ +A allocator_type │ │ │ │ │ +export the allocator type │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ +BDMatrix(int size) │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +BDMatrix & operator=(const BDMatrix &other) │ │ │ │ │ +assignment │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:103 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ +static constexpr unsigned int blocklevel │ │ │ │ │ +increment block level counter │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_s_e_t_S_i_z_e │ │ │ │ │ +void setSize(size_type size) │ │ │ │ │ +Resize the matrix. Invalidates the content! │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_i_n_v_e_r_t │ │ │ │ │ +void invert() │ │ │ │ │ +Inverts the matrix. │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:130 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename BDMatrix< B, A >::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:154 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn bdmatrix.hh:155 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00065.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: registry.hh File Reference │ │ │ │ +dune-istl: spqr.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,94 +65,71 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros
│ │ │ │ -
registry.hh File Reference
│ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#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>
│ │ │ │ + │ │ │ │ +

Class for using SPQR with ISTL matrices. │ │ │ │ +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>
│ │ │ │
│ │ │ │

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::SPQRCreator
 
struct  Dune::SPQRCreator::isValidBlock< class >
 
struct  Dune::SPQRCreator::isValidBlock< FieldVector< double, 1 > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ -Macros

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

│ │ │ │ +Functions

 Dune::DUNE_REGISTER_DIRECT_SOLVER ("spqr", Dune::SPQRCreator())
 
│ │ │ │ -

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

Detailed Description

│ │ │ │ +

Class for using SPQR with ISTL matrices.

│ │ │ │ +
Author
Marco Agnese, Andrea Sacconi
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,49 +1,49 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _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 │ │ │ │ │ +_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> │ │ │ │ │ _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_:_:_S_P_Q_R_C_r_e_a_t_o_r │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _c_l_a_s_s_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _d_o_u_b_l_e_,_ _1_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(Tag, id, ...) │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("spqr", _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r()) │ │ │ │ │   │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTRRYY__PPUUTT ********** │ │ │ │ │ -#define DUNE_REGISTRY_PUT (   Tag, │ │ │ │ │ -   id, │ │ │ │ │ -   ......  │ │ │ │ │ - ) │ │ │ │ │ -VVaalluuee:: │ │ │ │ │ -namespace { \ │ │ │ │ │ -template<> \ │ │ │ │ │ -struct Registry \ │ │ │ │ │ -{ \ │ │ │ │ │ -static auto getCreator() \ │ │ │ │ │ -{ \ │ │ │ │ │ -return __VA_ARGS__; \ │ │ │ │ │ -} \ │ │ │ │ │ -static std::string name() { return id; } \ │ │ │ │ │ -}; \ │ │ │ │ │ -} \ │ │ │ │ │ -DUNE_INC_COUNTER(Tag) │ │ │ │ │ -_D_U_N_E___G_E_T___C_O_U_N_T_E_R │ │ │ │ │ -#define DUNE_GET_COUNTER(Tag) │ │ │ │ │ -DDeeffiinniittiioonn counter.hh:17 │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Class for using SPQR with ISTL matrices. │ │ │ │ │ + Author │ │ │ │ │ + Marco Agnese, Andrea Sacconi │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ │ @@ -21,1070 +21,4679 @@ │ │ │ │ 00000140: 2267 656e 6572 6174 6f72 2220 636f 6e74 "generator" cont │ │ │ │ 00000150: 656e 743d 2244 6f78 7967 656e 2031 2e39 ent="Doxygen 1.9 │ │ │ │ 00000160: 2e38 222f 3e0a 3c6d 6574 6120 6e61 6d65 .8"/>..dune-istl: re │ │ │ │ -000001c0: 6769 7374 7279 2e68 6820 536f 7572 6365 gistry.hh Source │ │ │ │ -000001d0: 2046 696c 653c 2f74 6974 6c65 3e0a 3c6c File... │ │ │ │ -00000250: 3c73 6372 6970 7420 7479 7065 3d22 7465 .. │ │ │ │ -000002d0: 3c73 6372 6970 7420 7479 7065 3d22 7465 ../* @li │ │ │ │ -00000690: 6365 6e73 6520 6d61 676e 6574 3a3f 7874 cense magnet:?xt │ │ │ │ -000006a0: 3d75 726e 3a62 7469 683a 6433 6439 6139 =urn:btih:d3d9a9 │ │ │ │ -000006b0: 6136 3539 3535 3231 6639 3636 3661 3565 a6595521f9666a5e │ │ │ │ -000006c0: 3934 6363 3833 3064 6162 3833 6236 3536 94cc830dab83b656 │ │ │ │ -000006d0: 3939 2661 6d70 3b64 6e3d 6578 7061 742e 99&dn=expat. │ │ │ │ -000006e0: 7478 7420 4d49 5420 2a2f 0a24 2866 756e txt MIT */.$(fun │ │ │ │ -000006f0: 6374 696f 6e28 2920 7b0a 2020 696e 6974 ction() {. init │ │ │ │ -00000700: 4d65 6e75 2827 272c 7472 7565 2c66 616c Menu('',true,fal │ │ │ │ -00000710: 7365 2c27 7365 6172 6368 2e70 6870 272c se,'search.php', │ │ │ │ -00000720: 2753 6561 7263 6827 293b 0a20 2024 2864 'Search');. $(d │ │ │ │ -00000730: 6f63 756d 656e 7429 2e72 6561 6479 2866 ocument).ready(f │ │ │ │ -00000740: 756e 6374 696f 6e28 2920 7b20 696e 6974 unction() { init │ │ │ │ -00000750: 5f73 6561 7263 6828 293b 207d 293b 0a7d _search(); });.} │ │ │ │ -00000760: 293b 0a2f 2a20 406c 6963 656e 7365 2d65 );./* @license-e │ │ │ │ -00000770: 6e64 202a 2f0a 3c2f 7363 7269 7074 3e0a nd */.. │ │ │ │ -00000780: 3c64 6976 2069 643d 226d 6169 6e2d 6e61
../* @li │ │ │ │ -000007c0: 6365 6e73 6520 6d61 676e 6574 3a3f 7874 cense magnet:?xt │ │ │ │ -000007d0: 3d75 726e 3a62 7469 683a 6433 6439 6139 =urn:btih:d3d9a9 │ │ │ │ -000007e0: 6136 3539 3535 3231 6639 3636 3661 3565 a6595521f9666a5e │ │ │ │ -000007f0: 3934 6363 3833 3064 6162 3833 6236 3536 94cc830dab83b656 │ │ │ │ -00000800: 3939 2661 6d70 3b64 6e3d 6578 7061 742e 99&dn=expat. │ │ │ │ -00000810: 7478 7420 4d49 5420 2a2f 0a24 2864 6f63 txt MIT */.$(doc │ │ │ │ -00000820: 756d 656e 7429 2e72 6561 6479 2866 756e ument).ready(fun │ │ │ │ -00000830: 6374 696f 6e28 2920 7b20 696e 6974 5f63 ction() { init_c │ │ │ │ -00000840: 6f64 6566 6f6c 6428 3029 3b20 7d29 3b0a odefold(0); });. │ │ │ │ -00000850: 2f2a 2040 6c69 6365 6e73 652d 656e 6420 /* @license-end │ │ │ │ -00000860: 2a2f 0a3c 2f73 6372 6970 743e 0a3c 212d */...
.
...
.< │ │ │ │ -00001010: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00001020: 3e3c 6120 6964 3d22 6c30 3030 3035 2220 > 5 .
6< │ │ │ │ -000010c0: 7370 616e 2063 6c61 7373 3d22 7072 6570 span class="prep │ │ │ │ -000010d0: 726f 6365 7373 6f72 223e 2369 6e63 6c75 rocessor">#inclu │ │ │ │ -000010e0: 6465 2026 6c74 3b63 7374 6464 6566 2667 de <cstddef&g │ │ │ │ -000010f0: 743b 3c2f 7370 616e 3e3c 2f64 6976 3e0a t;
. │ │ │ │ -00001100: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
< │ │ │ │ -00001130: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 7# │ │ │ │ -00001170: 696e 636c 7564 6520 266c 743b 696f 7374 include <iost │ │ │ │ -00001180: 7265 616d 2667 743b 3c2f 7370 616e 3e3c ream>< │ │ │ │ -00001190: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -000011e0: 2020 383c 2f73 7061 6e3e 3c73 7061 6e20 8#include &l │ │ │ │ -00001210: 743b 6d65 6d6f 7279 2667 743b 3c2f 7370 t;memory>
.
9#includ │ │ │ │ -000012a0: 6520 266c 743b 7374 7269 6e67 2667 743b e <string> │ │ │ │ -000012b0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
. │ │ │ │ -000012d0: 3c61 2069 643d 226c 3030 3031 3022 206e 10#in │ │ │ │ -00001330: 636c 7564 6520 266c 743b 7574 696c 6974 clude <utilit │ │ │ │ -00001340: 7926 6774 3b3c 2f73 7061 6e3e 3c2f 6469 y>.
11 │ │ │ │ -000013a0: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
.< │ │ │ │ -000013b0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -000013c0: 3e3c 6120 6964 3d22 6c30 3030 3132 2220 > 12#i │ │ │ │ -00001420: 6e63 6c75 6465 2026 7175 6f74 3b3c 6120 nclude " │ │ │ │ -00001450: 636f 756e 7465 722e 6868 3c2f 613e 2671 counter.hh&q │ │ │ │ -00001460: 756f 743b 3c2f 7370 616e 3e3c 2f64 6976 uot;
.
13< │ │ │ │ -000014c0: 2f73 7061 6e3e 203c 2f64 6976 3e0a 3c64 /span>
. │ │ │ │ -000014e0: 3c61 2069 643d 226c 3030 3031 3422 206e 14#in │ │ │ │ -00001540: 636c 7564 6520 266c 743b 6475 6e65 2f63 clude <dune/c │ │ │ │ -00001550: 6f6d 6d6f 6e2f 7479 7065 6c69 7374 2e68 ommon/typelist.h │ │ │ │ -00001560: 6826 6774 3b3c 2f73 7061 6e3e 3c2f 6469 h>.
15 │ │ │ │ -000015c0: 3c2f 7370 616e 3e3c 7370 616e 2063 6c61 #include <d │ │ │ │ -000015f0: 756e 652f 636f 6d6d 6f6e 2f68 7962 7269 une/common/hybri │ │ │ │ -00001600: 6475 7469 6c69 7469 6573 2e68 6826 6774 dutilities.hh> │ │ │ │ -00001610: 3b3c 2f73 7061 6e3e 3c2f 6469 763e 0a3c ;
.< │ │ │ │ -00001620: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00001630: 3e3c 6120 6964 3d22 6c30 3030 3136 2220 > 16#i │ │ │ │ -00001690: 6e63 6c75 6465 2026 6c74 3b64 756e 652f nclude <dune/ │ │ │ │ -000016a0: 636f 6d6d 6f6e 2f70 6172 616d 6574 6572 common/parameter │ │ │ │ -000016b0: 697a 6564 6f62 6a65 6374 2e68 6826 6774 izedobject.hh> │ │ │ │ -000016c0: 3b3c 2f73 7061 6e3e 3c2f 6469 763e 0a3c ;.< │ │ │ │ -000016d0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -000016e0: 3e3c 6120 6964 3d22 6c30 3030 3137 2220 > 17 .
.< │ │ │ │ -00001770: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00001780: 3e3c 6120 6964 3d22 6c30 3030 3138 2220 > 1 │ │ │ │ -00001800: 383c 2f61 3e3c 2f73 7061 6e3e 3c73 7061 8#define D │ │ │ │ -00001830: 554e 455f 5245 4749 5354 5259 5f50 5554 UNE_REGISTRY_PUT │ │ │ │ -00001840: 2854 6167 2c20 6964 2c20 2e2e 2e29 2020 (Tag, id, ...) │ │ │ │ -00001850: 2020 2020 2020 2020 2020 2020 205c 3c2f \
.
< │ │ │ │ -000018a0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -000018b0: 6e6f 223e 2020 2031 393c 2f73 7061 6e3e no"> 19 │ │ │ │ -000018c0: 3c73 7061 6e20 636c 6173 733d 2270 7265 nam │ │ │ │ -000018e0: 6573 7061 6365 207b 2020 2020 2020 2020 espace { │ │ │ │ -000018f0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001900: 2020 2020 2020 2020 2020 205c 3c2f 7370 \
.
20 tem │ │ │ │ -00001990: 706c 6174 6526 6c74 3b26 6774 3b20 2020 plate<> │ │ │ │ -000019a0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -000019b0: 2020 2020 2020 2020 2020 2020 2020 205c \ │ │ │ │ -000019c0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
. │ │ │ │ -000019e0: 3c61 2069 643d 226c 3030 3032 3122 206e 21 │ │ │ │ -00001a40: 2073 7472 7563 7420 5265 6769 7374 7279 struct Registry │ │ │ │ -00001a50: 266c 743b 5461 672c 2044 554e 455f 4745 <Tag, DUNE_GE │ │ │ │ -00001a60: 545f 434f 554e 5445 5228 5461 6729 2667 T_COUNTER(Tag)&g │ │ │ │ -00001a70: 743b 2020 2020 2020 205c 3c2f 7370 616e t; \.
│ │ │ │ -00001ad0: 2020 2032 323c 2f73 7061 6e3e 3c73 7061 22 { │ │ │ │ -00001b00: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001b10: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001b20: 2020 2020 2020 205c 3c2f 7370 616e 3e3c \< │ │ │ │ -00001b30: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -00001b80: 2032 333c 2f73 7061 6e3e 3c73 7061 6e20 23 stati │ │ │ │ -00001bb0: 6320 6175 746f 2067 6574 4372 6561 746f c auto getCreato │ │ │ │ -00001bc0: 7228 2920 2020 2020 2020 2020 2020 2020 r() │ │ │ │ -00001bd0: 2020 2020 205c 3c2f 7370 616e 3e3c 2f64 \.
2 │ │ │ │ -00001c30: 343c 2f73 7061 6e3e 3c73 7061 6e20 636c 4 { │ │ │ │ -00001c60: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001c70: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001c80: 2020 205c 3c2f 7370 616e 3e3c 2f64 6976 \
.
25< │ │ │ │ -00001ce0: 2f73 7061 6e3e 3c73 7061 6e20 636c 6173 /span> return │ │ │ │ -00001d10: 5f5f 5641 5f41 5247 535f 5f3b 2020 2020 __VA_ARGS__; │ │ │ │ -00001d20: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001d30: 205c 3c2f 7370 616e 3e3c 2f64 6976 3e0a \
. │ │ │ │ -00001d40: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
. │ │ │ │ -00001e00: 3c61 2069 643d 226c 3030 3032 3722 206e 27 │ │ │ │ -00001e60: 2020 2073 7461 7469 6320 7374 643a 3a73 static std::s │ │ │ │ -00001e70: 7472 696e 6720 6e61 6d65 2829 207b 2072 tring name() { r │ │ │ │ -00001e80: 6574 7572 6e20 6964 3b20 7d20 205c 3c2f eturn id; } \
.
< │ │ │ │ -00001ed0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00001ee0: 6e6f 223e 2020 2032 383c 2f73 7061 6e3e no"> 28 │ │ │ │ -00001ef0: 3c73 7061 6e20 636c 6173 733d 2270 7265 } │ │ │ │ -00001f10: 3b20 2020 2020 2020 2020 2020 2020 2020 ; │ │ │ │ -00001f20: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001f30: 2020 2020 2020 2020 2020 205c 3c2f 7370 \
.
29 } │ │ │ │ -00001fc0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001fd0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00001fe0: 2020 2020 2020 2020 205c 3c2f 7370 616e \
.
│ │ │ │ -00002040: 2020 2033 303c 2f73 7061 6e3e 3c73 7061 30 DUNE_IN │ │ │ │ -00002070: 435f 434f 554e 5445 5228 5461 6729 3c2f C_COUNTER(Tag)
..
31 │ │ │ │ -000020e0: 3c2f 7370 616e 3e20 3c2f 6469 763e 0a3c
.< │ │ │ │ -000020f0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00002100: 3e3c 6120 6964 3d22 6c30 3030 3332 2220 > 32
.
33< │ │ │ │ -000021a0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -000021b0: 6f72 6422 3e6e 616d 6573 7061 6365 203c ord">namespace < │ │ │ │ -000021c0: 2f73 7061 6e3e 3c61 2063 6c61 7373 3d22 /span>Dune { │ │ │ │ -00002200: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
│ │ │ │ -00002250: 2020 3334 3c2f 7370 616e 3e20 203c 7370 34 namespace {
.
< │ │ │ │ -000022c0: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -000022d0: 6e6f 223e 2020 2033 353c 2f73 7061 6e3e no"> 35 │ │ │ │ -000022e0: 2020 2020 3c73 7061 6e20 636c 6173 733d templa │ │ │ │ -00002300: 7465 3c2f 7370 616e 3e26 6c74 3b3c 7370 te<class │ │ │ │ -00002330: 5461 672c 2073 7464 3a3a 3c73 7061 6e20 Tag, std::size_t index>
.
36< │ │ │ │ -000023c0: 2f73 7061 6e3e 2020 2020 3c73 7061 6e20 /span> │ │ │ │ -000023e0: 7374 7275 6374 203c 2f73 7061 6e3e 5265 struct Re │ │ │ │ -000023f0: 6769 7374 7279 3b3c 2f64 6976 3e0a 3c64 gistry;
. │ │ │ │ -00002410: 3c61 2069 643d 226c 3030 3033 3722 206e 37 }.
< │ │ │ │ -00002490: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -000024a0: 6e6f 223e 2020 2033 383c 2f73 7061 6e3e no"> 38 │ │ │ │ -000024b0: 203c 2f64 6976 3e0a 3c64 6976 2063 6c61
.
│ │ │ │ -00002500: 2020 2033 393c 2f73 7061 6e3e 2020 3c73 39 namespace {
.< │ │ │ │ -00002550: 6120 6964 3d22 6c30 3030 3430 2220 6e61 a id="l00040" na │ │ │ │ -00002560: 6d65 3d22 6c30 3030 3430 223e 3c2f 613e me="l00040"> │ │ │ │ -00002570: 3c73 7061 6e20 636c 6173 733d 226c 696e 40 templ │ │ │ │ -000025b0: 6174 653c 2f73 7061 6e3e 266c 743b 3c73 ate<template<cla │ │ │ │ -00002600: 7373 3c2f 7370 616e 3e26 6774 3b20 3c73 ss> class
Base, cla │ │ │ │ -00002650: 7373 203c 2f73 7061 6e3e 562c 203c 7370 ss V, class
│ │ │ │ -00002680: 5461 672c 203c 7370 616e 2063 6c61 7373 Tag, typen │ │ │ │ -000026a0: 616d 653c 2f73 7061 6e3e 2e2e 2e20 4172 ame... Ar │ │ │ │ -000026b0: 6773 2667 743b 3c2f 6469 763e 0a3c 6469 gs>.< │ │ │ │ -000026d0: 6120 6964 3d22 6c30 3030 3431 2220 6e61 a id="l00041" na │ │ │ │ -000026e0: 6d65 3d22 6c30 3030 3431 223e 3c2f 613e me="l00041"> │ │ │ │ -000026f0: 3c73 7061 6e20 636c 6173 733d 226c 696e 41 auto< │ │ │ │ -00002730: 2f73 7061 6e3e 2072 6567 6973 7472 7947 /span> registryG │ │ │ │ -00002740: 6574 2854 6167 202c 2073 7464 3a3a 7374 et(Tag , std::st │ │ │ │ -00002750: 7269 6e67 206e 616d 652c 2041 7267 732e ring name, Args. │ │ │ │ -00002760: 2e2e 2061 7267 7329 3c2f 6469 763e 0a3c .. args).< │ │ │ │ -00002770: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00002780: 3e3c 6120 6964 3d22 6c30 3030 3432 2220 > 42 {.< │ │ │ │ -000027d0: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -000027e0: 3e3c 6120 6964 3d22 6c30 3030 3433 2220 > 43 c │ │ │ │ -00002840: 6f6e 7374 6578 7072 3c2f 7370 616e 3e20 onstexpr │ │ │ │ -00002850: 3c73 7061 6e20 636c 6173 733d 226b 6579 auto count = DUNE_GE │ │ │ │ -000028d0: 545f 434f 554e 5445 523c 2f61 3e28 5461 T_COUNTER(Ta │ │ │ │ -000028e0: 6729 3b3c 2f64 6976 3e0a 3c64 6976 2063 g);.
44 │ │ │ │ -00002940: 2020 2020 7374 643a 3a73 6861 7265 645f std::shared_ │ │ │ │ -00002950: 7074 7226 6c74 3b42 6173 6526 6c74 3b56 ptr<Base<V │ │ │ │ -00002960: 2667 743b 2026 6774 3b20 7265 7375 6c74 > > result │ │ │ │ -00002970: 3b3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ;
.
│ │ │ │ -000029c0: 2020 2034 353c 2f73 7061 6e3e 2020 2020 45 │ │ │ │ -000029d0: 2020 4475 6e65 3a3a 4879 6272 6964 3a3a Dune::Hybrid:: │ │ │ │ -000029e0: 666f 7245 6163 6828 7374 643a 3a6d 616b forEach(std::mak │ │ │ │ -000029f0: 655f 696e 6465 785f 7365 7175 656e 6365 e_index_sequence │ │ │ │ -00002a00: 266c 743b 636f 756e 7426 6774 3b7b 7d2c <count>{}, │ │ │ │ -00002a10: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
│ │ │ │ -00002a60: 2020 3436 3c2f 7370 616e 3e20 2020 2020 46 │ │ │ │ -00002a70: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00002a80: 2020 2020 2020 205b 2661 6d70 3b5d 283c [&](< │ │ │ │ -00002a90: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00002aa0: 6f72 6422 3e61 7574 6f3c 2f73 7061 6e3e ord">auto │ │ │ │ -00002ab0: 2069 6e64 6578 2920 7b3c 2f64 6976 3e0a index) {
. │ │ │ │ -00002ac0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
.< │ │ │ │ -00002b90: 6120 6964 3d22 6c30 3030 3438 2220 6e61 a id="l00048" na │ │ │ │ -00002ba0: 6d65 3d22 6c30 3030 3438 223e 3c2f 613e me="l00048"> │ │ │ │ -00002bb0: 3c73 7061 6e20 636c 6173 733d 226c 696e 48 │ │ │ │ -00002be0: 2020 2020 2020 2020 2020 2020 2020 203c < │ │ │ │ -00002bf0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00002c00: 6f72 6466 6c6f 7722 3e69 663c 2f73 7061 ordflow">if(!result & │ │ │ │ -00002c20: 2661 6d70 3b20 5265 673a 3a6e 616d 6528 & Reg::name( │ │ │ │ -00002c30: 2920 3d3d 206e 616d 6529 207b 3c2f 6469 ) == name) {.
49 │ │ │ │ -00002c90: 3c2f 7370 616e 3e20 2020 2020 2020 2020 │ │ │ │ -00002ca0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00002cb0: 2020 2020 2020 2072 6573 756c 7420 3d20 result = │ │ │ │ -00002cc0: 5265 673a 3a67 6574 4372 6561 746f 7228 Reg::getCreator( │ │ │ │ -00002cd0: 2928 4475 6e65 3a3a 4d65 7461 5479 7065 )(Dune::MetaType │ │ │ │ -00002ce0: 266c 743b 5626 6774 3b7b 7d2c 2061 7267 <V>{}, arg │ │ │ │ -00002cf0: 732e 2e2e 293b 3c2f 6469 763e 0a3c 6469 s...);
.< │ │ │ │ -00002d10: 6120 6964 3d22 6c30 3030 3530 2220 6e61 a id="l00050" na │ │ │ │ -00002d20: 6d65 3d22 6c30 3030 3530 223e 3c2f 613e me="l00050"> │ │ │ │ -00002d30: 3c73 7061 6e20 636c 6173 733d 226c 696e 50 │ │ │ │ -00002d60: 2020 2020 2020 2020 2020 2020 2020 207d } │ │ │ │ -00002d70: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
│ │ │ │ -00002dc0: 2020 3531 3c2f 7370 616e 3e20 2020 2020 51 │ │ │ │ -00002dd0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00002de0: 2020 2020 2020 207d 293b 3c2f 6469 763e });
│ │ │ │ -00002df0: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ -00002e80: 0a3c 6469 7620 636c 6173 733d 226c 696e . │ │ │ │ -00002ee0: 0a3c 6469 7620 636c 6173 733d 226c 696e ..< │ │ │ │ -00002f50: 6120 6964 3d22 6c30 3030 3535 2220 6e61 a id="l00055" na │ │ │ │ -00002f60: 6d65 3d22 6c30 3030 3535 223e 3c2f 613e me="l00055"> │ │ │ │ -00002f70: 3c73 7061 6e20 636c 6173 733d 226c 696e 55 /*
.
56< │ │ │ │ -00003010: 7370 616e 2063 6c61 7373 3d22 636f 6d6d span class="comm │ │ │ │ -00003020: 656e 7422 3e20 2020 2020 2052 6567 6973 ent"> Regis │ │ │ │ -00003030: 7465 7220 616c 6c20 6372 6561 746f 7273 ter all creators │ │ │ │ -00003040: 2066 726f 6d20 7468 6520 7265 6769 7374 from the regist │ │ │ │ -00003050: 7279 2069 6e20 7468 6520 5061 7261 6d65 ry in the Parame │ │ │ │ -00003060: 7465 7269 7a65 646f 626a 6563 7466 6163 terizedobjectfac │ │ │ │ -00003070: 746f 7279 2041 6e3c 2f73 7061 6e3e 3c2f tory An.
│ │ │ │ -000030d0: 3537 3c2f 7370 616e 3e3c 7370 616e 2063 57 │ │ │ │ -000030f0: 2020 2020 206f 626a 6563 7420 6f66 2056 object of V │ │ │ │ -00003100: 2069 7320 7061 7373 6564 2069 6e20 7468 is passed in th │ │ │ │ -00003110: 6520 6372 6561 746f 7220 616e 7320 7368 e creator ans sh │ │ │ │ -00003120: 6f75 6c64 2062 6520 7573 6564 2074 6f20 ould be used to │ │ │ │ -00003130: 6465 7465 726d 696e 6520 7468 653c 2f73 determine the
.
58< │ │ │ │ -000031a0: 7370 616e 2063 6c61 7373 3d22 636f 6d6d span class="comm │ │ │ │ -000031b0: 656e 7422 3e20 2020 2020 2074 656d 706c ent"> templ │ │ │ │ -000031c0: 6174 6520 6172 6775 6d65 6e74 732e 3c2f ate arguments.
.
< │ │ │ │ -00003210: 7370 616e 2063 6c61 7373 3d22 6c69 6e65 span class="line │ │ │ │ -00003220: 6e6f 223e 2020 2035 393c 2f73 7061 6e3e no"> 59 │ │ │ │ -00003230: 3c73 7061 6e20 636c 6173 733d 2263 6f6d */
.
60 │ │ │ │ -000032b0: 2020 3c73 7061 6e20 636c 6173 733d 226b template │ │ │ │ -000032d0: 3c2f 7370 616e 3e26 6c74 3b3c 7370 616e <class V, │ │ │ │ -00003300: 203c 7370 616e 2063 6c61 7373 3d22 6b65 class Type, │ │ │ │ -00003340: 636c 6173 7320 3c2f 7370 616e 3e54 6167 class Tag │ │ │ │ -00003350: 2c20 3c73 7061 6e20 636c 6173 733d 226b , class... Args> │ │ │ │ -00003380: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
│ │ │ │ -000033d0: 2020 3631 3c2f 7370 616e 3e20 2020 203c 61 < │ │ │ │ -000033e0: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -000033f0: 6f72 6474 7970 6522 3e69 6e74 3c2f 7370 ordtype">int addRegistryT │ │ │ │ -00003410: 6f46 6163 746f 7279 2844 756e 653a 3a50 oFactory(Dune::P │ │ │ │ -00003420: 6172 616d 6574 6572 697a 6564 4f62 6a65 arameterizedObje │ │ │ │ -00003430: 6374 4661 6374 6f72 7926 6c74 3b54 7970 ctFactory<Typ │ │ │ │ -00003440: 6528 4172 6773 2e2e 2e29 2c20 7374 643a e(Args...), std: │ │ │ │ -00003450: 3a73 7472 696e 6726 6774 3b26 616d 703b :string>& │ │ │ │ -00003460: 2066 6163 746f 7279 2c3c 2f64 6976 3e0a factory,
. │ │ │ │ -00003470: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
. │ │ │ │ -00003500: 3c61 2069 643d 226c 3030 3036 3322 206e 63 co │ │ │ │ -00003560: 6e73 7465 7870 723c 2f73 7061 6e3e 203c nstexpr < │ │ │ │ -00003570: 7370 616e 2063 6c61 7373 3d22 6b65 7977 span class="keyw │ │ │ │ -00003580: 6f72 6422 3e61 7574 6f3c 2f73 7061 6e3e ord">auto │ │ │ │ -00003590: 2063 6f75 6e74 203d 203c 6120 636c 6173 count = DUNE_GET │ │ │ │ -000035f0: 5f43 4f55 4e54 4552 3c2f 613e 2854 6167 _COUNTER(Tag │ │ │ │ -00003600: 293b 3c2f 6469 763e 0a3c 6469 7620 636c );
.
64 │ │ │ │ -00003660: 2020 2044 756e 653a 3a48 7962 7269 643a Dune::Hybrid: │ │ │ │ -00003670: 3a66 6f72 4561 6368 2873 7464 3a3a 6d61 :forEach(std::ma │ │ │ │ -00003680: 6b65 5f69 6e64 6578 5f73 6571 7565 6e63 ke_index_sequenc │ │ │ │ -00003690: 6526 6c74 3b63 6f75 6e74 2667 743b 7b7d e<count>{} │ │ │ │ -000036a0: 2c3c 2f64 6976 3e0a 3c64 6976 2063 6c61 ,
.
│ │ │ │ -000036f0: 2020 2036 353c 2f73 7061 6e3e 2020 2020 65 │ │ │ │ -00003700: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003710: 2020 2020 2020 2020 5b26 616d 703b 5d28 [&]( │ │ │ │ -00003720: 3c73 7061 6e20 636c 6173 733d 226b 6579 auto index) {
│ │ │ │ -00003750: 0a3c 6469 7620 636c 6173 733d 226c 696e .
│ │ │ │ -00003780: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 66 │ │ │ │ -000037b0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -000037c0: 2020 203c 7370 616e 2063 6c61 7373 3d22 // we f │ │ │ │ -000037e0: 6972 7374 2067 6574 2074 6865 2067 656e irst get the gen │ │ │ │ -000037f0: 6572 6963 206c 616d 6264 613c 2f73 7061 eric lambda
.
67 │ │ │ │ -00003860: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003870: 2020 2020 2020 2020 2020 203c 7370 616e // and later sp │ │ │ │ -000038a0: 6563 6961 6c69 7a65 2069 7420 7769 7468 ecialize it with │ │ │ │ -000038b0: 2067 6976 656e 2070 6172 616d 6574 6572 given parameter │ │ │ │ -000038c0: 732e 3c2f 7370 616e 3e3c 2f64 6976 3e0a s.
. │ │ │ │ -000038d0: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
.
.
.
.
│ │ │ │ -00000a20: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
.
Loadin │ │ │ │ -00000a50: 672e 2e2e 3c2f 6469 763e 0a3c 6469 7620 g...
.
│ │ │ │ -00000a80: 5365 6172 6368 696e 672e 2e2e 3c2f 6469 Searching....
No Match │ │ │ │ -00000ac0: 6573 3c2f 6469 763e 0a3c 2f64 6976 3e0a es
.
. │ │ │ │ -00000ad0: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c2f
.
....
.
.
registry │ │ │ │ -00000ca0: 2e68 683c 2f64 6976 3e3c 2f64 6976 3e0a .hh
. │ │ │ │ -00000cb0: 3c2f 6469 763e 3c21 2d2d 6865 6164 6572
.
.Go to the docum │ │ │ │ -00000d00: 656e 7461 7469 6f6e 206f 6620 7468 6973 entation of this │ │ │ │ -00000d10: 2066 696c 652e 3c2f 613e 3c64 6976 2063 file.
│ │ │ │ -00000d30: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65 . │ │ │ │ -00000e20: 3c61 2069 643d 226c 3030 3030 3222 206e 2// SPDX- │ │ │ │ -00000e80: 4c69 6365 6e73 652d 4964 656e 7469 6669 License-Identifi │ │ │ │ -00000e90: 6572 3a20 4c69 6365 6e73 6552 6566 2d47 er: LicenseRef-G │ │ │ │ -00000ea0: 504c 2d32 2e30 2d6f 6e6c 792d 7769 7468 PL-2.0-only-with │ │ │ │ -00000eb0: 2d44 554e 452d 6578 6365 7074 696f 6e3c -DUNE-exception< │ │ │ │ -00000ec0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
.< │ │ │ │ -00000ee0: 6120 6964 3d22 6c30 3030 3033 2220 6e61 a id="l00003" na │ │ │ │ -00000ef0: 6d65 3d22 6c30 3030 3033 223e 3c2f 613e me="l00003"> │ │ │ │ -00000f00: 3c73 7061 6e20 636c 6173 733d 226c 696e 3#ifn │ │ │ │ -00000f40: 6465 6620 4455 4e45 5f49 5354 4c5f 434f def DUNE_ISTL_CO │ │ │ │ -00000f50: 4d4d 4f4e 5f52 4547 4953 5452 595f 4848 MMON_REGISTRY_HH │ │ │ │ -00000f60: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
. │ │ │ │ -00000f80: 3c61 2069 643d 226c 3030 3030 3422 206e 4#de │ │ │ │ -00000fe0: 6669 6e65 2044 554e 455f 4953 544c 5f43 fine DUNE_ISTL_C │ │ │ │ -00000ff0: 4f4d 4d4f 4e5f 5245 4749 5354 5259 5f48 OMMON_REGISTRY_H │ │ │ │ -00001000: 483c 2f73 7061 6e3e 3c2f 6469 763e 0a3c H
.< │ │ │ │ -00003e80: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00003e90: 3e3c 6120 6964 3d22 6c30 3030 3737 2220 > 77 } // │ │ │ │ -00003ef0: 656e 6420 616e 6f6e 796d 6f75 7320 6e61 end anonymous na │ │ │ │ -00003f00: 6d65 7370 6163 653c 2f73 7061 6e3e 3c2f mespace.
< │ │ │ │ -00003900: 2f61 3e3c 7370 616e 2063 6c61 7373 3d22 /a> 68 │ │ │ │ -00003930: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003940: 2020 3c73 7061 6e20 636c 6173 733d 2263 // doing │ │ │ │ -00003960: 2061 6c6c 2061 7420 6f6e 6365 206c 6561 all at once lea │ │ │ │ -00003970: 6420 746f 2061 6e20 4943 4520 776f 7468 d to an ICE woth │ │ │ │ -00003980: 2067 2b2b 2d36 3c2f 7370 616e 3e3c 2f64 g++-6.
6 │ │ │ │ -000039e0: 393c 2f73 7061 6e3e 2020 2020 2020 2020 9 │ │ │ │ -000039f0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003a00: 2020 2020 2020 3c73 7061 6e20 636c 6173 usin │ │ │ │ -00003a20: 6720 3c2f 7370 616e 3e52 6567 203d 2052 g Reg = R │ │ │ │ -00003a30: 6567 6973 7472 7926 6c74 3b54 6167 2c20 egistry<Tag, │ │ │ │ -00003a40: 696e 6465 7826 6774 3b3b 3c2f 6469 763e index>;
│ │ │ │ -00003a50: 0a3c 6469 7620 636c 6173 733d 226c 696e .
│ │ │ │ -00003a80: 3c2f 613e 3c73 7061 6e20 636c 6173 733d 70 │ │ │ │ -00003ab0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003ac0: 2020 203c 7370 616e 2063 6c61 7373 3d22 auto genericcrea │ │ │ │ -00003af0: 746f 7220 3d20 5265 673a 3a67 6574 4372 tor = Reg::getCr │ │ │ │ -00003b00: 6561 746f 7228 293b 3c2f 6469 763e 0a3c eator();
.< │ │ │ │ -00003b10: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00003b20: 3e3c 6120 6964 3d22 6c30 3030 3731 2220 > 71 │ │ │ │ -00003b70: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003b80: 2066 6163 746f 7279 2e64 6566 696e 6528 factory.define( │ │ │ │ -00003b90: 5265 673a 3a6e 616d 6528 292c 205b 6765 Reg::name(), [ge │ │ │ │ -00003ba0: 6e65 7269 6363 7265 6174 6f72 5d28 4172 nericcreator](Ar │ │ │ │ -00003bb0: 6773 2e2e 2e20 6172 6773 297b 3c2f 6469 gs... args){.
72 │ │ │ │ -00003c10: 3c2f 7370 616e 3e20 2020 2020 2020 2020 │ │ │ │ -00003c20: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003c30: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003c40: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003c50: 2020 2072 6574 7572 6e20 6765 6e65 7269 return generi │ │ │ │ -00003c60: 6363 7265 6174 6f72 2856 7b7d 2c20 6172 ccreator(V{}, ar │ │ │ │ -00003c70: 6773 2e2e 2e29 3b3c 2f64 6976 3e0a 3c64 gs...);
. │ │ │ │ -00003c90: 3c61 2069 643d 226c 3030 3037 3322 206e 73 │ │ │ │ -00003ce0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003cf0: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003d00: 2020 2020 2020 2020 2020 2020 7d29 3b3c });< │ │ │ │ -00003d10: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
│ │ │ │ -00003d60: 2037 343c 2f73 7061 6e3e 2020 2020 2020 74 │ │ │ │ -00003d70: 2020 2020 2020 2020 2020 2020 2020 2020 │ │ │ │ -00003d80: 2020 2020 2020 7d29 3b3c 2f64 6976 3e0a });
. │ │ │ │ -00003d90: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
.< │ │ │ │ -00003e20: 6469 7620 636c 6173 733d 226c 696e 6522 div class="line" │ │ │ │ -00003e30: 3e3c 6120 6964 3d22 6c30 3030 3736 2220 > 76 }
│ │ │ │ -00003f60: 3738 3c2f 7370 616e 3e7d 203c 7370 616e 78} // end namespac │ │ │ │ -00003f90: 6520 4475 6e65 3c2f 7370 616e 3e3c 2f64 e Dune.
7 │ │ │ │ -00003ff0: 393c 2f73 7061 6e3e 203c 2f64 6976 3e0a 9
. │ │ │ │ -00004000: 3c64 6976 2063 6c61 7373 3d22 6c69 6e65
. │ │ │ │ -000040c0: 3c64 6976 2063 6c61 7373 3d22 7474 6322 .
DUNE_GE │ │ │ │ -000041c0: 545f 434f 554e 5445 523c 2f61 3e3c 2f64 T_COUNTER
#define D │ │ │ │ -000041f0: 554e 455f 4745 545f 434f 554e 5445 5228 UNE_GET_COUNTER( │ │ │ │ -00004200: 5461 6729 3c2f 6469 763e 3c64 6976 2063 Tag)
│ │ │ │ -00004220: 4465 6669 6e69 7469 6f6e 3c2f 623e 2063 Definition c │ │ │ │ -00004230: 6f75 6e74 6572 2e68 683a 3137 3c2f 6469 ounter.hh:17
.
│ │ │ │ -00004280: 3c61 2068 7265 663d 2261 3030 3234 392e Dune
Defini │ │ │ │ -000042c0: 7469 6f6e 3c2f 623e 2061 6c6c 6f63 6174 tion allocat │ │ │ │ -000042d0: 6f72 2e68 683a 3131 3c2f 6469 763e 3c2f or.hh:11
.
..< │ │ │ │ -00004330: 6872 2063 6c61 7373 3d22 666f 6f74 6572 hr class="footer │ │ │ │ -00004340: 222f 3e3c 6164 6472 6573 7320 636c 6173 "/>
.Generated by& │ │ │ │ -00004370: 2331 3630 3b3c 6120 6872 6566 3d22 6874 #160;doxygen< │ │ │ │ -000043f0: 2f61 3e20 312e 392e 380a 3c2f 736d 616c /a> 1.9.8.
... │ │ │ │ +000001b0: 6c65 3e64 756e 652d 6973 746c 3a20 7370 le>dune-istl: sp │ │ │ │ +000001c0: 7172 2e68 6820 536f 7572 6365 2046 696c qr.hh Source Fil │ │ │ │ +000001d0: 653c 2f74 6974 6c65 3e0a 3c6c 696e 6b20 e... │ │ │ │ +00000280: 3c2f 7363 7269 7074 3e0a 3c6c 696e 6b20 ... │ │ │ │ +00000310: 3c73 6372 6970 7420 7479 7065 3d22 7465 . │ │ │ │ +00000350: 3c6c 696e 6b20 6872 6566 3d22 646f 7879 ...
.
. │ │ │ │ +00000420: 0a20 3c74 626f 6479 3e0a 203c 7472 2069 . . . │ │ │ │ +00000440: 2020 3c74 6420 6964 3d22 7072 6f6a 6563 . . │ │ │ │ +000004c0: 203c 2f74 626f 6479 3e0a 3c2f 7461 626c .....< │ │ │ │ +00000630: 7363 7269 7074 2074 7970 653d 2274 6578 script type="tex │ │ │ │ +00000640: 742f 6a61 7661 7363 7269 7074 2220 7372 t/javascript" sr │ │ │ │ +00000650: 633d 226d 656e 752e 6a73 223e 3c2f 7363 c="menu.js">..
.
dune-istl 2.9.0< │ │ │ │ +000004a0: 2f73 7061 6e3e 0a20 2020 3c2f 6469 763e /span>.
│ │ │ │ +000004b0: 0a20 203c 2f74 643e 0a20 3c2f 7472 3e0a .
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ 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::SPQRCreator
 
struct  Dune::SPQRCreator::isValidBlock< class >
 
struct  Dune::SPQRCreator::isValidBlock< FieldVector< double, 1 > >
class  Dune::Preconditioner< X, Y >
 Base class for matrix free definition of preconditioners. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

 Dune::DUNE_REGISTER_DIRECT_SOLVER ("spqr", Dune::SPQRCreator())
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Class for using SPQR with ISTL matrices.

│ │ │ │ -
Author
Marco Agnese, Andrea Sacconi
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,49 +1,20 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +preconditioner.hh File Reference │ │ │ │ │ #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> │ │ │ │ │ +#include "_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_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_:_:_S_P_Q_R_C_r_e_a_t_o_r │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _c_l_a_s_s_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _d_o_u_b_l_e_,_ _1_ _>_ _> │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("spqr", _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r()) │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Class for using SPQR with ISTL matrices. │ │ │ │ │ - Author │ │ │ │ │ - Marco Agnese, Andrea Sacconi │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ │ @@ -21,4679 +21,910 @@ │ │ │ │ 00000140: 2267 656e 6572 6174 6f72 2220 636f 6e74 "generator" cont │ │ │ │ 00000150: 656e 743d 2244 6f78 7967 656e 2031 2e39 ent="Doxygen 1.9 │ │ │ │ 00000160: 2e38 222f 3e0a 3c6d 6574 6120 6e61 6d65 .8"/>..dune-istl: sp │ │ │ │ -000001c0: 7172 2e68 6820 536f 7572 6365 2046 696c qr.hh Source Fil │ │ │ │ -000001d0: 653c 2f74 6974 6c65 3e0a 3c6c 696e 6b20 e... │ │ │ │ -00000280: 3c2f 7363 7269 7074 3e0a 3c6c 696e 6b20 ... │ │ │ │ -00000310: 3c73 6372 6970 7420 7479 7065 3d22 7465 . │ │ │ │ -00000350: 3c6c 696e 6b20 6872 6566 3d22 646f 7879 ...
.
. │ │ │ │ -00000420: 0a20 3c74 626f 6479 3e0a 203c 7472 2069 . . . │ │ │ │ -00000440: 2020 3c74 6420 6964 3d22 7072 6f6a 6563 . . │ │ │ │ -000004c0: 203c 2f74 626f 6479 3e0a 3c2f 7461 626c .....< │ │ │ │ -00000630: 7363 7269 7074 2074 7970 653d 2274 6578 script type="tex │ │ │ │ -00000640: 742f 6a61 7661 7363 7269 7074 2220 7372 t/javascript" sr │ │ │ │ -00000650: 633d 226d 656e 752e 6a73 223e 3c2f 7363 c="menu.js">..
.
dune-istl 2.9.0< │ │ │ │ -000004a0: 2f73 7061 6e3e 0a20 2020 3c2f 6469 763e /span>.
│ │ │ │ -000004b0: 0a20 203c 2f74 643e 0a20 3c2f 7472 3e0a .
. . . . .
.
dune │ │ │ │ +00000480: 2d69 7374 6c3c 7370 616e 2069 643d 2270 -istl&# │ │ │ │ +000004a0: 3136 303b 322e 392e 303c 2f73 7061 6e3e 160;2.9.0 │ │ │ │ +000004b0: 0a20 2020 3c2f 6469 763e 0a20 203c 2f74 .
. .
... │ │ │ │ +00000520: 0a3c 7363 7269 7074 2074 7970 653d 2274 ..< │ │ │ │ +00000630: 2f73 6372 6970 743e 0a3c 7363 7269 7074 /script>.. │ │ │ │ +00000670: 3c73 6372 6970 7420 7479 7065 3d22 7465 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,44 +72,37 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
bdmatrix.hh File Reference
│ │ │ │ +
solvertype.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Implementation of the BDMatrix class. │ │ │ │ +

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

│ │ │ │ -
#include <memory>
│ │ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ -
│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::BDMatrix< B, A >
 A block-diagonal matrix. More...
struct  Dune::IsDirectSolver< Solver >
 
struct  Dune::FieldTraits< BDMatrix< B, A > >
struct  Dune::StoresColumnCompressed< Solver >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
│ │ │ │

Detailed Description

│ │ │ │ -

Implementation of the BDMatrix class.

│ │ │ │ -
Author
Oliver Sander
│ │ │ │ +

Templates characterizing the type of a solver.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,30 +1,22 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -bdmatrix.hh File Reference │ │ │ │ │ -Implementation of the BDMatrix class. _M_o_r_e_._._. │ │ │ │ │ -#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_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +solvertype.hh File Reference │ │ │ │ │ +Templates characterizing the type of a solver. _M_o_r_e_._._. │ │ │ │ │ _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_:_:_B_D_M_a_t_r_i_x_<_ _B_,_ _A_ _> │ │ │ │ │ -  A block-diagonal matrix. _M_o_r_e_._._. │ │ │ │ │ +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_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_D_M_a_t_r_i_x_<_ _B_,_ _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_o_l_v_e_r_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implementation of the BDMatrix class. │ │ │ │ │ - Author │ │ │ │ │ - Oliver Sander │ │ │ │ │ +Templates characterizing the type of a solver. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bdmatrix.hh Source File │ │ │ │ +dune-istl: solvertype.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,189 +74,54 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
bdmatrix.hh
│ │ │ │ +
solvertype.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_BDMATRIX_HH
│ │ │ │ -
6#define DUNE_ISTL_BDMATRIX_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_SOLVERTYPE_HH
│ │ │ │ +
6#define DUNE_ISTL_SOLVERTYPE_HH
│ │ │ │
7
│ │ │ │ -
8#include <memory>
│ │ │ │ -
9
│ │ │ │ -
10#include <dune/common/rangeutilities.hh>
│ │ │ │ -
11#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
12
│ │ │ │ - │ │ │ │ - │ │ │ │ -
15
│ │ │ │ -
21namespace Dune {
│ │ │ │ -
31 template <class B, class A=std::allocator<B> >
│ │ │ │ -
│ │ │ │ -
32 class BDMatrix : public BCRSMatrix<B,A>
│ │ │ │ -
33 {
│ │ │ │ -
34 public:
│ │ │ │ -
35
│ │ │ │ -
36 //===== type definitions and constants
│ │ │ │ -
37
│ │ │ │ -
39 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
40
│ │ │ │ -
42 typedef B block_type;
│ │ │ │ -
43
│ │ │ │ -
45 typedef A allocator_type;
│ │ │ │ -
46
│ │ │ │ -
48 //typedef BCRSMatrix<B,A>::row_type row_type;
│ │ │ │ -
49
│ │ │ │ -
51 typedef typename A::size_type size_type;
│ │ │ │ -
52
│ │ │ │ -
54 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
55 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ -
56
│ │ │ │ -
58 BDMatrix() : BCRSMatrix<B,A>() {}
│ │ │ │ -
59
│ │ │ │ -
│ │ │ │ -
60 explicit BDMatrix(int size)
│ │ │ │ -
61 : BCRSMatrix<B,A>(size, size, BCRSMatrix<B,A>::random) {
│ │ │ │ -
62
│ │ │ │ -
63 for (int i=0; i<size; i++)
│ │ │ │ - │ │ │ │ -
65
│ │ │ │ - │ │ │ │ -
67
│ │ │ │ -
68 for (int i=0; i<size; i++)
│ │ │ │ -
69 this->BCRSMatrix<B,A>::addindex(i, i);
│ │ │ │ -
70
│ │ │ │ - │ │ │ │ -
72
│ │ │ │ -
73 }
│ │ │ │ +
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 };
│ │ │ │
│ │ │ │ -
74
│ │ │ │ -
│ │ │ │ -
76 BDMatrix (std::initializer_list<B> const &list)
│ │ │ │ -
77 : BDMatrix(list.size())
│ │ │ │ -
78 {
│ │ │ │ -
79 size_t i=0;
│ │ │ │ -
80 for (auto it = list.begin(); it != list.end(); ++it, ++i)
│ │ │ │ -
81 (*this)[i][i] = *it;
│ │ │ │ -
82 }
│ │ │ │ -
│ │ │ │ -
83
│ │ │ │ -
│ │ │ │ -
85 void setSize(size_type size)
│ │ │ │ -
86 {
│ │ │ │ -
87 this->BCRSMatrix<B,A>::setSize(size, // rows
│ │ │ │ -
88 size, // columns
│ │ │ │ -
89 size); // nonzeros
│ │ │ │ -
90
│ │ │ │ -
91 for (auto i : range(size))
│ │ │ │ - │ │ │ │ -
93
│ │ │ │ - │ │ │ │ -
95
│ │ │ │ -
96 for (auto i : range(size))
│ │ │ │ -
97 this->BCRSMatrix<B,A>::addindex(i, i);
│ │ │ │ -
98
│ │ │ │ - │ │ │ │ -
100 }
│ │ │ │ -
│ │ │ │ -
101
│ │ │ │ -
│ │ │ │ -
103 BDMatrix& operator= (const BDMatrix& other) {
│ │ │ │ -
104 this->BCRSMatrix<B,A>::operator=(other);
│ │ │ │ -
105 return *this;
│ │ │ │ -
106 }
│ │ │ │ -
│ │ │ │ -
107
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
111 return *this;
│ │ │ │ -
112 }
│ │ │ │ -
│ │ │ │ -
113
│ │ │ │ -
119 template <class V>
│ │ │ │ -
│ │ │ │ -
120 void solve (V& x, const V& rhs) const {
│ │ │ │ -
121 for (size_type i=0; i<this->N(); i++)
│ │ │ │ -
122 {
│ │ │ │ -
123 auto&& xv = Impl::asVector(x[i]);
│ │ │ │ -
124 auto&& rhsv = Impl::asVector(rhs[i]);
│ │ │ │ -
125 Impl::asMatrix((*this)[i][i]).solve(xv,rhsv);
│ │ │ │ -
126 }
│ │ │ │ -
127 }
│ │ │ │ -
│ │ │ │ -
128
│ │ │ │ -
│ │ │ │ -
130 void invert() {
│ │ │ │ -
131 for (size_type i=0; i<this->N(); i++)
│ │ │ │ -
132 Impl::asMatrix((*this)[i][i]).invert();
│ │ │ │ -
133 }
│ │ │ │ -
│ │ │ │ -
134
│ │ │ │ -
135 private:
│ │ │ │ -
136
│ │ │ │ -
137 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ -
138 // The following methods from the base class should now actually be called
│ │ │ │ -
139 // ////////////////////////////////////////////////////////////////////////////
│ │ │ │ -
140
│ │ │ │ -
141 // createbegin and createend should be in there, too, but I can't get it to compile
│ │ │ │ -
142 // BCRSMatrix<B,A>::CreateIterator createbegin () {}
│ │ │ │ -
143 // BCRSMatrix<B,A>::CreateIterator createend () {}
│ │ │ │ -
144 void setrowsize (size_type i, size_type s) {}
│ │ │ │ -
145 void incrementrowsize (size_type i) {}
│ │ │ │ -
146 void endrowsizes () {}
│ │ │ │ -
147 void addindex (size_type row, size_type col) {}
│ │ │ │ -
148 void endindices () {}
│ │ │ │ -
149 };
│ │ │ │ -
│ │ │ │ -
150
│ │ │ │ -
151 template<typename B, typename A>
│ │ │ │ -
│ │ │ │ -
152 struct FieldTraits< BDMatrix<B, A> >
│ │ │ │ -
153 {
│ │ │ │ - │ │ │ │ -
155 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
156 };
│ │ │ │ -
│ │ │ │ -
159} // end namespace Dune
│ │ │ │ -
160
│ │ │ │ -
161#endif
│ │ │ │ -
Helper functions for determining the vector/matrix block level.
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
39} // end namespace Dune
│ │ │ │ +
40#endif
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1149
│ │ │ │ -
@ random
Build entries randomly.
Definition bcrsmatrix.hh:530
│ │ │ │ -
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1248
│ │ │ │ -
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ -
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:861
│ │ │ │ -
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:911
│ │ │ │ -
A block-diagonal matrix.
Definition bdmatrix.hh:33
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bdmatrix.hh:39
│ │ │ │ -
A::size_type size_type
implement row_type with compressed vector
Definition bdmatrix.hh:51
│ │ │ │ -
BDMatrix()
Default constructor.
Definition bdmatrix.hh:58
│ │ │ │ -
BDMatrix(std::initializer_list< B > const &list)
Construct from a std::initializer_list.
Definition bdmatrix.hh:76
│ │ │ │ -
B block_type
export the type representing the components
Definition bdmatrix.hh:42
│ │ │ │ -
void solve(V &x, const V &rhs) const
Solve the system Ax=b in O(n) time.
Definition bdmatrix.hh:120
│ │ │ │ -
A allocator_type
export the allocator type
Definition bdmatrix.hh:45
│ │ │ │ -
BDMatrix(int size)
Definition bdmatrix.hh:60
│ │ │ │ -
BDMatrix & operator=(const BDMatrix &other)
assignment
Definition bdmatrix.hh:103
│ │ │ │ -
static constexpr unsigned int blocklevel
increment block level counter
Definition bdmatrix.hh:55
│ │ │ │ -
void setSize(size_type size)
Resize the matrix. Invalidates the content!
Definition bdmatrix.hh:85
│ │ │ │ -
void invert()
Inverts the matrix.
Definition bdmatrix.hh:130
│ │ │ │ -
typename BDMatrix< B, A >::field_type field_type
Definition bdmatrix.hh:154
│ │ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition bdmatrix.hh:155
│ │ │ │ +
Definition solvertype.hh:16
│ │ │ │ +
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ │ +
Definition solvertype.hh:30
│ │ │ │ +
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,234 +1,53 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -bdmatrix.hh │ │ │ │ │ +solvertype.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 (C) 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_BDMATRIX_HH │ │ │ │ │ -6#define DUNE_ISTL_BDMATRIX_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_SOLVERTYPE_HH │ │ │ │ │ +6#define DUNE_ISTL_SOLVERTYPE_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12 │ │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -15 │ │ │ │ │ -21namespace _D_u_n_e { │ │ │ │ │ -31 template > │ │ │ │ │ -_3_2 class _B_D_M_a_t_r_i_x : public _B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -33 { │ │ │ │ │ -34 public: │ │ │ │ │ -35 │ │ │ │ │ -36 //===== type definitions and constants │ │ │ │ │ -37 │ │ │ │ │ -_3_9 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ -40 │ │ │ │ │ -_4_2 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -43 │ │ │ │ │ -_4_5 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ -46 │ │ │ │ │ -48 //typedef BCRSMatrix::row_type row_type; │ │ │ │ │ -49 │ │ │ │ │ -_5_1 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -52 │ │ │ │ │ -54 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]] │ │ │ │ │ -_5_5 static constexpr unsigned int _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ -56 │ │ │ │ │ -_5_8 _B_D_M_a_t_r_i_x() : _B_C_R_S_M_a_t_r_i_x() {} │ │ │ │ │ -59 │ │ │ │ │ -_6_0 explicit _B_D_M_a_t_r_i_x(int size) │ │ │ │ │ -61 : _B_C_R_S_M_a_t_r_i_x(size, size, _B_C_R_S_M_a_t_r_i_x::_r_a_n_d_o_m) { │ │ │ │ │ -62 │ │ │ │ │ -63 for (int i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 1); │ │ │ │ │ -65 │ │ │ │ │ -66 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ -67 │ │ │ │ │ -68 for (int i=0; i_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i); │ │ │ │ │ -70 │ │ │ │ │ -71 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ -72 │ │ │ │ │ -73 } │ │ │ │ │ -74 │ │ │ │ │ -_7_6 _B_D_M_a_t_r_i_x (std::initializer_list const &list) │ │ │ │ │ -77 : _B_D_M_a_t_r_i_x(list.size()) │ │ │ │ │ -78 { │ │ │ │ │ -79 size_t i=0; │ │ │ │ │ -80 for (auto it = list.begin(); it != list.end(); ++it, ++i) │ │ │ │ │ -81 (*this)[i][i] = *it; │ │ │ │ │ -82 } │ │ │ │ │ -83 │ │ │ │ │ -_8_5 void _s_e_t_S_i_z_e(_s_i_z_e___t_y_p_e size) │ │ │ │ │ -86 { │ │ │ │ │ -87 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_S_i_z_e(size, // rows │ │ │ │ │ -88 size, // columns │ │ │ │ │ -89 size); // nonzeros │ │ │ │ │ -90 │ │ │ │ │ -91 for (auto i : range(size)) │ │ │ │ │ -92 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_s_e_t_r_o_w_s_i_z_e(i, 1); │ │ │ │ │ -93 │ │ │ │ │ -94 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_r_o_w_s_i_z_e_s(); │ │ │ │ │ -95 │ │ │ │ │ -96 for (auto i : range(size)) │ │ │ │ │ -97 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_a_d_d_i_n_d_e_x(i, i); │ │ │ │ │ -98 │ │ │ │ │ -99 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_e_n_d_i_n_d_i_c_e_s(); │ │ │ │ │ -100 } │ │ │ │ │ -101 │ │ │ │ │ -_1_0_3 _B_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _B_D_M_a_t_r_i_x& other) { │ │ │ │ │ -104 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(other); │ │ │ │ │ -105 return *this; │ │ │ │ │ -106 } │ │ │ │ │ -107 │ │ │ │ │ -_1_0_9 _B_D_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) { │ │ │ │ │ -110 this->_B_C_R_S_M_a_t_r_i_x_<_B_,_A_>_:_:_o_p_e_r_a_t_o_r_=(k); │ │ │ │ │ -111 return *this; │ │ │ │ │ -112 } │ │ │ │ │ -113 │ │ │ │ │ -119 template │ │ │ │ │ -_1_2_0 void _s_o_l_v_e (V& x, const V& rhs) const { │ │ │ │ │ -121 for (_s_i_z_e___t_y_p_e i=0; i_N(); i++) │ │ │ │ │ -122 { │ │ │ │ │ -123 auto&& xv = Impl::asVector(x[i]); │ │ │ │ │ -124 auto&& rhsv = Impl::asVector(rhs[i]); │ │ │ │ │ -125 Impl::asMatrix((*this)[i][i]).solve(xv,rhsv); │ │ │ │ │ -126 } │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -_1_3_0 void _i_n_v_e_r_t() { │ │ │ │ │ -131 for (_s_i_z_e___t_y_p_e i=0; i_N(); i++) │ │ │ │ │ -132 Impl::asMatrix((*this)[i][i])._i_n_v_e_r_t(); │ │ │ │ │ -133 } │ │ │ │ │ -134 │ │ │ │ │ -135 private: │ │ │ │ │ -136 │ │ │ │ │ -137 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ -//// │ │ │ │ │ -138 // The following methods from the base class should now actually be called │ │ │ │ │ -139 // //////////////////////////////////////////////////////////////////////// │ │ │ │ │ -//// │ │ │ │ │ -140 │ │ │ │ │ -141 // createbegin and createend should be in there, too, but I can't get it to │ │ │ │ │ -compile │ │ │ │ │ -142 // BCRSMatrix::CreateIterator createbegin () {} │ │ │ │ │ -143 // BCRSMatrix::CreateIterator createend () {} │ │ │ │ │ -144 void setrowsize (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s) {} │ │ │ │ │ -145 void incrementrowsize (_s_i_z_e___t_y_p_e i) {} │ │ │ │ │ -146 void endrowsizes () {} │ │ │ │ │ -147 void addindex (_s_i_z_e___t_y_p_e row, _s_i_z_e___t_y_p_e _c_o_l) {} │ │ │ │ │ -148 void endindices () {} │ │ │ │ │ -149 }; │ │ │ │ │ -150 │ │ │ │ │ -151 template │ │ │ │ │ -_1_5_2 struct FieldTraits< _B_D_M_a_t_r_i_x > │ │ │ │ │ -153 { │ │ │ │ │ -_1_5_4 using _f_i_e_l_d___t_y_p_e = typename _B_D_M_a_t_r_i_x_<_B_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_1_5_5 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ -156 }; │ │ │ │ │ -159} // end namespace Dune │ │ │ │ │ -160 │ │ │ │ │ -161#endif │ │ │ │ │ -_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +12namespace _D_u_n_e │ │ │ │ │ +13{ │ │ │ │ │ +14 template │ │ │ │ │ +_1_5 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ +16 { │ │ │ │ │ +17 enum │ │ │ │ │ +18 { │ │ │ │ │ +24 _v_a_l_u_e =false │ │ │ │ │ +_2_5 }; │ │ │ │ │ +26 }; │ │ │ │ │ +27 │ │ │ │ │ +28 template │ │ │ │ │ +_2_9 struct _S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ │ +30 { │ │ │ │ │ +31 enum │ │ │ │ │ +32 { │ │ │ │ │ +36 _v_a_l_u_e = false │ │ │ │ │ +_3_7 }; │ │ │ │ │ +38 }; │ │ │ │ │ +39} // end namespace Dune │ │ │ │ │ +40#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_r_o_w_s_i_z_e_s │ │ │ │ │ -void endrowsizes() │ │ │ │ │ -indicate that size of all rows is defined │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1149 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_a_n_d_o_m │ │ │ │ │ -@ random │ │ │ │ │ -Build entries randomly. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:530 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_i_n_d_i_c_e_s │ │ │ │ │ -void endindices() │ │ │ │ │ -indicate that all indices are defined, check consistency │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1248 │ │ │ │ │ -_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:1972 │ │ │ │ │ -_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:861 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -BCRSMatrix & operator=(const BCRSMatrix &Mat) │ │ │ │ │ -assignment │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:911 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ -A block-diagonal matrix. │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:39 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -implement row_type with compressed vector │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ -BDMatrix() │ │ │ │ │ -Default constructor. │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ -BDMatrix(std::initializer_list< B > const &list) │ │ │ │ │ -Construct from a std::initializer_list. │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -B block_type │ │ │ │ │ -export the type representing the components │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:42 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ │ -void solve(V &x, const V &rhs) const │ │ │ │ │ -Solve the system Ax=b in O(n) time. │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ -A allocator_type │ │ │ │ │ -export the allocator type │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_B_D_M_a_t_r_i_x │ │ │ │ │ -BDMatrix(int size) │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -BDMatrix & operator=(const BDMatrix &other) │ │ │ │ │ -assignment │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:103 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ -static constexpr unsigned int blocklevel │ │ │ │ │ -increment block level counter │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_s_e_t_S_i_z_e │ │ │ │ │ -void setSize(size_type size) │ │ │ │ │ -Resize the matrix. Invalidates the content! │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_B_D_M_a_t_r_i_x_:_:_i_n_v_e_r_t │ │ │ │ │ -void invert() │ │ │ │ │ -Inverts the matrix. │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:130 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename BDMatrix< B, A >::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:154 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_D_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn bdmatrix.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ │ +@ value │ │ │ │ │ +Whether this is a direct solver. │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ │ +@ value │ │ │ │ │ +whether the solver internally uses column compressed storage │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00077.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: cholmod.hh File Reference │ │ │ │ +dune-istl: multitypeblockmatrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -69,19 +69,64 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
cholmod.hh File Reference
│ │ │ │ +
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
multitypeblockmatrix.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ +
#include <cmath>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <tuple>
│ │ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ │ +#include "istlexception.hh"
│ │ │ │ +#include "gsetc.hh"
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::MultiTypeBlockMatrix< FirstRow, Args >
 A Matrix class to support different block types. More...
 
class  Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, remain_col >
 part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types More...
 
class  Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, 0 >
 
class  Dune::MultiTypeBlockMatrix_Solver< I, crow, remain_row >
 solver for MultiTypeBlockVector & MultiTypeBlockMatrix types More...
 
class  Dune::MultiTypeBlockMatrix_Solver< I, crow, 0 >
 
struct  std::tuple_element< i, Dune::MultiTypeBlockMatrix< Args... > >
 Make std::tuple_element work for MultiTypeBlockMatrix. More...
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Namespaces

namespace  Dune
 
namespace  std
 STL namespace.
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Functions

template<typename T1 , typename... Args>
std::ostream & Dune::operator<< (std::ostream &s, const MultiTypeBlockMatrix< T1, Args... > &m)
 << operator for a MultiTypeBlockMatrix
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,10 +1,47 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -cholmod.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 │ │ │ │ │ +multitypeblockmatrix.hh File Reference │ │ │ │ │ +#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 │ │ │ │ │ + class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _F_i_r_s_t_R_o_w_,_ _A_r_g_s_ _> │ │ │ │ │ +  A _M_a_t_r_i_x class to support different block types. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_ _I_,_ _c_r_o_w_,_ _c_c_o_l_,_ _r_e_m_a_i_n___c_o_l_ _> │ │ │ │ │ +  part of solvers for _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r & _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x types │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_ _I_,_ _c_r_o_w_,_ _c_c_o_l_,_ _0_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _r_e_m_a_i_n___r_o_w_ _> │ │ │ │ │ +  solver for _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r & _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x types _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _> │ │ │ │ │ +  │ │ │ │ │ +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_M_a_t_r_i_x_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ │ +  Make std::tuple_element work for MultiTypeBlockMatrix. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │ +  │ │ │ │ │ +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_M_a_t_r_i_x< │ │ │ │ │ + T1, Args... > &m) │ │ │ │ │ +  << operator for a _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: cholmod.hh Source File │ │ │ │ +dune-istl: multitypeblockmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,378 +74,666 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
cholmod.hh
│ │ │ │ +
multitypeblockmatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │ -
3#pragma once
│ │ │ │ -
4
│ │ │ │ -
5#if HAVE_SUITESPARSE_CHOLMOD
│ │ │ │ -
6
│ │ │ │ -
7#include <dune/common/fmatrix.hh>
│ │ │ │ -
8#include <dune/common/fvector.hh>
│ │ │ │ - │ │ │ │ -
10#include <dune/istl/bvector.hh>
│ │ │ │ -
11#include<dune/istl/solver.hh>
│ │ │ │ - │ │ │ │ -
13#include <dune/istl/foreach.hh>
│ │ │ │ -
14
│ │ │ │ -
15#include <vector>
│ │ │ │ -
16#include <memory>
│ │ │ │ -
17
│ │ │ │ -
18#include <cholmod.h>
│ │ │ │ -
19
│ │ │ │ -
20namespace Dune {
│ │ │ │ +
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_MULTITYPEBLOCKMATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_MULTITYPEBLOCKMATRIX_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <cmath>
│ │ │ │ +
9#include <iostream>
│ │ │ │ +
10#include <tuple>
│ │ │ │ +
11
│ │ │ │ +
12#include <dune/common/hybridutilities.hh>
│ │ │ │ +
13
│ │ │ │ +
14#include "istlexception.hh"
│ │ │ │ +
15
│ │ │ │ +
16// forward declaration
│ │ │ │ +
17namespace Dune
│ │ │ │ +
18{
│ │ │ │ +
19 template<typename FirstRow, typename... Args>
│ │ │ │ +
20 class MultiTypeBlockMatrix;
│ │ │ │
21
│ │ │ │ -
22namespace Impl{
│ │ │ │ -
23
│ │ │ │ -
32 struct NoIgnore
│ │ │ │ -
33 {
│ │ │ │ -
34 const NoIgnore& operator[](std::size_t) const { return *this; }
│ │ │ │ -
35 explicit operator bool() const { return false; }
│ │ │ │ -
36 static constexpr std::size_t size() { return 0; }
│ │ │ │ -
37
│ │ │ │ -
38 };
│ │ │ │ -
39
│ │ │ │ -
40
│ │ │ │ -
41 template<class BlockedVector, class FlatVector>
│ │ │ │ -
42 void copyToFlatVector(const BlockedVector& blockedVector, FlatVector& flatVector)
│ │ │ │ -
43 {
│ │ │ │ -
44 // traverse the vector once just to compute the size
│ │ │ │ -
45 std::size_t len = flatVectorForEach(blockedVector, [&](auto&&, auto...){});
│ │ │ │ -
46 flatVector.resize(len);
│ │ │ │ -
47
│ │ │ │ -
48 flatVectorForEach(blockedVector, [&](auto&& entry, auto offset){
│ │ │ │ -
49 flatVector[offset] = entry;
│ │ │ │ -
50 });
│ │ │ │ -
51 }
│ │ │ │ +
22 template<int I, int crow, int remain_row>
│ │ │ │ +
23 class MultiTypeBlockMatrix_Solver;
│ │ │ │ +
24}
│ │ │ │ +
25
│ │ │ │ +
26#include "gsetc.hh"
│ │ │ │ +
27
│ │ │ │ +
28namespace Dune {
│ │ │ │ +
29
│ │ │ │ +
43 template<typename FirstRow, typename... Args>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
45 : public std::tuple<FirstRow, Args...>
│ │ │ │ +
46 {
│ │ │ │ +
47 using ParentType = std::tuple<FirstRow, Args...>;
│ │ │ │ +
48 public:
│ │ │ │ +
49
│ │ │ │ +
51 using ParentType::ParentType;
│ │ │ │
52
│ │ │ │ -
53 // special (dummy) case for NoIgnore
│ │ │ │ -
54 template<class FlatVector>
│ │ │ │ -
55 void copyToFlatVector(const NoIgnore&, FlatVector&)
│ │ │ │ -
56 {
│ │ │ │ -
57 // just do nothing
│ │ │ │ -
58 return;
│ │ │ │ -
59 }
│ │ │ │ +
56 typedef MultiTypeBlockMatrix<FirstRow, Args...> type;
│ │ │ │ +
57
│ │ │ │ +
59 using size_type = std::size_t;
│ │ │ │
60
│ │ │ │ -
61 template<class FlatVector, class BlockedVector>
│ │ │ │ -
62 void copyToBlockedVector(const FlatVector& flatVector, BlockedVector& blockedVector)
│ │ │ │ -
63 {
│ │ │ │ -
64 flatVectorForEach(blockedVector, [&](auto& entry, auto offset){
│ │ │ │ -
65 entry = flatVector[offset];
│ │ │ │ -
66 });
│ │ │ │ -
67 }
│ │ │ │ +
61 typedef typename FirstRow::field_type field_type;
│ │ │ │ +
62
│ │ │ │ +
│ │ │ │ +
64 static constexpr size_type N()
│ │ │ │ +
65 {
│ │ │ │ +
66 return 1+sizeof...(Args);
│ │ │ │ +
67 }
│ │ │ │ +
│ │ │ │
68
│ │ │ │ -
69
│ │ │ │ -
70} //namespace Impl
│ │ │ │ -
71
│ │ │ │ -
76template<class Vector>
│ │ │ │ -
77class Cholmod : public InverseOperator<Vector, Vector>
│ │ │ │ -
78{
│ │ │ │ -
79public:
│ │ │ │ -
80
│ │ │ │ -
86 Cholmod()
│ │ │ │ -
87 {
│ │ │ │ -
88 cholmod_start(&c_);
│ │ │ │ -
89 }
│ │ │ │ -
90
│ │ │ │ -
96 ~Cholmod()
│ │ │ │ -
97 {
│ │ │ │ -
98 if (L_)
│ │ │ │ -
99 cholmod_free_factor(&L_, &c_);
│ │ │ │ -
100 cholmod_finish(&c_);
│ │ │ │ -
101 }
│ │ │ │ -
102
│ │ │ │ -
103 // forbid copying to avoid freeing memory twice
│ │ │ │ -
104 Cholmod(const Cholmod&) = delete;
│ │ │ │ -
105 Cholmod& operator=(const Cholmod&) = delete;
│ │ │ │ -
106
│ │ │ │ -
107
│ │ │ │ -
110 void apply (Vector& x, Vector& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ │ -
111 {
│ │ │ │ -
112 apply(x,b,res);
│ │ │ │ -
113 }
│ │ │ │ -
114
│ │ │ │ -
120 void apply(Vector& x, Vector& b, InverseOperatorResult& res)
│ │ │ │ -
121 {
│ │ │ │ -
122 // do nothing if N=0
│ │ │ │ -
123 if ( nIsZero_ )
│ │ │ │ -
124 {
│ │ │ │ -
125 return;
│ │ │ │ -
126 }
│ │ │ │ -
127
│ │ │ │ -
128 if (x.size() != b.size())
│ │ │ │ -
129 DUNE_THROW(Exception, "Error in apply(): sizes of x and b do not match!");
│ │ │ │ -
130
│ │ │ │ -
131 // cast to double array
│ │ │ │ -
132 auto b2 = std::make_unique<double[]>(L_->n);
│ │ │ │ -
133 auto x2 = std::make_unique<double[]>(L_->n);
│ │ │ │ -
134
│ │ │ │ -
135 // copy to cholmod
│ │ │ │ -
136 auto bp = b2.get();
│ │ │ │ +
74 [[deprecated("Use method 'N' instead")]]
│ │ │ │ +
│ │ │ │ +
75 static constexpr size_type size()
│ │ │ │ +
76 {
│ │ │ │ +
77 return 1+sizeof...(Args);
│ │ │ │ +
78 }
│ │ │ │ +
│ │ │ │ +
79
│ │ │ │ +
│ │ │ │ +
81 static constexpr size_type M()
│ │ │ │ +
82 {
│ │ │ │ +
83 return FirstRow::size();
│ │ │ │ +
84 }
│ │ │ │ +
│ │ │ │ +
85
│ │ │ │ +
102 template< size_type index >
│ │ │ │ +
103 auto
│ │ │ │ +
│ │ │ │ +
104 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable)
│ │ │ │ +
105 -> decltype(std::get<index>(*this))
│ │ │ │ +
106 {
│ │ │ │ +
107 return std::get<index>(*this);
│ │ │ │ +
108 }
│ │ │ │ +
│ │ │ │ +
109
│ │ │ │ +
115 template< size_type index >
│ │ │ │ +
116 auto
│ │ │ │ +
│ │ │ │ +
117 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable) const
│ │ │ │ +
118 -> decltype(std::get<index>(*this))
│ │ │ │ +
119 {
│ │ │ │ +
120 return std::get<index>(*this);
│ │ │ │ +
121 }
│ │ │ │ +
│ │ │ │ +
122
│ │ │ │ +
126 template<typename T>
│ │ │ │ +
│ │ │ │ +
127 void operator= (const T& newval) {
│ │ │ │ +
128 using namespace Dune::Hybrid;
│ │ │ │ +
129 auto size = index_constant<1+sizeof...(Args)>();
│ │ │ │ +
130 // Since Dune::Hybrid::size(MultiTypeBlockMatrix) is not implemented,
│ │ │ │ +
131 // we cannot use a plain forEach(*this, ...). This could be achieved,
│ │ │ │ +
132 // e.g., by implementing a static size() method.
│ │ │ │ +
133 forEach(integralRange(size), [&](auto&& i) {
│ │ │ │ +
134 (*this)[i] = newval;
│ │ │ │ +
135 });
│ │ │ │ +
136 }
│ │ │ │ +
│ │ │ │
137
│ │ │ │ -
138 flatVectorForEach(b, [&](auto&& entry, auto&& flatIndex){
│ │ │ │ -
139 if ( subIndices_.empty() )
│ │ │ │ -
140 bp[ flatIndex ] = entry;
│ │ │ │ -
141 else
│ │ │ │ -
142 if( subIndices_[ flatIndex ] != std::numeric_limits<std::size_t>::max() )
│ │ │ │ -
143 bp[ subIndices_[ flatIndex ] ] = entry;
│ │ │ │ -
144 });
│ │ │ │ -
145
│ │ │ │ -
146 // create a cholmod dense object
│ │ │ │ -
147 auto b3 = make_cholmod_dense(cholmod_allocate_dense(L_->n, 1, L_->n, CHOLMOD_REAL, &c_), &c_);
│ │ │ │ -
148 // cast because void-ptr
│ │ │ │ -
149 auto b4 = static_cast<double*>(b3->x);
│ │ │ │ -
150 std::copy(b2.get(), b2.get() + L_->n, b4);
│ │ │ │ -
151
│ │ │ │ -
152 // solve for a cholmod x object
│ │ │ │ -
153 auto x3 = make_cholmod_dense(cholmod_solve(CHOLMOD_A, L_, b3.get(), &c_), &c_);
│ │ │ │ -
154 // cast because void-ptr
│ │ │ │ -
155 auto xp = static_cast<double*>(x3->x);
│ │ │ │ -
156
│ │ │ │ -
157 // copy into x
│ │ │ │ -
158 flatVectorForEach(x, [&](auto&& entry, auto&& flatIndex){
│ │ │ │ -
159 if ( subIndices_.empty() )
│ │ │ │ -
160 entry = xp[ flatIndex ];
│ │ │ │ -
161 else
│ │ │ │ -
162 if( subIndices_[ flatIndex ] != std::numeric_limits<std::size_t>::max() )
│ │ │ │ -
163 entry = xp[ subIndices_[ flatIndex ] ];
│ │ │ │ -
164 });
│ │ │ │ -
165
│ │ │ │ -
166 // statistics for a direct solver
│ │ │ │ -
167 res.iterations = 1;
│ │ │ │ -
168 res.converged = true;
│ │ │ │ -
169 }
│ │ │ │ -
170
│ │ │ │ -
171
│ │ │ │ -
177 template<class Matrix>
│ │ │ │ -
178 void setMatrix(const Matrix& matrix)
│ │ │ │ -
179 {
│ │ │ │ -
180 const Impl::NoIgnore* noIgnore = nullptr;
│ │ │ │ -
181 setMatrix(matrix, noIgnore);
│ │ │ │ -
182 }
│ │ │ │ -
183
│ │ │ │ -
198 template<class Matrix, class Ignore>
│ │ │ │ -
199 void setMatrix(const Matrix& matrix, const Ignore* ignore)
│ │ │ │ -
200 {
│ │ │ │ -
201 // count the number of entries and diagonal entries
│ │ │ │ -
202 int nonZeros = 0;
│ │ │ │ -
203 int numberOfIgnoredDofs = 0;
│ │ │ │ -
204
│ │ │ │ -
205
│ │ │ │ -
206 auto [flatRows,flatCols] = flatMatrixForEach( matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex){
│ │ │ │ -
207 if( flatRowIndex <= flatColIndex )
│ │ │ │ -
208 nonZeros++;
│ │ │ │ -
209 });
│ │ │ │ -
210
│ │ │ │ -
211 std::vector<bool> flatIgnore;
│ │ │ │ -
212
│ │ │ │ -
213 if ( ignore )
│ │ │ │ -
214 {
│ │ │ │ -
215 Impl::copyToFlatVector(*ignore,flatIgnore);
│ │ │ │ -
216 numberOfIgnoredDofs = std::count(flatIgnore.begin(),flatIgnore.end(),true);
│ │ │ │ -
217 }
│ │ │ │ -
218
│ │ │ │ -
219 // Total number of rows
│ │ │ │ -
220 int N = flatRows - numberOfIgnoredDofs;
│ │ │ │ -
221
│ │ │ │ -
222 nIsZero_ = (N <= 0);
│ │ │ │ -
223
│ │ │ │ -
224 if ( nIsZero_ )
│ │ │ │ -
225 {
│ │ │ │ -
226 return;
│ │ │ │ -
227 }
│ │ │ │ -
228
│ │ │ │ -
229 /*
│ │ │ │ -
230 * CHOLMOD uses compressed-column sparse matrices, but for symmetric
│ │ │ │ -
231 * matrices this is the same as the compressed-row sparse matrix used
│ │ │ │ -
232 * by DUNE. So we can just store Mᵀ instead of M (as M = Mᵀ).
│ │ │ │ -
233 */
│ │ │ │ -
234 const auto deleter = [c = &this->c_](auto* p) {
│ │ │ │ -
235 cholmod_free_sparse(&p, c);
│ │ │ │ -
236 };
│ │ │ │ -
237 auto M = std::unique_ptr<cholmod_sparse, decltype(deleter)>(
│ │ │ │ -
238 cholmod_allocate_sparse(N, // # rows
│ │ │ │ -
239 N, // # cols
│ │ │ │ -
240 nonZeros, // # of nonzeroes
│ │ │ │ -
241 1, // indices are sorted ( 1 = true)
│ │ │ │ -
242 1, // matrix is "packed" ( 1 = true)
│ │ │ │ -
243 -1, // stype of matrix ( -1 = consider the lower part only )
│ │ │ │ -
244 CHOLMOD_REAL, // xtype of matrix ( CHOLMOD_REAL = single array, no complex numbers)
│ │ │ │ -
245 &c_ // cholmod_common ptr
│ │ │ │ -
246 ), deleter);
│ │ │ │ +
138 //===== vector space arithmetic
│ │ │ │ +
139
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
142 {
│ │ │ │ +
143 auto size = index_constant<N()>();
│ │ │ │ +
144 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ +
145 (*this)[i] *= k;
│ │ │ │ +
146 });
│ │ │ │ +
147
│ │ │ │ +
148 return *this;
│ │ │ │ +
149 }
│ │ │ │ +
│ │ │ │ +
150
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
153 {
│ │ │ │ +
154 auto size = index_constant<N()>();
│ │ │ │ +
155 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ +
156 (*this)[i] /= k;
│ │ │ │ +
157 });
│ │ │ │ +
158
│ │ │ │ +
159 return *this;
│ │ │ │ +
160 }
│ │ │ │ +
│ │ │ │ +
161
│ │ │ │ +
162
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
169 {
│ │ │ │ +
170 auto size = index_constant<N()>();
│ │ │ │ +
171 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ +
172 (*this)[i] += b[i];
│ │ │ │ +
173 });
│ │ │ │ +
174
│ │ │ │ +
175 return *this;
│ │ │ │ +
176 }
│ │ │ │ +
│ │ │ │ +
177
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
184 {
│ │ │ │ +
185 auto size = index_constant<N()>();
│ │ │ │ +
186 Hybrid::forEach(Hybrid::integralRange(size), [&](auto&& i) {
│ │ │ │ +
187 (*this)[i] -= b[i];
│ │ │ │ +
188 });
│ │ │ │ +
189
│ │ │ │ +
190 return *this;
│ │ │ │ +
191 }
│ │ │ │ +
│ │ │ │ +
192
│ │ │ │ +
195 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
196 void mv (const X& x, Y& y) const {
│ │ │ │ +
197 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ +
198 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ +
199 y = 0; //reset y (for mv uses umv)
│ │ │ │ +
200 umv(x,y);
│ │ │ │ +
201 }
│ │ │ │ +
│ │ │ │ +
202
│ │ │ │ +
205 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
206 void umv (const X& x, Y& y) const {
│ │ │ │ +
207 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ +
208 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ +
209 using namespace Dune::Hybrid;
│ │ │ │ +
210 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
211 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
212 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
213 (*this)[i][j].umv(x[j], y[i]);
│ │ │ │ +
214 });
│ │ │ │ +
215 });
│ │ │ │ +
216 }
│ │ │ │ +
│ │ │ │ +
217
│ │ │ │ +
220 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
221 void mmv (const X& x, Y& y) const {
│ │ │ │ +
222 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ +
223 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ +
224 using namespace Dune::Hybrid;
│ │ │ │ +
225 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
226 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
227 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
228 (*this)[i][j].mmv(x[j], y[i]);
│ │ │ │ +
229 });
│ │ │ │ +
230 });
│ │ │ │ +
231 }
│ │ │ │ +
│ │ │ │ +
232
│ │ │ │ +
235 template<typename AlphaType, typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
236 void usmv (const AlphaType& alpha, const X& x, Y& y) const {
│ │ │ │ +
237 static_assert(X::size() == M(), "length of x does not match row length");
│ │ │ │ +
238 static_assert(Y::size() == N(), "length of y does not match row count");
│ │ │ │ +
239 using namespace Dune::Hybrid;
│ │ │ │ +
240 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
241 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
242 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
243 (*this)[i][j].usmv(alpha, x[j], y[i]);
│ │ │ │ +
244 });
│ │ │ │ +
245 });
│ │ │ │ +
246 }
│ │ │ │ +
│ │ │ │
247
│ │ │ │ -
248 // copy the data of BCRS matrix to Cholmod Sparse matrix
│ │ │ │ -
249 int* Ap = static_cast<int*>(M->p);
│ │ │ │ -
250 int* Ai = static_cast<int*>(M->i);
│ │ │ │ -
251 double* Ax = static_cast<double*>(M->x);
│ │ │ │ -
252
│ │ │ │ -
253
│ │ │ │ -
254 if ( ignore )
│ │ │ │ -
255 {
│ │ │ │ -
256 // init the mapping
│ │ │ │ -
257 subIndices_.resize(flatRows,std::numeric_limits<std::size_t>::max());
│ │ │ │ -
258
│ │ │ │ -
259 std::size_t subIndexCounter = 0;
│ │ │ │ -
260
│ │ │ │ -
261 for ( std::size_t i=0; i<flatRows; i++ )
│ │ │ │ -
262 {
│ │ │ │ -
263 if ( not flatIgnore[ i ] )
│ │ │ │ -
264 {
│ │ │ │ -
265 subIndices_[ i ] = subIndexCounter++;
│ │ │ │ -
266 }
│ │ │ │ -
267 }
│ │ │ │ -
268 }
│ │ │ │ -
269
│ │ │ │ -
270 // at first, we need to compute the row starts "Ap"
│ │ │ │ -
271 // therefore, we count all (not ignored) entries in each row and in the end we accumulate everything
│ │ │ │ -
272 flatMatrixForEach(matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex){
│ │ │ │ -
273
│ │ │ │ -
274 // stop if ignored
│ │ │ │ -
275 if ( ignore and ( flatIgnore[flatRowIndex] or flatIgnore[flatColIndex] ) )
│ │ │ │ -
276 return;
│ │ │ │ -
277
│ │ │ │ -
278 // stop if in lower half
│ │ │ │ -
279 if ( flatRowIndex > flatColIndex )
│ │ │ │ -
280 return;
│ │ │ │ -
281
│ │ │ │ -
282 // ok, count the entry
│ │ │ │ -
283 auto idx = ignore ? subIndices_[flatRowIndex] : flatRowIndex;
│ │ │ │ -
284 Ap[idx+1]++;
│ │ │ │ -
285
│ │ │ │ -
286 });
│ │ │ │ +
250 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
251 void mtv (const X& x, Y& y) const {
│ │ │ │ +
252 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ +
253 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ +
254 y = 0;
│ │ │ │ +
255 umtv(x,y);
│ │ │ │ +
256 }
│ │ │ │ +
│ │ │ │ +
257
│ │ │ │ +
260 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
261 void umtv (const X& x, Y& y) const {
│ │ │ │ +
262 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ +
263 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ +
264 using namespace Dune::Hybrid;
│ │ │ │ +
265 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
266 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
267 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
268 (*this)[j][i].umtv(x[j], y[i]);
│ │ │ │ +
269 });
│ │ │ │ +
270 });
│ │ │ │ +
271 }
│ │ │ │ +
│ │ │ │ +
272
│ │ │ │ +
275 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
276 void mmtv (const X& x, Y& y) const {
│ │ │ │ +
277 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ +
278 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ +
279 using namespace Dune::Hybrid;
│ │ │ │ +
280 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
281 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
282 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
283 (*this)[j][i].mmtv(x[j], y[i]);
│ │ │ │ +
284 });
│ │ │ │ +
285 });
│ │ │ │ +
286 }
│ │ │ │ +
│ │ │ │
287
│ │ │ │ -
288 // now accumulate
│ │ │ │ -
289 Ap[0] = 0;
│ │ │ │ -
290 for ( int i=0; i<N; i++ )
│ │ │ │ -
291 {
│ │ │ │ -
292 Ap[i+1] += Ap[i];
│ │ │ │ -
293 }
│ │ │ │ -
294
│ │ │ │ -
295 // we need a compressed row position counter
│ │ │ │ -
296 std::vector<std::size_t> rowPosition(N,0);
│ │ │ │ -
297
│ │ │ │ -
298 // now we can set the entries
│ │ │ │ -
299 flatMatrixForEach(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& flatColIndex){
│ │ │ │ -
300
│ │ │ │ -
301 // stop if ignored
│ │ │ │ -
302 if ( ignore and ( flatIgnore[flatRowIndex] or flatIgnore[flatColIndex] ) )
│ │ │ │ -
303 return;
│ │ │ │ -
304
│ │ │ │ -
305 // stop if in lower half
│ │ │ │ -
306 if ( flatRowIndex > flatColIndex )
│ │ │ │ -
307 return;
│ │ │ │ -
308
│ │ │ │ -
309 // ok, set the entry
│ │ │ │ -
310 auto rowIdx = ignore ? subIndices_[flatRowIndex] : flatRowIndex;
│ │ │ │ -
311 auto colIdx = ignore ? subIndices_[flatColIndex] : flatColIndex;
│ │ │ │ -
312 auto rowStart = Ap[rowIdx];
│ │ │ │ -
313 auto rowPos = rowPosition[rowIdx];
│ │ │ │ -
314 Ai[ rowStart + rowPos ] = colIdx;
│ │ │ │ -
315 Ax[ rowStart + rowPos ] = entry;
│ │ │ │ -
316 rowPosition[rowIdx]++;
│ │ │ │ +
290 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
291 void usmtv (const field_type& alpha, const X& x, Y& y) const {
│ │ │ │ +
292 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ +
293 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ +
294 using namespace Dune::Hybrid;
│ │ │ │ +
295 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
296 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
297 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
298 (*this)[j][i].usmtv(alpha, x[j], y[i]);
│ │ │ │ +
299 });
│ │ │ │ +
300 });
│ │ │ │ +
301 }
│ │ │ │ +
│ │ │ │ +
302
│ │ │ │ +
305 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
306 void umhv (const X& x, Y& y) const {
│ │ │ │ +
307 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ +
308 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ +
309 using namespace Dune::Hybrid;
│ │ │ │ +
310 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
311 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
312 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
313 (*this)[j][i].umhv(x[j], y[i]);
│ │ │ │ +
314 });
│ │ │ │ +
315 });
│ │ │ │ +
316 }
│ │ │ │ +
│ │ │ │
317
│ │ │ │ -
318 });
│ │ │ │ -
319
│ │ │ │ -
320 // Now analyse the pattern and optimal row order
│ │ │ │ -
321 L_ = cholmod_analyze(M.get(), &c_);
│ │ │ │ -
322
│ │ │ │ -
323 // Do the factorization (this may take some time)
│ │ │ │ -
324 cholmod_factorize(M.get(), L_, &c_);
│ │ │ │ -
325 }
│ │ │ │ -
326
│ │ │ │ -
327 virtual SolverCategory::Category category() const
│ │ │ │ -
328 {
│ │ │ │ -
329 return SolverCategory::Category::sequential;
│ │ │ │ -
330 }
│ │ │ │ -
331
│ │ │ │ -
337 cholmod_common& cholmodCommonObject()
│ │ │ │ -
338 {
│ │ │ │ -
339 return c_;
│ │ │ │ -
340 }
│ │ │ │ -
341
│ │ │ │ -
347 cholmod_factor& cholmodFactor()
│ │ │ │ -
348 {
│ │ │ │ -
349 return *L_;
│ │ │ │ -
350 }
│ │ │ │ -
351
│ │ │ │ -
357 const cholmod_factor& cholmodFactor() const
│ │ │ │ -
358 {
│ │ │ │ -
359 return *L_;
│ │ │ │ -
360 }
│ │ │ │ -
361private:
│ │ │ │ -
362
│ │ │ │ -
363 // create a std::unique_ptr to a cholmod_dense object with a deleter
│ │ │ │ -
364 // that calls the appropriate cholmod cleanup routine
│ │ │ │ -
365 auto make_cholmod_dense(cholmod_dense* x, cholmod_common* c)
│ │ │ │ -
366 {
│ │ │ │ -
367 const auto deleter = [c](auto* p) {
│ │ │ │ -
368 cholmod_free_dense(&p, c);
│ │ │ │ -
369 };
│ │ │ │ -
370 return std::unique_ptr<cholmod_dense, decltype(deleter)>(x, deleter);
│ │ │ │ -
371 }
│ │ │ │ -
372
│ │ │ │ -
373 cholmod_common c_;
│ │ │ │ -
374 cholmod_factor* L_ = nullptr;
│ │ │ │ -
375
│ │ │ │ -
376 // indicator for a 0x0 problem (due to ignore dof's)
│ │ │ │ -
377 bool nIsZero_ = false;
│ │ │ │ -
378
│ │ │ │ -
379 // vector mapping all indices in flat order to the not ignored indices
│ │ │ │ -
380 std::vector<std::size_t> subIndices_;
│ │ │ │ -
381};
│ │ │ │ -
382
│ │ │ │ -
383 struct CholmodCreator{
│ │ │ │ -
384 template<class F> struct isValidBlock : std::false_type{};
│ │ │ │ -
385 template<int k> struct isValidBlock<FieldVector<double,k>> : std::true_type{};
│ │ │ │ -
386 template<int k> struct isValidBlock<FieldVector<float,k>> : std::true_type{};
│ │ │ │ -
387
│ │ │ │ -
388 template<class TL, typename M>
│ │ │ │ -
389 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ -
390 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ -
391 operator()(TL /*tl*/, const M& mat, const Dune::ParameterTree& /*config*/,
│ │ │ │ -
392 std::enable_if_t<isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ -
393 {
│ │ │ │ -
394 using D = typename Dune::TypeListElement<1, TL>::type;
│ │ │ │ -
395 auto solver = std::make_shared<Dune::Cholmod<D>>();
│ │ │ │ -
396 solver->setMatrix(mat);
│ │ │ │ -
397 return solver;
│ │ │ │ -
398 }
│ │ │ │ -
399
│ │ │ │ -
400 // second version with SFINAE to validate the template parameters of Cholmod
│ │ │ │ -
401 template<typename TL, typename M>
│ │ │ │ -
402 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ -
403 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ -
404 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ │ -
405 std::enable_if_t<!isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ -
406 {
│ │ │ │ -
407 DUNE_THROW(UnsupportedType, "Unsupported Type in Cholmod");
│ │ │ │ -
408 }
│ │ │ │ -
409 };
│ │ │ │ -
410 DUNE_REGISTER_DIRECT_SOLVER("cholmod", Dune::CholmodCreator());
│ │ │ │ -
411
│ │ │ │ -
412} /* namespace Dune */
│ │ │ │ -
413
│ │ │ │ -
414#endif // HAVE_SUITESPARSE_CHOLMOD
│ │ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ - │ │ │ │ -
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ │ - │ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
320 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
321 void mmhv (const X& x, Y& y) const {
│ │ │ │ +
322 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ +
323 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ +
324 using namespace Dune::Hybrid;
│ │ │ │ +
325 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
326 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
327 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
328 (*this)[j][i].mmhv(x[j], y[i]);
│ │ │ │ +
329 });
│ │ │ │ +
330 });
│ │ │ │ +
331 }
│ │ │ │ +
│ │ │ │ +
332
│ │ │ │ +
335 template<typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
336 void usmhv (const field_type& alpha, const X& x, Y& y) const {
│ │ │ │ +
337 static_assert(X::size() == N(), "length of x does not match number of rows");
│ │ │ │ +
338 static_assert(Y::size() == M(), "length of y does not match number of columns");
│ │ │ │ +
339 using namespace Dune::Hybrid;
│ │ │ │ +
340 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) {
│ │ │ │ +
341 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
342 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) {
│ │ │ │ +
343 (*this)[j][i].usmhv(alpha, x[j], y[i]);
│ │ │ │ +
344 });
│ │ │ │ +
345 });
│ │ │ │ +
346 }
│ │ │ │ +
│ │ │ │ +
347
│ │ │ │ +
348
│ │ │ │ +
349 //===== norms
│ │ │ │ +
350
│ │ │ │ +
│ │ │ │ +
352 auto frobenius_norm2 () const
│ │ │ │ +
353 {
│ │ │ │ +
354 using field_type_00 = typename std::decay_t<decltype((*this)[Indices::_0][Indices::_0])>::field_type;
│ │ │ │ +
355 typename FieldTraits<field_type_00>::real_type sum=0;
│ │ │ │ +
356
│ │ │ │ +
357 auto rows = index_constant<N()>();
│ │ │ │ +
358 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) {
│ │ │ │ +
359 auto cols = index_constant<MultiTypeBlockMatrix<FirstRow, Args...>::M()>();
│ │ │ │ +
360 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) {
│ │ │ │ +
361 sum += (*this)[i][j].frobenius_norm2();
│ │ │ │ +
362 });
│ │ │ │ +
363 });
│ │ │ │ +
364
│ │ │ │ +
365 return sum;
│ │ │ │ +
366 }
│ │ │ │ +
│ │ │ │ +
367
│ │ │ │ +
│ │ │ │ +
369 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ +
370 {
│ │ │ │ +
371 return sqrt(frobenius_norm2());
│ │ │ │ +
372 }
│ │ │ │ +
│ │ │ │ +
373
│ │ │ │ +
│ │ │ │ +
375 auto infinity_norm () const
│ │ │ │ +
376 {
│ │ │ │ +
377 using field_type_00 = typename std::decay_t<decltype((*this)[Indices::_0][Indices::_0])>::field_type;
│ │ │ │ +
378 using std::max;
│ │ │ │ +
379 typename FieldTraits<field_type_00>::real_type norm=0;
│ │ │ │ +
380
│ │ │ │ +
381 auto rows = index_constant<N()>();
│ │ │ │ +
382 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) {
│ │ │ │ +
383
│ │ │ │ +
384 typename FieldTraits<field_type_00>::real_type sum=0;
│ │ │ │ +
385 auto cols = index_constant<MultiTypeBlockMatrix<FirstRow, Args...>::M()>();
│ │ │ │ +
386 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) {
│ │ │ │ +
387 sum += (*this)[i][j].infinity_norm();
│ │ │ │ +
388 });
│ │ │ │ +
389 norm = max(sum, norm);
│ │ │ │ +
390 });
│ │ │ │ +
391
│ │ │ │ +
392 return norm;
│ │ │ │ +
393 }
│ │ │ │ +
│ │ │ │ +
394
│ │ │ │ +
│ │ │ │ +
396 auto infinity_norm_real () const
│ │ │ │ +
397 {
│ │ │ │ +
398 using field_type_00 = typename std::decay_t<decltype((*this)[Indices::_0][Indices::_0])>::field_type;
│ │ │ │ +
399 using std::max;
│ │ │ │ +
400 typename FieldTraits<field_type_00>::real_type norm=0;
│ │ │ │ +
401
│ │ │ │ +
402 auto rows = index_constant<N()>();
│ │ │ │ +
403 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) {
│ │ │ │ +
404
│ │ │ │ +
405 typename FieldTraits<field_type_00>::real_type sum=0;
│ │ │ │ +
406 auto cols = index_constant<MultiTypeBlockMatrix<FirstRow, Args...>::M()>();
│ │ │ │ +
407 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) {
│ │ │ │ +
408 sum += (*this)[i][j].infinity_norm_real();
│ │ │ │ +
409 });
│ │ │ │ +
410 norm = max(sum, norm);
│ │ │ │ +
411 });
│ │ │ │ +
412
│ │ │ │ +
413 return norm;
│ │ │ │ +
414 }
│ │ │ │ +
│ │ │ │ +
415
│ │ │ │ +
416 };
│ │ │ │ +
│ │ │ │ +
417
│ │ │ │ +
423 template<typename T1, typename... Args>
│ │ │ │ +
│ │ │ │ +
424 std::ostream& operator<< (std::ostream& s, const MultiTypeBlockMatrix<T1,Args...>& m) {
│ │ │ │ +
425 auto N = index_constant<MultiTypeBlockMatrix<T1,Args...>::N()>();
│ │ │ │ +
426 auto M = index_constant<MultiTypeBlockMatrix<T1,Args...>::M()>();
│ │ │ │ +
427 using namespace Dune::Hybrid;
│ │ │ │ +
428 forEach(integralRange(N), [&](auto&& i) {
│ │ │ │ +
429 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
430 forEach(integralRange(M), [&](auto&& j) {
│ │ │ │ +
431 s << "\t(" << i << ", " << j << "): \n" << m[i][j];
│ │ │ │ +
432 });
│ │ │ │ +
433 });
│ │ │ │ +
434 s << std::endl;
│ │ │ │ +
435 return s;
│ │ │ │ +
436 }
│ │ │ │ +
│ │ │ │ +
437
│ │ │ │ +
438 //make algmeta_itsteps known
│ │ │ │ +
439 template<int I, typename M>
│ │ │ │ +
440 struct algmeta_itsteps;
│ │ │ │ +
441
│ │ │ │ +
448 template<int I, int crow, int ccol, int remain_col> //MultiTypeBlockMatrix_Solver_Col: iterating over one row
│ │ │ │ +
│ │ │ │ +
449 class MultiTypeBlockMatrix_Solver_Col { //calculating b- A[i][j]*x[j]
│ │ │ │ +
450 public:
│ │ │ │ +
454 template <typename Trhs, typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
455 static void calc_rhs(const TMatrix& A, TVector& x, TVector& v, Trhs& b, const K& w) {
│ │ │ │ +
456 std::get<ccol>( std::get<crow>(A) ).mmv( std::get<ccol>(x), b );
│ │ │ │ + │ │ │ │ +
458 }
│ │ │ │ +
│ │ │ │ +
459
│ │ │ │ +
460 };
│ │ │ │ +
│ │ │ │ +
461 template<int I, int crow, int ccol> //MultiTypeBlockMatrix_Solver_Col recursion end
│ │ │ │ +
│ │ │ │ +
462 class MultiTypeBlockMatrix_Solver_Col<I,crow,ccol,0> {
│ │ │ │ +
463 public:
│ │ │ │ +
464 template <typename Trhs, typename TVector, typename TMatrix, typename K>
│ │ │ │ +
465 static void calc_rhs(const TMatrix&, TVector&, TVector&, Trhs&, const K&) {}
│ │ │ │ +
466 };
│ │ │ │ +
│ │ │ │ +
467
│ │ │ │ +
468
│ │ │ │ +
469
│ │ │ │ +
476 template<int I, int crow, int remain_row>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
478 public:
│ │ │ │ +
479
│ │ │ │ +
483 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
484 static void dbgs(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ +
485 TVector xold(x);
│ │ │ │ +
486 xold=x; //store old x values
│ │ │ │ + │ │ │ │ +
488 x *= w;
│ │ │ │ +
489 x.axpy(1-w,xold); //improve x
│ │ │ │ +
490 }
│ │ │ │ +
│ │ │ │ +
491 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
492 static void dbgs(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ +
493 auto rhs = std::get<crow> (b);
│ │ │ │ +
494
│ │ │ │ +
495 MultiTypeBlockMatrix_Solver_Col<I,crow,0, TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ +
496 //solve on blocklevel I-1
│ │ │ │ +
497 using M =
│ │ │ │ +
498 typename std::remove_cv<
│ │ │ │ +
499 typename std::remove_reference<
│ │ │ │ +
500 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ +
501 >::type
│ │ │ │ +
502 >::type;
│ │ │ │ +
503 algmeta_itsteps<I-1,M>::dbgs(std::get<crow>( std::get<crow>(A)), std::get<crow>(x),rhs,w);
│ │ │ │ + │ │ │ │ +
505 }
│ │ │ │ +
│ │ │ │ +
506
│ │ │ │ +
507
│ │ │ │ +
508
│ │ │ │ +
512 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
513 static void bsorf(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ +
514 TVector v;
│ │ │ │ +
515 v=x; //use latest x values in right side calculation
│ │ │ │ + │ │ │ │ +
517
│ │ │ │ +
518 }
│ │ │ │ +
│ │ │ │ +
519 template <typename TVector, typename TMatrix, typename K> //recursion over all matrix rows (A)
│ │ │ │ +
│ │ │ │ +
520 static void bsorf(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ +
521 auto rhs = std::get<crow> (b);
│ │ │ │ +
522
│ │ │ │ +
523 MultiTypeBlockMatrix_Solver_Col<I,crow,0,TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ +
524 //solve on blocklevel I-1
│ │ │ │ +
525 using M =
│ │ │ │ +
526 typename std::remove_cv<
│ │ │ │ +
527 typename std::remove_reference<
│ │ │ │ +
528 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ +
529 >::type
│ │ │ │ +
530 >::type;
│ │ │ │ +
531 algmeta_itsteps<I-1,M>::bsorf(std::get<crow>( std::get<crow>(A)), std::get<crow>(v),rhs,w);
│ │ │ │ +
532 std::get<crow>(x).axpy(w,std::get<crow>(v));
│ │ │ │ + │ │ │ │ +
534 }
│ │ │ │ +
│ │ │ │ +
535
│ │ │ │ +
539 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
540 static void bsorb(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ +
541 TVector v;
│ │ │ │ +
542 v=x; //use latest x values in right side calculation
│ │ │ │ + │ │ │ │ +
544
│ │ │ │ +
545 }
│ │ │ │ +
│ │ │ │ +
546 template <typename TVector, typename TMatrix, typename K> //recursion over all matrix rows (A)
│ │ │ │ +
│ │ │ │ +
547 static void bsorb(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ +
548 auto rhs = std::get<crow> (b);
│ │ │ │ +
549
│ │ │ │ +
550 MultiTypeBlockMatrix_Solver_Col<I,crow,0, TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ +
551 //solve on blocklevel I-1
│ │ │ │ +
552 using M =
│ │ │ │ +
553 typename std::remove_cv<
│ │ │ │ +
554 typename std::remove_reference<
│ │ │ │ +
555 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ +
556 >::type
│ │ │ │ +
557 >::type;
│ │ │ │ +
558 algmeta_itsteps<I-1,M>::bsorb(std::get<crow>( std::get<crow>(A)), std::get<crow>(v),rhs,w);
│ │ │ │ +
559 std::get<crow>(x).axpy(w,std::get<crow>(v));
│ │ │ │ + │ │ │ │ +
561 }
│ │ │ │ +
│ │ │ │ +
562
│ │ │ │ +
563
│ │ │ │ +
567 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
568 static void dbjac(const TMatrix& A, TVector& x, const TVector& b, const K& w) {
│ │ │ │ +
569 TVector v(x);
│ │ │ │ +
570 v=0; //calc new x in v
│ │ │ │ + │ │ │ │ +
572 x.axpy(w,v); //improve x
│ │ │ │ +
573 }
│ │ │ │ +
│ │ │ │ +
574 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
575 static void dbjac(const TMatrix& A, TVector& x, TVector& v, const TVector& b, const K& w) {
│ │ │ │ +
576 auto rhs = std::get<crow> (b);
│ │ │ │ +
577
│ │ │ │ +
578 MultiTypeBlockMatrix_Solver_Col<I,crow,0, TMatrix::M()>::calc_rhs(A,x,v,rhs,w); // calculate right side of equation
│ │ │ │ +
579 //solve on blocklevel I-1
│ │ │ │ +
580 using M =
│ │ │ │ +
581 typename std::remove_cv<
│ │ │ │ +
582 typename std::remove_reference<
│ │ │ │ +
583 decltype(std::get<crow>( std::get<crow>(A)))
│ │ │ │ +
584 >::type
│ │ │ │ +
585 >::type;
│ │ │ │ +
586 algmeta_itsteps<I-1,M>::dbjac(std::get<crow>( std::get<crow>(A)), std::get<crow>(v),rhs,w);
│ │ │ │ + │ │ │ │ +
588 }
│ │ │ │ +
│ │ │ │ +
589
│ │ │ │ +
590
│ │ │ │ +
591
│ │ │ │ +
592
│ │ │ │ +
593 };
│ │ │ │ +
│ │ │ │ +
594 template<int I, int crow> //recursion end for remain_row = 0
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
596 public:
│ │ │ │ +
597 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
598 static void dbgs(const TMatrix&, TVector&, TVector&,
│ │ │ │ +
599 const TVector&, const K&) {}
│ │ │ │ +
│ │ │ │ +
600
│ │ │ │ +
601 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
602 static void bsorf(const TMatrix&, TVector&, TVector&,
│ │ │ │ +
603 const TVector&, const K&) {}
│ │ │ │ +
│ │ │ │ +
604
│ │ │ │ +
605 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
606 static void bsorb(const TMatrix&, TVector&, TVector&,
│ │ │ │ +
607 const TVector&, const K&) {}
│ │ │ │ +
│ │ │ │ +
608
│ │ │ │ +
609 template <typename TVector, typename TMatrix, typename K>
│ │ │ │ +
│ │ │ │ +
610 static void dbjac(const TMatrix&, TVector&, TVector&,
│ │ │ │ +
611 const TVector&, const K&) {}
│ │ │ │ +
│ │ │ │ +
612 };
│ │ │ │ +
│ │ │ │ +
613
│ │ │ │ +
614} // end namespace Dune
│ │ │ │ +
615
│ │ │ │ +
616namespace std
│ │ │ │ +
617{
│ │ │ │ +
622 template <size_t i, typename... Args>
│ │ │ │ +
│ │ │ │ +
623 struct tuple_element<i,Dune::MultiTypeBlockMatrix<Args...> >
│ │ │ │ +
624 {
│ │ │ │ +
625 using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
│ │ │ │ +
626 };
│ │ │ │ +
│ │ │ │ +
627}
│ │ │ │ +
628#endif
│ │ │ │ +
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ + │ │ │ │ +
MultiTypeBlockMatrix< FirstRow, Args... > type
Definition multitypeblockmatrix.hh:56
│ │ │ │ +
static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:568
│ │ │ │ +
MultiTypeBlockMatrix & operator+=(const MultiTypeBlockMatrix &b)
Add the entries of another matrix to this one.
Definition multitypeblockmatrix.hh:168
│ │ │ │ +
void mv(const X &x, Y &y) const
y = A x
Definition multitypeblockmatrix.hh:196
│ │ │ │ +
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition multitypeblockmatrix.hh:276
│ │ │ │ +
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition multitypeblockmatrix.hh:321
│ │ │ │ +
static void dbgs(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:598
│ │ │ │ +
static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:484
│ │ │ │ +
static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:540
│ │ │ │ +
void usmhv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition multitypeblockmatrix.hh:336
│ │ │ │ +
FirstRow::field_type field_type
Definition multitypeblockmatrix.hh:61
│ │ │ │ +
void usmv(const AlphaType &alpha, const X &x, Y &y) const
y += alpha A x
Definition multitypeblockmatrix.hh:236
│ │ │ │ +
MultiTypeBlockMatrix & operator/=(const field_type &k)
vector space division by scalar
Definition multitypeblockmatrix.hh:152
│ │ │ │ +
typename std::tuple_element< i, std::tuple< Args... > >::type type
Definition multitypeblockmatrix.hh:625
│ │ │ │ +
static void dbgs(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:492
│ │ │ │ +
static void bsorf(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:520
│ │ │ │ +
void umhv(const X &x, Y &y) const
y += A^H x
Definition multitypeblockmatrix.hh:306
│ │ │ │ +
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition multitypeblockmatrix.hh:369
│ │ │ │ +
static constexpr size_type N()
Return the number of matrix rows.
Definition multitypeblockmatrix.hh:64
│ │ │ │ +
void usmtv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition multitypeblockmatrix.hh:291
│ │ │ │ +
void operator=(const T &newval)
Definition multitypeblockmatrix.hh:127
│ │ │ │ +
static void calc_rhs(const TMatrix &, TVector &, TVector &, Trhs &, const K &)
Definition multitypeblockmatrix.hh:465
│ │ │ │ +
void umv(const X &x, Y &y) const
y += A x
Definition multitypeblockmatrix.hh:206
│ │ │ │ +
static void calc_rhs(const TMatrix &A, TVector &x, TVector &v, Trhs &b, const K &w)
Definition multitypeblockmatrix.hh:455
│ │ │ │ +
static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:513
│ │ │ │ +
static constexpr size_type size()
Return the number of matrix rows.
Definition multitypeblockmatrix.hh:75
│ │ │ │ +
static void dbjac(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:610
│ │ │ │ +
auto infinity_norm_real() const
Bastardized version of the infinity-norm / row-sum norm.
Definition multitypeblockmatrix.hh:396
│ │ │ │ +
auto frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition multitypeblockmatrix.hh:352
│ │ │ │ +
std::size_t size_type
Type used for sizes.
Definition multitypeblockmatrix.hh:59
│ │ │ │ +
auto infinity_norm() const
Bastardized version of the infinity-norm / row-sum norm.
Definition multitypeblockmatrix.hh:375
│ │ │ │ +
static void bsorb(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:606
│ │ │ │ +
MultiTypeBlockMatrix & operator-=(const MultiTypeBlockMatrix &b)
Subtract the entries of another matrix from this one.
Definition multitypeblockmatrix.hh:183
│ │ │ │ +
auto operator[](const std::integral_constant< size_type, index > indexVariable) -> decltype(std::get< index >(*this))
Random-access operator.
Definition multitypeblockmatrix.hh:104
│ │ │ │ +
static void dbjac(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:575
│ │ │ │ +
static void bsorf(const TMatrix &, TVector &, TVector &, const TVector &, const K &)
Definition multitypeblockmatrix.hh:602
│ │ │ │ +
void mtv(const X &x, Y &y) const
y = A^T x
Definition multitypeblockmatrix.hh:251
│ │ │ │ +
static constexpr size_type M()
Return the number of matrix columns.
Definition multitypeblockmatrix.hh:81
│ │ │ │ +
void mmv(const X &x, Y &y) const
y -= A x
Definition multitypeblockmatrix.hh:221
│ │ │ │ +
void umtv(const X &x, Y &y) const
y += A^T x
Definition multitypeblockmatrix.hh:261
│ │ │ │ +
static void bsorb(const TMatrix &A, TVector &x, TVector &v, const TVector &b, const K &w)
Definition multitypeblockmatrix.hh:547
│ │ │ │ +
MultiTypeBlockMatrix & operator*=(const field_type &k)
vector space multiplication with scalar
Definition multitypeblockmatrix.hh:141
│ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, std::size_t rowOffset=0, std::size_t colOffset=0)
Traverse a blocked matrix and call a functor at each scalar entry.
Definition foreach.hh:132
│ │ │ │ -
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
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:590
│ │ │ │ +
A Matrix class to support different block types.
Definition multitypeblockmatrix.hh:46
│ │ │ │ +
static void bsorb(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:461
│ │ │ │ +
static void bsorf(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:418
│ │ │ │ +
static void dbjac(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:504
│ │ │ │ +
static void dbgs(const M &A, X &x, const Y &b, const K &w)
Definition gsetc.hh:378
│ │ │ │ +
solver for MultiTypeBlockVector & MultiTypeBlockMatrix types
Definition multitypeblockmatrix.hh:477
│ │ │ │ +
part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types
Definition multitypeblockmatrix.hh:449
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,406 +1,756 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -cholmod.hh │ │ │ │ │ +multitypeblockmatrix.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ -3#pragma once │ │ │ │ │ -4 │ │ │ │ │ -5#if HAVE_SUITESPARSE_CHOLMOD │ │ │ │ │ -6 │ │ │ │ │ -7#include │ │ │ │ │ -8#include │ │ │ │ │ -9#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ -10#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ -11#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ -12#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_f_o_r_e_a_c_h_._h_h> │ │ │ │ │ -14 │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17 │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20namespace _D_u_n_e { │ │ │ │ │ +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_MULTITYPEBLOCKMATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_MULTITYPEBLOCKMATRIX_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12#include │ │ │ │ │ +13 │ │ │ │ │ +14#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +15 │ │ │ │ │ +16// forward declaration │ │ │ │ │ +17namespace _D_u_n_e │ │ │ │ │ +18{ │ │ │ │ │ +19 template │ │ │ │ │ +20 class MultiTypeBlockMatrix; │ │ │ │ │ 21 │ │ │ │ │ -22namespace Impl{ │ │ │ │ │ -23 │ │ │ │ │ -32 struct NoIgnore │ │ │ │ │ -33 { │ │ │ │ │ -34 const NoIgnore& operator[](std::size_t) const { return *this; } │ │ │ │ │ -35 explicit operator bool() const { return false; } │ │ │ │ │ -36 static constexpr std::size_t size() { return 0; } │ │ │ │ │ -37 │ │ │ │ │ -38 }; │ │ │ │ │ -39 │ │ │ │ │ -40 │ │ │ │ │ -41 template │ │ │ │ │ -42 void copyToFlatVector(const BlockedVector& blockedVector, FlatVector& │ │ │ │ │ -flatVector) │ │ │ │ │ -43 { │ │ │ │ │ -44 // traverse the vector once just to compute the size │ │ │ │ │ -45 std::size_t len = _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(blockedVector, [&](auto&&, auto...){}); │ │ │ │ │ -46 flatVector.resize(len); │ │ │ │ │ -47 │ │ │ │ │ -48 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(blockedVector, [&](auto&& entry, auto offset){ │ │ │ │ │ -49 flatVector[offset] = entry; │ │ │ │ │ -50 }); │ │ │ │ │ -51 } │ │ │ │ │ +22 template │ │ │ │ │ +23 class MultiTypeBlockMatrix_Solver; │ │ │ │ │ +24} │ │ │ │ │ +25 │ │ │ │ │ +26#include "_g_s_e_t_c_._h_h" │ │ │ │ │ +27 │ │ │ │ │ +28namespace _D_u_n_e { │ │ │ │ │ +29 │ │ │ │ │ +43 template │ │ │ │ │ +_4_4 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ +45 : public std::tuple │ │ │ │ │ +46 { │ │ │ │ │ +47 using ParentType = std::tuple; │ │ │ │ │ +48 public: │ │ │ │ │ +49 │ │ │ │ │ +51 using ParentType::ParentType; │ │ │ │ │ 52 │ │ │ │ │ -53 // special (dummy) case for NoIgnore │ │ │ │ │ -54 template │ │ │ │ │ -55 void copyToFlatVector(const NoIgnore&, FlatVector&) │ │ │ │ │ -56 { │ │ │ │ │ -57 // just do nothing │ │ │ │ │ -58 return; │ │ │ │ │ -59 } │ │ │ │ │ +_5_6 typedef _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x _t_y_p_e; │ │ │ │ │ +57 │ │ │ │ │ +_5_9 using _s_i_z_e___t_y_p_e = std::size_t; │ │ │ │ │ 60 │ │ │ │ │ -61 template │ │ │ │ │ -62 void copyToBlockedVector(const FlatVector& flatVector, BlockedVector& │ │ │ │ │ -blockedVector) │ │ │ │ │ -63 { │ │ │ │ │ -64 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(blockedVector, [&](auto& entry, auto offset){ │ │ │ │ │ -65 entry = flatVector[offset]; │ │ │ │ │ -66 }); │ │ │ │ │ +_6_1 typedef typename FirstRow::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +62 │ │ │ │ │ +_6_4 static constexpr _s_i_z_e___t_y_p_e _N() │ │ │ │ │ +65 { │ │ │ │ │ +66 return 1+sizeof...(Args); │ │ │ │ │ 67 } │ │ │ │ │ 68 │ │ │ │ │ -69 │ │ │ │ │ -70} //namespace Impl │ │ │ │ │ -71 │ │ │ │ │ -76template │ │ │ │ │ -77class Cholmod : public InverseOperator │ │ │ │ │ -78{ │ │ │ │ │ -79public: │ │ │ │ │ -80 │ │ │ │ │ -86 Cholmod() │ │ │ │ │ -87 { │ │ │ │ │ -88 cholmod_start(&c_); │ │ │ │ │ -89 } │ │ │ │ │ -90 │ │ │ │ │ -96 ~Cholmod() │ │ │ │ │ -97 { │ │ │ │ │ -98 if (L_) │ │ │ │ │ -99 cholmod_free_factor(&L_, &c_); │ │ │ │ │ -100 cholmod_finish(&c_); │ │ │ │ │ -101 } │ │ │ │ │ -102 │ │ │ │ │ -103 // forbid copying to avoid freeing memory twice │ │ │ │ │ -104 Cholmod(const Cholmod&) = delete; │ │ │ │ │ -105 Cholmod& operator=(const Cholmod&) = delete; │ │ │ │ │ -106 │ │ │ │ │ -107 │ │ │ │ │ -110 void apply (Vector& x, Vector& b, [[maybe_unused]] double reduction, │ │ │ │ │ -InverseOperatorResult& res) │ │ │ │ │ -111 { │ │ │ │ │ -112 apply(x,b,res); │ │ │ │ │ -113 } │ │ │ │ │ -114 │ │ │ │ │ -120 void apply(Vector& x, Vector& b, InverseOperatorResult& res) │ │ │ │ │ -121 { │ │ │ │ │ -122 // do nothing if N=0 │ │ │ │ │ -123 if ( nIsZero_ ) │ │ │ │ │ -124 { │ │ │ │ │ -125 return; │ │ │ │ │ -126 } │ │ │ │ │ -127 │ │ │ │ │ -128 if (x.size() != b.size()) │ │ │ │ │ -129 DUNE_THROW(Exception, "Error in apply(): sizes of x and b do not match!"); │ │ │ │ │ -130 │ │ │ │ │ -131 // cast to double array │ │ │ │ │ -132 auto b2 = std::make_unique(L_->n); │ │ │ │ │ -133 auto x2 = std::make_unique(L_->n); │ │ │ │ │ -134 │ │ │ │ │ -135 // copy to cholmod │ │ │ │ │ -136 auto bp = b2.get(); │ │ │ │ │ +74 [[deprecated("Use method 'N' instead")]] │ │ │ │ │ +_7_5 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e() │ │ │ │ │ +76 { │ │ │ │ │ +77 return 1+sizeof...(Args); │ │ │ │ │ +78 } │ │ │ │ │ +79 │ │ │ │ │ +_8_1 static constexpr _s_i_z_e___t_y_p_e _M() │ │ │ │ │ +82 { │ │ │ │ │ +83 return FirstRow::size(); │ │ │ │ │ +84 } │ │ │ │ │ +85 │ │ │ │ │ +102 template< size_type index > │ │ │ │ │ +103 auto │ │ │ │ │ +_1_0_4 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ +> indexVariable) │ │ │ │ │ +105 -> decltype(std::get(*this)) │ │ │ │ │ +106 { │ │ │ │ │ +107 return std::get(*this); │ │ │ │ │ +108 } │ │ │ │ │ +109 │ │ │ │ │ +115 template< size_type index > │ │ │ │ │ +116 auto │ │ │ │ │ +_1_1_7 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ +> indexVariable) const │ │ │ │ │ +118 -> decltype(std::get(*this)) │ │ │ │ │ +119 { │ │ │ │ │ +120 return std::get(*this); │ │ │ │ │ +121 } │ │ │ │ │ +122 │ │ │ │ │ +126 template │ │ │ │ │ +_1_2_7 void _o_p_e_r_a_t_o_r_=_ (const T& newval) { │ │ │ │ │ +128 using namespace Dune::Hybrid; │ │ │ │ │ +129 auto _s_i_z_e = index_constant<1+sizeof...(Args)>(); │ │ │ │ │ +130 // Since Dune::Hybrid::size(MultiTypeBlockMatrix) is not implemented, │ │ │ │ │ +131 // we cannot use a plain forEach(*this, ...). This could be achieved, │ │ │ │ │ +132 // e.g., by implementing a static size() method. │ │ │ │ │ +133 forEach(integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ +134 (*this)[i] = newval; │ │ │ │ │ +135 }); │ │ │ │ │ +136 } │ │ │ │ │ 137 │ │ │ │ │ -138 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(b, [&](auto&& entry, auto&& flatIndex){ │ │ │ │ │ -139 if ( subIndices_.empty() ) │ │ │ │ │ -140 bp[ flatIndex ] = entry; │ │ │ │ │ -141 else │ │ │ │ │ -142 if( subIndices_[ flatIndex ] != std::numeric_limits::max() ) │ │ │ │ │ -143 bp[ subIndices_[ flatIndex ] ] = entry; │ │ │ │ │ -144 }); │ │ │ │ │ -145 │ │ │ │ │ -146 // create a cholmod dense object │ │ │ │ │ -147 auto b3 = make_cholmod_dense(cholmod_allocate_dense(L_->n, 1, L_->n, │ │ │ │ │ -CHOLMOD_REAL, &c_), &c_); │ │ │ │ │ -148 // cast because void-ptr │ │ │ │ │ -149 auto b4 = static_cast(b3->x); │ │ │ │ │ -150 std::copy(b2.get(), b2.get() + L_->n, b4); │ │ │ │ │ -151 │ │ │ │ │ -152 // solve for a cholmod x object │ │ │ │ │ -153 auto x3 = make_cholmod_dense(cholmod_solve(CHOLMOD_A, L_, b3.get(), &c_), │ │ │ │ │ -&c_); │ │ │ │ │ -154 // cast because void-ptr │ │ │ │ │ -155 auto xp = static_cast(x3->x); │ │ │ │ │ -156 │ │ │ │ │ -157 // copy into x │ │ │ │ │ -158 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(x, [&](auto&& entry, auto&& flatIndex){ │ │ │ │ │ -159 if ( subIndices_.empty() ) │ │ │ │ │ -160 entry = xp[ flatIndex ]; │ │ │ │ │ -161 else │ │ │ │ │ -162 if( subIndices_[ flatIndex ] != std::numeric_limits::max() ) │ │ │ │ │ -163 entry = xp[ subIndices_[ flatIndex ] ]; │ │ │ │ │ -164 }); │ │ │ │ │ -165 │ │ │ │ │ -166 // statistics for a direct solver │ │ │ │ │ -167 res.iterations = 1; │ │ │ │ │ -168 res.converged = true; │ │ │ │ │ -169 } │ │ │ │ │ -170 │ │ │ │ │ -171 │ │ │ │ │ -177 template │ │ │ │ │ -178 void setMatrix(const Matrix& matrix) │ │ │ │ │ -179 { │ │ │ │ │ -180 const Impl::NoIgnore* noIgnore = nullptr; │ │ │ │ │ -181 setMatrix(matrix, noIgnore); │ │ │ │ │ -182 } │ │ │ │ │ -183 │ │ │ │ │ -198 template │ │ │ │ │ -199 void setMatrix(const Matrix& matrix, const Ignore* ignore) │ │ │ │ │ -200 { │ │ │ │ │ -201 // count the number of entries and diagonal entries │ │ │ │ │ -202 int nonZeros = 0; │ │ │ │ │ -203 int numberOfIgnoredDofs = 0; │ │ │ │ │ -204 │ │ │ │ │ -205 │ │ │ │ │ -206 auto [flatRows,flatCols] = _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h( matrix, [&](auto&& /*entry*/, │ │ │ │ │ -auto&& flatRowIndex, auto&& flatColIndex){ │ │ │ │ │ -207 if( flatRowIndex <= flatColIndex ) │ │ │ │ │ -208 nonZeros++; │ │ │ │ │ -209 }); │ │ │ │ │ -210 │ │ │ │ │ -211 std::vector flatIgnore; │ │ │ │ │ -212 │ │ │ │ │ -213 if ( ignore ) │ │ │ │ │ -214 { │ │ │ │ │ -215 Impl::copyToFlatVector(*ignore,flatIgnore); │ │ │ │ │ -216 numberOfIgnoredDofs = std::count(flatIgnore.begin(),flatIgnore.end(),true); │ │ │ │ │ -217 } │ │ │ │ │ -218 │ │ │ │ │ -219 // Total number of rows │ │ │ │ │ -220 int N = flatRows - numberOfIgnoredDofs; │ │ │ │ │ -221 │ │ │ │ │ -222 nIsZero_ = (N <= 0); │ │ │ │ │ -223 │ │ │ │ │ -224 if ( nIsZero_ ) │ │ │ │ │ -225 { │ │ │ │ │ -226 return; │ │ │ │ │ -227 } │ │ │ │ │ -228 │ │ │ │ │ -229 /* │ │ │ │ │ -230 * CHOLMOD uses compressed-column sparse matrices, but for symmetric │ │ │ │ │ -231 * matrices this is the same as the compressed-row sparse matrix used │ │ │ │ │ -232 * by DUNE. So we can just store Mᵀ instead of M (as M = Mᵀ). │ │ │ │ │ -233 */ │ │ │ │ │ -234 const auto deleter = [c = &this->c_](auto* p) { │ │ │ │ │ -235 cholmod_free_sparse(&p, c); │ │ │ │ │ -236 }; │ │ │ │ │ -237 auto M = std::unique_ptr( │ │ │ │ │ -238 cholmod_allocate_sparse(N, // # rows │ │ │ │ │ -239 N, // # cols │ │ │ │ │ -240 nonZeros, // # of nonzeroes │ │ │ │ │ -241 1, // indices are sorted ( 1 = true) │ │ │ │ │ -242 1, // matrix is "packed" ( 1 = true) │ │ │ │ │ -243 -1, // stype of matrix ( -1 = consider the lower part only ) │ │ │ │ │ -244 CHOLMOD_REAL, // xtype of matrix ( CHOLMOD_REAL = single array, no complex │ │ │ │ │ -numbers) │ │ │ │ │ -245 &c_ // cholmod_common ptr │ │ │ │ │ -246 ), deleter); │ │ │ │ │ +138 //===== vector space arithmetic │ │ │ │ │ +139 │ │ │ │ │ +_1_4_1 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +142 { │ │ │ │ │ +143 auto _s_i_z_e = index_constant(); │ │ │ │ │ +144 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ +145 (*this)[i] *= k; │ │ │ │ │ +146 }); │ │ │ │ │ +147 │ │ │ │ │ +148 return *this; │ │ │ │ │ +149 } │ │ │ │ │ +150 │ │ │ │ │ +_1_5_2 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_/_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ +153 { │ │ │ │ │ +154 auto _s_i_z_e = index_constant(); │ │ │ │ │ +155 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ +156 (*this)[i] /= k; │ │ │ │ │ +157 }); │ │ │ │ │ +158 │ │ │ │ │ +159 return *this; │ │ │ │ │ +160 } │ │ │ │ │ +161 │ │ │ │ │ +162 │ │ │ │ │ +_1_6_8 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& b) │ │ │ │ │ +169 { │ │ │ │ │ +170 auto _s_i_z_e = index_constant(); │ │ │ │ │ +171 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ +172 (*this)[i] += b[i]; │ │ │ │ │ +173 }); │ │ │ │ │ +174 │ │ │ │ │ +175 return *this; │ │ │ │ │ +176 } │ │ │ │ │ +177 │ │ │ │ │ +_1_8_3 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x& b) │ │ │ │ │ +184 { │ │ │ │ │ +185 auto _s_i_z_e = index_constant(); │ │ │ │ │ +186 Hybrid::forEach(Hybrid::integralRange(_s_i_z_e), [&](auto&& i) { │ │ │ │ │ +187 (*this)[i] -= b[i]; │ │ │ │ │ +188 }); │ │ │ │ │ +189 │ │ │ │ │ +190 return *this; │ │ │ │ │ +191 } │ │ │ │ │ +192 │ │ │ │ │ +195 template │ │ │ │ │ +_1_9_6 void _m_v (const X& x, Y& y) const { │ │ │ │ │ +197 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ +198 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ +199 y = 0; //reset y (for mv uses umv) │ │ │ │ │ +200 _u_m_v(x,y); │ │ │ │ │ +201 } │ │ │ │ │ +202 │ │ │ │ │ +205 template │ │ │ │ │ +_2_0_6 void _u_m_v (const X& x, Y& y) const { │ │ │ │ │ +207 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ +208 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ +209 using namespace Dune::Hybrid; │ │ │ │ │ +210 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +211 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +212 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +213 (*this)[i][j].umv(x[j], y[i]); │ │ │ │ │ +214 }); │ │ │ │ │ +215 }); │ │ │ │ │ +216 } │ │ │ │ │ +217 │ │ │ │ │ +220 template │ │ │ │ │ +_2_2_1 void _m_m_v (const X& x, Y& y) const { │ │ │ │ │ +222 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ +223 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ +224 using namespace Dune::Hybrid; │ │ │ │ │ +225 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +226 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +227 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +228 (*this)[i][j].mmv(x[j], y[i]); │ │ │ │ │ +229 }); │ │ │ │ │ +230 }); │ │ │ │ │ +231 } │ │ │ │ │ +232 │ │ │ │ │ +235 template │ │ │ │ │ +_2_3_6 void _u_s_m_v (const AlphaType& alpha, const X& x, Y& y) const { │ │ │ │ │ +237 static_assert(X::size() == _M(), "length of x does not match row length"); │ │ │ │ │ +238 static_assert(Y::size() == _N(), "length of y does not match row count"); │ │ │ │ │ +239 using namespace Dune::Hybrid; │ │ │ │ │ +240 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +241 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +242 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +243 (*this)[i][j].usmv(alpha, x[j], y[i]); │ │ │ │ │ +244 }); │ │ │ │ │ +245 }); │ │ │ │ │ +246 } │ │ │ │ │ 247 │ │ │ │ │ -248 // copy the data of BCRS matrix to Cholmod Sparse matrix │ │ │ │ │ -249 int* Ap = static_cast(M->p); │ │ │ │ │ -250 int* Ai = static_cast(M->i); │ │ │ │ │ -251 double* Ax = static_cast(M->x); │ │ │ │ │ -252 │ │ │ │ │ -253 │ │ │ │ │ -254 if ( ignore ) │ │ │ │ │ -255 { │ │ │ │ │ -256 // init the mapping │ │ │ │ │ -257 subIndices_.resize(flatRows,std::numeric_limits::max()); │ │ │ │ │ -258 │ │ │ │ │ -259 std::size_t subIndexCounter = 0; │ │ │ │ │ -260 │ │ │ │ │ -261 for ( std::size_t i=0; i flatColIndex ) │ │ │ │ │ -280 return; │ │ │ │ │ -281 │ │ │ │ │ -282 // ok, count the entry │ │ │ │ │ -283 auto idx = ignore ? subIndices_[flatRowIndex] : flatRowIndex; │ │ │ │ │ -284 Ap[idx+1]++; │ │ │ │ │ -285 │ │ │ │ │ -286 }); │ │ │ │ │ +250 template │ │ │ │ │ +_2_5_1 void _m_t_v (const X& x, Y& y) const { │ │ │ │ │ +252 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ +rows"); │ │ │ │ │ +253 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ +columns"); │ │ │ │ │ +254 y = 0; │ │ │ │ │ +255 _u_m_t_v(x,y); │ │ │ │ │ +256 } │ │ │ │ │ +257 │ │ │ │ │ +260 template │ │ │ │ │ +_2_6_1 void _u_m_t_v (const X& x, Y& y) const { │ │ │ │ │ +262 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ +rows"); │ │ │ │ │ +263 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ +columns"); │ │ │ │ │ +264 using namespace Dune::Hybrid; │ │ │ │ │ +265 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +266 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +267 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +268 (*this)[j][i].umtv(x[j], y[i]); │ │ │ │ │ +269 }); │ │ │ │ │ +270 }); │ │ │ │ │ +271 } │ │ │ │ │ +272 │ │ │ │ │ +275 template │ │ │ │ │ +_2_7_6 void _m_m_t_v (const X& x, Y& y) const { │ │ │ │ │ +277 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ +rows"); │ │ │ │ │ +278 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ +columns"); │ │ │ │ │ +279 using namespace Dune::Hybrid; │ │ │ │ │ +280 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +281 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +282 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +283 (*this)[j][i].mmtv(x[j], y[i]); │ │ │ │ │ +284 }); │ │ │ │ │ +285 }); │ │ │ │ │ +286 } │ │ │ │ │ 287 │ │ │ │ │ -288 // now accumulate │ │ │ │ │ -289 Ap[0] = 0; │ │ │ │ │ -290 for ( int i=0; i rowPosition(N,0); │ │ │ │ │ -297 │ │ │ │ │ -298 // now we can set the entries │ │ │ │ │ -299 _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& │ │ │ │ │ -flatColIndex){ │ │ │ │ │ -300 │ │ │ │ │ -301 // stop if ignored │ │ │ │ │ -302 if ( ignore and ( flatIgnore[flatRowIndex] or flatIgnore[flatColIndex] ) ) │ │ │ │ │ -303 return; │ │ │ │ │ -304 │ │ │ │ │ -305 // stop if in lower half │ │ │ │ │ -306 if ( flatRowIndex > flatColIndex ) │ │ │ │ │ -307 return; │ │ │ │ │ -308 │ │ │ │ │ -309 // ok, set the entry │ │ │ │ │ -310 auto rowIdx = ignore ? subIndices_[flatRowIndex] : flatRowIndex; │ │ │ │ │ -311 auto colIdx = ignore ? subIndices_[flatColIndex] : flatColIndex; │ │ │ │ │ -312 auto rowStart = Ap[rowIdx]; │ │ │ │ │ -313 auto rowPos = rowPosition[rowIdx]; │ │ │ │ │ -314 Ai[ rowStart + rowPos ] = colIdx; │ │ │ │ │ -315 Ax[ rowStart + rowPos ] = entry; │ │ │ │ │ -316 rowPosition[rowIdx]++; │ │ │ │ │ +290 template │ │ │ │ │ +_2_9_1 void _u_s_m_t_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const { │ │ │ │ │ +292 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ +rows"); │ │ │ │ │ +293 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ +columns"); │ │ │ │ │ +294 using namespace Dune::Hybrid; │ │ │ │ │ +295 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +296 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +297 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +298 (*this)[j][i].usmtv(alpha, x[j], y[i]); │ │ │ │ │ +299 }); │ │ │ │ │ +300 }); │ │ │ │ │ +301 } │ │ │ │ │ +302 │ │ │ │ │ +305 template │ │ │ │ │ +_3_0_6 void _u_m_h_v (const X& x, Y& y) const { │ │ │ │ │ +307 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ +rows"); │ │ │ │ │ +308 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ +columns"); │ │ │ │ │ +309 using namespace Dune::Hybrid; │ │ │ │ │ +310 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +311 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +312 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +313 (*this)[j][i].umhv(x[j], y[i]); │ │ │ │ │ +314 }); │ │ │ │ │ +315 }); │ │ │ │ │ +316 } │ │ │ │ │ 317 │ │ │ │ │ -318 }); │ │ │ │ │ -319 │ │ │ │ │ -320 // Now analyse the pattern and optimal row order │ │ │ │ │ -321 L_ = cholmod_analyze(M.get(), &c_); │ │ │ │ │ -322 │ │ │ │ │ -323 // Do the factorization (this may take some time) │ │ │ │ │ -324 cholmod_factorize(M.get(), L_, &c_); │ │ │ │ │ -325 } │ │ │ │ │ -326 │ │ │ │ │ -327 virtual SolverCategory::Category category() const │ │ │ │ │ -328 { │ │ │ │ │ -329 return SolverCategory::Category::sequential; │ │ │ │ │ -330 } │ │ │ │ │ -331 │ │ │ │ │ -337 cholmod_common& cholmodCommonObject() │ │ │ │ │ -338 { │ │ │ │ │ -339 return c_; │ │ │ │ │ -340 } │ │ │ │ │ -341 │ │ │ │ │ -347 cholmod_factor& cholmodFactor() │ │ │ │ │ -348 { │ │ │ │ │ -349 return *L_; │ │ │ │ │ -350 } │ │ │ │ │ -351 │ │ │ │ │ -357 const cholmod_factor& cholmodFactor() const │ │ │ │ │ -358 { │ │ │ │ │ -359 return *L_; │ │ │ │ │ -360 } │ │ │ │ │ -361private: │ │ │ │ │ -362 │ │ │ │ │ -363 // create a std::unique_ptr to a cholmod_dense object with a deleter │ │ │ │ │ -364 // that calls the appropriate cholmod cleanup routine │ │ │ │ │ -365 auto make_cholmod_dense(cholmod_dense* x, cholmod_common* c) │ │ │ │ │ -366 { │ │ │ │ │ -367 const auto deleter = [c](auto* p) { │ │ │ │ │ -368 cholmod_free_dense(&p, c); │ │ │ │ │ -369 }; │ │ │ │ │ -370 return std::unique_ptr(x, deleter); │ │ │ │ │ -371 } │ │ │ │ │ -372 │ │ │ │ │ -373 cholmod_common c_; │ │ │ │ │ -374 cholmod_factor* L_ = nullptr; │ │ │ │ │ -375 │ │ │ │ │ -376 // indicator for a 0x0 problem (due to ignore dof's) │ │ │ │ │ -377 bool nIsZero_ = false; │ │ │ │ │ -378 │ │ │ │ │ -379 // vector mapping all indices in flat order to the not ignored indices │ │ │ │ │ -380 std::vector subIndices_; │ │ │ │ │ -381}; │ │ │ │ │ -382 │ │ │ │ │ -383 struct CholmodCreator{ │ │ │ │ │ -384 template struct isValidBlock : std::false_type{}; │ │ │ │ │ -385 template struct isValidBlock> : std::true_type │ │ │ │ │ -{}; │ │ │ │ │ -386 template struct isValidBlock> : std::true_type │ │ │ │ │ -{}; │ │ │ │ │ -387 │ │ │ │ │ -388 template │ │ │ │ │ -389 std::shared_ptr::type, │ │ │ │ │ -390 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ -391 operator()(TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& /*config*/, │ │ │ │ │ -392 std::enable_if_t::type:: │ │ │ │ │ -block_type>::value,int> = 0) const │ │ │ │ │ -393 { │ │ │ │ │ -394 using D = typename Dune::TypeListElement<1, TL>::type; │ │ │ │ │ -395 auto solver = std::make_shared>(); │ │ │ │ │ -396 solver->setMatrix(_m_a_t); │ │ │ │ │ -397 return solver; │ │ │ │ │ -398 } │ │ │ │ │ -399 │ │ │ │ │ -400 // second version with SFINAE to validate the template parameters of │ │ │ │ │ -Cholmod │ │ │ │ │ -401 template │ │ │ │ │ -402 std::shared_ptr::type, │ │ │ │ │ -403 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ -404 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& / │ │ │ │ │ -*config*/, │ │ │ │ │ -405 std::enable_if_t:: │ │ │ │ │ -type::block_type>::value,int> = 0) const │ │ │ │ │ -406 { │ │ │ │ │ -407 DUNE_THROW(UnsupportedType, "Unsupported Type in Cholmod"); │ │ │ │ │ -408 } │ │ │ │ │ -409 }; │ │ │ │ │ -410 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("cholmod", Dune::CholmodCreator()); │ │ │ │ │ -411 │ │ │ │ │ -412} /* namespace Dune */ │ │ │ │ │ -413 │ │ │ │ │ -414#endif // HAVE_SUITESPARSE_CHOLMOD │ │ │ │ │ -_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... │ │ │ │ │ -_f_o_r_e_a_c_h_._h_h │ │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ │ -#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ │ -_s_o_l_v_e_r_._h_h │ │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ │ -_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +320 template │ │ │ │ │ +_3_2_1 void _m_m_h_v (const X& x, Y& y) const { │ │ │ │ │ +322 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ +rows"); │ │ │ │ │ +323 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ +columns"); │ │ │ │ │ +324 using namespace Dune::Hybrid; │ │ │ │ │ +325 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +326 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +327 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +328 (*this)[j][i].mmhv(x[j], y[i]); │ │ │ │ │ +329 }); │ │ │ │ │ +330 }); │ │ │ │ │ +331 } │ │ │ │ │ +332 │ │ │ │ │ +335 template │ │ │ │ │ +_3_3_6 void _u_s_m_h_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const { │ │ │ │ │ +337 static_assert(X::size() == _N(), "length of x does not match number of │ │ │ │ │ +rows"); │ │ │ │ │ +338 static_assert(Y::size() == _M(), "length of y does not match number of │ │ │ │ │ +columns"); │ │ │ │ │ +339 using namespace Dune::Hybrid; │ │ │ │ │ +340 forEach(integralRange(Hybrid::size(y)), [&](auto&& i) { │ │ │ │ │ +341 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +342 forEach(integralRange(Hybrid::size(x)), [&](auto&& j) { │ │ │ │ │ +343 (*this)[j][i].usmhv(alpha, x[j], y[i]); │ │ │ │ │ +344 }); │ │ │ │ │ +345 }); │ │ │ │ │ +346 } │ │ │ │ │ +347 │ │ │ │ │ +348 │ │ │ │ │ +349 //===== norms │ │ │ │ │ +350 │ │ │ │ │ +_3_5_2 auto _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ +353 { │ │ │ │ │ +354 using field_type_00 = typename std::decay_t_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +355 typename FieldTraits::real_type sum=0; │ │ │ │ │ +356 │ │ │ │ │ +357 auto rows = index_constant(); │ │ │ │ │ +358 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) { │ │ │ │ │ +359 auto cols = index_constant::M()>(); │ │ │ │ │ +360 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) { │ │ │ │ │ +361 sum += (*this)[i][j].frobenius_norm2(); │ │ │ │ │ +362 }); │ │ │ │ │ +363 }); │ │ │ │ │ +364 │ │ │ │ │ +365 return sum; │ │ │ │ │ +366 } │ │ │ │ │ +367 │ │ │ │ │ +_3_6_9 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ │ +370 { │ │ │ │ │ +371 return sqrt(_f_r_o_b_e_n_i_u_s___n_o_r_m_2()); │ │ │ │ │ +372 } │ │ │ │ │ +373 │ │ │ │ │ +_3_7_5 auto _i_n_f_i_n_i_t_y___n_o_r_m () const │ │ │ │ │ +376 { │ │ │ │ │ +377 using field_type_00 = typename std::decay_t_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +378 using std::max; │ │ │ │ │ +379 typename FieldTraits::real_type norm=0; │ │ │ │ │ +380 │ │ │ │ │ +381 auto rows = index_constant(); │ │ │ │ │ +382 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) { │ │ │ │ │ +383 │ │ │ │ │ +384 typename FieldTraits::real_type sum=0; │ │ │ │ │ +385 auto cols = index_constant::M()>(); │ │ │ │ │ +386 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) { │ │ │ │ │ +387 sum += (*this)[i][j].infinity_norm(); │ │ │ │ │ +388 }); │ │ │ │ │ +389 norm = max(sum, norm); │ │ │ │ │ +390 }); │ │ │ │ │ +391 │ │ │ │ │ +392 return norm; │ │ │ │ │ +393 } │ │ │ │ │ +394 │ │ │ │ │ +_3_9_6 auto _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l () const │ │ │ │ │ +397 { │ │ │ │ │ +398 using field_type_00 = typename std::decay_t_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +399 using std::max; │ │ │ │ │ +400 typename FieldTraits::real_type norm=0; │ │ │ │ │ +401 │ │ │ │ │ +402 auto rows = index_constant(); │ │ │ │ │ +403 Hybrid::forEach(Hybrid::integralRange(rows), [&](auto&& i) { │ │ │ │ │ +404 │ │ │ │ │ +405 typename FieldTraits::real_type sum=0; │ │ │ │ │ +406 auto cols = index_constant::M()>(); │ │ │ │ │ +407 Hybrid::forEach(Hybrid::integralRange(cols), [&](auto&& j) { │ │ │ │ │ +408 sum += (*this)[i][j].infinity_norm_real(); │ │ │ │ │ +409 }); │ │ │ │ │ +410 norm = max(sum, norm); │ │ │ │ │ +411 }); │ │ │ │ │ +412 │ │ │ │ │ +413 return norm; │ │ │ │ │ +414 } │ │ │ │ │ +415 │ │ │ │ │ +416 }; │ │ │ │ │ +417 │ │ │ │ │ +423 template │ │ │ │ │ +_4_2_4 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_M_a_t_r_i_x_<_T_1_,_A_r_g_s_._._._>& m) { │ │ │ │ │ +425 auto N = index_constant::N()>(); │ │ │ │ │ +426 auto M = index_constant::M()>(); │ │ │ │ │ +427 using namespace Dune::Hybrid; │ │ │ │ │ +428 forEach(integralRange(N), [&](auto&& i) { │ │ │ │ │ +429 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +430 forEach(integralRange(M), [&](auto&& j) { │ │ │ │ │ +431 s << "\t(" << i << ", " << j << "): \n" << m[i][j]; │ │ │ │ │ +432 }); │ │ │ │ │ +433 }); │ │ │ │ │ +434 s << std::endl; │ │ │ │ │ +435 return s; │ │ │ │ │ +436 } │ │ │ │ │ +437 │ │ │ │ │ +438 //make algmeta_itsteps known │ │ │ │ │ +439 template │ │ │ │ │ +440 struct algmeta_itsteps; │ │ │ │ │ +441 │ │ │ │ │ +448 template // │ │ │ │ │ +MultiTypeBlockMatrix_Solver_Col: iterating over one row │ │ │ │ │ +_4_4_9 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l { //calculating b- A[i][j]*x[j] │ │ │ │ │ +450 public: │ │ │ │ │ +454 template │ │ │ │ │ +_4_5_5 static void _c_a_l_c___r_h_s(const TMatrix& A, TVector& x, TVector& v, Trhs& b, │ │ │ │ │ +const K& w) { │ │ │ │ │ +456 std::get( std::get(A) ).mmv( std::get(x), b ); │ │ │ │ │ +457 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_I_,_ _c_r_o_w_,_ _c_c_o_l_+_1_,_ _r_e_m_a_i_n___c_o_l_-_1_>_:_:_c_a_l_c___r_h_s │ │ │ │ │ +(A,x,v,b,w); //next column element │ │ │ │ │ +458 } │ │ │ │ │ +459 │ │ │ │ │ +460 }; │ │ │ │ │ +461 template //MultiTypeBlockMatrix_Solver_Col │ │ │ │ │ +recursion end │ │ │ │ │ +_4_6_2 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l { │ │ │ │ │ +463 public: │ │ │ │ │ +464 template │ │ │ │ │ +_4_6_5 static void _c_a_l_c___r_h_s(const TMatrix&, TVector&, TVector&, Trhs&, const K&) │ │ │ │ │ +{} │ │ │ │ │ +466 }; │ │ │ │ │ +467 │ │ │ │ │ +468 │ │ │ │ │ +469 │ │ │ │ │ +476 template │ │ │ │ │ +_4_7_7 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r { │ │ │ │ │ +478 public: │ │ │ │ │ +479 │ │ │ │ │ +483 template │ │ │ │ │ +_4_8_4 static void _d_b_g_s(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ +w) { │ │ │ │ │ +485 TVector xold(x); │ │ │ │ │ +486 xold=x; //store old x values │ │ │ │ │ +487 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_d_b_g_s(A,x,x,b,w); │ │ │ │ │ +488 x *= w; │ │ │ │ │ +489 x.axpy(1-w,xold); //improve x │ │ │ │ │ +490 } │ │ │ │ │ +491 template │ │ │ │ │ +_4_9_2 static void _d_b_g_s(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ +b, const K& w) { │ │ │ │ │ +493 auto rhs = std::get (b); │ │ │ │ │ +494 │ │ │ │ │ +495 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ +(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ +496 //solve on blocklevel I-1 │ │ │ │ │ +497 using M = │ │ │ │ │ +498 typename std::remove_cv< │ │ │ │ │ +499 typename std::remove_reference< │ │ │ │ │ +500 decltype(std::get( std::get(A))) │ │ │ │ │ +501 >::type │ │ │ │ │ +502 >::type; │ │ │ │ │ +503 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_d_b_g_s(std::get( std::get(A)), std:: │ │ │ │ │ +get(x),rhs,w); │ │ │ │ │ +504 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_+_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_d_b_g_s(A,x,v,b,w); //next │ │ │ │ │ +row │ │ │ │ │ +505 } │ │ │ │ │ +506 │ │ │ │ │ +507 │ │ │ │ │ +508 │ │ │ │ │ +512 template │ │ │ │ │ +_5_1_3 static void _b_s_o_r_f(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ +w) { │ │ │ │ │ +514 TVector v; │ │ │ │ │ +515 v=x; //use latest x values in right side calculation │ │ │ │ │ +516 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_b_s_o_r_f(A,x,v,b,w); │ │ │ │ │ +517 │ │ │ │ │ +518 } │ │ │ │ │ +519 template //recursion over │ │ │ │ │ +all matrix rows (A) │ │ │ │ │ +_5_2_0 static void _b_s_o_r_f(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ +b, const K& w) { │ │ │ │ │ +521 auto rhs = std::get (b); │ │ │ │ │ +522 │ │ │ │ │ +523 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ +(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ +524 //solve on blocklevel I-1 │ │ │ │ │ +525 using M = │ │ │ │ │ +526 typename std::remove_cv< │ │ │ │ │ +527 typename std::remove_reference< │ │ │ │ │ +528 decltype(std::get( std::get(A))) │ │ │ │ │ +529 >::type │ │ │ │ │ +530 >::type; │ │ │ │ │ +531 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_b_s_o_r_f(std::get( std::get(A)), std:: │ │ │ │ │ +get(v),rhs,w); │ │ │ │ │ +532 std::get(x).axpy(w,std::get(v)); │ │ │ │ │ +533 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_+_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_b_s_o_r_f(A,x,v,b,w); // │ │ │ │ │ +next row │ │ │ │ │ +534 } │ │ │ │ │ +535 │ │ │ │ │ +539 template │ │ │ │ │ +_5_4_0 static void _b_s_o_r_b(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ +w) { │ │ │ │ │ +541 TVector v; │ │ │ │ │ +542 v=x; //use latest x values in right side calculation │ │ │ │ │ +543 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_b_s_o_r_b(A,x,v,b,w); │ │ │ │ │ +544 │ │ │ │ │ +545 } │ │ │ │ │ +546 template //recursion over │ │ │ │ │ +all matrix rows (A) │ │ │ │ │ +_5_4_7 static void _b_s_o_r_b(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ +b, const K& w) { │ │ │ │ │ +548 auto rhs = std::get (b); │ │ │ │ │ +549 │ │ │ │ │ +550 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ +(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ +551 //solve on blocklevel I-1 │ │ │ │ │ +552 using M = │ │ │ │ │ +553 typename std::remove_cv< │ │ │ │ │ +554 typename std::remove_reference< │ │ │ │ │ +555 decltype(std::get( std::get(A))) │ │ │ │ │ +556 >::type │ │ │ │ │ +557 >::type; │ │ │ │ │ +558 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_b_s_o_r_b(std::get( std::get(A)), std:: │ │ │ │ │ +get(v),rhs,w); │ │ │ │ │ +559 std::get(x).axpy(w,std::get(v)); │ │ │ │ │ +560 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_-_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_b_s_o_r_b(A,x,v,b,w); // │ │ │ │ │ +next row │ │ │ │ │ +561 } │ │ │ │ │ +562 │ │ │ │ │ +563 │ │ │ │ │ +567 template │ │ │ │ │ +_5_6_8 static void _d_b_j_a_c(const TMatrix& A, TVector& x, const TVector& b, const K& │ │ │ │ │ +w) { │ │ │ │ │ +569 TVector v(x); │ │ │ │ │ +570 v=0; //calc new x in v │ │ │ │ │ +571 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_,_r_e_m_a_i_n___r_o_w_>_:_:_d_b_j_a_c(A,x,v,b,w); │ │ │ │ │ +572 x.axpy(w,v); //improve x │ │ │ │ │ +573 } │ │ │ │ │ +574 template │ │ │ │ │ +_5_7_5 static void _d_b_j_a_c(const TMatrix& A, TVector& x, TVector& v, const TVector& │ │ │ │ │ +b, const K& w) { │ │ │ │ │ +576 auto rhs = std::get (b); │ │ │ │ │ +577 │ │ │ │ │ +578 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l::calc_rhs │ │ │ │ │ +(A,x,v,rhs,w); // calculate right side of equation │ │ │ │ │ +579 //solve on blocklevel I-1 │ │ │ │ │ +580 using M = │ │ │ │ │ +581 typename std::remove_cv< │ │ │ │ │ +582 typename std::remove_reference< │ │ │ │ │ +583 decltype(std::get( std::get(A))) │ │ │ │ │ +584 >::type │ │ │ │ │ +585 >::type; │ │ │ │ │ +586 _a_l_g_m_e_t_a___i_t_s_t_e_p_s_<_I_-_1_,_M_>_:_:_d_b_j_a_c(std::get( std::get(A)), std:: │ │ │ │ │ +get(v),rhs,w); │ │ │ │ │ +587 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_I_,_c_r_o_w_+_1_,_r_e_m_a_i_n___r_o_w_-_1_>_:_:_d_b_j_a_c(A,x,v,b,w); // │ │ │ │ │ +next row │ │ │ │ │ +588 } │ │ │ │ │ +589 │ │ │ │ │ +590 │ │ │ │ │ +591 │ │ │ │ │ +592 │ │ │ │ │ +593 }; │ │ │ │ │ +594 template //recursion end for remain_row = 0 │ │ │ │ │ +_5_9_5 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r { │ │ │ │ │ +596 public: │ │ │ │ │ +597 template │ │ │ │ │ +_5_9_8 static void _d_b_g_s(const TMatrix&, TVector&, TVector&, │ │ │ │ │ +599 const TVector&, const K&) {} │ │ │ │ │ +600 │ │ │ │ │ +601 template │ │ │ │ │ +_6_0_2 static void _b_s_o_r_f(const TMatrix&, TVector&, TVector&, │ │ │ │ │ +603 const TVector&, const K&) {} │ │ │ │ │ +604 │ │ │ │ │ +605 template │ │ │ │ │ +_6_0_6 static void _b_s_o_r_b(const TMatrix&, TVector&, TVector&, │ │ │ │ │ +607 const TVector&, const K&) {} │ │ │ │ │ +608 │ │ │ │ │ +609 template │ │ │ │ │ +_6_1_0 static void _d_b_j_a_c(const TMatrix&, TVector&, TVector&, │ │ │ │ │ +611 const TVector&, const K&) {} │ │ │ │ │ +612 }; │ │ │ │ │ +613 │ │ │ │ │ +614} // end namespace Dune │ │ │ │ │ +615 │ │ │ │ │ +616namespace _s_t_d │ │ │ │ │ +617{ │ │ │ │ │ +622 template │ │ │ │ │ +_6_2_3 struct tuple_element > │ │ │ │ │ +624 { │ │ │ │ │ +_6_2_5 using _t_y_p_e = typename std::tuple_element >::type; │ │ │ │ │ +626 }; │ │ │ │ │ +627} │ │ │ │ │ +628#endif │ │ │ │ │ +_g_s_e_t_c_._h_h │ │ │ │ │ +Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ +generic way. │ │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_t_y_p_e │ │ │ │ │ +MultiTypeBlockMatrix< FirstRow, Args... > type │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:568 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ +MultiTypeBlockMatrix & operator+=(const MultiTypeBlockMatrix &b) │ │ │ │ │ +Add the entries of another matrix to this one. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:168 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ +void mv(const X &x, Y &y) const │ │ │ │ │ +y = A x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:196 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ +void mmtv(const X &x, Y &y) const │ │ │ │ │ +y -= A^T x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ +void mmhv(const X &x, Y &y) const │ │ │ │ │ +y -= A^H x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:321 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ +K &) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:598 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:484 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:540 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ +void usmhv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^H x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:336 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +FirstRow::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ +void usmv(const AlphaType &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:236 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ +MultiTypeBlockMatrix & operator/=(const field_type &k) │ │ │ │ │ +vector space division by scalar │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:152 │ │ │ │ │ +_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_M_a_t_r_i_x_<_ _A_r_g_s_._._._ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +typename std::tuple_element< i, std::tuple< Args... > >::type type │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:625 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ +const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:492 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ +const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ +void umhv(const X &x, Y &y) const │ │ │ │ │ +y += A^H x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:306 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ +FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ +frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:369 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_N │ │ │ │ │ +static constexpr size_type N() │ │ │ │ │ +Return the number of matrix rows. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ +void usmtv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^T x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:291 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +void operator=(const T &newval) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:127 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_<_ _I_,_ _c_r_o_w_,_ _c_c_o_l_,_ _0_ _>_:_:_c_a_l_c___r_h_s │ │ │ │ │ +static void calc_rhs(const TMatrix &, TVector &, TVector &, Trhs &, const K &) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:465 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ +void umv(const X &x, Y &y) const │ │ │ │ │ +y += A x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l_:_:_c_a_l_c___r_h_s │ │ │ │ │ +static void calc_rhs(const TMatrix &A, TVector &x, TVector &v, Trhs &b, const K │ │ │ │ │ +&w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:455 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const TMatrix &A, TVector &x, const TVector &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:513 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_s_i_z_e │ │ │ │ │ +static constexpr size_type size() │ │ │ │ │ +Return the number of matrix rows. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ +K &) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:610 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ +auto infinity_norm_real() const │ │ │ │ │ +Bastardized version of the infinity-norm / row-sum norm. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:396 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ +auto frobenius_norm2() const │ │ │ │ │ +square of frobenius norm, need for block recursion │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:352 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::size_t size_type │ │ │ │ │ +Type used for sizes. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ +auto infinity_norm() const │ │ │ │ │ +Bastardized version of the infinity-norm / row-sum norm. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:375 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ +K &) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:606 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ +MultiTypeBlockMatrix & operator-=(const MultiTypeBlockMatrix &b) │ │ │ │ │ +Subtract the entries of another matrix from this one. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:183 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +auto operator[](const std::integral_constant< size_type, index > indexVariable) │ │ │ │ │ +-> decltype(std::get< index >(*this)) │ │ │ │ │ +Random-access operator. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ +const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:575 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_<_ _I_,_ _c_r_o_w_,_ _0_ _>_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const TMatrix &, TVector &, TVector &, const TVector &, const │ │ │ │ │ +K &) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:602 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ +void mtv(const X &x, Y &y) const │ │ │ │ │ +y = A^T x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:251 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_M │ │ │ │ │ +static constexpr size_type M() │ │ │ │ │ +Return the number of matrix columns. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:81 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ +void mmv(const X &x, Y &y) const │ │ │ │ │ +y -= A x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:221 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ +void umtv(const X &x, Y &y) const │ │ │ │ │ +y += A^T x │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:261 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const TMatrix &A, TVector &x, TVector &v, const TVector &b, │ │ │ │ │ +const K &w) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:547 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ +MultiTypeBlockMatrix & operator*=(const field_type &k) │ │ │ │ │ +vector space multiplication with scalar │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:141 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h │ │ │ │ │ -std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, │ │ │ │ │ -std::size_t rowOffset=0, std::size_t colOffset=0) │ │ │ │ │ -Traverse a blocked matrix and call a functor at each scalar entry. │ │ │ │ │ -DDeeffiinniittiioonn foreach.hh:132 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_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:590 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ +A Matrix class to support different block types. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_b │ │ │ │ │ +static void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:461 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_b_s_o_r_f │ │ │ │ │ +static void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:418 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_j_a_c │ │ │ │ │ +static void dbjac(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:504 │ │ │ │ │ +_D_u_n_e_:_:_a_l_g_m_e_t_a___i_t_s_t_e_p_s_:_:_d_b_g_s │ │ │ │ │ +static void dbgs(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:378 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r │ │ │ │ │ +solver for MultiTypeBlockVector & MultiTypeBlockMatrix types │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:477 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x___S_o_l_v_e_r___C_o_l │ │ │ │ │ +part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:449 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixutils.hh File Reference │ │ │ │ +dune-istl: matrixmarket.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,91 +72,263 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Enumerations | │ │ │ │ +Functions | │ │ │ │ +Variables
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Some handy generic functions for ISTL matrices. │ │ │ │ +

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

│ │ │ │ -
#include <set>
│ │ │ │ -#include <vector>
│ │ │ │ +
#include <algorithm>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <fstream>
│ │ │ │ +#include <ios>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <istream>
│ │ │ │ #include <limits>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ +#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/dynmatrix.hh>
│ │ │ │ -#include <dune/common/diagonalmatrix.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <dune/istl/scaledidmatrix.hh>
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ │ +#include <dune/common/simd/simd.hh>
│ │ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ +#include <dune/istl/bvector.hh>
│ │ │ │ +#include <dune/istl/matrixutils.hh>
│ │ │ │ +#include <dune/istl/owneroverlapcopy.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::CheckIfDiagonalPresent< Matrix, blocklevel, l >
 Check whether the a matrix has diagonal values on blocklevel recursion levels. More...
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::CheckIfDiagonalPresent< Matrix, 0, l >
struct  Dune::MatrixMarketImpl::mm_header_printer< FieldVector< T, j > >
 
struct  Dune::CheckIfDiagonalPresent< MultiTypeBlockMatrix< T1, Args... >, blocklevel, l >
struct  Dune::MatrixMarketImpl::mm_header_printer< FieldMatrix< T, i, j > >
 
struct  Dune::MatrixDimension< M >
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BlockVector< T, A > >
 
struct  Dune::MatrixDimension< Matrix< B, TA > >
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BlockVector< FieldVector< T, i >, A > >
 
struct  Dune::MatrixDimension< BCRSMatrix< B, TA > >
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BCRSMatrix< T, A > >
 
struct  Dune::MatrixDimension< BCRSMatrix< FieldMatrix< B, n, m >, TA > >
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BCRSMatrix< FieldMatrix< T, i, j >, A > >
 
struct  Dune::MatrixDimension< FieldMatrix< K, n, m > >
struct  Dune::MatrixMarketImpl::mm_block_structure_header< FieldMatrix< T, i, j > >
 
struct  Dune::MatrixDimension< Dune::DynamicMatrix< T > >
struct  Dune::MatrixMarketImpl::mm_block_structure_header< FieldVector< T, i > >
 
struct  Dune::MatrixDimension< Matrix< FieldMatrix< K, n, m >, TA > >
struct  Dune::MatrixMarketImpl::MMHeader
 
struct  Dune::MatrixDimension< DiagonalMatrix< K, n > >
struct  Dune::MatrixMarketImpl::IndexData< T >
 
struct  Dune::MatrixDimension< ScaledIdentityMatrix< K, n > >
struct  Dune::MatrixMarketImpl::NumericWrapper< T >
 a wrapper class of numeric values. More...
 
struct  Dune::IsMatrix< T >
 Test whether a type is an ISTL Matrix. More...
struct  Dune::MatrixMarketImpl::PatternDummy
 Utility class for marking the pattern type of the MatrixMarket matrices. More...
 
struct  Dune::IsMatrix< DenseMatrix< T > >
struct  Dune::MatrixMarketImpl::NumericWrapper< PatternDummy >
 
struct  Dune::IsMatrix< BCRSMatrix< T, A > >
struct  Dune::MatrixMarketImpl::MatrixValuesSetter< D, brows, bcols >
 Functor to the data values of the matrix. More...
 
struct  Dune::PointerCompare< T >
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::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

template<class M >
auto Dune::countNonZeros (const M &, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr)
 Get the number of nonzero fields in the matrix.
 
template<class M >
auto Dune::countNonZeros (const M &matrix, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
 
template<class M , class C >
void Dune::printGlobalSparseMatrix (const M &mat, C &ooc, std::ostream &os)
 
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

│ │ │ │ -

Some handy generic functions for ISTL matrices.

│ │ │ │ +

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

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

Contains one level overlapping Schwarz preconditioners. │ │ │ │ -More...

│ │ │ │ -
#include <cassert>
│ │ │ │ -#include <algorithm>
│ │ │ │ +
#include <unordered_map>
│ │ │ │ #include <functional>
│ │ │ │ #include <memory>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <set>
│ │ │ │ -#include <dune/common/dynmatrix.hh>
│ │ │ │ -#include <dune/common/sllist.hh>
│ │ │ │ -#include <dune/istl/bccsmatrixinitializer.hh>
│ │ │ │ -#include "preconditioners.hh"
│ │ │ │ -#include "superlu.hh"
│ │ │ │ -#include "umfpack.hh"
│ │ │ │ -#include "bvector.hh"
│ │ │ │ -#include "bcrsmatrix.hh"
│ │ │ │ -#include "ilusubdomainsolver.hh"
│ │ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ │ +#include <dune/common/parametertree.hh>
│ │ │ │ +#include <dune/common/singleton.hh>
│ │ │ │ +#include "solverregistry.hh"
│ │ │ │ +#include <dune/istl/solver.hh>
│ │ │ │ +#include <dune/istl/schwarz.hh>
│ │ │ │ +#include <dune/istl/novlpschwarz.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::OverlappingSchwarzInitializer< I, S, D >
 Initializer for SuperLU Matrices representing the subdomains. More...
 
struct  Dune::AdditiveSchwarzMode
 Tag that the tells the Schwarz method to be additive. More...
 
struct  Dune::MultiplicativeSchwarzMode
 Tag that tells the Schwarz method to be multiplicative. More...
 
struct  Dune::SymmetricMultiplicativeSchwarzMode
 Tag that tells the Schwarz method to be multiplicative and symmetric. More...
 
class  Dune::DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >
 
class  Dune::OverlappingAssignerHelper< T, tag >
 
class  Dune::OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >, false >
 
struct  Dune::OverlappingAssignerHelper< S< BCRSMatrix< T, A > >, true >
 
class  Dune::OverlappingAssignerILUBase< M, X, Y >
 
class  Dune::OverlappingAssignerHelper< ILU0SubdomainSolver< M, X, Y >, false >
 
class  Dune::OverlappingAssignerHelper< ILUNSubdomainSolver< M, X, Y >, false >
 
struct  Dune::AdditiveAdder< S, T >
 
struct  Dune::AdditiveAdder< S, BlockVector< T, A > >
 
struct  Dune::MultiplicativeAdder< S, T >
 
struct  Dune::MultiplicativeAdder< S, BlockVector< T, A > >
 
struct  Dune::AdderSelector< T, X, S >
 template meta program for choosing how to add the correction. More...
 
struct  Dune::AdderSelector< AdditiveSchwarzMode, X, S >
 
struct  Dune::AdderSelector< MultiplicativeSchwarzMode, X, S >
 
struct  Dune::AdderSelector< SymmetricMultiplicativeSchwarzMode, X, S >
 
struct  Dune::IteratorDirectionSelector< T1, T2, forward >
 Helper template meta program for application of overlapping Schwarz. More...
 
struct  Dune::IteratorDirectionSelector< T1, T2, false >
 
struct  Dune::SeqOverlappingSchwarzApplier< T >
 Helper template meta program for application of overlapping Schwarz. More...
 
struct  Dune::SeqOverlappingSchwarzApplier< SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< T, tag >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >, false >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< S< BCRSMatrix< T, A > >, true >
 
struct  Dune::SeqOverlappingSchwarzAssemblerILUBase< M, X, Y >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< ILU0SubdomainSolver< M, X, Y >, false >
 
struct  Dune::SeqOverlappingSchwarzAssemblerHelper< ILUNSubdomainSolver< M, X, Y >, false >
 
class  Dune::SeqOverlappingSchwarz< M, X, TM, TD, TA >
 Sequential overlapping Schwarz preconditioner. More...
 
struct  Dune::SeqOverlappingSchwarzDomainSize< M >
 
struct  Dune::SeqOverlappingSchwarzDomainSize< BCRSMatrix< T, A > >
class  Dune::SolverFactory< Operator >
 Factory to assembly solvers configured by a ParameterTree. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Typedefs

template<typename T >
using Dune::OverlappingAssigner = OverlappingAssignerHelper< T, Dune::StoresColumnCompressed< T >::value >
 
template<class T >
using Dune::SeqOverlappingSchwarzAssembler = SeqOverlappingSchwarzAssemblerHelper< T, Dune::StoresColumnCompressed< T >::value >
 
template<class M , class X , class Y >
using Dune::DirectSolverSignature = std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &)
 
template<class M , class X , class Y >
using Dune::DirectSolverFactory = Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > >
 
template<class M , class X , class Y >
using Dune::PreconditionerSignature = std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const ParameterTree &)
 
template<class M , class X , class Y >
using Dune::PreconditionerFactory = Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > >
 
template<class X , class Y >
using Dune::IterativeSolverSignature = std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &)
 
template<class X , class Y >
using Dune::IterativeSolverFactory = Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > >
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

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

Detailed Description

│ │ │ │ -

Contains one level overlapping Schwarz preconditioners.

│ │ │ │ -
Author
Markus Blatt
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,130 +1,101 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -overlappingschwarz.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 │ │ │ │ │ -Contains one level overlapping Schwarz preconditioners. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +solverfactory.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#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 "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ │ -#include "_s_u_p_e_r_l_u_._h_h" │ │ │ │ │ -#include "_u_m_f_p_a_c_k_._h_h" │ │ │ │ │ -#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ │ -#include "_i_l_u_s_u_b_d_o_m_a_i_n_s_o_l_v_e_r_._h_h" │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h" │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ - class   _D_u_n_e_:_:_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_<_ _I_,_ _S_,_ _D_ _> │ │ │ │ │ -  Initializer for _S_u_p_e_r_L_U Matrices representing the subdomains. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e │ │ │ │ │ -  Tag that the tells the Schwarz method to be additive. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_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 │ │ │ │ │ -  Tag that tells the Schwarz method to be multiplicative. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_y_m_m_e_t_r_i_c_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 │ │ │ │ │ -  Tag that tells the Schwarz method to be multiplicative and symmetric. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _T_,_ _t_a_g_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_< │ │ │ │ │ - _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e │ │ │ │ │ - _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e │ │ │ │ │ - _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _T_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _T_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _T_,_ _X_,_ _S_ _> │ │ │ │ │ -  template meta program for choosing how to add the correction. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_ _X_,_ _S_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _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_,_ _X_,_ _S_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _S_y_m_m_e_t_r_i_c_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_,_ _X_,_ _S_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_o_r_w_a_r_d_ _> │ │ │ │ │ -  Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_p_p_l_i_e_r_<_ _T_ _> │ │ │ │ │ -  Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _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_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_, │ │ │ │ │ - _S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_<_ _T_,_ _t_a_g_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_< │ │ │ │ │ - _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_, │ │ │ │ │ - _t_r_u_e_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_I_L_U_B_a_s_e_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_<_ _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_, │ │ │ │ │ - _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_<_ _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_, │ │ │ │ │ - _Y_ _>_,_ _f_a_l_s_e_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _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_<_ _M_,_ _X_,_ _T_M_,_ _T_D_,_ _T_A_ _> │ │ │ │ │ -  Sequential overlapping Schwarz preconditioner. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _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_D_o_m_a_i_n_S_i_z_e_<_ _M_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _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_D_o_m_a_i_n_S_i_z_e_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_<_ _O_p_e_r_a_t_o_r_ _> │ │ │ │ │ +  Factory to assembly solvers configured by a ParameterTree. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r = _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r< T, _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< T >::value > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _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 = │ │ │ │ │ - _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< T, _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< T │ │ │ │ │ - >::value > │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Contains one level overlapping Schwarz preconditioners. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y > > │ │ │ │ │ + (const M &, const ParameterTree &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ │ + _D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ │ + >(const std::shared_ptr< M > &, const ParameterTree &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ │ + _P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y │ │ │ │ │ + > >(const std::shared_ptr< _L_i_n_e_a_r_O_p_e_r_a_t_o_r< X, Y > > &, const std:: │ │ │ │ │ + shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > > &, const std::shared_ptr< │ │ │ │ │ + _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > >, const ParameterTree &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ │ + _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< X, Y > > > │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ │ + const O &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ │ + const std::shared_ptr< │ │ │ │ │ + _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, C > │ │ │ │ │ + > &op) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ │ + const std::shared_ptr< │ │ │ │ │ + _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ │ + C > > &op) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ │ + shared_ptr< _M_a_t_r_i_x_A_d_a_p_t_e_r< M, X, Y > > │ │ │ │ │ + &) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ │ + shared_ptr< _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< │ │ │ │ │ + M, X, Y, C > > &op) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ │ + shared_ptr< │ │ │ │ │ + _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ │ + C > > &op) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< _D_u_n_e_:_:_g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y (std:: │ │ │ │ │ + typename Operator::domain_type, shared_ptr< Operator > op, const │ │ │ │ │ + typename Operator::range_type > >  ParameterTree &config, std::shared_ptr< │ │ │ │ │ + _P_r_e_c_o_n_d_i_t_i_o_n_e_r< typename Operator:: │ │ │ │ │ + domain_type, typename Operator:: │ │ │ │ │ + range_type > > prec=nullptr) │ │ │ │ │ + Instantiates an _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r from an │ │ │ │ │ +  Operator and a configuration given as a │ │ │ │ │ + ParameterTree. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: overlappingschwarz.hh Source File │ │ │ │ +dune-istl: solverfactory.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,1666 +74,245 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
overlappingschwarz.hh
│ │ │ │ +
solverfactory.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_OVERLAPPINGSCHWARZ_HH
│ │ │ │ -
6#define DUNE_ISTL_OVERLAPPINGSCHWARZ_HH
│ │ │ │ -
7#include <cassert>
│ │ │ │ -
8#include <algorithm>
│ │ │ │ -
9#include <functional>
│ │ │ │ -
10#include <memory>
│ │ │ │ -
11#include <vector>
│ │ │ │ -
12#include <set>
│ │ │ │ -
13#include <dune/common/dynmatrix.hh>
│ │ │ │ -
14#include <dune/common/sllist.hh>
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_ISTL_SOLVERFACTORY_HH
│ │ │ │ +
7#define DUNE_ISTL_SOLVERFACTORY_HH
│ │ │ │ +
8
│ │ │ │ +
9#include <unordered_map>
│ │ │ │ +
10#include <functional>
│ │ │ │ +
11#include <memory>
│ │ │ │ +
12
│ │ │ │ +
13#include <dune/common/parametertree.hh>
│ │ │ │ +
14#include <dune/common/singleton.hh>
│ │ │ │
15
│ │ │ │ - │ │ │ │ -
17#include "preconditioners.hh"
│ │ │ │ -
18#include "superlu.hh"
│ │ │ │ -
19#include "umfpack.hh"
│ │ │ │ -
20#include "bvector.hh"
│ │ │ │ -
21#include "bcrsmatrix.hh"
│ │ │ │ -
22#include "ilusubdomainsolver.hh"
│ │ │ │ - │ │ │ │ -
24
│ │ │ │ -
25namespace Dune
│ │ │ │ -
26{
│ │ │ │ -
27
│ │ │ │ -
39 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ -
40 class SeqOverlappingSchwarz;
│ │ │ │ -
41
│ │ │ │ -
45 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
47 {
│ │ │ │ -
48 public:
│ │ │ │ - │ │ │ │ -
51
│ │ │ │ -
52 typedef I InitializerList;
│ │ │ │ -
53 typedef typename InitializerList::value_type AtomInitializer;
│ │ │ │ -
54 typedef typename AtomInitializer::Matrix Matrix;
│ │ │ │ -
55 typedef typename Matrix::const_iterator Iter;
│ │ │ │ -
56 typedef typename Matrix::row_type::const_iterator CIter;
│ │ │ │ -
57
│ │ │ │ -
58 typedef S IndexSet;
│ │ │ │ -
59 typedef typename IndexSet::size_type size_type;
│ │ │ │ -
60
│ │ │ │ - │ │ │ │ -
62 const IndexSet& indices,
│ │ │ │ -
63 const subdomain_vector& domains);
│ │ │ │ -
64
│ │ │ │ -
65
│ │ │ │ -
66 void addRowNnz(const Iter& row);
│ │ │ │ -
67
│ │ │ │ -
68 void allocate();
│ │ │ │ -
69
│ │ │ │ -
70 void countEntries(const Iter& row, const CIter& col) const;
│ │ │ │ -
71
│ │ │ │ -
72 void calcColstart() const;
│ │ │ │ -
73
│ │ │ │ -
74 void copyValue(const Iter& row, const CIter& col) const;
│ │ │ │ -
75
│ │ │ │ -
76 void createMatrix() const;
│ │ │ │ -
77 private:
│ │ │ │ -
78 class IndexMap
│ │ │ │ -
79 {
│ │ │ │ -
80 public:
│ │ │ │ -
81 typedef typename S::size_type size_type;
│ │ │ │ -
82 typedef std::map<size_type,size_type> Map;
│ │ │ │ -
83 typedef typename Map::iterator iterator;
│ │ │ │ -
84 typedef typename Map::const_iterator const_iterator;
│ │ │ │ -
85
│ │ │ │ -
86 IndexMap();
│ │ │ │ -
87
│ │ │ │ -
88 void insert(size_type grow);
│ │ │ │ -
89
│ │ │ │ -
90 const_iterator find(size_type grow) const;
│ │ │ │ -
91
│ │ │ │ -
92 iterator find(size_type grow);
│ │ │ │ -
93
│ │ │ │ -
94 iterator begin();
│ │ │ │ -
95
│ │ │ │ -
96 const_iterator begin() const;
│ │ │ │ -
97
│ │ │ │ -
98 iterator end();
│ │ │ │ -
99
│ │ │ │ -
100 const_iterator end() const;
│ │ │ │ -
101
│ │ │ │ -
102 private:
│ │ │ │ -
103 std::map<size_type,size_type> map_;
│ │ │ │ -
104 size_type row;
│ │ │ │ -
105 };
│ │ │ │ -
106
│ │ │ │ -
107
│ │ │ │ -
108 typedef typename InitializerList::iterator InitIterator;
│ │ │ │ -
109 typedef typename IndexSet::const_iterator IndexIteratur;
│ │ │ │ -
110 InitializerList* initializers;
│ │ │ │ -
111 const IndexSet *indices;
│ │ │ │ -
112 mutable std::vector<IndexMap> indexMaps;
│ │ │ │ -
113 const subdomain_vector& domains;
│ │ │ │ -
114 };
│ │ │ │ -
│ │ │ │ -
115
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
120 {};
│ │ │ │ -
│ │ │ │ -
121
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
126 {};
│ │ │ │ -
│ │ │ │ -
127
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
133 {};
│ │ │ │ -
│ │ │ │ -
134
│ │ │ │ -
139 template<class M, class X, class Y>
│ │ │ │ - │ │ │ │ -
141
│ │ │ │ -
142 // Specialization for BCRSMatrix
│ │ │ │ -
143 template<class K, class Al, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
145 {
│ │ │ │ -
146 typedef BCRSMatrix< K, Al> M;
│ │ │ │ -
147 public:
│ │ │ │ -
149 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ │ -
150 typedef typename X::field_type field_type;
│ │ │ │ -
151 typedef typename std::remove_const<M>::type rilu_type;
│ │ │ │ -
153 typedef X domain_type;
│ │ │ │ -
155 typedef Y range_type;
│ │ │ │ -
156 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<K>()))>::rows;
│ │ │ │ -
157
│ │ │ │ -
│ │ │ │ -
162 void apply (DynamicVector<field_type>& v, DynamicVector<field_type>& d)
│ │ │ │ -
163 {
│ │ │ │ -
164 assert(v.size() > 0);
│ │ │ │ -
165 assert(v.size() == d.size());
│ │ │ │ -
166 assert(A.rows() <= v.size());
│ │ │ │ -
167 assert(A.cols() <= v.size());
│ │ │ │ -
168 size_t sz = A.rows();
│ │ │ │ -
169 v.resize(sz);
│ │ │ │ -
170 d.resize(sz);
│ │ │ │ -
171 A.solve(v,d);
│ │ │ │ -
172 v.resize(v.capacity());
│ │ │ │ -
173 d.resize(d.capacity());
│ │ │ │ -
174 }
│ │ │ │ +
16#include "solverregistry.hh"
│ │ │ │ +
17#include <dune/istl/solver.hh>
│ │ │ │ +
18#include <dune/istl/schwarz.hh>
│ │ │ │ + │ │ │ │ +
20
│ │ │ │ +
21namespace Dune{
│ │ │ │ +
26 // Direct solver factory:
│ │ │ │ +
27 template<class M, class X, class Y>
│ │ │ │ +
28 using DirectSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const M&, const ParameterTree&);
│ │ │ │ +
29 template<class M, class X, class Y>
│ │ │ │ +
30 using DirectSolverFactory = Singleton<ParameterizedObjectFactory<DirectSolverSignature<M,X,Y>>>;
│ │ │ │ +
31
│ │ │ │ +
32 // Preconditioner factory:
│ │ │ │ +
33 template<class M, class X, class Y>
│ │ │ │ +
34 using PreconditionerSignature = std::shared_ptr<Preconditioner<X,Y>>(const std::shared_ptr<M>&, const ParameterTree&);
│ │ │ │ +
35 template<class M, class X, class Y>
│ │ │ │ +
36 using PreconditionerFactory = Singleton<ParameterizedObjectFactory<PreconditionerSignature<M,X,Y>>>;
│ │ │ │ +
37
│ │ │ │ +
38 // Iterative solver factory
│ │ │ │ +
39 template<class X, class Y>
│ │ │ │ +
40 using IterativeSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const std::shared_ptr<LinearOperator<X,Y>>&, const std::shared_ptr<ScalarProduct<X>>&, const std::shared_ptr<Preconditioner<X,Y>>, const ParameterTree&);
│ │ │ │ +
41 template<class X, class Y>
│ │ │ │ +
42 using IterativeSolverFactory = Singleton<ParameterizedObjectFactory<IterativeSolverSignature<X,Y>>>;
│ │ │ │ +
43
│ │ │ │ +
44 // initSolverFactories differs in different compilation units, so we have it
│ │ │ │ +
45 // in an anonymous namespace
│ │ │ │ +
46 namespace {
│ │ │ │ +
47
│ │ │ │ +
53 template<class O>
│ │ │ │ +
54 int initSolverFactories(){
│ │ │ │ +
55 using M = typename O::matrix_type;
│ │ │ │ +
56 using X = typename O::range_type;
│ │ │ │ +
57 using Y = typename O::domain_type;
│ │ │ │ +
58 using TL = Dune::TypeList<M,X,Y>;
│ │ │ │ + │ │ │ │ +
60 addRegistryToFactory<TL>(dsfac, DirectSolverTag{});
│ │ │ │ + │ │ │ │ +
62 addRegistryToFactory<TL>(pfac, PreconditionerTag{});
│ │ │ │ +
63 using TLS = Dune::TypeList<X,Y>;
│ │ │ │ + │ │ │ │ +
65 return addRegistryToFactory<TLS>(isfac, IterativeSolverTag{});
│ │ │ │ +
66 }
│ │ │ │ +
77 template<class O, class X, class Y>
│ │ │ │ +
78 [[deprecated("Use method 'initSolverFactories<O>' instead")]]
│ │ │ │ +
79 int initSolverFactories() {
│ │ │ │ +
80 return initSolverFactories<O>();
│ │ │ │ +
81 }
│ │ │ │ +
82 } // end anonymous namespace
│ │ │ │ +
83
│ │ │ │ +
84
│ │ │ │ +
85 template<class O, class Preconditioner>
│ │ │ │ +
│ │ │ │ +
86 std::shared_ptr<Preconditioner> wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ │ +
87 const O&)
│ │ │ │ +
88 {
│ │ │ │ +
89 return prec;
│ │ │ │ +
90 }
│ │ │ │
│ │ │ │ -
175
│ │ │ │ -
183 template<class S>
│ │ │ │ -
│ │ │ │ -
184 void setSubMatrix(const M& BCRS, S& rowset)
│ │ │ │ -
185 {
│ │ │ │ -
186 size_t sz = rowset.size();
│ │ │ │ -
187 A.resize(sz*n,sz*n);
│ │ │ │ -
188 typedef typename S::const_iterator SIter;
│ │ │ │ -
189 size_t r = 0, c = 0;
│ │ │ │ -
190 for(SIter rowIdx = rowset.begin(), rowEnd=rowset.end();
│ │ │ │ -
191 rowIdx!= rowEnd; ++rowIdx, r++)
│ │ │ │ -
192 {
│ │ │ │ -
193 c = 0;
│ │ │ │ -
194 for(SIter colIdx = rowset.begin(), colEnd=rowset.end();
│ │ │ │ -
195 colIdx!= colEnd; ++colIdx, c++)
│ │ │ │ -
196 {
│ │ │ │ -
197 if (BCRS[*rowIdx].find(*colIdx) == BCRS[*rowIdx].end())
│ │ │ │ -
198 continue;
│ │ │ │ -
199 for (size_t i=0; i<n; i++)
│ │ │ │ -
200 {
│ │ │ │ -
201 for (size_t j=0; j<n; j++)
│ │ │ │ -
202 {
│ │ │ │ -
203 A[r*n+i][c*n+j] = Impl::asMatrix(BCRS[*rowIdx][*colIdx])[i][j];
│ │ │ │ -
204 }
│ │ │ │ -
205 }
│ │ │ │ -
206 }
│ │ │ │ -
207 }
│ │ │ │ -
208 }
│ │ │ │ -
│ │ │ │ -
209 private:
│ │ │ │ -
210 DynamicMatrix<K> A;
│ │ │ │ -
211 };
│ │ │ │ +
91
│ │ │ │ +
92 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ │ +
93 std::shared_ptr<Preconditioner>
│ │ │ │ +
│ │ │ │ +
94 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ │ +
95 const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ +
96 {
│ │ │ │ +
97 return std::make_shared<BlockPreconditioner<X,Y,C,Preconditioner> >(prec, op->getCommunication());
│ │ │ │ +
98 }
│ │ │ │
│ │ │ │ -
212
│ │ │ │ -
213 template<typename T, bool tag>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
215 {};
│ │ │ │ +
99
│ │ │ │ +
100 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ │ +
101 std::shared_ptr<Preconditioner>
│ │ │ │ +
│ │ │ │ +
102 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ │ +
103 const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ +
104 {
│ │ │ │ +
105 return std::make_shared<NonoverlappingBlockPreconditioner<C,Preconditioner> >(prec, op->getCommunication());
│ │ │ │ +
106 }
│ │ │ │
│ │ │ │ -
216
│ │ │ │ -
217 template<typename T>
│ │ │ │ - │ │ │ │ -
219
│ │ │ │ -
220 // specialization for DynamicMatrix
│ │ │ │ -
221 template<class K, class Al, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
223 {
│ │ │ │ -
224 public:
│ │ │ │ - │ │ │ │ -
226 typedef typename X::field_type field_type;
│ │ │ │ -
227 typedef Y range_type;
│ │ │ │ -
228 typedef typename range_type::block_type block_type;
│ │ │ │ - │ │ │ │ -
230 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<K>()))>::rows;
│ │ │ │ -
238 OverlappingAssignerHelper(std::size_t maxlength, const BCRSMatrix<K, Al>& mat_, const X& b_, Y& x_);
│ │ │ │ +
107
│ │ │ │ +
108 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
109 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<MatrixAdapter<M,X,Y> >&)
│ │ │ │ +
110 {
│ │ │ │ +
111 return std::make_shared<SeqScalarProduct<X>>();
│ │ │ │ +
112 }
│ │ │ │ +
│ │ │ │ +
113 template<class M, class X, class Y, class C>
│ │ │ │ +
│ │ │ │ +
114 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ +
115 {
│ │ │ │ +
116 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ │ +
117 }
│ │ │ │ +
│ │ │ │ +
118
│ │ │ │ +
119 template<class M, class X, class Y, class C>
│ │ │ │ +
│ │ │ │ +
120 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ +
121 {
│ │ │ │ +
122 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ │ +
123 }
│ │ │ │ +
│ │ │ │ +
124
│ │ │ │ +
144 template<class Operator>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
146 using Domain = typename Operator::domain_type;
│ │ │ │ +
147 using Range = typename Operator::range_type;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
150
│ │ │ │ +
151 template<class O>
│ │ │ │ +
152 using _matrix_type = typename O::matrix_type;
│ │ │ │ +
153 using matrix_type = Std::detected_or_t<int, _matrix_type, Operator>;
│ │ │ │ +
154 static constexpr bool isAssembled = !std::is_same<matrix_type, int>::value;
│ │ │ │ +
155
│ │ │ │ +
156 static const matrix_type* getmat(std::shared_ptr<Operator> op){
│ │ │ │ +
157 std::shared_ptr<AssembledLinearOperator<matrix_type, Domain, Range>> aop
│ │ │ │ +
158 = std::dynamic_pointer_cast<AssembledLinearOperator<matrix_type, Domain, Range>>(op);
│ │ │ │ +
159 if(aop)
│ │ │ │ +
160 return &aop->getmat();
│ │ │ │ +
161 return nullptr;
│ │ │ │ +
162 }
│ │ │ │ +
163
│ │ │ │ +
164 public:
│ │ │ │ +
165
│ │ │ │ +
│ │ │ │ +
168 static std::shared_ptr<Solver> get(std::shared_ptr<Operator> op,
│ │ │ │ +
169 const ParameterTree& config,
│ │ │ │ +
170 std::shared_ptr<Preconditioner> prec = nullptr){
│ │ │ │ +
171 std::string type = config.get<std::string>("type");
│ │ │ │ +
172 std::shared_ptr<Solver> result;
│ │ │ │ +
173 const matrix_type* mat = getmat(op);
│ │ │ │ +
174 if(mat){
│ │ │ │ + │ │ │ │ +
176 if(op->category()!=SolverCategory::sequential){
│ │ │ │ +
177 DUNE_THROW(NotImplemented, "The solver factory does not support parallel direct solvers!");
│ │ │ │ +
178 }
│ │ │ │ +
179 result = DirectSolverFactory<matrix_type, Domain, Range>::instance().create(type, *mat, config);
│ │ │ │ +
180 return result;
│ │ │ │ +
181 }
│ │ │ │ +
182 }
│ │ │ │ +
183 // if no direct solver is found it might be an iterative solver
│ │ │ │ + │ │ │ │ +
185 DUNE_THROW(Dune::InvalidStateException, "Solver not found in the factory.");
│ │ │ │ +
186 }
│ │ │ │ +
187 if(!prec){
│ │ │ │ +
188 const ParameterTree& precConfig = config.sub("preconditioner");
│ │ │ │ +
189 std::string prec_type = precConfig.get<std::string>("type");
│ │ │ │ +
190 prec = PreconditionerFactory<Operator, Domain, Range>::instance().create(prec_type, op, precConfig);
│ │ │ │ +
191 if (prec->category() != op->category() && prec->category() == SolverCategory::sequential)
│ │ │ │ +
192 // try to wrap to a parallel preconditioner
│ │ │ │ +
193 prec = wrapPreconditioner4Parallel(prec, op);
│ │ │ │ +
194 }
│ │ │ │ +
195 std::shared_ptr<ScalarProduct<Domain>> sp = createScalarProduct(op);
│ │ │ │ +
196 result = IterativeSolverFactory<Domain, Range>::instance().create(type, op, sp, prec, config);
│ │ │ │ +
197 return result;
│ │ │ │ +
198 }
│ │ │ │ +
│ │ │ │ +
199
│ │ │ │ +
│ │ │ │ +
203 static std::shared_ptr<Preconditioner> getPreconditioner(std::shared_ptr<Operator> op,
│ │ │ │ +
204 const ParameterTree& config){
│ │ │ │ +
205 const matrix_type* mat = getmat(op);
│ │ │ │ +
206 if(mat){
│ │ │ │ +
207 std::string prec_type = config.get<std::string>("type");
│ │ │ │ +
208 return PreconditionerFactory<Operator, Domain, Range>::instance().create(prec_type, op, config);
│ │ │ │ +
209 }else{
│ │ │ │ +
210 DUNE_THROW(InvalidStateException, "Could not obtain matrix from operator. Please pass in an AssembledLinearOperator.");
│ │ │ │ +
211 }
│ │ │ │ +
212 }
│ │ │ │ +
│ │ │ │ +
213 };
│ │ │ │ +
│ │ │ │ +
214
│ │ │ │ +
225 template<class Operator>
│ │ │ │ +
226 std::shared_ptr<InverseOperator<typename Operator::domain_type,
│ │ │ │ +
│ │ │ │ +
227 typename Operator::range_type>> getSolverFromFactory(std::shared_ptr<Operator> op,
│ │ │ │ +
228 const ParameterTree& config,
│ │ │ │ +
229 std::shared_ptr<Preconditioner<typename Operator::domain_type,
│ │ │ │ +
230 typename Operator::range_type>> prec = nullptr){
│ │ │ │ +
231 return SolverFactory<Operator>::get(op, config, prec);
│ │ │ │ +
232 }
│ │ │ │ +
│ │ │ │ +
233
│ │ │ │ +
237} // end namespace Dune
│ │ │ │ +
238
│ │ │ │
239
│ │ │ │ -
243 inline
│ │ │ │ -
244 void deallocate();
│ │ │ │ -
245
│ │ │ │ -
249 inline
│ │ │ │ -
250 void resetIndexForNextDomain();
│ │ │ │ -
251
│ │ │ │ -
256 inline
│ │ │ │ -
257 DynamicVector<field_type> & lhs();
│ │ │ │ -
258
│ │ │ │ -
263 inline
│ │ │ │ -
264 DynamicVector<field_type> & rhs();
│ │ │ │ -
265
│ │ │ │ -
270 inline
│ │ │ │ -
271 void relaxResult(field_type relax);
│ │ │ │ -
272
│ │ │ │ -
277 void operator()(const size_type& domainIndex);
│ │ │ │ -
278
│ │ │ │ -
286 inline
│ │ │ │ -
287 void assignResult(block_type& res);
│ │ │ │ -
288
│ │ │ │ -
289 private:
│ │ │ │ -
293 const matrix_type* mat;
│ │ │ │ -
295 // we need a pointer, because we have to avoid deep copies
│ │ │ │ -
296 DynamicVector<field_type> * rhs_;
│ │ │ │ -
298 // we need a pointer, because we have to avoid deep copies
│ │ │ │ -
299 DynamicVector<field_type> * lhs_;
│ │ │ │ -
301 const range_type* b;
│ │ │ │ -
303 range_type* x;
│ │ │ │ -
305 std::size_t i;
│ │ │ │ -
307 std::size_t maxlength_;
│ │ │ │ -
308 };
│ │ │ │ -
│ │ │ │ -
309
│ │ │ │ -
310#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
311 template<template<class> class S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
313 {
│ │ │ │ - │ │ │ │ -
315 typedef typename S<BCRSMatrix<T, A>>::range_type range_type;
│ │ │ │ -
316 typedef typename range_type::field_type field_type;
│ │ │ │ -
317 typedef typename range_type::block_type block_type;
│ │ │ │ -
318
│ │ │ │ - │ │ │ │ -
320
│ │ │ │ -
321 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::rows;
│ │ │ │ -
322 static constexpr size_t m = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::cols;
│ │ │ │ -
330 OverlappingAssignerHelper(std::size_t maxlength, const matrix_type& mat,
│ │ │ │ -
331 const range_type& b, range_type& x);
│ │ │ │ -
337 void deallocate();
│ │ │ │ -
338
│ │ │ │ -
339 /*
│ │ │ │ -
340 * @brief Resets the local index to zero.
│ │ │ │ -
341 */
│ │ │ │ -
342 void resetIndexForNextDomain();
│ │ │ │ -
343
│ │ │ │ -
348 field_type* lhs();
│ │ │ │ -
349
│ │ │ │ -
354 field_type* rhs();
│ │ │ │ -
355
│ │ │ │ -
360 void relaxResult(field_type relax);
│ │ │ │ -
361
│ │ │ │ -
366 void operator()(const size_type& domain);
│ │ │ │ -
367
│ │ │ │ -
375 void assignResult(block_type& res);
│ │ │ │ -
376
│ │ │ │ -
377 private:
│ │ │ │ -
381 const matrix_type* mat;
│ │ │ │ -
383 field_type* rhs_;
│ │ │ │ -
385 field_type* lhs_;
│ │ │ │ -
387 const range_type* b;
│ │ │ │ -
389 range_type* x;
│ │ │ │ -
391 std::size_t i;
│ │ │ │ -
393 std::size_t maxlength_;
│ │ │ │ -
394 };
│ │ │ │ -
│ │ │ │ -
395
│ │ │ │ -
396#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
397
│ │ │ │ -
398 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
400 {
│ │ │ │ -
401 public:
│ │ │ │ -
402 typedef M matrix_type;
│ │ │ │ -
403
│ │ │ │ -
404 typedef typename Y::field_type field_type;
│ │ │ │ -
405
│ │ │ │ -
406 typedef typename Y::block_type block_type;
│ │ │ │ -
407
│ │ │ │ -
408 typedef typename matrix_type::size_type size_type;
│ │ │ │ -
416 OverlappingAssignerILUBase(std::size_t maxlength, const M& mat,
│ │ │ │ -
417 const Y& b, X& x);
│ │ │ │ -
423 void deallocate();
│ │ │ │ -
424
│ │ │ │ - │ │ │ │ -
429
│ │ │ │ -
434 X& lhs();
│ │ │ │ -
435
│ │ │ │ -
440 Y& rhs();
│ │ │ │ -
441
│ │ │ │ -
446 void relaxResult(field_type relax);
│ │ │ │ -
447
│ │ │ │ -
452 void operator()(const size_type& domain);
│ │ │ │ -
453
│ │ │ │ -
461 void assignResult(block_type& res);
│ │ │ │ -
462
│ │ │ │ -
463 private:
│ │ │ │ -
467 const M* mat;
│ │ │ │ -
469 X* lhs_;
│ │ │ │ -
471 Y* rhs_;
│ │ │ │ -
473 const Y* b;
│ │ │ │ -
475 X* x;
│ │ │ │ -
477 size_type i;
│ │ │ │ -
478 };
│ │ │ │ -
│ │ │ │ -
479
│ │ │ │ -
480 // specialization for ILU0
│ │ │ │ -
481 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
483 : public OverlappingAssignerILUBase<M,X,Y>
│ │ │ │ -
484 {
│ │ │ │ -
485 public:
│ │ │ │ -
│ │ │ │ -
493 OverlappingAssignerHelper(std::size_t maxlength, const M& mat,
│ │ │ │ -
494 const Y& b, X& x)
│ │ │ │ -
495 : OverlappingAssignerILUBase<M,X,Y>(maxlength, mat,b,x)
│ │ │ │ -
496 {}
│ │ │ │ -
│ │ │ │ -
497 };
│ │ │ │ -
│ │ │ │ -
498
│ │ │ │ -
499 // specialization for ILUN
│ │ │ │ -
500 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
502 : public OverlappingAssignerILUBase<M,X,Y>
│ │ │ │ -
503 {
│ │ │ │ -
504 public:
│ │ │ │ -
│ │ │ │ -
512 OverlappingAssignerHelper(std::size_t maxlength, const M& mat,
│ │ │ │ -
513 const Y& b, X& x)
│ │ │ │ -
514 : OverlappingAssignerILUBase<M,X,Y>(maxlength, mat,b,x)
│ │ │ │ -
515 {}
│ │ │ │ -
│ │ │ │ -
516 };
│ │ │ │ -
│ │ │ │ -
517
│ │ │ │ -
518 template<typename S, typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
520 {};
│ │ │ │ -
│ │ │ │ -
521
│ │ │ │ -
522 template<typename S, typename T, typename A>
│ │ │ │ -
│ │ │ │ -
523 struct AdditiveAdder<S, BlockVector<T,A> >
│ │ │ │ -
524 {
│ │ │ │ -
525 typedef typename A::size_type size_type;
│ │ │ │ -
526 typedef typename std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::field_type field_type;
│ │ │ │ - │ │ │ │ -
528 OverlappingAssigner<S>& assigner, const field_type& relax_);
│ │ │ │ -
529 void operator()(const size_type& domain);
│ │ │ │ -
530 void axpy();
│ │ │ │ -
531 static constexpr size_t n = std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::dimension;
│ │ │ │ -
532
│ │ │ │ -
533 private:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
536 OverlappingAssigner<S>* assigner;
│ │ │ │ -
537 field_type relax;
│ │ │ │ -
538 };
│ │ │ │ -
│ │ │ │ -
539
│ │ │ │ -
540 template<typename S,typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
542 {};
│ │ │ │ -
│ │ │ │ -
543
│ │ │ │ -
544 template<typename S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
546 {
│ │ │ │ -
547 typedef typename A::size_type size_type;
│ │ │ │ -
548 typedef typename std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::field_type field_type;
│ │ │ │ - │ │ │ │ -
550 OverlappingAssigner<S>& assigner_, const field_type& relax_);
│ │ │ │ -
551 void operator()(const size_type& domain);
│ │ │ │ -
552 void axpy();
│ │ │ │ -
553 static constexpr size_t n = std::decay_t<decltype(Impl::asVector(std::declval<T>()))>::dimension;
│ │ │ │ -
554
│ │ │ │ -
555 private:
│ │ │ │ - │ │ │ │ -
557 OverlappingAssigner<S>* assigner;
│ │ │ │ -
558 field_type relax;
│ │ │ │ -
559 };
│ │ │ │ -
│ │ │ │ -
560
│ │ │ │ -
570 template<typename T, class X, class S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
572 {};
│ │ │ │ -
│ │ │ │ -
573
│ │ │ │ -
574 template<class X, class S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
576 {
│ │ │ │ - │ │ │ │ -
578 };
│ │ │ │ -
│ │ │ │ -
579
│ │ │ │ -
580 template<class X, class S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
582 {
│ │ │ │ - │ │ │ │ -
584 };
│ │ │ │ -
│ │ │ │ -
585
│ │ │ │ -
586 template<class X, class S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
588 {
│ │ │ │ - │ │ │ │ -
590 };
│ │ │ │ -
│ │ │ │ -
591
│ │ │ │ -
603 template<typename T1, typename T2, bool forward>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
605 {
│ │ │ │ -
606 typedef T1 solver_vector;
│ │ │ │ -
607 typedef typename solver_vector::iterator solver_iterator;
│ │ │ │ - │ │ │ │ -
609 typedef typename subdomain_vector::const_iterator domain_iterator;
│ │ │ │ -
610
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
612 {
│ │ │ │ -
613 return sv.begin();
│ │ │ │ -
614 }
│ │ │ │ -
│ │ │ │ -
615
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
617 {
│ │ │ │ -
618 return sv.end();
│ │ │ │ -
619 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
621 {
│ │ │ │ -
622 return sv.begin();
│ │ │ │ -
623 }
│ │ │ │ -
│ │ │ │ -
624
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
626 {
│ │ │ │ -
627 return sv.end();
│ │ │ │ -
628 }
│ │ │ │ -
│ │ │ │ -
629 };
│ │ │ │ -
│ │ │ │ -
630
│ │ │ │ -
631 template<typename T1, typename T2>
│ │ │ │ -
│ │ │ │ -
632 struct IteratorDirectionSelector<T1,T2,false>
│ │ │ │ -
633 {
│ │ │ │ -
634 typedef T1 solver_vector;
│ │ │ │ -
635 typedef typename solver_vector::reverse_iterator solver_iterator;
│ │ │ │ - │ │ │ │ -
637 typedef typename subdomain_vector::const_reverse_iterator domain_iterator;
│ │ │ │ -
638
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
640 {
│ │ │ │ -
641 return sv.rbegin();
│ │ │ │ -
642 }
│ │ │ │ -
│ │ │ │ -
643
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
645 {
│ │ │ │ -
646 return sv.rend();
│ │ │ │ -
647 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
649 {
│ │ │ │ -
650 return sv.rbegin();
│ │ │ │ -
651 }
│ │ │ │ -
│ │ │ │ -
652
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
654 {
│ │ │ │ -
655 return sv.rend();
│ │ │ │ -
656 }
│ │ │ │ -
│ │ │ │ -
657 };
│ │ │ │ -
│ │ │ │ -
658
│ │ │ │ -
667 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
669 {
│ │ │ │ -
670 typedef T smoother;
│ │ │ │ -
671 typedef typename smoother::range_type range_type;
│ │ │ │ -
672
│ │ │ │ -
│ │ │ │ -
673 static void apply(smoother& sm, range_type& v, const range_type& b)
│ │ │ │ -
674 {
│ │ │ │ -
675 sm.template apply<true>(v, b);
│ │ │ │ -
676 }
│ │ │ │ -
│ │ │ │ -
677 };
│ │ │ │ -
│ │ │ │ -
678
│ │ │ │ -
679 template<class M, class X, class TD, class TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
681 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
684
│ │ │ │ -
│ │ │ │ -
685 static void apply(smoother& sm, range_type& v, const range_type& b)
│ │ │ │ -
686 {
│ │ │ │ -
687 sm.template apply<true>(v, b);
│ │ │ │ -
688 sm.template apply<false>(v, b);
│ │ │ │ -
689 }
│ │ │ │ -
│ │ │ │ -
690 };
│ │ │ │ -
│ │ │ │ -
691
│ │ │ │ -
692 template<class T, bool tag>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
694 {};
│ │ │ │ -
│ │ │ │ -
695
│ │ │ │ -
696 template<class T>
│ │ │ │ - │ │ │ │ -
698
│ │ │ │ -
699 template<class K, class Al, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
701 {
│ │ │ │ - │ │ │ │ -
703 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<K>()))>::rows;
│ │ │ │ -
704 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ -
705 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, const matrix_type& mat,
│ │ │ │ -
706 Solvers& solvers, const SubDomains& domains,
│ │ │ │ -
707 bool onTheFly);
│ │ │ │ -
708 };
│ │ │ │ -
│ │ │ │ -
709
│ │ │ │ -
710 template<template<class> class S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
712 {
│ │ │ │ - │ │ │ │ -
714 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::rows;
│ │ │ │ -
715 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ -
716 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, const matrix_type& mat,
│ │ │ │ -
717 Solvers& solvers, const SubDomains& domains,
│ │ │ │ -
718 bool onTheFly);
│ │ │ │ -
719 };
│ │ │ │ -
│ │ │ │ -
720
│ │ │ │ -
721 template<class M,class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
723 {
│ │ │ │ -
724 typedef M matrix_type;
│ │ │ │ -
725 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ -
726 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, const matrix_type& mat,
│ │ │ │ -
727 Solvers& solvers, const SubDomains& domains,
│ │ │ │ -
728 bool onTheFly);
│ │ │ │ -
729 };
│ │ │ │ -
│ │ │ │ -
730
│ │ │ │ -
731 template<class M,class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
734 {};
│ │ │ │ -
│ │ │ │ -
735
│ │ │ │ -
736 template<class M,class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
739 {};
│ │ │ │ -
│ │ │ │ -
740
│ │ │ │ -
751 template<class M, class X, class TM=AdditiveSchwarzMode,
│ │ │ │ -
752 class TD=ILU0SubdomainSolver<M,X,X>, class TA=std::allocator<X> >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
754 : public Preconditioner<X,X>
│ │ │ │ -
755 {
│ │ │ │ -
756 public:
│ │ │ │ -
760 typedef M matrix_type;
│ │ │ │ -
761
│ │ │ │ -
765 typedef X domain_type;
│ │ │ │ -
766
│ │ │ │ -
770 typedef X range_type;
│ │ │ │ -
771
│ │ │ │ -
778 typedef TM Mode;
│ │ │ │ -
779
│ │ │ │ -
783 typedef typename X::field_type field_type;
│ │ │ │ -
784
│ │ │ │ -
786 typedef typename matrix_type::size_type size_type;
│ │ │ │ -
787
│ │ │ │ -
789 typedef TA allocator;
│ │ │ │ -
790
│ │ │ │ -
792 typedef std::set<size_type, std::less<size_type>,
│ │ │ │ -
793 typename std::allocator_traits<TA>::template rebind_alloc<size_type> >
│ │ │ │ - │ │ │ │ -
795
│ │ │ │ -
797 typedef std::vector<subdomain_type, typename std::allocator_traits<TA>::template rebind_alloc<subdomain_type> > subdomain_vector;
│ │ │ │ -
798
│ │ │ │ - │ │ │ │ -
801
│ │ │ │ -
803 typedef std::vector<subdomain_list, typename std::allocator_traits<TA>::template rebind_alloc<subdomain_list> > rowtodomain_vector;
│ │ │ │ -
804
│ │ │ │ -
806 typedef TD slu;
│ │ │ │ -
807
│ │ │ │ -
809 typedef std::vector<slu, typename std::allocator_traits<TA>::template rebind_alloc<slu> > slu_vector;
│ │ │ │ -
810
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
825 field_type relaxationFactor=1, bool onTheFly_=true);
│ │ │ │ -
826
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
839 field_type relaxationFactor=1, bool onTheFly_=true);
│ │ │ │ -
840
│ │ │ │ -
│ │ │ │ -
846 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] X& b)
│ │ │ │ -
847 {}
│ │ │ │ -
│ │ │ │ -
848
│ │ │ │ -
│ │ │ │ -
854 virtual void apply (X& v, const X& d);
│ │ │ │ -
855
│ │ │ │ -
│ │ │ │ -
861 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ -
862 {}
│ │ │ │ -
│ │ │ │ -
863
│ │ │ │ -
864 template<bool forward>
│ │ │ │ -
│ │ │ │ -
865 void apply(X& v, const X& d);
│ │ │ │ -
866
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
869 {
│ │ │ │ - │ │ │ │ -
871 }
│ │ │ │ -
│ │ │ │ -
872
│ │ │ │ -
873 private:
│ │ │ │ -
874 const M& mat;
│ │ │ │ -
875 slu_vector solvers;
│ │ │ │ -
876 subdomain_vector subDomains;
│ │ │ │ -
877 field_type relax;
│ │ │ │ -
878
│ │ │ │ -
879 typename M::size_type maxlength;
│ │ │ │ -
880
│ │ │ │ -
881 bool onTheFly;
│ │ │ │ -
882 };
│ │ │ │ -
883
│ │ │ │ -
884
│ │ │ │ -
885
│ │ │ │ -
886 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
888 const IndexSet& idx,
│ │ │ │ -
889 const subdomain_vector& domains_)
│ │ │ │ -
890 : initializers(&il), indices(&idx), indexMaps(il.size()), domains(domains_)
│ │ │ │ -
891 {}
│ │ │ │ -
│ │ │ │ -
892
│ │ │ │ -
893
│ │ │ │ -
894 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
896 {
│ │ │ │ -
897 typedef typename IndexSet::value_type::const_iterator iterator;
│ │ │ │ -
898 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices)[row.index()].end(); ++domain) {
│ │ │ │ -
899 (*initializers)[*domain].addRowNnz(row, domains[*domain]);
│ │ │ │ -
900 indexMaps[*domain].insert(row.index());
│ │ │ │ -
901 }
│ │ │ │ -
902 }
│ │ │ │ -
│ │ │ │ -
903
│ │ │ │ -
904 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
906 {
│ │ │ │ -
907 for(auto&& i: *initializers)
│ │ │ │ -
908 i.allocateMatrixStorage();
│ │ │ │ -
909 for(auto&& i: *initializers)
│ │ │ │ -
910 i.allocateMarker();
│ │ │ │ -
911 }
│ │ │ │ -
│ │ │ │ -
912
│ │ │ │ -
913 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
915 {
│ │ │ │ -
916 typedef typename IndexSet::value_type::const_iterator iterator;
│ │ │ │ -
917 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices)[row.index()].end(); ++domain) {
│ │ │ │ -
918 typename std::map<size_type,size_type>::const_iterator v = indexMaps[*domain].find(col.index());
│ │ │ │ -
919 if(v!= indexMaps[*domain].end()) {
│ │ │ │ -
920 (*initializers)[*domain].countEntries(indexMaps[*domain].find(col.index())->second);
│ │ │ │ -
921 }
│ │ │ │ -
922 }
│ │ │ │ -
923 }
│ │ │ │ -
│ │ │ │ -
924
│ │ │ │ -
925 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
927 {
│ │ │ │ -
928 for(auto&& i : *initializers)
│ │ │ │ -
929 i.calcColstart();
│ │ │ │ -
930 }
│ │ │ │ -
│ │ │ │ -
931
│ │ │ │ -
932 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
934 {
│ │ │ │ -
935 typedef typename IndexSet::value_type::const_iterator iterator;
│ │ │ │ -
936 for(iterator domain=(*indices)[row.index()].begin(); domain!= (*indices)[row.index()].end(); ++domain) {
│ │ │ │ -
937 typename std::map<size_type,size_type>::const_iterator v = indexMaps[*domain].find(col.index());
│ │ │ │ -
938 if(v!= indexMaps[*domain].end()) {
│ │ │ │ -
939 assert(indexMaps[*domain].end()!=indexMaps[*domain].find(row.index()));
│ │ │ │ -
940 (*initializers)[*domain].copyValue(col, indexMaps[*domain].find(row.index())->second,
│ │ │ │ -
941 v->second);
│ │ │ │ -
942 }
│ │ │ │ -
943 }
│ │ │ │ -
944 }
│ │ │ │ -
│ │ │ │ -
945
│ │ │ │ -
946 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
948 {
│ │ │ │ -
949 std::vector<IndexMap>().swap(indexMaps);
│ │ │ │ -
950 for(auto&& i: *initializers)
│ │ │ │ -
951 i.createMatrix();
│ │ │ │ -
952 }
│ │ │ │ -
│ │ │ │ -
953
│ │ │ │ -
954 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
956 : row(0)
│ │ │ │ -
957 {}
│ │ │ │ -
│ │ │ │ -
958
│ │ │ │ -
959 template<class I, class S, class D>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
961 {
│ │ │ │ -
962 assert(map_.find(grow)==map_.end());
│ │ │ │ -
963 map_.insert(std::make_pair(grow, row++));
│ │ │ │ -
964 }
│ │ │ │ -
│ │ │ │ -
965
│ │ │ │ -
966 template<class I, class S, class D>
│ │ │ │ -
967 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
969 {
│ │ │ │ -
970 return map_.find(grow);
│ │ │ │ -
971 }
│ │ │ │ -
│ │ │ │ -
972
│ │ │ │ -
973 template<class I, class S, class D>
│ │ │ │ -
974 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
976 {
│ │ │ │ -
977 return map_.find(grow);
│ │ │ │ -
978 }
│ │ │ │ -
│ │ │ │ -
979
│ │ │ │ -
980 template<class I, class S, class D>
│ │ │ │ -
981 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
983 {
│ │ │ │ -
984 return map_.end();
│ │ │ │ -
985 }
│ │ │ │ -
│ │ │ │ -
986
│ │ │ │ -
987 template<class I, class S, class D>
│ │ │ │ -
988 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
990 {
│ │ │ │ -
991 return map_.end();
│ │ │ │ -
992 }
│ │ │ │ -
│ │ │ │ -
993
│ │ │ │ -
994 template<class I, class S, class D>
│ │ │ │ -
995 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
997 {
│ │ │ │ -
998 return map_.begin();
│ │ │ │ -
999 }
│ │ │ │ -
│ │ │ │ -
1000
│ │ │ │ -
1001 template<class I, class S, class D>
│ │ │ │ -
1002 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1004 {
│ │ │ │ -
1005 return map_.begin();
│ │ │ │ -
1006 }
│ │ │ │ -
│ │ │ │ -
1007
│ │ │ │ -
1008 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1010 field_type relaxationFactor, bool fly)
│ │ │ │ -
1011 : mat(mat_), relax(relaxationFactor), onTheFly(fly)
│ │ │ │ -
1012 {
│ │ │ │ -
1013 typedef typename rowtodomain_vector::const_iterator RowDomainIterator;
│ │ │ │ -
1014 typedef typename subdomain_list::const_iterator DomainIterator;
│ │ │ │ -
1015#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1016 assert(rowToDomain.size()==mat.N());
│ │ │ │ -
1017 assert(rowToDomain.size()==mat.M());
│ │ │ │ -
1018
│ │ │ │ -
1019 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter)
│ │ │ │ -
1020 assert(iter->size()>0);
│ │ │ │ -
1021
│ │ │ │ -
1022#endif
│ │ │ │ -
1023 // calculate the number of domains
│ │ │ │ -
1024 size_type domains=0;
│ │ │ │ -
1025 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter)
│ │ │ │ -
1026 for(DomainIterator d=iter->begin(); d != iter->end(); ++d)
│ │ │ │ -
1027 domains=std::max(domains, *d);
│ │ │ │ -
1028 ++domains;
│ │ │ │ -
1029
│ │ │ │ -
1030 solvers.resize(domains);
│ │ │ │ -
1031 subDomains.resize(domains);
│ │ │ │ -
1032
│ │ │ │ -
1033 // initialize subdomains to row mapping from row to subdomain mapping
│ │ │ │ -
1034 size_type row=0;
│ │ │ │ -
1035 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter, ++row)
│ │ │ │ -
1036 for(DomainIterator d=iter->begin(); d != iter->end(); ++d)
│ │ │ │ -
1037 subDomains[*d].insert(row);
│ │ │ │ -
1038
│ │ │ │ -
1039#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1040 size_type i=0;
│ │ │ │ -
1041 typedef typename subdomain_vector::const_iterator iterator;
│ │ │ │ -
1042 for(iterator iter=subDomains.begin(); iter != subDomains.end(); ++iter) {
│ │ │ │ -
1043 typedef typename subdomain_type::const_iterator entry_iterator;
│ │ │ │ -
1044 Dune::dvverb<<"domain "<<i++<<":";
│ │ │ │ -
1045 for(entry_iterator entry = iter->begin(); entry != iter->end(); ++entry) {
│ │ │ │ -
1046 Dune::dvverb<<" "<<*entry;
│ │ │ │ -
1047 }
│ │ │ │ -
1048 Dune::dvverb<<std::endl;
│ │ │ │ -
1049 }
│ │ │ │ -
1050#endif
│ │ │ │ - │ │ │ │ -
1052 ::assembleLocalProblems(rowToDomain, mat, solvers, subDomains, onTheFly);
│ │ │ │ -
1053 }
│ │ │ │ -
│ │ │ │ -
1054
│ │ │ │ -
1055 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1057 const subdomain_vector& sd,
│ │ │ │ -
1058 field_type relaxationFactor,
│ │ │ │ -
1059 bool fly)
│ │ │ │ -
1060 : mat(mat_), solvers(sd.size()), subDomains(sd), relax(relaxationFactor),
│ │ │ │ -
1061 onTheFly(fly)
│ │ │ │ -
1062 {
│ │ │ │ -
1063 typedef typename subdomain_vector::const_iterator DomainIterator;
│ │ │ │ -
1064
│ │ │ │ -
1065#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1066 size_type i=0;
│ │ │ │ -
1067
│ │ │ │ -
1068 for(DomainIterator d=sd.begin(); d != sd.end(); ++d,++i) {
│ │ │ │ -
1069 //std::cout<<i<<": "<<d->size()<<std::endl;
│ │ │ │ -
1070 assert(d->size()>0);
│ │ │ │ -
1071 typedef typename DomainIterator::value_type::const_iterator entry_iterator;
│ │ │ │ -
1072 Dune::dvverb<<"domain "<<i<<":";
│ │ │ │ -
1073 for(entry_iterator entry = d->begin(); entry != d->end(); ++entry) {
│ │ │ │ -
1074 Dune::dvverb<<" "<<*entry;
│ │ │ │ -
1075 }
│ │ │ │ -
1076 Dune::dvverb<<std::endl;
│ │ │ │ -
1077 }
│ │ │ │ -
1078
│ │ │ │ -
1079#endif
│ │ │ │ -
1080
│ │ │ │ -
1081 // Create a row to subdomain mapping
│ │ │ │ - │ │ │ │ -
1083
│ │ │ │ - │ │ │ │ -
1085
│ │ │ │ -
1086 for(DomainIterator domain=sd.begin(); domain != sd.end(); ++domain, ++domainId) {
│ │ │ │ -
1087 typedef typename subdomain_type::const_iterator iterator;
│ │ │ │ -
1088 for(iterator row=domain->begin(); row != domain->end(); ++row)
│ │ │ │ -
1089 rowToDomain[*row].push_back(domainId);
│ │ │ │ -
1090 }
│ │ │ │ -
1091
│ │ │ │ - │ │ │ │ -
1093 ::assembleLocalProblems(rowToDomain, mat, solvers, subDomains, onTheFly);
│ │ │ │ -
1094 }
│ │ │ │ -
│ │ │ │ -
1095
│ │ │ │ -
1102 template<class M>
│ │ │ │ - │ │ │ │ -
1104
│ │ │ │ -
1105 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1107 {
│ │ │ │ -
1108 static constexpr size_t n = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::rows;
│ │ │ │ -
1109 static constexpr size_t m = std::decay_t<decltype(Impl::asMatrix(std::declval<T>()))>::cols;
│ │ │ │ -
1110 template<class Domain>
│ │ │ │ -
│ │ │ │ -
1111 static int size(const Domain & d)
│ │ │ │ -
1112 {
│ │ │ │ -
1113 assert(n==m);
│ │ │ │ -
1114 return m*d.size();
│ │ │ │ -
1115 }
│ │ │ │ -
│ │ │ │ -
1116 };
│ │ │ │ -
│ │ │ │ -
1117
│ │ │ │ -
1118 template<class K, class Al, class X, class Y>
│ │ │ │ -
1119 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ -
1120 std::size_t
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1122 assembleLocalProblems([[maybe_unused]] const RowToDomain& rowToDomain,
│ │ │ │ -
1123 [[maybe_unused]] const matrix_type& mat,
│ │ │ │ -
1124 [[maybe_unused]] Solvers& solvers,
│ │ │ │ -
1125 const SubDomains& subDomains,
│ │ │ │ -
1126 [[maybe_unused]] bool onTheFly)
│ │ │ │ -
1127 {
│ │ │ │ -
1128 typedef typename SubDomains::const_iterator DomainIterator;
│ │ │ │ -
1129 std::size_t maxlength = 0;
│ │ │ │ -
1130
│ │ │ │ -
1131 assert(onTheFly);
│ │ │ │ -
1132
│ │ │ │ -
1133 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
│ │ │ │ -
1134 maxlength=std::max(maxlength, domain->size());
│ │ │ │ -
1135 maxlength*=n;
│ │ │ │ -
1136
│ │ │ │ -
1137 return maxlength;
│ │ │ │ -
1138 }
│ │ │ │ -
│ │ │ │ -
1139
│ │ │ │ -
1140#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
1141 template<template<class> class S, typename T, typename A>
│ │ │ │ -
1142 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ -
│ │ │ │ -
1143 std::size_t SeqOverlappingSchwarzAssemblerHelper<S<BCRSMatrix<T,A>>,true>::assembleLocalProblems(const RowToDomain& rowToDomain,
│ │ │ │ -
1144 const matrix_type& mat,
│ │ │ │ -
1145 Solvers& solvers,
│ │ │ │ -
1146 const SubDomains& subDomains,
│ │ │ │ -
1147 bool onTheFly)
│ │ │ │ -
1148 {
│ │ │ │ -
1149 typedef typename S<BCRSMatrix<T,A>>::MatrixInitializer MatrixInitializer;
│ │ │ │ -
1150 typedef typename std::vector<MatrixInitializer>::iterator InitializerIterator;
│ │ │ │ -
1151 typedef typename SubDomains::const_iterator DomainIterator;
│ │ │ │ -
1152 typedef typename Solvers::iterator SolverIterator;
│ │ │ │ -
1153 std::size_t maxlength = 0;
│ │ │ │ -
1154
│ │ │ │ -
1155 if(onTheFly) {
│ │ │ │ -
1156 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
│ │ │ │ -
1157 maxlength=std::max(maxlength, domain->size());
│ │ │ │ -
1158 maxlength*=Impl::asMatrix(*mat[0].begin()).N();
│ │ │ │ -
1159 }else{
│ │ │ │ -
1160 // initialize the initializers
│ │ │ │ -
1161 DomainIterator domain=subDomains.begin();
│ │ │ │ -
1162
│ │ │ │ -
1163 // Create the initializers list.
│ │ │ │ -
1164 std::vector<MatrixInitializer> initializers(subDomains.size());
│ │ │ │ -
1165
│ │ │ │ -
1166 SolverIterator solver=solvers.begin();
│ │ │ │ -
1167 for(InitializerIterator initializer=initializers.begin(); initializer!=initializers.end();
│ │ │ │ -
1168 ++initializer, ++solver, ++domain) {
│ │ │ │ -
1169 solver->getInternalMatrix().N_=SeqOverlappingSchwarzDomainSize<matrix_type>::size(*domain);
│ │ │ │ -
1170 solver->getInternalMatrix().M_=SeqOverlappingSchwarzDomainSize<matrix_type>::size(*domain);
│ │ │ │ -
1171 //solver->setVerbosity(true);
│ │ │ │ -
1172 *initializer=MatrixInitializer(solver->getInternalMatrix());
│ │ │ │ -
1173 }
│ │ │ │ -
1174
│ │ │ │ -
1175 // Set up the supermatrices according to the subdomains
│ │ │ │ - │ │ │ │ -
1177 RowToDomain, SubDomains> Initializer;
│ │ │ │ -
1178
│ │ │ │ -
1179 Initializer initializer(initializers, rowToDomain, subDomains);
│ │ │ │ -
1180 copyToBCCSMatrix(initializer, mat);
│ │ │ │ -
1181
│ │ │ │ -
1182 // Calculate the LU decompositions
│ │ │ │ -
1183 for(auto&& s: solvers)
│ │ │ │ -
1184 s.decompose();
│ │ │ │ -
1185 for (SolverIterator solverIt = solvers.begin(); solverIt != solvers.end(); ++solverIt)
│ │ │ │ -
1186 {
│ │ │ │ -
1187 assert(solverIt->getInternalMatrix().N() == solverIt->getInternalMatrix().M());
│ │ │ │ -
1188 maxlength = std::max(maxlength, solverIt->getInternalMatrix().N());
│ │ │ │ -
1189 }
│ │ │ │ -
1190 }
│ │ │ │ -
1191 return maxlength;
│ │ │ │ -
1192 }
│ │ │ │ -
│ │ │ │ -
1193
│ │ │ │ -
1194#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
1195
│ │ │ │ -
1196 template<class M,class X,class Y>
│ │ │ │ -
1197 template<class RowToDomain, class Solvers, class SubDomains>
│ │ │ │ -
│ │ │ │ -
1198 std::size_t SeqOverlappingSchwarzAssemblerILUBase<M,X,Y>::assembleLocalProblems([[maybe_unused]] const RowToDomain& rowToDomain,
│ │ │ │ -
1199 const matrix_type& mat,
│ │ │ │ -
1200 Solvers& solvers,
│ │ │ │ -
1201 const SubDomains& subDomains,
│ │ │ │ -
1202 bool onTheFly)
│ │ │ │ -
1203 {
│ │ │ │ -
1204 typedef typename SubDomains::const_iterator DomainIterator;
│ │ │ │ -
1205 typedef typename Solvers::iterator SolverIterator;
│ │ │ │ -
1206 std::size_t maxlength = 0;
│ │ │ │ -
1207
│ │ │ │ -
1208 if(onTheFly) {
│ │ │ │ -
1209 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
│ │ │ │ -
1210 maxlength=std::max(maxlength, domain->size());
│ │ │ │ -
1211 }else{
│ │ │ │ -
1212 // initialize the solvers of the local prolems.
│ │ │ │ -
1213 SolverIterator solver=solvers.begin();
│ │ │ │ -
1214 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end();
│ │ │ │ -
1215 ++domain, ++solver) {
│ │ │ │ -
1216 solver->setSubMatrix(mat, *domain);
│ │ │ │ -
1217 maxlength=std::max(maxlength, domain->size());
│ │ │ │ -
1218 }
│ │ │ │ -
1219 }
│ │ │ │ -
1220
│ │ │ │ -
1221 return maxlength;
│ │ │ │ -
1222
│ │ │ │ -
1223 }
│ │ │ │ -
│ │ │ │ -
1224
│ │ │ │ -
1225
│ │ │ │ -
1226 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1228 {
│ │ │ │ - │ │ │ │ -
1230 }
│ │ │ │ -
│ │ │ │ -
1231
│ │ │ │ -
1232 template<class M, class X, class TM, class TD, class TA>
│ │ │ │ -
1233 template<bool forward>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1235 {
│ │ │ │ -
1236 typedef slu_vector solver_vector;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
1239 domain_iterator;
│ │ │ │ -
1240
│ │ │ │ -
1241 OverlappingAssigner<TD> assigner(maxlength, mat, b, x);
│ │ │ │ -
1242
│ │ │ │ - │ │ │ │ - │ │ │ │ -
1245 X v(x); // temporary for the update
│ │ │ │ -
1246 v=0;
│ │ │ │ -
1247
│ │ │ │ -
1248 typedef typename AdderSelector<TM,X,TD >::Adder Adder;
│ │ │ │ -
1249 Adder adder(v, x, assigner, relax);
│ │ │ │ -
1250
│ │ │ │ - │ │ │ │ -
1252 //Copy rhs to C-array for SuperLU
│ │ │ │ -
1253 std::for_each(domain->begin(), domain->end(), assigner);
│ │ │ │ -
1254 assigner.resetIndexForNextDomain();
│ │ │ │ -
1255 if(onTheFly) {
│ │ │ │ -
1256 // Create the subdomain solver
│ │ │ │ -
1257 slu sdsolver;
│ │ │ │ -
1258 sdsolver.setSubMatrix(mat, *domain);
│ │ │ │ -
1259 // Apply
│ │ │ │ -
1260 sdsolver.apply(assigner.lhs(), assigner.rhs());
│ │ │ │ -
1261 }else{
│ │ │ │ -
1262 solver->apply(assigner.lhs(), assigner.rhs());
│ │ │ │ -
1263 ++solver;
│ │ │ │ -
1264 }
│ │ │ │ -
1265
│ │ │ │ -
1266 //Add relaxed correction to from SuperLU to v
│ │ │ │ -
1267 std::for_each(domain->begin(), domain->end(), adder);
│ │ │ │ -
1268 assigner.resetIndexForNextDomain();
│ │ │ │ -
1269
│ │ │ │ -
1270 }
│ │ │ │ -
1271
│ │ │ │ -
1272 adder.axpy();
│ │ │ │ -
1273 assigner.deallocate();
│ │ │ │ -
1274 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
1275
│ │ │ │ -
1276 template<class K, class Al, class X, class Y>
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1278 ::OverlappingAssignerHelper(std::size_t maxlength, const BCRSMatrix<K, Al>& mat_,
│ │ │ │ -
1279 const X& b_, Y& x_) :
│ │ │ │ -
1280 mat(&mat_),
│ │ │ │ -
1281 rhs_( new DynamicVector<field_type>(maxlength, 42) ),
│ │ │ │ -
1282 lhs_( new DynamicVector<field_type>(maxlength, -42) ),
│ │ │ │ -
1283 b(&b_),
│ │ │ │ -
1284 x(&x_),
│ │ │ │ -
1285 i(0),
│ │ │ │ -
1286 maxlength_(maxlength)
│ │ │ │ -
1287 {}
│ │ │ │ -
│ │ │ │ -
1288
│ │ │ │ -
1289 template<class K, class Al, class X, class Y>
│ │ │ │ -
1290 void
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1292 ::deallocate()
│ │ │ │ -
1293 {
│ │ │ │ -
1294 delete rhs_;
│ │ │ │ -
1295 delete lhs_;
│ │ │ │ -
1296 }
│ │ │ │ -
│ │ │ │ -
1297
│ │ │ │ -
1298 template<class K, class Al, class X, class Y>
│ │ │ │ -
1299 void
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1301 ::resetIndexForNextDomain()
│ │ │ │ -
1302 {
│ │ │ │ -
1303 i=0;
│ │ │ │ -
1304 }
│ │ │ │ -
│ │ │ │ -
1305
│ │ │ │ -
1306 template<class K, class Al, class X, class Y>
│ │ │ │ -
1307 DynamicVector<typename X::field_type> &
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1309 ::lhs()
│ │ │ │ -
1310 {
│ │ │ │ -
1311 return *lhs_;
│ │ │ │ -
1312 }
│ │ │ │ -
│ │ │ │ -
1313
│ │ │ │ -
1314 template<class K, class Al, class X, class Y>
│ │ │ │ -
1315 DynamicVector<typename X::field_type> &
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1317 ::rhs()
│ │ │ │ -
1318 {
│ │ │ │ -
1319 return *rhs_;
│ │ │ │ -
1320 }
│ │ │ │ -
│ │ │ │ -
1321
│ │ │ │ -
1322 template<class K, class Al, class X, class Y>
│ │ │ │ -
1323 void
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1325 ::relaxResult(field_type relax)
│ │ │ │ -
1326 {
│ │ │ │ -
1327 lhs() *= relax;
│ │ │ │ -
1328 }
│ │ │ │ -
│ │ │ │ -
1329
│ │ │ │ -
1330 template<class K, class Al, class X, class Y>
│ │ │ │ -
1331 void
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1333 ::operator()(const size_type& domainIndex)
│ │ │ │ -
1334 {
│ │ │ │ -
1335 lhs() = 0.0;
│ │ │ │ -
1336#if 0
│ │ │ │ -
1337 //assign right hand side of current domainindex block
│ │ │ │ -
1338 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ -
1339 assert(i<maxlength_);
│ │ │ │ -
1340 rhs()[i]=(*b)[domainIndex][j];
│ │ │ │ -
1341 }
│ │ │ │ -
1342
│ │ │ │ -
1343 // loop over all Matrix row entries and calculate defect.
│ │ │ │ -
1344 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ -
1345
│ │ │ │ -
1346 // calculate defect for current row index block
│ │ │ │ -
1347 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ -
1348 block_type tmp(0.0);
│ │ │ │ -
1349 (*col).mv((*x)[col.index()], tmp);
│ │ │ │ -
1350 i-=n;
│ │ │ │ -
1351 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ -
1352 assert(i<maxlength_);
│ │ │ │ -
1353 rhs()[i]-=tmp[j];
│ │ │ │ -
1354 }
│ │ │ │ -
1355 }
│ │ │ │ -
1356#else
│ │ │ │ -
1357 //assign right hand side of current domainindex block
│ │ │ │ -
1358 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ -
1359 assert(i<maxlength_);
│ │ │ │ -
1360 rhs()[i]=Impl::asVector((*b)[domainIndex])[j];
│ │ │ │ -
1361
│ │ │ │ -
1362 // loop over all Matrix row entries and calculate defect.
│ │ │ │ -
1363 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ -
1364
│ │ │ │ -
1365 // calculate defect for current row index block
│ │ │ │ -
1366 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ -
1367 for(size_type k=0; k<n; ++k) {
│ │ │ │ -
1368 rhs()[i]-=Impl::asMatrix(*col)[j][k] * Impl::asVector((*x)[col.index()])[k];
│ │ │ │ -
1369 }
│ │ │ │ -
1370 }
│ │ │ │ -
1371 }
│ │ │ │ -
1372#endif
│ │ │ │ -
1373 }
│ │ │ │ -
│ │ │ │ -
1374
│ │ │ │ -
1375 template<class K, class Al, class X, class Y>
│ │ │ │ -
1376 void
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1378 ::assignResult(block_type& res)
│ │ │ │ -
1379 {
│ │ │ │ -
1380 // assign the result of the local solve to the global vector
│ │ │ │ -
1381 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ -
1382 assert(i<maxlength_);
│ │ │ │ -
1383 Impl::asVector(res)[j]+=lhs()[i];
│ │ │ │ -
1384 }
│ │ │ │ -
1385 }
│ │ │ │ -
│ │ │ │ -
1386
│ │ │ │ -
1387#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
1388
│ │ │ │ -
1389 template<template<class> class S, typename T, typename A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1391 ::OverlappingAssignerHelper(std::size_t maxlength,
│ │ │ │ -
1392 const BCRSMatrix<T,A>& mat_,
│ │ │ │ -
1393 const range_type& b_,
│ │ │ │ -
1394 range_type& x_)
│ │ │ │ -
1395 : mat(&mat_),
│ │ │ │ -
1396 b(&b_),
│ │ │ │ -
1397 x(&x_), i(0), maxlength_(maxlength)
│ │ │ │ -
1398 {
│ │ │ │ -
1399 rhs_ = new field_type[maxlength];
│ │ │ │ -
1400 lhs_ = new field_type[maxlength];
│ │ │ │ -
1401
│ │ │ │ -
1402 }
│ │ │ │ -
│ │ │ │ -
1403
│ │ │ │ -
1404 template<template<class> class S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1406 {
│ │ │ │ -
1407 delete[] rhs_;
│ │ │ │ -
1408 delete[] lhs_;
│ │ │ │ -
1409 }
│ │ │ │ -
│ │ │ │ -
1410
│ │ │ │ -
1411 template<template<class> class S, typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1412 void OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::operator()(const size_type& domainIndex)
│ │ │ │ -
1413 {
│ │ │ │ -
1414 //assign right hand side of current domainindex block
│ │ │ │ -
1415 // rhs is an array of doubles!
│ │ │ │ -
1416 // rhs[starti] = b[domainindex]
│ │ │ │ -
1417 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ -
1418 assert(i<maxlength_);
│ │ │ │ -
1419 rhs_[i]=Impl::asVector((*b)[domainIndex])[j];
│ │ │ │ -
1420 }
│ │ │ │ -
1421
│ │ │ │ -
1422
│ │ │ │ -
1423 // loop over all Matrix row entries and calculate defect.
│ │ │ │ -
1424 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ -
1425
│ │ │ │ -
1426 // calculate defect for current row index block
│ │ │ │ -
1427 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ -
1428 block_type tmp;
│ │ │ │ -
1429 Impl::asMatrix(*col).mv((*x)[col.index()], tmp);
│ │ │ │ -
1430 i-=n;
│ │ │ │ -
1431 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ -
1432 assert(i<maxlength_);
│ │ │ │ -
1433 rhs_[i]-=Impl::asVector(tmp)[j];
│ │ │ │ -
1434 }
│ │ │ │ -
1435
│ │ │ │ -
1436 }
│ │ │ │ -
1437
│ │ │ │ -
1438 }
│ │ │ │ -
│ │ │ │ -
1439
│ │ │ │ -
1440 template<template<class> class S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1442 {
│ │ │ │ -
1443 for(size_type j=i+n; i<j; ++i) {
│ │ │ │ -
1444 assert(i<maxlength_);
│ │ │ │ -
1445 lhs_[i]*=relax;
│ │ │ │ -
1446 }
│ │ │ │ -
1447 i-=n;
│ │ │ │ -
1448 }
│ │ │ │ -
│ │ │ │ -
1449
│ │ │ │ -
1450 template<template<class> class S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1452 {
│ │ │ │ -
1453 // assign the result of the local solve to the global vector
│ │ │ │ -
1454 for(size_type j=0; j<n; ++j, ++i) {
│ │ │ │ -
1455 assert(i<maxlength_);
│ │ │ │ -
1456 Impl::asVector(res)[j]+=lhs_[i];
│ │ │ │ -
1457 }
│ │ │ │ -
1458 }
│ │ │ │ -
│ │ │ │ -
1459
│ │ │ │ -
1460 template<template<class> class S, typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1461 void OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::resetIndexForNextDomain()
│ │ │ │ -
1462 {
│ │ │ │ -
1463 i=0;
│ │ │ │ -
1464 }
│ │ │ │ -
│ │ │ │ -
1465
│ │ │ │ -
1466 template<template<class> class S, typename T, typename A>
│ │ │ │ -
1467 typename OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::field_type*
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1469 {
│ │ │ │ -
1470 return lhs_;
│ │ │ │ -
1471 }
│ │ │ │ -
│ │ │ │ -
1472
│ │ │ │ -
1473 template<template<class> class S, typename T, typename A>
│ │ │ │ -
1474 typename OverlappingAssignerHelper<S<BCRSMatrix<T,A>>,true>::field_type*
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1476 {
│ │ │ │ -
1477 return rhs_;
│ │ │ │ -
1478 }
│ │ │ │ -
│ │ │ │ -
1479
│ │ │ │ -
1480#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
1481
│ │ │ │ -
1482 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1484 const M& mat_,
│ │ │ │ -
1485 const Y& b_,
│ │ │ │ -
1486 X& x_)
│ │ │ │ -
1487 : mat(&mat_),
│ │ │ │ -
1488 b(&b_),
│ │ │ │ -
1489 x(&x_), i(0)
│ │ │ │ -
1490 {
│ │ │ │ -
1491 rhs_= new Y(maxlength);
│ │ │ │ -
1492 lhs_ = new X(maxlength);
│ │ │ │ -
1493 }
│ │ │ │ -
│ │ │ │ -
1494
│ │ │ │ -
1495 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1497 {
│ │ │ │ -
1498 delete rhs_;
│ │ │ │ -
1499 delete lhs_;
│ │ │ │ -
1500 }
│ │ │ │ -
│ │ │ │ -
1501
│ │ │ │ -
1502 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1504 {
│ │ │ │ -
1505 (*rhs_)[i]=(*b)[domainIndex];
│ │ │ │ -
1506
│ │ │ │ -
1507 // loop over all Matrix row entries and calculate defect.
│ │ │ │ -
1508 typedef typename matrix_type::ConstColIterator col_iterator;
│ │ │ │ -
1509
│ │ │ │ -
1510 // calculate defect for current row index block
│ │ │ │ -
1511 for(col_iterator col=(*mat)[domainIndex].begin(); col!=(*mat)[domainIndex].end(); ++col) {
│ │ │ │ -
1512 Impl::asMatrix(*col).mmv((*x)[col.index()], (*rhs_)[i]);
│ │ │ │ -
1513 }
│ │ │ │ -
1514 // Goto next local index
│ │ │ │ -
1515 ++i;
│ │ │ │ -
1516 }
│ │ │ │ -
│ │ │ │ -
1517
│ │ │ │ -
1518 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1520 {
│ │ │ │ -
1521 (*lhs_)[i]*=relax;
│ │ │ │ -
1522 }
│ │ │ │ -
│ │ │ │ -
1523
│ │ │ │ -
1524 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1526 {
│ │ │ │ -
1527 res+=(*lhs_)[i++];
│ │ │ │ -
1528 }
│ │ │ │ -
│ │ │ │ -
1529
│ │ │ │ -
1530 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1532 {
│ │ │ │ -
1533 return *lhs_;
│ │ │ │ -
1534 }
│ │ │ │ -
│ │ │ │ -
1535
│ │ │ │ -
1536 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1538 {
│ │ │ │ -
1539 return *rhs_;
│ │ │ │ -
1540 }
│ │ │ │ -
│ │ │ │ -
1541
│ │ │ │ -
1542 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1544 {
│ │ │ │ -
1545 i=0;
│ │ │ │ -
1546 }
│ │ │ │ -
│ │ │ │ -
1547
│ │ │ │ -
1548 template<typename S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1550 BlockVector<T,A>& x_,
│ │ │ │ -
1551 OverlappingAssigner<S>& assigner_,
│ │ │ │ -
1552 const field_type& relax_)
│ │ │ │ -
1553 : v(&v_), x(&x_), assigner(&assigner_), relax(relax_)
│ │ │ │ -
1554 {}
│ │ │ │ -
│ │ │ │ -
1555
│ │ │ │ -
1556 template<typename S, typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1557 void AdditiveAdder<S,BlockVector<T,A> >::operator()(const size_type& domainIndex)
│ │ │ │ -
1558 {
│ │ │ │ -
1559 // add the result of the local solve to the current update
│ │ │ │ -
1560 assigner->assignResult((*v)[domainIndex]);
│ │ │ │ -
1561 }
│ │ │ │ -
│ │ │ │ -
1562
│ │ │ │ -
1563
│ │ │ │ -
1564 template<typename S, typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1566 {
│ │ │ │ -
1567 // relax the update and add it to the current guess.
│ │ │ │ -
1568 x->axpy(relax,*v);
│ │ │ │ -
1569 }
│ │ │ │ -
│ │ │ │ -
1570
│ │ │ │ -
1571
│ │ │ │ -
1572 template<typename S, typename T, typename A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
1574 ::MultiplicativeAdder([[maybe_unused]] BlockVector<T,A>& v_,
│ │ │ │ -
1575 BlockVector<T,A>& x_,
│ │ │ │ -
1576 OverlappingAssigner<S>& assigner_, const field_type& relax_)
│ │ │ │ -
1577 : x(&x_), assigner(&assigner_), relax(relax_)
│ │ │ │ -
1578 {}
│ │ │ │ -
│ │ │ │ -
1579
│ │ │ │ -
1580
│ │ │ │ -
1581 template<typename S,typename T, typename A>
│ │ │ │ -
│ │ │ │ -
1582 void MultiplicativeAdder<S,BlockVector<T,A> >::operator()(const size_type& domainIndex)
│ │ │ │ -
1583 {
│ │ │ │ -
1584 // add the result of the local solve to the current guess
│ │ │ │ -
1585 assigner->relaxResult(relax);
│ │ │ │ -
1586 assigner->assignResult((*x)[domainIndex]);
│ │ │ │ -
1587 }
│ │ │ │ -
│ │ │ │ -
1588
│ │ │ │ -
1589
│ │ │ │ -
1590 template<typename S,typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1592 {
│ │ │ │ -
1593 // nothing to do, as the corrections already relaxed and added in operator()
│ │ │ │ -
1594 }
│ │ │ │ -
│ │ │ │ -
1595
│ │ │ │ -
1596
│ │ │ │ -
1598}
│ │ │ │ -
1599
│ │ │ │ -
1600#endif
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ -
Templates characterizing the type of a solver.
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ -
Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.
│ │ │ │ -
Classes for using UMFPack with ISTL matrices.
│ │ │ │ - │ │ │ │ -
Define general preconditioner interface.
│ │ │ │ -
Classes for using SuperLU with ISTL matrices.
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
240#endif
│ │ │ │ + │ │ │ │ + │ │ │ │ +
Define general, extensible interface for inverse operators.
│ │ │ │ + │ │ │ │
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
void addRowNnz(const Iter &row)
Definition overlappingschwarz.hh:895
│ │ │ │ -
void apply(X &v, const X &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition overlappingschwarz.hh:1234
│ │ │ │ -
X & lhs()
Get the local left hand side.
Definition overlappingschwarz.hh:1531
│ │ │ │ -
void calcColstart() const
Definition overlappingschwarz.hh:926
│ │ │ │ -
Y & rhs()
Get the local right hand side.
Definition overlappingschwarz.hh:1537
│ │ │ │ -
iterator end()
Definition overlappingschwarz.hh:989
│ │ │ │ -
void resetIndexForNextDomain()
Resets the local index to zero.
Definition overlappingschwarz.hh:1543
│ │ │ │ -
void copyValue(const Iter &row, const CIter &col) const
Definition overlappingschwarz.hh:933
│ │ │ │ -
void createMatrix() const
Definition overlappingschwarz.hh:947
│ │ │ │ -
iterator begin()
Definition overlappingschwarz.hh:1003
│ │ │ │ -
OverlappingSchwarzInitializer(InitializerList &il, const IndexSet &indices, const subdomain_vector &domains)
Definition overlappingschwarz.hh:887
│ │ │ │ -
IndexMap()
Definition overlappingschwarz.hh:955
│ │ │ │ -
virtual void apply(X &v, const X &d)
Apply the precondtioner.
Definition overlappingschwarz.hh:1227
│ │ │ │ -
OverlappingAssignerILUBase(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition overlappingschwarz.hh:1483
│ │ │ │ -
const_iterator find(size_type grow) const
Definition overlappingschwarz.hh:968
│ │ │ │ -
void operator()(const size_type &domain)
calculate one entry of the local defect.
Definition overlappingschwarz.hh:1503
│ │ │ │ -
SeqOverlappingSchwarz(const matrix_type &mat, const subdomain_vector &subDomains, field_type relaxationFactor=1, bool onTheFly_=true)
Construct the overlapping Schwarz method.
Definition overlappingschwarz.hh:1056
│ │ │ │ -
void allocate()
Definition overlappingschwarz.hh:905
│ │ │ │ -
void deallocate()
Deallocates memory of the local vector.
Definition overlappingschwarz.hh:1496
│ │ │ │ -
void insert(size_type grow)
Definition overlappingschwarz.hh:960
│ │ │ │ -
void countEntries(const Iter &row, const CIter &col) const
Definition overlappingschwarz.hh:914
│ │ │ │ -
static std::size_t assembleLocalProblems(const RowToDomain &rowToDomain, const matrix_type &mat, Solvers &solvers, const SubDomains &domains, bool onTheFly)
Definition overlappingschwarz.hh:1198
│ │ │ │ -
void relaxResult(field_type relax)
relax the result.
Definition overlappingschwarz.hh:1519
│ │ │ │ -
void assignResult(block_type &res)
Assigns the block to the current local index. At the same time the local defect is calculated for the...
Definition overlappingschwarz.hh:1525
│ │ │ │ -
SeqOverlappingSchwarz(const matrix_type &mat, const rowtodomain_vector &rowToDomain, field_type relaxationFactor=1, bool onTheFly_=true)
Definition overlappingschwarz.hh:1009
│ │ │ │ +
Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > > PreconditionerFactory
Definition solverfactory.hh:36
│ │ │ │ +
Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > > DirectSolverFactory
Definition solverfactory.hh:30
│ │ │ │ +
std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &) IterativeSolverSignature
Definition solverfactory.hh:40
│ │ │ │ +
std::shared_ptr< Preconditioner > wrapPreconditioner4Parallel(const std::shared_ptr< Preconditioner > &prec, const O &)
Definition solverfactory.hh:86
│ │ │ │ +
std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &) DirectSolverSignature
Definition solverfactory.hh:28
│ │ │ │ +
std::shared_ptr< InverseOperator< typename Operator::domain_type, typename Operator::range_type > > getSolverFromFactory(std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > prec=nullptr)
Instantiates an InverseOperator from an Operator and a configuration given as a ParameterTree.
Definition solverfactory.hh:227
│ │ │ │ +
Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > > IterativeSolverFactory
Definition solverfactory.hh:42
│ │ │ │ +
std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const ParameterTree &) PreconditionerSignature
Definition solverfactory.hh:34
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Initializer for SuperLU Matrices representing the subdomains.
Definition overlappingschwarz.hh:47
│ │ │ │ -
Matrix::row_type::const_iterator CIter
Definition overlappingschwarz.hh:56
│ │ │ │ -
S IndexSet
Definition overlappingschwarz.hh:58
│ │ │ │ -
Matrix::const_iterator Iter
Definition overlappingschwarz.hh:55
│ │ │ │ -
IndexSet::size_type size_type
Definition overlappingschwarz.hh:59
│ │ │ │ -
I InitializerList
Definition overlappingschwarz.hh:52
│ │ │ │ -
AtomInitializer::Matrix Matrix
Definition overlappingschwarz.hh:54
│ │ │ │ -
InitializerList::value_type AtomInitializer
Definition overlappingschwarz.hh:53
│ │ │ │ -
D subdomain_vector
The vector type containing the subdomain to row index mapping.
Definition overlappingschwarz.hh:50
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:681
│ │ │ │ -
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ -
row_type::ConstIterator ConstColIterator
Const iterator to the entries of a row.
Definition bcrsmatrix.hh:741
│ │ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ -
Exact subdomain solver using ILU(p) with appropriate p.
Definition ilusubdomainsolver.hh:78
│ │ │ │ -
Definition ilusubdomainsolver.hh:111
│ │ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition overlappingschwarz.hh:783
│ │ │ │ -
SLList< size_type, typename std::allocator_traits< TA >::template rebind_alloc< size_type > > subdomain_list
The type for the row to subdomain mapping.
Definition overlappingschwarz.hh:800
│ │ │ │ -
std::vector< slu, typename std::allocator_traits< TA >::template rebind_alloc< slu > > slu_vector
The vector type containing subdomain solvers.
Definition overlappingschwarz.hh:809
│ │ │ │ -
M matrix_type
The type of the matrix to precondition.
Definition overlappingschwarz.hh:760
│ │ │ │ -
TM Mode
The mode (additive or multiplicative) of the Schwarz method.
Definition overlappingschwarz.hh:778
│ │ │ │ -
X range_type
The range type of the preconditioner.
Definition overlappingschwarz.hh:770
│ │ │ │ -
std::set< size_type, std::less< size_type >, typename std::allocator_traits< TA >::template rebind_alloc< size_type > > subdomain_type
The type for the subdomain to row index mapping.
Definition overlappingschwarz.hh:794
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition overlappingschwarz.hh:765
│ │ │ │ -
TD slu
The type for the subdomain solver in use.
Definition overlappingschwarz.hh:806
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition overlappingschwarz.hh:868
│ │ │ │ -
virtual void pre(X &x, X &b)
Prepare the preconditioner.
Definition overlappingschwarz.hh:846
│ │ │ │ -
virtual void post(X &x)
Postprocess the preconditioner.
Definition overlappingschwarz.hh:861
│ │ │ │ -
TA allocator
The allocator to use.
Definition overlappingschwarz.hh:789
│ │ │ │ -
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
│ │ │ │ -
std::vector< subdomain_list, typename std::allocator_traits< TA >::template rebind_alloc< subdomain_list > > rowtodomain_vector
The vector type containing the row index to subdomain mapping.
Definition overlappingschwarz.hh:803
│ │ │ │ -
matrix_type::size_type size_type
The return type of the size method.
Definition overlappingschwarz.hh:786
│ │ │ │ -
Definition overlappingschwarz.hh:694
│ │ │ │ -
Tag that the tells the Schwarz method to be additive.
Definition overlappingschwarz.hh:120
│ │ │ │ -
Tag that tells the Schwarz method to be multiplicative.
Definition overlappingschwarz.hh:126
│ │ │ │ -
Tag that tells the Schwarz method to be multiplicative and symmetric.
Definition overlappingschwarz.hh:133
│ │ │ │ -
Exact subdomain solver using Dune::DynamicMatrix<T>::solve.
Definition overlappingschwarz.hh:140
│ │ │ │ -
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition overlappingschwarz.hh:149
│ │ │ │ -
X::field_type field_type
Definition overlappingschwarz.hh:150
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition overlappingschwarz.hh:153
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition overlappingschwarz.hh:155
│ │ │ │ -
void setSubMatrix(const M &BCRS, S &rowset)
Set the data of the local problem.
Definition overlappingschwarz.hh:184
│ │ │ │ -
void apply(DynamicVector< field_type > &v, DynamicVector< field_type > &d)
Apply the subdomain solver.
Definition overlappingschwarz.hh:162
│ │ │ │ -
std::remove_const< M >::type rilu_type
Definition overlappingschwarz.hh:151
│ │ │ │ -
Definition overlappingschwarz.hh:215
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
S< BCRSMatrix< T, A > >::range_type range_type
Definition overlappingschwarz.hh:315
│ │ │ │ -
range_type::block_type block_type
Definition overlappingschwarz.hh:317
│ │ │ │ -
range_type::field_type field_type
Definition overlappingschwarz.hh:316
│ │ │ │ -
matrix_type::size_type size_type
Definition overlappingschwarz.hh:319
│ │ │ │ -
BCRSMatrix< T, A > matrix_type
Definition overlappingschwarz.hh:314
│ │ │ │ -
Definition overlappingschwarz.hh:400
│ │ │ │ -
matrix_type::size_type size_type
Definition overlappingschwarz.hh:408
│ │ │ │ -
Y::field_type field_type
Definition overlappingschwarz.hh:404
│ │ │ │ -
Y::block_type block_type
Definition overlappingschwarz.hh:406
│ │ │ │ -
M matrix_type
Definition overlappingschwarz.hh:402
│ │ │ │ -
OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition overlappingschwarz.hh:493
│ │ │ │ -
OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition overlappingschwarz.hh:512
│ │ │ │ -
Definition overlappingschwarz.hh:520
│ │ │ │ -
std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type field_type
Definition overlappingschwarz.hh:526
│ │ │ │ -
A::size_type size_type
Definition overlappingschwarz.hh:525
│ │ │ │ -
Definition overlappingschwarz.hh:542
│ │ │ │ -
A::size_type size_type
Definition overlappingschwarz.hh:547
│ │ │ │ -
std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type field_type
Definition overlappingschwarz.hh:548
│ │ │ │ -
template meta program for choosing how to add the correction.
Definition overlappingschwarz.hh:572
│ │ │ │ -
AdditiveAdder< S, X > Adder
Definition overlappingschwarz.hh:577
│ │ │ │ -
MultiplicativeAdder< S, X > Adder
Definition overlappingschwarz.hh:583
│ │ │ │ -
MultiplicativeAdder< S, X > Adder
Definition overlappingschwarz.hh:589
│ │ │ │ -
Helper template meta program for application of overlapping Schwarz.
Definition overlappingschwarz.hh:605
│ │ │ │ -
static solver_iterator begin(solver_vector &sv)
Definition overlappingschwarz.hh:611
│ │ │ │ -
solver_vector::iterator solver_iterator
Definition overlappingschwarz.hh:607
│ │ │ │ -
static domain_iterator end(const subdomain_vector &sv)
Definition overlappingschwarz.hh:625
│ │ │ │ -
subdomain_vector::const_iterator domain_iterator
Definition overlappingschwarz.hh:609
│ │ │ │ -
T1 solver_vector
Definition overlappingschwarz.hh:606
│ │ │ │ -
static domain_iterator begin(const subdomain_vector &sv)
Definition overlappingschwarz.hh:620
│ │ │ │ -
T2 subdomain_vector
Definition overlappingschwarz.hh:608
│ │ │ │ -
static solver_iterator end(solver_vector &sv)
Definition overlappingschwarz.hh:616
│ │ │ │ -
T2 subdomain_vector
Definition overlappingschwarz.hh:636
│ │ │ │ -
static solver_iterator end(solver_vector &sv)
Definition overlappingschwarz.hh:644
│ │ │ │ -
solver_vector::reverse_iterator solver_iterator
Definition overlappingschwarz.hh:635
│ │ │ │ -
subdomain_vector::const_reverse_iterator domain_iterator
Definition overlappingschwarz.hh:637
│ │ │ │ -
static solver_iterator begin(solver_vector &sv)
Definition overlappingschwarz.hh:639
│ │ │ │ -
T1 solver_vector
Definition overlappingschwarz.hh:634
│ │ │ │ -
static domain_iterator begin(const subdomain_vector &sv)
Definition overlappingschwarz.hh:648
│ │ │ │ -
static domain_iterator end(const subdomain_vector &sv)
Definition overlappingschwarz.hh:653
│ │ │ │ -
Helper template meta program for application of overlapping Schwarz.
Definition overlappingschwarz.hh:669
│ │ │ │ -
smoother::range_type range_type
Definition overlappingschwarz.hh:671
│ │ │ │ -
T smoother
Definition overlappingschwarz.hh:670
│ │ │ │ -
static void apply(smoother &sm, range_type &v, const range_type &b)
Definition overlappingschwarz.hh:673
│ │ │ │ -
static void apply(smoother &sm, range_type &v, const range_type &b)
Definition overlappingschwarz.hh:685
│ │ │ │ -
SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > smoother
Definition overlappingschwarz.hh:682
│ │ │ │ - │ │ │ │ - │ │ │ │ -
BCRSMatrix< T, A > matrix_type
Definition overlappingschwarz.hh:713
│ │ │ │ -
Definition overlappingschwarz.hh:723
│ │ │ │ -
M matrix_type
Definition overlappingschwarz.hh:724
│ │ │ │ -
Definition overlappingschwarz.hh:1103
│ │ │ │ -
static int size(const Domain &d)
Definition overlappingschwarz.hh:1111
│ │ │ │ +
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
│ │ │ │ +
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │ +
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ +
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ │
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ + │ │ │ │
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ +
Factory to assembly solvers configured by a ParameterTree.
Definition solverfactory.hh:145
│ │ │ │ +
static std::shared_ptr< Solver > get(std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner > prec=nullptr)
get a solver from the factory
Definition solverfactory.hh:168
│ │ │ │ +
static std::shared_ptr< Preconditioner > getPreconditioner(std::shared_ptr< Operator > op, const ParameterTree &config)
Construct a Preconditioner for a given Operator.
Definition solverfactory.hh:203
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1878 +1,303 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -overlappingschwarz.hh │ │ │ │ │ +solverfactory.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 (C) 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_OVERLAPPINGSCHWARZ_HH │ │ │ │ │ -6#define DUNE_ISTL_OVERLAPPINGSCHWARZ_HH │ │ │ │ │ -7#include │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_ISTL_SOLVERFACTORY_HH │ │ │ │ │ +7#define DUNE_ISTL_SOLVERFACTORY_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ 15 │ │ │ │ │ -16#include <_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> │ │ │ │ │ -17#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ │ -18#include "_s_u_p_e_r_l_u_._h_h" │ │ │ │ │ -19#include "_u_m_f_p_a_c_k_._h_h" │ │ │ │ │ -20#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -21#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ │ -22#include "_i_l_u_s_u_b_d_o_m_a_i_n_s_o_l_v_e_r_._h_h" │ │ │ │ │ -23#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ -24 │ │ │ │ │ -25namespace _D_u_n_e │ │ │ │ │ -26{ │ │ │ │ │ -27 │ │ │ │ │ -39 template │ │ │ │ │ -40 class SeqOverlappingSchwarz; │ │ │ │ │ -41 │ │ │ │ │ -45 template │ │ │ │ │ -_4_6 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 │ │ │ │ │ -47 { │ │ │ │ │ -48 public: │ │ │ │ │ -_5_0 typedef D _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ -51 │ │ │ │ │ -_5_2 typedef I _I_n_i_t_i_a_l_i_z_e_r_L_i_s_t; │ │ │ │ │ -_5_3 typedef typename InitializerList::value_type _A_t_o_m_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ │ -_5_4 typedef typename AtomInitializer::Matrix _M_a_t_r_i_x; │ │ │ │ │ -_5_5 typedef typename Matrix::const_iterator _I_t_e_r; │ │ │ │ │ -_5_6 typedef typename Matrix::row_type::const_iterator _C_I_t_e_r; │ │ │ │ │ -57 │ │ │ │ │ -_5_8 typedef S _I_n_d_e_x_S_e_t; │ │ │ │ │ -_5_9 typedef typename IndexSet::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -60 │ │ │ │ │ -61 _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(_I_n_i_t_i_a_l_i_z_e_r_L_i_s_t& il, │ │ │ │ │ -62 const _I_n_d_e_x_S_e_t& indices, │ │ │ │ │ -63 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& domains); │ │ │ │ │ -64 │ │ │ │ │ -65 │ │ │ │ │ -66 void _a_d_d_R_o_w_N_n_z(const _I_t_e_r& row); │ │ │ │ │ -67 │ │ │ │ │ -68 void _a_l_l_o_c_a_t_e(); │ │ │ │ │ -69 │ │ │ │ │ -70 void _c_o_u_n_t_E_n_t_r_i_e_s(const _I_t_e_r& row, const _C_I_t_e_r& _c_o_l) const; │ │ │ │ │ -71 │ │ │ │ │ -72 void _c_a_l_c_C_o_l_s_t_a_r_t() const; │ │ │ │ │ -73 │ │ │ │ │ -74 void _c_o_p_y_V_a_l_u_e(const _I_t_e_r& row, const _C_I_t_e_r& _c_o_l) const; │ │ │ │ │ -75 │ │ │ │ │ -76 void _c_r_e_a_t_e_M_a_t_r_i_x() const; │ │ │ │ │ -77 private: │ │ │ │ │ -78 class IndexMap │ │ │ │ │ -79 { │ │ │ │ │ -80 public: │ │ │ │ │ -81 typedef typename S::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -82 typedef std::map Map; │ │ │ │ │ -83 typedef typename Map::iterator iterator; │ │ │ │ │ -84 typedef typename Map::const_iterator const_iterator; │ │ │ │ │ -85 │ │ │ │ │ -86 _I_n_d_e_x_M_a_p(); │ │ │ │ │ -87 │ │ │ │ │ -88 void _i_n_s_e_r_t(_s_i_z_e___t_y_p_e grow); │ │ │ │ │ -89 │ │ │ │ │ -90 const_iterator _f_i_n_d(_s_i_z_e___t_y_p_e grow) const; │ │ │ │ │ +16#include "_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h" │ │ │ │ │ +17#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ +20 │ │ │ │ │ +21namespace _D_u_n_e{ │ │ │ │ │ +26 // Direct solver factory: │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 using _D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ │ +M&, const ParameterTree&); │ │ │ │ │ +29 template │ │ │ │ │ +_3_0 using _D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ │ +Singleton>>; │ │ │ │ │ +31 │ │ │ │ │ +32 // Preconditioner factory: │ │ │ │ │ +33 template │ │ │ │ │ +_3_4 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ │ +std::shared_ptr&, const ParameterTree&); │ │ │ │ │ +35 template │ │ │ │ │ +_3_6 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = │ │ │ │ │ +Singleton>>; │ │ │ │ │ +37 │ │ │ │ │ +38 // Iterative solver factory │ │ │ │ │ +39 template │ │ │ │ │ +_4_0 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ │ +std::shared_ptr>&, const std:: │ │ │ │ │ +shared_ptr>&, const std::shared_ptr>, │ │ │ │ │ +const ParameterTree&); │ │ │ │ │ +41 template │ │ │ │ │ +_4_2 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ │ +Singleton>>; │ │ │ │ │ +43 │ │ │ │ │ +44 // initSolverFactories differs in different compilation units, so we have it │ │ │ │ │ +45 // in an anonymous namespace │ │ │ │ │ +46 namespace { │ │ │ │ │ +47 │ │ │ │ │ +53 template │ │ │ │ │ +54 int initSolverFactories(){ │ │ │ │ │ +55 using M = typename O::matrix_type; │ │ │ │ │ +56 using X = typename O::range_type; │ │ │ │ │ +57 using Y = typename O::domain_type; │ │ │ │ │ +58 using TL = Dune::TypeList; │ │ │ │ │ +59 auto& dsfac=_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_M_,_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ │ +60 addRegistryToFactory(dsfac, DirectSolverTag{}); │ │ │ │ │ +61 auto& pfac=_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_,_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ │ +62 addRegistryToFactory(pfac, PreconditionerTag{}); │ │ │ │ │ +63 using TLS = Dune::TypeList; │ │ │ │ │ +64 auto& isfac=_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ │ +65 return addRegistryToFactory(isfac, IterativeSolverTag{}); │ │ │ │ │ +66 } │ │ │ │ │ +77 template │ │ │ │ │ +78 [[deprecated("Use method 'initSolverFactories' instead")]] │ │ │ │ │ +79 int initSolverFactories() { │ │ │ │ │ +80 return initSolverFactories(); │ │ │ │ │ +81 } │ │ │ │ │ +82 } // end anonymous namespace │ │ │ │ │ +83 │ │ │ │ │ +84 │ │ │ │ │ +85 template │ │ │ │ │ +_8_6 std::shared_ptr _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std:: │ │ │ │ │ +shared_ptr& prec, │ │ │ │ │ +87 const O&) │ │ │ │ │ +88 { │ │ │ │ │ +89 return prec; │ │ │ │ │ +90 } │ │ │ │ │ 91 │ │ │ │ │ -92 iterator _f_i_n_d(_s_i_z_e___t_y_p_e grow); │ │ │ │ │ -93 │ │ │ │ │ -94 iterator _b_e_g_i_n(); │ │ │ │ │ -95 │ │ │ │ │ -96 const_iterator _b_e_g_i_n() const; │ │ │ │ │ -97 │ │ │ │ │ -98 iterator _e_n_d(); │ │ │ │ │ +92 template │ │ │ │ │ +93 std::shared_ptr │ │ │ │ │ +_9_4 _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std::shared_ptr& prec, │ │ │ │ │ +95 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) │ │ │ │ │ +96 { │ │ │ │ │ +97 return std::make_shared >(prec, │ │ │ │ │ +op->getCommunication()); │ │ │ │ │ +98 } │ │ │ │ │ 99 │ │ │ │ │ -100 const_iterator _e_n_d() const; │ │ │ │ │ -101 │ │ │ │ │ -102 private: │ │ │ │ │ -103 std::map map_; │ │ │ │ │ -104 _s_i_z_e___t_y_p_e row; │ │ │ │ │ -105 }; │ │ │ │ │ -106 │ │ │ │ │ +100 template │ │ │ │ │ +101 std::shared_ptr │ │ │ │ │ +_1_0_2 _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std::shared_ptr& prec, │ │ │ │ │ +103 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) │ │ │ │ │ +104 { │ │ │ │ │ +105 return std::make_shared │ │ │ │ │ +>(prec, op->getCommunication()); │ │ │ │ │ +106 } │ │ │ │ │ 107 │ │ │ │ │ -108 typedef typename InitializerList::iterator InitIterator; │ │ │ │ │ -109 typedef typename IndexSet::const_iterator IndexIteratur; │ │ │ │ │ -110 _I_n_i_t_i_a_l_i_z_e_r_L_i_s_t* initializers; │ │ │ │ │ -111 const _I_n_d_e_x_S_e_t *indices; │ │ │ │ │ -112 mutable std::vector indexMaps; │ │ │ │ │ -113 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& domains; │ │ │ │ │ -114 }; │ │ │ │ │ -115 │ │ │ │ │ -_1_1_9 struct _A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e │ │ │ │ │ -120 {}; │ │ │ │ │ -121 │ │ │ │ │ -_1_2_5 struct _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 │ │ │ │ │ -126 {}; │ │ │ │ │ -127 │ │ │ │ │ -_1_3_2 struct _S_y_m_m_e_t_r_i_c_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 │ │ │ │ │ -133 {}; │ │ │ │ │ -134 │ │ │ │ │ -139 template │ │ │ │ │ -_1_4_0 class _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r; │ │ │ │ │ -141 │ │ │ │ │ -142 // Specialization for BCRSMatrix │ │ │ │ │ -143 template │ │ │ │ │ -_1_4_4 class _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r< _B_C_R_S_M_a_t_r_i_x< K, Al>, X, Y > │ │ │ │ │ -145 { │ │ │ │ │ -146 typedef _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_> _M; │ │ │ │ │ -147 public: │ │ │ │ │ -_1_4_9 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_1_5_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_1_5_1 typedef typename std::remove_const::type _r_i_l_u___t_y_p_e; │ │ │ │ │ -_1_5_3 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_1_5_5 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_1_5_6 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ -157 │ │ │ │ │ -_1_6_2 void _a_p_p_l_y (DynamicVector& v, DynamicVector& d) │ │ │ │ │ -163 { │ │ │ │ │ -164 assert(v.size() > 0); │ │ │ │ │ -165 assert(v.size() == d.size()); │ │ │ │ │ -166 assert(A.rows() <= v.size()); │ │ │ │ │ -167 assert(A.cols() <= v.size()); │ │ │ │ │ -168 size_t sz = A.rows(); │ │ │ │ │ -169 v.resize(sz); │ │ │ │ │ -170 d.resize(sz); │ │ │ │ │ -171 A.solve(v,d); │ │ │ │ │ -172 v.resize(v.capacity()); │ │ │ │ │ -173 d.resize(d.capacity()); │ │ │ │ │ -174 } │ │ │ │ │ -175 │ │ │ │ │ -183 template │ │ │ │ │ -_1_8_4 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M& BCRS, S& rowset) │ │ │ │ │ -185 { │ │ │ │ │ -186 size_t sz = rowset.size(); │ │ │ │ │ -187 A.resize(sz*n,sz*n); │ │ │ │ │ -188 typedef typename S::const_iterator SIter; │ │ │ │ │ -189 size_t r = 0, c = 0; │ │ │ │ │ -190 for(SIter rowIdx = rowset.begin(), rowEnd=rowset.end(); │ │ │ │ │ -191 rowIdx!= rowEnd; ++rowIdx, r++) │ │ │ │ │ -192 { │ │ │ │ │ -193 c = 0; │ │ │ │ │ -194 for(SIter colIdx = rowset.begin(), colEnd=rowset.end(); │ │ │ │ │ -195 colIdx!= colEnd; ++colIdx, c++) │ │ │ │ │ -196 { │ │ │ │ │ -197 if (BCRS[*rowIdx].find(*colIdx) == BCRS[*rowIdx]._e_n_d()) │ │ │ │ │ -198 continue; │ │ │ │ │ -199 for (size_t i=0; i A; │ │ │ │ │ -211 }; │ │ │ │ │ -212 │ │ │ │ │ -213 template │ │ │ │ │ -_2_1_4 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ -215 {}; │ │ │ │ │ -216 │ │ │ │ │ -217 template │ │ │ │ │ -_2_1_8 using _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r = _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_T_,_ _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_<_T_>_:_:_v_a_l_u_e>; │ │ │ │ │ -219 │ │ │ │ │ -220 // specialization for DynamicMatrix │ │ │ │ │ -221 template │ │ │ │ │ -_2_2_2 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r< _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r< │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x, X, Y >,false> │ │ │ │ │ -223 { │ │ │ │ │ -224 public: │ │ │ │ │ -_2_2_5 typedef _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_2_2_6 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_2_2_7 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_2_2_8 typedef typename range_type::block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -_2_2_9 typedef typename _m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ -_2_3_0 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ -238 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const _B_C_R_S_M_a_t_r_i_x_<_K_,_ _A_l_>& │ │ │ │ │ -mat_, const X& b_, Y& x_); │ │ │ │ │ +108 template │ │ │ │ │ +_1_0_9 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ │ +shared_ptr<_M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_> >&) │ │ │ │ │ +110 { │ │ │ │ │ +111 return std::make_shared>(); │ │ │ │ │ +112 } │ │ │ │ │ +113 template │ │ │ │ │ +_1_1_4 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ │ +shared_ptr<_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) │ │ │ │ │ +115 { │ │ │ │ │ +116 return createScalarProduct(op->getCommunication(), op->category()); │ │ │ │ │ +117 } │ │ │ │ │ +118 │ │ │ │ │ +119 template │ │ │ │ │ +_1_2_0 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ │ +shared_ptr<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_> >& op) │ │ │ │ │ +121 { │ │ │ │ │ +122 return createScalarProduct(op->getCommunication(), op->category()); │ │ │ │ │ +123 } │ │ │ │ │ +124 │ │ │ │ │ +144 template │ │ │ │ │ +_1_4_5 class _S_o_l_v_e_r_F_a_c_t_o_r_y { │ │ │ │ │ +146 using Domain = typename Operator::domain_type; │ │ │ │ │ +147 using Range = typename Operator::range_type; │ │ │ │ │ +148 using _S_o_l_v_e_r = _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_>; │ │ │ │ │ +149 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r = _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>; │ │ │ │ │ +150 │ │ │ │ │ +151 template │ │ │ │ │ +152 using _matrix_type = typename O::matrix_type; │ │ │ │ │ +153 using matrix_type = Std::detected_or_t; │ │ │ │ │ +154 static constexpr bool isAssembled = !std::is_same::value; │ │ │ │ │ +155 │ │ │ │ │ +156 static const matrix_type* getmat(std::shared_ptr op){ │ │ │ │ │ +157 std::shared_ptr> aop │ │ │ │ │ +158 = std::dynamic_pointer_cast>(op); │ │ │ │ │ +159 if(aop) │ │ │ │ │ +160 return &aop->getmat(); │ │ │ │ │ +161 return nullptr; │ │ │ │ │ +162 } │ │ │ │ │ +163 │ │ │ │ │ +164 public: │ │ │ │ │ +165 │ │ │ │ │ +_1_6_8 static std::shared_ptr _g_e_t(std::shared_ptr op, │ │ │ │ │ +169 const ParameterTree& config, │ │ │ │ │ +170 std::shared_ptr prec = nullptr){ │ │ │ │ │ +171 std::string type = config.get("type"); │ │ │ │ │ +172 std::shared_ptr result; │ │ │ │ │ +173 const matrix_type* _m_a_t = getmat(op); │ │ │ │ │ +174 if(_m_a_t){ │ │ │ │ │ +175 if (_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_m_a_t_r_i_x___t_y_p_e_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().contains │ │ │ │ │ +(type)) { │ │ │ │ │ +176 if(op->category()!=_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l){ │ │ │ │ │ +177 DUNE_THROW(NotImplemented, "The solver factory does not support parallel │ │ │ │ │ +direct solvers!"); │ │ │ │ │ +178 } │ │ │ │ │ +179 result = _D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_m_a_t_r_i_x___t_y_p_e_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ │ +(type, *_m_a_t, config); │ │ │ │ │ +180 return result; │ │ │ │ │ +181 } │ │ │ │ │ +182 } │ │ │ │ │ +183 // if no direct solver is found it might be an iterative solver │ │ │ │ │ +184 if (!_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().contains(type)) { │ │ │ │ │ +185 DUNE_THROW(Dune::InvalidStateException, "Solver not found in the │ │ │ │ │ +factory."); │ │ │ │ │ +186 } │ │ │ │ │ +187 if(!prec){ │ │ │ │ │ +188 const ParameterTree& precConfig = config.sub("preconditioner"); │ │ │ │ │ +189 std::string prec_type = precConfig.get("type"); │ │ │ │ │ +190 prec = _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ │ +(prec_type, op, precConfig); │ │ │ │ │ +191 if (prec->category() != op->category() && prec->category() == │ │ │ │ │ +_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l) │ │ │ │ │ +192 // try to wrap to a parallel preconditioner │ │ │ │ │ +193 prec = _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(prec, op); │ │ │ │ │ +194 } │ │ │ │ │ +195 std::shared_ptr> sp = _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(op); │ │ │ │ │ +196 result = _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create(type, op, │ │ │ │ │ +sp, prec, config); │ │ │ │ │ +197 return result; │ │ │ │ │ +198 } │ │ │ │ │ +199 │ │ │ │ │ +_2_0_3 static std::shared_ptr _g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r(std:: │ │ │ │ │ +shared_ptr op, │ │ │ │ │ +204 const ParameterTree& config){ │ │ │ │ │ +205 const matrix_type* _m_a_t = getmat(op); │ │ │ │ │ +206 if(_m_a_t){ │ │ │ │ │ +207 std::string prec_type = config.get("type"); │ │ │ │ │ +208 return _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ │ +(prec_type, op, config); │ │ │ │ │ +209 }else{ │ │ │ │ │ +210 DUNE_THROW(InvalidStateException, "Could not obtain matrix from operator. │ │ │ │ │ +Please pass in an AssembledLinearOperator."); │ │ │ │ │ +211 } │ │ │ │ │ +212 } │ │ │ │ │ +213 }; │ │ │ │ │ +214 │ │ │ │ │ +225 template │ │ │ │ │ +226 std::shared_ptr> _g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y(std:: │ │ │ │ │ +shared_ptr op, │ │ │ │ │ +228 const ParameterTree& config, │ │ │ │ │ +229 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r> prec = nullptr){ │ │ │ │ │ +231 return _S_o_l_v_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_>_:_:_g_e_t(op, config, prec); │ │ │ │ │ +232 } │ │ │ │ │ +233 │ │ │ │ │ +237} // end namespace Dune │ │ │ │ │ +238 │ │ │ │ │ 239 │ │ │ │ │ -243 inline │ │ │ │ │ -244 void deallocate(); │ │ │ │ │ -245 │ │ │ │ │ -249 inline │ │ │ │ │ -250 void resetIndexForNextDomain(); │ │ │ │ │ -251 │ │ │ │ │ -256 inline │ │ │ │ │ -257 DynamicVector & lhs(); │ │ │ │ │ -258 │ │ │ │ │ -263 inline │ │ │ │ │ -264 DynamicVector & rhs(); │ │ │ │ │ -265 │ │ │ │ │ -270 inline │ │ │ │ │ -271 void relaxResult(_f_i_e_l_d___t_y_p_e relax); │ │ │ │ │ -272 │ │ │ │ │ -277 void operator()(const _s_i_z_e___t_y_p_e& domainIndex); │ │ │ │ │ -278 │ │ │ │ │ -286 inline │ │ │ │ │ -287 void assignResult(_b_l_o_c_k___t_y_p_e& res); │ │ │ │ │ -288 │ │ │ │ │ -289 private: │ │ │ │ │ -293 const _m_a_t_r_i_x___t_y_p_e* _m_a_t; │ │ │ │ │ -295 // we need a pointer, because we have to avoid deep copies │ │ │ │ │ -296 DynamicVector * rhs_; │ │ │ │ │ -298 // we need a pointer, because we have to avoid deep copies │ │ │ │ │ -299 DynamicVector * lhs_; │ │ │ │ │ -301 const _r_a_n_g_e___t_y_p_e* b; │ │ │ │ │ -303 _r_a_n_g_e___t_y_p_e* x; │ │ │ │ │ -305 std::size_t i; │ │ │ │ │ -307 std::size_t maxlength_; │ │ │ │ │ -308 }; │ │ │ │ │ -309 │ │ │ │ │ -310#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -311 template class S, typename T, typename A> │ │ │ │ │ -_3_1_2 struct _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r>, true> │ │ │ │ │ -313 { │ │ │ │ │ -_3_1_4 typedef _B_C_R_S_M_a_t_r_i_x_<_T_,_ _A_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_3_1_5 typedef typename S>::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_3_1_6 typedef typename range_type::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_3_1_7 typedef typename range_type::block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -318 │ │ │ │ │ -_3_1_9 typedef typename _m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ -320 │ │ │ │ │ -_3_2_1 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ -_3_2_2 static constexpr size_t m = std::decay_t()))>::cols; │ │ │ │ │ -330 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ -331 const _r_a_n_g_e___t_y_p_e& b, _r_a_n_g_e___t_y_p_e& x); │ │ │ │ │ -337 void deallocate(); │ │ │ │ │ -338 │ │ │ │ │ -339 /* │ │ │ │ │ -340 * @brief Resets the local index to zero. │ │ │ │ │ -341 */ │ │ │ │ │ -342 void resetIndexForNextDomain(); │ │ │ │ │ -343 │ │ │ │ │ -348 _f_i_e_l_d___t_y_p_e* lhs(); │ │ │ │ │ -349 │ │ │ │ │ -354 _f_i_e_l_d___t_y_p_e* rhs(); │ │ │ │ │ -355 │ │ │ │ │ -360 void relaxResult(_f_i_e_l_d___t_y_p_e relax); │ │ │ │ │ -361 │ │ │ │ │ -366 void operator()(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ -367 │ │ │ │ │ -375 void assignResult(_b_l_o_c_k___t_y_p_e& res); │ │ │ │ │ -376 │ │ │ │ │ -377 private: │ │ │ │ │ -381 const _m_a_t_r_i_x___t_y_p_e* _m_a_t; │ │ │ │ │ -383 _f_i_e_l_d___t_y_p_e* rhs_; │ │ │ │ │ -385 _f_i_e_l_d___t_y_p_e* lhs_; │ │ │ │ │ -387 const _r_a_n_g_e___t_y_p_e* b; │ │ │ │ │ -389 _r_a_n_g_e___t_y_p_e* x; │ │ │ │ │ -391 std::size_t i; │ │ │ │ │ -393 std::size_t maxlength_; │ │ │ │ │ -394 }; │ │ │ │ │ -395 │ │ │ │ │ -396#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -397 │ │ │ │ │ -398 template │ │ │ │ │ -_3_9_9 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ -400 { │ │ │ │ │ -401 public: │ │ │ │ │ -_4_0_2 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -403 │ │ │ │ │ -_4_0_4 typedef typename Y::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -405 │ │ │ │ │ -_4_0_6 typedef typename Y::block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -407 │ │ │ │ │ -_4_0_8 typedef typename matrix_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -416 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(std::size_t maxlength, const M& mat, │ │ │ │ │ -417 const Y& b, X& x); │ │ │ │ │ -423 void _d_e_a_l_l_o_c_a_t_e(); │ │ │ │ │ -424 │ │ │ │ │ -428 void _r_e_s_e_t_I_n_d_e_x_F_o_r_N_e_x_t_D_o_m_a_i_n(); │ │ │ │ │ -429 │ │ │ │ │ -434 X& _l_h_s(); │ │ │ │ │ -435 │ │ │ │ │ -440 Y& _r_h_s(); │ │ │ │ │ -441 │ │ │ │ │ -446 void _r_e_l_a_x_R_e_s_u_l_t(_f_i_e_l_d___t_y_p_e relax); │ │ │ │ │ -447 │ │ │ │ │ -452 void _o_p_e_r_a_t_o_r_(_)(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ -453 │ │ │ │ │ -461 void _a_s_s_i_g_n_R_e_s_u_l_t(_b_l_o_c_k___t_y_p_e& res); │ │ │ │ │ -462 │ │ │ │ │ -463 private: │ │ │ │ │ -467 const M* mat; │ │ │ │ │ -469 X* lhs_; │ │ │ │ │ -471 Y* rhs_; │ │ │ │ │ -473 const Y* b; │ │ │ │ │ -475 X* x; │ │ │ │ │ -477 _s_i_z_e___t_y_p_e i; │ │ │ │ │ -478 }; │ │ │ │ │ -479 │ │ │ │ │ -480 // specialization for ILU0 │ │ │ │ │ -481 template │ │ │ │ │ -_4_8_2 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r<_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r, false> │ │ │ │ │ -483 : public _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ -484 { │ │ │ │ │ -485 public: │ │ │ │ │ -_4_9_3 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const M& _m_a_t, │ │ │ │ │ -494 const Y& b, X& x) │ │ │ │ │ -495 : _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(maxlength, _m_a_t,b,x) │ │ │ │ │ -496 {} │ │ │ │ │ -497 }; │ │ │ │ │ -498 │ │ │ │ │ -499 // specialization for ILUN │ │ │ │ │ -500 template │ │ │ │ │ -_5_0_1 class _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r<_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r,false> │ │ │ │ │ -502 : public _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ -503 { │ │ │ │ │ -504 public: │ │ │ │ │ -_5_1_2 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r(std::size_t maxlength, const M& _m_a_t, │ │ │ │ │ -513 const Y& b, X& x) │ │ │ │ │ -514 : _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(maxlength, _m_a_t,b,x) │ │ │ │ │ -515 {} │ │ │ │ │ -516 }; │ │ │ │ │ -517 │ │ │ │ │ -518 template │ │ │ │ │ -_5_1_9 struct _A_d_d_i_t_i_v_e_A_d_d_e_r │ │ │ │ │ -520 {}; │ │ │ │ │ -521 │ │ │ │ │ -522 template │ │ │ │ │ -_5_2_3 struct _A_d_d_i_t_i_v_e_A_d_d_e_r > │ │ │ │ │ -524 { │ │ │ │ │ -_5_2_5 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -_5_2_6 typedef typename std::decay_t │ │ │ │ │ -()))>::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -527 _A_d_d_i_t_i_v_e_A_d_d_e_r(_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v, _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x, │ │ │ │ │ -528 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner, const _f_i_e_l_d___t_y_p_e& relax_); │ │ │ │ │ -529 void operator()(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ -530 void axpy(); │ │ │ │ │ -_5_3_1 static constexpr size_t n = std::decay_t()))>::dimension; │ │ │ │ │ -532 │ │ │ │ │ -533 private: │ │ │ │ │ -534 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>* v; │ │ │ │ │ -535 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>* x; │ │ │ │ │ -536 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>* assigner; │ │ │ │ │ -537 _f_i_e_l_d___t_y_p_e relax; │ │ │ │ │ -538 }; │ │ │ │ │ -539 │ │ │ │ │ -540 template │ │ │ │ │ -_5_4_1 struct _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r │ │ │ │ │ -542 {}; │ │ │ │ │ -543 │ │ │ │ │ -544 template │ │ │ │ │ -_5_4_5 struct _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r > │ │ │ │ │ -546 { │ │ │ │ │ -_5_4_7 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -_5_4_8 typedef typename std::decay_t │ │ │ │ │ -()))>::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -549 _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r(_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v, _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x, │ │ │ │ │ -550 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner_, const _f_i_e_l_d___t_y_p_e& relax_); │ │ │ │ │ -551 void operator()(const _s_i_z_e___t_y_p_e& domain); │ │ │ │ │ -552 void axpy(); │ │ │ │ │ -_5_5_3 static constexpr size_t n = std::decay_t()))>::dimension; │ │ │ │ │ -554 │ │ │ │ │ -555 private: │ │ │ │ │ -556 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>* x; │ │ │ │ │ -557 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>* assigner; │ │ │ │ │ -558 _f_i_e_l_d___t_y_p_e relax; │ │ │ │ │ -559 }; │ │ │ │ │ -560 │ │ │ │ │ -570 template │ │ │ │ │ -_5_7_1 struct _A_d_d_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ -572 {}; │ │ │ │ │ -573 │ │ │ │ │ -574 template │ │ │ │ │ -_5_7_5 struct _A_d_d_e_r_S_e_l_e_c_t_o_r<_A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e,X,S> │ │ │ │ │ -576 { │ │ │ │ │ -_5_7_7 typedef _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_X_> _A_d_d_e_r; │ │ │ │ │ -578 }; │ │ │ │ │ -579 │ │ │ │ │ -580 template │ │ │ │ │ -_5_8_1 struct _A_d_d_e_r_S_e_l_e_c_t_o_r<_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,X,S> │ │ │ │ │ -582 { │ │ │ │ │ -_5_8_3 typedef _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_X_> _A_d_d_e_r; │ │ │ │ │ -584 }; │ │ │ │ │ -585 │ │ │ │ │ -586 template │ │ │ │ │ -_5_8_7 struct _A_d_d_e_r_S_e_l_e_c_t_o_r<_S_y_m_m_e_t_r_i_c_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,X,S> │ │ │ │ │ -588 { │ │ │ │ │ -_5_8_9 typedef _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_X_> _A_d_d_e_r; │ │ │ │ │ -590 }; │ │ │ │ │ -591 │ │ │ │ │ -603 template │ │ │ │ │ -_6_0_4 struct _I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r │ │ │ │ │ -605 { │ │ │ │ │ -_6_0_6 typedef T1 _s_o_l_v_e_r___v_e_c_t_o_r; │ │ │ │ │ -_6_0_7 typedef typename solver_vector::iterator _s_o_l_v_e_r___i_t_e_r_a_t_o_r; │ │ │ │ │ -_6_0_8 typedef T2 _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ -_6_0_9 typedef typename subdomain_vector::const_iterator _d_o_m_a_i_n___i_t_e_r_a_t_o_r; │ │ │ │ │ -610 │ │ │ │ │ -_6_1_1 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _b_e_g_i_n(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ -612 { │ │ │ │ │ -613 return sv.begin(); │ │ │ │ │ -614 } │ │ │ │ │ -615 │ │ │ │ │ -_6_1_6 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _e_n_d(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ -617 { │ │ │ │ │ -618 return sv.end(); │ │ │ │ │ -619 } │ │ │ │ │ -_6_2_0 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _b_e_g_i_n(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ -621 { │ │ │ │ │ -622 return sv.begin(); │ │ │ │ │ -623 } │ │ │ │ │ -624 │ │ │ │ │ -_6_2_5 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _e_n_d(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ -626 { │ │ │ │ │ -627 return sv.end(); │ │ │ │ │ -628 } │ │ │ │ │ -629 }; │ │ │ │ │ -630 │ │ │ │ │ -631 template │ │ │ │ │ -_6_3_2 struct _I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r │ │ │ │ │ -633 { │ │ │ │ │ -_6_3_4 typedef T1 _s_o_l_v_e_r___v_e_c_t_o_r; │ │ │ │ │ -_6_3_5 typedef typename solver_vector::reverse_iterator _s_o_l_v_e_r___i_t_e_r_a_t_o_r; │ │ │ │ │ -_6_3_6 typedef T2 _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ -_6_3_7 typedef typename subdomain_vector::const_reverse_iterator _d_o_m_a_i_n___i_t_e_r_a_t_o_r; │ │ │ │ │ -638 │ │ │ │ │ -_6_3_9 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _b_e_g_i_n(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ -640 { │ │ │ │ │ -641 return sv.rbegin(); │ │ │ │ │ -642 } │ │ │ │ │ -643 │ │ │ │ │ -_6_4_4 static _s_o_l_v_e_r___i_t_e_r_a_t_o_r _e_n_d(_s_o_l_v_e_r___v_e_c_t_o_r& sv) │ │ │ │ │ -645 { │ │ │ │ │ -646 return sv.rend(); │ │ │ │ │ -647 } │ │ │ │ │ -_6_4_8 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _b_e_g_i_n(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ -649 { │ │ │ │ │ -650 return sv.rbegin(); │ │ │ │ │ -651 } │ │ │ │ │ -652 │ │ │ │ │ -_6_5_3 static _d_o_m_a_i_n___i_t_e_r_a_t_o_r _e_n_d(const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& sv) │ │ │ │ │ -654 { │ │ │ │ │ -655 return sv.rend(); │ │ │ │ │ -656 } │ │ │ │ │ -657 }; │ │ │ │ │ -658 │ │ │ │ │ -667 template │ │ │ │ │ -_6_6_8 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_p_p_l_i_e_r │ │ │ │ │ -669 { │ │ │ │ │ -_6_7_0 typedef T _s_m_o_o_t_h_e_r; │ │ │ │ │ -_6_7_1 typedef typename smoother::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -672 │ │ │ │ │ -_6_7_3 static void _a_p_p_l_y(_s_m_o_o_t_h_e_r& sm, _r_a_n_g_e___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& b) │ │ │ │ │ -674 { │ │ │ │ │ -675 sm.template apply(v, b); │ │ │ │ │ -676 } │ │ │ │ │ -677 }; │ │ │ │ │ -678 │ │ │ │ │ -679 template │ │ │ │ │ -_6_8_0 struct │ │ │ │ │ -_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_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 │ │ │ │ │ -> │ │ │ │ │ -681 { │ │ │ │ │ -_6_8_2 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_S_y_m_m_e_t_r_i_c_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_,_T_D_,_T_A_> │ │ │ │ │ -_s_m_o_o_t_h_e_r; │ │ │ │ │ -_6_8_3 typedef typename _s_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -684 │ │ │ │ │ -_6_8_5 static void _a_p_p_l_y(_s_m_o_o_t_h_e_r& sm, _r_a_n_g_e___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& b) │ │ │ │ │ -686 { │ │ │ │ │ -687 sm.template apply(v, b); │ │ │ │ │ -688 sm.template apply(v, b); │ │ │ │ │ -689 } │ │ │ │ │ -690 }; │ │ │ │ │ -691 │ │ │ │ │ -692 template │ │ │ │ │ -_6_9_3 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 │ │ │ │ │ -694 {}; │ │ │ │ │ -695 │ │ │ │ │ -696 template │ │ │ │ │ -_6_9_7 using _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 = │ │ │ │ │ -_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_<_T_,_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_<_T_>_:_:_v_a_l_u_e>; │ │ │ │ │ -698 │ │ │ │ │ -699 template │ │ │ │ │ -_7_0_0 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< _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r< │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x< K, Al>, X, Y >,false> │ │ │ │ │ -701 { │ │ │ │ │ -_7_0_2 typedef _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_7_0_3 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ -704 template │ │ │ │ │ -705 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, │ │ │ │ │ -const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ -706 Solvers& solvers, const SubDomains& domains, │ │ │ │ │ -707 bool onTheFly); │ │ │ │ │ -708 }; │ │ │ │ │ -709 │ │ │ │ │ -710 template class S, typename T, typename A> │ │ │ │ │ -_7_1_1 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>,true> │ │ │ │ │ -712 { │ │ │ │ │ -_7_1_3 typedef _B_C_R_S_M_a_t_r_i_x_<_T_,_A_> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_7_1_4 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ -715 template │ │ │ │ │ -716 static std::size_t assembleLocalProblems(const RowToDomain& rowToDomain, │ │ │ │ │ -const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ -717 Solvers& solvers, const SubDomains& domains, │ │ │ │ │ -718 bool onTheFly); │ │ │ │ │ -719 }; │ │ │ │ │ -720 │ │ │ │ │ -721 template │ │ │ │ │ -_7_2_2 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_I_L_U_B_a_s_e │ │ │ │ │ -723 { │ │ │ │ │ -_7_2_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -725 template │ │ │ │ │ -726 static std::size_t _a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s(const RowToDomain& rowToDomain, │ │ │ │ │ -const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ -727 Solvers& solvers, const SubDomains& domains, │ │ │ │ │ -728 bool onTheFly); │ │ │ │ │ -729 }; │ │ │ │ │ -730 │ │ │ │ │ -731 template │ │ │ │ │ -_7_3_2 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<_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r,false> │ │ │ │ │ -733 : public _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_I_L_U_B_a_s_e │ │ │ │ │ -734 {}; │ │ │ │ │ -735 │ │ │ │ │ -736 template │ │ │ │ │ -_7_3_7 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<_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r,false> │ │ │ │ │ -738 : public _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_I_L_U_B_a_s_e │ │ │ │ │ -739 {}; │ │ │ │ │ -740 │ │ │ │ │ -751 template, class TA=std::allocator > │ │ │ │ │ -_7_5_3 class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ -754 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -755 { │ │ │ │ │ -756 public: │ │ │ │ │ -_7_6_0 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -761 │ │ │ │ │ -_7_6_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -766 │ │ │ │ │ -_7_7_0 typedef X _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -771 │ │ │ │ │ -_7_7_8 typedef _T_M _M_o_d_e; │ │ │ │ │ -779 │ │ │ │ │ -_7_8_3 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -784 │ │ │ │ │ -_7_8_6 typedef typename matrix_type::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -787 │ │ │ │ │ -_7_8_9 typedef _T_A _a_l_l_o_c_a_t_o_r; │ │ │ │ │ -790 │ │ │ │ │ -792 typedef std::set, │ │ │ │ │ -793 typename std::allocator_traits::template _r_e_b_i_n_d___a_l_l_o_c_<_s_i_z_e___t_y_p_e_> > │ │ │ │ │ -_7_9_4 _s_u_b_d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -795 │ │ │ │ │ -_7_9_7 typedef std::vector:: │ │ │ │ │ -template _r_e_b_i_n_d___a_l_l_o_c_<_s_u_b_d_o_m_a_i_n___t_y_p_e_> > _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ -798 │ │ │ │ │ -_8_0_0 typedef _S_L_L_i_s_t_<_s_i_z_e___t_y_p_e_,_ _t_y_p_e_n_a_m_e_ _s_t_d_:_:_a_l_l_o_c_a_t_o_r___t_r_a_i_t_s_<_T_A_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ │ -_r_e_b_i_n_d___a_l_l_o_c_<_s_i_z_e___t_y_p_e_> > _s_u_b_d_o_m_a_i_n___l_i_s_t; │ │ │ │ │ -801 │ │ │ │ │ -_8_0_3 typedef std::vector:: │ │ │ │ │ -template _r_e_b_i_n_d___a_l_l_o_c_<_s_u_b_d_o_m_a_i_n___l_i_s_t_> > _r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r; │ │ │ │ │ -804 │ │ │ │ │ -_8_0_6 typedef _T_D _s_l_u; │ │ │ │ │ -807 │ │ │ │ │ -_8_0_9 typedef std::vector::template │ │ │ │ │ -_r_e_b_i_n_d___a_l_l_o_c_<_s_l_u_> > _s_l_u___v_e_c_t_o_r; │ │ │ │ │ -810 │ │ │ │ │ -_8_2_4 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const _m_a_t_r_i_x___t_y_p_e& mat, const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& │ │ │ │ │ -subDomains, │ │ │ │ │ -825 _f_i_e_l_d___t_y_p_e relaxationFactor=1, bool _o_n_T_h_e_F_l_y__=true); │ │ │ │ │ -826 │ │ │ │ │ -_8_3_8 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const _m_a_t_r_i_x___t_y_p_e& mat, const _r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r& │ │ │ │ │ -_r_o_w_T_o_D_o_m_a_i_n, │ │ │ │ │ -839 _f_i_e_l_d___t_y_p_e relaxationFactor=1, bool _o_n_T_h_e_F_l_y__=true); │ │ │ │ │ -840 │ │ │ │ │ -_8_4_6 virtual void _p_r_e ([[_m_a_y_b_e___u_n_u_s_e_d]] X& x, [[_m_a_y_b_e___u_n_u_s_e_d]] X& b) │ │ │ │ │ -847 {} │ │ │ │ │ -848 │ │ │ │ │ -_8_5_4 virtual void _a_p_p_l_y (X& v, const X& _d); │ │ │ │ │ -855 │ │ │ │ │ -_8_6_1 virtual void _p_o_s_t ([[_m_a_y_b_e___u_n_u_s_e_d]] X& x) │ │ │ │ │ -862 {} │ │ │ │ │ -863 │ │ │ │ │ -864 template │ │ │ │ │ -_8_6_5 void _a_p_p_l_y(X& v, const X& _d); │ │ │ │ │ -866 │ │ │ │ │ -_8_6_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 │ │ │ │ │ -869 { │ │ │ │ │ -870 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; │ │ │ │ │ -871 } │ │ │ │ │ -872 │ │ │ │ │ -873 private: │ │ │ │ │ -874 const M& mat; │ │ │ │ │ -875 _s_l_u___v_e_c_t_o_r solvers; │ │ │ │ │ -876 _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r subDomains; │ │ │ │ │ -877 _f_i_e_l_d___t_y_p_e relax; │ │ │ │ │ -878 │ │ │ │ │ -879 typename M::size_type maxlength; │ │ │ │ │ -880 │ │ │ │ │ -881 bool onTheFly; │ │ │ │ │ -882 }; │ │ │ │ │ -883 │ │ │ │ │ -884 │ │ │ │ │ -885 │ │ │ │ │ -886 template │ │ │ │ │ -_8_8_7 _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_<_I_,_S_,_D_>_:_:_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 │ │ │ │ │ -(_I_n_i_t_i_a_l_i_z_e_r_L_i_s_t& il, │ │ │ │ │ -888 const _I_n_d_e_x_S_e_t& idx, │ │ │ │ │ -889 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& domains_) │ │ │ │ │ -890 : initializers(&il), indices(&idx), indexMaps(il.size()), domains(domains_) │ │ │ │ │ -891 {} │ │ │ │ │ -892 │ │ │ │ │ -893 │ │ │ │ │ -894 template │ │ │ │ │ -_8_9_5 void _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_<_I_,_S_,_D_>_:_:_a_d_d_R_o_w_N_n_z(const _I_t_e_r& row) │ │ │ │ │ -896 { │ │ │ │ │ -897 typedef typename IndexSet::value_type::const_iterator iterator; │ │ │ │ │ -898 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices) │ │ │ │ │ -[row.index()].end(); ++domain) { │ │ │ │ │ -899 (*initializers)[*domain].addRowNnz(row, domains[*domain]); │ │ │ │ │ -900 indexMaps[*domain].insert(row.index()); │ │ │ │ │ -901 } │ │ │ │ │ -902 } │ │ │ │ │ -903 │ │ │ │ │ -904 template │ │ │ │ │ -_9_0_5 void _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_<_I_,_S_,_D_>_:_:_a_l_l_o_c_a_t_e() │ │ │ │ │ -906 { │ │ │ │ │ -907 for(auto&& i: *initializers) │ │ │ │ │ -908 i.allocateMatrixStorage(); │ │ │ │ │ -909 for(auto&& i: *initializers) │ │ │ │ │ -910 i.allocateMarker(); │ │ │ │ │ -911 } │ │ │ │ │ -912 │ │ │ │ │ -913 template │ │ │ │ │ -_9_1_4 void _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_<_I_,_S_,_D_>_:_:_c_o_u_n_t_E_n_t_r_i_e_s(const _I_t_e_r& row, │ │ │ │ │ -const _C_I_t_e_r& _c_o_l) const │ │ │ │ │ -915 { │ │ │ │ │ -916 typedef typename IndexSet::value_type::const_iterator iterator; │ │ │ │ │ -917 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices) │ │ │ │ │ -[row.index()].end(); ++domain) { │ │ │ │ │ -918 typename std::map::const_iterator v = indexMaps │ │ │ │ │ -[*domain].find(_c_o_l.index()); │ │ │ │ │ -919 if(v!= indexMaps[*domain].end()) { │ │ │ │ │ -920 (*initializers)[*domain].countEntries(indexMaps[*domain].find(_c_o_l.index())- │ │ │ │ │ ->second); │ │ │ │ │ -921 } │ │ │ │ │ -922 } │ │ │ │ │ -923 } │ │ │ │ │ -924 │ │ │ │ │ -925 template │ │ │ │ │ -_9_2_6 void _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_<_I_,_S_,_D_>_:_:_c_a_l_c_C_o_l_s_t_a_r_t() const │ │ │ │ │ -927 { │ │ │ │ │ -928 for(auto&& i : *initializers) │ │ │ │ │ -929 i.calcColstart(); │ │ │ │ │ -930 } │ │ │ │ │ -931 │ │ │ │ │ -932 template │ │ │ │ │ -_9_3_3 void _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_<_I_,_S_,_D_>_:_:_c_o_p_y_V_a_l_u_e(const _I_t_e_r& row, const │ │ │ │ │ -_C_I_t_e_r& _c_o_l) const │ │ │ │ │ -934 { │ │ │ │ │ -935 typedef typename IndexSet::value_type::const_iterator iterator; │ │ │ │ │ -936 for(iterator domain=(*indices)[row.index()].begin(); domain!= (*indices) │ │ │ │ │ -[row.index()].end(); ++domain) { │ │ │ │ │ -937 typename std::map::const_iterator v = indexMaps │ │ │ │ │ -[*domain].find(_c_o_l.index()); │ │ │ │ │ -938 if(v!= indexMaps[*domain].end()) { │ │ │ │ │ -939 assert(indexMaps[*domain].end()!=indexMaps[*domain].find(row.index())); │ │ │ │ │ -940 (*initializers)[*domain].copyValue(_c_o_l, indexMaps[*domain].find(row.index │ │ │ │ │ -())->second, │ │ │ │ │ -941 v->second); │ │ │ │ │ -942 } │ │ │ │ │ -943 } │ │ │ │ │ -944 } │ │ │ │ │ -945 │ │ │ │ │ -946 template │ │ │ │ │ -_9_4_7 void _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_<_I_,_S_,_D_>_:_:_c_r_e_a_t_e_M_a_t_r_i_x() const │ │ │ │ │ -948 { │ │ │ │ │ -949 std::vector().swap(indexMaps); │ │ │ │ │ -950 for(auto&& i: *initializers) │ │ │ │ │ -951 i.createMatrix(); │ │ │ │ │ -952 } │ │ │ │ │ -953 │ │ │ │ │ -954 template │ │ │ │ │ -_9_5_5 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_I_n_d_e_x_M_a_p() │ │ │ │ │ -956 : row(0) │ │ │ │ │ -957 {} │ │ │ │ │ -958 │ │ │ │ │ -959 template │ │ │ │ │ -_9_6_0 void _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_i_n_s_e_r_t(size_type grow) │ │ │ │ │ -961 { │ │ │ │ │ -962 assert(map_.find(grow)==map_.end()); │ │ │ │ │ -963 map_.insert(std::make_pair(grow, row++)); │ │ │ │ │ -964 } │ │ │ │ │ -965 │ │ │ │ │ -966 template │ │ │ │ │ -967 typename OverlappingSchwarzInitializer::IndexMap::const_iterator │ │ │ │ │ -_9_6_8 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_f_i_n_d(size_type grow) const │ │ │ │ │ -969 { │ │ │ │ │ -970 return map_.find(grow); │ │ │ │ │ -971 } │ │ │ │ │ -972 │ │ │ │ │ -973 template │ │ │ │ │ -974 typename OverlappingSchwarzInitializer::IndexMap::iterator │ │ │ │ │ -_9_7_5 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_f_i_n_d(size_type grow) │ │ │ │ │ -976 { │ │ │ │ │ -977 return map_.find(grow); │ │ │ │ │ -978 } │ │ │ │ │ -979 │ │ │ │ │ -980 template │ │ │ │ │ -981 typename OverlappingSchwarzInitializer::IndexMap::const_iterator │ │ │ │ │ -_9_8_2 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_e_n_d() const │ │ │ │ │ -983 { │ │ │ │ │ -984 return map_.end(); │ │ │ │ │ -985 } │ │ │ │ │ -986 │ │ │ │ │ -987 template │ │ │ │ │ -988 typename OverlappingSchwarzInitializer::IndexMap::iterator │ │ │ │ │ -_9_8_9 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_e_n_d() │ │ │ │ │ -990 { │ │ │ │ │ -991 return map_.end(); │ │ │ │ │ -992 } │ │ │ │ │ -993 │ │ │ │ │ -994 template │ │ │ │ │ -995 typename OverlappingSchwarzInitializer::IndexMap::const_iterator │ │ │ │ │ -_9_9_6 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_b_e_g_i_n() const │ │ │ │ │ -997 { │ │ │ │ │ -998 return map_.begin(); │ │ │ │ │ -999 } │ │ │ │ │ -1000 │ │ │ │ │ -1001 template │ │ │ │ │ -1002 typename OverlappingSchwarzInitializer::IndexMap::iterator │ │ │ │ │ -_1_0_0_3 _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_<_I_,_S_,_D_>_:_:_I_n_d_e_x_M_a_p_:_:_b_e_g_i_n() │ │ │ │ │ -1004 { │ │ │ │ │ -1005 return map_.begin(); │ │ │ │ │ -1006 } │ │ │ │ │ -1007 │ │ │ │ │ -1008 template │ │ │ │ │ -_1_0_0_9 _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_D_,_T_A_>_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const │ │ │ │ │ -_m_a_t_r_i_x___t_y_p_e& _m_a_t__, const _r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r& _r_o_w_T_o_D_o_m_a_i_n, │ │ │ │ │ -1010 _f_i_e_l_d___t_y_p_e relaxationFactor, bool _f_l_y) │ │ │ │ │ -1011 : _m_a_t(_m_a_t__), relax(relaxationFactor), onTheFly(_f_l_y) │ │ │ │ │ -1012 { │ │ │ │ │ -1013 typedef typename rowtodomain_vector::const_iterator _R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r; │ │ │ │ │ -1014 typedef typename subdomain_list::const_iterator _D_o_m_a_i_n_I_t_e_r_a_t_o_r; │ │ │ │ │ -1015#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1016 _a_s_s_e_r_t(_r_o_w_T_o_D_o_m_a_i_n.size()==mat.N()); │ │ │ │ │ -1017 _a_s_s_e_r_t(_r_o_w_T_o_D_o_m_a_i_n.size()==mat.M()); │ │ │ │ │ -1018 │ │ │ │ │ -1019 for(_R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r _i_t_e_r=_r_o_w_T_o_D_o_m_a_i_n.begin(); _i_t_e_r != _r_o_w_T_o_D_o_m_a_i_n.end(); │ │ │ │ │ -++_i_t_e_r) │ │ │ │ │ -1020 _a_s_s_e_r_t(_i_t_e_r->size()>0); │ │ │ │ │ -1021 │ │ │ │ │ -1022#endif │ │ │ │ │ -1023 // calculate the number of domains │ │ │ │ │ -1024 _s_i_z_e___t_y_p_e domains=0; │ │ │ │ │ -1025 for(_R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r _i_t_e_r=_r_o_w_T_o_D_o_m_a_i_n.begin(); _i_t_e_r != _r_o_w_T_o_D_o_m_a_i_n.end(); │ │ │ │ │ -++_i_t_e_r) │ │ │ │ │ -1026 for(_D_o_m_a_i_n_I_t_e_r_a_t_o_r _d=_i_t_e_r->begin(); _d != _i_t_e_r->end(); ++_d) │ │ │ │ │ -1027 domains=std::max(domains, *_d); │ │ │ │ │ -1028 ++domains; │ │ │ │ │ -1029 │ │ │ │ │ -1030 solvers.resize(domains); │ │ │ │ │ -1031 subDomains.resize(domains); │ │ │ │ │ -1032 │ │ │ │ │ -1033 // initialize subdomains to row mapping from row to subdomain mapping │ │ │ │ │ -1034 _s_i_z_e___t_y_p_e row=0; │ │ │ │ │ -1035 for(_R_o_w_D_o_m_a_i_n_I_t_e_r_a_t_o_r _i_t_e_r=_r_o_w_T_o_D_o_m_a_i_n.begin(); _i_t_e_r != _r_o_w_T_o_D_o_m_a_i_n.end(); │ │ │ │ │ -++_i_t_e_r, ++row) │ │ │ │ │ -1036 for(_D_o_m_a_i_n_I_t_e_r_a_t_o_r _d=_i_t_e_r->begin(); _d != _i_t_e_r->end(); ++_d) │ │ │ │ │ -1037 subDomains[*_d].insert(row); │ │ │ │ │ -1038 │ │ │ │ │ -1039#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1040 _s_i_z_e___t_y_p_e i=0; │ │ │ │ │ -1041 typedef typename subdomain_vector::const_iterator iterator; │ │ │ │ │ -1042 for(iterator _i_t_e_r=subDomains.begin(); _i_t_e_r != subDomains.end(); ++_i_t_e_r) { │ │ │ │ │ -1043 typedef typename subdomain_type::const_iterator _e_n_t_r_y___i_t_e_r_a_t_o_r; │ │ │ │ │ -1044 Dune::dvverb<<"domain "<begin(); entry != _i_t_e_r->end(); ++entry) { │ │ │ │ │ -1046 Dune::dvverb<<" "<<*entry; │ │ │ │ │ -1047 } │ │ │ │ │ -1048 Dune::dvverb< │ │ │ │ │ -1052_ _:_:_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s(_r_o_w_T_o_D_o_m_a_i_n, mat, solvers, subDomains, onTheFly); │ │ │ │ │ -1053 } │ │ │ │ │ -1054 │ │ │ │ │ -1055 template │ │ │ │ │ -_1_0_5_6 _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_D_,_T_A_>_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z(const │ │ │ │ │ -_m_a_t_r_i_x___t_y_p_e& _m_a_t__, │ │ │ │ │ -1057 const _s_u_b_d_o_m_a_i_n___v_e_c_t_o_r& _s_d, │ │ │ │ │ -1058 _f_i_e_l_d___t_y_p_e relaxationFactor, │ │ │ │ │ -1059 bool _f_l_y) │ │ │ │ │ -1060 : _m_a_t(_m_a_t__), solvers(_s_d.size()), subDomains(_s_d), relax(relaxationFactor), │ │ │ │ │ -1061 onTheFly(_f_l_y) │ │ │ │ │ -1062 { │ │ │ │ │ -1063 typedef typename subdomain_vector::const_iterator _D_o_m_a_i_n_I_t_e_r_a_t_o_r; │ │ │ │ │ -1064 │ │ │ │ │ -1065#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1066 _s_i_z_e___t_y_p_e i=0; │ │ │ │ │ -1067 │ │ │ │ │ -1068 for(_D_o_m_a_i_n_I_t_e_r_a_t_o_r _d=_s_d.begin(); _d != _s_d.end(); ++_d,++i) { │ │ │ │ │ -1069 //std::cout<size()<size()>0); │ │ │ │ │ -1071 typedef typename DomainIterator::value_type::const_iterator │ │ │ │ │ -_e_n_t_r_y___i_t_e_r_a_t_o_r; │ │ │ │ │ -1072 Dune::dvverb<<"domain "<begin(); entry != _d->end(); ++entry) { │ │ │ │ │ -1074 Dune::dvverb<<" "<<*entry; │ │ │ │ │ -1075 } │ │ │ │ │ -1076 Dune::dvverb<begin(); row != _d_o_m_a_i_n->end(); ++row) │ │ │ │ │ -1089 _r_o_w_T_o_D_o_m_a_i_n[*row].push_back(_d_o_m_a_i_n_I_d); │ │ │ │ │ -1090 } │ │ │ │ │ -1091 │ │ │ │ │ -1092 maxlength = _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_<_s_l_u_> │ │ │ │ │ -1093_ _:_:_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s(_r_o_w_T_o_D_o_m_a_i_n, mat, solvers, subDomains, onTheFly); │ │ │ │ │ -1094 } │ │ │ │ │ -1095 │ │ │ │ │ -1102 template │ │ │ │ │ -_1_1_0_3 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e {}; │ │ │ │ │ -1104 │ │ │ │ │ -1105 template │ │ │ │ │ -_1_1_0_6 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ │ -1107 { │ │ │ │ │ -_1_1_0_8 static constexpr size_t n = std::decay_t()))>::rows; │ │ │ │ │ -_1_1_0_9 static constexpr size_t m = std::decay_t()))>::cols; │ │ │ │ │ -1110 template │ │ │ │ │ -_1_1_1_1 static int _s_i_z_e(const Domain & d) │ │ │ │ │ -1112 { │ │ │ │ │ -1113 assert(n==m); │ │ │ │ │ -1114 return m*d.size(); │ │ │ │ │ -1115 } │ │ │ │ │ -1116 }; │ │ │ │ │ -1117 │ │ │ │ │ -1118 template │ │ │ │ │ -1119 template │ │ │ │ │ -1120 std::size_t │ │ │ │ │ -_1_1_2_1 _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_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_< │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_>, X, Y >,false>:: │ │ │ │ │ -1122 assembleLocalProblems([[maybe_unused]] const RowToDomain& rowToDomain, │ │ │ │ │ -1123 [[maybe_unused]] const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ -1124 [[maybe_unused]] Solvers& solvers, │ │ │ │ │ -1125 const SubDomains& subDomains, │ │ │ │ │ -1126 [[maybe_unused]] bool onTheFly) │ │ │ │ │ -1127 { │ │ │ │ │ -1128 typedef typename SubDomains::const_iterator DomainIterator; │ │ │ │ │ -1129 std::size_t maxlength = 0; │ │ │ │ │ -1130 │ │ │ │ │ -1131 assert(onTheFly); │ │ │ │ │ -1132 │ │ │ │ │ -1133 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ -++domain) │ │ │ │ │ -1134 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ -1135 maxlength*=n; │ │ │ │ │ -1136 │ │ │ │ │ -1137 return maxlength; │ │ │ │ │ -1138 } │ │ │ │ │ -1139 │ │ │ │ │ -1140#if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -1141 template class S, typename T, typename A> │ │ │ │ │ -1142 template │ │ │ │ │ -_1_1_4_3 std::size_t │ │ │ │ │ -_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_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>:: │ │ │ │ │ -assembleLocalProblems(const RowToDomain& rowToDomain, │ │ │ │ │ -1144 const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ -1145 Solvers& solvers, │ │ │ │ │ -1146 const SubDomains& subDomains, │ │ │ │ │ -1147 bool onTheFly) │ │ │ │ │ -1148 { │ │ │ │ │ -1149 typedef typename S>::MatrixInitializer MatrixInitializer; │ │ │ │ │ -1150 typedef typename std::vector::iterator │ │ │ │ │ -InitializerIterator; │ │ │ │ │ -1151 typedef typename SubDomains::const_iterator DomainIterator; │ │ │ │ │ -1152 typedef typename Solvers::iterator SolverIterator; │ │ │ │ │ -1153 std::size_t maxlength = 0; │ │ │ │ │ -1154 │ │ │ │ │ -1155 if(onTheFly) { │ │ │ │ │ -1156 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ -++domain) │ │ │ │ │ -1157 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ -1158 maxlength*=Impl::asMatrix(*_m_a_t[0].begin()).N(); │ │ │ │ │ -1159 }else{ │ │ │ │ │ -1160 // initialize the initializers │ │ │ │ │ -1161 DomainIterator domain=subDomains.begin(); │ │ │ │ │ -1162 │ │ │ │ │ -1163 // Create the initializers list. │ │ │ │ │ -1164 std::vector initializers(subDomains.size()); │ │ │ │ │ -1165 │ │ │ │ │ -1166 SolverIterator solver=solvers.begin(); │ │ │ │ │ -1167 for(InitializerIterator initializer=initializers.begin(); │ │ │ │ │ -initializer!=initializers.end(); │ │ │ │ │ -1168 ++initializer, ++solver, ++domain) { │ │ │ │ │ -1169 solver->getInternalMatrix │ │ │ │ │ -().N_=_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e_<_m_a_t_r_i_x___t_y_p_e_>_:_:_s_i_z_e(*domain); │ │ │ │ │ -1170 solver->getInternalMatrix │ │ │ │ │ -().M_=_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_D_o_m_a_i_n_S_i_z_e_<_m_a_t_r_i_x___t_y_p_e_>_:_:_s_i_z_e(*domain); │ │ │ │ │ -1171 //solver->setVerbosity(true); │ │ │ │ │ -1172 *initializer=MatrixInitializer(solver->getInternalMatrix()); │ │ │ │ │ -1173 } │ │ │ │ │ -1174 │ │ │ │ │ -1175 // Set up the supermatrices according to the subdomains │ │ │ │ │ -1176 typedef _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_<_s_t_d_:_:_v_e_c_t_o_r_<_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_>, │ │ │ │ │ -1177 RowToDomain, SubDomains> Initializer; │ │ │ │ │ -1178 │ │ │ │ │ -1179 Initializer initializer(initializers, rowToDomain, subDomains); │ │ │ │ │ -1180 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ │ -1181 │ │ │ │ │ -1182 // Calculate the LU decompositions │ │ │ │ │ -1183 for(auto&& s: solvers) │ │ │ │ │ -1184 s.decompose(); │ │ │ │ │ -1185 for (SolverIterator solverIt = solvers.begin(); solverIt != solvers.end(); │ │ │ │ │ -++solverIt) │ │ │ │ │ -1186 { │ │ │ │ │ -1187 assert(solverIt->getInternalMatrix().N() == solverIt->getInternalMatrix │ │ │ │ │ -().M()); │ │ │ │ │ -1188 maxlength = std::max(maxlength, solverIt->getInternalMatrix().N()); │ │ │ │ │ -1189 } │ │ │ │ │ -1190 } │ │ │ │ │ -1191 return maxlength; │ │ │ │ │ -1192 } │ │ │ │ │ -1193 │ │ │ │ │ -1194#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -1195 │ │ │ │ │ -1196 template │ │ │ │ │ -1197 template │ │ │ │ │ -_1_1_9_8 std::size_t _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_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_: │ │ │ │ │ -_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s([[maybe_unused]] const RowToDomain& rowToDomain, │ │ │ │ │ -1199 const _m_a_t_r_i_x___t_y_p_e& _m_a_t, │ │ │ │ │ -1200 Solvers& solvers, │ │ │ │ │ -1201 const SubDomains& subDomains, │ │ │ │ │ -1202 bool onTheFly) │ │ │ │ │ -1203 { │ │ │ │ │ -1204 typedef typename SubDomains::const_iterator DomainIterator; │ │ │ │ │ -1205 typedef typename Solvers::iterator SolverIterator; │ │ │ │ │ -1206 std::size_t maxlength = 0; │ │ │ │ │ -1207 │ │ │ │ │ -1208 if(onTheFly) { │ │ │ │ │ -1209 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ -++domain) │ │ │ │ │ -1210 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ -1211 }else{ │ │ │ │ │ -1212 // initialize the solvers of the local prolems. │ │ │ │ │ -1213 SolverIterator solver=solvers.begin(); │ │ │ │ │ -1214 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); │ │ │ │ │ -1215 ++domain, ++solver) { │ │ │ │ │ -1216 solver->setSubMatrix(_m_a_t, *domain); │ │ │ │ │ -1217 maxlength=std::max(maxlength, domain->size()); │ │ │ │ │ -1218 } │ │ │ │ │ -1219 } │ │ │ │ │ -1220 │ │ │ │ │ -1221 return maxlength; │ │ │ │ │ -1222 │ │ │ │ │ -1223 } │ │ │ │ │ -1224 │ │ │ │ │ -1225 │ │ │ │ │ -1226 template │ │ │ │ │ -_1_2_2_7 void _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_D_,_T_A_>_:_:_a_p_p_l_y(X& x, const X& b) │ │ │ │ │ -1228 { │ │ │ │ │ -1229 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_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_>_:_:_a_p_p_l_y(*this, x, b); │ │ │ │ │ -1230 } │ │ │ │ │ -1231 │ │ │ │ │ -1232 template │ │ │ │ │ -1233 template │ │ │ │ │ -_1_2_3_4 void _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_D_,_T_A_>_:_:_a_p_p_l_y(X& x, const X& b) │ │ │ │ │ -1235 { │ │ │ │ │ -1236 typedef _s_l_u___v_e_c_t_o_r solver_vector; │ │ │ │ │ -1237 typedef typename │ │ │ │ │ -_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_: │ │ │ │ │ -_s_o_l_v_e_r___i_t_e_r_a_t_o_r iterator; │ │ │ │ │ -1238 typedef typename │ │ │ │ │ -_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_: │ │ │ │ │ -_d_o_m_a_i_n___i_t_e_r_a_t_o_r │ │ │ │ │ -1239 domain_iterator; │ │ │ │ │ -1240 │ │ │ │ │ -1241 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_T_D_> assigner(maxlength, _m_a_t, b, x); │ │ │ │ │ -1242 │ │ │ │ │ -1243 domain_iterator │ │ │ │ │ -_d_o_m_a_i_n=_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_:_b_e_g_i_n │ │ │ │ │ -(subDomains); │ │ │ │ │ -1244 iterator solver = │ │ │ │ │ -_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_:_b_e_g_i_n │ │ │ │ │ -(solvers); │ │ │ │ │ -1245 X v(x); // temporary for the update │ │ │ │ │ -1246 v=0; │ │ │ │ │ -1247 │ │ │ │ │ -1248 typedef typename _A_d_d_e_r_S_e_l_e_c_t_o_r_<_T_M_,_X_,_T_D_ _>_:_:_A_d_d_e_r Adder; │ │ │ │ │ -1249 Adder adder(v, x, assigner, relax); │ │ │ │ │ -1250 │ │ │ │ │ -1251 for(; _d_o_m_a_i_n != │ │ │ │ │ -_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_s_o_l_v_e_r___v_e_c_t_o_r_,_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r_,_f_o_r_w_a_r_d_>_:_:_e_n_d │ │ │ │ │ -(subDomains); ++_d_o_m_a_i_n) { │ │ │ │ │ -1252 //Copy rhs to C-array for SuperLU │ │ │ │ │ -1253 std::for_each(_d_o_m_a_i_n->begin(), _d_o_m_a_i_n->end(), assigner); │ │ │ │ │ -1254 assigner.resetIndexForNextDomain(); │ │ │ │ │ -1255 if(onTheFly) { │ │ │ │ │ -1256 // Create the subdomain solver │ │ │ │ │ -1257 _s_l_u _s_d_s_o_l_v_e_r; │ │ │ │ │ -1258 _s_d_s_o_l_v_e_r.setSubMatrix(_m_a_t, *_d_o_m_a_i_n); │ │ │ │ │ -1259 // Apply │ │ │ │ │ -1260 _s_d_s_o_l_v_e_r.apply(assigner.lhs(), assigner.rhs()); │ │ │ │ │ -1261 }else{ │ │ │ │ │ -1262 solver->apply(assigner.lhs(), assigner.rhs()); │ │ │ │ │ -1263 ++solver; │ │ │ │ │ -1264 } │ │ │ │ │ -1265 │ │ │ │ │ -1266 //Add relaxed correction to from SuperLU to v │ │ │ │ │ -1267 std::for_each(_d_o_m_a_i_n->begin(), _d_o_m_a_i_n->end(), adder); │ │ │ │ │ -1268 assigner.resetIndexForNextDomain(); │ │ │ │ │ -1269 │ │ │ │ │ -1270 } │ │ │ │ │ -1271 │ │ │ │ │ -1272 adder.axpy(); │ │ │ │ │ -1273 assigner.deallocate(); │ │ │ │ │ -1274 } │ │ │ │ │ -1275 │ │ │ │ │ -1276 template │ │ │ │ │ -1277 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_2_7_8 ::OverlappingAssignerHelper(std::size_t maxlength, const _B_C_R_S_M_a_t_r_i_x_<_K_, │ │ │ │ │ -_A_l_>& mat_, │ │ │ │ │ -1279 const X& b_, Y& x_) : │ │ │ │ │ -1280 _m_a_t(&mat_), │ │ │ │ │ -1281 rhs_( new DynamicVector<_f_i_e_l_d___t_y_p_e>(maxlength, 42) ), │ │ │ │ │ -1282 lhs_( new DynamicVector<_f_i_e_l_d___t_y_p_e>(maxlength, -42) ), │ │ │ │ │ -1283 b(&b_), │ │ │ │ │ -1284 x(&x_), │ │ │ │ │ -1285 i(0), │ │ │ │ │ -1286 maxlength_(maxlength) │ │ │ │ │ -1287 {} │ │ │ │ │ -1288 │ │ │ │ │ -1289 template │ │ │ │ │ -1290 void │ │ │ │ │ -1291 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_2_9_2 ::deallocate() │ │ │ │ │ -1293 { │ │ │ │ │ -1294 delete rhs_; │ │ │ │ │ -1295 delete lhs_; │ │ │ │ │ -1296 } │ │ │ │ │ -1297 │ │ │ │ │ -1298 template │ │ │ │ │ -1299 void │ │ │ │ │ -1300 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_3_0_1 ::resetIndexForNextDomain() │ │ │ │ │ -1302 { │ │ │ │ │ -1303 i=0; │ │ │ │ │ -1304 } │ │ │ │ │ -1305 │ │ │ │ │ -1306 template │ │ │ │ │ -1307 DynamicVector & │ │ │ │ │ -1308 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_3_0_9 ::lhs() │ │ │ │ │ -1310 { │ │ │ │ │ -1311 return *lhs_; │ │ │ │ │ -1312 } │ │ │ │ │ -1313 │ │ │ │ │ -1314 template │ │ │ │ │ -1315 DynamicVector & │ │ │ │ │ -1316 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_3_1_7 ::rhs() │ │ │ │ │ -1318 { │ │ │ │ │ -1319 return *rhs_; │ │ │ │ │ -1320 } │ │ │ │ │ -1321 │ │ │ │ │ -1322 template │ │ │ │ │ -1323 void │ │ │ │ │ -1324 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_3_2_5 ::relaxResult(_f_i_e_l_d___t_y_p_e relax) │ │ │ │ │ -1326 { │ │ │ │ │ -1327 lhs() *= relax; │ │ │ │ │ -1328 } │ │ │ │ │ -1329 │ │ │ │ │ -1330 template │ │ │ │ │ -1331 void │ │ │ │ │ -1332 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_3_3_3 ::operator()(const _s_i_z_e___t_y_p_e& domainIndex) │ │ │ │ │ -1334 { │ │ │ │ │ -1335 lhs() = 0.0; │ │ │ │ │ -1336#if 0 │ │ │ │ │ -1337 //assign right hand side of current domainindex block │ │ │ │ │ -1338 for(_s_i_z_e___t_y_p_e j=0; j │ │ │ │ │ -1376 void │ │ │ │ │ -1377 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_>, X, Y >,false> │ │ │ │ │ -_1_3_7_8 ::assignResult(_b_l_o_c_k___t_y_p_e& res) │ │ │ │ │ -1379 { │ │ │ │ │ -1380 // assign the result of the local solve to the global vector │ │ │ │ │ -1381 for(_s_i_z_e___t_y_p_e j=0; j class S, typename T, typename A> │ │ │ │ │ -1390 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true> │ │ │ │ │ -_1_3_9_1 ::OverlappingAssignerHelper(std::size_t maxlength, │ │ │ │ │ -1392 const _B_C_R_S_M_a_t_r_i_x_<_T_,_A_>& mat_, │ │ │ │ │ -1393 const _r_a_n_g_e___t_y_p_e& b_, │ │ │ │ │ -1394 _r_a_n_g_e___t_y_p_e& x_) │ │ │ │ │ -1395 : _m_a_t(&mat_), │ │ │ │ │ -1396 b(&b_), │ │ │ │ │ -1397 x(&x_), i(0), maxlength_(maxlength) │ │ │ │ │ -1398 { │ │ │ │ │ -1399 rhs_ = new _f_i_e_l_d___t_y_p_e[maxlength]; │ │ │ │ │ -1400 lhs_ = new _f_i_e_l_d___t_y_p_e[maxlength]; │ │ │ │ │ -1401 │ │ │ │ │ -1402 } │ │ │ │ │ -1403 │ │ │ │ │ -1404 template class S, typename T, typename A> │ │ │ │ │ -_1_4_0_5 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_> >,true>::deallocate() │ │ │ │ │ -1406 { │ │ │ │ │ -1407 delete[] rhs_; │ │ │ │ │ -1408 delete[] lhs_; │ │ │ │ │ -1409 } │ │ │ │ │ -1410 │ │ │ │ │ -1411 template class S, typename T, typename A> │ │ │ │ │ -_1_4_1_2 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::operator()(const │ │ │ │ │ -_s_i_z_e___t_y_p_e& domainIndex) │ │ │ │ │ -1413 { │ │ │ │ │ -1414 //assign right hand side of current domainindex block │ │ │ │ │ -1415 // rhs is an array of doubles! │ │ │ │ │ -1416 // rhs[starti] = b[domainindex] │ │ │ │ │ -1417 for(_s_i_z_e___t_y_p_e j=0; j class S, typename T, typename A> │ │ │ │ │ -_1_4_4_1 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::relaxResult │ │ │ │ │ -(_f_i_e_l_d___t_y_p_e relax) │ │ │ │ │ -1442 { │ │ │ │ │ -1443 for(_s_i_z_e___t_y_p_e j=i+n; i class S, typename T, typename A> │ │ │ │ │ -_1_4_5_1 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::assignResult │ │ │ │ │ -(_b_l_o_c_k___t_y_p_e& res) │ │ │ │ │ -1452 { │ │ │ │ │ -1453 // assign the result of the local solve to the global vector │ │ │ │ │ -1454 for(_s_i_z_e___t_y_p_e j=0; j class S, typename T, typename A> │ │ │ │ │ -_1_4_6_1 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>:: │ │ │ │ │ -resetIndexForNextDomain() │ │ │ │ │ -1462 { │ │ │ │ │ -1463 i=0; │ │ │ │ │ -1464 } │ │ │ │ │ -1465 │ │ │ │ │ -1466 template class S, typename T, typename A> │ │ │ │ │ -1467 typename _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::field_type* │ │ │ │ │ -_1_4_6_8 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::lhs() │ │ │ │ │ -1469 { │ │ │ │ │ -1470 return lhs_; │ │ │ │ │ -1471 } │ │ │ │ │ -1472 │ │ │ │ │ -1473 template class S, typename T, typename A> │ │ │ │ │ -1474 typename _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::field_type* │ │ │ │ │ -_1_4_7_5 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_S_<_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>>,true>::rhs() │ │ │ │ │ -1476 { │ │ │ │ │ -1477 return rhs_; │ │ │ │ │ -1478 } │ │ │ │ │ -1479 │ │ │ │ │ -1480#endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -1481 │ │ │ │ │ -1482 template │ │ │ │ │ -_1_4_8_3 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e(std::size_t │ │ │ │ │ -maxlength, │ │ │ │ │ -1484 const M& mat_, │ │ │ │ │ -1485 const Y& b_, │ │ │ │ │ -1486 X& x_) │ │ │ │ │ -1487 : _m_a_t(&mat_), │ │ │ │ │ -1488 b(&b_), │ │ │ │ │ -1489 x(&x_), i(0) │ │ │ │ │ -1490 { │ │ │ │ │ -1491 rhs_= new Y(maxlength); │ │ │ │ │ -1492 lhs_ = new X(maxlength); │ │ │ │ │ -1493 } │ │ │ │ │ -1494 │ │ │ │ │ -1495 template │ │ │ │ │ -_1_4_9_6 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_d_e_a_l_l_o_c_a_t_e() │ │ │ │ │ -1497 { │ │ │ │ │ -1498 delete rhs_; │ │ │ │ │ -1499 delete lhs_; │ │ │ │ │ -1500 } │ │ │ │ │ -1501 │ │ │ │ │ -1502 template │ │ │ │ │ -_1_5_0_3 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_o_p_e_r_a_t_o_r_(_)(const _s_i_z_e___t_y_p_e& │ │ │ │ │ -domainIndex) │ │ │ │ │ -1504 { │ │ │ │ │ -1505 (*rhs_)[i]=(*b)[domainIndex]; │ │ │ │ │ -1506 │ │ │ │ │ -1507 // loop over all Matrix row entries and calculate defect. │ │ │ │ │ -1508 typedef typename matrix_type::ConstColIterator col_iterator; │ │ │ │ │ -1509 │ │ │ │ │ -1510 // calculate defect for current row index block │ │ │ │ │ -1511 for(col_iterator _c_o_l=(*_m_a_t)[domainIndex].begin(); _c_o_l!=(*mat) │ │ │ │ │ -[domainIndex].end(); ++_c_o_l) { │ │ │ │ │ -1512 Impl::asMatrix(*col).mmv((*x)[_c_o_l.index()], (*rhs_)[i]); │ │ │ │ │ -1513 } │ │ │ │ │ -1514 // Goto next local index │ │ │ │ │ -1515 ++i; │ │ │ │ │ -1516 } │ │ │ │ │ -1517 │ │ │ │ │ -1518 template │ │ │ │ │ -_1_5_1_9 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_r_e_l_a_x_R_e_s_u_l_t(_f_i_e_l_d___t_y_p_e relax) │ │ │ │ │ -1520 { │ │ │ │ │ -1521 (*lhs_)[i]*=relax; │ │ │ │ │ -1522 } │ │ │ │ │ -1523 │ │ │ │ │ -1524 template │ │ │ │ │ -_1_5_2_5 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_a_s_s_i_g_n_R_e_s_u_l_t(_b_l_o_c_k___t_y_p_e& res) │ │ │ │ │ -1526 { │ │ │ │ │ -1527 res+=(*lhs_)[i++]; │ │ │ │ │ -1528 } │ │ │ │ │ -1529 │ │ │ │ │ -1530 template │ │ │ │ │ -_1_5_3_1 X& _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_l_h_s() │ │ │ │ │ -1532 { │ │ │ │ │ -1533 return *lhs_; │ │ │ │ │ -1534 } │ │ │ │ │ -1535 │ │ │ │ │ -1536 template │ │ │ │ │ -_1_5_3_7 Y& _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_r_h_s() │ │ │ │ │ -1538 { │ │ │ │ │ -1539 return *rhs_; │ │ │ │ │ -1540 } │ │ │ │ │ -1541 │ │ │ │ │ -1542 template │ │ │ │ │ -_1_5_4_3 void _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_<_M_,_X_,_Y_>_:_:_r_e_s_e_t_I_n_d_e_x_F_o_r_N_e_x_t_D_o_m_a_i_n() │ │ │ │ │ -1544 { │ │ │ │ │ -1545 i=0; │ │ │ │ │ -1546 } │ │ │ │ │ -1547 │ │ │ │ │ -1548 template │ │ │ │ │ -_1_5_4_9 _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::AdditiveAdder(_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v_, │ │ │ │ │ -1550 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x_, │ │ │ │ │ -1551 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner_, │ │ │ │ │ -1552 const _f_i_e_l_d___t_y_p_e& relax_) │ │ │ │ │ -1553 : v(&v_), x(&x_), assigner(&assigner_), relax(relax_) │ │ │ │ │ -1554 {} │ │ │ │ │ -1555 │ │ │ │ │ -1556 template │ │ │ │ │ -_1_5_5_7 void _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::operator()(const _s_i_z_e___t_y_p_e& │ │ │ │ │ -domainIndex) │ │ │ │ │ -1558 { │ │ │ │ │ -1559 // add the result of the local solve to the current update │ │ │ │ │ -1560 assigner->assignResult((*v)[domainIndex]); │ │ │ │ │ -1561 } │ │ │ │ │ -1562 │ │ │ │ │ -1563 │ │ │ │ │ -1564 template │ │ │ │ │ -_1_5_6_5 void _A_d_d_i_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::axpy() │ │ │ │ │ -1566 { │ │ │ │ │ -1567 // relax the update and add it to the current guess. │ │ │ │ │ -1568 x->axpy(relax,*v); │ │ │ │ │ -1569 } │ │ │ │ │ -1570 │ │ │ │ │ -1571 │ │ │ │ │ -1572 template │ │ │ │ │ -1573 _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> > │ │ │ │ │ -_1_5_7_4 ::MultiplicativeAdder([[maybe_unused]] _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& v_, │ │ │ │ │ -1575 _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& x_, │ │ │ │ │ -1576 _O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_<_S_>& assigner_, const _f_i_e_l_d___t_y_p_e& relax_) │ │ │ │ │ -1577 : x(&x_), assigner(&assigner_), relax(relax_) │ │ │ │ │ -1578 {} │ │ │ │ │ -1579 │ │ │ │ │ -1580 │ │ │ │ │ -1581 template │ │ │ │ │ -_1_5_8_2 void _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::operator()(const _s_i_z_e___t_y_p_e& │ │ │ │ │ -domainIndex) │ │ │ │ │ -1583 { │ │ │ │ │ -1584 // add the result of the local solve to the current guess │ │ │ │ │ -1585 assigner->relaxResult(relax); │ │ │ │ │ -1586 assigner->assignResult((*x)[domainIndex]); │ │ │ │ │ -1587 } │ │ │ │ │ -1588 │ │ │ │ │ -1589 │ │ │ │ │ -1590 template │ │ │ │ │ -_1_5_9_1 void _M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_S_,_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> >::axpy() │ │ │ │ │ -1592 { │ │ │ │ │ -1593 // nothing to do, as the corrections already relaxed and added in operator │ │ │ │ │ -() │ │ │ │ │ -1594 } │ │ │ │ │ -1595 │ │ │ │ │ -1596 │ │ │ │ │ -1598} │ │ │ │ │ -1599 │ │ │ │ │ -1600#endif │ │ │ │ │ -_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_t_y_p_e_._h_h │ │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ │ -_i_l_u_s_u_b_d_o_m_a_i_n_s_o_l_v_e_r_._h_h │ │ │ │ │ -Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ │ │ -_u_m_f_p_a_c_k_._h_h │ │ │ │ │ -Classes for using UMFPack with ISTL matrices. │ │ │ │ │ -_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ -Define general preconditioner interface. │ │ │ │ │ -_s_u_p_e_r_l_u_._h_h │ │ │ │ │ -Classes for using SuperLU with ISTL matrices. │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +240#endif │ │ │ │ │ +_n_o_v_l_p_s_c_h_w_a_r_z_._h_h │ │ │ │ │ +_s_c_h_w_a_r_z_._h_h │ │ │ │ │ +_s_o_l_v_e_r_._h_h │ │ │ │ │ +Define general, extensible interface for inverse operators. │ │ │ │ │ +_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h │ │ │ │ │ _m_a_t │ │ │ │ │ Matrix & mat │ │ │ │ │ DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_a_d_d_R_o_w_N_n_z │ │ │ │ │ -void addRowNnz(const Iter &row) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:895 │ │ │ │ │ -_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_p_p_l_y │ │ │ │ │ -void apply(X &v, const X &d) │ │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1234 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_l_h_s │ │ │ │ │ -X & lhs() │ │ │ │ │ -Get the local left hand side. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1531 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_a_l_c_C_o_l_s_t_a_r_t │ │ │ │ │ -void calcColstart() const │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:926 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_r_h_s │ │ │ │ │ -Y & rhs() │ │ │ │ │ -Get the local right hand side. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1537 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_e_n_d │ │ │ │ │ -iterator end() │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:989 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_r_e_s_e_t_I_n_d_e_x_F_o_r_N_e_x_t_D_o_m_a_i_n │ │ │ │ │ -void resetIndexForNextDomain() │ │ │ │ │ -Resets the local index to zero. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1543 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_o_p_y_V_a_l_u_e │ │ │ │ │ -void copyValue(const Iter &row, const CIter &col) const │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:933 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_r_e_a_t_e_M_a_t_r_i_x │ │ │ │ │ -void createMatrix() const │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:947 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ -iterator begin() │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1003 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_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 │ │ │ │ │ -OverlappingSchwarzInitializer(InitializerList &il, const IndexSet &indices, │ │ │ │ │ -const subdomain_vector &domains) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:887 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_I_n_d_e_x_M_a_p │ │ │ │ │ -IndexMap() │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:955 │ │ │ │ │ -_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_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const X &d) │ │ │ │ │ -Apply the precondtioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1227 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ -OverlappingAssignerILUBase(std::size_t maxlength, const M &mat, const Y &b, X │ │ │ │ │ -&x) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1483 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_f_i_n_d │ │ │ │ │ -const_iterator find(size_type grow) const │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:968 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const size_type &domain) │ │ │ │ │ -calculate one entry of the local defect. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1503 │ │ │ │ │ -_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_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ -SeqOverlappingSchwarz(const matrix_type &mat, const subdomain_vector │ │ │ │ │ -&subDomains, field_type relaxationFactor=1, bool onTheFly_=true) │ │ │ │ │ -Construct the overlapping Schwarz method. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1056 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ -void allocate() │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:905 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_d_e_a_l_l_o_c_a_t_e │ │ │ │ │ -void deallocate() │ │ │ │ │ -Deallocates memory of the local vector. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1496 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_M_a_p_:_:_i_n_s_e_r_t │ │ │ │ │ -void insert(size_type grow) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:960 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_c_o_u_n_t_E_n_t_r_i_e_s │ │ │ │ │ -void countEntries(const Iter &row, const CIter &col) const │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:914 │ │ │ │ │ -_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_I_L_U_B_a_s_e_:_:_a_s_s_e_m_b_l_e_L_o_c_a_l_P_r_o_b_l_e_m_s │ │ │ │ │ -static std::size_t assembleLocalProblems(const RowToDomain &rowToDomain, const │ │ │ │ │ -matrix_type &mat, Solvers &solvers, const SubDomains &domains, bool onTheFly) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1198 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_r_e_l_a_x_R_e_s_u_l_t │ │ │ │ │ -void relaxResult(field_type relax) │ │ │ │ │ -relax the result. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1519 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_a_s_s_i_g_n_R_e_s_u_l_t │ │ │ │ │ -void assignResult(block_type &res) │ │ │ │ │ -Assigns the block to the current local index. At the same time the local defect │ │ │ │ │ -is calculated for the... │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1525 │ │ │ │ │ -_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_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ -SeqOverlappingSchwarz(const matrix_type &mat, const rowtodomain_vector │ │ │ │ │ -&rowToDomain, field_type relaxationFactor=1, bool onTheFly_=true) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1009 │ │ │ │ │ +_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y │ │ │ │ │ +Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > > │ │ │ │ │ +PreconditionerFactory │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ │ +Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > > │ │ │ │ │ +DirectSolverFactory │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ │ +std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< │ │ │ │ │ +LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, │ │ │ │ │ +const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &) │ │ │ │ │ +IterativeSolverSignature │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l │ │ │ │ │ +std::shared_ptr< Preconditioner > wrapPreconditioner4Parallel(const std:: │ │ │ │ │ +shared_ptr< Preconditioner > &prec, const O &) │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ │ +std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &) │ │ │ │ │ +DirectSolverSignature │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y │ │ │ │ │ +std::shared_ptr< InverseOperator< typename Operator::domain_type, typename │ │ │ │ │ +Operator::range_type > > getSolverFromFactory(std::shared_ptr< Operator > op, │ │ │ │ │ +const ParameterTree &config, std::shared_ptr< Preconditioner< typename │ │ │ │ │ +Operator::domain_type, typename Operator::range_type > > prec=nullptr) │ │ │ │ │ +Instantiates an InverseOperator from an Operator and a configuration given as a │ │ │ │ │ +ParameterTree. │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:227 │ │ │ │ │ +_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ │ +Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > > │ │ │ │ │ +IterativeSolverFactory │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:42 │ │ │ │ │ +_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ │ +std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const │ │ │ │ │ +ParameterTree &) PreconditionerSignature │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:34 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ -Initializer for SuperLU Matrices representing the subdomains. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_C_I_t_e_r │ │ │ │ │ -Matrix::row_type::const_iterator CIter │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_d_e_x_S_e_t │ │ │ │ │ -S IndexSet │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_t_e_r │ │ │ │ │ -Matrix::const_iterator Iter │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -IndexSet::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_I_n_i_t_i_a_l_i_z_e_r_L_i_s_t │ │ │ │ │ -I InitializerList │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ -AtomInitializer::Matrix Matrix │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_A_t_o_m_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ -InitializerList::value_type AtomInitializer │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ -D subdomain_vector │ │ │ │ │ -The vector type containing the subdomain to row index mapping. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -Iterator end() │ │ │ │ │ -Get iterator to one beyond last row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:681 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -The type for the index access and the size. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -row_type::ConstIterator ConstColIterator │ │ │ │ │ -Const iterator to the entries of a row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:741 │ │ │ │ │ -_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:395 │ │ │ │ │ -_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_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:111 │ │ │ │ │ -_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_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:783 │ │ │ │ │ -_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_:_:_s_u_b_d_o_m_a_i_n___l_i_s_t │ │ │ │ │ -SLList< size_type, typename std::allocator_traits< TA >::template rebind_alloc< │ │ │ │ │ -size_type > > subdomain_list │ │ │ │ │ -The type for the row to subdomain mapping. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:800 │ │ │ │ │ -_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_:_:_s_l_u___v_e_c_t_o_r │ │ │ │ │ -std::vector< slu, typename std::allocator_traits< TA >::template rebind_alloc< │ │ │ │ │ -slu > > slu_vector │ │ │ │ │ -The vector type containing subdomain solvers. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:809 │ │ │ │ │ -_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_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -The type of the matrix to precondition. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:760 │ │ │ │ │ -_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_:_:_M_o_d_e │ │ │ │ │ -TM Mode │ │ │ │ │ -The mode (additive or multiplicative) of the Schwarz method. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:778 │ │ │ │ │ -_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -X range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:770 │ │ │ │ │ -_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_:_:_s_u_b_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -std::set< size_type, std::less< size_type >, typename std::allocator_traits< TA │ │ │ │ │ ->::template rebind_alloc< size_type > > subdomain_type │ │ │ │ │ -The type for the subdomain to row index mapping. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:794 │ │ │ │ │ -_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:765 │ │ │ │ │ -_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_:_:_s_l_u │ │ │ │ │ -TD slu │ │ │ │ │ -The type for the subdomain solver in use. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:806 │ │ │ │ │ -_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:868 │ │ │ │ │ -_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_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, X &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:846 │ │ │ │ │ -_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_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Postprocess the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:861 │ │ │ │ │ -_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_l_l_o_c_a_t_o_r │ │ │ │ │ -TA allocator │ │ │ │ │ -The allocator to use. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:789 │ │ │ │ │ -_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_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ -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. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:797 │ │ │ │ │ -_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_:_:_r_o_w_t_o_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ -std::vector< subdomain_list, typename std::allocator_traits< TA >::template │ │ │ │ │ -rebind_alloc< subdomain_list > > rowtodomain_vector │ │ │ │ │ -The vector type containing the row index to subdomain mapping. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:803 │ │ │ │ │ -_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_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -matrix_type::size_type size_type │ │ │ │ │ -The return type of the size method. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:786 │ │ │ │ │ -_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_:_:_A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e │ │ │ │ │ -Tag that the tells the Schwarz method to be additive. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_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 │ │ │ │ │ -Tag that tells the Schwarz method to be multiplicative. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_S_y_m_m_e_t_r_i_c_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 │ │ │ │ │ -Tag that tells the Schwarz method to be multiplicative and symmetric. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:133 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -Exact subdomain solver using Dune::DynamicMatrix::solve. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_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 overlappingschwarz.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ -void setSubMatrix(const M &BCRS, S &rowset) │ │ │ │ │ -Set the data of the local problem. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:184 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_a_p_p_l_y │ │ │ │ │ -void apply(DynamicVector< field_type > &v, DynamicVector< field_type > &d) │ │ │ │ │ -Apply the subdomain solver. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:162 │ │ │ │ │ -_D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_:_:_r_i_l_u___t_y_p_e │ │ │ │ │ -std::remove_const< M >::type rilu_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:151 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:215 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -matrix_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:229 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:226 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -BCRSMatrix< K, Al > matrix_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:225 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:227 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _K_, │ │ │ │ │ -_A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -range_type::block_type block_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:228 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -S< BCRSMatrix< T, A > >::range_type range_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:315 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -range_type::block_type block_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:317 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -range_type::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:316 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -matrix_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:319 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -BCRSMatrix< T, A > matrix_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:314 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:400 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -matrix_type::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:408 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -Y::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:404 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -Y::block_type block_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:406 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_I_L_U_B_a_s_e_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:402 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_: │ │ │ │ │ -_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ -OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X │ │ │ │ │ -&x) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:493 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r_<_ _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_: │ │ │ │ │ -_O_v_e_r_l_a_p_p_i_n_g_A_s_s_i_g_n_e_r_H_e_l_p_e_r │ │ │ │ │ -OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X │ │ │ │ │ -&x) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:512 │ │ │ │ │ -_D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:520 │ │ │ │ │ -_D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type │ │ │ │ │ -field_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:526 │ │ │ │ │ -_D_u_n_e_:_:_A_d_d_i_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:525 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:542 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:547 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_p_l_i_c_a_t_i_v_e_A_d_d_e_r_<_ _S_,_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type │ │ │ │ │ -field_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:548 │ │ │ │ │ -_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ -template meta program for choosing how to add the correction. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:572 │ │ │ │ │ -_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _A_d_d_i_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_ _X_,_ _S_ _>_:_:_A_d_d_e_r │ │ │ │ │ -AdditiveAdder< S, X > Adder │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:577 │ │ │ │ │ -_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _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_,_ _X_,_ _S_ _>_:_:_A_d_d_e_r │ │ │ │ │ -MultiplicativeAdder< S, X > Adder │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:583 │ │ │ │ │ -_D_u_n_e_:_:_A_d_d_e_r_S_e_l_e_c_t_o_r_<_ _S_y_m_m_e_t_r_i_c_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_,_ _X_,_ _S_ _>_:_:_A_d_d_e_r │ │ │ │ │ -MultiplicativeAdder< S, X > Adder │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:589 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r │ │ │ │ │ -Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:605 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ -static solver_iterator begin(solver_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:611 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_s_o_l_v_e_r___i_t_e_r_a_t_o_r │ │ │ │ │ -solver_vector::iterator solver_iterator │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:607 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ -static domain_iterator end(const subdomain_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:625 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_d_o_m_a_i_n___i_t_e_r_a_t_o_r │ │ │ │ │ -subdomain_vector::const_iterator domain_iterator │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:609 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_s_o_l_v_e_r___v_e_c_t_o_r │ │ │ │ │ -T1 solver_vector │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:606 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ -static domain_iterator begin(const subdomain_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:620 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ -T2 subdomain_vector │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:608 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_:_:_e_n_d │ │ │ │ │ -static solver_iterator end(solver_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:616 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ │ -T2 subdomain_vector │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:636 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_e_n_d │ │ │ │ │ -static solver_iterator end(solver_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:644 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_s_o_l_v_e_r___i_t_e_r_a_t_o_r │ │ │ │ │ -solver_vector::reverse_iterator solver_iterator │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:635 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_d_o_m_a_i_n___i_t_e_r_a_t_o_r │ │ │ │ │ -subdomain_vector::const_reverse_iterator domain_iterator │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:637 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_b_e_g_i_n │ │ │ │ │ -static solver_iterator begin(solver_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:639 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_s_o_l_v_e_r___v_e_c_t_o_r │ │ │ │ │ -T1 solver_vector │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:634 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_b_e_g_i_n │ │ │ │ │ -static domain_iterator begin(const subdomain_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:648 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_o_r_D_i_r_e_c_t_i_o_n_S_e_l_e_c_t_o_r_<_ _T_1_,_ _T_2_,_ _f_a_l_s_e_ _>_:_:_e_n_d │ │ │ │ │ -static domain_iterator end(const subdomain_vector &sv) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:653 │ │ │ │ │ -_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_p_p_l_i_e_r │ │ │ │ │ -Helper template meta program for application of overlapping Schwarz. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:669 │ │ │ │ │ -_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_p_p_l_i_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -smoother::range_type range_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:671 │ │ │ │ │ -_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_p_p_l_i_e_r_:_:_s_m_o_o_t_h_e_r │ │ │ │ │ -T smoother │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:670 │ │ │ │ │ -_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_p_p_l_i_e_r_:_:_a_p_p_l_y │ │ │ │ │ -static void apply(smoother &sm, range_type &v, const range_type &b) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:673 │ │ │ │ │ -_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_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_, │ │ │ │ │ -_S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ │ -static void apply(smoother &sm, range_type &v, const range_type &b) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:685 │ │ │ │ │ -_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_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_, │ │ │ │ │ -_S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _>_:_:_s_m_o_o_t_h_e_r │ │ │ │ │ -SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > │ │ │ │ │ -smoother │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:682 │ │ │ │ │ -_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_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_, │ │ │ │ │ -_S_y_m_m_e_t_r_i_c_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_,_ _T_D_,_ _T_A_ _>_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -smoother::range_type range_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:683 │ │ │ │ │ -_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_<_ _D_y_n_a_m_i_c_M_a_t_r_i_x_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_< │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x_<_ _K_,_ _A_l_ _>_,_ _X_,_ _Y_ _>_,_ _f_a_l_s_e_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -BCRSMatrix< K, Al > matrix_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:702 │ │ │ │ │ -_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_<_ _S_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_,_ _t_r_u_e_ _>_:_: │ │ │ │ │ -_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -BCRSMatrix< T, A > matrix_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:713 │ │ │ │ │ -_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_I_L_U_B_a_s_e │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:723 │ │ │ │ │ -_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_I_L_U_B_a_s_e_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:724 │ │ │ │ │ -_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_D_o_m_a_i_n_S_i_z_e │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1103 │ │ │ │ │ -_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_D_o_m_a_i_n_S_i_z_e_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_s_i_z_e │ │ │ │ │ -static int size(const Domain &d) │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:1111 │ │ │ │ │ +_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_:_:_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:137 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ +An overlapping Schwarz operator. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ │ _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ Base class for matrix free definition of preconditioners. │ │ │ │ │ DDeeffiinniittiioonn preconditioner.hh: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 │ │ │ │ │ -Category │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_ _D_o_m_a_i_n_,_ _R_a_n_g_e_ _> │ │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ │ @ sequential │ │ │ │ │ Category for sequential solvers. │ │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ │ +Factory to assembly solvers configured by a ParameterTree. │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:145 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_:_:_g_e_t │ │ │ │ │ +static std::shared_ptr< Solver > get(std::shared_ptr< Operator > op, const │ │ │ │ │ +ParameterTree &config, std::shared_ptr< Preconditioner > prec=nullptr) │ │ │ │ │ +get a solver from the factory │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:168 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_:_:_g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +static std::shared_ptr< Preconditioner > getPreconditioner(std::shared_ptr< │ │ │ │ │ +Operator > op, const ParameterTree &config) │ │ │ │ │ +Construct a Preconditioner for a given Operator. │ │ │ │ │ +DDeeffiinniittiioonn solverfactory.hh:203 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: novlpschwarz.hh File Reference │ │ │ │ +dune-istl: schwarz.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,45 +72,47 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
novlpschwarz.hh File Reference
│ │ │ │ +
schwarz.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │
#include <iostream>
│ │ │ │ #include <fstream>
│ │ │ │ #include <vector>
│ │ │ │ #include <sstream>
│ │ │ │ #include <cmath>
│ │ │ │ #include <dune/common/timer.hh>
│ │ │ │ -#include <dune/common/hybridutilities.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"
│ │ │ │ +#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"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::NonoverlappingSchwarzOperator< M, X, Y, C >
 A nonoverlapping operator with communication object. More...
class  Dune::OverlappingSchwarzOperator< M, X, Y, C >
 An overlapping Schwarz operator. More...
 
class  Dune::NonoverlappingBlockPreconditioner< C, P >
 Nonoverlapping parallel preconditioner. More...
class  Dune::ParSSOR< M, X, Y, C >
 A parallel SSOR preconditioner. More...
 
class  Dune::BlockPreconditioner< X, Y, C, P >
 Block parallel preconditioner. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,40 +1,42 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -novlpschwarz.hh File Reference │ │ │ │ │ +schwarz.hh File Reference │ │ │ │ │ #include │ │ │ │ │ #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" │ │ │ │ │ _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_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 nonoverlapping operator 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_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_:_:_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_,_ _P_ _> │ │ │ │ │ -  Nonoverlapping parallel preconditioner. _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_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: novlpschwarz.hh Source File │ │ │ │ +dune-istl: schwarz.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,381 +74,302 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
novlpschwarz.hh
│ │ │ │ +
schwarz.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_NOVLPSCHWARZ_HH
│ │ │ │ -
6#define DUNE_ISTL_NOVLPSCHWARZ_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_SCHWARZ_HH
│ │ │ │ +
6#define DUNE_ISTL_SCHWARZ_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>
│ │ │ │
16
│ │ │ │ -
17#include <dune/common/hybridutilities.hh>
│ │ │ │ -
18
│ │ │ │ -
19#include "io.hh"
│ │ │ │ -
20#include "bvector.hh"
│ │ │ │ -
21#include "vbvector.hh"
│ │ │ │ -
22#include "bcrsmatrix.hh"
│ │ │ │ -
23#include "io.hh"
│ │ │ │ -
24#include "gsetc.hh"
│ │ │ │ -
25#include "ilu.hh"
│ │ │ │ -
26#include "operators.hh"
│ │ │ │ -
27#include "solvers.hh"
│ │ │ │ -
28#include "preconditioners.hh"
│ │ │ │ -
29#include "scalarproducts.hh"
│ │ │ │ -
30#include "owneroverlapcopy.hh"
│ │ │ │ +
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
│ │ │ │ -
32namespace Dune {
│ │ │ │ -
33
│ │ │ │ -
59 template<class M, class X, class Y, class C>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
61 {
│ │ │ │ -
62 public:
│ │ │ │ -
64 typedef M matrix_type;
│ │ │ │ -
66 typedef X domain_type;
│ │ │ │ -
68 typedef Y range_type;
│ │ │ │ -
70 typedef typename X::field_type field_type;
│ │ │ │ - │ │ │ │ -
73
│ │ │ │ -
74 typedef typename C::PIS PIS;
│ │ │ │ -
75 typedef typename C::RI RI;
│ │ │ │ -
76 typedef typename RI::RemoteIndexList RIL;
│ │ │ │ -
77 typedef typename RI::const_iterator RIIterator;
│ │ │ │ -
78 typedef typename RIL::const_iterator RILIterator;
│ │ │ │ -
79 typedef typename M::ConstColIterator ColIterator;
│ │ │ │ -
80 typedef typename M::ConstRowIterator RowIterator;
│ │ │ │ -
81 typedef std::multimap<int,int> MM;
│ │ │ │ -
82 typedef std::multimap<int,std::pair<int,RILIterator> > RIMap;
│ │ │ │ -
83 typedef typename RIMap::iterator RIMapit;
│ │ │ │ -
84
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
93 : _A_(stackobject_to_shared_ptr(A)), communication(com), buildcomm(true)
│ │ │ │ -
94 {}
│ │ │ │ -
│ │ │ │ -
95
│ │ │ │ -
│ │ │ │ -
96 NonoverlappingSchwarzOperator (std::shared_ptr<const matrix_type> A, const communication_type& com)
│ │ │ │ -
97 : _A_(A), communication(com), buildcomm(true)
│ │ │ │ -
98 {}
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ -
101 virtual void apply (const X& x, Y& y) const
│ │ │ │ -
102 {
│ │ │ │ -
103 y = 0;
│ │ │ │ -
104 novlp_op_apply(x,y,1);
│ │ │ │ -
105 communication.addOwnerCopyToOwnerCopy(y,y);
│ │ │ │ -
106 }
│ │ │ │ -
│ │ │ │ -
107
│ │ │ │ -
│ │ │ │ -
109 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
│ │ │ │ -
110 {
│ │ │ │ -
111 // only apply communication to alpha*A*x to make it consistent,
│ │ │ │ -
112 // y already has to be consistent.
│ │ │ │ -
113 Y y1(y);
│ │ │ │ -
114 y = 0;
│ │ │ │ -
115 novlp_op_apply(x,y,alpha);
│ │ │ │ -
116 communication.addOwnerCopyToOwnerCopy(y,y);
│ │ │ │ -
117 y += y1;
│ │ │ │ -
118 }
│ │ │ │ -
│ │ │ │ -
119
│ │ │ │ -
│ │ │ │ -
121 virtual const matrix_type& getmat () const
│ │ │ │ -
122 {
│ │ │ │ -
123 return *_A_;
│ │ │ │ -
124 }
│ │ │ │ -
│ │ │ │ -
125
│ │ │ │ -
│ │ │ │ -
126 void novlp_op_apply (const X& x, Y& y, field_type alpha) const
│ │ │ │ -
127 {
│ │ │ │ -
128 //get index sets
│ │ │ │ -
129 const PIS& pis=communication.indexSet();
│ │ │ │ -
130 const RI& ri = communication.remoteIndices();
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
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 {}
│ │ │ │ +
│ │ │ │ +
114
│ │ │ │ +
│ │ │ │ +
116 virtual void apply (const X& x, Y& y) const
│ │ │ │ +
117 {
│ │ │ │ +
118 y = 0;
│ │ │ │ +
119 _A_->umv(x,y); // result is consistent on interior+border
│ │ │ │ +
120 communication.project(y); // we want this here to avoid it before the preconditioner
│ │ │ │ +
121 // since there d is const!
│ │ │ │ +
122 }
│ │ │ │ +
│ │ │ │ +
123
│ │ │ │ +
│ │ │ │ +
125 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
│ │ │ │ +
126 {
│ │ │ │ +
127 _A_->usmv(alpha,x,y); // result is consistent on interior+border
│ │ │ │ +
128 communication.project(y); // we want this here to avoid it before the preconditioner
│ │ │ │ +
129 // since there d is const!
│ │ │ │ +
130 }
│ │ │ │ +
│ │ │ │
131
│ │ │ │ -
132 // at the beginning make a multimap "bordercontribution".
│ │ │ │ -
133 // process has i and j as border dofs but is not the owner
│ │ │ │ -
134 // => only contribute to Ax if i,j is in bordercontribution
│ │ │ │ -
135 if (buildcomm == true) {
│ │ │ │ -
136
│ │ │ │ -
137 // set up mask vector
│ │ │ │ -
138 if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size())) {
│ │ │ │ -
139 mask.resize(x.size());
│ │ │ │ -
140 for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
│ │ │ │ -
141 mask[i] = 1;
│ │ │ │ -
142 for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
│ │ │ │ -
143 if (i->local().attribute()==OwnerOverlapCopyAttributeSet::copy)
│ │ │ │ -
144 mask[i->local().local()] = 0;
│ │ │ │ -
145 else if (i->local().attribute()==OwnerOverlapCopyAttributeSet::overlap)
│ │ │ │ -
146 mask[i->local().local()] = 2;
│ │ │ │ -
147 }
│ │ │ │ -
148
│ │ │ │ -
149 for (MM::iterator iter = bordercontribution.begin();
│ │ │ │ -
150 iter != bordercontribution.end(); ++iter)
│ │ │ │ -
151 bordercontribution.erase(iter);
│ │ │ │ -
152 std::map<int,int> owner; //key: local index i, value: process, that owns i
│ │ │ │ -
153 RIMap rimap;
│ │ │ │ +
│ │ │ │ +
133 virtual const matrix_type& getmat () const
│ │ │ │ +
134 {
│ │ │ │ +
135 return *_A_;
│ │ │ │ +
136 }
│ │ │ │ +
│ │ │ │ +
137
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
140 {
│ │ │ │ + │ │ │ │ +
142 }
│ │ │ │ +
│ │ │ │ +
143
│ │ │ │ +
144
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
147 {
│ │ │ │ +
148 return communication;
│ │ │ │ +
149 }
│ │ │ │ +
│ │ │ │ +
150 private:
│ │ │ │ +
151 const std::shared_ptr<const matrix_type>_A_;
│ │ │ │ +
152 const communication_type& communication;
│ │ │ │ +
153 };
│ │ │ │ +
│ │ │ │
154
│ │ │ │ -
155 // for each local index make multimap rimap:
│ │ │ │ -
156 // key: local index i, data: pair of process that knows i and pointer to RI entry
│ │ │ │ -
157 for (RowIterator i = _A_->begin(); i != _A_->end(); ++i)
│ │ │ │ -
158 if (mask[i.index()] == 0)
│ │ │ │ -
159 for (RIIterator remote = ri.begin(); remote != ri.end(); ++remote) {
│ │ │ │ -
160 RIL& ril = *(remote->second.first);
│ │ │ │ -
161 for (RILIterator rindex = ril.begin(); rindex != ril.end(); ++rindex)
│ │ │ │ -
162 if (rindex->attribute() != OwnerOverlapCopyAttributeSet::overlap)
│ │ │ │ -
163 if (rindex->localIndexPair().local().local() == i.index()) {
│ │ │ │ -
164 rimap.insert
│ │ │ │ -
165 (std::make_pair(i.index(),
│ │ │ │ -
166 std::pair<int,RILIterator>(remote->first, rindex)));
│ │ │ │ -
167 if(rindex->attribute()==OwnerOverlapCopyAttributeSet::owner)
│ │ │ │ -
168 owner.insert(std::make_pair(i.index(),remote->first));
│ │ │ │ -
169 }
│ │ │ │ -
170 }
│ │ │ │ -
171
│ │ │ │ -
172 int iowner = 0;
│ │ │ │ -
173 for (RowIterator i = _A_->begin(); i != _A_->end(); ++i) {
│ │ │ │ -
174 if (mask[i.index()] == 0) {
│ │ │ │ -
175 std::map<int,int>::iterator it = owner.find(i.index());
│ │ │ │ -
176 iowner = it->second;
│ │ │ │ -
177 std::pair<RIMapit, RIMapit> foundiit = rimap.equal_range(i.index());
│ │ │ │ -
178 for (ColIterator j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end(); ++j) {
│ │ │ │ -
179 if (mask[j.index()] == 0) {
│ │ │ │ -
180 bool flag = true;
│ │ │ │ -
181 for (RIMapit foundi = foundiit.first; foundi != foundiit.second; ++foundi) {
│ │ │ │ -
182 std::pair<RIMapit, RIMapit> foundjit = rimap.equal_range(j.index());
│ │ │ │ -
183 for (RIMapit foundj = foundjit.first; foundj != foundjit.second; ++foundj)
│ │ │ │ -
184 if (foundj->second.first == foundi->second.first)
│ │ │ │ -
185 if (foundj->second.second->attribute() == OwnerOverlapCopyAttributeSet::owner
│ │ │ │ -
186 || foundj->second.first == iowner
│ │ │ │ -
187 || foundj->second.first < communication.communicator().rank()) {
│ │ │ │ -
188 flag = false;
│ │ │ │ -
189 continue;
│ │ │ │ -
190 }
│ │ │ │ -
191 if (flag == false)
│ │ │ │ -
192 continue;
│ │ │ │ -
193 }
│ │ │ │ -
194 // don´t contribute to Ax if
│ │ │ │ -
195 // 1. the owner of j has i as interior/border dof
│ │ │ │ -
196 // 2. iowner has j as interior/border dof
│ │ │ │ -
197 // 3. there is another process with smaller rank that has i and j
│ │ │ │ -
198 // as interor/border dofs
│ │ │ │ -
199 // if the owner of j does not have i as interior/border dof,
│ │ │ │ -
200 // it will not be taken into account
│ │ │ │ -
201 if (flag==true)
│ │ │ │ -
202 bordercontribution.insert(std::pair<int,int>(i.index(),j.index()));
│ │ │ │ -
203 }
│ │ │ │ -
204 }
│ │ │ │ -
205 }
│ │ │ │ -
206 }
│ │ │ │ -
207 buildcomm = false;
│ │ │ │ -
208 }
│ │ │ │ -
209
│ │ │ │ -
210 //compute alpha*A*x nonoverlapping case
│ │ │ │ -
211 for (RowIterator i = _A_->begin(); i != _A_->end(); ++i) {
│ │ │ │ -
212 if (mask[i.index()] == 0) {
│ │ │ │ -
213 //dof doesn't belong to process but is border (not ghost)
│ │ │ │ -
214 for (ColIterator j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end(); ++j) {
│ │ │ │ -
215 if (mask[j.index()] == 1) //j is owner => then sum entries
│ │ │ │ -
216 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]);
│ │ │ │ -
217 else if (mask[j.index()] == 0) {
│ │ │ │ -
218 std::pair<MM::iterator, MM::iterator> itp =
│ │ │ │ -
219 bordercontribution.equal_range(i.index());
│ │ │ │ -
220 for (MM::iterator it = itp.first; it != itp.second; ++it)
│ │ │ │ -
221 if ((*it).second == (int)j.index())
│ │ │ │ -
222 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]);
│ │ │ │ -
223 }
│ │ │ │ -
224 }
│ │ │ │ -
225 }
│ │ │ │ -
226 else if (mask[i.index()] == 1) {
│ │ │ │ -
227 for (ColIterator j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end(); ++j)
│ │ │ │ -
228 if (mask[j.index()] != 2)
│ │ │ │ -
229 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]);
│ │ │ │ -
230 }
│ │ │ │ -
231 }
│ │ │ │ -
232 }
│ │ │ │ -
│ │ │ │ -
233
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
236 {
│ │ │ │ - │ │ │ │ -
238 }
│ │ │ │ -
│ │ │ │ -
239
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
242 {
│ │ │ │ -
243 return communication;
│ │ │ │ -
244 }
│ │ │ │ -
│ │ │ │ -
245 private:
│ │ │ │ -
246 std::shared_ptr<const matrix_type> _A_;
│ │ │ │ -
247 const communication_type& communication;
│ │ │ │ -
248 mutable bool buildcomm;
│ │ │ │ -
249 mutable std::vector<double> mask;
│ │ │ │ -
250 mutable std::multimap<int,int> bordercontribution;
│ │ │ │ -
251 };
│ │ │ │ -
│ │ │ │ -
252
│ │ │ │ -
│ │ │ │ -
255 namespace Amg
│ │ │ │ -
256 {
│ │ │ │ -
257 template<class T> struct ConstructionTraits;
│ │ │ │ -
258 }
│ │ │ │ -
│ │ │ │ -
259
│ │ │ │ -
274 template<class C, class P>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
276 : public Preconditioner<typename P::domain_type,typename P::range_type> {
│ │ │ │ -
277 friend struct Amg::ConstructionTraits<NonoverlappingBlockPreconditioner<C,P> >;
│ │ │ │ -
278 using X = typename P::domain_type;
│ │ │ │ -
279 using Y = typename P::range_type;
│ │ │ │ +
157 /*
│ │ │ │ +
158 * @addtogroup ISTL_Prec
│ │ │ │ +
159 * @{
│ │ │ │ +
160 */
│ │ │ │ +
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;
│ │ │ │ + │ │ │ │ +
187
│ │ │ │ +
│ │ │ │ +
197 ParSSOR (const matrix_type& A, int n, field_type w, const communication_type& c)
│ │ │ │ +
198 : _A_(A), _n(n), _w(w), communication(c)
│ │ │ │ +
199 { }
│ │ │ │ +
│ │ │ │ +
200
│ │ │ │ +
│ │ │ │ +
206 virtual void pre (X& x, [[maybe_unused]] Y& b)
│ │ │ │ +
207 {
│ │ │ │ +
208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ │ +
209 }
│ │ │ │ +
│ │ │ │ +
210
│ │ │ │ +
│ │ │ │ +
216 virtual void apply (X& v, const Y& d)
│ │ │ │ +
217 {
│ │ │ │ +
218 for (int i=0; i<_n; i++) {
│ │ │ │ +
219 bsorf(_A_,v,d,_w);
│ │ │ │ +
220 bsorb(_A_,v,d,_w);
│ │ │ │ +
221 }
│ │ │ │ +
222 communication.copyOwnerToAll(v,v);
│ │ │ │ +
223 }
│ │ │ │ +
│ │ │ │ +
224
│ │ │ │ +
230 virtual void post ([[maybe_unused]] X& x) {}
│ │ │ │ +
231
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
234 {
│ │ │ │ + │ │ │ │ +
236 }
│ │ │ │ +
│ │ │ │ +
237
│ │ │ │ +
238 private:
│ │ │ │ +
240 const matrix_type& _A_;
│ │ │ │ +
242 int _n;
│ │ │ │ +
244 field_type _w;
│ │ │ │ +
246 const communication_type& communication;
│ │ │ │ +
247 };
│ │ │ │ +
│ │ │ │ +
248
│ │ │ │ +
249 namespace Amg
│ │ │ │ +
250 {
│ │ │ │ +
251 template<class T> struct ConstructionTraits;
│ │ │ │ +
252 }
│ │ │ │ +
253
│ │ │ │ +
277 template<class X, class Y, class C, class P=Preconditioner<X,Y> >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
279 friend struct Amg::ConstructionTraits<BlockPreconditioner<X,Y,C,P> >;
│ │ │ │
280 public:
│ │ │ │ -
282 typedef typename P::domain_type domain_type;
│ │ │ │ -
284 typedef typename P::range_type range_type;
│ │ │ │ - │ │ │ │ -
287
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
303 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c)
│ │ │ │ -
304 { }
│ │ │ │ -
│ │ │ │ -
305
│ │ │ │ -
│ │ │ │ -
313 NonoverlappingBlockPreconditioner (const std::shared_ptr<P>& p, const communication_type& c)
│ │ │ │ -
314 : _preconditioner(p), _communication(c)
│ │ │ │ -
315 { }
│ │ │ │ -
│ │ │ │ -
316
│ │ │ │ -
│ │ │ │ -
322 virtual void pre (domain_type& x, range_type& b)
│ │ │ │ -
323 {
│ │ │ │ -
324 _preconditioner->pre(x,b);
│ │ │ │ -
325 }
│ │ │ │ -
│ │ │ │ -
326
│ │ │ │ -
│ │ │ │ -
332 virtual void apply (domain_type& v, const range_type& d)
│ │ │ │ -
333 {
│ │ │ │ -
334 // block preconditioner equivalent to WrappedPreconditioner from
│ │ │ │ -
335 // pdelab/backend/ovlpistsolverbackend.hh,
│ │ │ │ -
336 // but not to BlockPreconditioner from schwarz.hh
│ │ │ │ -
337 _preconditioner->apply(v,d);
│ │ │ │ -
338 _communication.addOwnerCopyToOwnerCopy(v,v);
│ │ │ │ -
339 }
│ │ │ │ -
│ │ │ │ -
340
│ │ │ │ -
341 template<bool forward>
│ │ │ │ -
│ │ │ │ -
342 void apply (X& v, const Y& d)
│ │ │ │ -
343 {
│ │ │ │ -
344 _preconditioner->template apply<forward>(v,d);
│ │ │ │ -
345 _communication.addOwnerCopyToOwnerCopy(v,v);
│ │ │ │ -
346 }
│ │ │ │ -
│ │ │ │ -
347
│ │ │ │ -
│ │ │ │ -
353 virtual void post (domain_type& x)
│ │ │ │ -
354 {
│ │ │ │ -
355 _preconditioner->post(x);
│ │ │ │ -
356 }
│ │ │ │ -
│ │ │ │ -
357
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
360 {
│ │ │ │ - │ │ │ │ -
362 }
│ │ │ │ -
│ │ │ │ -
363
│ │ │ │ -
364 private:
│ │ │ │ -
366 std::shared_ptr<P> _preconditioner;
│ │ │ │ -
367
│ │ │ │ -
369 const communication_type& _communication;
│ │ │ │ -
370 };
│ │ │ │ -
│ │ │ │ -
371
│ │ │ │ -
374} // end namespace
│ │ │ │ -
375
│ │ │ │ -
376#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 base class for scalar product and norm.
│ │ │ │ -
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ - │ │ │ │ -
The incomplete LU factorization kernels.
│ │ │ │ -
Implementations of the inverse operator interface.
│ │ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ -
Define general preconditioner interface.
│ │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ +
285 typedef X domain_type;
│ │ │ │ +
290 typedef Y range_type;
│ │ │ │ +
292 typedef typename X::field_type field_type;
│ │ │ │ + │ │ │ │ +
298
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
307 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c)
│ │ │ │ +
308 { }
│ │ │ │ +
│ │ │ │ +
309
│ │ │ │ +
│ │ │ │ +
317 BlockPreconditioner (const std::shared_ptr<P>& p, const communication_type& c)
│ │ │ │ +
318 : _preconditioner(p), _communication(c)
│ │ │ │ +
319 { }
│ │ │ │ +
│ │ │ │ +
320
│ │ │ │ +
│ │ │ │ +
326 virtual void pre (X& x, Y& b)
│ │ │ │ +
327 {
│ │ │ │ +
328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ │ +
329 _preconditioner->pre(x,b);
│ │ │ │ +
330 }
│ │ │ │ +
│ │ │ │ +
331
│ │ │ │ +
│ │ │ │ +
337 virtual void apply (X& v, const Y& d)
│ │ │ │ +
338 {
│ │ │ │ +
339 _preconditioner->apply(v,d);
│ │ │ │ +
340 _communication.copyOwnerToAll(v,v);
│ │ │ │ +
341 }
│ │ │ │ +
│ │ │ │ +
342
│ │ │ │ +
343 template<bool forward>
│ │ │ │ +
│ │ │ │ +
344 void apply (X& v, const Y& d)
│ │ │ │ +
345 {
│ │ │ │ +
346 _preconditioner->template apply<forward>(v,d);
│ │ │ │ +
347 _communication.copyOwnerToAll(v,v);
│ │ │ │ +
348 }
│ │ │ │ +
│ │ │ │ +
349
│ │ │ │ +
│ │ │ │ +
355 virtual void post (X& x)
│ │ │ │ +
356 {
│ │ │ │ +
357 _preconditioner->post(x);
│ │ │ │ +
358 }
│ │ │ │ +
│ │ │ │ +
359
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
362 {
│ │ │ │ + │ │ │ │ +
364 }
│ │ │ │ +
│ │ │ │ +
365
│ │ │ │ +
366 private:
│ │ │ │ +
368 std::shared_ptr<P> _preconditioner;
│ │ │ │ +
369
│ │ │ │ +
371 const communication_type& _communication;
│ │ │ │ +
372 };
│ │ │ │ +
│ │ │ │ +
373
│ │ │ │ +
376} // end namespace
│ │ │ │ +
377
│ │ │ │ +
378#endif
│ │ │ │ +
Define general preconditioner interface.
│ │ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ +
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
Implementations of the inverse operator interface.
│ │ │ │ +
The incomplete LU factorization kernels.
│ │ │ │ + │ │ │ │ +
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ +
Define base class for scalar product and norm.
│ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ +
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
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │ -
C::PIS PIS
Definition novlpschwarz.hh:74
│ │ │ │ -
C communication_type
The type of the communication object.
Definition novlpschwarz.hh:72
│ │ │ │ -
std::multimap< int, std::pair< int, RILIterator > > RIMap
Definition novlpschwarz.hh:82
│ │ │ │ -
C::RI RI
Definition novlpschwarz.hh:75
│ │ │ │ -
void novlp_op_apply(const X &x, Y &y, field_type alpha) const
Definition novlpschwarz.hh:126
│ │ │ │ -
NonoverlappingSchwarzOperator(std::shared_ptr< const matrix_type > A, const communication_type &com)
Definition novlpschwarz.hh:96
│ │ │ │ -
M::ConstColIterator ColIterator
Definition novlpschwarz.hh:79
│ │ │ │ -
virtual void apply(const X &x, Y &y) const
apply operator to x:
Definition novlpschwarz.hh:101
│ │ │ │ -
X domain_type
The type of the domain.
Definition novlpschwarz.hh:66
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the linear operator (see SolverCategory::Category)
Definition novlpschwarz.hh:235
│ │ │ │ -
RIMap::iterator RIMapit
Definition novlpschwarz.hh:83
│ │ │ │ -
virtual const matrix_type & getmat() const
get matrix via *
Definition novlpschwarz.hh:121
│ │ │ │ -
RIL::const_iterator RILIterator
Definition novlpschwarz.hh:78
│ │ │ │ -
std::multimap< int, int > MM
Definition novlpschwarz.hh:81
│ │ │ │ -
Y range_type
The type of the range.
Definition novlpschwarz.hh:68
│ │ │ │ -
M matrix_type
The type of the matrix we operate on.
Definition novlpschwarz.hh:64
│ │ │ │ -
M::ConstRowIterator RowIterator
Definition novlpschwarz.hh:80
│ │ │ │ -
const communication_type & getCommunication() const
Get the object responsible for communication.
Definition novlpschwarz.hh:241
│ │ │ │ -
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const
apply operator to x, scale and add:
Definition novlpschwarz.hh:109
│ │ │ │ -
RI::RemoteIndexList RIL
Definition novlpschwarz.hh:76
│ │ │ │ -
X::field_type field_type
The field type of the range.
Definition novlpschwarz.hh:70
│ │ │ │ -
NonoverlappingSchwarzOperator(const matrix_type &A, const communication_type &com)
constructor: just store a reference to a matrix.
Definition novlpschwarz.hh:92
│ │ │ │ -
RI::const_iterator RIIterator
Definition novlpschwarz.hh:77
│ │ │ │ -
Nonoverlapping parallel preconditioner.
Definition novlpschwarz.hh:276
│ │ │ │ -
NonoverlappingBlockPreconditioner(P &p, const communication_type &c)
Constructor.
Definition novlpschwarz.hh:302
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition novlpschwarz.hh:359
│ │ │ │ -
virtual void apply(domain_type &v, const range_type &d)
Apply the preconditioner.
Definition novlpschwarz.hh:332
│ │ │ │ -
P::range_type range_type
The range type of the preconditioner.
Definition novlpschwarz.hh:284
│ │ │ │ -
NonoverlappingBlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c)
Constructor.
Definition novlpschwarz.hh:313
│ │ │ │ -
virtual void post(domain_type &x)
Clean up.
Definition novlpschwarz.hh:353
│ │ │ │ -
C communication_type
The type of the communication object.
Definition novlpschwarz.hh:286
│ │ │ │ -
virtual void pre(domain_type &x, range_type &b)
Prepare the preconditioner.
Definition novlpschwarz.hh:322
│ │ │ │ -
void apply(X &v, const Y &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition novlpschwarz.hh:342
│ │ │ │ -
P::domain_type domain_type
The domain type of the preconditioner.
Definition novlpschwarz.hh:282
│ │ │ │
A linear operator exporting itself in matrix form.
Definition operators.hh:109
│ │ │ │ -
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ │ -
@ copy
Definition owneroverlapcopy.hh:61
│ │ │ │ -
@ overlap
Definition owneroverlapcopy.hh:61
│ │ │ │ +
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ │ +
const communication_type & getCommunication() const
Get the object responsible for communication.
Definition schwarz.hh:146
│ │ │ │ +
virtual const matrix_type & getmat() const
get the sequential assembled linear operator.
Definition schwarz.hh:133
│ │ │ │ +
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const
apply operator to x, scale and add:
Definition schwarz.hh:125
│ │ │ │ +
virtual void apply(const X &x, Y &y) const
apply operator to x:
Definition schwarz.hh:116
│ │ │ │ +
C communication_type
The type of the communication object.
Definition schwarz.hh:98
│ │ │ │ +
X domain_type
The type of the domain.
Definition schwarz.hh:86
│ │ │ │ +
M matrix_type
The type of the matrix we operate on.
Definition schwarz.hh:81
│ │ │ │ +
Y range_type
The type of the range.
Definition schwarz.hh:91
│ │ │ │ +
X::field_type field_type
The field type of the range.
Definition schwarz.hh:93
│ │ │ │ +
OverlappingSchwarzOperator(const matrix_type &A, const communication_type &com)
constructor: just store a reference to a matrix.
Definition schwarz.hh:107
│ │ │ │ +
OverlappingSchwarzOperator(const std::shared_ptr< matrix_type > A, const communication_type &com)
Definition schwarz.hh:111
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the linear operator (see SolverCategory::Category)
Definition schwarz.hh:139
│ │ │ │
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
A parallel SSOR preconditioner.
Definition schwarz.hh:175
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition schwarz.hh:184
│ │ │ │ +
C communication_type
The type of the communication object.
Definition schwarz.hh:186
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition schwarz.hh:233
│ │ │ │ +
ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c)
Constructor.
Definition schwarz.hh:197
│ │ │ │ +
virtual void post(X &x)
Clean up.
Definition schwarz.hh:230
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:180
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:182
│ │ │ │ +
M matrix_type
The matrix type the preconditioner is for.
Definition schwarz.hh:178
│ │ │ │ +
virtual void apply(X &v, const Y &d)
Apply the precondtioner.
Definition schwarz.hh:216
│ │ │ │ +
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition schwarz.hh:206
│ │ │ │ +
Block parallel preconditioner.
Definition schwarz.hh:278
│ │ │ │ +
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition schwarz.hh:326
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:285
│ │ │ │ +
BlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c)
Constructor.
Definition schwarz.hh:317
│ │ │ │ +
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition schwarz.hh:337
│ │ │ │ +
BlockPreconditioner(P &p, const communication_type &c)
Constructor.
Definition schwarz.hh:306
│ │ │ │ +
void apply(X &v, const Y &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition schwarz.hh:344
│ │ │ │ +
C communication_type
The type of the communication object..
Definition schwarz.hh:297
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition schwarz.hh:292
│ │ │ │ +
virtual void post(X &x)
Clean up.
Definition schwarz.hh:355
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:290
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition schwarz.hh:361
│ │ │ │
Category
Definition solvercategory.hh:23
│ │ │ │ -
@ nonoverlapping
Category for non-overlapping solvers.
Definition solvercategory.hh:27
│ │ │ │ +
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,474 +1,395 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -novlpschwarz.hh │ │ │ │ │ +schwarz.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 (C) 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_NOVLPSCHWARZ_HH │ │ │ │ │ -6#define DUNE_ISTL_NOVLPSCHWARZ_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_SCHWARZ_HH │ │ │ │ │ +6#define DUNE_ISTL_SCHWARZ_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 │ │ │ │ │ 16 │ │ │ │ │ -17#include │ │ │ │ │ -18 │ │ │ │ │ -19#include "_i_o_._h_h" │ │ │ │ │ -20#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -21#include "_v_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -22#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ │ -23#include "_i_o_._h_h" │ │ │ │ │ -24#include "_g_s_e_t_c_._h_h" │ │ │ │ │ -25#include "_i_l_u_._h_h" │ │ │ │ │ -26#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ │ -27#include "_s_o_l_v_e_r_s_._h_h" │ │ │ │ │ -28#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ │ -29#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ │ -30#include "_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h" │ │ │ │ │ +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 │ │ │ │ │ -32namespace _D_u_n_e { │ │ │ │ │ -33 │ │ │ │ │ -59 template │ │ │ │ │ -_6_0 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 : public _A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -61 { │ │ │ │ │ -62 public: │ │ │ │ │ -_6_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_6_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_6_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_7_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_7_2 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ -73 │ │ │ │ │ -_7_4 typedef typename C::PIS _P_I_S; │ │ │ │ │ -_7_5 typedef typename C::RI _R_I; │ │ │ │ │ -_7_6 typedef typename RI::RemoteIndexList _R_I_L; │ │ │ │ │ -_7_7 typedef typename RI::const_iterator _R_I_I_t_e_r_a_t_o_r; │ │ │ │ │ -_7_8 typedef typename RIL::const_iterator _R_I_L_I_t_e_r_a_t_o_r; │ │ │ │ │ -_7_9 typedef typename M::ConstColIterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -_8_0 typedef typename M::ConstRowIterator _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ -_8_1 typedef std::multimap _M_M; │ │ │ │ │ -_8_2 typedef std::multimap > _R_I_M_a_p; │ │ │ │ │ -_8_3 typedef typename RIMap::iterator _R_I_M_a_p_i_t; │ │ │ │ │ -84 │ │ │ │ │ -_9_2 _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 (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) │ │ │ │ │ -93 : _A_(stackobject_to_shared_ptr(A)), communication(com), buildcomm(true) │ │ │ │ │ -94 {} │ │ │ │ │ -95 │ │ │ │ │ -_9_6 _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 (std::shared_ptr A, const │ │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& com) │ │ │ │ │ -97 : _A_(A), communication(com), buildcomm(true) │ │ │ │ │ -98 {} │ │ │ │ │ +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_1 virtual void _a_p_p_l_y (const X& x, Y& y) const │ │ │ │ │ -102 { │ │ │ │ │ -103 y = 0; │ │ │ │ │ -104 _n_o_v_l_p___o_p___a_p_p_l_y(x,y,1); │ │ │ │ │ -105 communication.addOwnerCopyToOwnerCopy(y,y); │ │ │ │ │ -106 } │ │ │ │ │ -107 │ │ │ │ │ -_1_0_9 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (_f_i_e_l_d___t_y_p_e alpha, const X& x, Y& y) const │ │ │ │ │ -110 { │ │ │ │ │ -111 // only apply communication to alpha*A*x to make it consistent, │ │ │ │ │ -112 // y already has to be consistent. │ │ │ │ │ -113 Y y1(y); │ │ │ │ │ -114 y = 0; │ │ │ │ │ -115 _n_o_v_l_p___o_p___a_p_p_l_y(x,y,alpha); │ │ │ │ │ -116 communication.addOwnerCopyToOwnerCopy(y,y); │ │ │ │ │ -117 y += y1; │ │ │ │ │ -118 } │ │ │ │ │ -119 │ │ │ │ │ -_1_2_1 virtual const _m_a_t_r_i_x___t_y_p_e& _g_e_t_m_a_t () const │ │ │ │ │ -122 { │ │ │ │ │ -123 return *_A_; │ │ │ │ │ -124 } │ │ │ │ │ -125 │ │ │ │ │ -_1_2_6 void _n_o_v_l_p___o_p___a_p_p_l_y (const X& x, Y& y, _f_i_e_l_d___t_y_p_e alpha) const │ │ │ │ │ -127 { │ │ │ │ │ -128 //get index sets │ │ │ │ │ -129 const _P_I_S& pis=communication.indexSet(); │ │ │ │ │ -130 const _R_I& ri = communication.remoteIndices(); │ │ │ │ │ +_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 {} │ │ │ │ │ +114 │ │ │ │ │ +_1_1_6 virtual void _a_p_p_l_y (const X& x, Y& y) const │ │ │ │ │ +117 { │ │ │ │ │ +118 y = 0; │ │ │ │ │ +119 _A_->umv(x,y); // result is consistent on interior+border │ │ │ │ │ +120 communication.project(y); // we want this here to avoid it before the │ │ │ │ │ +preconditioner │ │ │ │ │ +121 // since there d is const! │ │ │ │ │ +122 } │ │ │ │ │ +123 │ │ │ │ │ +_1_2_5 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (_f_i_e_l_d___t_y_p_e alpha, const X& x, Y& y) const │ │ │ │ │ +126 { │ │ │ │ │ +127 _A_->usmv(alpha,x,y); // result is consistent on interior+border │ │ │ │ │ +128 communication.project(y); // we want this here to avoid it before the │ │ │ │ │ +preconditioner │ │ │ │ │ +129 // since there d is const! │ │ │ │ │ +130 } │ │ │ │ │ 131 │ │ │ │ │ -132 // at the beginning make a multimap "bordercontribution". │ │ │ │ │ -133 // process has i and j as border dofs but is not the owner │ │ │ │ │ -134 // => only contribute to Ax if i,j is in bordercontribution │ │ │ │ │ -135 if (buildcomm == true) { │ │ │ │ │ -136 │ │ │ │ │ -137 // set up mask vector │ │ │ │ │ -138 if (mask.size()!=static_cast::size_type> │ │ │ │ │ -(x.size())) { │ │ │ │ │ -139 mask.resize(x.size()); │ │ │ │ │ -140 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_:_:_c_o_p_y) │ │ │ │ │ -144 mask[i->local().local()] = 0; │ │ │ │ │ -145 else 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_:_:_o_v_e_r_l_a_p) │ │ │ │ │ -146 mask[i->local().local()] = 2; │ │ │ │ │ -147 } │ │ │ │ │ -148 │ │ │ │ │ -149 for (MM::iterator iter = bordercontribution.begin(); │ │ │ │ │ -150 iter != bordercontribution.end(); ++iter) │ │ │ │ │ -151 bordercontribution.erase(iter); │ │ │ │ │ -152 std::map owner; //key: local index i, value: process, that owns i │ │ │ │ │ -153 _R_I_M_a_p rimap; │ │ │ │ │ +_1_3_3 virtual const _m_a_t_r_i_x___t_y_p_e& _g_e_t_m_a_t () const │ │ │ │ │ +134 { │ │ │ │ │ +135 return *_A_; │ │ │ │ │ +136 } │ │ │ │ │ +137 │ │ │ │ │ +_1_3_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +140 { │ │ │ │ │ +141 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ │ +142 } │ │ │ │ │ +143 │ │ │ │ │ +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 │ │ │ │ │ -155 // for each local index make multimap rimap: │ │ │ │ │ -156 // key: local index i, data: pair of process that knows i and pointer to RI │ │ │ │ │ -entry │ │ │ │ │ -157 for (_R_o_w_I_t_e_r_a_t_o_r i = _A_->begin(); i != _A_->end(); ++i) │ │ │ │ │ -158 if (mask[i.index()] == 0) │ │ │ │ │ -159 for (_R_I_I_t_e_r_a_t_o_r remote = ri.begin(); remote != ri.end(); ++remote) { │ │ │ │ │ -160 _R_I_L& ril = *(remote->second.first); │ │ │ │ │ -161 for (_R_I_L_I_t_e_r_a_t_o_r rindex = ril.begin(); rindex != ril.end(); ++rindex) │ │ │ │ │ -162 if (rindex->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_v_e_r_l_a_p) │ │ │ │ │ -163 if (rindex->localIndexPair().local().local() == i.index()) { │ │ │ │ │ -164 rimap.insert │ │ │ │ │ -165 (std::make_pair(i.index(), │ │ │ │ │ -166 std::pair(remote->first, rindex))); │ │ │ │ │ -167 if(rindex->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) │ │ │ │ │ -168 owner.insert(std::make_pair(i.index(),remote->first)); │ │ │ │ │ -169 } │ │ │ │ │ -170 } │ │ │ │ │ -171 │ │ │ │ │ -172 int iowner = 0; │ │ │ │ │ -173 for (_R_o_w_I_t_e_r_a_t_o_r i = _A_->begin(); i != _A_->end(); ++i) { │ │ │ │ │ -174 if (mask[i.index()] == 0) { │ │ │ │ │ -175 std::map::iterator it = owner.find(i.index()); │ │ │ │ │ -176 iowner = it->second; │ │ │ │ │ -177 std::pair foundiit = rimap.equal_range(i.index()); │ │ │ │ │ -178 for (_C_o_l_I_t_e_r_a_t_o_r j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end │ │ │ │ │ -(); ++j) { │ │ │ │ │ -179 if (mask[j.index()] == 0) { │ │ │ │ │ -180 bool flag = true; │ │ │ │ │ -181 for (_R_I_M_a_p_i_t foundi = foundiit.first; foundi != foundiit.second; ++foundi) │ │ │ │ │ -{ │ │ │ │ │ -182 std::pair foundjit = rimap.equal_range(j.index()); │ │ │ │ │ -183 for (_R_I_M_a_p_i_t foundj = foundjit.first; foundj != foundjit.second; ++foundj) │ │ │ │ │ -184 if (foundj->second.first == foundi->second.first) │ │ │ │ │ -185 if (foundj->second.second->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 │ │ │ │ │ -186 || foundj->second.first == iowner │ │ │ │ │ -187 || foundj->second.first < communication.communicator().rank()) { │ │ │ │ │ -188 flag = false; │ │ │ │ │ -189 continue; │ │ │ │ │ -190 } │ │ │ │ │ -191 if (flag == false) │ │ │ │ │ -192 continue; │ │ │ │ │ -193 } │ │ │ │ │ -194 // don´t contribute to Ax if │ │ │ │ │ -195 // 1. the owner of j has i as interior/border dof │ │ │ │ │ -196 // 2. iowner has j as interior/border dof │ │ │ │ │ -197 // 3. there is another process with smaller rank that has i and j │ │ │ │ │ -198 // as interor/border dofs │ │ │ │ │ -199 // if the owner of j does not have i as interior/border dof, │ │ │ │ │ -200 // it will not be taken into account │ │ │ │ │ -201 if (flag==true) │ │ │ │ │ -202 bordercontribution.insert(std::pair(i.index(),j.index())); │ │ │ │ │ -203 } │ │ │ │ │ -204 } │ │ │ │ │ -205 } │ │ │ │ │ -206 } │ │ │ │ │ -207 buildcomm = false; │ │ │ │ │ -208 } │ │ │ │ │ -209 │ │ │ │ │ -210 //compute alpha*A*x nonoverlapping case │ │ │ │ │ -211 for (_R_o_w_I_t_e_r_a_t_o_r i = _A_->begin(); i != _A_->end(); ++i) { │ │ │ │ │ -212 if (mask[i.index()] == 0) { │ │ │ │ │ -213 //dof doesn't belong to process but is border (not ghost) │ │ │ │ │ -214 for (_C_o_l_I_t_e_r_a_t_o_r j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end │ │ │ │ │ -(); ++j) { │ │ │ │ │ -215 if (mask[j.index()] == 1) //j is owner => then sum entries │ │ │ │ │ -216 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]); │ │ │ │ │ -217 else if (mask[j.index()] == 0) { │ │ │ │ │ -218 std::pair itp = │ │ │ │ │ -219 bordercontribution.equal_range(i.index()); │ │ │ │ │ -220 for (MM::iterator it = itp.first; it != itp.second; ++it) │ │ │ │ │ -221 if ((*it).second == (int)j.index()) │ │ │ │ │ -222 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]); │ │ │ │ │ +157 /* │ │ │ │ │ +158 * @addtogroup ISTL_Prec │ │ │ │ │ +159 * @{ │ │ │ │ │ +160 */ │ │ │ │ │ +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; │ │ │ │ │ +187 │ │ │ │ │ +_1_9_7 _P_a_r_S_S_O_R (const _m_a_t_r_i_x___t_y_p_e& A, int n, _f_i_e_l_d___t_y_p_e w, const │ │ │ │ │ +_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ │ +198 : _A_(A), _n(n), _w(w), communication(c) │ │ │ │ │ +199 { } │ │ │ │ │ +200 │ │ │ │ │ +_2_0_6 virtual void _p_r_e (X& x, [[maybe_unused]] Y& b) │ │ │ │ │ +207 { │ │ │ │ │ +208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ │ +209 } │ │ │ │ │ +210 │ │ │ │ │ +_2_1_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +217 { │ │ │ │ │ +218 for (int i=0; i<_n; i++) { │ │ │ │ │ +219 _b_s_o_r_f(_A_,v,d,_w); │ │ │ │ │ +220 _b_s_o_r_b(_A_,v,d,_w); │ │ │ │ │ +221 } │ │ │ │ │ +222 communication.copyOwnerToAll(v,v); │ │ │ │ │ 223 } │ │ │ │ │ -224 } │ │ │ │ │ -225 } │ │ │ │ │ -226 else if (mask[i.index()] == 1) { │ │ │ │ │ -227 for (_C_o_l_I_t_e_r_a_t_o_r j = (*_A_)[i.index()].begin(); j != (*_A_)[i.index()].end │ │ │ │ │ -(); ++j) │ │ │ │ │ -228 if (mask[j.index()] != 2) │ │ │ │ │ -229 Impl::asMatrix(*j).usmv(alpha,x[j.index()],y[i.index()]); │ │ │ │ │ -230 } │ │ │ │ │ -231 } │ │ │ │ │ -232 } │ │ │ │ │ -233 │ │ │ │ │ -_2_3_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 │ │ │ │ │ -236 { │ │ │ │ │ -237 return _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; │ │ │ │ │ -238 } │ │ │ │ │ -239 │ │ │ │ │ -_2_4_1 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 │ │ │ │ │ -242 { │ │ │ │ │ -243 return communication; │ │ │ │ │ -244 } │ │ │ │ │ -245 private: │ │ │ │ │ -246 std::shared_ptr _A_; │ │ │ │ │ -247 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& communication; │ │ │ │ │ -248 mutable bool buildcomm; │ │ │ │ │ -249 mutable std::vector mask; │ │ │ │ │ -_2_5_0 mutable std::multimap bordercontribution; │ │ │ │ │ -251 }; │ │ │ │ │ -252 │ │ │ │ │ -_2_5_5 namespace Amg │ │ │ │ │ -256 { │ │ │ │ │ -257 template struct ConstructionTraits; │ │ │ │ │ -258 } │ │ │ │ │ -259 │ │ │ │ │ -274 template │ │ │ │ │ -_2_7_5 class _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 │ │ │ │ │ -276 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ -277 friend struct Amg:: │ │ │ │ │ -ConstructionTraits<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r >; │ │ │ │ │ -278 using X = typename P::domain_type; │ │ │ │ │ -279 using Y = typename P::range_type; │ │ │ │ │ +224 │ │ │ │ │ +_2_3_0 virtual void _p_o_s_t ([[maybe_unused]] X& x) {} │ │ │ │ │ +231 │ │ │ │ │ +_2_3_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +234 { │ │ │ │ │ +235 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ │ +236 } │ │ │ │ │ +237 │ │ │ │ │ +238 private: │ │ │ │ │ +240 const _m_a_t_r_i_x___t_y_p_e& _A_; │ │ │ │ │ +242 int _n; │ │ │ │ │ +244 _f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ +_2_4_6 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& communication; │ │ │ │ │ +247 }; │ │ │ │ │ +248 │ │ │ │ │ +249 namespace Amg │ │ │ │ │ +250 { │ │ │ │ │ +251 template struct ConstructionTraits; │ │ │ │ │ +252 } │ │ │ │ │ +253 │ │ │ │ │ +277 template > │ │ │ │ │ +_2_7_8 class _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ +279 friend struct Amg::ConstructionTraits<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r >; │ │ │ │ │ 280 public: │ │ │ │ │ -_2_8_2 typedef typename P::domain_type _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_2_8_4 typedef typename P::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_2_8_6 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ -287 │ │ │ │ │ -_3_0_2 _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 (P& p, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ │ -303 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c) │ │ │ │ │ -304 { } │ │ │ │ │ -305 │ │ │ │ │ -_3_1_3 _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 (const std::shared_ptr

& p, const │ │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ │ -314 : _preconditioner(p), _communication(c) │ │ │ │ │ -315 { } │ │ │ │ │ -316 │ │ │ │ │ -_3_2_2 virtual void _p_r_e (_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b) │ │ │ │ │ -323 { │ │ │ │ │ -324 _preconditioner->pre(x,b); │ │ │ │ │ -325 } │ │ │ │ │ -326 │ │ │ │ │ -_3_3_2 virtual void _a_p_p_l_y (_d_o_m_a_i_n___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& d) │ │ │ │ │ -333 { │ │ │ │ │ -334 // block preconditioner equivalent to WrappedPreconditioner from │ │ │ │ │ -335 // pdelab/backend/ovlpistsolverbackend.hh, │ │ │ │ │ -336 // but not to BlockPreconditioner from schwarz.hh │ │ │ │ │ -337 _preconditioner->apply(v,d); │ │ │ │ │ -338 _communication.addOwnerCopyToOwnerCopy(v,v); │ │ │ │ │ -339 } │ │ │ │ │ -340 │ │ │ │ │ -341 template │ │ │ │ │ -_3_4_2 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -343 { │ │ │ │ │ -344 _preconditioner->template apply(v,d); │ │ │ │ │ -345 _communication.addOwnerCopyToOwnerCopy(v,v); │ │ │ │ │ -346 } │ │ │ │ │ -347 │ │ │ │ │ -_3_5_3 virtual void _p_o_s_t (_d_o_m_a_i_n___t_y_p_e& x) │ │ │ │ │ -354 { │ │ │ │ │ -355 _preconditioner->post(x); │ │ │ │ │ -356 } │ │ │ │ │ -357 │ │ │ │ │ -_3_5_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -360 { │ │ │ │ │ -361 return _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; │ │ │ │ │ -362 } │ │ │ │ │ -363 │ │ │ │ │ -364 private: │ │ │ │ │ -366 std::shared_ptr

_preconditioner; │ │ │ │ │ -367 │ │ │ │ │ -369 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& _communication; │ │ │ │ │ -370 }; │ │ │ │ │ -371 │ │ │ │ │ -374} // end namespace │ │ │ │ │ -375 │ │ │ │ │ -376#endif │ │ │ │ │ +_2_8_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_2_9_0 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +_2_9_2 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_9_7 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ +298 │ │ │ │ │ +_3_0_6 _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r (P& p, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ │ +307 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c) │ │ │ │ │ +308 { } │ │ │ │ │ +309 │ │ │ │ │ +_3_1_7 _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r (const std::shared_ptr

& p, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& │ │ │ │ │ +c) │ │ │ │ │ +318 : _preconditioner(p), _communication(c) │ │ │ │ │ +319 { } │ │ │ │ │ +320 │ │ │ │ │ +_3_2_6 virtual void _p_r_e (X& x, Y& b) │ │ │ │ │ +327 { │ │ │ │ │ +328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ │ +329 _preconditioner->pre(x,b); │ │ │ │ │ +330 } │ │ │ │ │ +331 │ │ │ │ │ +_3_3_7 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +338 { │ │ │ │ │ +339 _preconditioner->apply(v,d); │ │ │ │ │ +340 _communication.copyOwnerToAll(v,v); │ │ │ │ │ +341 } │ │ │ │ │ +342 │ │ │ │ │ +343 template │ │ │ │ │ +_3_4_4 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +345 { │ │ │ │ │ +346 _preconditioner->template apply(v,d); │ │ │ │ │ +347 _communication.copyOwnerToAll(v,v); │ │ │ │ │ +348 } │ │ │ │ │ +349 │ │ │ │ │ +_3_5_5 virtual void _p_o_s_t (X& x) │ │ │ │ │ +356 { │ │ │ │ │ +357 _preconditioner->post(x); │ │ │ │ │ +358 } │ │ │ │ │ +359 │ │ │ │ │ +_3_6_1 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +362 { │ │ │ │ │ +363 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ │ +364 } │ │ │ │ │ +365 │ │ │ │ │ +366 private: │ │ │ │ │ +368 std::shared_ptr

_preconditioner; │ │ │ │ │ +369 │ │ │ │ │ +371 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& _communication; │ │ │ │ │ +372 }; │ │ │ │ │ +373 │ │ │ │ │ +376} // end namespace │ │ │ │ │ +377 │ │ │ │ │ +378#endif │ │ │ │ │ +_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. │ │ │ │ │ -_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_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ │ _g_s_e_t_c_._h_h │ │ │ │ │ Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ generic way. │ │ │ │ │ +_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. │ │ │ │ │ -_v_b_v_e_c_t_o_r_._h_h │ │ │ │ │ -??? │ │ │ │ │ -_i_l_u_._h_h │ │ │ │ │ -The incomplete LU factorization kernels. │ │ │ │ │ _s_o_l_v_e_r_s_._h_h │ │ │ │ │ Implementations of the inverse operator interface. │ │ │ │ │ +_i_l_u_._h_h │ │ │ │ │ +The incomplete LU factorization kernels. │ │ │ │ │ +_v_b_v_e_c_t_o_r_._h_h │ │ │ │ │ +??? │ │ │ │ │ _i_o_._h_h │ │ │ │ │ Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ -Define general preconditioner interface. │ │ │ │ │ -_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ │ -implementation wraps a matrix. │ │ │ │ │ +_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ │ +Define base class for scalar product and norm. │ │ │ │ │ +_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_:_:_b_s_o_r_b │ │ │ │ │ +void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +SSOR step. │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:646 │ │ │ │ │ +_D_u_n_e_:_:_b_s_o_r_f │ │ │ │ │ +void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ │ +SOR step. │ │ │ │ │ +DDeeffiinniittiioonn gsetc.hh:634 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_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_:_:_P_I_S │ │ │ │ │ -C::PIS PIS │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:74 │ │ │ │ │ -_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_:_:_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 novlpschwarz.hh:72 │ │ │ │ │ -_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_:_:_R_I_M_a_p │ │ │ │ │ -std::multimap< int, std::pair< int, RILIterator > > RIMap │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:82 │ │ │ │ │ -_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_:_:_R_I │ │ │ │ │ -C::RI RI │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:75 │ │ │ │ │ -_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_:_:_n_o_v_l_p___o_p___a_p_p_l_y │ │ │ │ │ -void novlp_op_apply(const X &x, Y &y, field_type alpha) const │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:126 │ │ │ │ │ -_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_:_:_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 │ │ │ │ │ -NonoverlappingSchwarzOperator(std::shared_ptr< const matrix_type > A, const │ │ │ │ │ -communication_type &com) │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:96 │ │ │ │ │ -_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_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -M::ConstColIterator ColIterator │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:79 │ │ │ │ │ -_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_p_p_l_y │ │ │ │ │ +_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:109 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ +An overlapping Schwarz operator. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +const communication_type & getCommunication() const │ │ │ │ │ +Get the object responsible for communication. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:146 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_g_e_t_m_a_t │ │ │ │ │ +virtual const matrix_type & getmat() const │ │ │ │ │ +get the sequential assembled linear operator. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:133 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ +virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const │ │ │ │ │ +apply operator to x, scale and add: │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:125 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ virtual void apply(const X &x, Y &y) const │ │ │ │ │ apply operator to x: │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:101 │ │ │ │ │ -_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ │ +C communication_type │ │ │ │ │ +The type of the communication object. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:98 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ X domain_type │ │ │ │ │ The type of the domain. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:66 │ │ │ │ │ -_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the linear operator (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:235 │ │ │ │ │ -_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_:_:_R_I_M_a_p_i_t │ │ │ │ │ -RIMap::iterator RIMapit │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:83 │ │ │ │ │ -_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_:_:_g_e_t_m_a_t │ │ │ │ │ -virtual const matrix_type & getmat() const │ │ │ │ │ -get matrix via * │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:121 │ │ │ │ │ -_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_:_:_R_I_L_I_t_e_r_a_t_o_r │ │ │ │ │ -RIL::const_iterator RILIterator │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:78 │ │ │ │ │ -_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_:_:_M_M │ │ │ │ │ -std::multimap< int, int > MM │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:81 │ │ │ │ │ -_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The type of the range. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:68 │ │ │ │ │ -_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_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +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 novlpschwarz.hh:64 │ │ │ │ │ -_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_:_:_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -M::ConstRowIterator RowIterator │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:80 │ │ │ │ │ -_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_:_:_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 novlpschwarz.hh:241 │ │ │ │ │ -_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_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ -virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const │ │ │ │ │ -apply operator to x, scale and add: │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:109 │ │ │ │ │ -_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_:_:_R_I_L │ │ │ │ │ -RI::RemoteIndexList RIL │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:76 │ │ │ │ │ -_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_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +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 novlpschwarz.hh:70 │ │ │ │ │ -_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_:_:_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 │ │ │ │ │ -NonoverlappingSchwarzOperator(const matrix_type &A, const communication_type │ │ │ │ │ -&com) │ │ │ │ │ +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 novlpschwarz.hh:92 │ │ │ │ │ -_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_:_:_R_I_I_t_e_r_a_t_o_r │ │ │ │ │ -RI::const_iterator RIIterator │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_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 │ │ │ │ │ -Nonoverlapping parallel preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_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 │ │ │ │ │ -NonoverlappingBlockPreconditioner(P &p, const communication_type &c) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:302 │ │ │ │ │ -_D_u_n_e_:_:_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_a_t_e_g_o_r_y │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:107 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ +OverlappingSchwarzOperator(const std::shared_ptr< matrix_type > A, const │ │ │ │ │ +communication_type &com) │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:111 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the linear operator (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:139 │ │ │ │ │ +_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +Base class for matrix free definition of preconditioners. │ │ │ │ │ +DDeeffiinniittiioonn preconditioner.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R │ │ │ │ │ +A parallel SSOR preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:184 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ │ +C communication_type │ │ │ │ │ +The type of the communication object. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:186 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ virtual SolverCategory::Category category() const │ │ │ │ │ Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:359 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(domain_type &v, const range_type &d) │ │ │ │ │ -Apply the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:332 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -P::range_type range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:284 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_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 │ │ │ │ │ -NonoverlappingBlockPreconditioner(const std::shared_ptr< P > &p, const │ │ │ │ │ -communication_type &c) │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:233 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_P_a_r_S_S_O_R │ │ │ │ │ +ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c) │ │ │ │ │ Constructor. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:313 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_p_o_s_t │ │ │ │ │ -virtual void post(domain_type &x) │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:197 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ Clean up. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:353 │ │ │ │ │ -_D_u_n_e_:_:_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_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 novlpschwarz.hh:286 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_p_r_e │ │ │ │ │ -virtual void pre(domain_type &x, range_type &b) │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +M matrix_type │ │ │ │ │ +The matrix type the preconditioner is for. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const Y &d) │ │ │ │ │ +Apply the precondtioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, Y &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +Block parallel preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_r_e │ │ │ │ │ +virtual void pre(X &x, Y &b) │ │ │ │ │ Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:322 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_a_p_p_l_y │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:326 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:285 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +BlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:317 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(X &v, const Y &d) │ │ │ │ │ +Apply the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:337 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +BlockPreconditioner(P &p, const communication_type &c) │ │ │ │ │ +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 novlpschwarz.hh:342 │ │ │ │ │ -_D_u_n_e_:_:_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -P::domain_type domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:282 │ │ │ │ │ -_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:109 │ │ │ │ │ -_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_:_:_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:32 │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:344 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ │ +C communication_type │ │ │ │ │ +The type of the communication object.. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:297 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:292 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_o_s_t │ │ │ │ │ +virtual void post(X &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:355 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:290 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:361 │ │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ Category │ │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvertype.hh File Reference │ │ │ │ +dune-istl: ilu.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,38 +71,79 @@ │ │ │ │

│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
solvertype.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
ilu.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Templates characterizing the type of a solver. │ │ │ │ +

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

│ │ │ │ - │ │ │ │ +
#include <cmath>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <map>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include "istlexception.hh"
│ │ │ │ +
│ │ │ │

Go to the source code of this file.

│ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Classes

struct  Dune::IsDirectSolver< Solver >
 
struct  Dune::StoresColumnCompressed< Solver >
struct  Dune::ILU::CRS< B, Alloc >
 a simple compressed row storage matrix class More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::ILU
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

template<class M >
void Dune::ILU::blockILU0Decomposition (M &A)
 compute ILU decomposition of A. A is overwritten by its decomposition
 
template<class M , class X , class Y >
void Dune::ILU::blockILUBacksolve (const M &A, X &v, const Y &d)
 LU backsolve with stored inverse.
 
template<class M >
M::field_type & Dune::ILU::firstMatrixElement (M &A, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
 
template<class K >
K & Dune::ILU::firstMatrixElement (K &A, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
 
template<class K , int n, int m>
K & Dune::ILU::firstMatrixElement (FieldMatrix< K, n, m > &A)
 
template<class M >
void Dune::ILU::blockILUDecomposition (const M &A, int n, M &ILU)
 
template<class M , class CRS , class InvVector >
void Dune::ILU::convertToCRS (const M &A, CRS &lower, CRS &upper, InvVector &inv)
 convert ILU decomposition into CRS format for lower and upper triangular and inverse.
 
template<class CRS , class InvVector , class X , class Y >
void Dune::ILU::blockILUBacksolve (const CRS &lower, const CRS &upper, const InvVector &inv, X &v, const Y &d)
 LU backsolve with stored inverse in CRS format for lower and upper triangular.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Templates characterizing the type of a solver.

│ │ │ │ +

The incomplete LU factorization kernels.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,22 +1,67 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -solvertype.hh File Reference │ │ │ │ │ -Templates characterizing the type of a solver. _M_o_r_e_._._. │ │ │ │ │ +_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 │ │ │ │ │ +ilu.hh File Reference │ │ │ │ │ +The incomplete LU factorization kernels. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -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_:_:_I_L_U_:_:_C_R_S_<_ _B_,_ _A_l_l_o_c_ _> │ │ │ │ │ +  a simple compressed row storage matrix class _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_I_L_U │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ + void  _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 (M &A) │ │ │ │ │ +  compute _I_L_U decomposition of A. A is overwritten by its │ │ │ │ │ + decomposition │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + void  _D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ +  LU backsolve with stored inverse. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +M::field_type &  _D_u_n_e_:_:_I_L_U_:_:_f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (M &A, typename std:: │ │ │ │ │ + enable_if_t::value > *sfinae=nullptr) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + K &  _D_u_n_e_:_:_I_L_U_:_:_f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (K &A, typename std:: │ │ │ │ │ + enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + K &  _D_u_n_e_:_:_I_L_U_:_:_f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (_F_i_e_l_d_M_a_t_r_i_x< K, n, m > &A) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + void  _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 (const M &A, int n, M &ILU) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + void  _D_u_n_e_:_:_I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S (const M &A, _C_R_S &lower, _C_R_S &upper, │ │ │ │ │ + InvVector &inv) │ │ │ │ │ +  convert _I_L_U decomposition into _C_R_S format for lower and upper │ │ │ │ │ + triangular and inverse. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + void  _D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const _C_R_S &lower, const _C_R_S │ │ │ │ │ + &upper, const InvVector &inv, X &v, const Y &d) │ │ │ │ │ +  LU backsolve with stored inverse in _C_R_S format for lower and │ │ │ │ │ + upper triangular. │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ │ +The incomplete LU factorization kernels. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvertype.hh Source File │ │ │ │ +dune-istl: ilu.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,54 +74,475 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
solvertype.hh
│ │ │ │ +
ilu.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ISTL_ILU_HH
│ │ │ │ +
6#define DUNE_ISTL_ILU_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 };
│ │ │ │ +
8#include <cmath>
│ │ │ │ +
9#include <complex>
│ │ │ │ +
10#include <map>
│ │ │ │ +
11#include <vector>
│ │ │ │ +
12
│ │ │ │ +
13#include <dune/common/fmatrix.hh>
│ │ │ │ +
14#include <dune/common/scalarvectorview.hh>
│ │ │ │ +
15#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +
16
│ │ │ │ +
17#include "istlexception.hh"
│ │ │ │ +
18
│ │ │ │ +
23namespace Dune {
│ │ │ │ +
24
│ │ │ │ +
│ │ │ │ +
29 namespace ILU {
│ │ │ │ +
30
│ │ │ │ +
32 template<class M>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
34 {
│ │ │ │ +
35 // iterator types
│ │ │ │ +
36 typedef typename M::RowIterator rowiterator;
│ │ │ │ +
37 typedef typename M::ColIterator coliterator;
│ │ │ │ +
38 typedef typename M::block_type block;
│ │ │ │ +
39
│ │ │ │ +
40 // implement left looking variant with stored inverse
│ │ │ │ +
41 rowiterator endi=A.end();
│ │ │ │ +
42 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
43 {
│ │ │ │ +
44 // coliterator is diagonal after the following loop
│ │ │ │ +
45 coliterator endij=(*i).end(); // end of row i
│ │ │ │ +
46 coliterator ij;
│ │ │ │ +
47
│ │ │ │ +
48 // eliminate entries left of diagonal; store L factor
│ │ │ │ +
49 for (ij=(*i).begin(); ij.index()<i.index(); ++ij)
│ │ │ │ +
50 {
│ │ │ │ +
51 // find A_jj which eliminates A_ij
│ │ │ │ +
52 coliterator jj = A[ij.index()].find(ij.index());
│ │ │ │ +
53
│ │ │ │ +
54 // compute L_ij = A_jj^-1 * A_ij
│ │ │ │ +
55 Impl::asMatrix(*ij).rightmultiply(Impl::asMatrix(*jj));
│ │ │ │ +
56
│ │ │ │ +
57 // modify row
│ │ │ │ +
58 coliterator endjk=A[ij.index()].end(); // end of row j
│ │ │ │ +
59 coliterator jk=jj; ++jk;
│ │ │ │ +
60 coliterator ik=ij; ++ik;
│ │ │ │ +
61 while (ik!=endij && jk!=endjk)
│ │ │ │ +
62 if (ik.index()==jk.index())
│ │ │ │ +
63 {
│ │ │ │ +
64 block B(*jk);
│ │ │ │ +
65 Impl::asMatrix(B).leftmultiply(Impl::asMatrix(*ij));
│ │ │ │ +
66 *ik -= B;
│ │ │ │ +
67 ++ik; ++jk;
│ │ │ │ +
68 }
│ │ │ │ +
69 else
│ │ │ │ +
70 {
│ │ │ │ +
71 if (ik.index()<jk.index())
│ │ │ │ +
72 ++ik;
│ │ │ │ +
73 else
│ │ │ │ +
74 ++jk;
│ │ │ │ +
75 }
│ │ │ │ +
76 }
│ │ │ │ +
77
│ │ │ │ +
78 // invert pivot and store it in A
│ │ │ │ +
79 if (ij.index()!=i.index())
│ │ │ │ +
80 DUNE_THROW(ISTLError,"diagonal entry missing");
│ │ │ │ +
81 try {
│ │ │ │ +
82 Impl::asMatrix(*ij).invert(); // compute inverse of diagonal block
│ │ │ │ +
83 }
│ │ │ │ +
84 catch (Dune::FMatrixError & e) {
│ │ │ │ +
85 DUNE_THROW(MatrixBlockError, "ILU failed to invert matrix block A["
│ │ │ │ +
86 << i.index() << "][" << ij.index() << "]" << e.what();
│ │ │ │ +
87 th__ex.r=i.index(); th__ex.c=ij.index(););
│ │ │ │ +
88 }
│ │ │ │ +
89 }
│ │ │ │ +
90 }
│ │ │ │
│ │ │ │ -
39} // end namespace Dune
│ │ │ │ -
40#endif
│ │ │ │ +
91
│ │ │ │ +
93 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
94 void blockILUBacksolve (const M& A, X& v, const Y& d)
│ │ │ │ +
95 {
│ │ │ │ +
96 // iterator types
│ │ │ │ +
97 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ +
98 typedef typename M::ConstColIterator coliterator;
│ │ │ │ +
99 typedef typename Y::block_type dblock;
│ │ │ │ +
100 typedef typename X::block_type vblock;
│ │ │ │ +
101
│ │ │ │ +
102 // lower triangular solve
│ │ │ │ +
103 rowiterator endi=A.end();
│ │ │ │ +
104 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
105 {
│ │ │ │ +
106 // We need to be careful here: Directly using
│ │ │ │ +
107 // auto rhs = Impl::asVector(d[ i.index() ]);
│ │ │ │ +
108 // is not OK in case this is a proxy. Hence
│ │ │ │ +
109 // we first have to copy the value. Notice that
│ │ │ │ +
110 // this is still not OK, if the vector type itself returns
│ │ │ │ +
111 // proxy references.
│ │ │ │ +
112 dblock rhsValue(d[i.index()]);
│ │ │ │ +
113 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ +
114 for (coliterator j=(*i).begin(); j.index()<i.index(); ++j)
│ │ │ │ +
115 Impl::asMatrix(*j).mmv(Impl::asVector(v[j.index()]),rhs);
│ │ │ │ +
116 Impl::asVector(v[i.index()]) = rhs; // Lii = I
│ │ │ │ +
117 }
│ │ │ │ +
118
│ │ │ │ +
119 // upper triangular solve
│ │ │ │ +
120 rowiterator rendi=A.beforeBegin();
│ │ │ │ +
121 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
│ │ │ │ +
122 {
│ │ │ │ +
123 // We need to be careful here: Directly using
│ │ │ │ +
124 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ │ +
125 // is not OK in case this is a proxy. Hence
│ │ │ │ +
126 // we first have to copy the value. Notice that
│ │ │ │ +
127 // this is still not OK, if the vector type itself returns
│ │ │ │ +
128 // proxy references.
│ │ │ │ +
129 vblock rhsValue(v[i.index()]);
│ │ │ │ +
130 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ +
131 coliterator j;
│ │ │ │ +
132 for (j=(*i).beforeEnd(); j.index()>i.index(); --j)
│ │ │ │ +
133 Impl::asMatrix(*j).mmv(Impl::asVector(v[j.index()]),rhs);
│ │ │ │ +
134 auto&& vi = Impl::asVector(v[i.index()]);
│ │ │ │ +
135 Impl::asMatrix(*j).mv(rhs,vi); // diagonal stores inverse!
│ │ │ │ +
136 }
│ │ │ │ +
137 }
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
139 // recursive function template to access first entry of a matrix
│ │ │ │ +
140 template<class M>
│ │ │ │ +
│ │ │ │ +
141 typename M::field_type& firstMatrixElement (M& A,
│ │ │ │ +
142 [[maybe_unused]] typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr)
│ │ │ │ +
143 {
│ │ │ │ +
144 return firstMatrixElement(*(A.begin()->begin()));
│ │ │ │ +
145 }
│ │ │ │ +
│ │ │ │ +
146
│ │ │ │ +
147 template<class K>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
149 [[maybe_unused]] typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr)
│ │ │ │ +
150 {
│ │ │ │ +
151 return A;
│ │ │ │ +
152 }
│ │ │ │ +
│ │ │ │ +
153
│ │ │ │ +
154 template<class K, int n, int m>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
156 {
│ │ │ │ +
157 return A[0][0];
│ │ │ │ +
158 }
│ │ │ │ +
│ │ │ │ +
159
│ │ │ │ +
166 template<class M>
│ │ │ │ +
│ │ │ │ +
167 void blockILUDecomposition (const M& A, int n, M& ILU)
│ │ │ │ +
168 {
│ │ │ │ +
169 // iterator types
│ │ │ │ +
170 typedef typename M::ColIterator coliterator;
│ │ │ │ +
171 typedef typename M::ConstRowIterator crowiterator;
│ │ │ │ +
172 typedef typename M::ConstColIterator ccoliterator;
│ │ │ │ +
173 typedef typename M::CreateIterator createiterator;
│ │ │ │ +
174 typedef typename M::field_type K;
│ │ │ │ +
175 typedef std::map<size_t, int> map;
│ │ │ │ +
176 typedef typename map::iterator mapiterator;
│ │ │ │ +
177
│ │ │ │ +
178 // symbolic factorization phase, store generation number in first matrix element
│ │ │ │ +
179 crowiterator endi=A.end();
│ │ │ │ +
180 createiterator ci=ILU.createbegin();
│ │ │ │ +
181 for (crowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
182 {
│ │ │ │ +
183 map rowpattern; // maps column index to generation
│ │ │ │ +
184
│ │ │ │ +
185 // initialize pattern with row of A
│ │ │ │ +
186 for (ccoliterator j=(*i).begin(); j!=(*i).end(); ++j)
│ │ │ │ +
187 rowpattern[j.index()] = 0;
│ │ │ │ +
188
│ │ │ │ +
189 // eliminate entries in row which are to the left of the diagonal
│ │ │ │ +
190 for (mapiterator ik=rowpattern.begin(); (*ik).first<i.index(); ++ik)
│ │ │ │ +
191 {
│ │ │ │ +
192 if ((*ik).second<n)
│ │ │ │ +
193 {
│ │ │ │ +
194 coliterator endk = ILU[(*ik).first].end(); // end of row k
│ │ │ │ +
195 coliterator kj = ILU[(*ik).first].find((*ik).first); // diagonal in k
│ │ │ │ +
196 for (++kj; kj!=endk; ++kj) // row k eliminates in row i
│ │ │ │ +
197 {
│ │ │ │ +
198 // we misuse the storage to store an int. If the field_type is std::complex, we have to access the real/abs part
│ │ │ │ +
199 // starting from C++11, we can use std::abs to always return a real value, even if it is double/float
│ │ │ │ +
200 using std::abs;
│ │ │ │ +
201 int generation = (int) Simd::lane(0, abs( firstMatrixElement(*kj) ));
│ │ │ │ +
202 if (generation<n)
│ │ │ │ +
203 {
│ │ │ │ +
204 mapiterator ij = rowpattern.find(kj.index());
│ │ │ │ +
205 if (ij==rowpattern.end())
│ │ │ │ +
206 {
│ │ │ │ +
207 rowpattern[kj.index()] = generation+1;
│ │ │ │ +
208 }
│ │ │ │ +
209 }
│ │ │ │ +
210 }
│ │ │ │ +
211 }
│ │ │ │ +
212 }
│ │ │ │ +
213
│ │ │ │ +
214 // create row
│ │ │ │ +
215 for (mapiterator ik=rowpattern.begin(); ik!=rowpattern.end(); ++ik)
│ │ │ │ +
216 ci.insert((*ik).first);
│ │ │ │ +
217 ++ci; // now row i exist
│ │ │ │ +
218
│ │ │ │ +
219 // write generation index into entries
│ │ │ │ +
220 coliterator endILUij = ILU[i.index()].end();;
│ │ │ │ +
221 for (coliterator ILUij=ILU[i.index()].begin(); ILUij!=endILUij; ++ILUij)
│ │ │ │ +
222 Simd::lane(0, firstMatrixElement(*ILUij)) = (Simd::Scalar<K>) rowpattern[ILUij.index()];
│ │ │ │ +
223 }
│ │ │ │ +
224
│ │ │ │ +
225 // copy entries of A
│ │ │ │ +
226 for (crowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ +
227 {
│ │ │ │ +
228 coliterator ILUij;
│ │ │ │ +
229 coliterator endILUij = ILU[i.index()].end();;
│ │ │ │ +
230 for (ILUij=ILU[i.index()].begin(); ILUij!=endILUij; ++ILUij)
│ │ │ │ +
231 (*ILUij) = 0; // clear row
│ │ │ │ +
232 ccoliterator Aij = (*i).begin();
│ │ │ │ +
233 ccoliterator endAij = (*i).end();
│ │ │ │ +
234 ILUij = ILU[i.index()].begin();
│ │ │ │ +
235 while (Aij!=endAij && ILUij!=endILUij)
│ │ │ │ +
236 {
│ │ │ │ +
237 if (Aij.index()==ILUij.index())
│ │ │ │ +
238 {
│ │ │ │ +
239 *ILUij = *Aij;
│ │ │ │ +
240 ++Aij; ++ILUij;
│ │ │ │ +
241 }
│ │ │ │ +
242 else
│ │ │ │ +
243 {
│ │ │ │ +
244 if (Aij.index()<ILUij.index())
│ │ │ │ +
245 ++Aij;
│ │ │ │ +
246 else
│ │ │ │ +
247 ++ILUij;
│ │ │ │ +
248 }
│ │ │ │ +
249 }
│ │ │ │ +
250 }
│ │ │ │ +
251
│ │ │ │ +
252 // call decomposition on pattern
│ │ │ │ + │ │ │ │ +
254 }
│ │ │ │ +
│ │ │ │ +
255
│ │ │ │ +
257 template <class B, class Alloc = std::allocator<B>>
│ │ │ │ +
│ │ │ │ +
258 struct CRS
│ │ │ │ +
259 {
│ │ │ │ +
260 typedef B block_type;
│ │ │ │ +
261 typedef size_t size_type;
│ │ │ │ +
262
│ │ │ │ +
263 CRS() : nRows_( 0 ) {}
│ │ │ │ +
264
│ │ │ │ +
265 size_type rows() const { return nRows_; }
│ │ │ │ +
266
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
268 {
│ │ │ │ +
269 assert( rows_[ rows() ] != size_type(-1) );
│ │ │ │ +
270 return rows_[ rows() ];
│ │ │ │ +
271 }
│ │ │ │ +
│ │ │ │ +
272
│ │ │ │ +
│ │ │ │ +
273 void resize( const size_type nRows )
│ │ │ │ +
274 {
│ │ │ │ +
275 if( nRows_ != nRows )
│ │ │ │ +
276 {
│ │ │ │ +
277 nRows_ = nRows ;
│ │ │ │ +
278 rows_.resize( nRows_+1, size_type(-1) );
│ │ │ │ +
279 }
│ │ │ │ +
280 }
│ │ │ │ +
│ │ │ │ +
281
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
283 {
│ │ │ │ +
284 const size_type needed = values_.size() + nonZeros ;
│ │ │ │ +
285 if( values_.capacity() < needed )
│ │ │ │ +
286 {
│ │ │ │ +
287 const size_type estimate = needed * 1.1;
│ │ │ │ +
288 values_.reserve( estimate );
│ │ │ │ +
289 cols_.reserve( estimate );
│ │ │ │ +
290 }
│ │ │ │ +
291 }
│ │ │ │ +
│ │ │ │ +
292
│ │ │ │ +
│ │ │ │ +
293 void push_back( const block_type& value, const size_type index )
│ │ │ │ +
294 {
│ │ │ │ +
295 values_.push_back( value );
│ │ │ │ +
296 cols_.push_back( index );
│ │ │ │ +
297 }
│ │ │ │ +
│ │ │ │ +
298
│ │ │ │ +
299 std::vector< size_type > rows_;
│ │ │ │ +
300 std::vector< block_type, Alloc> values_;
│ │ │ │ +
301 std::vector< size_type > cols_;
│ │ │ │ + │ │ │ │ +
303 };
│ │ │ │ +
│ │ │ │ +
304
│ │ │ │ +
306 template<class M, class CRS, class InvVector>
│ │ │ │ +
│ │ │ │ +
307 void convertToCRS(const M& A, CRS& lower, CRS& upper, InvVector& inv )
│ │ │ │ +
308 {
│ │ │ │ +
309 typedef typename M :: size_type size_type;
│ │ │ │ +
310
│ │ │ │ +
311 lower.resize( A.N() );
│ │ │ │ +
312 upper.resize( A.N() );
│ │ │ │ +
313 inv.resize( A.N() );
│ │ │ │ +
314
│ │ │ │ +
315 // lower and upper triangular should store half of non zeros minus diagonal
│ │ │ │ +
316 const size_t memEstimate = (A.nonzeroes() - A.N())/2;
│ │ │ │ +
317
│ │ │ │ +
318 assert( A.nonzeroes() != 0 );
│ │ │ │ +
319 lower.reserveAdditional( memEstimate );
│ │ │ │ +
320 upper.reserveAdditional( memEstimate );
│ │ │ │ +
321
│ │ │ │ +
322 const auto endi = A.end();
│ │ │ │ +
323 size_type row = 0;
│ │ │ │ +
324 size_type colcount = 0;
│ │ │ │ +
325 lower.rows_[ 0 ] = colcount;
│ │ │ │ +
326 for (auto i=A.begin(); i!=endi; ++i, ++row)
│ │ │ │ +
327 {
│ │ │ │ +
328 const size_type iIndex = i.index();
│ │ │ │ +
329
│ │ │ │ +
330 // store entries left of diagonal
│ │ │ │ +
331 for (auto j=(*i).begin(); j.index() < iIndex; ++j )
│ │ │ │ +
332 {
│ │ │ │ +
333 lower.push_back( (*j), j.index() );
│ │ │ │ +
334 ++colcount;
│ │ │ │ +
335 }
│ │ │ │ +
336 lower.rows_[ iIndex+1 ] = colcount;
│ │ │ │ +
337 }
│ │ │ │ +
338
│ │ │ │ +
339 const auto rendi = A.beforeBegin();
│ │ │ │ +
340 row = 0;
│ │ │ │ +
341 colcount = 0;
│ │ │ │ +
342 upper.rows_[ 0 ] = colcount ;
│ │ │ │ +
343
│ │ │ │ +
344 // NOTE: upper and inv store entries in reverse row and col order,
│ │ │ │ +
345 // reverse here relative to ILU
│ │ │ │ +
346 for (auto i=A.beforeEnd(); i!=rendi; --i, ++ row )
│ │ │ │ +
347 {
│ │ │ │ +
348 const auto endij=(*i).beforeBegin(); // end of row i
│ │ │ │ +
349
│ │ │ │ +
350 const size_type iIndex = i.index();
│ │ │ │ +
351
│ │ │ │ +
352 // store in reverse row order for faster access during backsolve
│ │ │ │ +
353 for (auto j=(*i).beforeEnd(); j != endij; --j )
│ │ │ │ +
354 {
│ │ │ │ +
355 const size_type jIndex = j.index();
│ │ │ │ +
356 if( j.index() == iIndex )
│ │ │ │ +
357 {
│ │ │ │ +
358 inv[ row ] = (*j);
│ │ │ │ +
359 break; // assuming consecutive ordering of A
│ │ │ │ +
360 }
│ │ │ │ +
361 else if ( j.index() >= i.index() )
│ │ │ │ +
362 {
│ │ │ │ +
363 upper.push_back( (*j), jIndex );
│ │ │ │ +
364 ++colcount ;
│ │ │ │ +
365 }
│ │ │ │ +
366 }
│ │ │ │ +
367 upper.rows_[ row+1 ] = colcount;
│ │ │ │ +
368 }
│ │ │ │ +
369 } // end convertToCRS
│ │ │ │ +
│ │ │ │ +
370
│ │ │ │ +
372 template<class CRS, class InvVector, class X, class Y>
│ │ │ │ +
│ │ │ │ +
373 void blockILUBacksolve (const CRS& lower,
│ │ │ │ +
374 const CRS& upper,
│ │ │ │ +
375 const InvVector& inv,
│ │ │ │ +
376 X& v, const Y& d)
│ │ │ │ +
377 {
│ │ │ │ +
378 // iterator types
│ │ │ │ +
379 typedef typename Y :: block_type dblock;
│ │ │ │ +
380 typedef typename X :: block_type vblock;
│ │ │ │ +
381 typedef typename X :: size_type size_type ;
│ │ │ │ +
382
│ │ │ │ +
383 const size_type iEnd = lower.rows();
│ │ │ │ +
384 const size_type lastRow = iEnd - 1;
│ │ │ │ +
385 if( iEnd != upper.rows() )
│ │ │ │ +
386 {
│ │ │ │ +
387 DUNE_THROW(ISTLError,"ILU::blockILUBacksolve: lower and upper rows must be the same");
│ │ │ │ +
388 }
│ │ │ │ +
389
│ │ │ │ +
390 // lower triangular solve
│ │ │ │ +
391 for( size_type i=0; i<iEnd; ++ i )
│ │ │ │ +
392 {
│ │ │ │ +
393 dblock rhsValue( d[ i ] );
│ │ │ │ +
394 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ +
395 const size_type rowI = lower.rows_[ i ];
│ │ │ │ +
396 const size_type rowINext = lower.rows_[ i+1 ];
│ │ │ │ +
397
│ │ │ │ +
398 for( size_type col = rowI; col < rowINext; ++ col )
│ │ │ │ +
399 Impl::asMatrix(lower.values_[ col ]).mmv( Impl::asVector(v[ lower.cols_[ col ] ] ), rhs );
│ │ │ │ +
400
│ │ │ │ +
401 Impl::asVector(v[ i ]) = rhs; // Lii = I
│ │ │ │ +
402 }
│ │ │ │ +
403
│ │ │ │ +
404 // upper triangular solve
│ │ │ │ +
405 for( size_type i=0; i<iEnd; ++ i )
│ │ │ │ +
406 {
│ │ │ │ +
407 auto&& vBlock = Impl::asVector(v[ lastRow - i ]);
│ │ │ │ +
408 vblock rhsValue ( v[ lastRow - i ] );
│ │ │ │ +
409 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ +
410 const size_type rowI = upper.rows_[ i ];
│ │ │ │ +
411 const size_type rowINext = upper.rows_[ i+1 ];
│ │ │ │ +
412
│ │ │ │ +
413 for( size_type col = rowI; col < rowINext; ++ col )
│ │ │ │ +
414 Impl::asMatrix(upper.values_[ col ]).mmv( Impl::asVector(v[ upper.cols_[ col ] ]), rhs );
│ │ │ │ +
415
│ │ │ │ +
416 // apply inverse and store result
│ │ │ │ +
417 Impl::asMatrix(inv[ i ]).mv(rhs, vBlock);
│ │ │ │ +
418 }
│ │ │ │ +
419 }
│ │ │ │ +
│ │ │ │ +
420
│ │ │ │ +
421 } // end namespace ILU
│ │ │ │ +
│ │ │ │ +
422
│ │ │ │ +
425} // end namespace
│ │ │ │ +
426
│ │ │ │ +
427#endif
│ │ │ │ + │ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │
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
│ │ │ │ +
void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv)
convert ILU decomposition into CRS format for lower and upper triangular and inverse.
Definition ilu.hh:307
│ │ │ │ +
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ │ +
M::field_type & firstMatrixElement(M &A, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
Definition ilu.hh:141
│ │ │ │ +
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ │ +
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ │ +
a simple compressed row storage matrix class
Definition ilu.hh:259
│ │ │ │ +
std::vector< size_type > cols_
Definition ilu.hh:301
│ │ │ │ +
size_type nonZeros() const
Definition ilu.hh:267
│ │ │ │ +
void resize(const size_type nRows)
Definition ilu.hh:273
│ │ │ │ +
size_type rows() const
Definition ilu.hh:265
│ │ │ │ +
CRS()
Definition ilu.hh:263
│ │ │ │ +
void reserveAdditional(const size_type nonZeros)
Definition ilu.hh:282
│ │ │ │ +
B block_type
Definition ilu.hh:260
│ │ │ │ +
std::vector< block_type, Alloc > values_
Definition ilu.hh:300
│ │ │ │ +
size_type nRows_
Definition ilu.hh:302
│ │ │ │ +
size_t size_type
Definition ilu.hh:261
│ │ │ │ +
std::vector< size_type > rows_
Definition ilu.hh:299
│ │ │ │ +
void push_back(const block_type &value, const size_type index)
Definition ilu.hh:293
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │ │ +
Definition matrixutils.hh:27
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,53 +1,499 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -solvertype.hh │ │ │ │ │ +ilu.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 (C) 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_ISTL_ILU_HH │ │ │ │ │ +6#define DUNE_ISTL_ILU_HH │ │ │ │ │ 7 │ │ │ │ │ -12namespace _D_u_n_e │ │ │ │ │ -13{ │ │ │ │ │ -14 template │ │ │ │ │ -_1_5 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ -16 { │ │ │ │ │ -17 enum │ │ │ │ │ -18 { │ │ │ │ │ -24 _v_a_l_u_e =false │ │ │ │ │ -_2_5 }; │ │ │ │ │ -26 }; │ │ │ │ │ -27 │ │ │ │ │ -28 template │ │ │ │ │ -_2_9 struct _S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ │ -30 { │ │ │ │ │ -31 enum │ │ │ │ │ -32 { │ │ │ │ │ -36 _v_a_l_u_e = false │ │ │ │ │ -_3_7 }; │ │ │ │ │ -38 }; │ │ │ │ │ -39} // end namespace Dune │ │ │ │ │ -40#endif │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +17#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +18 │ │ │ │ │ +23namespace _D_u_n_e { │ │ │ │ │ +24 │ │ │ │ │ +_2_9 namespace ILU { │ │ │ │ │ +30 │ │ │ │ │ +32 template │ │ │ │ │ +_3_3 void _b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n (M& A) │ │ │ │ │ +34 { │ │ │ │ │ +35 // iterator types │ │ │ │ │ +36 typedef typename M::RowIterator rowiterator; │ │ │ │ │ +37 typedef typename M::ColIterator coliterator; │ │ │ │ │ +38 typedef typename M::block_type block; │ │ │ │ │ +39 │ │ │ │ │ +40 // implement left looking variant with stored inverse │ │ │ │ │ +41 rowiterator endi=A.end(); │ │ │ │ │ +42 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +43 { │ │ │ │ │ +44 // coliterator is diagonal after the following loop │ │ │ │ │ +45 coliterator endij=(*i).end(); // end of row i │ │ │ │ │ +46 coliterator ij; │ │ │ │ │ +47 │ │ │ │ │ +48 // eliminate entries left of diagonal; store L factor │ │ │ │ │ +49 for (ij=(*i).begin(); ij.index() │ │ │ │ │ +_9_4 void _b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ +95 { │ │ │ │ │ +96 // iterator types │ │ │ │ │ +97 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ +98 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ +99 typedef typename Y::block_type dblock; │ │ │ │ │ +100 typedef typename X::block_type vblock; │ │ │ │ │ +101 │ │ │ │ │ +102 // lower triangular solve │ │ │ │ │ +103 rowiterator endi=A.end(); │ │ │ │ │ +104 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +105 { │ │ │ │ │ +106 // We need to be careful here: Directly using │ │ │ │ │ +107 // auto rhs = Impl::asVector(d[ i.index() ]); │ │ │ │ │ +108 // is not OK in case this is a proxy. Hence │ │ │ │ │ +109 // we first have to copy the value. Notice that │ │ │ │ │ +110 // this is still not OK, if the vector type itself returns │ │ │ │ │ +111 // proxy references. │ │ │ │ │ +112 dblock rhsValue(d[i.index()]); │ │ │ │ │ +113 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ │ +114 for (coliterator j=(*i).begin(); j.index()i.index(); --j) │ │ │ │ │ +133 Impl::asMatrix(*j).mmv(Impl::asVector(v[j.index()]),rhs); │ │ │ │ │ +134 auto&& vi = Impl::asVector(v[i.index()]); │ │ │ │ │ +135 Impl::asMatrix(*j).mv(rhs,vi); // diagonal stores inverse! │ │ │ │ │ +136 } │ │ │ │ │ +137 } │ │ │ │ │ +138 │ │ │ │ │ +139 // recursive function template to access first entry of a matrix │ │ │ │ │ +140 template │ │ │ │ │ +_1_4_1 typename M::field_type& _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (M& A, │ │ │ │ │ +142 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ +sfinae = nullptr) │ │ │ │ │ +143 { │ │ │ │ │ +144 return _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t(*(A.begin()->begin())); │ │ │ │ │ +145 } │ │ │ │ │ +146 │ │ │ │ │ +147 template │ │ │ │ │ +_1_4_8 K& _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (K& A, │ │ │ │ │ +149 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ +sfinae = nullptr) │ │ │ │ │ +150 { │ │ │ │ │ +151 return A; │ │ │ │ │ +152 } │ │ │ │ │ +153 │ │ │ │ │ +154 template │ │ │ │ │ +_1_5_5 K& _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (_F_i_e_l_d_M_a_t_r_i_x_<_K_,_n_,_m_>& A) │ │ │ │ │ +156 { │ │ │ │ │ +157 return A[0][0]; │ │ │ │ │ +158 } │ │ │ │ │ +159 │ │ │ │ │ +166 template │ │ │ │ │ +_1_6_7 void _b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n (const M& A, int n, M& ILU) │ │ │ │ │ +168 { │ │ │ │ │ +169 // iterator types │ │ │ │ │ +170 typedef typename M::ColIterator coliterator; │ │ │ │ │ +171 typedef typename M::ConstRowIterator crowiterator; │ │ │ │ │ +172 typedef typename M::ConstColIterator ccoliterator; │ │ │ │ │ +173 typedef typename M::CreateIterator createiterator; │ │ │ │ │ +174 typedef typename M::field_type K; │ │ │ │ │ +175 typedef std::map map; │ │ │ │ │ +176 typedef typename map::iterator mapiterator; │ │ │ │ │ +177 │ │ │ │ │ +178 // symbolic factorization phase, store generation number in first matrix │ │ │ │ │ +element │ │ │ │ │ +179 crowiterator endi=A.end(); │ │ │ │ │ +180 createiterator ci=ILU.createbegin(); │ │ │ │ │ +181 for (crowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +182 { │ │ │ │ │ +183 map rowpattern; // maps column index to generation │ │ │ │ │ +184 │ │ │ │ │ +185 // initialize pattern with row of A │ │ │ │ │ +186 for (ccoliterator j=(*i).begin(); j!=(*i).end(); ++j) │ │ │ │ │ +187 rowpattern[j.index()] = 0; │ │ │ │ │ +188 │ │ │ │ │ +189 // eliminate entries in row which are to the left of the diagonal │ │ │ │ │ +190 for (mapiterator ik=rowpattern.begin(); (*ik).first) rowpattern │ │ │ │ │ +[ILUij.index()]; │ │ │ │ │ +223 } │ │ │ │ │ +224 │ │ │ │ │ +225 // copy entries of A │ │ │ │ │ +226 for (crowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ +227 { │ │ │ │ │ +228 coliterator ILUij; │ │ │ │ │ +229 coliterator endILUij = ILU[i.index()].end();; │ │ │ │ │ +230 for (ILUij=ILU[i.index()].begin(); ILUij!=endILUij; ++ILUij) │ │ │ │ │ +231 (*ILUij) = 0; // clear row │ │ │ │ │ +232 ccoliterator Aij = (*i).begin(); │ │ │ │ │ +233 ccoliterator endAij = (*i).end(); │ │ │ │ │ +234 ILUij = ILU[i.index()].begin(); │ │ │ │ │ +235 while (Aij!=endAij && ILUij!=endILUij) │ │ │ │ │ +236 { │ │ │ │ │ +237 if (Aij.index()==ILUij.index()) │ │ │ │ │ +238 { │ │ │ │ │ +239 *ILUij = *Aij; │ │ │ │ │ +240 ++Aij; ++ILUij; │ │ │ │ │ +241 } │ │ │ │ │ +242 else │ │ │ │ │ +243 { │ │ │ │ │ +244 if (Aij.index()> │ │ │ │ │ +_2_5_8 struct _C_R_S │ │ │ │ │ +259 { │ │ │ │ │ +_2_6_0 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +_2_6_1 typedef size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +262 │ │ │ │ │ +_2_6_3 _C_R_S() : _n_R_o_w_s__( 0 ) {} │ │ │ │ │ +264 │ │ │ │ │ +_2_6_5 _s_i_z_e___t_y_p_e _r_o_w_s() const { return _n_R_o_w_s__; } │ │ │ │ │ +266 │ │ │ │ │ +_2_6_7 _s_i_z_e___t_y_p_e _n_o_n_Z_e_r_o_s() const │ │ │ │ │ +268 { │ │ │ │ │ +269 assert( _r_o_w_s__[ _r_o_w_s() ] != _s_i_z_e___t_y_p_e(-1) ); │ │ │ │ │ +270 return _r_o_w_s__[ _r_o_w_s() ]; │ │ │ │ │ +271 } │ │ │ │ │ +272 │ │ │ │ │ +_2_7_3 void _r_e_s_i_z_e( const _s_i_z_e___t_y_p_e nRows ) │ │ │ │ │ +274 { │ │ │ │ │ +275 if( _n_R_o_w_s__ != nRows ) │ │ │ │ │ +276 { │ │ │ │ │ +277 _n_R_o_w_s__ = nRows ; │ │ │ │ │ +278 _r_o_w_s__.resize( _n_R_o_w_s__+1, _s_i_z_e___t_y_p_e(-1) ); │ │ │ │ │ +279 } │ │ │ │ │ +280 } │ │ │ │ │ +281 │ │ │ │ │ +_2_8_2 void _r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l( const _s_i_z_e___t_y_p_e _n_o_n_Z_e_r_o_s ) │ │ │ │ │ +283 { │ │ │ │ │ +284 const _s_i_z_e___t_y_p_e needed = _v_a_l_u_e_s__.size() + _n_o_n_Z_e_r_o_s ; │ │ │ │ │ +285 if( _v_a_l_u_e_s__.capacity() < needed ) │ │ │ │ │ +286 { │ │ │ │ │ +287 const _s_i_z_e___t_y_p_e estimate = needed * 1.1; │ │ │ │ │ +288 _v_a_l_u_e_s__.reserve( estimate ); │ │ │ │ │ +289 _c_o_l_s__.reserve( estimate ); │ │ │ │ │ +290 } │ │ │ │ │ +291 } │ │ │ │ │ +292 │ │ │ │ │ +_2_9_3 void _p_u_s_h___b_a_c_k( const _b_l_o_c_k___t_y_p_e& value, const _s_i_z_e___t_y_p_e index ) │ │ │ │ │ +294 { │ │ │ │ │ +295 _v_a_l_u_e_s__.push_back( value ); │ │ │ │ │ +296 _c_o_l_s__.push_back( index ); │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +_2_9_9 std::vector< size_type > _r_o_w_s__; │ │ │ │ │ +_3_0_0 std::vector< block_type, Alloc> _v_a_l_u_e_s__; │ │ │ │ │ +_3_0_1 std::vector< size_type > _c_o_l_s__; │ │ │ │ │ +_3_0_2 _s_i_z_e___t_y_p_e _n_R_o_w_s__; │ │ │ │ │ +303 }; │ │ │ │ │ +304 │ │ │ │ │ +306 template │ │ │ │ │ +_3_0_7 void _c_o_n_v_e_r_t_T_o_C_R_S(const M& A, _C_R_S& lower, _C_R_S& upper, InvVector& inv ) │ │ │ │ │ +308 { │ │ │ │ │ +309 typedef typename M :: size_type size_type; │ │ │ │ │ +310 │ │ │ │ │ +311 lower._r_e_s_i_z_e( A.N() ); │ │ │ │ │ +312 upper._r_e_s_i_z_e( A.N() ); │ │ │ │ │ +313 inv.resize( A.N() ); │ │ │ │ │ +314 │ │ │ │ │ +315 // lower and upper triangular should store half of non zeros minus diagonal │ │ │ │ │ +316 const size_t memEstimate = (A.nonzeroes() - A.N())/2; │ │ │ │ │ +317 │ │ │ │ │ +318 assert( A.nonzeroes() != 0 ); │ │ │ │ │ +319 lower._r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l( memEstimate ); │ │ │ │ │ +320 upper._r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l( memEstimate ); │ │ │ │ │ +321 │ │ │ │ │ +322 const auto endi = A.end(); │ │ │ │ │ +323 size_type row = 0; │ │ │ │ │ +324 size_type colcount = 0; │ │ │ │ │ +325 lower._r_o_w_s__[ 0 ] = colcount; │ │ │ │ │ +326 for (auto i=A.begin(); i!=endi; ++i, ++row) │ │ │ │ │ +327 { │ │ │ │ │ +328 const size_type iIndex = i.index(); │ │ │ │ │ +329 │ │ │ │ │ +330 // store entries left of diagonal │ │ │ │ │ +331 for (auto j=(*i).begin(); j.index() < iIndex; ++j ) │ │ │ │ │ +332 { │ │ │ │ │ +333 lower._p_u_s_h___b_a_c_k( (*j), j.index() ); │ │ │ │ │ +334 ++colcount; │ │ │ │ │ +335 } │ │ │ │ │ +336 lower._r_o_w_s__[ iIndex+1 ] = colcount; │ │ │ │ │ +337 } │ │ │ │ │ +338 │ │ │ │ │ +339 const auto rendi = A.beforeBegin(); │ │ │ │ │ +340 row = 0; │ │ │ │ │ +341 colcount = 0; │ │ │ │ │ +342 upper._r_o_w_s__[ 0 ] = colcount ; │ │ │ │ │ +343 │ │ │ │ │ +344 // NOTE: upper and inv store entries in reverse row and col order, │ │ │ │ │ +345 // reverse here relative to ILU │ │ │ │ │ +346 for (auto i=A.beforeEnd(); i!=rendi; --i, ++ row ) │ │ │ │ │ +347 { │ │ │ │ │ +348 const auto endij=(*i).beforeBegin(); // end of row i │ │ │ │ │ +349 │ │ │ │ │ +350 const size_type iIndex = i.index(); │ │ │ │ │ +351 │ │ │ │ │ +352 // store in reverse row order for faster access during backsolve │ │ │ │ │ +353 for (auto j=(*i).beforeEnd(); j != endij; --j ) │ │ │ │ │ +354 { │ │ │ │ │ +355 const size_type jIndex = j.index(); │ │ │ │ │ +356 if( j.index() == iIndex ) │ │ │ │ │ +357 { │ │ │ │ │ +358 inv[ row ] = (*j); │ │ │ │ │ +359 break; // assuming consecutive ordering of A │ │ │ │ │ +360 } │ │ │ │ │ +361 else if ( j.index() >= i.index() ) │ │ │ │ │ +362 { │ │ │ │ │ +363 upper._p_u_s_h___b_a_c_k( (*j), jIndex ); │ │ │ │ │ +364 ++colcount ; │ │ │ │ │ +365 } │ │ │ │ │ +366 } │ │ │ │ │ +367 upper._r_o_w_s__[ row+1 ] = colcount; │ │ │ │ │ +368 } │ │ │ │ │ +369 } // end convertToCRS │ │ │ │ │ +370 │ │ │ │ │ +372 template │ │ │ │ │ +_3_7_3 void _b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const _C_R_S& lower, │ │ │ │ │ +374 const _C_R_S& upper, │ │ │ │ │ +375 const InvVector& inv, │ │ │ │ │ +376 X& v, const Y& d) │ │ │ │ │ +377 { │ │ │ │ │ +378 // iterator types │ │ │ │ │ +379 typedef typename Y :: block_type dblock; │ │ │ │ │ +380 typedef typename X :: block_type vblock; │ │ │ │ │ +381 typedef typename X :: size_type size_type ; │ │ │ │ │ +382 │ │ │ │ │ +383 const size_type iEnd = lower._r_o_w_s(); │ │ │ │ │ +384 const size_type lastRow = iEnd - 1; │ │ │ │ │ +385 if( iEnd != upper._r_o_w_s() ) │ │ │ │ │ +386 { │ │ │ │ │ +387 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"ILU::blockILUBacksolve: lower and upper rows must be │ │ │ │ │ +the same"); │ │ │ │ │ +388 } │ │ │ │ │ +389 │ │ │ │ │ +390 // lower triangular solve │ │ │ │ │ +391 for( size_type i=0; i::value > *sfinae=nullptr) │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ +void blockILU0Decomposition(M &A) │ │ │ │ │ +compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ +void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S │ │ │ │ │ +a simple compressed row storage matrix class │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:259 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_c_o_l_s__ │ │ │ │ │ +std::vector< size_type > cols_ │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:301 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_n_o_n_Z_e_r_o_s │ │ │ │ │ +size_type nonZeros() const │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_e_s_i_z_e │ │ │ │ │ +void resize(const size_type nRows) │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:273 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_o_w_s │ │ │ │ │ +size_type rows() const │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:265 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_C_R_S │ │ │ │ │ +CRS() │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l │ │ │ │ │ +void reserveAdditional(const size_type nonZeros) │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +B block_type │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:260 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_v_a_l_u_e_s__ │ │ │ │ │ +std::vector< block_type, Alloc > values_ │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_n_R_o_w_s__ │ │ │ │ │ +size_type nRows_ │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:302 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +size_t size_type │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:261 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_o_w_s__ │ │ │ │ │ +std::vector< size_type > rows_ │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:299 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ +void push_back(const block_type &value, const size_type index) │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ +derive error class from the base class in common │ │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_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_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00092.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlufunctions.hh File Reference │ │ │ │ +dune-istl: ildl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,43 +70,55 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Macros
│ │ │ │ -
superlufunctions.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
ildl.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include "supermatrix.h"
│ │ │ │ -#include "slu_util.h"
│ │ │ │ + │ │ │ │ +

Incomplete LDL decomposition. │ │ │ │ +More...

│ │ │ │ +
#include <dune/common/scalarvectorview.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include "ilu.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Macros

#define int_t   SUPERLU_INT_TYPE
 

│ │ │ │ +Namespaces

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

│ │ │ │ +Functions

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

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ int_t

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define int_t   SUPERLU_INT_TYPE
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Incomplete LDL decomposition.

│ │ │ │ +
Author
Martin Nolte
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,19 +1,44 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -_M_a_c_r_o_s │ │ │ │ │ -superlufunctions.hh File Reference │ │ │ │ │ -#include "supermatrix.h" │ │ │ │ │ -#include "slu_util.h" │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +ildl.hh File Reference │ │ │ │ │ +Incomplete LDL decomposition. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_i_l_u_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _i_n_t___t   SUPERLU_INT_TYPE │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? iinntt__tt ********** │ │ │ │ │ -#define int_t   SUPERLU_INT_TYPE │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &B, const │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &CT, _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &A) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const K &B, const K &CT, K &A, typename │ │ │ │ │ + std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const _M_a_t_r_i_x &B, const _M_a_t_r_i_x &CT, _M_a_t_r_i_x │ │ │ │ │ + &A, typename std::enable_if_t::value > │ │ │ │ │ + *sfinae=nullptr) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + void  _D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e (_M_a_t_r_i_x &A) │ │ │ │ │ +  compute ILDL decomposition of a symmetric matrix A │ │ │ │ │ +  │ │ │ │ │ +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 ********** │ │ │ │ │ +Incomplete LDL decomposition. │ │ │ │ │ + Author │ │ │ │ │ + Martin Nolte │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlufunctions.hh Source File │ │ │ │ +dune-istl: ildl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,130 +74,246 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
superlufunctions.hh
│ │ │ │ +
ildl.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ +
3#ifndef DUNE_ISTL_ILDL_HH
│ │ │ │ +
4#define DUNE_ISTL_ILDL_HH
│ │ │ │ +
5
│ │ │ │ +
6#include <dune/common/scalarvectorview.hh>
│ │ │ │ +
7#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +
8#include "ilu.hh"
│ │ │ │
9
│ │ │ │ -
10#define int_t SUPERLU_INT_TYPE
│ │ │ │ -
11#include "supermatrix.h"
│ │ │ │ -
12#include "slu_util.h"
│ │ │ │ -
13#undef int_t
│ │ │ │ -
14
│ │ │ │ -
15#if __has_include("slu_sdefs.h")
│ │ │ │ -
16extern "C" {
│ │ │ │ -
17 extern void
│ │ │ │ -
18 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ -
19 char *, float *, float *, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
20 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
21 float *, float *, float *, float *,
│ │ │ │ -
22 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ -
23
│ │ │ │ -
24 extern void
│ │ │ │ -
25 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int,
│ │ │ │ -
26 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ -
27 extern void
│ │ │ │ -
28 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *,
│ │ │ │ -
29 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │ -
30 extern int sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │ -
31
│ │ │ │ -
32 extern void sPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ -
33}
│ │ │ │ -
34#endif
│ │ │ │ +
17namespace Dune
│ │ │ │ +
18{
│ │ │ │ +
19
│ │ │ │ +
20 // bildl_subtractBCT
│ │ │ │ +
21 // -----------------
│ │ │ │ +
22
│ │ │ │ +
23 template< class K, int m, int n >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
25 {
│ │ │ │ +
26 for( int i = 0; i < m; ++i )
│ │ │ │ +
27 {
│ │ │ │ +
28 for( int j = 0; j < n; ++j )
│ │ │ │ +
29 {
│ │ │ │ +
30 for( int k = 0; k < n; ++k )
│ │ │ │ +
31 A[ i ][ j ] -= B[ i ][ k ] * CT[ j ][ k ];
│ │ │ │ +
32 }
│ │ │ │ +
33 }
│ │ │ │ +
34 }
│ │ │ │ +
│ │ │ │
35
│ │ │ │ -
36#if __has_include("slu_ddefs.h")
│ │ │ │ -
37extern "C" {
│ │ │ │ -
38 extern void
│ │ │ │ -
39 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ -
40 char *, double *, double *, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
41 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
42 double *, double *, double *, double *,
│ │ │ │ -
43 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ -
44
│ │ │ │ -
45 extern void
│ │ │ │ -
46 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
│ │ │ │ -
47 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │ -
48
│ │ │ │ -
49 extern void
│ │ │ │ -
50 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
│ │ │ │ -
51 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ -
52
│ │ │ │ -
53 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │ -
54
│ │ │ │ -
55 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ -
56}
│ │ │ │ -
57#endif
│ │ │ │ -
58
│ │ │ │ -
59#if __has_include("slu_cdefs.h")
│ │ │ │ -
60#include "slu_scomplex.h"
│ │ │ │ -
61
│ │ │ │ -
62extern "C" {
│ │ │ │ -
63 extern void
│ │ │ │ -
64 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ -
65 char *, float *, float *, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
66 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
67 float *, float *, float *, float *,
│ │ │ │ -
68 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ -
69
│ │ │ │ -
70
│ │ │ │ -
71 extern void
│ │ │ │ -
72 cCreate_Dense_Matrix(SuperMatrix *, int, int, ::complex *, int,
│ │ │ │ -
73 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ +
36 template< class K >
│ │ │ │ +
│ │ │ │ +
37 inline static void bildl_subtractBCT ( const K &B, const K &CT, K &A,
│ │ │ │ +
38 typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr )
│ │ │ │ +
39 {
│ │ │ │ +
40 A -= B * CT;
│ │ │ │ +
41 }
│ │ │ │ +
│ │ │ │ +
42
│ │ │ │ +
43 template< class Matrix >
│ │ │ │ +
│ │ │ │ +
44 inline static void bildl_subtractBCT ( const Matrix &B, const Matrix &CT, Matrix &A,
│ │ │ │ +
45 typename std::enable_if_t<!Dune::IsNumber<Matrix>::value>* sfinae = nullptr )
│ │ │ │ +
46 {
│ │ │ │ +
47 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ +
48 {
│ │ │ │ +
49 auto &&A_i = *i;
│ │ │ │ +
50 auto &&B_i = B[ i.index() ];
│ │ │ │ +
51 const auto ikend = B_i.end();
│ │ │ │ +
52 for( auto j = A_i.begin(), jend = A_i.end(); j != jend; ++j )
│ │ │ │ +
53 {
│ │ │ │ +
54 auto &&A_ij = *j;
│ │ │ │ +
55 auto &&CT_j = CT[ j.index() ];
│ │ │ │ +
56 const auto jkend = CT_j.end();
│ │ │ │ +
57 for( auto ik = B_i.begin(), jk = CT_j.begin(); (ik != ikend) && (jk != jkend); )
│ │ │ │ +
58 {
│ │ │ │ +
59 if( ik.index() == jk.index() )
│ │ │ │ +
60 {
│ │ │ │ +
61 bildl_subtractBCT( *ik, *jk, A_ij );
│ │ │ │ +
62 ++ik; ++jk;
│ │ │ │ +
63 }
│ │ │ │ +
64 else if( ik.index() < jk.index() )
│ │ │ │ +
65 ++ik;
│ │ │ │ +
66 else
│ │ │ │ +
67 ++jk;
│ │ │ │ +
68 }
│ │ │ │ +
69 }
│ │ │ │ +
70 }
│ │ │ │ +
71 }
│ │ │ │ +
│ │ │ │ +
72
│ │ │ │ +
73
│ │ │ │
74
│ │ │ │ -
75
│ │ │ │ -
76 extern void
│ │ │ │ -
77 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, ::complex *,
│ │ │ │ -
78 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │ -
79
│ │ │ │ -
80 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │ -
81
│ │ │ │ -
82 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ -
83}
│ │ │ │ -
84#endif
│ │ │ │ -
85
│ │ │ │ -
86#if __has_include("slu_zdefs.h")
│ │ │ │ -
87#include "slu_dcomplex.h"
│ │ │ │ -
88extern "C" {
│ │ │ │ -
89 extern void
│ │ │ │ -
90 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ │ -
91 char *, double *, double *, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
92 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ │ -
93 double *, double *, double *, double *,
│ │ │ │ -
94 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ │ -
95
│ │ │ │ -
96
│ │ │ │ -
97 extern void
│ │ │ │ -
98 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
│ │ │ │ -
99 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ │ -
100
│ │ │ │ -
101 extern void
│ │ │ │ -
102 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int,
│ │ │ │ -
103 Stype_t, Dtype_t, Mtype_t);
│ │ │ │ -
104
│ │ │ │ -
105 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ │ -
106
│ │ │ │ -
107 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ │ -
108}
│ │ │ │ -
109#endif
│ │ │ │ -
110
│ │ │ │ -
111
│ │ │ │ -
112#endif
│ │ │ │ -
113#endif
│ │ │ │ +
75 // bildl_decompose
│ │ │ │ +
76 // ---------------
│ │ │ │ +
77
│ │ │ │ +
87 template< class Matrix >
│ │ │ │ +
│ │ │ │ +
88 inline void bildl_decompose ( Matrix &A )
│ │ │ │ +
89 {
│ │ │ │ +
90 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ +
91 {
│ │ │ │ +
92 auto &&A_i = *i;
│ │ │ │ +
93
│ │ │ │ +
94 auto ij = A_i.begin();
│ │ │ │ +
95 for( ; ij.index() < i.index(); ++ij )
│ │ │ │ +
96 {
│ │ │ │ +
97 auto &&A_ij = *ij;
│ │ │ │ +
98 auto &&A_j = A[ ij.index() ];
│ │ │ │ +
99
│ │ │ │ +
100 // store L_ij Dj in A_ij (note: for k < i: A_kj = L_kj)
│ │ │ │ +
101 // L_ij Dj = A_ij - \sum_{k < j} (L_ik D_k) L_jk^T
│ │ │ │ +
102 auto ik = A_i.begin();
│ │ │ │ +
103 auto jk = A_j.begin();
│ │ │ │ +
104 while( (ik != ij) && (jk.index() < ij.index()) )
│ │ │ │ +
105 {
│ │ │ │ +
106 if( ik.index() == jk.index() )
│ │ │ │ +
107 {
│ │ │ │ +
108 bildl_subtractBCT(*ik, *jk, A_ij);
│ │ │ │ +
109 ++ik; ++jk;
│ │ │ │ +
110 }
│ │ │ │ +
111 else if( ik.index() < jk.index() )
│ │ │ │ +
112 ++ik;
│ │ │ │ +
113 else
│ │ │ │ +
114 ++jk;
│ │ │ │ +
115 }
│ │ │ │ +
116 }
│ │ │ │ +
117
│ │ │ │ +
118 if( ij.index() != i.index() )
│ │ │ │ +
119 DUNE_THROW( ISTLError, "diagonal entry missing" );
│ │ │ │ +
120
│ │ │ │ +
121 // update diagonal and multiply A_ij by D_j^{-1}
│ │ │ │ +
122 auto &&A_ii = *ij;
│ │ │ │ +
123 for( auto ik = A_i.begin(); ik != ij; ++ik )
│ │ │ │ +
124 {
│ │ │ │ +
125 auto &&A_ik = *ik;
│ │ │ │ +
126 const auto &A_k = A[ ik.index() ];
│ │ │ │ +
127
│ │ │ │ +
128 auto B = A_ik;
│ │ │ │ +
129 Impl::asMatrix(A_ik).rightmultiply( Impl::asMatrix(*A_k.find( ik.index() )) );
│ │ │ │ +
130 bildl_subtractBCT( B, A_ik, A_ii );
│ │ │ │ +
131 }
│ │ │ │ +
132 try
│ │ │ │ +
133 {
│ │ │ │ +
134 Impl::asMatrix(A_ii).invert();
│ │ │ │ +
135 }
│ │ │ │ +
136 catch( const Dune::FMatrixError &e )
│ │ │ │ +
137 {
│ │ │ │ +
138 DUNE_THROW( MatrixBlockError, "ILDL failed to invert matrix block A[" << i.index() << "][" << ij.index() << "]" << e.what(); th__ex.r = i.index(); th__ex.c = ij.index() );
│ │ │ │ +
139 }
│ │ │ │ +
140 }
│ │ │ │ +
141 }
│ │ │ │ +
│ │ │ │ +
142
│ │ │ │ +
143
│ │ │ │ +
144
│ │ │ │ +
145 // bildl_backsolve
│ │ │ │ +
146 // ---------------
│ │ │ │ +
147
│ │ │ │ +
148 template< class Matrix, class X, class Y >
│ │ │ │ +
│ │ │ │ +
149 inline void bildl_backsolve ( const Matrix &A, X &v, const Y &d, bool isLowerTriangular = false )
│ │ │ │ +
150 {
│ │ │ │ +
151 // solve L v = d, note: Lii = I
│ │ │ │ +
152 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ +
153 {
│ │ │ │ +
154 const auto &A_i = *i;
│ │ │ │ +
155 v[ i.index() ] = d[ i.index() ];
│ │ │ │ +
156 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij )
│ │ │ │ +
157 {
│ │ │ │ +
158 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ │ +
159 Impl::asMatrix(*ij).mmv(Impl::asVector( v[ ij.index() ] ), vi);
│ │ │ │ +
160 }
│ │ │ │ +
161 }
│ │ │ │ +
162
│ │ │ │ +
163 // solve D w = v, note: diagonal stores Dii^{-1}
│ │ │ │ +
164 if( isLowerTriangular )
│ │ │ │ +
165 {
│ │ │ │ +
166 // The matrix is lower triangular, so the diagonal entry is the
│ │ │ │ +
167 // last one in each row.
│ │ │ │ +
168 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ +
169 {
│ │ │ │ +
170 const auto &A_i = *i;
│ │ │ │ +
171 const auto ii = A_i.beforeEnd();
│ │ │ │ +
172 assert( ii.index() == i.index() );
│ │ │ │ +
173 // We need to be careful here: Directly using
│ │ │ │ +
174 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ │ +
175 // is not OK in case this is a proxy. Hence
│ │ │ │ +
176 // we first have to copy the value. Notice that
│ │ │ │ +
177 // this is still not OK, if the vector type itself returns
│ │ │ │ +
178 // proxy references.
│ │ │ │ +
179 auto rhsValue = v[ i.index() ];
│ │ │ │ +
180 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ +
181 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ │ +
182 Impl::asMatrix(*ii).mv(rhs, vi);
│ │ │ │ +
183 }
│ │ │ │ +
184 }
│ │ │ │ +
185 else
│ │ │ │ +
186 {
│ │ │ │ +
187 // Without assumptions on the sparsity pattern we have to search
│ │ │ │ +
188 // for the diagonal entry in each row.
│ │ │ │ +
189 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ +
190 {
│ │ │ │ +
191 const auto &A_i = *i;
│ │ │ │ +
192 const auto ii = A_i.find( i.index() );
│ │ │ │ +
193 assert( ii.index() == i.index() );
│ │ │ │ +
194 // We need to be careful here: Directly using
│ │ │ │ +
195 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ │ +
196 // is not OK in case this is a proxy. Hence
│ │ │ │ +
197 // we first have to copy the value. Notice that
│ │ │ │ +
198 // this is still not OK, if the vector type itself returns
│ │ │ │ +
199 // proxy references.
│ │ │ │ +
200 auto rhsValue = v[ i.index() ];
│ │ │ │ +
201 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ +
202 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ │ +
203 Impl::asMatrix(*ii).mv(rhs, vi);
│ │ │ │ +
204 }
│ │ │ │ +
205 }
│ │ │ │ +
206
│ │ │ │ +
207 // solve L^T v = w, note: only L is stored
│ │ │ │ +
208 // note: we perform the operation column-wise from right to left
│ │ │ │ +
209 for( auto i = A.beforeEnd(), iend = A.beforeBegin(); i != iend; --i )
│ │ │ │ +
210 {
│ │ │ │ +
211 const auto &A_i = *i;
│ │ │ │ +
212 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij )
│ │ │ │ +
213 {
│ │ │ │ +
214 auto&& vij = Impl::asVector( v[ ij.index() ] );
│ │ │ │ +
215 Impl::asMatrix(*ij).mmtv(Impl::asVector( v[ i.index() ] ), vij);
│ │ │ │ +
216 }
│ │ │ │ +
217 }
│ │ │ │ +
218 }
│ │ │ │ +
│ │ │ │ +
219
│ │ │ │ +
220} // namespace Dune
│ │ │ │ +
221
│ │ │ │ +
222#endif // #ifndef DUNE_ISTL_ILDL_HH
│ │ │ │ +
The incomplete LU factorization kernels.
│ │ │ │ +
Definition allocator.hh:11
│ │ │ │ +
void bildl_decompose(Matrix &A)
compute ILDL decomposition of a symmetric matrix A
Definition ildl.hh:88
│ │ │ │ +
void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
Definition ildl.hh:149
│ │ │ │ +
static void bildl_subtractBCT(const FieldMatrix< K, m, n > &B, const FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A)
Definition ildl.hh:24
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
RowIterator beforeBegin()
Definition matrix.hh:634
│ │ │ │ +
RowIterator beforeEnd()
Definition matrix.hh:627
│ │ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ +
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:614
│ │ │ │ +
Definition matrixutils.hh:27
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,124 +1,266 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -superlufunctions.hh │ │ │ │ │ +ildl.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// SPDX-FileCopyrightText: Copyright (C) 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 │ │ │ │ │ +3#ifndef DUNE_ISTL_ILDL_HH │ │ │ │ │ +4#define DUNE_ISTL_ILDL_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8#include "_i_l_u_._h_h" │ │ │ │ │ 9 │ │ │ │ │ -_1_0#define int_t SUPERLU_INT_TYPE │ │ │ │ │ -11#include "supermatrix.h" │ │ │ │ │ -12#include "slu_util.h" │ │ │ │ │ -13#undef int_t │ │ │ │ │ -14 │ │ │ │ │ -15#if __has_include("slu_sdefs.h") │ │ │ │ │ -16extern "C" { │ │ │ │ │ -17 extern void │ │ │ │ │ -18 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ -19 char *, float *, float *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -20 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -21 float *, float *, float *, float *, │ │ │ │ │ -22 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ -23 │ │ │ │ │ -24 extern void │ │ │ │ │ -25 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int, │ │ │ │ │ -26 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ -27 extern void │ │ │ │ │ -28 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *, │ │ │ │ │ -29 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ -30 extern int sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ -31 │ │ │ │ │ -32 extern void sPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ -33} │ │ │ │ │ -34#endif │ │ │ │ │ +17namespace _D_u_n_e │ │ │ │ │ +18{ │ │ │ │ │ +19 │ │ │ │ │ +20 // bildl_subtractBCT │ │ │ │ │ +21 // ----------------- │ │ │ │ │ +22 │ │ │ │ │ +23 template< class K, int m, int n > │ │ │ │ │ +_2_4 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &B, │ │ │ │ │ +const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &CT, _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &A ) │ │ │ │ │ +25 { │ │ │ │ │ +26 for( int i = 0; i < m; ++i ) │ │ │ │ │ +27 { │ │ │ │ │ +28 for( int j = 0; j < n; ++j ) │ │ │ │ │ +29 { │ │ │ │ │ +30 for( int k = 0; k < n; ++k ) │ │ │ │ │ +31 A[ i ][ j ] -= B[ i ][ k ] * CT[ j ][ k ]; │ │ │ │ │ +32 } │ │ │ │ │ +33 } │ │ │ │ │ +34 } │ │ │ │ │ 35 │ │ │ │ │ -36#if __has_include("slu_ddefs.h") │ │ │ │ │ -37extern "C" { │ │ │ │ │ -38 extern void │ │ │ │ │ -39 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ -40 char *, double *, double *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -41 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -42 double *, double *, double *, double *, │ │ │ │ │ -43 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ -44 │ │ │ │ │ -45 extern void │ │ │ │ │ -46 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *, │ │ │ │ │ -47 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ -48 │ │ │ │ │ -49 extern void │ │ │ │ │ -50 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int, │ │ │ │ │ -51 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ -52 │ │ │ │ │ -53 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ -54 │ │ │ │ │ -55 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ -56} │ │ │ │ │ -57#endif │ │ │ │ │ -58 │ │ │ │ │ -59#if __has_include("slu_cdefs.h") │ │ │ │ │ -60#include "slu_scomplex.h" │ │ │ │ │ -61 │ │ │ │ │ -62extern "C" { │ │ │ │ │ -63 extern void │ │ │ │ │ -64 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ -65 char *, float *, float *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -66 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -67 float *, float *, float *, float *, │ │ │ │ │ -68 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ -69 │ │ │ │ │ -70 │ │ │ │ │ -71 extern void │ │ │ │ │ -72 cCreate_Dense_Matrix(SuperMatrix *, int, int, ::complex *, int, │ │ │ │ │ -73 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ +36 template< class K > │ │ │ │ │ +_3_7 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const K &B, const K &CT, K &A, │ │ │ │ │ +38 typename std::enable_if_t::value>* sfinae = nullptr ) │ │ │ │ │ +39 { │ │ │ │ │ +40 A -= B * CT; │ │ │ │ │ +41 } │ │ │ │ │ +42 │ │ │ │ │ +43 template< class Matrix > │ │ │ │ │ +_4_4 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const _M_a_t_r_i_x &B, const _M_a_t_r_i_x &CT, │ │ │ │ │ +_M_a_t_r_i_x &A, │ │ │ │ │ +45 typename std::enable_if_t::value>* sfinae = nullptr │ │ │ │ │ +) │ │ │ │ │ +46 { │ │ │ │ │ +47 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ +48 { │ │ │ │ │ +49 auto &&A_i = *i; │ │ │ │ │ +50 auto &&B_i = B[ i.index() ]; │ │ │ │ │ +51 const auto ikend = B_i._e_n_d(); │ │ │ │ │ +52 for( auto j = A_i.begin(), jend = A_i.end(); j != jend; ++j ) │ │ │ │ │ +53 { │ │ │ │ │ +54 auto &&A_ij = *j; │ │ │ │ │ +55 auto &&CT_j = CT[ j.index() ]; │ │ │ │ │ +56 const auto jkend = CT_j._e_n_d(); │ │ │ │ │ +57 for( auto ik = B_i.begin(), jk = CT_j.begin(); (ik != ikend) && (jk != │ │ │ │ │ +jkend); ) │ │ │ │ │ +58 { │ │ │ │ │ +59 if( ik.index() == jk.index() ) │ │ │ │ │ +60 { │ │ │ │ │ +61 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T( *ik, *jk, A_ij ); │ │ │ │ │ +62 ++ik; ++jk; │ │ │ │ │ +63 } │ │ │ │ │ +64 else if( ik.index() < jk.index() ) │ │ │ │ │ +65 ++ik; │ │ │ │ │ +66 else │ │ │ │ │ +67 ++jk; │ │ │ │ │ +68 } │ │ │ │ │ +69 } │ │ │ │ │ +70 } │ │ │ │ │ +71 } │ │ │ │ │ +72 │ │ │ │ │ +73 │ │ │ │ │ 74 │ │ │ │ │ -75 │ │ │ │ │ -76 extern void │ │ │ │ │ -77 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, ::complex *, │ │ │ │ │ -78 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ -79 │ │ │ │ │ -80 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ -81 │ │ │ │ │ -82 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ -83} │ │ │ │ │ -84#endif │ │ │ │ │ -85 │ │ │ │ │ -86#if __has_include("slu_zdefs.h") │ │ │ │ │ -87#include "slu_dcomplex.h" │ │ │ │ │ -88extern "C" { │ │ │ │ │ -89 extern void │ │ │ │ │ -90 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ │ -91 char *, double *, double *, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -92 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ │ -93 double *, double *, double *, double *, │ │ │ │ │ -94 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ │ -95 │ │ │ │ │ -96 │ │ │ │ │ -97 extern void │ │ │ │ │ -98 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *, │ │ │ │ │ -99 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ -100 │ │ │ │ │ -101 extern void │ │ │ │ │ -102 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int, │ │ │ │ │ -103 Stype_t, Dtype_t, Mtype_t); │ │ │ │ │ -104 │ │ │ │ │ -105 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ │ -106 │ │ │ │ │ -107 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ │ -108} │ │ │ │ │ -109#endif │ │ │ │ │ -110 │ │ │ │ │ -111 │ │ │ │ │ -112#endif │ │ │ │ │ -113#endif │ │ │ │ │ +75 // bildl_decompose │ │ │ │ │ +76 // --------------- │ │ │ │ │ +77 │ │ │ │ │ +87 template< class Matrix > │ │ │ │ │ +_8_8 inline void _b_i_l_d_l___d_e_c_o_m_p_o_s_e ( _M_a_t_r_i_x &A ) │ │ │ │ │ +89 { │ │ │ │ │ +90 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ +91 { │ │ │ │ │ +92 auto &&A_i = *i; │ │ │ │ │ +93 │ │ │ │ │ +94 auto ij = A_i.begin(); │ │ │ │ │ +95 for( ; ij.index() < i.index(); ++ij ) │ │ │ │ │ +96 { │ │ │ │ │ +97 auto &&A_ij = *ij; │ │ │ │ │ +98 auto &&A_j = A[ ij.index() ]; │ │ │ │ │ +99 │ │ │ │ │ +100 // store L_ij Dj in A_ij (note: for k < i: A_kj = L_kj) │ │ │ │ │ +101 // L_ij Dj = A_ij - \sum_{k < j} (L_ik D_k) L_jk^T │ │ │ │ │ +102 auto ik = A_i._b_e_g_i_n(); │ │ │ │ │ +103 auto jk = A_j.begin(); │ │ │ │ │ +104 while( (ik != ij) && (jk.index() < ij.index()) ) │ │ │ │ │ +105 { │ │ │ │ │ +106 if( ik.index() == jk.index() ) │ │ │ │ │ +107 { │ │ │ │ │ +108 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T(*ik, *jk, A_ij); │ │ │ │ │ +109 ++ik; ++jk; │ │ │ │ │ +110 } │ │ │ │ │ +111 else if( ik.index() < jk.index() ) │ │ │ │ │ +112 ++ik; │ │ │ │ │ +113 else │ │ │ │ │ +114 ++jk; │ │ │ │ │ +115 } │ │ │ │ │ +116 } │ │ │ │ │ +117 │ │ │ │ │ +118 if( ij.index() != i.index() ) │ │ │ │ │ +119 DUNE_THROW( _I_S_T_L_E_r_r_o_r, "diagonal entry missing" ); │ │ │ │ │ +120 │ │ │ │ │ +121 // update diagonal and multiply A_ij by D_j^{-1} │ │ │ │ │ +122 auto &&A_ii = *ij; │ │ │ │ │ +123 for( auto ik = A_i.begin(); ik != ij; ++ik ) │ │ │ │ │ +124 { │ │ │ │ │ +125 auto &&A_ik = *ik; │ │ │ │ │ +126 const auto &A_k = A[ ik.index() ]; │ │ │ │ │ +127 │ │ │ │ │ +128 auto B = A_ik; │ │ │ │ │ +129 Impl::asMatrix(A_ik).rightmultiply( Impl::asMatrix(*A_k.find( ik.index() )) │ │ │ │ │ +); │ │ │ │ │ +130 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T( B, A_ik, A_ii ); │ │ │ │ │ +131 } │ │ │ │ │ +132 try │ │ │ │ │ +133 { │ │ │ │ │ +134 Impl::asMatrix(A_ii).invert(); │ │ │ │ │ +135 } │ │ │ │ │ +136 catch( const Dune::FMatrixError &e ) │ │ │ │ │ +137 { │ │ │ │ │ +138 DUNE_THROW( _M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r, "ILDL failed to invert matrix block A[" << │ │ │ │ │ +i.index() << "][" << ij.index() << "]" << e.what(); th__ex.r = i.index(); │ │ │ │ │ +th__ex.c = ij.index() ); │ │ │ │ │ +139 } │ │ │ │ │ +140 } │ │ │ │ │ +141 } │ │ │ │ │ +142 │ │ │ │ │ +143 │ │ │ │ │ +144 │ │ │ │ │ +145 // bildl_backsolve │ │ │ │ │ +146 // --------------- │ │ │ │ │ +147 │ │ │ │ │ +148 template< class Matrix, class X, class Y > │ │ │ │ │ +_1_4_9 inline void _b_i_l_d_l___b_a_c_k_s_o_l_v_e ( const _M_a_t_r_i_x &A, X &v, const Y &d, bool │ │ │ │ │ +isLowerTriangular = false ) │ │ │ │ │ +150 { │ │ │ │ │ +151 // solve L v = d, note: Lii = I │ │ │ │ │ +152 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ +153 { │ │ │ │ │ +154 const auto &A_i = *i; │ │ │ │ │ +155 v[ i.index() ] = d[ i.index() ]; │ │ │ │ │ +156 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij ) │ │ │ │ │ +157 { │ │ │ │ │ +158 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ │ +159 Impl::asMatrix(*ij).mmv(Impl::asVector( v[ ij.index() ] ), vi); │ │ │ │ │ +160 } │ │ │ │ │ +161 } │ │ │ │ │ +162 │ │ │ │ │ +163 // solve D w = v, note: diagonal stores Dii^{-1} │ │ │ │ │ +164 if( isLowerTriangular ) │ │ │ │ │ +165 { │ │ │ │ │ +166 // The matrix is lower triangular, so the diagonal entry is the │ │ │ │ │ +167 // last one in each row. │ │ │ │ │ +168 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ +169 { │ │ │ │ │ +170 const auto &A_i = *i; │ │ │ │ │ +171 const auto ii = A_i.beforeEnd(); │ │ │ │ │ +172 assert( ii.index() == i.index() ); │ │ │ │ │ +173 // We need to be careful here: Directly using │ │ │ │ │ +174 // auto rhs = Impl::asVector(v[ i.index() ]); │ │ │ │ │ +175 // is not OK in case this is a proxy. Hence │ │ │ │ │ +176 // we first have to copy the value. Notice that │ │ │ │ │ +177 // this is still not OK, if the vector type itself returns │ │ │ │ │ +178 // proxy references. │ │ │ │ │ +179 auto rhsValue = v[ i.index() ]; │ │ │ │ │ +180 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ │ +181 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ │ +182 Impl::asMatrix(*ii).mv(rhs, vi); │ │ │ │ │ +183 } │ │ │ │ │ +184 } │ │ │ │ │ +185 else │ │ │ │ │ +186 { │ │ │ │ │ +187 // Without assumptions on the sparsity pattern we have to search │ │ │ │ │ +188 // for the diagonal entry in each row. │ │ │ │ │ +189 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ │ +190 { │ │ │ │ │ +191 const auto &A_i = *i; │ │ │ │ │ +192 const auto ii = A_i.find( i.index() ); │ │ │ │ │ +193 assert( ii.index() == i.index() ); │ │ │ │ │ +194 // We need to be careful here: Directly using │ │ │ │ │ +195 // auto rhs = Impl::asVector(v[ i.index() ]); │ │ │ │ │ +196 // is not OK in case this is a proxy. Hence │ │ │ │ │ +197 // we first have to copy the value. Notice that │ │ │ │ │ +198 // this is still not OK, if the vector type itself returns │ │ │ │ │ +199 // proxy references. │ │ │ │ │ +200 auto rhsValue = v[ i.index() ]; │ │ │ │ │ +201 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ │ +202 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ │ +203 Impl::asMatrix(*ii).mv(rhs, vi); │ │ │ │ │ +204 } │ │ │ │ │ +205 } │ │ │ │ │ +206 │ │ │ │ │ +207 // solve L^T v = w, note: only L is stored │ │ │ │ │ +208 // note: we perform the operation column-wise from right to left │ │ │ │ │ +209 for( auto i = A._b_e_f_o_r_e_E_n_d(), iend = A._b_e_f_o_r_e_B_e_g_i_n(); i != iend; --i ) │ │ │ │ │ +210 { │ │ │ │ │ +211 const auto &A_i = *i; │ │ │ │ │ +212 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij ) │ │ │ │ │ +213 { │ │ │ │ │ +214 auto&& vij = Impl::asVector( v[ ij.index() ] ); │ │ │ │ │ +215 Impl::asMatrix(*ij).mmtv(Impl::asVector( v[ i.index() ] ), vij); │ │ │ │ │ +216 } │ │ │ │ │ +217 } │ │ │ │ │ +218 } │ │ │ │ │ +219 │ │ │ │ │ +220} // namespace Dune │ │ │ │ │ +221 │ │ │ │ │ +222#endif // #ifndef DUNE_ISTL_ILDL_HH │ │ │ │ │ +_i_l_u_._h_h │ │ │ │ │ +The incomplete LU factorization kernels. │ │ │ │ │ +_D_u_n_e │ │ │ │ │ +DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ +_D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e │ │ │ │ │ +void bildl_decompose(Matrix &A) │ │ │ │ │ +compute ILDL decomposition of a symmetric matrix A │ │ │ │ │ +DDeeffiinniittiioonn ildl.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_b_i_l_d_l___b_a_c_k_s_o_l_v_e │ │ │ │ │ +void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool │ │ │ │ │ +isLowerTriangular=false) │ │ │ │ │ +DDeeffiinniittiioonn ildl.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T │ │ │ │ │ +static void bildl_subtractBCT(const FieldMatrix< K, m, n > &B, const │ │ │ │ │ +FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A) │ │ │ │ │ +DDeeffiinniittiioonn ildl.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ +derive error class from the base class in common │ │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r │ │ │ │ │ +Error when performing an operation on a matrix block. │ │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ +RowIterator beforeBegin() │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:634 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +RowIterator beforeEnd() │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:627 │ │ │ │ │ +_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:620 │ │ │ │ │ +_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:614 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: parameters.hh File Reference │ │ │ │ +dune-istl: matrixutils.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,67 +65,99 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Enumerations
│ │ │ │ - │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Parameter classes for customizing AMG. │ │ │ │ +

Some handy generic functions for ISTL matrices. │ │ │ │ More...

│ │ │ │ -
#include <cstddef>
│ │ │ │ +
#include <set>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <dune/common/dynmatrix.hh>
│ │ │ │ +#include <dune/common/diagonalmatrix.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include <dune/istl/scaledidmatrix.hh>
│ │ │ │ +#include "istlexception.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...
struct  Dune::CheckIfDiagonalPresent< Matrix, blocklevel, l >
 Check whether the a matrix has diagonal values on blocklevel recursion levels. More...
 
class  Dune::Amg::AggregationParameters
 Parameters needed for the aggregation process. More...
struct  Dune::CheckIfDiagonalPresent< Matrix, 0, l >
 
class  Dune::Amg::CoarseningParameters
 Parameters for the complete coarsening process. More...
struct  Dune::CheckIfDiagonalPresent< MultiTypeBlockMatrix< T1, Args... >, blocklevel, l >
 
class  Dune::Amg::Parameters
 All parameters for AMG. More...
struct  Dune::MatrixDimension< M >
 
struct  Dune::MatrixDimension< Matrix< B, TA > >
 
struct  Dune::MatrixDimension< BCRSMatrix< B, TA > >
 
struct  Dune::MatrixDimension< BCRSMatrix< FieldMatrix< B, n, m >, TA > >
 
struct  Dune::MatrixDimension< FieldMatrix< K, n, m > >
 
struct  Dune::MatrixDimension< Dune::DynamicMatrix< T > >
 
struct  Dune::MatrixDimension< Matrix< FieldMatrix< K, n, m >, TA > >
 
struct  Dune::MatrixDimension< DiagonalMatrix< K, n > >
 
struct  Dune::MatrixDimension< ScaledIdentityMatrix< K, n > >
 
struct  Dune::IsMatrix< T >
 Test whether a type is an ISTL Matrix. More...
 
struct  Dune::IsMatrix< DenseMatrix< T > >
 
struct  Dune::IsMatrix< BCRSMatrix< T, A > >
 
struct  Dune::PointerCompare< T >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │

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

│ │ │ │ +Functions

template<class M >
auto Dune::countNonZeros (const M &, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr)
 Get the number of nonzero fields in the matrix.
 
template<class M >
auto Dune::countNonZeros (const M &matrix, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
 
template<class M , class C >
void Dune::printGlobalSparseMatrix (const M &mat, C &ooc, std::ostream &os)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Parameter classes for customizing AMG.

│ │ │ │ +

Some handy generic functions for ISTL matrices.

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

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

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,45 +1,80 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -_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 │ │ │ │ │ +_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 │ │ │ │ │ +matrixutils.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 │ │ │ │ │ +Some handy generic functions for ISTL matrices. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#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> │ │ │ │ │ +#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_:_:_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_._._. │ │ │ │ │ +struct   _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_<_ _M_a_t_r_i_x_,_ _b_l_o_c_k_l_e_v_e_l_,_ _l_ _> │ │ │ │ │ +  Check whether the a matrix has diagonal values on blocklevel recursion │ │ │ │ │ + levels. _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_._._. │ │ │ │ │ +struct   _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_<_ _M_a_t_r_i_x_,_ _0_,_ _l_ _> │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +struct   _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_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _A_r_g_s_._._._ _>_, │ │ │ │ │ + _b_l_o_c_k_l_e_v_e_l_,_ _l_ _> │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _T_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_M_a_t_r_i_x_<_ _T_ _> │ │ │ │ │ +  Test whether a type is an _I_S_T_L _M_a_t_r_i_x. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_M_a_t_r_i_x_<_ _D_e_n_s_e_M_a_t_r_i_x_<_ _T_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_P_o_i_n_t_e_r_C_o_m_p_a_r_e_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +auto  _D_u_n_e_:_:_c_o_u_n_t_N_o_n_Z_e_r_o_s (const M &, typename std::enable_if_t< Dune:: │ │ │ │ │ + IsNumber< M >::value > *sfinae=nullptr) │ │ │ │ │ +  Get the number of nonzero fields in the matrix. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +auto  _D_u_n_e_:_:_c_o_u_n_t_N_o_n_Z_e_r_o_s (const M &matrix, typename std::enable_if_t::value > *sfinae=nullptr) │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +template │ │ │ │ │ +void  _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 (const M &_m_a_t, C &ooc, std::ostream &os) │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Parameter classes for customizing AMG. │ │ │ │ │ +Some handy generic functions for ISTL matrices. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ -All parameters of the AMG can be set by using the class Parameter, which can be │ │ │ │ │ -provided to CoarsenCriterion via its constructor. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: parameters.hh Source File │ │ │ │ +dune-istl: matrixutils.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,395 +70,721 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
parameters.hh
│ │ │ │ +
matrixutils.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ISTL_MATRIXUTILS_HH
│ │ │ │ +
6#define DUNE_ISTL_MATRIXUTILS_HH
│ │ │ │
7
│ │ │ │ -
8#include <cstddef>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune
│ │ │ │ -
11{
│ │ │ │ -
12 namespace Amg
│ │ │ │ -
13 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
31 {
│ │ │ │ -
32 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
35 : alpha_(1.0/3.0), beta_(1.0E-5)
│ │ │ │ -
36 {}
│ │ │ │ -
│ │ │ │ -
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 }
│ │ │ │ -
│ │ │ │ -
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;
│ │ │ │ -
113
│ │ │ │ -
114 for(; dim>0; dim--) {
│ │ │ │ -
115 csize*=diameter;
│ │ │ │ -
116 maxDistance_+=diameter-1;
│ │ │ │ -
117 }
│ │ │ │ -
118 minAggregateSize_=csize;
│ │ │ │ -
119 maxAggregateSize_=static_cast<std::size_t>(csize*1.5);
│ │ │ │ -
120 }
│ │ │ │ -
│ │ │ │ -
121
│ │ │ │ -
│ │ │ │ -
132 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
│ │ │ │ -
133 {
│ │ │ │ -
134 setDefaultValuesIsotropic(dim, diameter);
│ │ │ │ -
135 maxDistance_+=dim-1;
│ │ │ │ -
136 }
│ │ │ │ -
│ │ │ │ -
144 std::size_t maxDistance() const { return maxDistance_;}
│ │ │ │ -
145
│ │ │ │ -
154 void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
│ │ │ │ -
155
│ │ │ │ -
│ │ │ │ -
161 bool skipIsolated() const
│ │ │ │ -
162 {
│ │ │ │ -
163 return skipiso_;
│ │ │ │ -
164 }
│ │ │ │ -
│ │ │ │ +
8#include <set>
│ │ │ │ +
9#include <vector>
│ │ │ │ +
10#include <limits>
│ │ │ │ +
11#include <dune/common/typetraits.hh>
│ │ │ │ +
12#include <dune/common/fmatrix.hh>
│ │ │ │ +
13#include <dune/common/dynmatrix.hh>
│ │ │ │ +
14#include <dune/common/diagonalmatrix.hh>
│ │ │ │ +
15#include <dune/common/scalarmatrixview.hh>
│ │ │ │ + │ │ │ │ +
17#include "istlexception.hh"
│ │ │ │ +
18
│ │ │ │ +
19namespace Dune
│ │ │ │ +
20{
│ │ │ │ +
21
│ │ │ │ +
22#ifndef DOYXGEN
│ │ │ │ +
23 template<typename B, typename A>
│ │ │ │ +
24 class BCRSMatrix;
│ │ │ │ +
25
│ │ │ │ +
26 template<typename K, int n, int m>
│ │ │ │ + │ │ │ │ +
28
│ │ │ │ +
29 template<class T, class A>
│ │ │ │ +
30 class Matrix;
│ │ │ │ +
31#endif
│ │ │ │ +
32
│ │ │ │ +
46 template<class Matrix, std::size_t blocklevel, std::size_t l=blocklevel>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
48 {
│ │ │ │ +
│ │ │ │ +
53 static void check([[maybe_unused]] const Matrix& mat)
│ │ │ │ +
54 {
│ │ │ │ +
55#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
56 typedef typename Matrix::ConstRowIterator Row;
│ │ │ │ +
57 typedef typename Matrix::ConstColIterator Entry;
│ │ │ │ +
58 for(Row row = mat.begin(); row!=mat.end(); ++row) {
│ │ │ │ +
59 Entry diagonal = row->find(row.index());
│ │ │ │ +
60 if(diagonal==row->end())
│ │ │ │ +
61 DUNE_THROW(ISTLError, "Missing diagonal value in row "<<row.index()
│ │ │ │ +
62 <<" at block recursion level "<<l-blocklevel);
│ │ │ │ +
63 else{
│ │ │ │ +
64 auto m = Impl::asMatrix(*diagonal);
│ │ │ │ +
65 CheckIfDiagonalPresent<decltype(m),blocklevel-1,l>::check(m);
│ │ │ │ +
66 }
│ │ │ │ +
67 }
│ │ │ │ +
68#endif
│ │ │ │ +
69 }
│ │ │ │ +
│ │ │ │ +
70 };
│ │ │ │ +
│ │ │ │ +
71
│ │ │ │ +
72 template<class Matrix, std::size_t l>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
74 {
│ │ │ │ +
│ │ │ │ +
75 static void check(const Matrix& mat)
│ │ │ │ +
76 {
│ │ │ │ +
77 typedef typename Matrix::ConstRowIterator Row;
│ │ │ │ +
78 for(Row row = mat.begin(); row!=mat.end(); ++row) {
│ │ │ │ +
79 if(row->find(row.index())==row->end())
│ │ │ │ +
80 DUNE_THROW(ISTLError, "Missing diagonal value in row "<<row.index()
│ │ │ │ +
81 <<" at block recursion level "<<l);
│ │ │ │ +
82 }
│ │ │ │ +
83 }
│ │ │ │ +
│ │ │ │ +
84 };
│ │ │ │ +
│ │ │ │ +
85
│ │ │ │ +
86 template<typename FirstRow, typename... Args>
│ │ │ │ +
87 class MultiTypeBlockMatrix;
│ │ │ │ +
88
│ │ │ │ +
89 template<std::size_t blocklevel, std::size_t l, typename T1, typename... Args>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
91 blocklevel,l>
│ │ │ │ +
92 {
│ │ │ │ +
93 typedef MultiTypeBlockMatrix<T1,Args...> Matrix;
│ │ │ │ +
94
│ │ │ │ +
│ │ │ │ +
99 static void check(const Matrix& /* mat */)
│ │ │ │ +
100 {
│ │ │ │ +
101#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
102 // TODO Implement check
│ │ │ │ +
103#endif
│ │ │ │ +
104 }
│ │ │ │ +
│ │ │ │ +
105 };
│ │ │ │ +
│ │ │ │ +
106
│ │ │ │ +
118 template<class M>
│ │ │ │ +
│ │ │ │ +
119 inline auto countNonZeros(const M&,
│ │ │ │ +
120 [[maybe_unused]] typename std::enable_if_t<Dune::IsNumber<M>::value>* sfinae = nullptr)
│ │ │ │ +
121 {
│ │ │ │ +
122 return 1;
│ │ │ │ +
123 }
│ │ │ │ +
│ │ │ │ +
124
│ │ │ │ +
125 template<class M>
│ │ │ │ +
│ │ │ │ +
126 inline auto countNonZeros(const M& matrix,
│ │ │ │ +
127 [[maybe_unused]] typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr)
│ │ │ │ +
128 {
│ │ │ │ +
129 typename M::size_type nonZeros = 0;
│ │ │ │ +
130 for(auto&& row : matrix)
│ │ │ │ +
131 for(auto&& entry : row)
│ │ │ │ +
132 nonZeros += countNonZeros(entry);
│ │ │ │ +
133 return nonZeros;
│ │ │ │ +
134 }
│ │ │ │ +
│ │ │ │ +
135
│ │ │ │ +
136 /*
│ │ │ │ +
137 template<class M>
│ │ │ │ +
138 struct ProcessOnFieldsOfMatrix
│ │ │ │ +
139 */
│ │ │ │ +
140
│ │ │ │ +
142 namespace
│ │ │ │ +
143 {
│ │ │ │ +
144 struct CompPair {
│ │ │ │ +
145 template<class G,class M>
│ │ │ │ +
146 bool operator()(const std::pair<G,M>& p1, const std::pair<G,M>& p2) const
│ │ │ │ +
147 {
│ │ │ │ +
148 return p1.first<p2.first;
│ │ │ │ +
149 }
│ │ │ │ +
150 };
│ │ │ │ +
151
│ │ │ │ +
152 }
│ │ │ │ +
153 template<class M, class C>
│ │ │ │ +
│ │ │ │ +
154 void printGlobalSparseMatrix(const M& mat, C& ooc, std::ostream& os)
│ │ │ │ +
155 {
│ │ │ │ +
156 typedef typename C::ParallelIndexSet::const_iterator IIter;
│ │ │ │ +
157 typedef typename C::OwnerSet OwnerSet;
│ │ │ │ +
158 typedef typename C::ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ │ +
159
│ │ │ │ +
160 GlobalIndex gmax=0;
│ │ │ │ +
161
│ │ │ │ +
162 for(IIter idx=ooc.indexSet().begin(), eidx=ooc.indexSet().end();
│ │ │ │ +
163 idx!=eidx; ++idx)
│ │ │ │ +
164 gmax=std::max(gmax,idx->global());
│ │ │ │
165
│ │ │ │ -
│ │ │ │ -
171 void setSkipIsolated(bool skip)
│ │ │ │ +
166 gmax=ooc.communicator().max(gmax);
│ │ │ │ +
167 ooc.buildGlobalLookup();
│ │ │ │ +
168
│ │ │ │ +
169 for(IIter idx=ooc.indexSet().begin(), eidx=ooc.indexSet().end();
│ │ │ │ +
170 idx!=eidx; ++idx) {
│ │ │ │ +
171 if(OwnerSet::contains(idx->local().attribute()))
│ │ │ │
172 {
│ │ │ │ -
173 skipiso_=skip;
│ │ │ │ -
174 }
│ │ │ │ -
│ │ │ │ -
175
│ │ │ │ -
180 std::size_t minAggregateSize() const { return minAggregateSize_;}
│ │ │ │ -
181
│ │ │ │ -
188 void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
│ │ │ │ -
189
│ │ │ │ -
194 std::size_t maxAggregateSize() const { return maxAggregateSize_;}
│ │ │ │ -
195
│ │ │ │ -
202 void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
│ │ │ │ -
203
│ │ │ │ -
211 std::size_t maxConnectivity() const { return connectivity_;}
│ │ │ │ -
212
│ │ │ │ -
220 void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
│ │ │ │ -
221
│ │ │ │ -
222 private:
│ │ │ │ -
223 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
│ │ │ │ -
224 bool skipiso_;
│ │ │ │ -
225
│ │ │ │ -
226 };
│ │ │ │ -
│ │ │ │ -
227
│ │ │ │ -
228
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
249 };
│ │ │ │ -
│ │ │ │ -
250
│ │ │ │ -
251
│ │ │ │ -
252
│ │ │ │ -
253
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
258 {
│ │ │ │ -
259 public:
│ │ │ │ -
│ │ │ │ -
263 void setMaxLevel(int l)
│ │ │ │ -
264 {
│ │ │ │ -
265 maxLevel_ = l;
│ │ │ │ -
266 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
270 int maxLevel() const
│ │ │ │ -
271 {
│ │ │ │ -
272 return maxLevel_;
│ │ │ │ -
273 }
│ │ │ │ -
│ │ │ │ -
274
│ │ │ │ -
│ │ │ │ -
278 void setCoarsenTarget(int nodes)
│ │ │ │ -
279 {
│ │ │ │ -
280 coarsenTarget_ = nodes;
│ │ │ │ -
281 }
│ │ │ │ -
│ │ │ │ -
282
│ │ │ │ -
│ │ │ │ -
286 int coarsenTarget() const
│ │ │ │ -
287 {
│ │ │ │ -
288 return coarsenTarget_;
│ │ │ │ -
289 }
│ │ │ │ -
│ │ │ │ -
290
│ │ │ │ -
│ │ │ │ -
296 void setMinCoarsenRate(double rate)
│ │ │ │ -
297 {
│ │ │ │ -
298 minCoarsenRate_ = rate;
│ │ │ │ -
299 }
│ │ │ │ +
173 typedef typename M::block_type Block;
│ │ │ │ +
174
│ │ │ │ +
175 std::set<std::pair<GlobalIndex,Block>,CompPair> entries;
│ │ │ │ +
176
│ │ │ │ +
177 // sort rows
│ │ │ │ +
178 typedef typename M::ConstColIterator CIter;
│ │ │ │ +
179 for(CIter c=mat[idx->local()].begin(), cend=mat[idx->local()].end();
│ │ │ │ +
180 c!=cend; ++c) {
│ │ │ │ +
181 const typename C::ParallelIndexSet::IndexPair* pair
│ │ │ │ +
182 =ooc.globalLookup().pair(c.index());
│ │ │ │ +
183 assert(pair);
│ │ │ │ +
184 entries.insert(std::make_pair(pair->global(), *c));
│ │ │ │ +
185 }
│ │ │ │ +
186
│ │ │ │ +
187 //wait until its the rows turn.
│ │ │ │ +
188 GlobalIndex rowidx = idx->global();
│ │ │ │ +
189 GlobalIndex cur=std::numeric_limits<GlobalIndex>::max();
│ │ │ │ +
190 while(cur!=rowidx)
│ │ │ │ +
191 cur=ooc.communicator().min(rowidx);
│ │ │ │ +
192
│ │ │ │ +
193 // print rows
│ │ │ │ +
194 typedef typename std::set<std::pair<GlobalIndex,Block>,CompPair>::iterator SIter;
│ │ │ │ +
195 for(SIter s=entries.begin(), send=entries.end(); s!=send; ++s)
│ │ │ │ +
196 os<<idx->global()<<" "<<s->first<<" "<<s->second<<std::endl;
│ │ │ │ +
197
│ │ │ │ +
198
│ │ │ │ +
199 }
│ │ │ │ +
200 }
│ │ │ │ +
201
│ │ │ │ +
202 ooc.freeGlobalLookup();
│ │ │ │ +
203 // Wait until everybody is finished
│ │ │ │ +
204 GlobalIndex cur=std::numeric_limits<GlobalIndex>::max();
│ │ │ │ +
205 while(cur!=ooc.communicator().min(cur)) ;
│ │ │ │ +
206 }
│ │ │ │ +
│ │ │ │ +
207
│ │ │ │ +
208 // Default implementation for scalar types
│ │ │ │ +
209 template<typename M>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
211 {
│ │ │ │ +
212 static_assert(IsNumber<M>::value, "MatrixDimension is not implemented for this type!");
│ │ │ │ +
213
│ │ │ │ +
│ │ │ │ +
214 static auto rowdim(const M& A)
│ │ │ │ +
215 {
│ │ │ │ +
216 return 1;
│ │ │ │ +
217 }
│ │ │ │ +
│ │ │ │ +
218
│ │ │ │ +
│ │ │ │ +
219 static auto coldim(const M& A)
│ │ │ │ +
220 {
│ │ │ │ +
221 return 1;
│ │ │ │ +
222 }
│ │ │ │ +
│ │ │ │ +
223 };
│ │ │ │ +
│ │ │ │ +
224
│ │ │ │ +
225 // Default implementation for scalar types
│ │ │ │ +
226 template<typename B, typename TA>
│ │ │ │ +
│ │ │ │ +
227 struct MatrixDimension<Matrix<B,TA> >
│ │ │ │ +
228 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
231
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
233 {
│ │ │ │ + │ │ │ │ +
235 }
│ │ │ │ +
│ │ │ │ +
236
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
238 {
│ │ │ │ + │ │ │ │ +
240 }
│ │ │ │ +
│ │ │ │ +
241
│ │ │ │ +
│ │ │ │ +
242 static size_type rowdim (const Matrix<B,TA>& A)
│ │ │ │ +
243 {
│ │ │ │ +
244 size_type nn=0;
│ │ │ │ +
245 for (size_type i=0; i<A.N(); i++)
│ │ │ │ +
246 nn += rowdim(A,i);
│ │ │ │ +
247 return nn;
│ │ │ │ +
248 }
│ │ │ │ +
│ │ │ │ +
249
│ │ │ │ +
│ │ │ │ +
250 static size_type coldim (const Matrix<B,TA>& A)
│ │ │ │ +
251 {
│ │ │ │ +
252 size_type nn=0;
│ │ │ │ +
253 for (size_type i=0; i<A.M(); i++)
│ │ │ │ +
254 nn += coldim(A,i);
│ │ │ │ +
255 return nn;
│ │ │ │ +
256 }
│ │ │ │ +
│ │ │ │ +
257 };
│ │ │ │ +
│ │ │ │ +
258
│ │ │ │ +
259
│ │ │ │ +
260 template<typename B, typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
262 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
265 typedef typename Matrix::size_type size_type;
│ │ │ │ +
266
│ │ │ │ +
│ │ │ │ +
267 static size_type rowdim (const Matrix& A, size_type i)
│ │ │ │ +
268 {
│ │ │ │ +
269 const B* row = A.r[i].getptr();
│ │ │ │ +
270 if(row)
│ │ │ │ + │ │ │ │ +
272 else
│ │ │ │ +
273 return 0;
│ │ │ │ +
274 }
│ │ │ │ +
│ │ │ │ +
275
│ │ │ │ +
│ │ │ │ +
276 static size_type coldim (const Matrix& A, size_type c)
│ │ │ │ +
277 {
│ │ │ │ +
278 // find an entry in column c
│ │ │ │ +
279 if (A.nnz_ > 0)
│ │ │ │ +
280 {
│ │ │ │ +
281 for (size_type k=0; k<A.nnz_; k++) {
│ │ │ │ +
282 if (A.j_.get()[k] == c) {
│ │ │ │ + │ │ │ │ +
284 }
│ │ │ │ +
285 }
│ │ │ │ +
286 }
│ │ │ │ +
287 else
│ │ │ │ +
288 {
│ │ │ │ +
289 for (size_type i=0; i<A.N(); i++)
│ │ │ │ +
290 {
│ │ │ │ +
291 size_type* j = A.r[i].getindexptr();
│ │ │ │ +
292 B* a = A.r[i].getptr();
│ │ │ │ +
293 for (size_type k=0; k<A.r[i].getsize(); k++)
│ │ │ │ +
294 if (j[k]==c) {
│ │ │ │ + │ │ │ │ +
296 }
│ │ │ │ +
297 }
│ │ │ │ +
298 }
│ │ │ │ +
299
│ │ │ │ +
300 // not found
│ │ │ │ +
301 return 0;
│ │ │ │ +
302 }
│ │ │ │
│ │ │ │ -
300
│ │ │ │ +
303
│ │ │ │
│ │ │ │ -
304 double minCoarsenRate() const
│ │ │ │ -
305 {
│ │ │ │ -
306 return minCoarsenRate_;
│ │ │ │ -
307 }
│ │ │ │ -
│ │ │ │ -
308
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
313 {
│ │ │ │ -
314 return accumulate_;
│ │ │ │ -
315 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
320 {
│ │ │ │ -
321 accumulate_=accu;
│ │ │ │ -
322 }
│ │ │ │ -
│ │ │ │ -
323
│ │ │ │ -
│ │ │ │ -
324 void setAccumulate(bool accu){
│ │ │ │ -
325 accumulate_=accu ? successiveAccu : noAccu;
│ │ │ │ -
326 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
333 {
│ │ │ │ -
334 dampingFactor_ = d;
│ │ │ │ -
335 }
│ │ │ │ -
│ │ │ │ -
336
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
343 {
│ │ │ │ -
344 return dampingFactor_;
│ │ │ │ -
345 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
357 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
│ │ │ │ -
358 : maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
│ │ │ │ -
359 dampingFactor_(prolongDamp), accumulate_( accumulate)
│ │ │ │ -
360 {}
│ │ │ │ -
│ │ │ │ -
361
│ │ │ │ -
362 private:
│ │ │ │ -
366 int maxLevel_;
│ │ │ │ -
370 int coarsenTarget_;
│ │ │ │ -
374 double minCoarsenRate_;
│ │ │ │ -
378 double dampingFactor_;
│ │ │ │ -
383 AccumulationMode accumulate_;
│ │ │ │ -
384 };
│ │ │ │ +
304 static size_type rowdim (const Matrix& A){
│ │ │ │ +
305 size_type nn=0;
│ │ │ │ +
306 for (size_type i=0; i<A.N(); i++)
│ │ │ │ +
307 nn += rowdim(A,i);
│ │ │ │ +
308 return nn;
│ │ │ │ +
309 }
│ │ │ │ +
│ │ │ │ +
310
│ │ │ │ +
│ │ │ │ +
311 static size_type coldim (const Matrix& A){
│ │ │ │ +
312 typedef typename Matrix::ConstRowIterator ConstRowIterator;
│ │ │ │ +
313 typedef typename Matrix::ConstColIterator ConstColIterator;
│ │ │ │ +
314
│ │ │ │ +
315 // The following code has a complexity of nnz, and
│ │ │ │ +
316 // typically a very small constant.
│ │ │ │ +
317 //
│ │ │ │ +
318 std::vector<size_type> coldims(A.M(),
│ │ │ │ +
319 std::numeric_limits<size_type>::max());
│ │ │ │ +
320
│ │ │ │ +
321 for (ConstRowIterator row=A.begin(); row!=A.end(); ++row)
│ │ │ │ +
322 for (ConstColIterator col=row->begin(); col!=row->end(); ++col)
│ │ │ │ +
323 // only compute blocksizes we don't already have
│ │ │ │ +
324 if (coldims[col.index()]==std::numeric_limits<size_type>::max())
│ │ │ │ +
325 coldims[col.index()] = MatrixDimension<block_type>::coldim(*col);
│ │ │ │ +
326
│ │ │ │ +
327 size_type sum = 0;
│ │ │ │ +
328 for (typename std::vector<size_type>::iterator it=coldims.begin();
│ │ │ │ +
329 it!=coldims.end(); ++it)
│ │ │ │ +
330 // skip rows for which no coldim could be determined
│ │ │ │ +
331 if ((*it)>=0)
│ │ │ │ +
332 sum += *it;
│ │ │ │ +
333
│ │ │ │ +
334 return sum;
│ │ │ │ +
335 }
│ │ │ │ +
│ │ │ │ +
336 };
│ │ │ │ +
│ │ │ │ +
337
│ │ │ │ +
338
│ │ │ │ +
339 template<typename B, int n, int m, typename TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
341 {
│ │ │ │ + │ │ │ │ +
343 typedef typename Matrix::size_type size_type;
│ │ │ │ +
344
│ │ │ │ +
│ │ │ │ +
345 static size_type rowdim (const Matrix& /*A*/, size_type /*i*/)
│ │ │ │ +
346 {
│ │ │ │ +
347 return n;
│ │ │ │ +
348 }
│ │ │ │ +
│ │ │ │ +
349
│ │ │ │ +
│ │ │ │ +
350 static size_type coldim (const Matrix& /*A*/, size_type /*c*/)
│ │ │ │ +
351 {
│ │ │ │ +
352 return m;
│ │ │ │ +
353 }
│ │ │ │ +
│ │ │ │ +
354
│ │ │ │ +
│ │ │ │ +
355 static size_type rowdim (const Matrix& A) {
│ │ │ │ +
356 return A.N()*n;
│ │ │ │ +
357 }
│ │ │ │ +
│ │ │ │ +
358
│ │ │ │ +
│ │ │ │ +
359 static size_type coldim (const Matrix& A) {
│ │ │ │ +
360 return A.M()*m;
│ │ │ │ +
361 }
│ │ │ │ +
│ │ │ │ +
362 };
│ │ │ │ +
│ │ │ │ +
363
│ │ │ │ +
364 template<typename K, int n, int m>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
366 {
│ │ │ │ + │ │ │ │ +
368 typedef typename Matrix::size_type size_type;
│ │ │ │ +
369
│ │ │ │ +
│ │ │ │ +
370 static size_type rowdim(const Matrix& /*A*/, size_type /*r*/)
│ │ │ │ +
371 {
│ │ │ │ +
372 return 1;
│ │ │ │ +
373 }
│ │ │ │ +
│ │ │ │ +
374
│ │ │ │ +
│ │ │ │ +
375 static size_type coldim(const Matrix& /*A*/, size_type /*r*/)
│ │ │ │ +
376 {
│ │ │ │ +
377 return 1;
│ │ │ │ +
378 }
│ │ │ │ +
│ │ │ │ +
379
│ │ │ │ +
│ │ │ │ +
380 static size_type rowdim(const Matrix& /*A*/)
│ │ │ │ +
381 {
│ │ │ │ +
382 return n;
│ │ │ │ +
383 }
│ │ │ │ +
│ │ │ │ +
384
│ │ │ │ +
│ │ │ │ +
385 static size_type coldim(const Matrix& /*A*/)
│ │ │ │ +
386 {
│ │ │ │ +
387 return m;
│ │ │ │ +
388 }
│ │ │ │
│ │ │ │ -
385
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
393 {
│ │ │ │ -
394 public:
│ │ │ │ -
│ │ │ │ -
401 void setDebugLevel(int level)
│ │ │ │ -
402 {
│ │ │ │ -
403 debugLevel_ = level;
│ │ │ │ -
404 }
│ │ │ │ -
│ │ │ │ -
405
│ │ │ │ -
│ │ │ │ -
411 int debugLevel() const
│ │ │ │ -
412 {
│ │ │ │ -
413 return debugLevel_;
│ │ │ │ -
414 }
│ │ │ │ -
│ │ │ │ -
415
│ │ │ │ -
│ │ │ │ -
420 void setNoPreSmoothSteps(std::size_t steps)
│ │ │ │ -
421 {
│ │ │ │ -
422 preSmoothSteps_=steps;
│ │ │ │ -
423 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
428 std::size_t getNoPreSmoothSteps() const
│ │ │ │ -
429 {
│ │ │ │ -
430 return preSmoothSteps_;
│ │ │ │ -
431 }
│ │ │ │ -
│ │ │ │ -
432
│ │ │ │ -
│ │ │ │ -
437 void setNoPostSmoothSteps(std::size_t steps)
│ │ │ │ -
438 {
│ │ │ │ -
439 postSmoothSteps_=steps;
│ │ │ │ -
440 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
445 std::size_t getNoPostSmoothSteps() const
│ │ │ │ -
446 {
│ │ │ │ -
447 return postSmoothSteps_;
│ │ │ │ -
448 }
│ │ │ │ -
│ │ │ │ -
449
│ │ │ │ -
│ │ │ │ -
453 void setGamma(std::size_t gamma)
│ │ │ │ -
454 {
│ │ │ │ -
455 gamma_=gamma;
│ │ │ │ -
456 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
460 std::size_t getGamma() const
│ │ │ │ -
461 {
│ │ │ │ -
462 return gamma_;
│ │ │ │ -
463 }
│ │ │ │ -
│ │ │ │ -
464
│ │ │ │ -
│ │ │ │ -
469 void setAdditive(bool additive)
│ │ │ │ -
470 {
│ │ │ │ -
471 additive_=additive;
│ │ │ │ -
472 }
│ │ │ │ +
389 };
│ │ │ │
│ │ │ │ -
473
│ │ │ │ +
390
│ │ │ │ +
391 template <class T>
│ │ │ │ +
│ │ │ │ +
392 struct MatrixDimension<Dune::DynamicMatrix<T> >
│ │ │ │ +
393 {
│ │ │ │ +
394 typedef Dune::DynamicMatrix<T> MatrixType;
│ │ │ │ +
395 typedef typename MatrixType::size_type size_type;
│ │ │ │ +
396
│ │ │ │ +
│ │ │ │ +
397 static size_type rowdim(const MatrixType& /*A*/, size_type /*r*/)
│ │ │ │ +
398 {
│ │ │ │ +
399 return 1;
│ │ │ │ +
400 }
│ │ │ │ +
│ │ │ │ +
401
│ │ │ │ +
│ │ │ │ +
402 static size_type coldim(const MatrixType& /*A*/, size_type /*r*/)
│ │ │ │ +
403 {
│ │ │ │ +
404 return 1;
│ │ │ │ +
405 }
│ │ │ │ +
│ │ │ │ +
406
│ │ │ │ +
│ │ │ │ +
407 static size_type rowdim(const MatrixType& A)
│ │ │ │ +
408 {
│ │ │ │ +
409 return A.N();
│ │ │ │ +
410 }
│ │ │ │ +
│ │ │ │ +
411
│ │ │ │ +
│ │ │ │ +
412 static size_type coldim(const MatrixType& A)
│ │ │ │ +
413 {
│ │ │ │ +
414 return A.M();
│ │ │ │ +
415 }
│ │ │ │ +
│ │ │ │ +
416 };
│ │ │ │ +
│ │ │ │ +
417
│ │ │ │ +
418 template<typename K, int n, int m, typename TA>
│ │ │ │ +
│ │ │ │ +
419 struct MatrixDimension<Matrix<FieldMatrix<K,n,m>, TA> >
│ │ │ │ +
420 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
423
│ │ │ │ +
│ │ │ │ +
424 static size_type rowdim(const ThisMatrix& /*A*/, size_type /*r*/)
│ │ │ │ +
425 {
│ │ │ │ +
426 return n;
│ │ │ │ +
427 }
│ │ │ │ +
│ │ │ │ +
428
│ │ │ │ +
│ │ │ │ +
429 static size_type coldim(const ThisMatrix& /*A*/, size_type /*r*/)
│ │ │ │ +
430 {
│ │ │ │ +
431 return m;
│ │ │ │ +
432 }
│ │ │ │ +
│ │ │ │ +
433
│ │ │ │ +
│ │ │ │ +
434 static size_type rowdim(const ThisMatrix& A)
│ │ │ │ +
435 {
│ │ │ │ +
436 return A.N()*n;
│ │ │ │ +
437 }
│ │ │ │ +
│ │ │ │ +
438
│ │ │ │ +
│ │ │ │ +
439 static size_type coldim(const ThisMatrix& A)
│ │ │ │ +
440 {
│ │ │ │ +
441 return A.M()*m;
│ │ │ │ +
442 }
│ │ │ │ +
│ │ │ │ +
443 };
│ │ │ │ +
│ │ │ │ +
444
│ │ │ │ +
445 template<typename K, int n>
│ │ │ │ +
│ │ │ │ +
446 struct MatrixDimension<DiagonalMatrix<K,n> >
│ │ │ │ +
447 {
│ │ │ │ +
448 typedef DiagonalMatrix<K,n> Matrix;
│ │ │ │ +
449 typedef typename Matrix::size_type size_type;
│ │ │ │ +
450
│ │ │ │ +
│ │ │ │ +
451 static size_type rowdim(const Matrix& /*A*/, size_type /*r*/)
│ │ │ │ +
452 {
│ │ │ │ +
453 return 1;
│ │ │ │ +
454 }
│ │ │ │ +
│ │ │ │ +
455
│ │ │ │ +
│ │ │ │ +
456 static size_type coldim(const Matrix& /*A*/, size_type /*r*/)
│ │ │ │ +
457 {
│ │ │ │ +
458 return 1;
│ │ │ │ +
459 }
│ │ │ │ +
│ │ │ │ +
460
│ │ │ │ +
│ │ │ │ +
461 static size_type rowdim(const Matrix& /*A*/)
│ │ │ │ +
462 {
│ │ │ │ +
463 return n;
│ │ │ │ +
464 }
│ │ │ │ +
│ │ │ │ +
465
│ │ │ │ +
│ │ │ │ +
466 static size_type coldim(const Matrix& /*A*/)
│ │ │ │ +
467 {
│ │ │ │ +
468 return n;
│ │ │ │ +
469 }
│ │ │ │ +
│ │ │ │ +
470 };
│ │ │ │ +
│ │ │ │ +
471
│ │ │ │ +
472 template<typename K, int n>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
474 {
│ │ │ │ + │ │ │ │ +
476 typedef typename Matrix::size_type size_type;
│ │ │ │ +
477
│ │ │ │
│ │ │ │ -
478 bool getAdditive() const
│ │ │ │ -
479 {
│ │ │ │ -
480 return additive_;
│ │ │ │ -
481 }
│ │ │ │ +
478 static size_type rowdim(const Matrix& /*A*/, size_type /*r*/)
│ │ │ │ +
479 {
│ │ │ │ +
480 return 1;
│ │ │ │ +
481 }
│ │ │ │
│ │ │ │
482
│ │ │ │ +
│ │ │ │ +
483 static size_type coldim(const Matrix& /*A*/, size_type /*r*/)
│ │ │ │ +
484 {
│ │ │ │ +
485 return 1;
│ │ │ │ +
486 }
│ │ │ │ +
│ │ │ │ +
487
│ │ │ │ +
│ │ │ │ +
488 static size_type rowdim(const Matrix& /*A*/)
│ │ │ │ +
489 {
│ │ │ │ +
490 return n;
│ │ │ │ +
491 }
│ │ │ │ +
│ │ │ │ +
492
│ │ │ │
│ │ │ │ -
493 Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ │ -
494 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
│ │ │ │ - │ │ │ │ -
496 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
│ │ │ │ -
497 additive_(false)
│ │ │ │ -
498 {}
│ │ │ │ -
│ │ │ │ -
499 private:
│ │ │ │ -
500 int debugLevel_;
│ │ │ │ -
501 std::size_t preSmoothSteps_;
│ │ │ │ -
502 std::size_t postSmoothSteps_;
│ │ │ │ -
503 std::size_t gamma_;
│ │ │ │ -
504 bool additive_;
│ │ │ │ -
505 };
│ │ │ │ -
│ │ │ │ -
506
│ │ │ │ -
507 } //namespace AMG
│ │ │ │ -
508
│ │ │ │ -
509} //namespace Dune
│ │ │ │ -
510#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:469
│ │ │ │ -
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:332
│ │ │ │ -
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:202
│ │ │ │ -
void setMinCoarsenRate(double rate)
Set the minimum coarsening rate to be achieved in each coarsening.
Definition parameters.hh:296
│ │ │ │ -
double minCoarsenRate() const
Get the minimum coarsening rate to be achieved.
Definition parameters.hh:304
│ │ │ │ -
std::size_t maxAggregateSize() const
Get the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:194
│ │ │ │ -
void setAlpha(double a)
Set the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:61
│ │ │ │ -
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:211
│ │ │ │ -
int coarsenTarget() const
Get the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:286
│ │ │ │ -
void setAccumulate(AccumulationMode accu)
Set whether he data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:319
│ │ │ │ -
double getProlongationDampingFactor() const
Get the damping factor for the prolongation.
Definition parameters.hh:342
│ │ │ │ -
AccumulationMode accumulate() const
Whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:312
│ │ │ │ -
void setMaxConnectivity(std::size_t connectivity)
Set the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:220
│ │ │ │ -
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:478
│ │ │ │ -
void setMaxLevel(int l)
Set the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:263
│ │ │ │ -
void setDebugLevel(int level)
Set the debugging level.
Definition parameters.hh:401
│ │ │ │ -
std::size_t getGamma() const
Get the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:460
│ │ │ │ -
void setNoPostSmoothSteps(std::size_t steps)
Set the number of postsmoothing steps to apply.
Definition parameters.hh:437
│ │ │ │ -
std::size_t getNoPreSmoothSteps() const
Get the number of presmoothing steps to apply.
Definition parameters.hh:428
│ │ │ │ -
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:188
│ │ │ │ -
int maxLevel() const
Get the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:270
│ │ │ │ -
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
│ │ │ │ -
Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
Constructor.
Definition parameters.hh:493
│ │ │ │ -
void setCoarsenTarget(int nodes)
Set the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:278
│ │ │ │ -
void setNoPreSmoothSteps(std::size_t steps)
Set the number of presmoothing steps to apply.
Definition parameters.hh:420
│ │ │ │ -
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:232
│ │ │ │ -
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
│ │ │ │ -
CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
Constructor.
Definition parameters.hh:356
│ │ │ │ -
void setGamma(std::size_t gamma)
Set the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:453
│ │ │ │ -
void setAccumulate(bool accu)
Definition parameters.hh:324
│ │ │ │ -
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:411
│ │ │ │ -
std::size_t getNoPostSmoothSteps() const
Get the number of postsmoothing steps to apply.
Definition parameters.hh:445
│ │ │ │ -
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:244
│ │ │ │ -
@ noAccu
No data accumulution.
Definition parameters.hh:238
│ │ │ │ -
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:248
│ │ │ │ +
493 static size_type coldim(const Matrix& /*A*/)
│ │ │ │ +
494 {
│ │ │ │ +
495 return n;
│ │ │ │ +
496 }
│ │ │ │ +
│ │ │ │ +
497 };
│ │ │ │ +
│ │ │ │ +
498
│ │ │ │ +
502 template<typename T>
│ │ │ │ +
│ │ │ │ +
503 struct IsMatrix
│ │ │ │ +
504 {
│ │ │ │ +
505 enum {
│ │ │ │ +
509 value = false
│ │ │ │ +
510 };
│ │ │ │ +
511 };
│ │ │ │ +
│ │ │ │ +
512
│ │ │ │ +
513 template<typename T>
│ │ │ │ +
│ │ │ │ +
514 struct IsMatrix<DenseMatrix<T> >
│ │ │ │ +
515 {
│ │ │ │ +
516 enum {
│ │ │ │ +
520 value = true
│ │ │ │ +
521 };
│ │ │ │ +
522 };
│ │ │ │ +
│ │ │ │ +
523
│ │ │ │ +
524
│ │ │ │ +
525 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ +
526 struct IsMatrix<BCRSMatrix<T,A> >
│ │ │ │ +
527 {
│ │ │ │ +
528 enum {
│ │ │ │ +
532 value = true
│ │ │ │ +
533 };
│ │ │ │ +
534 };
│ │ │ │ +
│ │ │ │ +
535
│ │ │ │ +
536 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
538 {
│ │ │ │ +
│ │ │ │ +
539 bool operator()(const T* l, const T* r)
│ │ │ │ +
540 {
│ │ │ │ +
541 return *l < *r;
│ │ │ │ +
542 }
│ │ │ │ +
│ │ │ │ +
543 };
│ │ │ │ +
│ │ │ │ +
544
│ │ │ │ +
545}
│ │ │ │ +
546#endif
│ │ │ │ + │ │ │ │ +
This file implements a quadratic matrix of fixed size which is a multiple of the identity.
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
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
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Parameters needed to check whether a node depends on another.
Definition parameters.hh:31
│ │ │ │ -
Parameters needed for the aggregation process.
Definition parameters.hh:84
│ │ │ │ -
Parameters for the complete coarsening process.
Definition parameters.hh:258
│ │ │ │ -
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ +
void printGlobalSparseMatrix(const M &mat, C &ooc, std::ostream &os)
Definition matrixutils.hh:154
│ │ │ │ +
Definition matrixutils.hh:211
│ │ │ │ +
static auto coldim(const M &A)
Definition matrixutils.hh:219
│ │ │ │ +
static auto rowdim(const M &A)
Definition matrixutils.hh:214
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ +
row_type::ConstIterator ConstColIterator
Const iterator to the entries of a row.
Definition bcrsmatrix.hh:741
│ │ │ │ +
B block_type
export the type representing the components
Definition bcrsmatrix.hh:491
│ │ │ │ +
Iterator access to matrix rows
Definition bcrsmatrix.hh:579
│ │ │ │ +
A Matrix class to support different block types.
Definition multitypeblockmatrix.hh:46
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ +
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:614
│ │ │ │ +
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
│ │ │ │ +
Check whether the a matrix has diagonal values on blocklevel recursion levels.
Definition matrixutils.hh:48
│ │ │ │ +
static void check(const Matrix &mat)
Check whether the a matrix has diagonal values on blocklevel recursion levels.
Definition matrixutils.hh:53
│ │ │ │ +
static void check(const Matrix &mat)
Definition matrixutils.hh:75
│ │ │ │ +
static void check(const Matrix &)
Check whether the a matrix has diagonal values on blocklevel recursion levels.
Definition matrixutils.hh:99
│ │ │ │ +
MultiTypeBlockMatrix< T1, Args... > Matrix
Definition matrixutils.hh:93
│ │ │ │ +
static size_type rowdim(const Matrix< B, TA > &A, size_type i)
Definition matrixutils.hh:232
│ │ │ │ +
static size_type coldim(const Matrix< B, TA > &A)
Definition matrixutils.hh:250
│ │ │ │ +
static size_type rowdim(const Matrix< B, TA > &A)
Definition matrixutils.hh:242
│ │ │ │ +
typename Matrix< B, TA >::size_type size_type
Definition matrixutils.hh:230
│ │ │ │ +
static size_type coldim(const Matrix< B, TA > &A, size_type c)
Definition matrixutils.hh:237
│ │ │ │ +
typename Matrix< B, TA >::block_type block_type
Definition matrixutils.hh:229
│ │ │ │ +
BCRSMatrix< B, TA > Matrix
Definition matrixutils.hh:263
│ │ │ │ +
static size_type coldim(const Matrix &A)
Definition matrixutils.hh:311
│ │ │ │ +
Matrix::block_type block_type
Definition matrixutils.hh:264
│ │ │ │ +
static size_type coldim(const Matrix &A, size_type c)
Definition matrixutils.hh:276
│ │ │ │ +
Matrix::size_type size_type
Definition matrixutils.hh:265
│ │ │ │ +
static size_type rowdim(const Matrix &A, size_type i)
Definition matrixutils.hh:267
│ │ │ │ +
static size_type rowdim(const Matrix &A)
Definition matrixutils.hh:304
│ │ │ │ +
static size_type coldim(const Matrix &A)
Definition matrixutils.hh:359
│ │ │ │ +
static size_type rowdim(const Matrix &, size_type)
Definition matrixutils.hh:345
│ │ │ │ +
static size_type rowdim(const Matrix &A)
Definition matrixutils.hh:355
│ │ │ │ +
Matrix::size_type size_type
Definition matrixutils.hh:343
│ │ │ │ +
BCRSMatrix< FieldMatrix< B, n, m >,TA > Matrix
Definition matrixutils.hh:342
│ │ │ │ +
static size_type coldim(const Matrix &, size_type)
Definition matrixutils.hh:350
│ │ │ │ +
static size_type rowdim(const Matrix &, size_type)
Definition matrixutils.hh:370
│ │ │ │ +
static size_type coldim(const Matrix &)
Definition matrixutils.hh:385
│ │ │ │ +
Matrix::size_type size_type
Definition matrixutils.hh:368
│ │ │ │ +
FieldMatrix< K, n, m > Matrix
Definition matrixutils.hh:367
│ │ │ │ +
static size_type coldim(const Matrix &, size_type)
Definition matrixutils.hh:375
│ │ │ │ +
static size_type rowdim(const Matrix &)
Definition matrixutils.hh:380
│ │ │ │ +
static size_type coldim(const MatrixType &A)
Definition matrixutils.hh:412
│ │ │ │ +
static size_type rowdim(const MatrixType &A)
Definition matrixutils.hh:407
│ │ │ │ +
static size_type rowdim(const MatrixType &, size_type)
Definition matrixutils.hh:397
│ │ │ │ +
MatrixType::size_type size_type
Definition matrixutils.hh:395
│ │ │ │ +
static size_type coldim(const MatrixType &, size_type)
Definition matrixutils.hh:402
│ │ │ │ +
Dune::DynamicMatrix< T > MatrixType
Definition matrixutils.hh:394
│ │ │ │ +
static size_type coldim(const ThisMatrix &A)
Definition matrixutils.hh:439
│ │ │ │ +
static size_type rowdim(const ThisMatrix &A)
Definition matrixutils.hh:434
│ │ │ │ +
Matrix< FieldMatrix< K, n, m >, TA > ThisMatrix
Definition matrixutils.hh:421
│ │ │ │ +
static size_type coldim(const ThisMatrix &, size_type)
Definition matrixutils.hh:429
│ │ │ │ +
static size_type rowdim(const ThisMatrix &, size_type)
Definition matrixutils.hh:424
│ │ │ │ +
ThisMatrix::size_type size_type
Definition matrixutils.hh:422
│ │ │ │ +
static size_type coldim(const Matrix &, size_type)
Definition matrixutils.hh:456
│ │ │ │ +
Matrix::size_type size_type
Definition matrixutils.hh:449
│ │ │ │ +
static size_type coldim(const Matrix &)
Definition matrixutils.hh:466
│ │ │ │ +
static size_type rowdim(const Matrix &)
Definition matrixutils.hh:461
│ │ │ │ +
DiagonalMatrix< K, n > Matrix
Definition matrixutils.hh:448
│ │ │ │ +
static size_type rowdim(const Matrix &, size_type)
Definition matrixutils.hh:451
│ │ │ │ +
static size_type coldim(const Matrix &)
Definition matrixutils.hh:493
│ │ │ │ +
static size_type rowdim(const Matrix &, size_type)
Definition matrixutils.hh:478
│ │ │ │ +
static size_type coldim(const Matrix &, size_type)
Definition matrixutils.hh:483
│ │ │ │ +
Matrix::size_type size_type
Definition matrixutils.hh:476
│ │ │ │ +
ScaledIdentityMatrix< K, n > Matrix
Definition matrixutils.hh:475
│ │ │ │ +
static size_type rowdim(const Matrix &)
Definition matrixutils.hh:488
│ │ │ │ +
Test whether a type is an ISTL Matrix.
Definition matrixutils.hh:504
│ │ │ │ +
@ value
True if T is an ISTL matrix.
Definition matrixutils.hh:509
│ │ │ │ +
Definition matrixutils.hh:538
│ │ │ │ +
bool operator()(const T *l, const T *r)
Definition matrixutils.hh:539
│ │ │ │ +
A multiple of the identity matrix of static size.
Definition scaledidmatrix.hh:30
│ │ │ │ +
std::size_t size_type
The type used for the index access and size operations.
Definition scaledidmatrix.hh:43
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,462 +1,782 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -parameters.hh │ │ │ │ │ +matrixutils.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 (C) 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_ISTL_MATRIXUTILS_HH │ │ │ │ │ +6#define DUNE_ISTL_MATRIXUTILS_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10namespace _D_u_n_e │ │ │ │ │ -11{ │ │ │ │ │ -12 namespace Amg │ │ │ │ │ -13 { │ │ │ │ │ -_3_0 class _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -31 { │ │ │ │ │ -32 public: │ │ │ │ │ -_3_4 _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ -35 : alpha_(1.0/3.0), beta_(1.0E-5) │ │ │ │ │ -36 {} │ │ │ │ │ -37 │ │ │ │ │ -_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 │ │ │ │ │ -_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; │ │ │ │ │ -113 │ │ │ │ │ -114 for(; dim>0; dim--) { │ │ │ │ │ -115 csize*=diameter; │ │ │ │ │ -116 maxDistance_+=diameter-1; │ │ │ │ │ -117 } │ │ │ │ │ -118 minAggregateSize_=csize; │ │ │ │ │ -119 maxAggregateSize_=static_cast(csize*1.5); │ │ │ │ │ -120 } │ │ │ │ │ -121 │ │ │ │ │ -_1_3_2 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c(std::size_t dim,std::size_t diameter=2) │ │ │ │ │ -133 { │ │ │ │ │ -134 _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(dim, diameter); │ │ │ │ │ -135 maxDistance_+=dim-1; │ │ │ │ │ -136 } │ │ │ │ │ -_1_4_4 std::size_t _m_a_x_D_i_s_t_a_n_c_e() const { return maxDistance_;} │ │ │ │ │ -145 │ │ │ │ │ -_1_5_4 void _s_e_t_M_a_x_D_i_s_t_a_n_c_e(std::size_t distance) { maxDistance_ = distance;} │ │ │ │ │ -155 │ │ │ │ │ -_1_6_1 bool _s_k_i_p_I_s_o_l_a_t_e_d() const │ │ │ │ │ -162 { │ │ │ │ │ -163 return skipiso_; │ │ │ │ │ -164 } │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#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> │ │ │ │ │ +17#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +18 │ │ │ │ │ +19namespace _D_u_n_e │ │ │ │ │ +20{ │ │ │ │ │ +21 │ │ │ │ │ +22#ifndef DOYXGEN │ │ │ │ │ +23 template │ │ │ │ │ +24 class BCRSMatrix; │ │ │ │ │ +25 │ │ │ │ │ +26 template │ │ │ │ │ +_2_7 class _F_i_e_l_d_M_a_t_r_i_x; │ │ │ │ │ +28 │ │ │ │ │ +29 template │ │ │ │ │ +30 class _M_a_t_r_i_x; │ │ │ │ │ +31#endif │ │ │ │ │ +32 │ │ │ │ │ +46 template │ │ │ │ │ +_4_7 struct _C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t │ │ │ │ │ +48 { │ │ │ │ │ +_5_3 static void _c_h_e_c_k([[maybe_unused]] const _M_a_t_r_i_x& _m_a_t) │ │ │ │ │ +54 { │ │ │ │ │ +55#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +56 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r Row; │ │ │ │ │ +57 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r Entry; │ │ │ │ │ +58 for(Row row = _m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ │ +59 Entry diagonal = row->find(row.index()); │ │ │ │ │ +60 if(diagonal==row->end()) │ │ │ │ │ +61 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Missing diagonal value in row "<_:_:_c_h_e_c_k(m); │ │ │ │ │ +66 } │ │ │ │ │ +67 } │ │ │ │ │ +68#endif │ │ │ │ │ +69 } │ │ │ │ │ +70 }; │ │ │ │ │ +71 │ │ │ │ │ +72 template │ │ │ │ │ +_7_3 struct _C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t<_M_a_t_r_i_x,0,l> │ │ │ │ │ +74 { │ │ │ │ │ +_7_5 static void _c_h_e_c_k(const _M_a_t_r_i_x& _m_a_t) │ │ │ │ │ +76 { │ │ │ │ │ +77 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r Row; │ │ │ │ │ +78 for(Row row = _m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ │ +79 if(row->find(row.index())==row->end()) │ │ │ │ │ +80 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Missing diagonal value in row "< │ │ │ │ │ +87 class MultiTypeBlockMatrix; │ │ │ │ │ +88 │ │ │ │ │ +89 template │ │ │ │ │ +_9_0 struct _C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t<_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x, │ │ │ │ │ +91 blocklevel,l> │ │ │ │ │ +92 { │ │ │ │ │ +_9_3 typedef _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x _M_a_t_r_i_x; │ │ │ │ │ +94 │ │ │ │ │ +_9_9 static void _c_h_e_c_k(const _M_a_t_r_i_x& /* mat */) │ │ │ │ │ +100 { │ │ │ │ │ +101#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +102 // TODO Implement check │ │ │ │ │ +103#endif │ │ │ │ │ +104 } │ │ │ │ │ +105 }; │ │ │ │ │ +106 │ │ │ │ │ +118 template │ │ │ │ │ +_1_1_9 inline auto _c_o_u_n_t_N_o_n_Z_e_r_o_s(const M&, │ │ │ │ │ +120 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ +sfinae = nullptr) │ │ │ │ │ +121 { │ │ │ │ │ +122 return 1; │ │ │ │ │ +123 } │ │ │ │ │ +124 │ │ │ │ │ +125 template │ │ │ │ │ +_1_2_6 inline auto _c_o_u_n_t_N_o_n_Z_e_r_o_s(const M& matrix, │ │ │ │ │ +127 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ +sfinae = nullptr) │ │ │ │ │ +128 { │ │ │ │ │ +129 typename M::size_type nonZeros = 0; │ │ │ │ │ +130 for(auto&& row : matrix) │ │ │ │ │ +131 for(auto&& entry : row) │ │ │ │ │ +132 nonZeros += _c_o_u_n_t_N_o_n_Z_e_r_o_s(entry); │ │ │ │ │ +133 return nonZeros; │ │ │ │ │ +134 } │ │ │ │ │ +135 │ │ │ │ │ +136 /* │ │ │ │ │ +137 template │ │ │ │ │ +138 struct ProcessOnFieldsOfMatrix │ │ │ │ │ +139 */ │ │ │ │ │ +140 │ │ │ │ │ +142 namespace │ │ │ │ │ +143 { │ │ │ │ │ +144 struct CompPair { │ │ │ │ │ +145 template │ │ │ │ │ +146 bool operator()(const std::pair& p1, const std::pair& p2) const │ │ │ │ │ +147 { │ │ │ │ │ +148 return p1.first │ │ │ │ │ +_1_5_4 void _p_r_i_n_t_G_l_o_b_a_l_S_p_a_r_s_e_M_a_t_r_i_x(const M& _m_a_t, C& ooc, std::ostream& os) │ │ │ │ │ +155 { │ │ │ │ │ +156 typedef typename C::ParallelIndexSet::const_iterator IIter; │ │ │ │ │ +157 typedef typename C::OwnerSet OwnerSet; │ │ │ │ │ +158 typedef typename C::ParallelIndexSet::GlobalIndex GlobalIndex; │ │ │ │ │ +159 │ │ │ │ │ +160 GlobalIndex gmax=0; │ │ │ │ │ +161 │ │ │ │ │ +162 for(IIter idx=ooc.indexSet().begin(), eidx=ooc.indexSet().end(); │ │ │ │ │ +163 idx!=eidx; ++idx) │ │ │ │ │ +164 gmax=std::max(gmax,idx->global()); │ │ │ │ │ 165 │ │ │ │ │ -_1_7_1 void _s_e_t_S_k_i_p_I_s_o_l_a_t_e_d(bool skip) │ │ │ │ │ +166 gmax=ooc.communicator().max(gmax); │ │ │ │ │ +167 ooc.buildGlobalLookup(); │ │ │ │ │ +168 │ │ │ │ │ +169 for(IIter idx=ooc.indexSet().begin(), eidx=ooc.indexSet().end(); │ │ │ │ │ +170 idx!=eidx; ++idx) { │ │ │ │ │ +171 if(OwnerSet::contains(idx->local().attribute())) │ │ │ │ │ 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_8 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;} │ │ │ │ │ -189 │ │ │ │ │ -_1_9_4 std::size_t _m_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e() const { return maxAggregateSize_;} │ │ │ │ │ -195 │ │ │ │ │ -_2_0_2 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;} │ │ │ │ │ -203 │ │ │ │ │ -_2_1_1 std::size_t _m_a_x_C_o_n_n_e_c_t_i_v_i_t_y() const { return connectivity_;} │ │ │ │ │ -212 │ │ │ │ │ -_2_2_0 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;} │ │ │ │ │ -221 │ │ │ │ │ -222 private: │ │ │ │ │ -223 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, │ │ │ │ │ -connectivity_; │ │ │ │ │ -224 bool skipiso_; │ │ │ │ │ -225 │ │ │ │ │ -226 }; │ │ │ │ │ -227 │ │ │ │ │ -228 │ │ │ │ │ -_2_3_2 enum _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e { │ │ │ │ │ -_2_3_8 _n_o_A_c_c_u = 0, │ │ │ │ │ -_2_4_4 _a_t_O_n_c_e_A_c_c_u=1, │ │ │ │ │ -248 _s_u_c_c_e_s_s_i_v_e_A_c_c_u=2 │ │ │ │ │ -_2_4_9 }; │ │ │ │ │ -250 │ │ │ │ │ -251 │ │ │ │ │ -252 │ │ │ │ │ -253 │ │ │ │ │ -_2_5_7 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 │ │ │ │ │ -258 { │ │ │ │ │ -259 public: │ │ │ │ │ -_2_6_3 void _s_e_t_M_a_x_L_e_v_e_l(int l) │ │ │ │ │ -264 { │ │ │ │ │ -265 maxLevel_ = l; │ │ │ │ │ -266 } │ │ │ │ │ -_2_7_0 int _m_a_x_L_e_v_e_l() const │ │ │ │ │ -271 { │ │ │ │ │ -272 return maxLevel_; │ │ │ │ │ -273 } │ │ │ │ │ -274 │ │ │ │ │ -_2_7_8 void _s_e_t_C_o_a_r_s_e_n_T_a_r_g_e_t(int nodes) │ │ │ │ │ -279 { │ │ │ │ │ -280 coarsenTarget_ = nodes; │ │ │ │ │ -281 } │ │ │ │ │ -282 │ │ │ │ │ -_2_8_6 int _c_o_a_r_s_e_n_T_a_r_g_e_t() const │ │ │ │ │ -287 { │ │ │ │ │ -288 return coarsenTarget_; │ │ │ │ │ -289 } │ │ │ │ │ -290 │ │ │ │ │ -_2_9_6 void _s_e_t_M_i_n_C_o_a_r_s_e_n_R_a_t_e(double rate) │ │ │ │ │ -297 { │ │ │ │ │ -298 minCoarsenRate_ = rate; │ │ │ │ │ -299 } │ │ │ │ │ -300 │ │ │ │ │ -_3_0_4 double _m_i_n_C_o_a_r_s_e_n_R_a_t_e() const │ │ │ │ │ -305 { │ │ │ │ │ -306 return minCoarsenRate_; │ │ │ │ │ -307 } │ │ │ │ │ -308 │ │ │ │ │ -_3_1_2 _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 │ │ │ │ │ -313 { │ │ │ │ │ -314 return accumulate_; │ │ │ │ │ -315 } │ │ │ │ │ -_3_1_9 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) │ │ │ │ │ -320 { │ │ │ │ │ -321 accumulate_=accu; │ │ │ │ │ -322 } │ │ │ │ │ -323 │ │ │ │ │ -_3_2_4 void _s_e_t_A_c_c_u_m_u_l_a_t_e(bool accu){ │ │ │ │ │ -325 accumulate_=accu ? _s_u_c_c_e_s_s_i_v_e_A_c_c_u : _n_o_A_c_c_u; │ │ │ │ │ -326 } │ │ │ │ │ -_3_3_2 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) │ │ │ │ │ -333 { │ │ │ │ │ -334 dampingFactor_ = d; │ │ │ │ │ +173 typedef typename M::block_type Block; │ │ │ │ │ +174 │ │ │ │ │ +175 std::set,CompPair> entries; │ │ │ │ │ +176 │ │ │ │ │ +177 // sort rows │ │ │ │ │ +178 typedef typename M::ConstColIterator CIter; │ │ │ │ │ +179 for(CIter c=_m_a_t[idx->local()]._b_e_g_i_n(), cend=_m_a_t[idx->local()]._e_n_d(); │ │ │ │ │ +180 c!=cend; ++c) { │ │ │ │ │ +181 const typename C::ParallelIndexSet::IndexPair* pair │ │ │ │ │ +182 =ooc.globalLookup().pair(c.index()); │ │ │ │ │ +183 assert(pair); │ │ │ │ │ +184 entries.insert(std::make_pair(pair->global(), *c)); │ │ │ │ │ +185 } │ │ │ │ │ +186 │ │ │ │ │ +187 //wait until its the rows turn. │ │ │ │ │ +188 GlobalIndex rowidx = idx->global(); │ │ │ │ │ +189 GlobalIndex cur=std::numeric_limits::max(); │ │ │ │ │ +190 while(cur!=rowidx) │ │ │ │ │ +191 cur=ooc.communicator().min(rowidx); │ │ │ │ │ +192 │ │ │ │ │ +193 // print rows │ │ │ │ │ +194 typedef typename std::set,CompPair>::iterator │ │ │ │ │ +SIter; │ │ │ │ │ +195 for(SIter s=entries.begin(), send=entries.end(); s!=send; ++s) │ │ │ │ │ +196 os<global()<<" "<first<<" "<second<::max(); │ │ │ │ │ +205 while(cur!=ooc.communicator().min(cur)) ; │ │ │ │ │ +206 } │ │ │ │ │ +207 │ │ │ │ │ +208 // Default implementation for scalar types │ │ │ │ │ +209 template │ │ │ │ │ +_2_1_0 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ │ +211 { │ │ │ │ │ +212 static_assert(IsNumber::value, "MatrixDimension is not implemented for │ │ │ │ │ +this type!"); │ │ │ │ │ +213 │ │ │ │ │ +_2_1_4 static auto _r_o_w_d_i_m(const M& A) │ │ │ │ │ +215 { │ │ │ │ │ +216 return 1; │ │ │ │ │ +217 } │ │ │ │ │ +218 │ │ │ │ │ +_2_1_9 static auto _c_o_l_d_i_m(const M& A) │ │ │ │ │ +220 { │ │ │ │ │ +221 return 1; │ │ │ │ │ +222 } │ │ │ │ │ +223 }; │ │ │ │ │ +224 │ │ │ │ │ +225 // Default implementation for scalar types │ │ │ │ │ +226 template │ │ │ │ │ +_2_2_7 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_M_a_t_r_i_x > │ │ │ │ │ +228 { │ │ │ │ │ +_2_2_9 using _b_l_o_c_k___t_y_p_e = typename _M_a_t_r_i_x_<_B_,_T_A_>_:_:_b_l_o_c_k___t_y_p_e; │ │ │ │ │ +_2_3_0 using _s_i_z_e___t_y_p_e = typename _M_a_t_r_i_x_<_B_,_T_A_>_:_:_s_i_z_e___t_y_p_e; │ │ │ │ │ +231 │ │ │ │ │ +_2_3_2 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m (const _M_a_t_r_i_x_<_B_,_T_A_>& A, _s_i_z_e___t_y_p_e i) │ │ │ │ │ +233 { │ │ │ │ │ +234 return _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_b_l_o_c_k___t_y_p_e_>_:_:_r_o_w_d_i_m(A[i][0]); │ │ │ │ │ +235 } │ │ │ │ │ +236 │ │ │ │ │ +_2_3_7 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m (const _M_a_t_r_i_x_<_B_,_T_A_>& A, _s_i_z_e___t_y_p_e c) │ │ │ │ │ +238 { │ │ │ │ │ +239 return _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_b_l_o_c_k___t_y_p_e_>_:_:_c_o_l_d_i_m(A[0][c]); │ │ │ │ │ +240 } │ │ │ │ │ +241 │ │ │ │ │ +_2_4_2 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m (const _M_a_t_r_i_x_<_B_,_T_A_>& A) │ │ │ │ │ +243 { │ │ │ │ │ +244 _s_i_z_e___t_y_p_e nn=0; │ │ │ │ │ +245 for (_s_i_z_e___t_y_p_e i=0; i& A) │ │ │ │ │ +251 { │ │ │ │ │ +252 _s_i_z_e___t_y_p_e nn=0; │ │ │ │ │ +253 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_2_6_1 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ │ +262 { │ │ │ │ │ +_2_6_3 typedef _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> _M_a_t_r_i_x; │ │ │ │ │ +_2_6_4 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +_2_6_5 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +266 │ │ │ │ │ +_2_6_7 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m (const _M_a_t_r_i_x& A, _s_i_z_e___t_y_p_e i) │ │ │ │ │ +268 { │ │ │ │ │ +269 const B* row = A.r[i].getptr(); │ │ │ │ │ +270 if(row) │ │ │ │ │ +271 return _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_b_l_o_c_k___t_y_p_e_>_:_:_r_o_w_d_i_m(*row); │ │ │ │ │ +272 else │ │ │ │ │ +273 return 0; │ │ │ │ │ +274 } │ │ │ │ │ +275 │ │ │ │ │ +_2_7_6 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m (const _M_a_t_r_i_x& A, _s_i_z_e___t_y_p_e c) │ │ │ │ │ +277 { │ │ │ │ │ +278 // find an entry in column c │ │ │ │ │ +279 if (A.nnz_ > 0) │ │ │ │ │ +280 { │ │ │ │ │ +281 for (_s_i_z_e___t_y_p_e k=0; k_:_:_c_o_l_d_i_m(A.a[k]); │ │ │ │ │ +284 } │ │ │ │ │ +285 } │ │ │ │ │ +286 } │ │ │ │ │ +287 else │ │ │ │ │ +288 { │ │ │ │ │ +289 for (_s_i_z_e___t_y_p_e i=0; i_:_:_c_o_l_d_i_m(a[k]); │ │ │ │ │ +296 } │ │ │ │ │ +297 } │ │ │ │ │ +298 } │ │ │ │ │ +299 │ │ │ │ │ +300 // not found │ │ │ │ │ +301 return 0; │ │ │ │ │ +302 } │ │ │ │ │ +303 │ │ │ │ │ +_3_0_4 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m (const _M_a_t_r_i_x& A){ │ │ │ │ │ +305 _s_i_z_e___t_y_p_e nn=0; │ │ │ │ │ +306 for (_s_i_z_e___t_y_p_e i=0; i coldims(A.M(), │ │ │ │ │ +319 std::numeric_limits::max()); │ │ │ │ │ +320 │ │ │ │ │ +321 for (ConstRowIterator row=A.begin(); row!=A.end(); ++row) │ │ │ │ │ +322 for (ConstColIterator _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) │ │ │ │ │ +323 // only compute blocksizes we don't already have │ │ │ │ │ +324 if (coldims[_c_o_l.index()]==std::numeric_limits::max()) │ │ │ │ │ +325 coldims[_c_o_l.index()] = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_b_l_o_c_k___t_y_p_e_>_:_:_c_o_l_d_i_m(*_c_o_l); │ │ │ │ │ +326 │ │ │ │ │ +327 _s_i_z_e___t_y_p_e sum = 0; │ │ │ │ │ +328 for (typename std::vector::iterator it=coldims.begin(); │ │ │ │ │ +329 it!=coldims.end(); ++it) │ │ │ │ │ +330 // skip rows for which no coldim could be determined │ │ │ │ │ +331 if ((*it)>=0) │ │ │ │ │ +332 sum += *it; │ │ │ │ │ +333 │ │ │ │ │ +334 return sum; │ │ │ │ │ 335 } │ │ │ │ │ -336 │ │ │ │ │ -_3_4_2 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 │ │ │ │ │ -343 { │ │ │ │ │ -344 return dampingFactor_; │ │ │ │ │ -345 } │ │ │ │ │ -_3_5_6 _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, │ │ │ │ │ -357 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) │ │ │ │ │ -358 : 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), │ │ │ │ │ -359 dampingFactor_(prolongDamp), accumulate_( _a_c_c_u_m_u_l_a_t_e) │ │ │ │ │ -360 {} │ │ │ │ │ -361 │ │ │ │ │ -362 private: │ │ │ │ │ -366 int maxLevel_; │ │ │ │ │ -370 int coarsenTarget_; │ │ │ │ │ -374 double minCoarsenRate_; │ │ │ │ │ -378 double dampingFactor_; │ │ │ │ │ -383 _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e accumulate_; │ │ │ │ │ -384 }; │ │ │ │ │ -385 │ │ │ │ │ -_3_9_2 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 │ │ │ │ │ +336 }; │ │ │ │ │ +337 │ │ │ │ │ +338 │ │ │ │ │ +339 template │ │ │ │ │ +_3_4_0 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x ,TA> > │ │ │ │ │ +341 { │ │ │ │ │ +_3_4_2 typedef _B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_B_,_n_,_m_> ,TA> _M_a_t_r_i_x; │ │ │ │ │ +_3_4_3 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +344 │ │ │ │ │ +_3_4_5 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m (const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*i*/) │ │ │ │ │ +346 { │ │ │ │ │ +347 return n; │ │ │ │ │ +348 } │ │ │ │ │ +349 │ │ │ │ │ +_3_5_0 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m (const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*c*/) │ │ │ │ │ +351 { │ │ │ │ │ +352 return m; │ │ │ │ │ +353 } │ │ │ │ │ +354 │ │ │ │ │ +_3_5_5 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m (const _M_a_t_r_i_x& A) { │ │ │ │ │ +356 return A.N()*n; │ │ │ │ │ +357 } │ │ │ │ │ +358 │ │ │ │ │ +_3_5_9 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m (const _M_a_t_r_i_x& A) { │ │ │ │ │ +360 return A.M()*m; │ │ │ │ │ +361 } │ │ │ │ │ +362 }; │ │ │ │ │ +363 │ │ │ │ │ +364 template │ │ │ │ │ +_3_6_5 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ │ +366 { │ │ │ │ │ +_3_6_7 typedef _F_i_e_l_d_M_a_t_r_i_x_<_K_,_n_,_m_> _M_a_t_r_i_x; │ │ │ │ │ +_3_6_8 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +369 │ │ │ │ │ +_3_7_0 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +371 { │ │ │ │ │ +372 return 1; │ │ │ │ │ +373 } │ │ │ │ │ +374 │ │ │ │ │ +_3_7_5 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +376 { │ │ │ │ │ +377 return 1; │ │ │ │ │ +378 } │ │ │ │ │ +379 │ │ │ │ │ +_3_8_0 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x& /*A*/) │ │ │ │ │ +381 { │ │ │ │ │ +382 return n; │ │ │ │ │ +383 } │ │ │ │ │ +384 │ │ │ │ │ +_3_8_5 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x& /*A*/) │ │ │ │ │ +386 { │ │ │ │ │ +387 return m; │ │ │ │ │ +388 } │ │ │ │ │ +389 }; │ │ │ │ │ +390 │ │ │ │ │ +391 template │ │ │ │ │ +_3_9_2 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_D_u_n_e::DynamicMatrix > │ │ │ │ │ 393 { │ │ │ │ │ -394 public: │ │ │ │ │ -_4_0_1 void _s_e_t_D_e_b_u_g_L_e_v_e_l(int level) │ │ │ │ │ -402 { │ │ │ │ │ -403 debugLevel_ = level; │ │ │ │ │ -404 } │ │ │ │ │ -405 │ │ │ │ │ -_4_1_1 int _d_e_b_u_g_L_e_v_e_l() const │ │ │ │ │ -412 { │ │ │ │ │ -413 return debugLevel_; │ │ │ │ │ -414 } │ │ │ │ │ -415 │ │ │ │ │ -_4_2_0 void _s_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s(std::size_t steps) │ │ │ │ │ -421 { │ │ │ │ │ -422 preSmoothSteps_=steps; │ │ │ │ │ -423 } │ │ │ │ │ -_4_2_8 std::size_t _g_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ │ -429 { │ │ │ │ │ -430 return preSmoothSteps_; │ │ │ │ │ -431 } │ │ │ │ │ -432 │ │ │ │ │ -_4_3_7 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) │ │ │ │ │ -438 { │ │ │ │ │ -439 postSmoothSteps_=steps; │ │ │ │ │ -440 } │ │ │ │ │ -_4_4_5 std::size_t _g_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ │ -446 { │ │ │ │ │ -447 return postSmoothSteps_; │ │ │ │ │ -448 } │ │ │ │ │ -449 │ │ │ │ │ -_4_5_3 void _s_e_t_G_a_m_m_a(std::size_t gamma) │ │ │ │ │ -454 { │ │ │ │ │ -455 gamma_=gamma; │ │ │ │ │ -456 } │ │ │ │ │ -_4_6_0 std::size_t _g_e_t_G_a_m_m_a() const │ │ │ │ │ -461 { │ │ │ │ │ -462 return gamma_; │ │ │ │ │ -463 } │ │ │ │ │ -464 │ │ │ │ │ -_4_6_9 void _s_e_t_A_d_d_i_t_i_v_e(bool additive) │ │ │ │ │ -470 { │ │ │ │ │ -471 additive_=additive; │ │ │ │ │ -472 } │ │ │ │ │ -473 │ │ │ │ │ -_4_7_8 bool _g_e_t_A_d_d_i_t_i_v_e() const │ │ │ │ │ +_3_9_4 typedef Dune::DynamicMatrix _M_a_t_r_i_x_T_y_p_e; │ │ │ │ │ +_3_9_5 typedef typename MatrixType::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +396 │ │ │ │ │ +_3_9_7 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x_T_y_p_e& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +398 { │ │ │ │ │ +399 return 1; │ │ │ │ │ +400 } │ │ │ │ │ +401 │ │ │ │ │ +_4_0_2 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x_T_y_p_e& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +403 { │ │ │ │ │ +404 return 1; │ │ │ │ │ +405 } │ │ │ │ │ +406 │ │ │ │ │ +_4_0_7 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x_T_y_p_e& A) │ │ │ │ │ +408 { │ │ │ │ │ +409 return A.N(); │ │ │ │ │ +410 } │ │ │ │ │ +411 │ │ │ │ │ +_4_1_2 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x_T_y_p_e& A) │ │ │ │ │ +413 { │ │ │ │ │ +414 return A.M(); │ │ │ │ │ +415 } │ │ │ │ │ +416 }; │ │ │ │ │ +417 │ │ │ │ │ +418 template │ │ │ │ │ +_4_1_9 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x, TA> > │ │ │ │ │ +420 { │ │ │ │ │ +_4_2_1 typedef _M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_K_,_n_,_m_>, TA> _T_h_i_s_M_a_t_r_i_x; │ │ │ │ │ +_4_2_2 typedef typename _T_h_i_s_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +423 │ │ │ │ │ +_4_2_4 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _T_h_i_s_M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +425 { │ │ │ │ │ +426 return n; │ │ │ │ │ +427 } │ │ │ │ │ +428 │ │ │ │ │ +_4_2_9 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _T_h_i_s_M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +430 { │ │ │ │ │ +431 return m; │ │ │ │ │ +432 } │ │ │ │ │ +433 │ │ │ │ │ +_4_3_4 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _T_h_i_s_M_a_t_r_i_x& A) │ │ │ │ │ +435 { │ │ │ │ │ +436 return A.N()*n; │ │ │ │ │ +437 } │ │ │ │ │ +438 │ │ │ │ │ +_4_3_9 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _T_h_i_s_M_a_t_r_i_x& A) │ │ │ │ │ +440 { │ │ │ │ │ +441 return A.M()*m; │ │ │ │ │ +442 } │ │ │ │ │ +443 }; │ │ │ │ │ +444 │ │ │ │ │ +445 template │ │ │ │ │ +_4_4_6 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n > │ │ │ │ │ +447 { │ │ │ │ │ +_4_4_8 typedef DiagonalMatrix _M_a_t_r_i_x; │ │ │ │ │ +_4_4_9 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +450 │ │ │ │ │ +_4_5_1 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +452 { │ │ │ │ │ +453 return 1; │ │ │ │ │ +454 } │ │ │ │ │ +455 │ │ │ │ │ +_4_5_6 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +457 { │ │ │ │ │ +458 return 1; │ │ │ │ │ +459 } │ │ │ │ │ +460 │ │ │ │ │ +_4_6_1 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x& /*A*/) │ │ │ │ │ +462 { │ │ │ │ │ +463 return n; │ │ │ │ │ +464 } │ │ │ │ │ +465 │ │ │ │ │ +_4_6_6 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x& /*A*/) │ │ │ │ │ +467 { │ │ │ │ │ +468 return n; │ │ │ │ │ +469 } │ │ │ │ │ +470 }; │ │ │ │ │ +471 │ │ │ │ │ +472 template │ │ │ │ │ +_4_7_3 struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x > │ │ │ │ │ +474 { │ │ │ │ │ +_4_7_5 typedef _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_K_,_n_> _M_a_t_r_i_x; │ │ │ │ │ +_4_7_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; │ │ │ │ │ +477 │ │ │ │ │ +_4_7_8 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ 479 { │ │ │ │ │ -480 return additive_; │ │ │ │ │ +480 return 1; │ │ │ │ │ 481 } │ │ │ │ │ 482 │ │ │ │ │ -_4_9_3 _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, │ │ │ │ │ -494 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) │ │ │ │ │ -495 : _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) │ │ │ │ │ -496 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1), │ │ │ │ │ -497 additive_(false) │ │ │ │ │ -498 {} │ │ │ │ │ -499 private: │ │ │ │ │ -500 int debugLevel_; │ │ │ │ │ -501 std::size_t preSmoothSteps_; │ │ │ │ │ -502 std::size_t postSmoothSteps_; │ │ │ │ │ -503 std::size_t gamma_; │ │ │ │ │ -504 bool additive_; │ │ │ │ │ -505 }; │ │ │ │ │ -506 │ │ │ │ │ -507 } //namespace AMG │ │ │ │ │ -508 │ │ │ │ │ -509} //namespace Dune │ │ │ │ │ -510#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:469 │ │ │ │ │ -_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:332 │ │ │ │ │ -_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:202 │ │ │ │ │ -_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:296 │ │ │ │ │ -_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:304 │ │ │ │ │ -_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:194 │ │ │ │ │ -_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_:_:_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:211 │ │ │ │ │ -_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:286 │ │ │ │ │ -_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 he data should be accumulated on fewer processes on coarser levels. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:319 │ │ │ │ │ -_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:342 │ │ │ │ │ -_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:312 │ │ │ │ │ -_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:220 │ │ │ │ │ -_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:478 │ │ │ │ │ -_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:263 │ │ │ │ │ -_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:401 │ │ │ │ │ -_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:460 │ │ │ │ │ -_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:437 │ │ │ │ │ -_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:428 │ │ │ │ │ -_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:188 │ │ │ │ │ -_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:270 │ │ │ │ │ -_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_:_:_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) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:493 │ │ │ │ │ -_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:278 │ │ │ │ │ -_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:420 │ │ │ │ │ -_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:232 │ │ │ │ │ -_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_:_:_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) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:356 │ │ │ │ │ -_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:453 │ │ │ │ │ -_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:324 │ │ │ │ │ -_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:411 │ │ │ │ │ -_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:445 │ │ │ │ │ -_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:244 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u │ │ │ │ │ -@ noAccu │ │ │ │ │ -No data accumulution. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:238 │ │ │ │ │ -_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:248 │ │ │ │ │ +_4_8_3 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x& /*A*/, _s_i_z_e___t_y_p_e /*r*/) │ │ │ │ │ +484 { │ │ │ │ │ +485 return 1; │ │ │ │ │ +486 } │ │ │ │ │ +487 │ │ │ │ │ +_4_8_8 static _s_i_z_e___t_y_p_e _r_o_w_d_i_m(const _M_a_t_r_i_x& /*A*/) │ │ │ │ │ +489 { │ │ │ │ │ +490 return n; │ │ │ │ │ +491 } │ │ │ │ │ +492 │ │ │ │ │ +_4_9_3 static _s_i_z_e___t_y_p_e _c_o_l_d_i_m(const _M_a_t_r_i_x& /*A*/) │ │ │ │ │ +494 { │ │ │ │ │ +495 return n; │ │ │ │ │ +496 } │ │ │ │ │ +497 }; │ │ │ │ │ +498 │ │ │ │ │ +502 template │ │ │ │ │ +_5_0_3 struct _I_s_M_a_t_r_i_x │ │ │ │ │ +504 { │ │ │ │ │ +505 enum { │ │ │ │ │ +509 _v_a_l_u_e = false │ │ │ │ │ +_5_1_0 }; │ │ │ │ │ +511 }; │ │ │ │ │ +512 │ │ │ │ │ +513 template │ │ │ │ │ +_5_1_4 struct _I_s_M_a_t_r_i_x > │ │ │ │ │ +515 { │ │ │ │ │ +516 enum { │ │ │ │ │ +520 _v_a_l_u_e = true │ │ │ │ │ +_5_2_1 }; │ │ │ │ │ +522 }; │ │ │ │ │ +523 │ │ │ │ │ +524 │ │ │ │ │ +525 template │ │ │ │ │ +_5_2_6 struct _I_s_M_a_t_r_i_x<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ │ +527 { │ │ │ │ │ +528 enum { │ │ │ │ │ +532 _v_a_l_u_e = true │ │ │ │ │ +_5_3_3 }; │ │ │ │ │ +534 }; │ │ │ │ │ +535 │ │ │ │ │ +536 template │ │ │ │ │ +_5_3_7 struct _P_o_i_n_t_e_r_C_o_m_p_a_r_e │ │ │ │ │ +538 { │ │ │ │ │ +_5_3_9 bool _o_p_e_r_a_t_o_r_(_)(const T* l, const T* r) │ │ │ │ │ +540 { │ │ │ │ │ +541 return *l < *r; │ │ │ │ │ +542 } │ │ │ │ │ +543 }; │ │ │ │ │ +544 │ │ │ │ │ +545} │ │ │ │ │ +546#endif │ │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_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. │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_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 │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -Parameters needed to check whether a node depends on another. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:31 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -Parameters needed for the aggregation process. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -Parameters for the complete coarsening process. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:258 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -All parameters for AMG. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ +_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_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_c_o_l_d_i_m │ │ │ │ │ +static auto coldim(const M &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_r_o_w_d_i_m │ │ │ │ │ +static auto rowdim(const M &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:214 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The type for the index access and the size. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::ConstIterator ConstColIterator │ │ │ │ │ +Const iterator to the entries of a row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:741 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +B block_type │ │ │ │ │ +export the type representing the components │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:491 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator access to matrix rows │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:579 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x │ │ │ │ │ +A Matrix class to support different block types. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockmatrix.hh:46 │ │ │ │ │ +_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_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_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_:_:_e_n_d │ │ │ │ │ +RowIterator end() │ │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:620 │ │ │ │ │ +_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:614 │ │ │ │ │ +_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_:_:_C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t │ │ │ │ │ +Check whether the a matrix has diagonal values on blocklevel recursion levels. │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:48 │ │ │ │ │ +_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_:_:_C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t_<_ _M_a_t_r_i_x_,_ _0_,_ _l_ _>_:_:_c_h_e_c_k │ │ │ │ │ +static void check(const Matrix &mat) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:75 │ │ │ │ │ +_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_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _A_r_g_s_._._._ _>_,_ _b_l_o_c_k_l_e_v_e_l_, │ │ │ │ │ +_l_ _>_:_:_c_h_e_c_k │ │ │ │ │ +static void check(const Matrix &) │ │ │ │ │ +Check whether the a matrix has diagonal values on blocklevel recursion levels. │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:99 │ │ │ │ │ +_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_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_M_a_t_r_i_x_<_ _T_1_,_ _A_r_g_s_._._._ _>_,_ _b_l_o_c_k_l_e_v_e_l_, │ │ │ │ │ +_l_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +MultiTypeBlockMatrix< T1, Args... > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix< B, TA > &A, size_type i) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:232 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix< B, TA > &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix< B, TA > &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:242 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +typename Matrix< B, TA >::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix< B, TA > &A, size_type c) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +typename Matrix< B, TA >::block_type block_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< B, TA > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:311 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +Matrix::block_type block_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:264 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &A, size_type c) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _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 matrixutils.hh:265 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &A, size_type i) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:304 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:359 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:345 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:355 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:343 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< FieldMatrix< B, n, m >,TA > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:342 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:350 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:370 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:385 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:368 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +FieldMatrix< K, n, m > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:367 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:375 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:380 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _T_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const MatrixType &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:412 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _T_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const MatrixType &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:407 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _T_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const MatrixType &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:397 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _T_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +MatrixType::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:395 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _T_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const MatrixType &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:402 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_u_n_e_:_:_D_y_n_a_m_i_c_M_a_t_r_i_x_<_ _T_ _>_ _>_:_:_M_a_t_r_i_x_T_y_p_e │ │ │ │ │ +Dune::DynamicMatrix< T > MatrixType │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:394 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const ThisMatrix &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:439 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const ThisMatrix &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:434 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_T_h_i_s_M_a_t_r_i_x │ │ │ │ │ +Matrix< FieldMatrix< K, n, m >, TA > ThisMatrix │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:421 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const ThisMatrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:429 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const ThisMatrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:424 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _n_,_ _m_ _>_,_ _T_A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +ThisMatrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:422 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:456 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:461 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +DiagonalMatrix< K, n > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:448 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _D_i_a_g_o_n_a_l_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:451 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:493 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:478 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_c_o_l_d_i_m │ │ │ │ │ +static size_type coldim(const Matrix &, size_type) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:483 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:476 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +ScaledIdentityMatrix< K, n > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:475 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_r_o_w_d_i_m │ │ │ │ │ +static size_type rowdim(const Matrix &) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:488 │ │ │ │ │ +_D_u_n_e_:_:_I_s_M_a_t_r_i_x │ │ │ │ │ +Test whether a type is an ISTL Matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:504 │ │ │ │ │ +_D_u_n_e_:_:_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_:_:_P_o_i_n_t_e_r_C_o_m_p_a_r_e │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:538 │ │ │ │ │ +_D_u_n_e_:_:_P_o_i_n_t_e_r_C_o_m_p_a_r_e_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +bool operator()(const T *l, const T *r) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:539 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ │ +A multiple of the identity matrix of static size. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::size_t size_type │ │ │ │ │ +The type used for the index access and size operations. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:43 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: dependency.hh File Reference │ │ │ │ +dune-istl: basearray.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,69 +65,43 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ +
basearray.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

Implements several basic array containers. │ │ │ │ More...

│ │ │ │ -
#include <bitset>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include "graph.hh"
│ │ │ │ -#include "properties.hh"
│ │ │ │ -#include <dune/common/propertymap.hh>
│ │ │ │ +
#include "assert.h"
│ │ │ │ +#include <cmath>
│ │ │ │ +#include <cstddef>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include "istlexception.hh"
│ │ │ │ +#include <dune/common/iteratorfacades.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::Amg::EdgeProperties
 Class representing the properties of an ede 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
│ │ │ │ +

Implements several basic array containers.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,56 +1,24 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -dependency.hh File Reference │ │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ │ -Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ │ -_M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_g_r_a_p_h_._h_h" │ │ │ │ │ -#include "_p_r_o_p_e_r_t_i_e_s_._h_h" │ │ │ │ │ -#include │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +basearray.hh File Reference │ │ │ │ │ +Implements several basic array containers. _M_o_r_e_._._. │ │ │ │ │ +#include "assert.h" │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_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_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ -  Class representing the properties of an ede 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 │ │ │ │ │ +Implements several basic array containers. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: dependency.hh Source File │ │ │ │ +dune-istl: basearray.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,490 +70,431 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
dependency.hh
│ │ │ │ +
basearray.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
5#ifndef DUNE_AMG_DEPENDENCY_HH
│ │ │ │ -
6#define DUNE_AMG_DEPENDENCY_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_BASEARRAY_HH
│ │ │ │ +
6#define DUNE_ISTL_BASEARRAY_HH
│ │ │ │
7
│ │ │ │ -
8
│ │ │ │ -
9#include <bitset>
│ │ │ │ -
10#include <ostream>
│ │ │ │ -
11
│ │ │ │ -
12#include "graph.hh"
│ │ │ │ -
13#include "properties.hh"
│ │ │ │ -
14#include <dune/common/propertymap.hh>
│ │ │ │ -
15
│ │ │ │ +
8#include "assert.h"
│ │ │ │ +
9#include <cmath>
│ │ │ │ +
10#include <cstddef>
│ │ │ │ +
11#include <memory>
│ │ │ │ +
12#include <algorithm>
│ │ │ │ +
13
│ │ │ │ +
14#include "istlexception.hh"
│ │ │ │ +
15#include <dune/common/iteratorfacades.hh>
│ │ │ │
16
│ │ │ │ -
17namespace Dune
│ │ │ │ -
18{
│ │ │ │ -
19 namespace Amg
│ │ │ │ -
20 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
39 {
│ │ │ │ -
40 friend std::ostream& operator<<(std::ostream& os, const EdgeProperties& props);
│ │ │ │ -
41 public:
│ │ │ │ - │ │ │ │ -
44
│ │ │ │ -
45 private:
│ │ │ │ -
46
│ │ │ │ -
47 std::bitset<SIZE> flags_;
│ │ │ │ -
48 public:
│ │ │ │ - │ │ │ │ -
51
│ │ │ │ -
53 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ │ +
21namespace Dune {
│ │ │ │ +
22
│ │ │ │ +
24namespace Imp {
│ │ │ │ +
25
│ │ │ │ +
50 template<class B, class A=std::allocator<B> >
│ │ │ │ +
51 class base_array_unmanaged
│ │ │ │ +
52 {
│ │ │ │ +
53 public:
│ │ │ │
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();
│ │ │ │ +
55 //===== type definitions and constants
│ │ │ │ +
56
│ │ │ │ +
58 typedef B member_type;
│ │ │ │ +
59
│ │ │ │ +
61 typedef A allocator_type;
│ │ │ │ +
62
│ │ │ │ +
64 typedef typename A::size_type size_type;
│ │ │ │ +
65
│ │ │ │ +
67 using reference = B&;
│ │ │ │ +
68
│ │ │ │ +
70 using const_reference = const B&;
│ │ │ │ +
71
│ │ │ │ +
72 //===== access to components
│ │ │ │ +
73
│ │ │ │ +
75 reference operator[] (size_type i)
│ │ │ │ +
76 {
│ │ │ │ +
77#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
78 if (i>=n) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
79#endif
│ │ │ │ +
80 return p[i];
│ │ │ │ +
81 }
│ │ │ │ +
82
│ │ │ │ +
84 const_reference operator[] (size_type i) const
│ │ │ │ +
85 {
│ │ │ │ +
86#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
87 if (i>=n) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
88#endif
│ │ │ │ +
89 return p[i];
│ │ │ │ +
90 }
│ │ │ │
91
│ │ │ │ -
96 bool isOneWay() const;
│ │ │ │ -
97
│ │ │ │ -
102 bool isTwoWay() const;
│ │ │ │ -
103
│ │ │ │ -
108 bool isStrong() const;
│ │ │ │ -
109
│ │ │ │ -
113 void reset();
│ │ │ │ -
114
│ │ │ │ -
118 void printFlags() const;
│ │ │ │ -
119 };
│ │ │ │ -
│ │ │ │ -
120
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
127 friend std::ostream& operator<<(std::ostream& os, const VertexProperties& props);
│ │ │ │ -
128 public:
│ │ │ │ - │ │ │ │ -
130 private:
│ │ │ │ -
131
│ │ │ │ -
133 std::bitset<SIZE> flags_;
│ │ │ │ -
134
│ │ │ │ -
135 public:
│ │ │ │ - │ │ │ │ -
138
│ │ │ │ -
140 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ │ -
141
│ │ │ │ -
143 bool operator[](std::size_t v) const;
│ │ │ │ -
144
│ │ │ │ -
151 void setIsolated();
│ │ │ │ -
152
│ │ │ │ -
156 bool isolated() const;
│ │ │ │ -
157
│ │ │ │ -
161 void resetIsolated();
│ │ │ │ -
162
│ │ │ │ -
166 void setVisited();
│ │ │ │ +
93 template<class T>
│ │ │ │ +
94 class RealIterator
│ │ │ │ +
95 : public RandomAccessIteratorFacade<RealIterator<T>, T>
│ │ │ │ +
96 {
│ │ │ │ +
97 public:
│ │ │ │ +
99 typedef typename std::remove_const<T>::type ValueType;
│ │ │ │ +
100
│ │ │ │ +
101 friend class RandomAccessIteratorFacade<RealIterator<const ValueType>, const ValueType>;
│ │ │ │ +
102 friend class RandomAccessIteratorFacade<RealIterator<ValueType>, ValueType>;
│ │ │ │ +
103 friend class RealIterator<const ValueType>;
│ │ │ │ +
104 friend class RealIterator<ValueType>;
│ │ │ │ +
105
│ │ │ │ +
107 RealIterator ()
│ │ │ │ +
108 : p(0), i(0)
│ │ │ │ +
109 {}
│ │ │ │ +
110
│ │ │ │ +
111 RealIterator (const B* _p, B* _i) : p(_p), i(_i)
│ │ │ │ +
112 { }
│ │ │ │ +
113
│ │ │ │ +
114 RealIterator(const RealIterator<ValueType>& it)
│ │ │ │ +
115 : p(it.p), i(it.i)
│ │ │ │ +
116 {}
│ │ │ │ +
117
│ │ │ │ +
119 size_type index () const
│ │ │ │ +
120 {
│ │ │ │ +
121 return i-p;
│ │ │ │ +
122 }
│ │ │ │ +
123
│ │ │ │ +
125 bool equals (const RealIterator<ValueType>& other) const
│ │ │ │ +
126 {
│ │ │ │ +
127 assert(other.p==p);
│ │ │ │ +
128 return i==other.i;
│ │ │ │ +
129 }
│ │ │ │ +
130
│ │ │ │ +
132 bool equals (const RealIterator<const ValueType>& other) const
│ │ │ │ +
133 {
│ │ │ │ +
134 assert(other.p==p);
│ │ │ │ +
135 return i==other.i;
│ │ │ │ +
136 }
│ │ │ │ +
137
│ │ │ │ +
138 std::ptrdiff_t distanceTo(const RealIterator& o) const
│ │ │ │ +
139 {
│ │ │ │ +
140 return o.i-i;
│ │ │ │ +
141 }
│ │ │ │ +
142
│ │ │ │ +
143 private:
│ │ │ │ +
145 void increment()
│ │ │ │ +
146 {
│ │ │ │ +
147 ++i;
│ │ │ │ +
148 }
│ │ │ │ +
149
│ │ │ │ +
151 void decrement()
│ │ │ │ +
152 {
│ │ │ │ +
153 --i;
│ │ │ │ +
154 }
│ │ │ │ +
155
│ │ │ │ +
156 // Needed for operator[] of the iterator
│ │ │ │ +
157 reference elementAt (std::ptrdiff_t offset) const
│ │ │ │ +
158 {
│ │ │ │ +
159 return *(i+offset);
│ │ │ │ +
160 }
│ │ │ │ +
161
│ │ │ │ +
163 reference dereference () const
│ │ │ │ +
164 {
│ │ │ │ +
165 return *i;
│ │ │ │ +
166 }
│ │ │ │
167
│ │ │ │ -
171 bool visited() const;
│ │ │ │ +
168 void advance(std::ptrdiff_t d)
│ │ │ │ +
169 {
│ │ │ │ +
170 i+=d;
│ │ │ │ +
171 }
│ │ │ │
172
│ │ │ │ -
176 void resetVisited();
│ │ │ │ -
177
│ │ │ │ -
181 void setFront();
│ │ │ │ -
182
│ │ │ │ -
186 bool front() const;
│ │ │ │ -
187
│ │ │ │ -
191 void resetFront();
│ │ │ │ +
173 const B* p;
│ │ │ │ +
174 B* i;
│ │ │ │ +
175 };
│ │ │ │ +
176
│ │ │ │ +
178 typedef RealIterator<B> iterator;
│ │ │ │ +
179
│ │ │ │ +
180
│ │ │ │ +
182 iterator begin ()
│ │ │ │ +
183 {
│ │ │ │ +
184 return iterator(p,p);
│ │ │ │ +
185 }
│ │ │ │ +
186
│ │ │ │ +
188 iterator end ()
│ │ │ │ +
189 {
│ │ │ │ +
190 return iterator(p,p+n);
│ │ │ │ +
191 }
│ │ │ │
192
│ │ │ │ -
196 void setExcludedBorder();
│ │ │ │ -
197
│ │ │ │ -
202 bool excludedBorder() const;
│ │ │ │ -
203
│ │ │ │ -
207 void resetExcludedBorder();
│ │ │ │ -
208
│ │ │ │ -
212 void reset();
│ │ │ │ -
213
│ │ │ │ -
214 };
│ │ │ │ -
│ │ │ │ +
195 iterator beforeEnd ()
│ │ │ │ +
196 {
│ │ │ │ +
197 return iterator(p,p+n-1);
│ │ │ │ +
198 }
│ │ │ │ +
199
│ │ │ │ +
202 iterator beforeBegin ()
│ │ │ │ +
203 {
│ │ │ │ +
204 return iterator(p,p-1);
│ │ │ │ +
205 }
│ │ │ │ +
206
│ │ │ │ +
208 iterator find (size_type i)
│ │ │ │ +
209 {
│ │ │ │ +
210 return iterator(p,p+std::min(i,n));
│ │ │ │ +
211 }
│ │ │ │ +
212
│ │ │ │ +
214 typedef RealIterator<const B> const_iterator;
│ │ │ │
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 {
│ │ │ │ -
227 index = i
│ │ │ │ -
228 };
│ │ │ │ -
229
│ │ │ │ -
233 typedef G Graph;
│ │ │ │ +
217 const_iterator begin () const
│ │ │ │ +
218 {
│ │ │ │ +
219 return const_iterator(p,p+0);
│ │ │ │ +
220 }
│ │ │ │ +
221
│ │ │ │ +
223 const_iterator end () const
│ │ │ │ +
224 {
│ │ │ │ +
225 return const_iterator(p,p+n);
│ │ │ │ +
226 }
│ │ │ │ +
227
│ │ │ │ +
230 const_iterator beforeEnd () const
│ │ │ │ +
231 {
│ │ │ │ +
232 return const_iterator(p,p+n-1);
│ │ │ │ +
233 }
│ │ │ │
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 {}
│ │ │ │ -
│ │ │ │ +
237 const_iterator beforeBegin () const
│ │ │ │ +
238 {
│ │ │ │ +
239 return const_iterator(p,p-1);
│ │ │ │ +
240 }
│ │ │ │ +
241
│ │ │ │ +
243 const_iterator find (size_type i) const
│ │ │ │ +
244 {
│ │ │ │ +
245 return const_iterator(p,p+std::min(i,n));
│ │ │ │ +
246 }
│ │ │ │ +
247
│ │ │ │ +
248
│ │ │ │ +
249 //===== sizes
│ │ │ │ +
250
│ │ │ │ +
252 size_type size () const
│ │ │ │ +
253 {
│ │ │ │ +
254 return n;
│ │ │ │ +
255 }
│ │ │ │ +
256
│ │ │ │ +
258 const B* data() const
│ │ │ │ +
259 {
│ │ │ │ +
260 return p;
│ │ │ │ +
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 };
│ │ │ │ -
│ │ │ │ +
264 B* data()
│ │ │ │ +
265 {
│ │ │ │ +
266 return p;
│ │ │ │ +
267 }
│ │ │ │ +
268
│ │ │ │ +
269 protected:
│ │ │ │ +
271 base_array_unmanaged ()
│ │ │ │ +
272 : n(0), p(0)
│ │ │ │ +
273 {}
│ │ │ │ +
275 base_array_unmanaged (size_type n_, B* p_)
│ │ │ │ +
276 : n(n_), p(p_)
│ │ │ │ +
277 {}
│ │ │ │ +
278 size_type n; // number of elements in array
│ │ │ │ +
279 B *p; // pointer to dynamically allocated built-in array
│ │ │ │ +
280 };
│ │ │ │ +
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 }
│ │ │ │ -
│ │ │ │ +
283
│ │ │ │ +
305 template<class B, class A=std::allocator<B> >
│ │ │ │ +
306 class compressed_base_array_unmanaged
│ │ │ │ +
307 {
│ │ │ │ +
308 public:
│ │ │ │ +
309
│ │ │ │ +
310 //===== type definitions and constants
│ │ │ │ +
311
│ │ │ │ +
313 typedef B member_type;
│ │ │ │
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
│ │ │ │ -
│ │ │ │ -
332 inline bool EdgeProperties::influences() const
│ │ │ │ -
333 {
│ │ │ │ -
334 // Test the INFLUENCE bit
│ │ │ │ -
335 return flags_.test(INFLUENCE);
│ │ │ │ +
316 typedef A allocator_type;
│ │ │ │ +
317
│ │ │ │ +
319 typedef typename A::size_type size_type;
│ │ │ │ +
320
│ │ │ │ +
322 using reference = B&;
│ │ │ │ +
323
│ │ │ │ +
325 using const_reference = const B&;
│ │ │ │ +
326
│ │ │ │ +
327 //===== access to components
│ │ │ │ +
328
│ │ │ │ +
330 reference operator[] (size_type i)
│ │ │ │ +
331 {
│ │ │ │ +
332 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ +
333 if (lb == j+n || *lb != i)
│ │ │ │ +
334 DUNE_THROW(ISTLError,"index "<<i<<" not in compressed array");
│ │ │ │ +
335 return p[lb-j];
│ │ │ │
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 }
│ │ │ │ -
│ │ │ │ +
339 const_reference operator[] (size_type i) const
│ │ │ │ +
340 {
│ │ │ │ +
341 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ +
342 if (lb == j+n || *lb != i)
│ │ │ │ +
343 DUNE_THROW(ISTLError,"index "<<i<<" not in compressed array");
│ │ │ │ +
344 return p[lb-j];
│ │ │ │ +
345 }
│ │ │ │ +
346
│ │ │ │ +
348 template<class T>
│ │ │ │ +
349 class RealIterator
│ │ │ │ +
350 : public BidirectionalIteratorFacade<RealIterator<T>, T>
│ │ │ │ +
351 {
│ │ │ │ +
352 public:
│ │ │ │ +
354 typedef typename std::remove_const<T>::type ValueType;
│ │ │ │ +
355
│ │ │ │ +
356 friend class BidirectionalIteratorFacade<RealIterator<const ValueType>, const ValueType>;
│ │ │ │ +
357 friend class BidirectionalIteratorFacade<RealIterator<ValueType>, ValueType>;
│ │ │ │ +
358 friend class RealIterator<const ValueType>;
│ │ │ │ +
359 friend class RealIterator<ValueType>;
│ │ │ │ +
360
│ │ │ │ +
362 RealIterator ()
│ │ │ │ +
363 : p(0), j(0), i(0)
│ │ │ │ +
364 {}
│ │ │ │ +
365
│ │ │ │ +
367 RealIterator (B* _p, size_type* _j, size_type _i)
│ │ │ │ +
368 : p(_p), j(_j), i(_i)
│ │ │ │ +
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 {}
│ │ │ │ -
│ │ │ │ +
374 RealIterator(const RealIterator<ValueType>& it)
│ │ │ │ +
375 : p(it.p), j(it.j), i(it.i)
│ │ │ │ +
376 {}
│ │ │ │ +
377
│ │ │ │ +
378
│ │ │ │ +
380 bool equals (const RealIterator<ValueType>& it) const
│ │ │ │ +
381 {
│ │ │ │ +
382 assert(p==it.p);
│ │ │ │ +
383 return (i)==(it.i);
│ │ │ │ +
384 }
│ │ │ │ +
385
│ │ │ │ +
387 bool equals (const RealIterator<const ValueType>& it) const
│ │ │ │ +
388 {
│ │ │ │ +
389 assert(p==it.p);
│ │ │ │ +
390 return (i)==(it.i);
│ │ │ │ +
391 }
│ │ │ │
392
│ │ │ │
393
│ │ │ │ -
394 inline std::bitset<VertexProperties::SIZE>::reference
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
396 {
│ │ │ │ -
397 return flags_[v];
│ │ │ │ -
398 }
│ │ │ │ -
│ │ │ │ +
395 size_type index () const
│ │ │ │ +
396 {
│ │ │ │ +
397 return j[i];
│ │ │ │ +
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 }
│ │ │ │ -
│ │ │ │ +
401 void setindex (size_type k)
│ │ │ │ +
402 {
│ │ │ │ +
403 return j[i] = k;
│ │ │ │ +
404 }
│ │ │ │ +
405
│ │ │ │ +
413 size_type offset () const
│ │ │ │ +
414 {
│ │ │ │ +
415 return i;
│ │ │ │ +
416 }
│ │ │ │ +
417
│ │ │ │ +
418 private:
│ │ │ │ +
420 void increment()
│ │ │ │ +
421 {
│ │ │ │ +
422 ++i;
│ │ │ │ +
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 }
│ │ │ │ -
│ │ │ │ +
426 void decrement()
│ │ │ │ +
427 {
│ │ │ │ +
428 --i;
│ │ │ │ +
429 }
│ │ │ │ +
430
│ │ │ │ +
432 reference dereference () const
│ │ │ │ +
433 {
│ │ │ │ +
434 return p[i];
│ │ │ │ +
435 }
│ │ │ │ +
436
│ │ │ │ +
437 B* p;
│ │ │ │ +
438 size_type* j;
│ │ │ │ +
439 size_type i;
│ │ │ │ +
440 };
│ │ │ │ +
441
│ │ │ │ +
443 typedef RealIterator<B> iterator;
│ │ │ │
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 wether 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 wether 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 wether 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 wether 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 wether the node is marked as visited.
Definition dependency.hh:425
│ │ │ │ -
Reference operator[](const Vertex &vertex) const
Get the properties associated to a vertex.
Definition dependency.hh:275
│ │ │ │ -
void reset()
Reset all flags.
Definition dependency.hh:320
│ │ │ │ -
void resetDepends()
Resets the depends flag.
Definition dependency.hh:345
│ │ │ │ -
ReadWritePropertyMapTag Category
Definition dependency.hh:223
│ │ │ │ -
void resetIsolated()
Resets the isolated flag.
Definition dependency.hh:415
│ │ │ │ -
std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > &criterion)
Definition aggregates.hh:113
│ │ │ │ -
bool isStrong() const
Checks wether the edge is strong. I.e. the influence or depends flag is set.
Definition dependency.hh:377
│ │ │ │ -
bool front() const
Checks wether 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 wether the edge is one way. I.e. either the influence or the depends flag but is set.
Definition dependency.hh:364
│ │ │ │ -
@ index
the index to access in the bitset.
Definition dependency.hh:227
│ │ │ │ -
@ VISITED
Definition dependency.hh:129
│ │ │ │ -
@ ISOLATED
Definition dependency.hh:129
│ │ │ │ -
@ SIZE
Definition dependency.hh:129
│ │ │ │ -
@ BORDER
Definition dependency.hh:129
│ │ │ │ -
@ FRONT
Definition dependency.hh:129
│ │ │ │ -
@ DEPEND
Definition dependency.hh:43
│ │ │ │ -
@ SIZE
Definition dependency.hh:43
│ │ │ │ -
@ INFLUENCE
Definition dependency.hh:43
│ │ │ │ +
446 iterator begin ()
│ │ │ │ +
447 {
│ │ │ │ +
448 return iterator(p,j,0);
│ │ │ │ +
449 }
│ │ │ │ +
450
│ │ │ │ +
452 iterator end ()
│ │ │ │ +
453 {
│ │ │ │ +
454 return iterator(p,j,n);
│ │ │ │ +
455 }
│ │ │ │ +
456
│ │ │ │ +
459 iterator beforeEnd ()
│ │ │ │ +
460 {
│ │ │ │ +
461 return iterator(p,j,n-1);
│ │ │ │ +
462 }
│ │ │ │ +
463
│ │ │ │ +
466 iterator beforeBegin ()
│ │ │ │ +
467 {
│ │ │ │ +
468 return iterator(p,j,-1);
│ │ │ │ +
469 }
│ │ │ │ +
470
│ │ │ │ +
472 iterator find (size_type i)
│ │ │ │ +
473 {
│ │ │ │ +
474 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ +
475 return (lb != j+n && *lb == i)
│ │ │ │ +
476 ? iterator(p,j,lb-j)
│ │ │ │ +
477 : end();
│ │ │ │ +
478 }
│ │ │ │ +
479
│ │ │ │ +
481 typedef RealIterator<const B> const_iterator;
│ │ │ │ +
482
│ │ │ │ +
484 const_iterator begin () const
│ │ │ │ +
485 {
│ │ │ │ +
486 return const_iterator(p,j,0);
│ │ │ │ +
487 }
│ │ │ │ +
488
│ │ │ │ +
490 const_iterator end () const
│ │ │ │ +
491 {
│ │ │ │ +
492 return const_iterator(p,j,n);
│ │ │ │ +
493 }
│ │ │ │ +
494
│ │ │ │ +
497 const_iterator beforeEnd () const
│ │ │ │ +
498 {
│ │ │ │ +
499 return const_iterator(p,j,n-1);
│ │ │ │ +
500 }
│ │ │ │ +
501
│ │ │ │ +
504 const_iterator beforeBegin () const
│ │ │ │ +
505 {
│ │ │ │ +
506 return const_iterator(p,j,-1);
│ │ │ │ +
507 }
│ │ │ │ +
508
│ │ │ │ +
510 const_iterator find (size_type i) const
│ │ │ │ +
511 {
│ │ │ │ +
512 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ +
513 return (lb != j+n && *lb == i)
│ │ │ │ +
514 ? const_iterator(p,j,lb-j)
│ │ │ │ +
515 : end();
│ │ │ │ +
516 }
│ │ │ │ +
517
│ │ │ │ +
518 //===== sizes
│ │ │ │ +
519
│ │ │ │ +
521 size_type size () const
│ │ │ │ +
522 {
│ │ │ │ +
523 return n;
│ │ │ │ +
524 }
│ │ │ │ +
525
│ │ │ │ +
526 protected:
│ │ │ │ +
528 compressed_base_array_unmanaged ()
│ │ │ │ +
529 : n(0), p(0), j(0)
│ │ │ │ +
530 {}
│ │ │ │ +
531
│ │ │ │ +
532 size_type n; // number of elements in array
│ │ │ │ +
533 B *p; // pointer to dynamically allocated built-in array
│ │ │ │ +
534 size_type* j; // the index set
│ │ │ │ +
535 };
│ │ │ │ +
536
│ │ │ │ +
537} // end namespace Imp
│ │ │ │ +
538
│ │ │ │ +
539} // end namespace
│ │ │ │ +
540
│ │ │ │ +
541#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
│ │ │ │ -
Class representing the properties of an ede in the matrix graph.
Definition dependency.hh:39
│ │ │ │ -
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ │ -
Definition dependency.hh:220
│ │ │ │ -
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ │ -
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,575 +1,426 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -dependency.hh │ │ │ │ │ +basearray.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -5#ifndef DUNE_AMG_DEPENDENCY_HH │ │ │ │ │ -6#define DUNE_AMG_DEPENDENCY_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_BASEARRAY_HH │ │ │ │ │ +6#define DUNE_ISTL_BASEARRAY_HH │ │ │ │ │ 7 │ │ │ │ │ -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 │ │ │ │ │ +8#include "assert.h" │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13 │ │ │ │ │ +14#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +15#include │ │ │ │ │ 16 │ │ │ │ │ -17namespace _D_u_n_e │ │ │ │ │ -18{ │ │ │ │ │ -19 namespace Amg │ │ │ │ │ -20 { │ │ │ │ │ -_3_8 class _E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ -39 { │ │ │ │ │ -40 friend std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& │ │ │ │ │ -props); │ │ │ │ │ -41 public: │ │ │ │ │ -_4_3 enum {_I_N_F_L_U_E_N_C_E, _D_E_P_E_N_D, _S_I_Z_E}; │ │ │ │ │ -44 │ │ │ │ │ -45 private: │ │ │ │ │ -46 │ │ │ │ │ -47 std::bitset flags_; │ │ │ │ │ -48 public: │ │ │ │ │ -50 _E_d_g_e_P_r_o_p_e_r_t_i_e_s(); │ │ │ │ │ -51 │ │ │ │ │ -53 std::bitset::reference _o_p_e_r_a_t_o_r_[_](std::size_t v); │ │ │ │ │ +21namespace _D_u_n_e { │ │ │ │ │ +22 │ │ │ │ │ +24namespace Imp { │ │ │ │ │ +25 │ │ │ │ │ +50 template > │ │ │ │ │ +51 class base_array_unmanaged │ │ │ │ │ +52 { │ │ │ │ │ +53 public: │ │ │ │ │ 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(); │ │ │ │ │ +55 //===== type definitions and constants │ │ │ │ │ +56 │ │ │ │ │ +58 typedef B member_type; │ │ │ │ │ +59 │ │ │ │ │ +61 typedef A allocator_type; │ │ │ │ │ +62 │ │ │ │ │ +64 typedef typename A::size_type size_type; │ │ │ │ │ +65 │ │ │ │ │ +67 using reference = B&; │ │ │ │ │ +68 │ │ │ │ │ +70 using const_reference = const B&; │ │ │ │ │ +71 │ │ │ │ │ +72 //===== access to components │ │ │ │ │ +73 │ │ │ │ │ +75 reference operator[] (size_type i) │ │ │ │ │ +76 { │ │ │ │ │ +77#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +78 if (i>=n) DUNE_THROW(ISTLError,"index out of range"); │ │ │ │ │ +79#endif │ │ │ │ │ +80 return p[i]; │ │ │ │ │ +81 } │ │ │ │ │ +82 │ │ │ │ │ +84 const_reference operator[] (size_type i) const │ │ │ │ │ +85 { │ │ │ │ │ +86#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +87 if (i>=n) DUNE_THROW(ISTLError,"index out of range"); │ │ │ │ │ +88#endif │ │ │ │ │ +89 return p[i]; │ │ │ │ │ +90 } │ │ │ │ │ 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_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 │ │ │ │ │ -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 │ │ │ │ │ -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(); │ │ │ │ │ +93 template │ │ │ │ │ +94 class RealIterator │ │ │ │ │ +95 : public RandomAccessIteratorFacade, T> │ │ │ │ │ +96 { │ │ │ │ │ +97 public: │ │ │ │ │ +99 typedef typename std::remove_const::type ValueType; │ │ │ │ │ +100 │ │ │ │ │ +101 friend class RandomAccessIteratorFacade, │ │ │ │ │ +const ValueType>; │ │ │ │ │ +102 friend class RandomAccessIteratorFacade, │ │ │ │ │ +ValueType>; │ │ │ │ │ +103 friend class RealIterator; │ │ │ │ │ +104 friend class RealIterator; │ │ │ │ │ +105 │ │ │ │ │ +107 RealIterator () │ │ │ │ │ +108 : p(0), i(0) │ │ │ │ │ +109 {} │ │ │ │ │ +110 │ │ │ │ │ +111 RealIterator (const B* _p, B* _i) : p(_p), i(_i) │ │ │ │ │ +112 { } │ │ │ │ │ +113 │ │ │ │ │ +114 RealIterator(const RealIterator& it) │ │ │ │ │ +115 : p(it.p), i(it.i) │ │ │ │ │ +116 {} │ │ │ │ │ +117 │ │ │ │ │ +119 size_type index () const │ │ │ │ │ +120 { │ │ │ │ │ +121 return i-p; │ │ │ │ │ +122 } │ │ │ │ │ +123 │ │ │ │ │ +125 bool equals (const RealIterator& other) const │ │ │ │ │ +126 { │ │ │ │ │ +127 assert(other.p==p); │ │ │ │ │ +128 return i==other.i; │ │ │ │ │ +129 } │ │ │ │ │ +130 │ │ │ │ │ +132 bool equals (const RealIterator& other) const │ │ │ │ │ +133 { │ │ │ │ │ +134 assert(other.p==p); │ │ │ │ │ +135 return i==other.i; │ │ │ │ │ +136 } │ │ │ │ │ +137 │ │ │ │ │ +138 std::ptrdiff_t distanceTo(const RealIterator& o) const │ │ │ │ │ +139 { │ │ │ │ │ +140 return o.i-i; │ │ │ │ │ +141 } │ │ │ │ │ +142 │ │ │ │ │ +143 private: │ │ │ │ │ +145 void increment() │ │ │ │ │ +146 { │ │ │ │ │ +147 ++i; │ │ │ │ │ +148 } │ │ │ │ │ +149 │ │ │ │ │ +151 void decrement() │ │ │ │ │ +152 { │ │ │ │ │ +153 --i; │ │ │ │ │ +154 } │ │ │ │ │ +155 │ │ │ │ │ +156 // Needed for operator[] of the iterator │ │ │ │ │ +157 reference elementAt (std::ptrdiff_t offset) const │ │ │ │ │ +158 { │ │ │ │ │ +159 return *(i+offset); │ │ │ │ │ +160 } │ │ │ │ │ +161 │ │ │ │ │ +163 reference dereference () const │ │ │ │ │ +164 { │ │ │ │ │ +165 return *i; │ │ │ │ │ +166 } │ │ │ │ │ 167 │ │ │ │ │ -171 bool _v_i_s_i_t_e_d() const; │ │ │ │ │ +168 void advance(std::ptrdiff_t d) │ │ │ │ │ +169 { │ │ │ │ │ +170 i+=d; │ │ │ │ │ +171 } │ │ │ │ │ 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 │ │ │ │ │ -191 void _r_e_s_e_t_F_r_o_n_t(); │ │ │ │ │ +173 const B* p; │ │ │ │ │ +174 B* i; │ │ │ │ │ +175 }; │ │ │ │ │ +176 │ │ │ │ │ +178 typedef RealIterator iterator; │ │ │ │ │ +179 │ │ │ │ │ +180 │ │ │ │ │ +182 iterator begin () │ │ │ │ │ +183 { │ │ │ │ │ +184 return iterator(p,p); │ │ │ │ │ +185 } │ │ │ │ │ +186 │ │ │ │ │ +188 iterator end () │ │ │ │ │ +189 { │ │ │ │ │ +190 return iterator(p,p+n); │ │ │ │ │ +191 } │ │ │ │ │ 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 }; │ │ │ │ │ +195 iterator beforeEnd () │ │ │ │ │ +196 { │ │ │ │ │ +197 return iterator(p,p+n-1); │ │ │ │ │ +198 } │ │ │ │ │ +199 │ │ │ │ │ +202 iterator beforeBegin () │ │ │ │ │ +203 { │ │ │ │ │ +204 return iterator(p,p-1); │ │ │ │ │ +205 } │ │ │ │ │ +206 │ │ │ │ │ +208 iterator find (size_type i) │ │ │ │ │ +209 { │ │ │ │ │ +210 return iterator(p,p+std::min(i,n)); │ │ │ │ │ +211 } │ │ │ │ │ +212 │ │ │ │ │ +214 typedef RealIterator const_iterator; │ │ │ │ │ 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 │ │ │ │ │ -225 enum { │ │ │ │ │ -227 _i_n_d_e_x = i │ │ │ │ │ -_2_2_8 }; │ │ │ │ │ -229 │ │ │ │ │ -_2_3_3 typedef G _G_r_a_p_h; │ │ │ │ │ +217 const_iterator begin () const │ │ │ │ │ +218 { │ │ │ │ │ +219 return const_iterator(p,p+0); │ │ │ │ │ +220 } │ │ │ │ │ +221 │ │ │ │ │ +223 const_iterator end () const │ │ │ │ │ +224 { │ │ │ │ │ +225 return const_iterator(p,p+n); │ │ │ │ │ +226 } │ │ │ │ │ +227 │ │ │ │ │ +230 const_iterator beforeEnd () const │ │ │ │ │ +231 { │ │ │ │ │ +232 return const_iterator(p,p+n-1); │ │ │ │ │ +233 } │ │ │ │ │ 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 {} │ │ │ │ │ +237 const_iterator beforeBegin () const │ │ │ │ │ +238 { │ │ │ │ │ +239 return const_iterator(p,p-1); │ │ │ │ │ +240 } │ │ │ │ │ +241 │ │ │ │ │ +243 const_iterator find (size_type i) const │ │ │ │ │ +244 { │ │ │ │ │ +245 return const_iterator(p,p+std::min(i,n)); │ │ │ │ │ +246 } │ │ │ │ │ +247 │ │ │ │ │ +248 │ │ │ │ │ +249 //===== sizes │ │ │ │ │ +250 │ │ │ │ │ +252 size_type size () const │ │ │ │ │ +253 { │ │ │ │ │ +254 return n; │ │ │ │ │ +255 } │ │ │ │ │ +256 │ │ │ │ │ +258 const B* data() const │ │ │ │ │ +259 { │ │ │ │ │ +260 return p; │ │ │ │ │ +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 }; │ │ │ │ │ +264 B* data() │ │ │ │ │ +265 { │ │ │ │ │ +266 return p; │ │ │ │ │ +267 } │ │ │ │ │ +268 │ │ │ │ │ +269 protected: │ │ │ │ │ +271 base_array_unmanaged () │ │ │ │ │ +272 : n(0), p(0) │ │ │ │ │ +273 {} │ │ │ │ │ +275 base_array_unmanaged (size_type n_, B* p_) │ │ │ │ │ +276 : n(n_), p(p_) │ │ │ │ │ +277 {} │ │ │ │ │ +278 size_type n; // number of elements in array │ │ │ │ │ +279 B *p; // pointer to dynamically allocated built-in array │ │ │ │ │ +280 }; │ │ │ │ │ +281 │ │ │ │ │ 282 │ │ │ │ │ -283 } // end namespace Amg │ │ │ │ │ -284 │ │ │ │ │ -285 template │ │ │ │ │ -_2_8_6 struct PropertyMapTypeSelector > │ │ │ │ │ -287 { │ │ │ │ │ -_2_8_8 typedef _A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_: │ │ │ │ │ -_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>, Amg::VertexProperties::VISITED> _T_y_p_e; │ │ │ │ │ -289 }; │ │ │ │ │ -290 │ │ │ │ │ -291 template │ │ │ │ │ -292 typename PropertyMapTypeSelector >::Type │ │ │ │ │ -_2_9_3 _g_e_t([[maybe_unused]] const _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g& tag, _A_m_g_:_: │ │ │ │ │ -_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>& graph) │ │ │ │ │ -294 { │ │ │ │ │ -295 return _A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_: │ │ │ │ │ -_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>, _A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_I_S_I_T_E_D>(graph); │ │ │ │ │ -296 } │ │ │ │ │ -297 │ │ │ │ │ -298 namespace Amg │ │ │ │ │ -299 { │ │ │ │ │ -_3_0_0 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& │ │ │ │ │ -props) │ │ │ │ │ -301 { │ │ │ │ │ -302 return os << props.flags_; │ │ │ │ │ -303 } │ │ │ │ │ -304 │ │ │ │ │ -_3_0_5 inline _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s() │ │ │ │ │ -306 : flags_() │ │ │ │ │ -307 {} │ │ │ │ │ -308 │ │ │ │ │ -309 inline std::bitset::reference │ │ │ │ │ -_3_1_0 _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_](std::size_t v) │ │ │ │ │ -311 { │ │ │ │ │ -312 return flags_[v]; │ │ │ │ │ -313 } │ │ │ │ │ +283 │ │ │ │ │ +305 template > │ │ │ │ │ +306 class compressed_base_array_unmanaged │ │ │ │ │ +307 { │ │ │ │ │ +308 public: │ │ │ │ │ +309 │ │ │ │ │ +310 //===== type definitions and constants │ │ │ │ │ +311 │ │ │ │ │ +313 typedef B member_type; │ │ │ │ │ 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<((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 } │ │ │ │ │ +339 const_reference operator[] (size_type i) const │ │ │ │ │ +340 { │ │ │ │ │ +341 const size_type* lb = std::lower_bound(j, j+n, i); │ │ │ │ │ +342 if (lb == j+n || *lb != i) │ │ │ │ │ +343 DUNE_THROW(ISTLError,"index "< │ │ │ │ │ +349 class RealIterator │ │ │ │ │ +350 : public BidirectionalIteratorFacade, T> │ │ │ │ │ +351 { │ │ │ │ │ +352 public: │ │ │ │ │ +354 typedef typename std::remove_const::type ValueType; │ │ │ │ │ +355 │ │ │ │ │ +356 friend class BidirectionalIteratorFacade, │ │ │ │ │ +const ValueType>; │ │ │ │ │ +357 friend class BidirectionalIteratorFacade, │ │ │ │ │ +ValueType>; │ │ │ │ │ +358 friend class RealIterator; │ │ │ │ │ +359 friend class RealIterator; │ │ │ │ │ +360 │ │ │ │ │ +362 RealIterator () │ │ │ │ │ +363 : p(0), j(0), i(0) │ │ │ │ │ +364 {} │ │ │ │ │ +365 │ │ │ │ │ +367 RealIterator (B* _p, size_type* _j, size_type _i) │ │ │ │ │ +368 : p(_p), j(_j), i(_i) │ │ │ │ │ +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 {} │ │ │ │ │ +374 RealIterator(const RealIterator& it) │ │ │ │ │ +375 : p(it.p), j(it.j), i(it.i) │ │ │ │ │ +376 {} │ │ │ │ │ +377 │ │ │ │ │ +378 │ │ │ │ │ +380 bool equals (const RealIterator& it) const │ │ │ │ │ +381 { │ │ │ │ │ +382 assert(p==it.p); │ │ │ │ │ +383 return (i)==(it.i); │ │ │ │ │ +384 } │ │ │ │ │ +385 │ │ │ │ │ +387 bool equals (const RealIterator& it) const │ │ │ │ │ +388 { │ │ │ │ │ +389 assert(p==it.p); │ │ │ │ │ +390 return (i)==(it.i); │ │ │ │ │ +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) │ │ │ │ │ +395 size_type index () const │ │ │ │ │ 396 { │ │ │ │ │ -397 return flags_[v]; │ │ │ │ │ +397 return j[i]; │ │ │ │ │ 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() │ │ │ │ │ +401 void setindex (size_type k) │ │ │ │ │ +402 { │ │ │ │ │ +403 return j[i] = k; │ │ │ │ │ +404 } │ │ │ │ │ +405 │ │ │ │ │ +413 size_type offset () const │ │ │ │ │ +414 { │ │ │ │ │ +415 return i; │ │ │ │ │ +416 } │ │ │ │ │ +417 │ │ │ │ │ +418 private: │ │ │ │ │ +420 void increment() │ │ │ │ │ 421 { │ │ │ │ │ -422 flags_.set(_V_I_S_I_T_E_D); │ │ │ │ │ +422 ++i; │ │ │ │ │ 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 } │ │ │ │ │ +426 void decrement() │ │ │ │ │ +427 { │ │ │ │ │ +428 --i; │ │ │ │ │ +429 } │ │ │ │ │ +430 │ │ │ │ │ +432 reference dereference () const │ │ │ │ │ +433 { │ │ │ │ │ +434 return p[i]; │ │ │ │ │ +435 } │ │ │ │ │ +436 │ │ │ │ │ +437 B* p; │ │ │ │ │ +438 size_type* j; │ │ │ │ │ +439 size_type i; │ │ │ │ │ +440 }; │ │ │ │ │ +441 │ │ │ │ │ +443 typedef RealIterator iterator; │ │ │ │ │ 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 wether 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 wether 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 wether 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 wether 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 wether the node is marked as visited. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:425 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -Reference operator[](const Vertex &vertex) const │ │ │ │ │ -Get the properties associated to a vertex. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t │ │ │ │ │ -void reset() │ │ │ │ │ -Reset all flags. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:320 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_D_e_p_e_n_d_s │ │ │ │ │ -void resetDepends() │ │ │ │ │ -Resets the depends flag. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:345 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -ReadWritePropertyMapTag Category │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:223 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_I_s_o_l_a_t_e_d │ │ │ │ │ -void resetIsolated() │ │ │ │ │ -Resets the isolated flag. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:415 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > │ │ │ │ │ -&criterion) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:113 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_s_S_t_r_o_n_g │ │ │ │ │ -bool isStrong() const │ │ │ │ │ -Checks wether 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 wether 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 wether the edge is one way. I.e. either the influence or the depends │ │ │ │ │ -flag but is set. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:364 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_i_n_d_e_x │ │ │ │ │ -@ index │ │ │ │ │ -the index to access in the bitset. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:227 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_I_S_I_T_E_D │ │ │ │ │ -@ VISITED │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_I_S_O_L_A_T_E_D │ │ │ │ │ -@ ISOLATED │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_S_I_Z_E │ │ │ │ │ -@ SIZE │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_B_O_R_D_E_R │ │ │ │ │ -@ BORDER │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_F_R_O_N_T │ │ │ │ │ -@ FRONT │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_D_E_P_E_N_D │ │ │ │ │ -@ DEPEND │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_S_I_Z_E │ │ │ │ │ -@ SIZE │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_I_N_F_L_U_E_N_C_E │ │ │ │ │ -@ INFLUENCE │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ │ +446 iterator begin () │ │ │ │ │ +447 { │ │ │ │ │ +448 return iterator(p,j,0); │ │ │ │ │ +449 } │ │ │ │ │ +450 │ │ │ │ │ +452 iterator end () │ │ │ │ │ +453 { │ │ │ │ │ +454 return iterator(p,j,n); │ │ │ │ │ +455 } │ │ │ │ │ +456 │ │ │ │ │ +459 iterator beforeEnd () │ │ │ │ │ +460 { │ │ │ │ │ +461 return iterator(p,j,n-1); │ │ │ │ │ +462 } │ │ │ │ │ +463 │ │ │ │ │ +466 iterator beforeBegin () │ │ │ │ │ +467 { │ │ │ │ │ +468 return iterator(p,j,-1); │ │ │ │ │ +469 } │ │ │ │ │ +470 │ │ │ │ │ +472 iterator find (size_type i) │ │ │ │ │ +473 { │ │ │ │ │ +474 const size_type* lb = std::lower_bound(j, j+n, i); │ │ │ │ │ +475 return (lb != j+n && *lb == i) │ │ │ │ │ +476 ? iterator(p,j,lb-j) │ │ │ │ │ +477 : end(); │ │ │ │ │ +478 } │ │ │ │ │ +479 │ │ │ │ │ +481 typedef RealIterator const_iterator; │ │ │ │ │ +482 │ │ │ │ │ +484 const_iterator begin () const │ │ │ │ │ +485 { │ │ │ │ │ +486 return const_iterator(p,j,0); │ │ │ │ │ +487 } │ │ │ │ │ +488 │ │ │ │ │ +490 const_iterator end () const │ │ │ │ │ +491 { │ │ │ │ │ +492 return const_iterator(p,j,n); │ │ │ │ │ +493 } │ │ │ │ │ +494 │ │ │ │ │ +497 const_iterator beforeEnd () const │ │ │ │ │ +498 { │ │ │ │ │ +499 return const_iterator(p,j,n-1); │ │ │ │ │ +500 } │ │ │ │ │ +501 │ │ │ │ │ +504 const_iterator beforeBegin () const │ │ │ │ │ +505 { │ │ │ │ │ +506 return const_iterator(p,j,-1); │ │ │ │ │ +507 } │ │ │ │ │ +508 │ │ │ │ │ +510 const_iterator find (size_type i) const │ │ │ │ │ +511 { │ │ │ │ │ +512 const size_type* lb = std::lower_bound(j, j+n, i); │ │ │ │ │ +513 return (lb != j+n && *lb == i) │ │ │ │ │ +514 ? const_iterator(p,j,lb-j) │ │ │ │ │ +515 : end(); │ │ │ │ │ +516 } │ │ │ │ │ +517 │ │ │ │ │ +518 //===== sizes │ │ │ │ │ +519 │ │ │ │ │ +521 size_type size () const │ │ │ │ │ +522 { │ │ │ │ │ +523 return n; │ │ │ │ │ +524 } │ │ │ │ │ +525 │ │ │ │ │ +526 protected: │ │ │ │ │ +528 compressed_base_array_unmanaged () │ │ │ │ │ +529 : n(0), p(0), j(0) │ │ │ │ │ +530 {} │ │ │ │ │ +531 │ │ │ │ │ +532 size_type n; // number of elements in array │ │ │ │ │ +533 B *p; // pointer to dynamically allocated built-in array │ │ │ │ │ +534 size_type* j; // the index set │ │ │ │ │ +535 }; │ │ │ │ │ +536 │ │ │ │ │ +537} // end namespace Imp │ │ │ │ │ +538 │ │ │ │ │ +539} // end namespace │ │ │ │ │ +540 │ │ │ │ │ +541#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_:_:_g_e_t │ │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ -Class representing the properties of an ede in the matrix graph. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ -Class representing a node in the matrix graph. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:220 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ -Attaches properties to the edges and vertices of a graph. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:978 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ -Tag idnetifying the visited property of a vertex. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:29 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: construction.hh File Reference │ │ │ │ +dune-istl: repartition.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,68 +65,107 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +Namespaces | │ │ │ │ +Typedefs | │ │ │ │ +Functions
│ │ │ │ +
repartition.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <dune/istl/bvector.hh>
│ │ │ │ -#include <dune/istl/operators.hh>
│ │ │ │ -#include <dune/istl/owneroverlapcopy.hh>
│ │ │ │ -#include <dune/istl/solvercategory.hh>
│ │ │ │ -#include "pinfo.hh"
│ │ │ │ +
#include <cassert>
│ │ │ │ +#include <map>
│ │ │ │ +#include <utility>
│ │ │ │ +#include <cmath>
│ │ │ │ +#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>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

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 > >
struct  Dune::RedistributeInterface
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Typedefs

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

│ │ │ │ +Functions

template<class G , class T1 , class T2 >
void Dune::fillIndexSetHoles (const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
 Fills the holes in an index set.
 
template<class G , class T1 , class T2 >
bool Dune::buildCommunication (const G &graph, std::vector< int > &realparts, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 
template<class S , class T >
void Dune::print_carray (S &os, T *array, std::size_t l)
 
template<class S , class T >
bool Dune::isValidGraph (std::size_t noVtx, std::size_t gnoVtx, S noEdges, T *xadj, T *adjncy, bool checkSymmetry)
 
template<class M , class T1 , class T2 >
bool Dune::commGraphRepartition (const M &mat, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 
template<class G , class T1 , class T2 >
bool Dune::graphRepartition (const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 execute a graph repartition for a giving graph and indexset.
 
│ │ │ │

Detailed Description

│ │ │ │ -

Helper classes for the construction of classes without empty constructor.

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

Functionality for redistributing a parallel index set using graph partitioning.

│ │ │ │ +

Refactored version of an intern.

Author
Markus Blatt
│ │ │ │ +

Variable Documentation

│ │ │ │ + │ │ │ │ +

◆ globalOwnerVertices

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
int globalOwnerVertices
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,54 +1,81 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -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. │ │ │ │ │ +_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 <_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 │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#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_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ │ -#include "_p_i_n_f_o_._h_h" │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._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_:_:_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_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ │   │ │ │ │ │ -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_ _>_ _> │ │ │ │ │ +NNaammeessppaacceess │ │ │ │ │ +namespace   _D_u_n_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_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ │ +namespace   _D_u_n_e_:_:_M_e_t_i_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_w_n_e_r_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_ _> │ │ │ │ │ - _> │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ +using  _D_u_n_e_:_:_M_e_t_i_s_:_:_r_e_a_l___t = float │ │ │ │ │   │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ +using  _D_u_n_e_:_:_M_e_t_i_s_:_:_i_d_x___t = std::size_t │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s (const G &graph, _D_u_n_e_:_: │ │ │ │ │ + _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm) │ │ │ │ │ +  Fills the holes in an index set. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n (const G &graph, std::vector< int > &realparts, │ │ │ │ │ + _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, std::shared_ptr< │ │ │ │ │ + _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > &outcomm, │ │ │ │ │ + _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_p_r_i_n_t___c_a_r_r_a_y (S &os, T *array, std::size_t l) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_i_s_V_a_l_i_d_G_r_a_p_h (std::size_t noVtx, std::size_t gnoVtx, S noEdges, T │ │ │ │ │ + *xadj, T *adjncy, bool checkSymmetry) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n (const M &_m_a_t, _D_u_n_e_:_: │ │ │ │ │ + _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ │ + std::shared_ptr< _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > │ │ │ │ │ + &outcomm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +bool  _D_u_n_e_:_:_g_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n (const G &graph, _D_u_n_e_:_: │ │ │ │ │ + _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ │ + std::shared_ptr< _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > │ │ │ │ │ + &outcomm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ │ +  execute a graph repartition for a giving graph and indexset. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Helper classes for the construction of classes without empty constructor. │ │ │ │ │ +Functionality for redistributing a parallel index set using graph partitioning. │ │ │ │ │ +Refactored version of an intern. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ +********** VVaarriiaabbllee DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? gglloobbaallOOwwnneerrVVeerrttiicceess ********** │ │ │ │ │ +int globalOwnerVertices │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: construction.hh Source File │ │ │ │ +dune-istl: repartition.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,260 +70,1855 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
construction.hh
│ │ │ │ +
repartition.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AMGCONSTRUCTION_HH
│ │ │ │ -
6#define DUNE_AMGCONSTRUCTION_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_REPARTITION_HH
│ │ │ │ +
6#define DUNE_ISTL_REPARTITION_HH
│ │ │ │
7
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
12#include "pinfo.hh"
│ │ │ │ -
13
│ │ │ │ -
14namespace Dune
│ │ │ │ -
15{
│ │ │ │ -
16 namespace Amg
│ │ │ │ -
17 {
│ │ │ │ -
18
│ │ │ │ -
37 template<typename T>
│ │ │ │ -
38 struct ConstructionTraits
│ │ │ │ -
39 {
│ │ │ │ -
44 typedef const void* Arguments;
│ │ │ │ -
45
│ │ │ │ -
│ │ │ │ -
52 static inline std::shared_ptr<T> construct(Arguments& args)
│ │ │ │ -
53 {
│ │ │ │ -
54 return std::make_shared<T>();
│ │ │ │ -
55 }
│ │ │ │ -
│ │ │ │ -
56 };
│ │ │ │ -
57
│ │ │ │ -
58 template<class T, class A>
│ │ │ │ -
│ │ │ │ -
59 struct ConstructionTraits<BlockVector<T,A> >
│ │ │ │ -
60 {
│ │ │ │ -
61 typedef const int Arguments;
│ │ │ │ -
│ │ │ │ -
62 static inline std::shared_ptr<BlockVector<T,A>> construct(Arguments& n)
│ │ │ │ -
63 {
│ │ │ │ -
64 return std::make_shared<BlockVector<T,A>>(n);
│ │ │ │ -
65 }
│ │ │ │ -
│ │ │ │ -
66 };
│ │ │ │ +
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". Therfore no nested extern "C" will be created
│ │ │ │ +
17extern "C"
│ │ │ │ +
18{
│ │ │ │ +
19#include <parmetis.h>
│ │ │ │ +
20}
│ │ │ │ +
21#endif
│ │ │ │ +
22
│ │ │ │ +
23#include <dune/common/timer.hh>
│ │ │ │ +
24#include <dune/common/enumset.hh>
│ │ │ │ +
25#include <dune/common/stdstreams.hh>
│ │ │ │ +
26#include <dune/common/parallel/mpitraits.hh>
│ │ │ │ +
27#include <dune/common/parallel/communicator.hh>
│ │ │ │ +
28#include <dune/common/parallel/indexset.hh>
│ │ │ │ +
29#include <dune/common/parallel/indicessyncer.hh>
│ │ │ │ +
30#include <dune/common/parallel/remoteindices.hh>
│ │ │ │ +
31#include <dune/common/rangeutilities.hh>
│ │ │ │ +
32
│ │ │ │ + │ │ │ │ + │ │ │ │ +
35
│ │ │ │ +
44namespace Dune
│ │ │ │ +
45{
│ │ │ │ +
│ │ │ │ +
46 namespace Metis
│ │ │ │ +
47 {
│ │ │ │ +
48 // Explicitly specify a real_t and idx_t for older (Par)METIS versions that do not
│ │ │ │ +
49 // provide these typedefs
│ │ │ │ +
50#if HAVE_PARMETIS && defined(REALTYPEWIDTH)
│ │ │ │ +
51 using real_t = ::real_t;
│ │ │ │ +
52#else
│ │ │ │ +
53 using real_t = float;
│ │ │ │ +
54#endif
│ │ │ │ +
55
│ │ │ │ +
56#if HAVE_PARMETIS && defined(IDXTYPEWIDTH)
│ │ │ │ +
57 using idx_t = ::idx_t;
│ │ │ │ +
58#elif HAVE_PARMETIS && defined(HAVE_SCOTCH_NUM_TYPE)
│ │ │ │ +
59 using idx_t = SCOTCH_Num;
│ │ │ │ +
60#elif HAVE_PARMETIS
│ │ │ │ +
61 using idx_t = int;
│ │ │ │ +
62#else
│ │ │ │ +
63 using idx_t = std::size_t;
│ │ │ │ +
64#endif
│ │ │ │ +
65 }
│ │ │ │
│ │ │ │ +
66
│ │ │ │
67
│ │ │ │ -
68 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
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
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
│ │ │ │ +
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 // forward declaration
│ │ │ │ -
103 template<class M, class X, class Y, class C>
│ │ │ │ - │ │ │ │ -
105
│ │ │ │ -
106 template<class M, class X, class Y, class C>
│ │ │ │ - │ │ │ │ -
108
│ │ │ │ -
109 namespace Amg
│ │ │ │ -
110 {
│ │ │ │ -
111 template<class M, class X, class Y, class C>
│ │ │ │ -
│ │ │ │ -
112 struct ConstructionTraits<OverlappingSchwarzOperator<M,X,Y,C> >
│ │ │ │ -
113 {
│ │ │ │ - │ │ │ │ -
115
│ │ │ │ -
│ │ │ │ -
116 static inline std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
│ │ │ │ -
117 {
│ │ │ │ -
118 return std::make_shared<OverlappingSchwarzOperator<M,X,Y,C>>
│ │ │ │ -
119 (args.matrix_, args.comm_);
│ │ │ │ -
120 }
│ │ │ │ -
│ │ │ │ -
121 };
│ │ │ │ -
│ │ │ │ -
122
│ │ │ │ -
123 template<class M, class X, class Y, class C>
│ │ │ │ -
│ │ │ │ -
124 struct ConstructionTraits<NonoverlappingSchwarzOperator<M,X,Y,C> >
│ │ │ │ -
125 {
│ │ │ │ - │ │ │ │ -
127
│ │ │ │ -
│ │ │ │ -
128 static inline std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
│ │ │ │ -
129 {
│ │ │ │ -
130 return std::make_shared<NonoverlappingSchwarzOperator<M,X,Y,C>>
│ │ │ │ -
131 (args.matrix_, args.comm_);
│ │ │ │ -
132 }
│ │ │ │ -
│ │ │ │ -
133 };
│ │ │ │ -
│ │ │ │ +
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; //Sart with the next free index.
│ │ │ │ +
113
│ │ │ │ +
114 for(int i=0; i<oocomm.communicator().rank(); ++i)
│ │ │ │ +
115 maxgi=maxgi+neededall[i]; // TODO: make this more generic
│ │ │ │ +
116
│ │ │ │ +
117 // Store the global index information for repairing the remote index information
│ │ │ │ +
118 std::map<int,SLList<std::pair<T1,Attribute> > > globalIndices;
│ │ │ │ +
119 storeGlobalIndicesOfRemoteIndices(globalIndices, oocomm.remoteIndices());
│ │ │ │ +
120 indexSet.beginResize();
│ │ │ │ +
121
│ │ │ │ +
122 for(auto vertex = graph.begin(), vend=graph.end(); vertex != vend; ++vertex) {
│ │ │ │ +
123 const typename IndexSet::IndexPair* pair=lookup.pair(*vertex);
│ │ │ │ +
124 if(pair==0) {
│ │ │ │ +
125 // No index yet, add new one
│ │ │ │ +
126 indexSet.add(maxgi, typename IndexSet::LocalIndex(*vertex, OwnerOverlapCopyAttributeSet::owner, false));
│ │ │ │ +
127 ++maxgi;
│ │ │ │ +
128 }
│ │ │ │ +
129 }
│ │ │ │ +
130
│ │ │ │ +
131 indexSet.endResize();
│ │ │ │ +
132
│ │ │ │ +
133 repairLocalIndexPointers(globalIndices, oocomm.remoteIndices(), indexSet);
│ │ │ │
134
│ │ │ │ -
135 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
137 {
│ │ │ │ -
│ │ │ │ -
138 MatrixAdapterArgs(std::shared_ptr<M> matrix, const SequentialInformation)
│ │ │ │ -
139 : matrix_(matrix)
│ │ │ │ -
140 {}
│ │ │ │ -
│ │ │ │ -
141
│ │ │ │ -
142 std::shared_ptr<M> matrix_;
│ │ │ │ -
143 };
│ │ │ │ -
│ │ │ │ -
144
│ │ │ │ -
145 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
146 struct ConstructionTraits<MatrixAdapter<M,X,Y> >
│ │ │ │ +
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 {
│ │ │ │ - │ │ │ │ -
149
│ │ │ │ -
│ │ │ │ -
150 static inline std::shared_ptr<MatrixAdapter<M,X,Y>> construct(Arguments& args)
│ │ │ │ -
151 {
│ │ │ │ -
152 return std::make_shared<MatrixAdapter<M,X,Y>>(args.matrix_);
│ │ │ │ -
153 }
│ │ │ │ -
│ │ │ │ -
154 };
│ │ │ │ -
│ │ │ │ -
155
│ │ │ │ -
156 template<>
│ │ │ │ -
│ │ │ │ -
157 struct ConstructionTraits<SequentialInformation>
│ │ │ │ -
158 {
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
160 static inline std::shared_ptr<SequentialInformation> construct(Arguments& args)
│ │ │ │ -
161 {
│ │ │ │ -
162 return std::make_shared<SequentialInformation>(args.comm_);
│ │ │ │ -
163 }
│ │ │ │ -
│ │ │ │ -
164 };
│ │ │ │ -
│ │ │ │ -
165
│ │ │ │ -
166
│ │ │ │ -
167#if HAVE_MPI
│ │ │ │ -
168
│ │ │ │ -
169 template<class T1, class T2>
│ │ │ │ -
│ │ │ │ -
170 struct ConstructionTraits<OwnerOverlapCopyCommunication<T1,T2> >
│ │ │ │ -
171 {
│ │ │ │ - │ │ │ │ -
173
│ │ │ │ -
│ │ │ │ -
174 static inline std::shared_ptr<OwnerOverlapCopyCommunication<T1,T2>> construct(Arguments& args)
│ │ │ │ -
175 {
│ │ │ │ -
176 return std::make_shared<OwnerOverlapCopyCommunication<T1,T2>>(args.comm_, args.cat_);
│ │ │ │ -
177 }
│ │ │ │ -
│ │ │ │ -
178 };
│ │ │ │ -
│ │ │ │ -
179
│ │ │ │ -
180#endif
│ │ │ │ -
181
│ │ │ │ -
183 } // namespace Amg
│ │ │ │ -
184} // namespace Dune
│ │ │ │ -
185#endif
│ │ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ - │ │ │ │ - │ │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ -
const int Arguments
Definition construction.hh:61
│ │ │ │ -
SequentialCommunicationArgs(Communication< void * > comm, int cat)
Definition construction.hh:93
│ │ │ │ -
OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat)
Definition construction.hh:82
│ │ │ │ -
MPI_Comm comm_
Definition construction.hh:86
│ │ │ │ -
SolverCategory::Category cat_
Definition construction.hh:87
│ │ │ │ -
const C & comm_
Definition construction.hh:76
│ │ │ │ -
ParallelOperatorArgs(std::shared_ptr< M > matrix, const C &comm)
Definition construction.hh:71
│ │ │ │ -
std::shared_ptr< M > matrix_
Definition construction.hh:75
│ │ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ -
Communication< void * > comm_
Definition construction.hh:97
│ │ │ │ -
static std::shared_ptr< BlockVector< T, A > > construct(Arguments &n)
Definition construction.hh:62
│ │ │ │ +
148 public:
│ │ │ │ +
149 template<class Graph, class OOComm>
│ │ │ │ +
150 ParmetisDuneIndexMap(const Graph& graph, const OOComm& com);
│ │ │ │ +
151 int toParmetis(int i) const
│ │ │ │ +
152 {
│ │ │ │ +
153 return duneToParmetis[i];
│ │ │ │ +
154 }
│ │ │ │ +
155 int toLocalParmetis(int i) const
│ │ │ │ +
156 {
│ │ │ │ +
157 return duneToParmetis[i]-base_;
│ │ │ │ +
158 }
│ │ │ │ +
159 int operator[](int i) const
│ │ │ │ +
160 {
│ │ │ │ +
161 return duneToParmetis[i];
│ │ │ │ +
162 }
│ │ │ │ +
163 int toDune(int i) const
│ │ │ │ +
164 {
│ │ │ │ +
165 return parmetisToDune[i];
│ │ │ │ +
166 }
│ │ │ │ +
167 std::vector<int>::size_type numOfOwnVtx() const
│ │ │ │ +
168 {
│ │ │ │ +
169 return parmetisToDune.size();
│ │ │ │ +
170 }
│ │ │ │ +
171 Metis::idx_t* vtxDist()
│ │ │ │ +
172 {
│ │ │ │ +
173 return &vtxDist_[0];
│ │ │ │ +
174 }
│ │ │ │ + │ │ │ │ +
176 private:
│ │ │ │ +
177 int base_;
│ │ │ │ +
178 std::vector<int> duneToParmetis;
│ │ │ │ +
179 std::vector<int> parmetisToDune;
│ │ │ │ +
180 // range of vertices for processor i: vtxdist[i] to vtxdist[i+1] (parmetis global)
│ │ │ │ +
181 std::vector<Metis::idx_t> vtxDist_;
│ │ │ │ +
182 };
│ │ │ │ +
183
│ │ │ │ +
184 template<class G, class OOComm>
│ │ │ │ +
185 ParmetisDuneIndexMap::ParmetisDuneIndexMap(const G& graph, const OOComm& oocomm)
│ │ │ │ +
186 : duneToParmetis(graph.noVertices(), -1), vtxDist_(oocomm.communicator().size()+1)
│ │ │ │ +
187 {
│ │ │ │ +
188 int npes=oocomm.communicator().size(), mype=oocomm.communicator().rank();
│ │ │ │ +
189
│ │ │ │ +
190 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ │ +
191
│ │ │ │ +
192 int numOfOwnVtx=0;
│ │ │ │ +
193 auto end = oocomm.indexSet().end();
│ │ │ │ +
194 for(auto index = oocomm.indexSet().begin(); index != end; ++index) {
│ │ │ │ +
195 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ │ +
196 numOfOwnVtx++;
│ │ │ │ +
197 }
│ │ │ │ +
198 }
│ │ │ │ +
199 parmetisToDune.resize(numOfOwnVtx);
│ │ │ │ +
200 std::vector<int> globalNumOfVtx(npes);
│ │ │ │ +
201 // make this number available to all processes
│ │ │ │ +
202 MPI_Allgather(&numOfOwnVtx, 1, MPI_INT, &(globalNumOfVtx[0]), 1, MPI_INT, oocomm.communicator());
│ │ │ │ +
203
│ │ │ │ +
204 int base=0;
│ │ │ │ +
205 vtxDist_[0] = 0;
│ │ │ │ +
206 for(int i=0; i<npes; i++) {
│ │ │ │ +
207 if (i<mype) {
│ │ │ │ +
208 base += globalNumOfVtx[i];
│ │ │ │ +
209 }
│ │ │ │ +
210 vtxDist_[i+1] = vtxDist_[i] + globalNumOfVtx[i];
│ │ │ │ +
211 }
│ │ │ │ +
212 globalOwnerVertices=vtxDist_[npes];
│ │ │ │ +
213 base_=base;
│ │ │ │ +
214
│ │ │ │ +
215#ifdef DEBUG_REPART
│ │ │ │ +
216 std::cout << oocomm.communicator().rank()<<" vtxDist: ";
│ │ │ │ +
217 for(int i=0; i<= npes; ++i)
│ │ │ │ +
218 std::cout << vtxDist_[i]<<" ";
│ │ │ │ +
219 std::cout<<std::endl;
│ │ │ │ +
220#endif
│ │ │ │ +
221
│ │ │ │ +
222 // Traverse the graph and assign a new consecutive number/index
│ │ │ │ +
223 // starting by "base" to all owner vertices.
│ │ │ │ +
224 // The new index is used as the ParMETIS global index and is
│ │ │ │ +
225 // stored in the vector "duneToParmetis"
│ │ │ │ +
226 auto vend = graph.end();
│ │ │ │ +
227 for(auto vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ │ +
228 const typename OOComm::ParallelIndexSet::IndexPair* index=oocomm.globalLookup().pair(*vertex);
│ │ │ │ +
229 assert(index);
│ │ │ │ +
230 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ │ +
231 // assign and count the index
│ │ │ │ +
232 parmetisToDune[base-base_]=index->local();
│ │ │ │ +
233 duneToParmetis[index->local()] = base++;
│ │ │ │ +
234 }
│ │ │ │ +
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 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
302 {}
│ │ │ │ +
│ │ │ │ +
303
│ │ │ │ +
304 };
│ │ │ │ +
│ │ │ │ +
305
│ │ │ │ +
306 namespace
│ │ │ │ +
307 {
│ │ │ │ +
317 template<class GI>
│ │ │ │ +
318 void createSendBuf(std::vector<GI>& ownerVec, std::set<GI>& overlapVec, std::set<int>& neighbors, char *sendBuf, int buffersize, MPI_Comm comm) {
│ │ │ │ +
319 // Pack owner vertices
│ │ │ │ +
320 std::size_t s=ownerVec.size();
│ │ │ │ +
321 int pos=0;
│ │ │ │ +
322 if(s==0)
│ │ │ │ +
323 ownerVec.resize(1); // otherwise would read beyond the memory bound
│ │ │ │ +
324 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ +
325 MPI_Pack(&(ownerVec[0]), s, MPITraits<GI>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ +
326 s = overlapVec.size();
│ │ │ │ +
327 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ +
328 for(auto i=overlapVec.begin(), end= overlapVec.end(); i != end; ++i)
│ │ │ │ +
329 MPI_Pack(const_cast<GI*>(&(*i)), 1, MPITraits<GI>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ +
330
│ │ │ │ +
331 s=neighbors.size();
│ │ │ │ +
332 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ │ +
333
│ │ │ │ +
334 for(auto i=neighbors.begin(), end= neighbors.end(); i != end; ++i)
│ │ │ │ +
335 MPI_Pack(const_cast<int*>(&(*i)), 1, MPI_INT, sendBuf, buffersize, &pos, comm);
│ │ │ │ +
336 }
│ │ │ │ +
345 template<class GI>
│ │ │ │ +
346 void saveRecvBuf(char *recvBuf, int bufferSize, std::vector<std::pair<GI,int> >& ownerVec,
│ │ │ │ +
347 std::set<GI>& overlapVec, std::set<int>& neighbors, RedistributeInterface& inf, int from, MPI_Comm comm) {
│ │ │ │ +
348 std::size_t size;
│ │ │ │ +
349 int pos=0;
│ │ │ │ +
350 // unpack owner vertices
│ │ │ │ +
351 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ │ +
352 inf.reserveSpaceForReceiveInterface(from, size);
│ │ │ │ +
353 ownerVec.reserve(ownerVec.size()+size);
│ │ │ │ +
354 for(; size!=0; --size) {
│ │ │ │ +
355 GI gi;
│ │ │ │ +
356 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits<GI>::getType(), comm);
│ │ │ │ +
357 ownerVec.push_back(std::make_pair(gi,from));
│ │ │ │ +
358 }
│ │ │ │ +
359 // unpack overlap vertices
│ │ │ │ +
360 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ │ +
361 typename std::set<GI>::iterator ipos = overlapVec.begin();
│ │ │ │ +
362 Dune::dverb << "unpacking "<<size<<" overlap"<<std::endl;
│ │ │ │ +
363 for(; size!=0; --size) {
│ │ │ │ +
364 GI gi;
│ │ │ │ +
365 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits<GI>::getType(), comm);
│ │ │ │ +
366 ipos=overlapVec.insert(ipos, gi);
│ │ │ │ +
367 }
│ │ │ │ +
368 //unpack neighbors
│ │ │ │ +
369 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ │ +
370 Dune::dverb << "unpacking "<<size<<" neighbors"<<std::endl;
│ │ │ │ +
371 typename std::set<int>::iterator npos = neighbors.begin();
│ │ │ │ +
372 for(; size!=0; --size) {
│ │ │ │ +
373 int n;
│ │ │ │ +
374 MPI_Unpack(recvBuf, bufferSize, &pos, &n, 1, MPI_INT, comm);
│ │ │ │ +
375 npos=neighbors.insert(npos, n);
│ │ │ │ +
376 }
│ │ │ │ +
377 }
│ │ │ │ +
378
│ │ │ │ +
392 template<typename T>
│ │ │ │ +
393 void getDomain(const MPI_Comm& comm, T *part, int numOfOwnVtx, int nparts, int *myDomain, std::vector<int> &domainMapping) {
│ │ │ │ +
394 int npes, mype;
│ │ │ │ +
395 MPI_Comm_size(comm, &npes);
│ │ │ │ +
396 MPI_Comm_rank(comm, &mype);
│ │ │ │ +
397 MPI_Status status;
│ │ │ │ +
398
│ │ │ │ +
399 *myDomain = -1;
│ │ │ │ +
400 int i=0;
│ │ │ │ +
401 int j=0;
│ │ │ │ +
402
│ │ │ │ +
403 std::vector<int> domain(nparts, 0);
│ │ │ │ +
404 std::vector<int> assigned(npes, 0);
│ │ │ │ +
405 // init domain Mapping
│ │ │ │ +
406 domainMapping.assign(domainMapping.size(), -1);
│ │ │ │ +
407
│ │ │ │ +
408 // count the occurrence of domains
│ │ │ │ +
409 for (i=0; i<numOfOwnVtx; i++) {
│ │ │ │ +
410 domain[part[i]]++;
│ │ │ │ +
411 }
│ │ │ │ +
412
│ │ │ │ +
413 std::vector<int> domainMatrix(npes * nparts, -1);
│ │ │ │ +
414
│ │ │ │ +
415 // init buffer with the own domain
│ │ │ │ +
416 int *buf = new int[nparts];
│ │ │ │ +
417 for (i=0; i<nparts; i++) {
│ │ │ │ +
418 buf[i] = domain[i];
│ │ │ │ +
419 domainMatrix[mype*nparts+i] = domain[i];
│ │ │ │ +
420 }
│ │ │ │ +
421 int pe=0;
│ │ │ │ +
422 int src = (mype-1+npes)%npes;
│ │ │ │ +
423 int dest = (mype+1)%npes;
│ │ │ │ +
424 // ring communication, we need n-1 communications for n processors
│ │ │ │ +
425 for (i=0; i<npes-1; i++) {
│ │ │ │ +
426 MPI_Sendrecv_replace(buf, nparts, MPI_INT, dest, 0, src, 0, comm, &status);
│ │ │ │ +
427 // pe is the process of the actual received buffer
│ │ │ │ +
428 pe = ((mype-1-i)+npes)%npes;
│ │ │ │ +
429 for(j=0; j<nparts; j++) {
│ │ │ │ +
430 // save the values to the domain matrix
│ │ │ │ +
431 domainMatrix[pe*nparts+j] = buf[j];
│ │ │ │ +
432 }
│ │ │ │ +
433 }
│ │ │ │ +
434 delete[] buf;
│ │ │ │ +
435
│ │ │ │ +
436 // Start the domain calculation.
│ │ │ │ +
437 // The process which contains the maximum number of vertices of a
│ │ │ │ +
438 // particular domain is selected to choose it's favorate domain
│ │ │ │ +
439 int maxOccurance = 0;
│ │ │ │ +
440 pe = -1;
│ │ │ │ +
441 std::set<std::size_t> unassigned;
│ │ │ │ +
442
│ │ │ │ +
443 for(i=0; i<nparts; i++) {
│ │ │ │ +
444 for(j=0; j<npes; j++) {
│ │ │ │ +
445 // process has no domain assigned
│ │ │ │ +
446 if (assigned[j]==0) {
│ │ │ │ +
447 if (maxOccurance < domainMatrix[j*nparts+i]) {
│ │ │ │ +
448 maxOccurance = domainMatrix[j*nparts+i];
│ │ │ │ +
449 pe = j;
│ │ │ │ +
450 }
│ │ │ │ +
451 }
│ │ │ │ +
452
│ │ │ │ +
453 }
│ │ │ │ +
454 if (pe!=-1) {
│ │ │ │ +
455 // process got a domain, ...
│ │ │ │ +
456 domainMapping[i] = pe;
│ │ │ │ +
457 // ...mark as assigned
│ │ │ │ +
458 assigned[pe] = 1;
│ │ │ │ +
459 if (pe==mype) {
│ │ │ │ +
460 *myDomain = i;
│ │ │ │ +
461 }
│ │ │ │ +
462 pe = -1;
│ │ │ │ +
463 }
│ │ │ │ +
464 else
│ │ │ │ +
465 {
│ │ │ │ +
466 unassigned.insert(i);
│ │ │ │ +
467 }
│ │ │ │ +
468 maxOccurance = 0;
│ │ │ │ +
469 }
│ │ │ │ +
470
│ │ │ │ +
471 typename std::vector<int>::iterator next_free = assigned.begin();
│ │ │ │ +
472
│ │ │ │ +
473 for(auto udomain = unassigned.begin(),
│ │ │ │ +
474 end = unassigned.end(); udomain != end; ++udomain)
│ │ │ │ +
475 {
│ │ │ │ +
476 next_free = std::find_if(next_free, assigned.end(), std::bind(std::less<int>(), std::placeholders::_1, 1));
│ │ │ │ +
477 assert(next_free != assigned.end());
│ │ │ │ +
478 domainMapping[*udomain] = next_free-assigned.begin();
│ │ │ │ +
479 *next_free = 1;
│ │ │ │ +
480 }
│ │ │ │ +
481 }
│ │ │ │ +
482
│ │ │ │ +
483 struct SortFirst
│ │ │ │ +
484 {
│ │ │ │ +
485 template<class T>
│ │ │ │ +
486 bool operator()(const T& t1, const T& t2) const
│ │ │ │ +
487 {
│ │ │ │ +
488 return t1<t2;
│ │ │ │ +
489 }
│ │ │ │ +
490 };
│ │ │ │ +
491
│ │ │ │ +
492
│ │ │ │ +
503 template<class GI>
│ │ │ │ +
504 void mergeVec(std::vector<std::pair<GI, int> >& ownerVec, std::set<GI>& overlapSet) {
│ │ │ │ +
505
│ │ │ │ +
506#ifdef DEBUG_REPART
│ │ │ │ +
507 // Safety check for duplicates.
│ │ │ │ +
508 if(ownerVec.size()>0)
│ │ │ │ +
509 {
│ │ │ │ +
510 auto old=ownerVec.begin();
│ │ │ │ +
511 for(auto i=old+1, end=ownerVec.end(); i != end; old=i++)
│ │ │ │ +
512 {
│ │ │ │ +
513 if(i->first==old->first)
│ │ │ │ +
514 {
│ │ │ │ +
515 std::cerr<<"Value at indes"<<old-ownerVec.begin()<<" is the same as at index "
│ │ │ │ +
516 <<i-ownerVec.begin()<<" ["<<old->first<<","<<old->second<<"]==["
│ │ │ │ +
517 <<i->first<<","<<i->second<<"]"<<std::endl;
│ │ │ │ +
518 throw "Huch!";
│ │ │ │ +
519 }
│ │ │ │ +
520 }
│ │ │ │ +
521 }
│ │ │ │ +
522
│ │ │ │ +
523#endif
│ │ │ │ +
524
│ │ │ │ +
525 auto v=ownerVec.begin(), vend=ownerVec.end();
│ │ │ │ +
526 for(auto s=overlapSet.begin(), send=overlapSet.end(); s!=send;)
│ │ │ │ +
527 {
│ │ │ │ +
528 while(v!=vend && v->first<*s) ++v;
│ │ │ │ +
529 if(v!=vend && v->first==*s) {
│ │ │ │ +
530 // Move to the next element before erasing
│ │ │ │ +
531 // thus s stays valid!
│ │ │ │ +
532 auto tmp=s;
│ │ │ │ +
533 ++s;
│ │ │ │ +
534 overlapSet.erase(tmp);
│ │ │ │ +
535 }else
│ │ │ │ +
536 ++s;
│ │ │ │ +
537 }
│ │ │ │ +
538 }
│ │ │ │ +
539
│ │ │ │ +
540
│ │ │ │ +
554 template<class OwnerSet, class Graph, class IS, class GI>
│ │ │ │ +
555 void getNeighbor(const Graph& g, std::vector<int>& part,
│ │ │ │ +
556 typename Graph::VertexDescriptor vtx, const IS& indexSet,
│ │ │ │ +
557 int toPe, std::set<GI>& neighbor, std::set<int>& neighborProcs) {
│ │ │ │ +
558 for(auto edge=g.beginEdges(vtx), end=g.endEdges(vtx); edge!=end; ++edge)
│ │ │ │ +
559 {
│ │ │ │ +
560 const typename IS::IndexPair* pindex = indexSet.pair(edge.target());
│ │ │ │ +
561 assert(pindex);
│ │ │ │ +
562 if(part[pindex->local()]!=toPe || !OwnerSet::contains(pindex->local().attribute()))
│ │ │ │ +
563 {
│ │ │ │ +
564 // is sent to another process and therefore becomes overlap
│ │ │ │ +
565 neighbor.insert(pindex->global());
│ │ │ │ +
566 neighborProcs.insert(part[pindex->local()]);
│ │ │ │ +
567 }
│ │ │ │ +
568 }
│ │ │ │ +
569 }
│ │ │ │ +
570
│ │ │ │ +
571 template<class T, class I>
│ │ │ │ +
572 void my_push_back(std::vector<T>& ownerVec, const I& index, [[maybe_unused]] int proc)
│ │ │ │ +
573 {
│ │ │ │ +
574 ownerVec.push_back(index);
│ │ │ │ +
575 }
│ │ │ │ +
576
│ │ │ │ +
577 template<class T, class I>
│ │ │ │ +
578 void my_push_back(std::vector<std::pair<T,int> >& ownerVec, const I& index, int proc)
│ │ │ │ +
579 {
│ │ │ │ +
580 ownerVec.push_back(std::make_pair(index,proc));
│ │ │ │ +
581 }
│ │ │ │ +
582 template<class T>
│ │ │ │ +
583 void reserve(std::vector<T>&, RedistributeInterface&, int)
│ │ │ │ +
584 {}
│ │ │ │ +
585 template<class T>
│ │ │ │ +
586 void reserve(std::vector<std::pair<T,int> >& ownerVec, RedistributeInterface& redist, int proc)
│ │ │ │ +
587 {
│ │ │ │ +
588 redist.reserveSpaceForReceiveInterface(proc, ownerVec.size());
│ │ │ │ +
589 }
│ │ │ │ +
590
│ │ │ │ +
591
│ │ │ │ +
609 template<class OwnerSet, class G, class IS, class T, class GI>
│ │ │ │ +
610 void getOwnerOverlapVec(const G& graph, std::vector<int>& part, IS& indexSet,
│ │ │ │ +
611 [[maybe_unused]] int myPe, int toPe, std::vector<T>& ownerVec, std::set<GI>& overlapSet,
│ │ │ │ +
612 RedistributeInterface& redist, std::set<int>& neighborProcs) {
│ │ │ │ +
613 for(auto index = indexSet.begin(); index != indexSet.end(); ++index) {
│ │ │ │ +
614 // Only Process owner vertices, the others are not in the parmetis graph.
│ │ │ │ +
615 if(OwnerSet::contains(index->local().attribute()))
│ │ │ │ +
616 {
│ │ │ │ +
617 if(part[index->local()]==toPe)
│ │ │ │ +
618 {
│ │ │ │ +
619 getNeighbor<OwnerSet>(graph, part, index->local(), indexSet,
│ │ │ │ +
620 toPe, overlapSet, neighborProcs);
│ │ │ │ +
621 my_push_back(ownerVec, index->global(), toPe);
│ │ │ │ +
622 }
│ │ │ │ +
623 }
│ │ │ │ +
624 }
│ │ │ │ +
625 reserve(ownerVec, redist, toPe);
│ │ │ │ +
626
│ │ │ │ +
627 }
│ │ │ │ +
628
│ │ │ │ +
629
│ │ │ │ +
636 template<class F, class IS>
│ │ │ │ +
637 inline bool isOwner(IS& indexSet, int index) {
│ │ │ │ +
638
│ │ │ │ +
639 const typename IS::IndexPair* pindex=indexSet.pair(index);
│ │ │ │ +
640
│ │ │ │ +
641 assert(pindex);
│ │ │ │ +
642 return F::contains(pindex->local().attribute());
│ │ │ │ +
643 }
│ │ │ │ +
644
│ │ │ │ +
645
│ │ │ │ +
646 class BaseEdgeFunctor
│ │ │ │ +
647 {
│ │ │ │ +
648 public:
│ │ │ │ +
649 BaseEdgeFunctor(Metis::idx_t* adj,const ParmetisDuneIndexMap& data)
│ │ │ │ +
650 : i_(), adj_(adj), data_(data)
│ │ │ │ +
651 {}
│ │ │ │ +
652
│ │ │ │ +
653 template<class T>
│ │ │ │ +
654 void operator()(const T& edge)
│ │ │ │ +
655 {
│ │ │ │ +
656 // Get the egde weight
│ │ │ │ +
657 // const Weight& weight=edge.weight();
│ │ │ │ +
658 adj_[i_] = data_.toParmetis(edge.target());
│ │ │ │ +
659 i_++;
│ │ │ │ +
660 }
│ │ │ │ +
661 std::size_t index()
│ │ │ │ +
662 {
│ │ │ │ +
663 return i_;
│ │ │ │ +
664 }
│ │ │ │ +
665
│ │ │ │ +
666 private:
│ │ │ │ +
667 std::size_t i_;
│ │ │ │ +
668 Metis::idx_t* adj_;
│ │ │ │ +
669 const ParmetisDuneIndexMap& data_;
│ │ │ │ +
670 };
│ │ │ │ +
671
│ │ │ │ +
672 template<typename G>
│ │ │ │ +
673 struct EdgeFunctor
│ │ │ │ +
674 : public BaseEdgeFunctor
│ │ │ │ +
675 {
│ │ │ │ +
676 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std::size_t)
│ │ │ │ +
677 : BaseEdgeFunctor(adj, data)
│ │ │ │ +
678 {}
│ │ │ │ +
679
│ │ │ │ +
680 Metis::idx_t* getWeights()
│ │ │ │ +
681 {
│ │ │ │ +
682 return NULL;
│ │ │ │ +
683 }
│ │ │ │ +
684 void free(){}
│ │ │ │ +
685 };
│ │ │ │ +
686
│ │ │ │ +
687 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
688 class EdgeFunctor<Dune::Amg::PropertiesGraph<G,V,E,VM,EM> >
│ │ │ │ +
689 : public BaseEdgeFunctor
│ │ │ │ +
690 {
│ │ │ │ +
691 public:
│ │ │ │ +
692 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std::size_t s)
│ │ │ │ +
693 : BaseEdgeFunctor(adj, data)
│ │ │ │ +
694 {
│ │ │ │ +
695 weight_=new Metis::idx_t[s];
│ │ │ │ +
696 }
│ │ │ │ +
697
│ │ │ │ +
698 template<class T>
│ │ │ │ +
699 void operator()(const T& edge)
│ │ │ │ +
700 {
│ │ │ │ +
701 weight_[index()]=edge.properties().depends() ? 3 : 1;
│ │ │ │ +
702 BaseEdgeFunctor::operator()(edge);
│ │ │ │ +
703 }
│ │ │ │ +
704 Metis::idx_t* getWeights()
│ │ │ │ +
705 {
│ │ │ │ +
706 return weight_;
│ │ │ │ +
707 }
│ │ │ │ +
708 void free(){
│ │ │ │ +
709 if(weight_!=0) {
│ │ │ │ +
710 delete weight_;
│ │ │ │ +
711 weight_=0;
│ │ │ │ +
712 }
│ │ │ │ +
713 }
│ │ │ │ +
714 private:
│ │ │ │ +
715 Metis::idx_t* weight_;
│ │ │ │ +
716 };
│ │ │ │ +
717
│ │ │ │ +
718
│ │ │ │ +
719
│ │ │ │ +
733 template<class F, class G, class IS, class EW>
│ │ │ │ +
734 void getAdjArrays(G& graph, IS& indexSet, Metis::idx_t *xadj,
│ │ │ │ +
735 EW& ew)
│ │ │ │ +
736 {
│ │ │ │ +
737 int j=0;
│ │ │ │ +
738 auto vend = graph.end();
│ │ │ │ +
739
│ │ │ │ +
740 for(auto vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ │ +
741 if (isOwner<F>(indexSet,*vertex)) {
│ │ │ │ +
742 // The type of const edge iterator.
│ │ │ │ +
743 auto eend = vertex.end();
│ │ │ │ +
744 xadj[j] = ew.index();
│ │ │ │ +
745 j++;
│ │ │ │ +
746 for(auto edge = vertex.begin(); edge != eend; ++edge) {
│ │ │ │ +
747 ew(edge);
│ │ │ │ +
748 }
│ │ │ │ +
749 }
│ │ │ │ +
750 }
│ │ │ │ +
751 xadj[j] = ew.index();
│ │ │ │ +
752 }
│ │ │ │ +
753 } // end anonymous namespace
│ │ │ │ +
754
│ │ │ │ +
755 template<class G, class T1, class T2>
│ │ │ │ +
756 bool buildCommunication(const G& graph, std::vector<int>& realparts,
│ │ │ │ + │ │ │ │ +
758 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ +
759 RedistributeInterface& redistInf,
│ │ │ │ +
760 bool verbose=false);
│ │ │ │ +
761#if HAVE_PARMETIS
│ │ │ │ +
762#ifndef METIS_VER_MAJOR
│ │ │ │ +
763 extern "C"
│ │ │ │ +
764 {
│ │ │ │ +
765 // backwards compatibility to parmetis < 4.0.0
│ │ │ │ +
766 void METIS_PartGraphKway(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t *adjncy, Metis::idx_t *vwgt,
│ │ │ │ +
767 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts,
│ │ │ │ +
768 int *options, int *edgecut, Metis::idx_t *part);
│ │ │ │ +
769
│ │ │ │ +
770 void METIS_PartGraphRecursive(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t *adjncy, Metis::idx_t *vwgt,
│ │ │ │ +
771 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts,
│ │ │ │ +
772 int *options, int *edgecut, Metis::idx_t *part);
│ │ │ │ +
773 }
│ │ │ │ +
774#endif
│ │ │ │ +
775#endif // HAVE_PARMETIS
│ │ │ │ +
776
│ │ │ │ +
777 template<class S, class T>
│ │ │ │ +
│ │ │ │ +
778 inline void print_carray(S& os, T* array, std::size_t l)
│ │ │ │ +
779 {
│ │ │ │ +
780 for(T *cur=array, *end=array+l; cur!=end; ++cur)
│ │ │ │ +
781 os<<*cur<<" ";
│ │ │ │ +
782 }
│ │ │ │ +
│ │ │ │ +
783
│ │ │ │ +
784 template<class S, class T>
│ │ │ │ +
│ │ │ │ +
785 inline bool isValidGraph(std::size_t noVtx, std::size_t gnoVtx, S noEdges, T* xadj,
│ │ │ │ +
786 T* adjncy, bool checkSymmetry)
│ │ │ │ +
787 {
│ │ │ │ +
788 bool correct=true;
│ │ │ │ +
789
│ │ │ │ +
790 using std::signbit;
│ │ │ │ +
791 for(Metis::idx_t vtx=0; vtx<(Metis::idx_t)noVtx; ++vtx) {
│ │ │ │ +
792 if(static_cast<S>(xadj[vtx])>noEdges || signbit(xadj[vtx])) {
│ │ │ │ +
793 std::cerr <<"Check graph: xadj["<<vtx<<"]="<<xadj[vtx]<<" (>"
│ │ │ │ +
794 <<noEdges<<") out of range!"<<std::endl;
│ │ │ │ +
795 correct=false;
│ │ │ │ +
796 }
│ │ │ │ +
797 if(static_cast<S>(xadj[vtx+1])>noEdges || signbit(xadj[vtx+1])) {
│ │ │ │ +
798 std::cerr <<"Check graph: xadj["<<vtx+1<<"]="<<xadj[vtx+1]<<" (>"
│ │ │ │ +
799 <<noEdges<<") out of range!"<<std::endl;
│ │ │ │ +
800 correct=false;
│ │ │ │ +
801 }
│ │ │ │ +
802 // Check numbers in adjncy
│ │ │ │ +
803 for(Metis::idx_t i=xadj[vtx]; i< xadj[vtx+1]; ++i) {
│ │ │ │ +
804 if(signbit(adjncy[i]) || ((std::size_t)adjncy[i])>gnoVtx) {
│ │ │ │ +
805 std::cerr<<" Edge "<<adjncy[i]<<" out of range ["<<0<<","<<noVtx<<")"
│ │ │ │ +
806 <<std::endl;
│ │ │ │ +
807 correct=false;
│ │ │ │ +
808 }
│ │ │ │ +
809 }
│ │ │ │ +
810 if(checkSymmetry) {
│ │ │ │ +
811 for(Metis::idx_t i=xadj[vtx]; i< xadj[vtx+1]; ++i) {
│ │ │ │ +
812 Metis::idx_t target=adjncy[i];
│ │ │ │ +
813 // search for symmetric edge
│ │ │ │ +
814 int found=0;
│ │ │ │ +
815 for(Metis::idx_t j=xadj[target]; j< xadj[target+1]; ++j)
│ │ │ │ +
816 if(adjncy[j]==vtx)
│ │ │ │ +
817 found++;
│ │ │ │ +
818 if(found!=1) {
│ │ │ │ +
819 std::cerr<<"Edge ("<<target<<","<<vtx<<") "<<i<<" time"<<std::endl;
│ │ │ │ +
820 correct=false;
│ │ │ │ +
821 }
│ │ │ │ +
822 }
│ │ │ │ +
823 }
│ │ │ │ +
824 }
│ │ │ │ +
825 return correct;
│ │ │ │ +
826 }
│ │ │ │ +
│ │ │ │ +
827
│ │ │ │ +
828 template<class M, class T1, class T2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
830 Metis::idx_t nparts,
│ │ │ │ +
831 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ +
832 RedistributeInterface& redistInf,
│ │ │ │ +
833 bool verbose=false)
│ │ │ │ +
834 {
│ │ │ │ +
835 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
836 std::cout<<"Repartitioning from "<<oocomm.communicator().size()
│ │ │ │ +
837 <<" to "<<nparts<<" parts"<<std::endl;
│ │ │ │ +
838 Timer time;
│ │ │ │ +
839 int rank = oocomm.communicator().rank();
│ │ │ │ +
840#if !HAVE_PARMETIS
│ │ │ │ +
841 int* part = new int[1];
│ │ │ │ +
842 part[0]=0;
│ │ │ │ +
843#else
│ │ │ │ +
844 Metis::idx_t* part = new Metis::idx_t[1]; // where all our data moves to
│ │ │ │ +
845
│ │ │ │ +
846 if(nparts>1) {
│ │ │ │ +
847
│ │ │ │ +
848 part[0]=rank;
│ │ │ │ +
849
│ │ │ │ +
850 { // sublock for automatic memory deletion
│ │ │ │ +
851
│ │ │ │ +
852 // Build the graph of the communication scheme and create an appropriate indexset.
│ │ │ │ +
853 // calculate the neighbour vertices
│ │ │ │ +
854 int noNeighbours = oocomm.remoteIndices().neighbours();
│ │ │ │ +
855
│ │ │ │ +
856 for(auto n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ │ +
857 ++n)
│ │ │ │ +
858 if(n->first==rank) {
│ │ │ │ +
859 //do not include ourselves.
│ │ │ │ +
860 --noNeighbours;
│ │ │ │ +
861 break;
│ │ │ │ +
862 }
│ │ │ │ +
863
│ │ │ │ +
864 // A parmetis graph representing the communication graph.
│ │ │ │ +
865 // The diagonal entries are the number of nodes on the process.
│ │ │ │ +
866 // The offdiagonal entries are the number of edges leading to other processes.
│ │ │ │ +
867
│ │ │ │ +
868 Metis::idx_t *xadj=new Metis::idx_t[2];
│ │ │ │ +
869 Metis::idx_t *vtxdist=new Metis::idx_t[oocomm.communicator().size()+1];
│ │ │ │ +
870 Metis::idx_t *adjncy=new Metis::idx_t[noNeighbours];
│ │ │ │ +
871#ifdef USE_WEIGHTS
│ │ │ │ +
872 Metis::idx_t *vwgt = 0;
│ │ │ │ +
873 Metis::idx_t *adjwgt = 0;
│ │ │ │ +
874#endif
│ │ │ │ +
875
│ │ │ │ +
876 // each process has exactly one vertex!
│ │ │ │ +
877 for(int i=0; i<oocomm.communicator().size(); ++i)
│ │ │ │ +
878 vtxdist[i]=i;
│ │ │ │ +
879 vtxdist[oocomm.communicator().size()]=oocomm.communicator().size();
│ │ │ │ +
880
│ │ │ │ +
881 xadj[0]=0;
│ │ │ │ +
882 xadj[1]=noNeighbours;
│ │ │ │ +
883
│ │ │ │ +
884 // count edges to other processor
│ │ │ │ +
885 // a vector mapping the index to the owner
│ │ │ │ +
886 // std::vector<int> owner(mat.N(), oocomm.communicator().rank());
│ │ │ │ +
887 // for(NeighbourIterator n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ │ +
888 // ++n)
│ │ │ │ +
889 // {
│ │ │ │ +
890 // if(n->first!=oocomm.communicator().rank()){
│ │ │ │ +
891 // typedef typename RemoteIndices::RemoteIndexList RIList;
│ │ │ │ +
892 // const RIList& rlist = *(n->second.first);
│ │ │ │ +
893 // typedef typename RIList::const_iterator LIter;
│ │ │ │ +
894 // for(LIter entry=rlist.begin(); entry!=rlist.end(); ++entry){
│ │ │ │ +
895 // if(entry->attribute()==OwnerOverlapCopyAttributeSet::owner)
│ │ │ │ +
896 // owner[entry->localIndexPair().local()] = n->first;
│ │ │ │ +
897 // }
│ │ │ │ +
898 // }
│ │ │ │ +
899 // }
│ │ │ │ +
900
│ │ │ │ +
901 // std::map<int,Metis::idx_t> edgecount; // edges to other processors
│ │ │ │ +
902 // typedef typename M::ConstRowIterator RIter;
│ │ │ │ +
903 // typedef typename M::ConstColIterator CIter;
│ │ │ │ +
904
│ │ │ │ +
905 // // calculate edge count
│ │ │ │ +
906 // for(RIter row=mat.begin(), endr=mat.end(); row != endr; ++row)
│ │ │ │ +
907 // if(owner[row.index()]==OwnerOverlapCopyAttributeSet::owner)
│ │ │ │ +
908 // for(CIter entry= row->begin(), ende = row->end(); entry != ende; ++entry)
│ │ │ │ +
909 // ++edgecount[owner[entry.index()]];
│ │ │ │ +
910
│ │ │ │ +
911 // setup edge and weight pattern
│ │ │ │ +
912
│ │ │ │ +
913 Metis::idx_t* adjp=adjncy;
│ │ │ │ +
914
│ │ │ │ +
915#ifdef USE_WEIGHTS
│ │ │ │ +
916 vwgt = new Metis::idx_t[1];
│ │ │ │ +
917 vwgt[0]= mat.N(); // weight is numer of rows TODO: Should actually be the nonzeros.
│ │ │ │ +
918
│ │ │ │ +
919 adjwgt = new Metis::idx_t[noNeighbours];
│ │ │ │ +
920 Metis::idx_t* adjwp=adjwgt;
│ │ │ │ +
921#endif
│ │ │ │ +
922
│ │ │ │ +
923 for(auto n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ │ +
924 ++n)
│ │ │ │ +
925 if(n->first != rank) {
│ │ │ │ +
926 *adjp=n->first;
│ │ │ │ +
927 ++adjp;
│ │ │ │ +
928#ifdef USE_WEIGHTS
│ │ │ │ +
929 *adjwp=1; //edgecount[n->first];
│ │ │ │ +
930 ++adjwp;
│ │ │ │ +
931#endif
│ │ │ │ +
932 }
│ │ │ │ +
933 assert(isValidGraph(vtxdist[rank+1]-vtxdist[rank],
│ │ │ │ +
934 vtxdist[oocomm.communicator().size()],
│ │ │ │ +
935 noNeighbours, xadj, adjncy, false));
│ │ │ │ +
936
│ │ │ │ +
937 [[maybe_unused]] Metis::idx_t wgtflag=0;
│ │ │ │ +
938 Metis::idx_t numflag=0;
│ │ │ │ +
939 Metis::idx_t edgecut;
│ │ │ │ +
940#ifdef USE_WEIGHTS
│ │ │ │ +
941 wgtflag=3;
│ │ │ │ +
942#endif
│ │ │ │ +
943 Metis::real_t *tpwgts = new Metis::real_t[nparts];
│ │ │ │ +
944 for(int i=0; i<nparts; ++i)
│ │ │ │ +
945 tpwgts[i]=1.0/nparts;
│ │ │ │ +
946 MPI_Comm comm=oocomm.communicator();
│ │ │ │ +
947
│ │ │ │ +
948 Dune::dinfo<<rank<<" vtxdist: ";
│ │ │ │ +
949 print_carray(Dune::dinfo, vtxdist, oocomm.communicator().size()+1);
│ │ │ │ +
950 Dune::dinfo<<std::endl<<rank<<" xadj: ";
│ │ │ │ +
951 print_carray(Dune::dinfo, xadj, 2);
│ │ │ │ +
952 Dune::dinfo<<std::endl<<rank<<" adjncy: ";
│ │ │ │ +
953 print_carray(Dune::dinfo, adjncy, noNeighbours);
│ │ │ │ +
954
│ │ │ │ +
955#ifdef USE_WEIGHTS
│ │ │ │ +
956 Dune::dinfo<<std::endl<<rank<<" vwgt: ";
│ │ │ │ +
957 print_carray(Dune::dinfo, vwgt, 1);
│ │ │ │ +
958 Dune::dinfo<<std::endl<<rank<<" adwgt: ";
│ │ │ │ +
959 print_carray(Dune::dinfo, adjwgt, noNeighbours);
│ │ │ │ +
960#endif
│ │ │ │ +
961 Dune::dinfo<<std::endl;
│ │ │ │ +
962 oocomm.communicator().barrier();
│ │ │ │ +
963 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
964 std::cout<<"Creating comm graph took "<<time.elapsed()<<std::endl;
│ │ │ │ +
965 time.reset();
│ │ │ │ +
966
│ │ │ │ +
967#ifdef PARALLEL_PARTITION
│ │ │ │ +
968 Metis::real_t ubvec = 1.15;
│ │ │ │ +
969 int ncon=1;
│ │ │ │ +
970 int options[5] ={ 0,1,15,0,0};
│ │ │ │ +
971
│ │ │ │ +
972 //=======================================================
│ │ │ │ +
973 // ParMETIS_V3_PartKway
│ │ │ │ +
974 //=======================================================
│ │ │ │ +
975 ParMETIS_V3_PartKway(vtxdist, xadj, adjncy,
│ │ │ │ +
976 vwgt, adjwgt, &wgtflag,
│ │ │ │ +
977 &numflag, &ncon, &nparts, tpwgts, &ubvec, options, &edgecut, part,
│ │ │ │ +
978 &comm);
│ │ │ │ +
979 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
980 std::cout<<"ParMETIS took "<<time.elapsed()<<std::endl;
│ │ │ │ +
981 time.reset();
│ │ │ │ +
982#else
│ │ │ │ +
983 Timer time1;
│ │ │ │ +
984 std::size_t gnoedges=0;
│ │ │ │ +
985 int* noedges = 0;
│ │ │ │ +
986 noedges = new int[oocomm.communicator().size()];
│ │ │ │ +
987 Dune::dverb<<"noNeighbours: "<<noNeighbours<<std::endl;
│ │ │ │ +
988 // gather number of edges for each vertex.
│ │ │ │ +
989 MPI_Allgather(&noNeighbours,1,MPI_INT,noedges,1, MPI_INT,oocomm.communicator());
│ │ │ │ +
990
│ │ │ │ +
991 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
992 std::cout<<"Gathering noedges took "<<time1.elapsed()<<std::endl;
│ │ │ │ +
993 time1.reset();
│ │ │ │ +
994
│ │ │ │ +
995 Metis::idx_t noVertices = vtxdist[oocomm.communicator().size()];
│ │ │ │ +
996 Metis::idx_t *gxadj = 0;
│ │ │ │ +
997 Metis::idx_t *gvwgt = 0;
│ │ │ │ +
998 Metis::idx_t *gadjncy = 0;
│ │ │ │ +
999 Metis::idx_t *gadjwgt = 0;
│ │ │ │ +
1000 Metis::idx_t *gpart = 0;
│ │ │ │ +
1001 int* displ = 0;
│ │ │ │ +
1002 int* noxs = 0;
│ │ │ │ +
1003 int* xdispl = 0; // displacement for xadj
│ │ │ │ +
1004 int* novs = 0;
│ │ │ │ +
1005 int* vdispl=0; // real vertex displacement
│ │ │ │ +
1006#ifdef USE_WEIGHTS
│ │ │ │ +
1007 std::size_t localNoVtx=vtxdist[rank+1]-vtxdist[rank];
│ │ │ │ +
1008#endif
│ │ │ │ +
1009 std::size_t gxadjlen = vtxdist[oocomm.communicator().size()]-vtxdist[0]+oocomm.communicator().size();
│ │ │ │ +
1010
│ │ │ │ +
1011 {
│ │ │ │ +
1012 Dune::dinfo<<"noedges: ";
│ │ │ │ +
1013 print_carray(Dune::dinfo, noedges, oocomm.communicator().size());
│ │ │ │ +
1014 Dune::dinfo<<std::endl;
│ │ │ │ +
1015 displ = new int[oocomm.communicator().size()];
│ │ │ │ +
1016 xdispl = new int[oocomm.communicator().size()];
│ │ │ │ +
1017 noxs = new int[oocomm.communicator().size()];
│ │ │ │ +
1018 vdispl = new int[oocomm.communicator().size()];
│ │ │ │ +
1019 novs = new int[oocomm.communicator().size()];
│ │ │ │ +
1020
│ │ │ │ +
1021 for(int i=0; i < oocomm.communicator().size(); ++i) {
│ │ │ │ +
1022 noxs[i]=vtxdist[i+1]-vtxdist[i]+1;
│ │ │ │ +
1023 novs[i]=vtxdist[i+1]-vtxdist[i];
│ │ │ │ +
1024 }
│ │ │ │ +
1025
│ │ │ │ +
1026 Metis::idx_t *so= vtxdist;
│ │ │ │ +
1027 int offset = 0;
│ │ │ │ +
1028 for(int *xcurr = xdispl, *vcurr = vdispl, *end=vdispl+oocomm.communicator().size();
│ │ │ │ +
1029 vcurr!=end; ++vcurr, ++xcurr, ++so, ++offset) {
│ │ │ │ +
1030 *vcurr = *so;
│ │ │ │ +
1031 *xcurr = offset + *so;
│ │ │ │ +
1032 }
│ │ │ │ +
1033
│ │ │ │ +
1034 int *pdispl =displ;
│ │ │ │ +
1035 int cdispl = 0;
│ │ │ │ +
1036 *pdispl = 0;
│ │ │ │ +
1037 for(int *curr=noedges, *end=noedges+oocomm.communicator().size()-1;
│ │ │ │ +
1038 curr!=end; ++curr) {
│ │ │ │ +
1039 ++pdispl; // next displacement
│ │ │ │ +
1040 cdispl += *curr; // next value
│ │ │ │ +
1041 *pdispl = cdispl;
│ │ │ │ +
1042 }
│ │ │ │ +
1043 Dune::dinfo<<"displ: ";
│ │ │ │ +
1044 print_carray(Dune::dinfo, displ, oocomm.communicator().size());
│ │ │ │ +
1045 Dune::dinfo<<std::endl;
│ │ │ │ +
1046
│ │ │ │ +
1047 // calculate global number of edges
│ │ │ │ +
1048 // It is bigger than the actual one as we habe size-1 additional end entries
│ │ │ │ +
1049 for(int *curr=noedges, *end=noedges+oocomm.communicator().size();
│ │ │ │ +
1050 curr!=end; ++curr)
│ │ │ │ +
1051 gnoedges += *curr;
│ │ │ │ +
1052
│ │ │ │ +
1053 // alocate gobal graph
│ │ │ │ +
1054 Dune::dinfo<<"gxadjlen: "<<gxadjlen<<" noVertices: "<<noVertices
│ │ │ │ +
1055 <<" gnoedges: "<<gnoedges<<std::endl;
│ │ │ │ +
1056 gxadj = new Metis::idx_t[gxadjlen];
│ │ │ │ +
1057 gpart = new Metis::idx_t[noVertices];
│ │ │ │ +
1058#ifdef USE_WEIGHTS
│ │ │ │ +
1059 gvwgt = new Metis::idx_t[noVertices];
│ │ │ │ +
1060 gadjwgt = new Metis::idx_t[gnoedges];
│ │ │ │ +
1061#endif
│ │ │ │ +
1062 gadjncy = new Metis::idx_t[gnoedges];
│ │ │ │ +
1063 }
│ │ │ │ +
1064
│ │ │ │ +
1065 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1066 std::cout<<"Preparing global graph took "<<time1.elapsed()<<std::endl;
│ │ │ │ +
1067 time1.reset();
│ │ │ │ +
1068 // Communicate data
│ │ │ │ +
1069
│ │ │ │ +
1070 MPI_Allgatherv(xadj,2,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1071 gxadj,noxs,xdispl,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1072 comm);
│ │ │ │ +
1073 MPI_Allgatherv(adjncy,noNeighbours,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1074 gadjncy,noedges,displ,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1075 comm);
│ │ │ │ +
1076#ifdef USE_WEIGHTS
│ │ │ │ +
1077 MPI_Allgatherv(adjwgt,noNeighbours,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1078 gadjwgt,noedges,displ,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1079 comm);
│ │ │ │ +
1080 MPI_Allgatherv(vwgt,localNoVtx,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1081 gvwgt,novs,vdispl,MPITraits<Metis::idx_t>::getType(),
│ │ │ │ +
1082 comm);
│ │ │ │ +
1083#endif
│ │ │ │ +
1084 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1085 std::cout<<"Gathering global graph data took "<<time1.elapsed()<<std::endl;
│ │ │ │ +
1086 time1.reset();
│ │ │ │ +
1087
│ │ │ │ +
1088 {
│ │ │ │ +
1089 // create the real gxadj array
│ │ │ │ +
1090 // i.e. shift entries and add displacements.
│ │ │ │ +
1091
│ │ │ │ +
1092 print_carray(Dune::dinfo, gxadj, gxadjlen);
│ │ │ │ +
1093
│ │ │ │ +
1094 int offset = 0;
│ │ │ │ +
1095 Metis::idx_t increment = vtxdist[1];
│ │ │ │ +
1096 Metis::idx_t *start=gxadj+1;
│ │ │ │ +
1097 for(int i=1; i<oocomm.communicator().size(); ++i) {
│ │ │ │ +
1098 offset+=1;
│ │ │ │ +
1099 int lprev = vtxdist[i]-vtxdist[i-1];
│ │ │ │ +
1100 int l = vtxdist[i+1]-vtxdist[i];
│ │ │ │ +
1101 start+=lprev;
│ │ │ │ +
1102 assert((start+l+offset)-gxadj<=static_cast<Metis::idx_t>(gxadjlen));
│ │ │ │ +
1103 increment = *(start-1);
│ │ │ │ +
1104 std::transform(start+offset, start+l+offset, start, std::bind(std::plus<Metis::idx_t>(), std::placeholders::_1, increment));
│ │ │ │ +
1105 }
│ │ │ │ +
1106 Dune::dinfo<<std::endl<<"shifted xadj:";
│ │ │ │ +
1107 print_carray(Dune::dinfo, gxadj, noVertices+1);
│ │ │ │ +
1108 Dune::dinfo<<std::endl<<" gadjncy: ";
│ │ │ │ +
1109 print_carray(Dune::dinfo, gadjncy, gnoedges);
│ │ │ │ +
1110#ifdef USE_WEIGHTS
│ │ │ │ +
1111 Dune::dinfo<<std::endl<<" gvwgt: ";
│ │ │ │ +
1112 print_carray(Dune::dinfo, gvwgt, noVertices);
│ │ │ │ +
1113 Dune::dinfo<<std::endl<<"adjwgt: ";
│ │ │ │ +
1114 print_carray(Dune::dinfo, gadjwgt, gnoedges);
│ │ │ │ +
1115 Dune::dinfo<<std::endl;
│ │ │ │ +
1116#endif
│ │ │ │ +
1117 // everything should be fine now!!!
│ │ │ │ +
1118 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1119 std::cout<<"Postprocesing global graph data took "<<time1.elapsed()<<std::endl;
│ │ │ │ +
1120 time1.reset();
│ │ │ │ +
1121#ifndef NDEBUG
│ │ │ │ +
1122 assert(isValidGraph(noVertices, noVertices, gnoedges,
│ │ │ │ +
1123 gxadj, gadjncy, true));
│ │ │ │ +
1124#endif
│ │ │ │ +
1125
│ │ │ │ +
1126 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1127 std::cout<<"Creating grah one 1 process took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1128 time.reset();
│ │ │ │ +
1129#if METIS_VER_MAJOR >= 5
│ │ │ │ +
1130 Metis::idx_t ncon = 1;
│ │ │ │ +
1131 Metis::idx_t moptions[METIS_NOPTIONS];
│ │ │ │ +
1132 METIS_SetDefaultOptions(moptions);
│ │ │ │ +
1133 moptions[METIS_OPTION_NUMBERING] = numflag;
│ │ │ │ +
1134 METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, gadjwgt,
│ │ │ │ +
1135 &nparts, NULL, NULL, moptions, &edgecut, gpart);
│ │ │ │ +
1136#else
│ │ │ │ +
1137 int options[5] = {0, 1, 1, 3, 3};
│ │ │ │ +
1138 // Call metis
│ │ │ │ +
1139 METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, &wgtflag,
│ │ │ │ +
1140 &numflag, &nparts, options, &edgecut, gpart);
│ │ │ │ +
1141#endif
│ │ │ │ +
1142
│ │ │ │ +
1143 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1144 std::cout<<"METIS took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1145 time.reset();
│ │ │ │ +
1146
│ │ │ │ +
1147 Dune::dinfo<<std::endl<<"part:";
│ │ │ │ +
1148 print_carray(Dune::dinfo, gpart, noVertices);
│ │ │ │ +
1149
│ │ │ │ +
1150 delete[] gxadj;
│ │ │ │ +
1151 delete[] gadjncy;
│ │ │ │ +
1152#ifdef USE_WEIGHTS
│ │ │ │ +
1153 delete[] gvwgt;
│ │ │ │ +
1154 delete[] gadjwgt;
│ │ │ │ +
1155#endif
│ │ │ │ +
1156 }
│ │ │ │ +
1157 // Scatter result
│ │ │ │ +
1158 MPI_Scatter(gpart, 1, MPITraits<Metis::idx_t>::getType(), part, 1,
│ │ │ │ +
1159 MPITraits<Metis::idx_t>::getType(), 0, comm);
│ │ │ │ +
1160
│ │ │ │ +
1161 {
│ │ │ │ +
1162 // release remaining memory
│ │ │ │ +
1163 delete[] gpart;
│ │ │ │ +
1164 delete[] noedges;
│ │ │ │ +
1165 delete[] displ;
│ │ │ │ +
1166 }
│ │ │ │ +
1167
│ │ │ │ +
1168
│ │ │ │ +
1169#endif
│ │ │ │ +
1170 delete[] xadj;
│ │ │ │ +
1171 delete[] vtxdist;
│ │ │ │ +
1172 delete[] adjncy;
│ │ │ │ +
1173#ifdef USE_WEIGHTS
│ │ │ │ +
1174 delete[] vwgt;
│ │ │ │ +
1175 delete[] adjwgt;
│ │ │ │ +
1176#endif
│ │ │ │ +
1177 delete[] tpwgts;
│ │ │ │ +
1178 }
│ │ │ │ +
1179 }else{
│ │ │ │ +
1180 part[0]=0;
│ │ │ │ +
1181 }
│ │ │ │ +
1182#endif
│ │ │ │ +
1183 Dune::dinfo<<" repart "<<rank <<" -> "<< part[0]<<std::endl;
│ │ │ │ +
1184
│ │ │ │ +
1185 std::vector<int> realpart(mat.N(), part[0]);
│ │ │ │ +
1186 delete[] part;
│ │ │ │ +
1187
│ │ │ │ +
1188 oocomm.copyOwnerToAll(realpart, realpart);
│ │ │ │ +
1189
│ │ │ │ +
1190 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1191 std::cout<<"Scattering repartitioning took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1192 time.reset();
│ │ │ │ +
1193
│ │ │ │ +
1194
│ │ │ │ +
1195 oocomm.buildGlobalLookup(mat.N());
│ │ │ │ +
1196 Dune::Amg::MatrixGraph<M> graph(const_cast<M&>(mat));
│ │ │ │ +
1197 fillIndexSetHoles(graph, oocomm);
│ │ │ │ +
1198 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1199 std::cout<<"Filling index set took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1200 time.reset();
│ │ │ │ +
1201
│ │ │ │ +
1202 if(verbose) {
│ │ │ │ +
1203 int noNeighbours=oocomm.remoteIndices().neighbours();
│ │ │ │ +
1204 noNeighbours = oocomm.communicator().sum(noNeighbours)
│ │ │ │ +
1205 / oocomm.communicator().size();
│ │ │ │ +
1206 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1207 std::cout<<"Average no neighbours was "<<noNeighbours<<std::endl;
│ │ │ │ +
1208 }
│ │ │ │ +
1209 bool ret = buildCommunication(graph, realpart, oocomm, outcomm, redistInf,
│ │ │ │ +
1210 verbose);
│ │ │ │ +
1211 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1212 std::cout<<"Building index sets took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1213 time.reset();
│ │ │ │ +
1214
│ │ │ │ +
1215
│ │ │ │ +
1216 return ret;
│ │ │ │ +
1217
│ │ │ │ +
1218 }
│ │ │ │ +
│ │ │ │ +
1219
│ │ │ │ +
1234 template<class G, class T1, class T2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1236 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ +
1237 RedistributeInterface& redistInf,
│ │ │ │ +
1238 bool verbose=false)
│ │ │ │ +
1239 {
│ │ │ │ +
1240 Timer time;
│ │ │ │ +
1241
│ │ │ │ +
1242 MPI_Comm comm=oocomm.communicator();
│ │ │ │ +
1243 oocomm.buildGlobalLookup(graph.noVertices());
│ │ │ │ +
1244 fillIndexSetHoles(graph, oocomm);
│ │ │ │ +
1245
│ │ │ │ +
1246 if(verbose && oocomm.communicator().rank()==0)
│ │ │ │ +
1247 std::cout<<"Filling holes took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1248 time.reset();
│ │ │ │ +
1249
│ │ │ │ +
1250 // simple precondition checks
│ │ │ │ +
1251
│ │ │ │ +
1252#ifdef PERF_REPART
│ │ │ │ +
1253 // Profiling variables
│ │ │ │ +
1254 double t1=0.0, t2=0.0, t3=0.0, t4=0.0, tSum=0.0;
│ │ │ │ +
1255#endif
│ │ │ │ +
1256
│ │ │ │ +
1257
│ │ │ │ +
1258 // MPI variables
│ │ │ │ +
1259 int mype = oocomm.communicator().rank();
│ │ │ │ +
1260
│ │ │ │ +
1261 assert(nparts<=static_cast<Metis::idx_t>(oocomm.communicator().size()));
│ │ │ │ +
1262
│ │ │ │ +
1263 int myDomain = -1;
│ │ │ │ +
1264
│ │ │ │ +
1265 //
│ │ │ │ +
1266 // 1) Prepare the required parameters for using ParMETIS
│ │ │ │ +
1267 // Especially the arrays that represent the graph must be
│ │ │ │ +
1268 // generated by the DUNE Graph and IndexSet input variables.
│ │ │ │ +
1269 // These are the arrays:
│ │ │ │ +
1270 // - vtxdist
│ │ │ │ +
1271 // - xadj
│ │ │ │ +
1272 // - adjncy
│ │ │ │ +
1273 //
│ │ │ │ +
1274 //
│ │ │ │ +
1275#ifdef PERF_REPART
│ │ │ │ +
1276 // reset timer for step 1)
│ │ │ │ +
1277 t1=MPI_Wtime();
│ │ │ │ +
1278#endif
│ │ │ │ +
1279
│ │ │ │ +
1280
│ │ │ │ +
1281 typedef typename Dune::OwnerOverlapCopyCommunication<T1,T2> OOComm;
│ │ │ │ +
1282 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ │ +
1283
│ │ │ │ +
1284 // Create the vtxdist array and parmetisVtxMapping.
│ │ │ │ +
1285 // Global communications are necessary
│ │ │ │ +
1286 // The parmetis global identifiers for the owner vertices.
│ │ │ │ +
1287 ParmetisDuneIndexMap indexMap(graph,oocomm);
│ │ │ │ +
1288 Metis::idx_t *part = new Metis::idx_t[indexMap.numOfOwnVtx()];
│ │ │ │ +
1289 for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i)
│ │ │ │ +
1290 part[i]=mype;
│ │ │ │ +
1291
│ │ │ │ +
1292#if !HAVE_PARMETIS
│ │ │ │ +
1293 if(oocomm.communicator().rank()==0 && nparts>1)
│ │ │ │ +
1294 std::cerr<<"ParMETIS not activated. Will repartition to 1 domain instead of requested "
│ │ │ │ +
1295 <<nparts<<" domains."<<std::endl;
│ │ │ │ +
1296 nparts=1; // No parmetis available, fallback to agglomerating to 1 process
│ │ │ │ +
1297
│ │ │ │ +
1298#else
│ │ │ │ +
1299
│ │ │ │ +
1300 if(nparts>1) {
│ │ │ │ +
1301 // Create the xadj and adjncy arrays
│ │ │ │ +
1302 Metis::idx_t *xadj = new Metis::idx_t[indexMap.numOfOwnVtx()+1];
│ │ │ │ +
1303 Metis::idx_t *adjncy = new Metis::idx_t[graph.noEdges()];
│ │ │ │ +
1304 EdgeFunctor<G> ef(adjncy, indexMap, graph.noEdges());
│ │ │ │ +
1305 getAdjArrays<OwnerSet>(graph, oocomm.globalLookup(), xadj, ef);
│ │ │ │ +
1306
│ │ │ │ +
1307 //
│ │ │ │ +
1308 // 2) Call ParMETIS
│ │ │ │ +
1309 //
│ │ │ │ +
1310 //
│ │ │ │ +
1311 Metis::idx_t numflag=0, wgtflag=0, options[3], edgecut=0, ncon=1;
│ │ │ │ +
1312 //float *tpwgts = NULL;
│ │ │ │ +
1313 Metis::real_t *tpwgts = new Metis::real_t[nparts];
│ │ │ │ +
1314 for(int i=0; i<nparts; ++i)
│ │ │ │ +
1315 tpwgts[i]=1.0/nparts;
│ │ │ │ +
1316 Metis::real_t ubvec[1];
│ │ │ │ +
1317 options[0] = 0; // 0=default, 1=options are defined in [1]+[2]
│ │ │ │ +
1318#ifdef DEBUG_REPART
│ │ │ │ +
1319 options[1] = 3; // show info: 0=no message
│ │ │ │ +
1320#else
│ │ │ │ +
1321 options[1] = 0; // show info: 0=no message
│ │ │ │ +
1322#endif
│ │ │ │ +
1323 options[2] = 1; // random number seed, default is 15
│ │ │ │ +
1324 wgtflag = (ef.getWeights()!=NULL) ? 1 : 0;
│ │ │ │ +
1325 numflag = 0;
│ │ │ │ +
1326 edgecut = 0;
│ │ │ │ +
1327 ncon=1;
│ │ │ │ +
1328 ubvec[0]=1.05; // recommended by ParMETIS
│ │ │ │ +
1329
│ │ │ │ +
1330#ifdef DEBUG_REPART
│ │ │ │ +
1331 if (mype == 0) {
│ │ │ │ +
1332 std::cout<<std::endl;
│ │ │ │ +
1333 std::cout<<"Testing ParMETIS_V3_PartKway with options[1-2] = {"
│ │ │ │ +
1334 <<options[1]<<" "<<options[2]<<"}, Ncon: "
│ │ │ │ +
1335 <<ncon<<", Nparts: "<<nparts<<std::endl;
│ │ │ │ +
1336 }
│ │ │ │ +
1337#endif
│ │ │ │ +
1338#ifdef PERF_REPART
│ │ │ │ +
1339 // stop the time for step 1)
│ │ │ │ +
1340 t1=MPI_Wtime()-t1;
│ │ │ │ +
1341 // reset timer for step 2)
│ │ │ │ +
1342 t2=MPI_Wtime();
│ │ │ │ +
1343#endif
│ │ │ │ +
1344
│ │ │ │ +
1345 if(verbose) {
│ │ │ │ +
1346 oocomm.communicator().barrier();
│ │ │ │ +
1347 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1348 std::cout<<"Preparing for parmetis took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1349 }
│ │ │ │ +
1350 time.reset();
│ │ │ │ +
1351
│ │ │ │ +
1352 //=======================================================
│ │ │ │ +
1353 // ParMETIS_V3_PartKway
│ │ │ │ +
1354 //=======================================================
│ │ │ │ +
1355 ParMETIS_V3_PartKway(indexMap.vtxDist(), xadj, adjncy,
│ │ │ │ +
1356 NULL, ef.getWeights(), &wgtflag,
│ │ │ │ +
1357 &numflag, &ncon, &nparts, tpwgts, ubvec, options, &edgecut, part, &const_cast<MPI_Comm&>(comm));
│ │ │ │ +
1358
│ │ │ │ +
1359
│ │ │ │ +
1360 delete[] xadj;
│ │ │ │ +
1361 delete[] adjncy;
│ │ │ │ +
1362 delete[] tpwgts;
│ │ │ │ +
1363
│ │ │ │ +
1364 ef.free();
│ │ │ │ +
1365
│ │ │ │ +
1366#ifdef DEBUG_REPART
│ │ │ │ +
1367 if (mype == 0) {
│ │ │ │ +
1368 std::cout<<std::endl;
│ │ │ │ +
1369 std::cout<<"ParMETIS_V3_PartKway reported a cut of "<<edgecut<<std::endl;
│ │ │ │ +
1370 std::cout<<std::endl;
│ │ │ │ +
1371 }
│ │ │ │ +
1372 std::cout<<mype<<": PARMETIS-Result: ";
│ │ │ │ +
1373 for(int i=0; i < indexMap.vtxDist()[mype+1]-indexMap.vtxDist()[mype]; ++i) {
│ │ │ │ +
1374 std::cout<<part[i]<<" ";
│ │ │ │ +
1375 }
│ │ │ │ +
1376 std::cout<<std::endl;
│ │ │ │ +
1377 std::cout<<"Testing ParMETIS_V3_PartKway with options[1-2] = {"
│ │ │ │ +
1378 <<options[1]<<" "<<options[2]<<"}, Ncon: "
│ │ │ │ +
1379 <<ncon<<", Nparts: "<<nparts<<std::endl;
│ │ │ │ +
1380#endif
│ │ │ │ +
1381#ifdef PERF_REPART
│ │ │ │ +
1382 // stop the time for step 2)
│ │ │ │ +
1383 t2=MPI_Wtime()-t2;
│ │ │ │ +
1384 // reset timer for step 3)
│ │ │ │ +
1385 t3=MPI_Wtime();
│ │ │ │ +
1386#endif
│ │ │ │ +
1387
│ │ │ │ +
1388
│ │ │ │ +
1389 if(verbose) {
│ │ │ │ +
1390 oocomm.communicator().barrier();
│ │ │ │ +
1391 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1392 std::cout<<"Parmetis took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1393 }
│ │ │ │ +
1394 time.reset();
│ │ │ │ +
1395 }else
│ │ │ │ +
1396#endif
│ │ │ │ +
1397 {
│ │ │ │ +
1398 // Everything goes to process 0!
│ │ │ │ +
1399 for(std::size_t i=0; i<indexMap.numOfOwnVtx(); ++i)
│ │ │ │ +
1400 part[i]=0;
│ │ │ │ +
1401 }
│ │ │ │ +
1402
│ │ │ │ +
1403
│ │ │ │ +
1404 //
│ │ │ │ +
1405 // 3) Find a optimal domain based on the ParMETIS repartitioning
│ │ │ │ +
1406 // result
│ │ │ │ +
1407 //
│ │ │ │ +
1408
│ │ │ │ +
1409 std::vector<int> domainMapping(nparts);
│ │ │ │ +
1410 if(nparts>1)
│ │ │ │ +
1411 getDomain(comm, part, indexMap.numOfOwnVtx(), nparts, &myDomain, domainMapping);
│ │ │ │ +
1412 else
│ │ │ │ +
1413 domainMapping[0]=0;
│ │ │ │ +
1414
│ │ │ │ +
1415#ifdef DEBUG_REPART
│ │ │ │ +
1416 std::cout<<mype<<": myDomain: "<<myDomain<<std::endl;
│ │ │ │ +
1417 std::cout<<mype<<": DomainMapping: ";
│ │ │ │ +
1418 for(auto j : range(nparts)) {
│ │ │ │ +
1419 std::cout<<" do: "<<j<<" pe: "<<domainMapping[j]<<" ";
│ │ │ │ +
1420 }
│ │ │ │ +
1421 std::cout<<std::endl;
│ │ │ │ +
1422#endif
│ │ │ │ +
1423
│ │ │ │ +
1424 // Make a domain mapping for the indexset and translate
│ │ │ │ +
1425 //domain number to real process number
│ │ │ │ +
1426 // domainMapping is the one of parmetis, that is without
│ │ │ │ +
1427 // the overlap/copy vertices
│ │ │ │ +
1428 std::vector<int> setPartition(oocomm.indexSet().size(), -1);
│ │ │ │ +
1429
│ │ │ │ +
1430 std::size_t i=0; // parmetis index
│ │ │ │ +
1431 for(auto index = oocomm.indexSet().begin(); index != oocomm.indexSet().end(); ++index)
│ │ │ │ +
1432 if(OwnerSet::contains(index->local().attribute())) {
│ │ │ │ +
1433 setPartition[index->local()]=domainMapping[part[i++]];
│ │ │ │ +
1434 }
│ │ │ │ +
1435
│ │ │ │ +
1436 delete[] part;
│ │ │ │ +
1437 oocomm.copyOwnerToAll(setPartition, setPartition);
│ │ │ │ +
1438 // communication only needed for ALU
│ │ │ │ +
1439 // (ghosts with same global id as owners on the same process)
│ │ │ │ +
1440 if (SolverCategory::category(oocomm) ==
│ │ │ │ +
1441 static_cast<int>(SolverCategory::nonoverlapping))
│ │ │ │ +
1442 oocomm.copyCopyToAll(setPartition, setPartition);
│ │ │ │ +
1443 bool ret = buildCommunication(graph, setPartition, oocomm, outcomm, redistInf,
│ │ │ │ +
1444 verbose);
│ │ │ │ +
1445 if(verbose) {
│ │ │ │ +
1446 oocomm.communicator().barrier();
│ │ │ │ +
1447 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1448 std::cout<<"Creating indexsets took "<<time.elapsed()<<std::endl;
│ │ │ │ +
1449 }
│ │ │ │ +
1450 return ret;
│ │ │ │ +
1451 }
│ │ │ │ +
│ │ │ │ +
1452
│ │ │ │ +
1453
│ │ │ │ +
1454
│ │ │ │ +
1455 template<class G, class T1, class T2>
│ │ │ │ +
│ │ │ │ +
1456 bool buildCommunication(const G& graph,
│ │ │ │ +
1457 std::vector<int>& setPartition, Dune::OwnerOverlapCopyCommunication<T1,T2>& oocomm,
│ │ │ │ +
1458 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ │ +
1459 RedistributeInterface& redistInf,
│ │ │ │ +
1460 bool verbose)
│ │ │ │ +
1461 {
│ │ │ │ +
1462 typedef typename Dune::OwnerOverlapCopyCommunication<T1,T2> OOComm;
│ │ │ │ +
1463 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ │ +
1464
│ │ │ │ +
1465 Timer time;
│ │ │ │ +
1466
│ │ │ │ +
1467 // Build the send interface
│ │ │ │ +
1468 redistInf.buildSendInterface<OwnerSet>(setPartition, oocomm.indexSet());
│ │ │ │ +
1469
│ │ │ │ +
1470#ifdef PERF_REPART
│ │ │ │ +
1471 // stop the time for step 3)
│ │ │ │ +
1472 t3=MPI_Wtime()-t3;
│ │ │ │ +
1473 // reset timer for step 4)
│ │ │ │ +
1474 t4=MPI_Wtime();
│ │ │ │ +
1475#endif
│ │ │ │ +
1476
│ │ │ │ +
1477
│ │ │ │ +
1478 //
│ │ │ │ +
1479 // 4) Create the output IndexSet and RemoteIndices
│ │ │ │ +
1480 // 4.1) Determine the "send to" and "receive from" relation
│ │ │ │ +
1481 // according to the new partition using a MPI ring
│ │ │ │ +
1482 // communication.
│ │ │ │ +
1483 //
│ │ │ │ +
1484 // 4.2) Depends on the "send to" and "receive from" vector,
│ │ │ │ +
1485 // the processes will exchange the vertices each other
│ │ │ │ +
1486 //
│ │ │ │ +
1487 // 4.3) Create the IndexSet, RemoteIndices and the new MPI
│ │ │ │ +
1488 // communicator
│ │ │ │ +
1489 //
│ │ │ │ +
1490
│ │ │ │ +
1491 //
│ │ │ │ +
1492 // 4.1) Let's start...
│ │ │ │ +
1493 //
│ │ │ │ +
1494 int npes = oocomm.communicator().size();
│ │ │ │ +
1495 int *sendTo = 0;
│ │ │ │ +
1496 int noSendTo = 0;
│ │ │ │ +
1497 std::set<int> recvFrom;
│ │ │ │ +
1498
│ │ │ │ +
1499 // the max number of vertices is stored in the sendTo buffer,
│ │ │ │ +
1500 // not the number of vertices to send! Because the max number of Vtx
│ │ │ │ +
1501 // is used as the fixed buffer size by the MPI send/receive calls
│ │ │ │ +
1502
│ │ │ │ +
1503 int mype = oocomm.communicator().rank();
│ │ │ │ +
1504
│ │ │ │ +
1505 {
│ │ │ │ +
1506 std::set<int> tsendTo;
│ │ │ │ +
1507 for(auto i=setPartition.begin(), iend = setPartition.end(); i!=iend; ++i)
│ │ │ │ +
1508 tsendTo.insert(*i);
│ │ │ │ +
1509
│ │ │ │ +
1510 noSendTo = tsendTo.size();
│ │ │ │ +
1511 sendTo = new int[noSendTo];
│ │ │ │ +
1512 int idx=0;
│ │ │ │ +
1513 for(auto i=tsendTo.begin(); i != tsendTo.end(); ++i, ++idx)
│ │ │ │ +
1514 sendTo[idx]=*i;
│ │ │ │ +
1515 }
│ │ │ │ +
1516
│ │ │ │ +
1517 //
│ │ │ │ +
1518 int* gnoSend= new int[oocomm.communicator().size()];
│ │ │ │ +
1519 int* gsendToDispl = new int[oocomm.communicator().size()+1];
│ │ │ │ +
1520
│ │ │ │ +
1521 MPI_Allgather(&noSendTo, 1, MPI_INT, gnoSend, 1,
│ │ │ │ +
1522 MPI_INT, oocomm.communicator());
│ │ │ │ +
1523
│ │ │ │ +
1524 // calculate total receive message size
│ │ │ │ +
1525 int totalNoRecv = 0;
│ │ │ │ +
1526 for(int i=0; i<npes; ++i)
│ │ │ │ +
1527 totalNoRecv += gnoSend[i];
│ │ │ │ +
1528
│ │ │ │ +
1529 int *gsendTo = new int[totalNoRecv];
│ │ │ │ +
1530
│ │ │ │ +
1531 // calculate displacement for allgatherv
│ │ │ │ +
1532 gsendToDispl[0]=0;
│ │ │ │ +
1533 for(int i=0; i<npes; ++i)
│ │ │ │ +
1534 gsendToDispl[i+1]=gsendToDispl[i]+gnoSend[i];
│ │ │ │ +
1535
│ │ │ │ +
1536 // gather the data
│ │ │ │ +
1537 MPI_Allgatherv(sendTo, noSendTo, MPI_INT, gsendTo, gnoSend, gsendToDispl,
│ │ │ │ +
1538 MPI_INT, oocomm.communicator());
│ │ │ │ +
1539
│ │ │ │ +
1540 // Extract from which processes we will receive data
│ │ │ │ +
1541 for(int proc=0; proc < npes; ++proc)
│ │ │ │ +
1542 for(int i=gsendToDispl[proc]; i < gsendToDispl[proc+1]; ++i)
│ │ │ │ +
1543 if(gsendTo[i]==mype)
│ │ │ │ +
1544 recvFrom.insert(proc);
│ │ │ │ +
1545
│ │ │ │ +
1546 bool existentOnNextLevel = recvFrom.size()>0;
│ │ │ │ +
1547
│ │ │ │ +
1548 // Delete memory
│ │ │ │ +
1549 delete[] gnoSend;
│ │ │ │ +
1550 delete[] gsendToDispl;
│ │ │ │ +
1551 delete[] gsendTo;
│ │ │ │ +
1552
│ │ │ │ +
1553
│ │ │ │ +
1554#ifdef DEBUG_REPART
│ │ │ │ +
1555 if(recvFrom.size()) {
│ │ │ │ +
1556 std::cout<<mype<<": recvFrom: ";
│ │ │ │ +
1557 for(auto i=recvFrom.begin(); i!= recvFrom.end(); ++i) {
│ │ │ │ +
1558 std::cout<<*i<<" ";
│ │ │ │ +
1559 }
│ │ │ │ +
1560 }
│ │ │ │ +
1561
│ │ │ │ +
1562 std::cout<<std::endl<<std::endl;
│ │ │ │ +
1563 std::cout<<mype<<": sendTo: ";
│ │ │ │ +
1564 for(int i=0; i<noSendTo; i++) {
│ │ │ │ +
1565 std::cout<<sendTo[i]<<" ";
│ │ │ │ +
1566 }
│ │ │ │ +
1567 std::cout<<std::endl<<std::endl;
│ │ │ │ +
1568#endif
│ │ │ │ +
1569
│ │ │ │ +
1570 if(verbose)
│ │ │ │ +
1571 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1572 std::cout<<" Communicating the receive information took "<<
│ │ │ │ +
1573 time.elapsed()<<std::endl;
│ │ │ │ +
1574 time.reset();
│ │ │ │ +
1575
│ │ │ │ +
1576 //
│ │ │ │ +
1577 // 4.2) Start the communication
│ │ │ │ +
1578 //
│ │ │ │ +
1579
│ │ │ │ +
1580 // Get all the owner and overlap vertices for myself ans save
│ │ │ │ +
1581 // it in the vectors myOwnerVec and myOverlapVec.
│ │ │ │ +
1582 // The received vertices from the other processes are simple
│ │ │ │ +
1583 // added to these vector.
│ │ │ │ +
1584 //
│ │ │ │ +
1585
│ │ │ │ +
1586
│ │ │ │ +
1587 typedef typename OOComm::ParallelIndexSet::GlobalIndex GI;
│ │ │ │ +
1588 typedef std::vector<GI> GlobalVector;
│ │ │ │ +
1589 std::vector<std::pair<GI,int> > myOwnerVec;
│ │ │ │ +
1590 std::set<GI> myOverlapSet;
│ │ │ │ +
1591 GlobalVector sendOwnerVec;
│ │ │ │ +
1592 std::set<GI> sendOverlapSet;
│ │ │ │ +
1593 std::set<int> myNeighbors;
│ │ │ │ +
1594
│ │ │ │ +
1595 // getOwnerOverlapVec<OwnerSet>(graph, setPartition, oocomm.globalLookup(),
│ │ │ │ +
1596 // mype, mype, myOwnerVec, myOverlapSet, redistInf, myNeighbors);
│ │ │ │ +
1597
│ │ │ │ +
1598 char **sendBuffers=new char*[noSendTo];
│ │ │ │ +
1599 MPI_Request *requests = new MPI_Request[noSendTo];
│ │ │ │ +
1600
│ │ │ │ +
1601 // Create all messages to be sent
│ │ │ │ +
1602 for(int i=0; i < noSendTo; ++i) {
│ │ │ │ +
1603 // clear the vector for sending
│ │ │ │ +
1604 sendOwnerVec.clear();
│ │ │ │ +
1605 sendOverlapSet.clear();
│ │ │ │ +
1606 // get all owner and overlap vertices for process j and save these
│ │ │ │ +
1607 // in the vectors sendOwnerVec and sendOverlapSet
│ │ │ │ +
1608 std::set<int> neighbors;
│ │ │ │ +
1609 getOwnerOverlapVec<OwnerSet>(graph, setPartition, oocomm.globalLookup(),
│ │ │ │ +
1610 mype, sendTo[i], sendOwnerVec, sendOverlapSet, redistInf,
│ │ │ │ +
1611 neighbors);
│ │ │ │ +
1612 // +2, we need 2 integer more for the length of each part
│ │ │ │ +
1613 // (owner/overlap) of the array
│ │ │ │ +
1614 int buffersize=0;
│ │ │ │ +
1615 int tsize;
│ │ │ │ +
1616 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &buffersize);
│ │ │ │ +
1617 MPI_Pack_size(sendOwnerVec.size(), MPITraits<GI>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ +
1618 buffersize +=tsize;
│ │ │ │ +
1619 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ +
1620 buffersize +=tsize;
│ │ │ │ +
1621 MPI_Pack_size(sendOverlapSet.size(), MPITraits<GI>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ +
1622 buffersize += tsize;
│ │ │ │ +
1623 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &tsize);
│ │ │ │ +
1624 buffersize += tsize;
│ │ │ │ +
1625 MPI_Pack_size(neighbors.size(), MPI_INT, oocomm.communicator(), &tsize);
│ │ │ │ +
1626 buffersize += tsize;
│ │ │ │ +
1627
│ │ │ │ +
1628 sendBuffers[i] = new char[buffersize];
│ │ │ │ +
1629
│ │ │ │ +
1630#ifdef DEBUG_REPART
│ │ │ │ +
1631 std::cout<<mype<<" sending "<<sendOwnerVec.size()<<" owner and "<<
│ │ │ │ +
1632 sendOverlapSet.size()<<" overlap to "<<sendTo[i]<<" buffersize="<<buffersize<<std::endl;
│ │ │ │ +
1633#endif
│ │ │ │ +
1634 createSendBuf(sendOwnerVec, sendOverlapSet, neighbors, sendBuffers[i], buffersize, oocomm.communicator());
│ │ │ │ +
1635 MPI_Issend(sendBuffers[i], buffersize, MPI_PACKED, sendTo[i], 99, oocomm.communicator(), requests+i);
│ │ │ │ +
1636 }
│ │ │ │ +
1637
│ │ │ │ +
1638 if(verbose) {
│ │ │ │ +
1639 oocomm.communicator().barrier();
│ │ │ │ +
1640 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1641 std::cout<<" Creating sends took "<<
│ │ │ │ +
1642 time.elapsed()<<std::endl;
│ │ │ │ +
1643 }
│ │ │ │ +
1644 time.reset();
│ │ │ │ +
1645
│ │ │ │ +
1646 // Receive Messages
│ │ │ │ +
1647 int noRecv = recvFrom.size();
│ │ │ │ +
1648 int oldbuffersize=0;
│ │ │ │ +
1649 char* recvBuf = 0;
│ │ │ │ +
1650 while(noRecv>0) {
│ │ │ │ +
1651 // probe for an incoming message
│ │ │ │ +
1652 MPI_Status stat;
│ │ │ │ +
1653 MPI_Probe(MPI_ANY_SOURCE, 99, oocomm.communicator(), &stat);
│ │ │ │ +
1654 int buffersize;
│ │ │ │ +
1655 MPI_Get_count(&stat, MPI_PACKED, &buffersize);
│ │ │ │ +
1656
│ │ │ │ +
1657 if(oldbuffersize<buffersize) {
│ │ │ │ +
1658 // buffer too small, reallocate
│ │ │ │ +
1659 delete[] recvBuf;
│ │ │ │ +
1660 recvBuf = new char[buffersize];
│ │ │ │ +
1661 oldbuffersize = buffersize;
│ │ │ │ +
1662 }
│ │ │ │ +
1663 MPI_Recv(recvBuf, buffersize, MPI_PACKED, stat.MPI_SOURCE, 99, oocomm.communicator(), &stat);
│ │ │ │ +
1664 saveRecvBuf(recvBuf, buffersize, myOwnerVec, myOverlapSet, myNeighbors, redistInf,
│ │ │ │ +
1665 stat.MPI_SOURCE, oocomm.communicator());
│ │ │ │ +
1666 --noRecv;
│ │ │ │ +
1667 }
│ │ │ │ +
1668
│ │ │ │ +
1669 if(recvBuf)
│ │ │ │ +
1670 delete[] recvBuf;
│ │ │ │ +
1671
│ │ │ │ +
1672 time.reset();
│ │ │ │ +
1673 // Wait for sending messages to complete
│ │ │ │ +
1674 MPI_Status *statuses = new MPI_Status[noSendTo];
│ │ │ │ +
1675 int send = MPI_Waitall(noSendTo, requests, statuses);
│ │ │ │ +
1676
│ │ │ │ +
1677 // check for errors
│ │ │ │ +
1678 if(send==MPI_ERR_IN_STATUS) {
│ │ │ │ +
1679 std::cerr<<mype<<": Error in sending :"<<std::endl;
│ │ │ │ +
1680 // Search for the error
│ │ │ │ +
1681 for(int i=0; i< noSendTo; i++)
│ │ │ │ +
1682 if(statuses[i].MPI_ERROR!=MPI_SUCCESS) {
│ │ │ │ +
1683 char message[300];
│ │ │ │ +
1684 int messageLength;
│ │ │ │ +
1685 MPI_Error_string(statuses[i].MPI_ERROR, message, &messageLength);
│ │ │ │ +
1686 std::cerr<<" source="<<statuses[i].MPI_SOURCE<<" message: ";
│ │ │ │ +
1687 for(int j = 0; j < messageLength; j++)
│ │ │ │ +
1688 std::cout<<message[j];
│ │ │ │ +
1689 }
│ │ │ │ +
1690 std::cerr<<std::endl;
│ │ │ │ +
1691 }
│ │ │ │ +
1692
│ │ │ │ +
1693 if(verbose) {
│ │ │ │ +
1694 oocomm.communicator().barrier();
│ │ │ │ +
1695 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1696 std::cout<<" Receiving and saving took "<<
│ │ │ │ +
1697 time.elapsed()<<std::endl;
│ │ │ │ +
1698 }
│ │ │ │ +
1699 time.reset();
│ │ │ │ +
1700
│ │ │ │ +
1701 for(int i=0; i < noSendTo; ++i)
│ │ │ │ +
1702 delete[] sendBuffers[i];
│ │ │ │ +
1703
│ │ │ │ +
1704 delete[] sendBuffers;
│ │ │ │ +
1705 delete[] statuses;
│ │ │ │ +
1706 delete[] requests;
│ │ │ │ +
1707
│ │ │ │ +
1708 redistInf.setCommunicator(oocomm.communicator());
│ │ │ │ +
1709
│ │ │ │ +
1710 //
│ │ │ │ +
1711 // 4.2) Create the IndexSet etc.
│ │ │ │ +
1712 //
│ │ │ │ +
1713
│ │ │ │ +
1714 // build the new outputIndexSet
│ │ │ │ +
1715
│ │ │ │ +
1716
│ │ │ │ +
1717 int color=0;
│ │ │ │ +
1718
│ │ │ │ +
1719 if (!existentOnNextLevel) {
│ │ │ │ +
1720 // this process is not used anymore
│ │ │ │ +
1721 color= MPI_UNDEFINED;
│ │ │ │ +
1722 }
│ │ │ │ +
1723 MPI_Comm outputComm;
│ │ │ │ +
1724
│ │ │ │ +
1725 MPI_Comm_split(oocomm.communicator(), color, oocomm.communicator().rank(), &outputComm);
│ │ │ │ +
1726 outcomm = std::make_shared<OOComm>(outputComm,SolverCategory::category(oocomm),true);
│ │ │ │ +
1727
│ │ │ │ +
1728 // translate neighbor ranks.
│ │ │ │ +
1729 int newrank=outcomm->communicator().rank();
│ │ │ │ +
1730 int *newranks=new int[oocomm.communicator().size()];
│ │ │ │ +
1731 std::vector<int> tneighbors;
│ │ │ │ +
1732 tneighbors.reserve(myNeighbors.size());
│ │ │ │ +
1733
│ │ │ │ +
1734 typename OOComm::ParallelIndexSet& outputIndexSet = outcomm->indexSet();
│ │ │ │ +
1735
│ │ │ │ +
1736 MPI_Allgather(&newrank, 1, MPI_INT, newranks, 1,
│ │ │ │ +
1737 MPI_INT, oocomm.communicator());
│ │ │ │ +
1738
│ │ │ │ +
1739#ifdef DEBUG_REPART
│ │ │ │ +
1740 std::cout<<oocomm.communicator().rank()<<" ";
│ │ │ │ +
1741 for(auto i=myNeighbors.begin(), end=myNeighbors.end();
│ │ │ │ +
1742 i!=end; ++i) {
│ │ │ │ +
1743 assert(newranks[*i]>=0);
│ │ │ │ +
1744 std::cout<<*i<<"->"<<newranks[*i]<<" ";
│ │ │ │ +
1745 tneighbors.push_back(newranks[*i]);
│ │ │ │ +
1746 }
│ │ │ │ +
1747 std::cout<<std::endl;
│ │ │ │ +
1748#else
│ │ │ │ +
1749 for(auto i=myNeighbors.begin(), end=myNeighbors.end();
│ │ │ │ +
1750 i!=end; ++i) {
│ │ │ │ +
1751 tneighbors.push_back(newranks[*i]);
│ │ │ │ +
1752 }
│ │ │ │ +
1753#endif
│ │ │ │ +
1754 delete[] newranks;
│ │ │ │ +
1755 myNeighbors.clear();
│ │ │ │ +
1756
│ │ │ │ +
1757 if(verbose) {
│ │ │ │ +
1758 oocomm.communicator().barrier();
│ │ │ │ +
1759 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1760 std::cout<<" Calculating new neighbours ("<<tneighbors.size()<<") took "<<
│ │ │ │ +
1761 time.elapsed()<<std::endl;
│ │ │ │ +
1762 }
│ │ │ │ +
1763 time.reset();
│ │ │ │ +
1764
│ │ │ │ +
1765
│ │ │ │ +
1766 outputIndexSet.beginResize();
│ │ │ │ +
1767 // 1) add the owner vertices
│ │ │ │ +
1768 // Sort the owners
│ │ │ │ +
1769 std::sort(myOwnerVec.begin(), myOwnerVec.end(), SortFirst());
│ │ │ │ +
1770 // The owners are sorted according to there global index
│ │ │ │ +
1771 // Therefore the entries of ownerVec are the same as the
│ │ │ │ +
1772 // ones in the resulting index set.
│ │ │ │ +
1773 int i=0;
│ │ │ │ +
1774 using LocalIndexT = typename OOComm::ParallelIndexSet::LocalIndex;
│ │ │ │ +
1775 for(auto g=myOwnerVec.begin(), end =myOwnerVec.end(); g!=end; ++g, ++i ) {
│ │ │ │ +
1776 outputIndexSet.add(g->first,LocalIndexT(i, OwnerOverlapCopyAttributeSet::owner, true));
│ │ │ │ +
1777 redistInf.addReceiveIndex(g->second, i);
│ │ │ │ +
1778 }
│ │ │ │ +
1779
│ │ │ │ +
1780 if(verbose) {
│ │ │ │ +
1781 oocomm.communicator().barrier();
│ │ │ │ +
1782 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1783 std::cout<<" Adding owner indices took "<<
│ │ │ │ +
1784 time.elapsed()<<std::endl;
│ │ │ │ +
1785 }
│ │ │ │ +
1786 time.reset();
│ │ │ │ +
1787
│ │ │ │ +
1788
│ │ │ │ +
1789 // After all the vertices are received, the vectors must
│ │ │ │ +
1790 // be "merged" together to create the final vectors.
│ │ │ │ +
1791 // Because some vertices that are sent as overlap could now
│ │ │ │ +
1792 // already included as owner vertiecs in the new partition
│ │ │ │ +
1793 mergeVec(myOwnerVec, myOverlapSet);
│ │ │ │ +
1794
│ │ │ │ +
1795 // Trick to free memory
│ │ │ │ +
1796 myOwnerVec.clear();
│ │ │ │ +
1797 myOwnerVec.swap(myOwnerVec);
│ │ │ │ +
1798
│ │ │ │ +
1799 if(verbose) {
│ │ │ │ +
1800 oocomm.communicator().barrier();
│ │ │ │ +
1801 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1802 std::cout<<" Merging indices took "<<
│ │ │ │ +
1803 time.elapsed()<<std::endl;
│ │ │ │ +
1804 }
│ │ │ │ +
1805 time.reset();
│ │ │ │ +
1806
│ │ │ │ +
1807
│ │ │ │ +
1808 // 2) add the overlap vertices
│ │ │ │ +
1809 for(auto g=myOverlapSet.begin(), end=myOverlapSet.end(); g!=end; ++g, i++) {
│ │ │ │ +
1810 outputIndexSet.add(*g,LocalIndexT(i, OwnerOverlapCopyAttributeSet::copy, true));
│ │ │ │ +
1811 }
│ │ │ │ +
1812 myOverlapSet.clear();
│ │ │ │ +
1813 outputIndexSet.endResize();
│ │ │ │ +
1814
│ │ │ │ +
1815#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1816 int numOfOwnVtx =0;
│ │ │ │ +
1817 auto end = outputIndexSet.end();
│ │ │ │ +
1818 for(auto index = outputIndexSet.begin(); index != end; ++index) {
│ │ │ │ +
1819 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ │ +
1820 numOfOwnVtx++;
│ │ │ │ +
1821 }
│ │ │ │ +
1822 }
│ │ │ │ +
1823 numOfOwnVtx = oocomm.communicator().sum(numOfOwnVtx);
│ │ │ │ +
1824 // if(numOfOwnVtx!=indexMap.globalOwnerVertices)
│ │ │ │ +
1825 // {
│ │ │ │ +
1826 // std::cerr<<numOfOwnVtx<<"!="<<indexMap.globalOwnerVertices<<" owners missing or additional ones!"<<std::endl;
│ │ │ │ +
1827 // DUNE_THROW(ISTLError, numOfOwnVtx<<"!="<<indexMap.globalOwnerVertices<<" owners missing or additional ones"
│ │ │ │ +
1828 // <<" during repartitioning.");
│ │ │ │ +
1829 // }
│ │ │ │ +
1830 std::is_sorted(outputIndexSet.begin(), outputIndexSet.end(),
│ │ │ │ +
1831 [](const auto& v1, const auto& v2){ return v1.global() < v2.global();});
│ │ │ │ +
1832#endif
│ │ │ │ +
1833 if(verbose) {
│ │ │ │ +
1834 oocomm.communicator().barrier();
│ │ │ │ +
1835 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1836 std::cout<<" Adding overlap indices took "<<
│ │ │ │ +
1837 time.elapsed()<<std::endl;
│ │ │ │ +
1838 }
│ │ │ │ +
1839 time.reset();
│ │ │ │ +
1840
│ │ │ │ +
1841
│ │ │ │ +
1842 if(color != MPI_UNDEFINED) {
│ │ │ │ +
1843 outcomm->remoteIndices().setNeighbours(tneighbors);
│ │ │ │ +
1844 outcomm->remoteIndices().template rebuild<true>();
│ │ │ │ +
1845
│ │ │ │ +
1846 }
│ │ │ │ +
1847
│ │ │ │ +
1848 // release the memory
│ │ │ │ +
1849 delete[] sendTo;
│ │ │ │ +
1850
│ │ │ │ +
1851 if(verbose) {
│ │ │ │ +
1852 oocomm.communicator().barrier();
│ │ │ │ +
1853 if(oocomm.communicator().rank()==0)
│ │ │ │ +
1854 std::cout<<" Storing indexsets took "<<
│ │ │ │ +
1855 time.elapsed()<<std::endl;
│ │ │ │ +
1856 }
│ │ │ │ +
1857
│ │ │ │ +
1858#ifdef PERF_REPART
│ │ │ │ +
1859 // stop the time for step 4) and print the results
│ │ │ │ +
1860 t4=MPI_Wtime()-t4;
│ │ │ │ +
1861 tSum = t1 + t2 + t3 + t4;
│ │ │ │ +
1862 std::cout<<std::endl
│ │ │ │ +
1863 <<mype<<": WTime for step 1): "<<t1
│ │ │ │ +
1864 <<" 2): "<<t2
│ │ │ │ +
1865 <<" 3): "<<t3
│ │ │ │ +
1866 <<" 4): "<<t4
│ │ │ │ +
1867 <<" total: "<<tSum
│ │ │ │ +
1868 <<std::endl;
│ │ │ │ +
1869#endif
│ │ │ │ +
1870
│ │ │ │ +
1871 return color!=MPI_UNDEFINED;
│ │ │ │ +
1872
│ │ │ │ +
1873 }
│ │ │ │ +
│ │ │ │ +
1874#else
│ │ │ │ +
1875 template<class G, class P,class T1, class T2, class R>
│ │ │ │ +
1876 bool graphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ │ +
1877 std::shared_ptr<P>& outcomm,
│ │ │ │ +
1878 R& redistInf,
│ │ │ │ +
1879 bool v=false)
│ │ │ │ +
1880 {
│ │ │ │ +
1881 if(nparts!=oocomm.size())
│ │ │ │ +
1882 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ │ +
1883 }
│ │ │ │ +
1884
│ │ │ │ +
1885
│ │ │ │ +
1886 template<class G, class P,class T1, class T2, class R>
│ │ │ │ +
1887 bool commGraphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ │ +
1888 std::shared_ptr<P>& outcomm,
│ │ │ │ +
1889 R& redistInf,
│ │ │ │ +
1890 bool v=false)
│ │ │ │ +
1891 {
│ │ │ │ +
1892 if(nparts!=oocomm.size())
│ │ │ │ +
1893 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ │ +
1894 }
│ │ │ │ +
1895#endif // HAVE_MPI
│ │ │ │ +
1896} // end of namespace Dune
│ │ │ │ +
1897#endif
│ │ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ +
int globalOwnerVertices
Definition repartition.hh:175
│ │ │ │ +
Provides classes for building the matrix graph.
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ -
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │ -
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ +
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:1456
│ │ │ │ +
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:829
│ │ │ │ +
void print_carray(S &os, T *array, std::size_t l)
Definition repartition.hh:778
│ │ │ │ +
bool isValidGraph(std::size_t noVtx, std::size_t gnoVtx, S noEdges, T *xadj, T *adjncy, bool checkSymmetry)
Definition repartition.hh:785
│ │ │ │ +
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:1235
│ │ │ │ +
float real_t
Definition repartition.hh:53
│ │ │ │ +
std::size_t idx_t
Definition repartition.hh:63
│ │ │ │ +
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ │
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ -
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
│ │ │ │ +
const GlobalLookupIndexSet & globalLookup() const
Definition owneroverlapcopy.hh:526
│ │ │ │ +
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:462
│ │ │ │ +
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ │ +
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ │ +
void buildGlobalLookup()
Definition owneroverlapcopy.hh:495
│ │ │ │ +
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ │ +
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ +
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ │ +
void freeGlobalLookup()
Definition owneroverlapcopy.hh:520
│ │ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ │ +
Definition repartition.hh:260
│ │ │ │ +
void reserveSpaceForReceiveInterface(int proc, int size)
Definition repartition.hh:284
│ │ │ │ +
void buildReceiveInterface(std::vector< std::pair< TG, int > > &indices)
Definition repartition.hh:293
│ │ │ │ +
~RedistributeInterface()
Definition repartition.hh:301
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,300 +1,1986 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -construction.hh │ │ │ │ │ +repartition.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 (C) 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_AMGCONSTRUCTION_HH │ │ │ │ │ -6#define DUNE_AMGCONSTRUCTION_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_REPARTITION_HH │ │ │ │ │ +6#define DUNE_ISTL_REPARTITION_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ -9#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ │ -10#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ │ -12#include "_p_i_n_f_o_._h_h" │ │ │ │ │ -13 │ │ │ │ │ -14namespace _D_u_n_e │ │ │ │ │ -15{ │ │ │ │ │ -16 namespace Amg │ │ │ │ │ -17 { │ │ │ │ │ -18 │ │ │ │ │ -37 template │ │ │ │ │ -38 struct ConstructionTraits │ │ │ │ │ -39 { │ │ │ │ │ -_4_4 typedef const void* _A_r_g_u_m_e_n_t_s; │ │ │ │ │ -45 │ │ │ │ │ -_5_2 static inline std::shared_ptr _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ -53 { │ │ │ │ │ -54 return std::make_shared(); │ │ │ │ │ -55 } │ │ │ │ │ -56 }; │ │ │ │ │ -57 │ │ │ │ │ -58 template │ │ │ │ │ -_5_9 struct ConstructionTraits<_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ │ -60 { │ │ │ │ │ -_6_1 typedef const int _A_r_g_u_m_e_n_t_s; │ │ │ │ │ -_6_2 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& n) │ │ │ │ │ -63 { │ │ │ │ │ -64 return std::make_shared>(n); │ │ │ │ │ +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". Therfore no nested extern "C" will be created │ │ │ │ │ +17extern "C" │ │ │ │ │ +18{ │ │ │ │ │ +19#include │ │ │ │ │ +20} │ │ │ │ │ +21#endif │ │ │ │ │ +22 │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26#include │ │ │ │ │ +27#include │ │ │ │ │ +28#include │ │ │ │ │ +29#include │ │ │ │ │ +30#include │ │ │ │ │ +31#include │ │ │ │ │ +32 │ │ │ │ │ +33#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ │ +34#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ │ +35 │ │ │ │ │ +44namespace _D_u_n_e │ │ │ │ │ +45{ │ │ │ │ │ +_4_6 namespace Metis │ │ │ │ │ +47 { │ │ │ │ │ +48 // Explicitly specify a real_t and idx_t for older (Par)METIS versions that │ │ │ │ │ +do not │ │ │ │ │ +49 // provide these typedefs │ │ │ │ │ +50#if HAVE_PARMETIS && defined(REALTYPEWIDTH) │ │ │ │ │ +51 using _r_e_a_l___t = _:_:_r_e_a_l___t; │ │ │ │ │ +52#else │ │ │ │ │ +_5_3 using _r_e_a_l___t = float; │ │ │ │ │ +54#endif │ │ │ │ │ +55 │ │ │ │ │ +56#if HAVE_PARMETIS && defined(IDXTYPEWIDTH) │ │ │ │ │ +57 using _i_d_x___t = _:_:_i_d_x___t; │ │ │ │ │ +58#elif HAVE_PARMETIS && defined(HAVE_SCOTCH_NUM_TYPE) │ │ │ │ │ +59 using _i_d_x___t = SCOTCH_Num; │ │ │ │ │ +60#elif HAVE_PARMETIS │ │ │ │ │ +61 using _i_d_x___t = int; │ │ │ │ │ +62#else │ │ │ │ │ +_6_3 using _i_d_x___t = std::size_t; │ │ │ │ │ +64#endif │ │ │ │ │ 65 } │ │ │ │ │ -66 }; │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ -_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 │ │ │ │ │ +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; i │ │ │ │ │ -104 class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r; │ │ │ │ │ -105 │ │ │ │ │ -106 template │ │ │ │ │ -107 class _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r; │ │ │ │ │ -108 │ │ │ │ │ -109 namespace Amg │ │ │ │ │ -110 { │ │ │ │ │ -111 template │ │ │ │ │ -_1_1_2 struct ConstructionTraits<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r > │ │ │ │ │ -113 { │ │ │ │ │ -_1_1_4 typedef _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ │ -115 │ │ │ │ │ -_1_1_6 static inline std::shared_ptr> │ │ │ │ │ -_c_o_n_s_t_r_u_c_t(const _A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ -117 { │ │ │ │ │ -118 return std::make_shared> │ │ │ │ │ -119 (args._m_a_t_r_i_x__, args._c_o_m_m__); │ │ │ │ │ -120 } │ │ │ │ │ -121 }; │ │ │ │ │ -122 │ │ │ │ │ -123 template │ │ │ │ │ -_1_2_4 struct ConstructionTraits<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r > │ │ │ │ │ -125 { │ │ │ │ │ -_1_2_6 typedef _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ │ -127 │ │ │ │ │ -_1_2_8 static inline std::shared_ptr> │ │ │ │ │ -_c_o_n_s_t_r_u_c_t(const _A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ -129 { │ │ │ │ │ -130 return std::make_shared> │ │ │ │ │ -131 (args._m_a_t_r_i_x__, args._c_o_m_m__); │ │ │ │ │ -132 } │ │ │ │ │ -133 }; │ │ │ │ │ +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._c_o_m_m_u_n_i_c_a_t_o_r().max(maxgi); │ │ │ │ │ +112 ++maxgi; //Sart with the next free index. │ │ │ │ │ +113 │ │ │ │ │ +114 for(int i=0; i > > globalIndices; │ │ │ │ │ +119 storeGlobalIndicesOfRemoteIndices(globalIndices, oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s()); │ │ │ │ │ +120 indexSet.beginResize(); │ │ │ │ │ +121 │ │ │ │ │ +122 for(auto vertex = graph.begin(), vend=graph.end(); vertex != vend; │ │ │ │ │ +++vertex) { │ │ │ │ │ +123 const typename IndexSet::IndexPair* pair=lookup.pair(*vertex); │ │ │ │ │ +124 if(pair==0) { │ │ │ │ │ +125 // No index yet, add new one │ │ │ │ │ +126 indexSet.add(maxgi, typename IndexSet::LocalIndex(*vertex, │ │ │ │ │ +_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r, false)); │ │ │ │ │ +127 ++maxgi; │ │ │ │ │ +128 } │ │ │ │ │ +129 } │ │ │ │ │ +130 │ │ │ │ │ +131 indexSet.endResize(); │ │ │ │ │ +132 │ │ │ │ │ +133 repairLocalIndexPointers(globalIndices, oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s(), indexSet); │ │ │ │ │ 134 │ │ │ │ │ -135 template │ │ │ │ │ -_1_3_6 struct _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s │ │ │ │ │ -137 { │ │ │ │ │ -_1_3_8 _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s(std::shared_ptr matrix, const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n) │ │ │ │ │ -139 : _m_a_t_r_i_x__(matrix) │ │ │ │ │ -140 {} │ │ │ │ │ -141 │ │ │ │ │ -_1_4_2 std::shared_ptr _m_a_t_r_i_x__; │ │ │ │ │ -143 }; │ │ │ │ │ -144 │ │ │ │ │ -145 template │ │ │ │ │ -_1_4_6 struct ConstructionTraits<_M_a_t_r_i_x_A_d_a_p_t_e_r > │ │ │ │ │ +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!"< _A_r_g_u_m_e_n_t_s; │ │ │ │ │ -149 │ │ │ │ │ -_1_5_0 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& │ │ │ │ │ -args) │ │ │ │ │ -151 { │ │ │ │ │ -152 return std::make_shared>(args._m_a_t_r_i_x__); │ │ │ │ │ -153 } │ │ │ │ │ -154 }; │ │ │ │ │ -155 │ │ │ │ │ -156 template<> │ │ │ │ │ -_1_5_7 struct ConstructionTraits<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ │ -158 { │ │ │ │ │ -_1_5_9 typedef const _S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s _A_r_g_u_m_e_n_t_s; │ │ │ │ │ -_1_6_0 static inline std::shared_ptr _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& │ │ │ │ │ -args) │ │ │ │ │ -161 { │ │ │ │ │ -162 return std::make_shared(args._c_o_m_m__); │ │ │ │ │ -163 } │ │ │ │ │ -164 }; │ │ │ │ │ -165 │ │ │ │ │ -166 │ │ │ │ │ -167#if HAVE_MPI │ │ │ │ │ -168 │ │ │ │ │ -169 template │ │ │ │ │ -_1_7_0 struct ConstructionTraits<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n > │ │ │ │ │ -171 { │ │ │ │ │ -_1_7_2 typedef const _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s _A_r_g_u_m_e_n_t_s; │ │ │ │ │ -173 │ │ │ │ │ -_1_7_4 static inline std::shared_ptr> │ │ │ │ │ -_c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ -175 { │ │ │ │ │ -176 return std::make_shared>(args._c_o_m_m__, │ │ │ │ │ -args._c_a_t__); │ │ │ │ │ -177 } │ │ │ │ │ -178 }; │ │ │ │ │ -179 │ │ │ │ │ -180#endif │ │ │ │ │ -181 │ │ │ │ │ -183 } // namespace Amg │ │ │ │ │ -184} // namespace Dune │ │ │ │ │ -185#endif │ │ │ │ │ +148 public: │ │ │ │ │ +149 template │ │ │ │ │ +150 ParmetisDuneIndexMap(const Graph& graph, const OOComm& com); │ │ │ │ │ +151 int toParmetis(int i) const │ │ │ │ │ +152 { │ │ │ │ │ +153 return duneToParmetis[i]; │ │ │ │ │ +154 } │ │ │ │ │ +155 int toLocalParmetis(int i) const │ │ │ │ │ +156 { │ │ │ │ │ +157 return duneToParmetis[i]-base_; │ │ │ │ │ +158 } │ │ │ │ │ +159 int operator[](int i) const │ │ │ │ │ +160 { │ │ │ │ │ +161 return duneToParmetis[i]; │ │ │ │ │ +162 } │ │ │ │ │ +163 int toDune(int i) const │ │ │ │ │ +164 { │ │ │ │ │ +165 return parmetisToDune[i]; │ │ │ │ │ +166 } │ │ │ │ │ +167 std::vector::size_type numOfOwnVtx() const │ │ │ │ │ +168 { │ │ │ │ │ +169 return parmetisToDune.size(); │ │ │ │ │ +170 } │ │ │ │ │ +171 _M_e_t_i_s_:_:_i_d_x___t* vtxDist() │ │ │ │ │ +172 { │ │ │ │ │ +173 return &vtxDist_[0]; │ │ │ │ │ +174 } │ │ │ │ │ +_1_7_5 int _g_l_o_b_a_l_O_w_n_e_r_V_e_r_t_i_c_e_s; │ │ │ │ │ +176 private: │ │ │ │ │ +177 int base_; │ │ │ │ │ +178 std::vector duneToParmetis; │ │ │ │ │ +179 std::vector parmetisToDune; │ │ │ │ │ +180 // range of vertices for processor i: vtxdist[i] to vtxdist[i+1] (parmetis │ │ │ │ │ +global) │ │ │ │ │ +181 std::vector vtxDist_; │ │ │ │ │ +182 }; │ │ │ │ │ +183 │ │ │ │ │ +184 template │ │ │ │ │ +185 ParmetisDuneIndexMap::ParmetisDuneIndexMap(const G& graph, const OOComm& │ │ │ │ │ +oocomm) │ │ │ │ │ +186 : duneToParmetis(graph.noVertices(), -1), vtxDist_(oocomm.communicator │ │ │ │ │ +().size()+1) │ │ │ │ │ +187 { │ │ │ │ │ +188 int npes=oocomm.communicator().size(), mype=oocomm.communicator().rank(); │ │ │ │ │ +189 │ │ │ │ │ +190 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ │ +191 │ │ │ │ │ +192 int numOfOwnVtx=0; │ │ │ │ │ +193 auto end = oocomm.indexSet().end(); │ │ │ │ │ +194 for(auto index = oocomm.indexSet().begin(); index != end; ++index) { │ │ │ │ │ +195 if (OwnerSet::contains(index->local().attribute())) { │ │ │ │ │ +196 numOfOwnVtx++; │ │ │ │ │ +197 } │ │ │ │ │ +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; ilocal().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 │ │ │ │ │ +_3_0_1 _~_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e() │ │ │ │ │ +302 {} │ │ │ │ │ +303 │ │ │ │ │ +304 }; │ │ │ │ │ +305 │ │ │ │ │ +306 namespace │ │ │ │ │ +307 { │ │ │ │ │ +317 template │ │ │ │ │ +318 void createSendBuf(std::vector& ownerVec, std::set& overlapVec, │ │ │ │ │ +std::set& neighbors, char *sendBuf, int buffersize, MPI_Comm comm) { │ │ │ │ │ +319 // Pack owner vertices │ │ │ │ │ +320 std::size_t s=ownerVec.size(); │ │ │ │ │ +321 int pos=0; │ │ │ │ │ +322 if(s==0) │ │ │ │ │ +323 ownerVec.resize(1); // otherwise would read beyond the memory bound │ │ │ │ │ +324 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ +&pos, comm); │ │ │ │ │ +325 MPI_Pack(&(ownerVec[0]), s, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ +&pos, comm); │ │ │ │ │ +326 s = overlapVec.size(); │ │ │ │ │ +327 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ +&pos, comm); │ │ │ │ │ +328 for(auto i=overlapVec.begin(), end= overlapVec.end(); i != end; ++i) │ │ │ │ │ +329 MPI_Pack(const_cast(&(*i)), 1, MPITraits::getType(), sendBuf, │ │ │ │ │ +buffersize, &pos, comm); │ │ │ │ │ +330 │ │ │ │ │ +331 s=neighbors.size(); │ │ │ │ │ +332 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ │ +&pos, comm); │ │ │ │ │ +333 │ │ │ │ │ +334 for(auto i=neighbors.begin(), end= neighbors.end(); i != end; ++i) │ │ │ │ │ +335 MPI_Pack(const_cast(&(*i)), 1, MPI_INT, sendBuf, buffersize, &pos, │ │ │ │ │ +comm); │ │ │ │ │ +336 } │ │ │ │ │ +345 template │ │ │ │ │ +346 void saveRecvBuf(char *recvBuf, int bufferSize, std::vector >& ownerVec, │ │ │ │ │ +347 std::set& overlapVec, std::set& neighbors, RedistributeInterface& │ │ │ │ │ +inf, int from, MPI_Comm comm) { │ │ │ │ │ +348 std::size_t size; │ │ │ │ │ +349 int pos=0; │ │ │ │ │ +350 // unpack owner vertices │ │ │ │ │ +351 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ │ +getType(), comm); │ │ │ │ │ +352 inf.reserveSpaceForReceiveInterface(from, size); │ │ │ │ │ +353 ownerVec.reserve(ownerVec.size()+size); │ │ │ │ │ +354 for(; size!=0; --size) { │ │ │ │ │ +355 GI gi; │ │ │ │ │ +356 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits::getType(), │ │ │ │ │ +comm); │ │ │ │ │ +357 ownerVec.push_back(std::make_pair(gi,from)); │ │ │ │ │ +358 } │ │ │ │ │ +359 // unpack overlap vertices │ │ │ │ │ +360 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ │ +getType(), comm); │ │ │ │ │ +361 typename std::set::iterator ipos = overlapVec.begin(); │ │ │ │ │ +362 Dune::dverb << "unpacking "<::getType(), │ │ │ │ │ +comm); │ │ │ │ │ +366 ipos=overlapVec.insert(ipos, gi); │ │ │ │ │ +367 } │ │ │ │ │ +368 //unpack neighbors │ │ │ │ │ +369 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ │ +getType(), comm); │ │ │ │ │ +370 Dune::dverb << "unpacking "<::iterator npos = neighbors.begin(); │ │ │ │ │ +372 for(; size!=0; --size) { │ │ │ │ │ +373 int n; │ │ │ │ │ +374 MPI_Unpack(recvBuf, bufferSize, &pos, &n, 1, MPI_INT, comm); │ │ │ │ │ +375 npos=neighbors.insert(npos, n); │ │ │ │ │ +376 } │ │ │ │ │ +377 } │ │ │ │ │ +378 │ │ │ │ │ +392 template │ │ │ │ │ +393 void getDomain(const MPI_Comm& comm, T *part, int numOfOwnVtx, int nparts, │ │ │ │ │ +int *myDomain, std::vector &domainMapping) { │ │ │ │ │ +394 int npes, mype; │ │ │ │ │ +395 MPI_Comm_size(comm, &npes); │ │ │ │ │ +396 MPI_Comm_rank(comm, &mype); │ │ │ │ │ +397 MPI_Status status; │ │ │ │ │ +398 │ │ │ │ │ +399 *myDomain = -1; │ │ │ │ │ +400 int i=0; │ │ │ │ │ +401 int j=0; │ │ │ │ │ +402 │ │ │ │ │ +403 std::vector domain(nparts, 0); │ │ │ │ │ +404 std::vector assigned(npes, 0); │ │ │ │ │ +405 // init domain Mapping │ │ │ │ │ +406 domainMapping.assign(domainMapping.size(), -1); │ │ │ │ │ +407 │ │ │ │ │ +408 // count the occurrence of domains │ │ │ │ │ +409 for (i=0; i domainMatrix(npes * nparts, -1); │ │ │ │ │ +414 │ │ │ │ │ +415 // init buffer with the own domain │ │ │ │ │ +416 int *buf = new int[nparts]; │ │ │ │ │ +417 for (i=0; i unassigned; │ │ │ │ │ +442 │ │ │ │ │ +443 for(i=0; i::iterator next_free = assigned.begin(); │ │ │ │ │ +472 │ │ │ │ │ +473 for(auto udomain = unassigned.begin(), │ │ │ │ │ +474 end = unassigned.end(); udomain != end; ++udomain) │ │ │ │ │ +475 { │ │ │ │ │ +476 next_free = std::find_if(next_free, assigned.end(), std::bind(std:: │ │ │ │ │ +less(), std::placeholders::_1, 1)); │ │ │ │ │ +477 assert(next_free != assigned.end()); │ │ │ │ │ +478 domainMapping[*udomain] = next_free-assigned.begin(); │ │ │ │ │ +479 *next_free = 1; │ │ │ │ │ +480 } │ │ │ │ │ +481 } │ │ │ │ │ +482 │ │ │ │ │ +483 struct SortFirst │ │ │ │ │ +484 { │ │ │ │ │ +485 template │ │ │ │ │ +486 bool operator()(const T& t1, const T& t2) const │ │ │ │ │ +487 { │ │ │ │ │ +488 return t1 │ │ │ │ │ +504 void mergeVec(std::vector >& ownerVec, std::set& │ │ │ │ │ +overlapSet) { │ │ │ │ │ +505 │ │ │ │ │ +506#ifdef DEBUG_REPART │ │ │ │ │ +507 // Safety check for duplicates. │ │ │ │ │ +508 if(ownerVec.size()>0) │ │ │ │ │ +509 { │ │ │ │ │ +510 auto old=ownerVec.begin(); │ │ │ │ │ +511 for(auto i=old+1, end=ownerVec.end(); i != end; old=i++) │ │ │ │ │ +512 { │ │ │ │ │ +513 if(i->first==old->first) │ │ │ │ │ +514 { │ │ │ │ │ +515 std::cerr<<"Value at indes"<first<<","<second<<"]==[" │ │ │ │ │ +517 <first<<","<second<<"]"<first<*s) ++v; │ │ │ │ │ +529 if(v!=vend && v->first==*s) { │ │ │ │ │ +530 // Move to the next element before erasing │ │ │ │ │ +531 // thus s stays valid! │ │ │ │ │ +532 auto tmp=s; │ │ │ │ │ +533 ++s; │ │ │ │ │ +534 overlapSet.erase(tmp); │ │ │ │ │ +535 }else │ │ │ │ │ +536 ++s; │ │ │ │ │ +537 } │ │ │ │ │ +538 } │ │ │ │ │ +539 │ │ │ │ │ +540 │ │ │ │ │ +554 template │ │ │ │ │ +555 void getNeighbor(const Graph& g, std::vector& part, │ │ │ │ │ +556 typename Graph::VertexDescriptor vtx, const IS& indexSet, │ │ │ │ │ +557 int toPe, std::set& neighbor, std::set& neighborProcs) { │ │ │ │ │ +558 for(auto edge=g.beginEdges(vtx), end=g.endEdges(vtx); edge!=end; ++edge) │ │ │ │ │ +559 { │ │ │ │ │ +560 const typename IS::IndexPair* pindex = indexSet.pair(edge.target()); │ │ │ │ │ +561 assert(pindex); │ │ │ │ │ +562 if(part[pindex->local()]!=toPe || !OwnerSet::contains(pindex->local │ │ │ │ │ +().attribute())) │ │ │ │ │ +563 { │ │ │ │ │ +564 // is sent to another process and therefore becomes overlap │ │ │ │ │ +565 neighbor.insert(pindex->global()); │ │ │ │ │ +566 neighborProcs.insert(part[pindex->local()]); │ │ │ │ │ +567 } │ │ │ │ │ +568 } │ │ │ │ │ +569 } │ │ │ │ │ +570 │ │ │ │ │ +571 template │ │ │ │ │ +572 void my_push_back(std::vector& ownerVec, const I& index, [ │ │ │ │ │ +[maybe_unused]] int proc) │ │ │ │ │ +573 { │ │ │ │ │ +574 ownerVec.push_back(index); │ │ │ │ │ +575 } │ │ │ │ │ +576 │ │ │ │ │ +577 template │ │ │ │ │ +578 void my_push_back(std::vector >& ownerVec, const I& index, │ │ │ │ │ +int proc) │ │ │ │ │ +579 { │ │ │ │ │ +580 ownerVec.push_back(std::make_pair(index,proc)); │ │ │ │ │ +581 } │ │ │ │ │ +582 template │ │ │ │ │ +583 void reserve(std::vector&, RedistributeInterface&, int) │ │ │ │ │ +584 {} │ │ │ │ │ +585 template │ │ │ │ │ +586 void reserve(std::vector >& ownerVec, │ │ │ │ │ +RedistributeInterface& redist, int proc) │ │ │ │ │ +587 { │ │ │ │ │ +588 redist.reserveSpaceForReceiveInterface(proc, ownerVec.size()); │ │ │ │ │ +589 } │ │ │ │ │ +590 │ │ │ │ │ +591 │ │ │ │ │ +609 template │ │ │ │ │ +610 void getOwnerOverlapVec(const G& graph, std::vector& part, IS& │ │ │ │ │ +indexSet, │ │ │ │ │ +611 [[maybe_unused]] int myPe, int toPe, std::vector& ownerVec, std:: │ │ │ │ │ +set& overlapSet, │ │ │ │ │ +612 RedistributeInterface& redist, std::set& neighborProcs) { │ │ │ │ │ +613 for(auto index = indexSet.begin(); index != indexSet.end(); ++index) { │ │ │ │ │ +614 // Only Process owner vertices, the others are not in the parmetis graph. │ │ │ │ │ +615 if(OwnerSet::contains(index->local().attribute())) │ │ │ │ │ +616 { │ │ │ │ │ +617 if(part[index->local()]==toPe) │ │ │ │ │ +618 { │ │ │ │ │ +619 getNeighbor(graph, part, index->local(), indexSet, │ │ │ │ │ +620 toPe, overlapSet, neighborProcs); │ │ │ │ │ +621 my_push_back(ownerVec, index->global(), toPe); │ │ │ │ │ +622 } │ │ │ │ │ +623 } │ │ │ │ │ +624 } │ │ │ │ │ +625 reserve(ownerVec, redist, toPe); │ │ │ │ │ +626 │ │ │ │ │ +627 } │ │ │ │ │ +628 │ │ │ │ │ +629 │ │ │ │ │ +636 template │ │ │ │ │ +637 inline bool isOwner(IS& indexSet, int index) { │ │ │ │ │ +638 │ │ │ │ │ +639 const typename IS::IndexPair* pindex=indexSet.pair(index); │ │ │ │ │ +640 │ │ │ │ │ +641 assert(pindex); │ │ │ │ │ +642 return F::contains(pindex->local().attribute()); │ │ │ │ │ +643 } │ │ │ │ │ +644 │ │ │ │ │ +645 │ │ │ │ │ +646 class BaseEdgeFunctor │ │ │ │ │ +647 { │ │ │ │ │ +648 public: │ │ │ │ │ +649 BaseEdgeFunctor(Metis::idx_t* adj,const ParmetisDuneIndexMap& data) │ │ │ │ │ +650 : i_(), adj_(adj), data_(data) │ │ │ │ │ +651 {} │ │ │ │ │ +652 │ │ │ │ │ +653 template │ │ │ │ │ +654 void operator()(const T& edge) │ │ │ │ │ +655 { │ │ │ │ │ +656 // Get the egde weight │ │ │ │ │ +657 // const Weight& weight=edge.weight(); │ │ │ │ │ +658 adj_[i_] = data_.toParmetis(edge.target()); │ │ │ │ │ +659 i_++; │ │ │ │ │ +660 } │ │ │ │ │ +661 std::size_t index() │ │ │ │ │ +662 { │ │ │ │ │ +663 return i_; │ │ │ │ │ +664 } │ │ │ │ │ +665 │ │ │ │ │ +666 private: │ │ │ │ │ +667 std::size_t i_; │ │ │ │ │ +668 Metis::idx_t* adj_; │ │ │ │ │ +669 const ParmetisDuneIndexMap& data_; │ │ │ │ │ +670 }; │ │ │ │ │ +671 │ │ │ │ │ +672 template │ │ │ │ │ +673 struct EdgeFunctor │ │ │ │ │ +674 : public BaseEdgeFunctor │ │ │ │ │ +675 { │ │ │ │ │ +676 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std:: │ │ │ │ │ +size_t) │ │ │ │ │ +677 : BaseEdgeFunctor(adj, data) │ │ │ │ │ +678 {} │ │ │ │ │ +679 │ │ │ │ │ +680 Metis::idx_t* getWeights() │ │ │ │ │ +681 { │ │ │ │ │ +682 return NULL; │ │ │ │ │ +683 } │ │ │ │ │ +684 void free(){} │ │ │ │ │ +685 }; │ │ │ │ │ +686 │ │ │ │ │ +687 template │ │ │ │ │ +688 class EdgeFunctor<_D_u_n_e::Amg::PropertiesGraph > │ │ │ │ │ +689 : public BaseEdgeFunctor │ │ │ │ │ +690 { │ │ │ │ │ +691 public: │ │ │ │ │ +692 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std:: │ │ │ │ │ +size_t s) │ │ │ │ │ +693 : BaseEdgeFunctor(adj, data) │ │ │ │ │ +694 { │ │ │ │ │ +695 weight_=new Metis::idx_t[s]; │ │ │ │ │ +696 } │ │ │ │ │ +697 │ │ │ │ │ +698 template │ │ │ │ │ +699 void operator()(const T& edge) │ │ │ │ │ +700 { │ │ │ │ │ +701 weight_[index()]=edge.properties().depends() ? 3 : 1; │ │ │ │ │ +702 BaseEdgeFunctor::operator()(edge); │ │ │ │ │ +703 } │ │ │ │ │ +704 Metis::idx_t* getWeights() │ │ │ │ │ +705 { │ │ │ │ │ +706 return weight_; │ │ │ │ │ +707 } │ │ │ │ │ +708 void free(){ │ │ │ │ │ +709 if(weight_!=0) { │ │ │ │ │ +710 delete weight_; │ │ │ │ │ +711 weight_=0; │ │ │ │ │ +712 } │ │ │ │ │ +713 } │ │ │ │ │ +714 private: │ │ │ │ │ +715 Metis::idx_t* weight_; │ │ │ │ │ +716 }; │ │ │ │ │ +717 │ │ │ │ │ +718 │ │ │ │ │ +719 │ │ │ │ │ +733 template │ │ │ │ │ +734 void getAdjArrays(G& graph, IS& indexSet, Metis::idx_t *xadj, │ │ │ │ │ +735 EW& ew) │ │ │ │ │ +736 { │ │ │ │ │ +737 int j=0; │ │ │ │ │ +738 auto vend = graph.end(); │ │ │ │ │ +739 │ │ │ │ │ +740 for(auto vertex = graph.begin(); vertex != vend; ++vertex) { │ │ │ │ │ +741 if (isOwner(indexSet,*vertex)) { │ │ │ │ │ +742 // The type of const edge iterator. │ │ │ │ │ +743 auto eend = vertex.end(); │ │ │ │ │ +744 xadj[j] = ew.index(); │ │ │ │ │ +745 j++; │ │ │ │ │ +746 for(auto edge = vertex.begin(); edge != eend; ++edge) { │ │ │ │ │ +747 ew(edge); │ │ │ │ │ +748 } │ │ │ │ │ +749 } │ │ │ │ │ +750 } │ │ │ │ │ +751 xadj[j] = ew.index(); │ │ │ │ │ +752 } │ │ │ │ │ +753 } // end anonymous namespace │ │ │ │ │ +754 │ │ │ │ │ +755 template │ │ │ │ │ +756 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, │ │ │ │ │ +757 _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, │ │ │ │ │ +758 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, │ │ │ │ │ +759 RedistributeInterface& redistInf, │ │ │ │ │ +760 bool verbose=false); │ │ │ │ │ +761#if HAVE_PARMETIS │ │ │ │ │ +762#ifndef METIS_VER_MAJOR │ │ │ │ │ +763 extern "C" │ │ │ │ │ +764 { │ │ │ │ │ +765 // backwards compatibility to parmetis < 4.0.0 │ │ │ │ │ +766 void METIS_PartGraphKway(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t │ │ │ │ │ +*adjncy, Metis::idx_t *vwgt, │ │ │ │ │ +767 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts, │ │ │ │ │ +768 int *options, int *edgecut, Metis::idx_t *part); │ │ │ │ │ +769 │ │ │ │ │ +770 void METIS_PartGraphRecursive(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t │ │ │ │ │ +*adjncy, Metis::idx_t *vwgt, │ │ │ │ │ +771 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts, │ │ │ │ │ +772 int *options, int *edgecut, Metis::idx_t *part); │ │ │ │ │ +773 } │ │ │ │ │ +774#endif │ │ │ │ │ +775#endif // HAVE_PARMETIS │ │ │ │ │ +776 │ │ │ │ │ +777 template │ │ │ │ │ +_7_7_8 inline void _p_r_i_n_t___c_a_r_r_a_y(S& os, T* array, std::size_t l) │ │ │ │ │ +779 { │ │ │ │ │ +780 for(T *cur=array, *end=array+l; cur!=end; ++cur) │ │ │ │ │ +781 os<<*cur<<" "; │ │ │ │ │ +782 } │ │ │ │ │ +783 │ │ │ │ │ +784 template │ │ │ │ │ +_7_8_5 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, │ │ │ │ │ +786 T* adjncy, bool checkSymmetry) │ │ │ │ │ +787 { │ │ │ │ │ +788 bool correct=true; │ │ │ │ │ +789 │ │ │ │ │ +790 using std::signbit; │ │ │ │ │ +791 for(_M_e_t_i_s_:_:_i_d_x___t vtx=0; vtx<(_M_e_t_i_s_:_:_i_d_x___t)noVtx; ++vtx) { │ │ │ │ │ +792 if(static_cast(xadj[vtx])>noEdges || signbit(xadj[vtx])) { │ │ │ │ │ +793 std::cerr <<"Check graph: xadj["<" │ │ │ │ │ +794 <(xadj[vtx+1])>noEdges || signbit(xadj[vtx+1])) { │ │ │ │ │ +798 std::cerr <<"Check graph: xadj["<" │ │ │ │ │ +799 <gnoVtx) { │ │ │ │ │ +805 std::cerr<<" Edge "< │ │ │ │ │ +_8_2_9 bool _c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n(const M& _m_a_t, _D_u_n_e_:_: │ │ │ │ │ +_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm, │ │ │ │ │ +830 _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ │ +831 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, │ │ │ │ │ +832 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ │ +833 bool verbose=false) │ │ │ │ │ +834 { │ │ │ │ │ +835 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +836 std::cout<<"Repartitioning from "<1) { │ │ │ │ │ +847 │ │ │ │ │ +848 part[0]=rank; │ │ │ │ │ +849 │ │ │ │ │ +850 { // sublock for automatic memory deletion │ │ │ │ │ +851 │ │ │ │ │ +852 // Build the graph of the communication scheme and create an appropriate │ │ │ │ │ +indexset. │ │ │ │ │ +853 // calculate the neighbour vertices │ │ │ │ │ +854 int noNeighbours = oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s().neighbours(); │ │ │ │ │ +855 │ │ │ │ │ +856 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 │ │ │ │ │ +(); │ │ │ │ │ +857 ++n) │ │ │ │ │ +858 if(n->first==rank) { │ │ │ │ │ +859 //do not include ourselves. │ │ │ │ │ +860 --noNeighbours; │ │ │ │ │ +861 break; │ │ │ │ │ +862 } │ │ │ │ │ +863 │ │ │ │ │ +864 // A parmetis graph representing the communication graph. │ │ │ │ │ +865 // The diagonal entries are the number of nodes on the process. │ │ │ │ │ +866 // The offdiagonal entries are the number of edges leading to other │ │ │ │ │ +processes. │ │ │ │ │ +867 │ │ │ │ │ +868 _M_e_t_i_s_:_:_i_d_x___t *xadj=new _M_e_t_i_s_:_:_i_d_x___t[2]; │ │ │ │ │ +869 _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]; │ │ │ │ │ +870 _M_e_t_i_s_:_:_i_d_x___t *adjncy=new _M_e_t_i_s_:_:_i_d_x___t[noNeighbours]; │ │ │ │ │ +871#ifdef USE_WEIGHTS │ │ │ │ │ +872 _M_e_t_i_s_:_:_i_d_x___t *vwgt = 0; │ │ │ │ │ +873 _M_e_t_i_s_:_:_i_d_x___t *adjwgt = 0; │ │ │ │ │ +874#endif │ │ │ │ │ +875 │ │ │ │ │ +876 // each process has exactly one vertex! │ │ │ │ │ +877 for(int i=0; i owner(mat.N(), oocomm.communicator().rank()); │ │ │ │ │ +887 // for(NeighbourIterator n= oocomm.remoteIndices().begin(); n != │ │ │ │ │ +oocomm.remoteIndices().end(); │ │ │ │ │ +888 // ++n) │ │ │ │ │ +889 // { │ │ │ │ │ +890 // if(n->first!=oocomm.communicator().rank()){ │ │ │ │ │ +891 // typedef typename RemoteIndices::RemoteIndexList RIList; │ │ │ │ │ +892 // const RIList& rlist = *(n->second.first); │ │ │ │ │ +893 // typedef typename RIList::const_iterator LIter; │ │ │ │ │ +894 // for(LIter entry=rlist.begin(); entry!=rlist.end(); ++entry){ │ │ │ │ │ +895 // if(entry->attribute()==OwnerOverlapCopyAttributeSet::owner) │ │ │ │ │ +896 // owner[entry->localIndexPair().local()] = n->first; │ │ │ │ │ +897 // } │ │ │ │ │ +898 // } │ │ │ │ │ +899 // } │ │ │ │ │ +900 │ │ │ │ │ +901 // std::map edgecount; // edges to other processors │ │ │ │ │ +902 // typedef typename M::ConstRowIterator RIter; │ │ │ │ │ +903 // typedef typename M::ConstColIterator CIter; │ │ │ │ │ +904 │ │ │ │ │ +905 // // calculate edge count │ │ │ │ │ +906 // for(RIter row=mat.begin(), endr=mat.end(); row != endr; ++row) │ │ │ │ │ +907 // if(owner[row.index()]==OwnerOverlapCopyAttributeSet::owner) │ │ │ │ │ +908 // for(CIter entry= row->begin(), ende = row->end(); entry != ende; │ │ │ │ │ +++entry) │ │ │ │ │ +909 // ++edgecount[owner[entry.index()]]; │ │ │ │ │ +910 │ │ │ │ │ +911 // setup edge and weight pattern │ │ │ │ │ +912 │ │ │ │ │ +913 _M_e_t_i_s_:_:_i_d_x___t* adjp=adjncy; │ │ │ │ │ +914 │ │ │ │ │ +915#ifdef USE_WEIGHTS │ │ │ │ │ +916 vwgt = new _M_e_t_i_s_:_:_i_d_x___t[1]; │ │ │ │ │ +917 vwgt[0]= _m_a_t.N(); // weight is numer of rows TODO: Should actually be the │ │ │ │ │ +nonzeros. │ │ │ │ │ +918 │ │ │ │ │ +919 adjwgt = new _M_e_t_i_s_:_:_i_d_x___t[noNeighbours]; │ │ │ │ │ +920 _M_e_t_i_s_:_:_i_d_x___t* adjwp=adjwgt; │ │ │ │ │ +921#endif │ │ │ │ │ +922 │ │ │ │ │ +923 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 │ │ │ │ │ +(); │ │ │ │ │ +924 ++n) │ │ │ │ │ +925 if(n->first != rank) { │ │ │ │ │ +926 *adjp=n->first; │ │ │ │ │ +927 ++adjp; │ │ │ │ │ +928#ifdef USE_WEIGHTS │ │ │ │ │ +929 *adjwp=1; //edgecount[n->first]; │ │ │ │ │ +930 ++adjwp; │ │ │ │ │ +931#endif │ │ │ │ │ +932 } │ │ │ │ │ +933 assert(_i_s_V_a_l_i_d_G_r_a_p_h(vtxdist[rank+1]-vtxdist[rank], │ │ │ │ │ +934 vtxdist[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()], │ │ │ │ │ +935 noNeighbours, xadj, adjncy, false)); │ │ │ │ │ +936 │ │ │ │ │ +937 [[maybe_unused]] _M_e_t_i_s_:_:_i_d_x___t wgtflag=0; │ │ │ │ │ +938 _M_e_t_i_s_:_:_i_d_x___t numflag=0; │ │ │ │ │ +939 _M_e_t_i_s_:_:_i_d_x___t edgecut; │ │ │ │ │ +940#ifdef USE_WEIGHTS │ │ │ │ │ +941 wgtflag=3; │ │ │ │ │ +942#endif │ │ │ │ │ +943 _M_e_t_i_s_:_:_r_e_a_l___t *tpwgts = new _M_e_t_i_s_:_:_r_e_a_l___t[nparts]; │ │ │ │ │ +944 for(int i=0; i::getType(), │ │ │ │ │ +1071 gxadj,noxs,xdispl,MPITraits::getType(), │ │ │ │ │ +1072 comm); │ │ │ │ │ +1073 MPI_Allgatherv(adjncy,noNeighbours,MPITraits::getType(), │ │ │ │ │ +1074 gadjncy,noedges,displ,MPITraits::getType(), │ │ │ │ │ +1075 comm); │ │ │ │ │ +1076#ifdef USE_WEIGHTS │ │ │ │ │ +1077 MPI_Allgatherv(adjwgt,noNeighbours,MPITraits::getType(), │ │ │ │ │ +1078 gadjwgt,noedges,displ,MPITraits::getType(), │ │ │ │ │ +1079 comm); │ │ │ │ │ +1080 MPI_Allgatherv(vwgt,localNoVtx,MPITraits::getType(), │ │ │ │ │ +1081 gvwgt,novs,vdispl,MPITraits::getType(), │ │ │ │ │ +1082 comm); │ │ │ │ │ +1083#endif │ │ │ │ │ +1084 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1085 std::cout<<"Gathering global graph data took "<(gxadjlen)); │ │ │ │ │ +1103 increment = *(start-1); │ │ │ │ │ +1104 std::transform(start+offset, start+l+offset, start, std::bind(std:: │ │ │ │ │ +plus(), std::placeholders::_1, increment)); │ │ │ │ │ +1105 } │ │ │ │ │ +1106 Dune::dinfo<= 5 │ │ │ │ │ +1130 _M_e_t_i_s_:_:_i_d_x___t ncon = 1; │ │ │ │ │ +1131 _M_e_t_i_s_:_:_i_d_x___t moptions[METIS_NOPTIONS]; │ │ │ │ │ +1132 METIS_SetDefaultOptions(moptions); │ │ │ │ │ +1133 moptions[METIS_OPTION_NUMBERING] = numflag; │ │ │ │ │ +1134 METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, │ │ │ │ │ +gadjwgt, │ │ │ │ │ +1135 &nparts, NULL, NULL, moptions, &edgecut, gpart); │ │ │ │ │ +1136#else │ │ │ │ │ +1137 int options[5] = {0, 1, 1, 3, 3}; │ │ │ │ │ +1138 // Call metis │ │ │ │ │ +1139 METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, │ │ │ │ │ +&wgtflag, │ │ │ │ │ +1140 &numflag, &nparts, options, &edgecut, gpart); │ │ │ │ │ +1141#endif │ │ │ │ │ +1142 │ │ │ │ │ +1143 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1144 std::cout<<"METIS took "<::getType(), part, 1, │ │ │ │ │ +1159 MPITraits::getType(), 0, comm); │ │ │ │ │ +1160 │ │ │ │ │ +1161 { │ │ │ │ │ +1162 // release remaining memory │ │ │ │ │ +1163 delete[] gpart; │ │ │ │ │ +1164 delete[] noedges; │ │ │ │ │ +1165 delete[] displ; │ │ │ │ │ +1166 } │ │ │ │ │ +1167 │ │ │ │ │ +1168 │ │ │ │ │ +1169#endif │ │ │ │ │ +1170 delete[] xadj; │ │ │ │ │ +1171 delete[] vtxdist; │ │ │ │ │ +1172 delete[] adjncy; │ │ │ │ │ +1173#ifdef USE_WEIGHTS │ │ │ │ │ +1174 delete[] vwgt; │ │ │ │ │ +1175 delete[] adjwgt; │ │ │ │ │ +1176#endif │ │ │ │ │ +1177 delete[] tpwgts; │ │ │ │ │ +1178 } │ │ │ │ │ +1179 }else{ │ │ │ │ │ +1180 part[0]=0; │ │ │ │ │ +1181 } │ │ │ │ │ +1182#endif │ │ │ │ │ +1183 Dune::dinfo<<" repart "< "<< part[0]< realpart(_m_a_t.N(), part[0]); │ │ │ │ │ +1186 delete[] part; │ │ │ │ │ +1187 │ │ │ │ │ +1188 oocomm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(realpart, realpart); │ │ │ │ │ +1189 │ │ │ │ │ +1190 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1191 std::cout<<"Scattering repartitioning took "< graph(const_cast(_m_a_t)); │ │ │ │ │ +1197 _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(graph, oocomm); │ │ │ │ │ +1198 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1199 std::cout<<"Filling index set took "< │ │ │ │ │ +_1_2_3_5 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, │ │ │ │ │ +1236 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, │ │ │ │ │ +1237 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ │ +1238 bool verbose=false) │ │ │ │ │ +1239 { │ │ │ │ │ +1240 Timer time; │ │ │ │ │ +1241 │ │ │ │ │ +1242 MPI_Comm comm=oocomm._c_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ │ +1243 oocomm._b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p(graph.noVertices()); │ │ │ │ │ +1244 _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(graph, oocomm); │ │ │ │ │ +1245 │ │ │ │ │ +1246 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1247 std::cout<<"Filling holes took "<(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size())); │ │ │ │ │ +1262 │ │ │ │ │ +1263 int myDomain = -1; │ │ │ │ │ +1264 │ │ │ │ │ +1265 // │ │ │ │ │ +1266 // 1) Prepare the required parameters for using ParMETIS │ │ │ │ │ +1267 // Especially the arrays that represent the graph must be │ │ │ │ │ +1268 // generated by the DUNE Graph and IndexSet input variables. │ │ │ │ │ +1269 // These are the arrays: │ │ │ │ │ +1270 // - vtxdist │ │ │ │ │ +1271 // - xadj │ │ │ │ │ +1272 // - adjncy │ │ │ │ │ +1273 // │ │ │ │ │ +1274 // │ │ │ │ │ +1275#ifdef PERF_REPART │ │ │ │ │ +1276 // reset timer for step 1) │ │ │ │ │ +1277 t1=MPI_Wtime(); │ │ │ │ │ +1278#endif │ │ │ │ │ +1279 │ │ │ │ │ +1280 │ │ │ │ │ +1281 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; │ │ │ │ │ +1282 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ │ +1283 │ │ │ │ │ +1284 // Create the vtxdist array and parmetisVtxMapping. │ │ │ │ │ +1285 // Global communications are necessary │ │ │ │ │ +1286 // The parmetis global identifiers for the owner vertices. │ │ │ │ │ +1287 ParmetisDuneIndexMap indexMap(graph,oocomm); │ │ │ │ │ +1288 _M_e_t_i_s_:_:_i_d_x___t *part = new _M_e_t_i_s_:_:_i_d_x___t[indexMap.numOfOwnVtx()]; │ │ │ │ │ +1289 for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i) │ │ │ │ │ +1290 part[i]=mype; │ │ │ │ │ +1291 │ │ │ │ │ +1292#if !HAVE_PARMETIS │ │ │ │ │ +1293 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0 && nparts>1) │ │ │ │ │ +1294 std::cerr<<"ParMETIS not activated. Will repartition to 1 domain instead │ │ │ │ │ +of requested " │ │ │ │ │ +1295 <1) { │ │ │ │ │ +1301 // Create the xadj and adjncy arrays │ │ │ │ │ +1302 _M_e_t_i_s_:_:_i_d_x___t *xadj = new _M_e_t_i_s_:_:_i_d_x___t[indexMap.numOfOwnVtx()+1]; │ │ │ │ │ +1303 _M_e_t_i_s_:_:_i_d_x___t *adjncy = new _M_e_t_i_s_:_:_i_d_x___t[graph.noEdges()]; │ │ │ │ │ +1304 EdgeFunctor ef(adjncy, indexMap, graph.noEdges()); │ │ │ │ │ +1305 getAdjArrays(graph, oocomm._g_l_o_b_a_l_L_o_o_k_u_p(), xadj, ef); │ │ │ │ │ +1306 │ │ │ │ │ +1307 // │ │ │ │ │ +1308 // 2) Call ParMETIS │ │ │ │ │ +1309 // │ │ │ │ │ +1310 // │ │ │ │ │ +1311 _M_e_t_i_s_:_:_i_d_x___t numflag=0, wgtflag=0, options[3], edgecut=0, ncon=1; │ │ │ │ │ +1312 //float *tpwgts = NULL; │ │ │ │ │ +1313 _M_e_t_i_s_:_:_r_e_a_l___t *tpwgts = new _M_e_t_i_s_:_:_r_e_a_l___t[nparts]; │ │ │ │ │ +1314 for(int i=0; i(comm)); │ │ │ │ │ +1358 │ │ │ │ │ +1359 │ │ │ │ │ +1360 delete[] xadj; │ │ │ │ │ +1361 delete[] adjncy; │ │ │ │ │ +1362 delete[] tpwgts; │ │ │ │ │ +1363 │ │ │ │ │ +1364 ef.free(); │ │ │ │ │ +1365 │ │ │ │ │ +1366#ifdef DEBUG_REPART │ │ │ │ │ +1367 if (mype == 0) { │ │ │ │ │ +1368 std::cout< domainMapping(nparts); │ │ │ │ │ +1410 if(nparts>1) │ │ │ │ │ +1411 getDomain(comm, part, indexMap.numOfOwnVtx(), nparts, &myDomain, │ │ │ │ │ +domainMapping); │ │ │ │ │ +1412 else │ │ │ │ │ +1413 domainMapping[0]=0; │ │ │ │ │ +1414 │ │ │ │ │ +1415#ifdef DEBUG_REPART │ │ │ │ │ +1416 std::cout< setPartition(oocomm._i_n_d_e_x_S_e_t().size(), -1); │ │ │ │ │ +1429 │ │ │ │ │ +1430 std::size_t i=0; // parmetis index │ │ │ │ │ +1431 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) │ │ │ │ │ +1432 if(OwnerSet::contains(index->local().attribute())) { │ │ │ │ │ +1433 setPartition[index->local()]=domainMapping[part[i++]]; │ │ │ │ │ +1434 } │ │ │ │ │ +1435 │ │ │ │ │ +1436 delete[] part; │ │ │ │ │ +1437 oocomm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(setPartition, setPartition); │ │ │ │ │ +1438 // communication only needed for ALU │ │ │ │ │ +1439 // (ghosts with same global id as owners on the same process) │ │ │ │ │ +1440 if (SolverCategory::category(oocomm) == │ │ │ │ │ +1441 static_cast(SolverCategory::nonoverlapping)) │ │ │ │ │ +1442 oocomm._c_o_p_y_C_o_p_y_T_o_A_l_l(setPartition, setPartition); │ │ │ │ │ +1443 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, │ │ │ │ │ +1444 verbose); │ │ │ │ │ +1445 if(verbose) { │ │ │ │ │ +1446 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ │ +1447 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1448 std::cout<<"Creating indexsets took "< │ │ │ │ │ +_1_4_5_6 bool _b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n(const G& graph, │ │ │ │ │ +1457 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, │ │ │ │ │ +1458 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, │ │ │ │ │ +1459 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ │ +1460 bool verbose) │ │ │ │ │ +1461 { │ │ │ │ │ +1462 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; │ │ │ │ │ +1463 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ │ +1464 │ │ │ │ │ +1465 Timer time; │ │ │ │ │ +1466 │ │ │ │ │ +1467 // Build the send interface │ │ │ │ │ +1468 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()); │ │ │ │ │ +1469 │ │ │ │ │ +1470#ifdef PERF_REPART │ │ │ │ │ +1471 // stop the time for step 3) │ │ │ │ │ +1472 t3=MPI_Wtime()-t3; │ │ │ │ │ +1473 // reset timer for step 4) │ │ │ │ │ +1474 t4=MPI_Wtime(); │ │ │ │ │ +1475#endif │ │ │ │ │ +1476 │ │ │ │ │ +1477 │ │ │ │ │ +1478 // │ │ │ │ │ +1479 // 4) Create the output IndexSet and RemoteIndices │ │ │ │ │ +1480 // 4.1) Determine the "send to" and "receive from" relation │ │ │ │ │ +1481 // according to the new partition using a MPI ring │ │ │ │ │ +1482 // communication. │ │ │ │ │ +1483 // │ │ │ │ │ +1484 // 4.2) Depends on the "send to" and "receive from" vector, │ │ │ │ │ +1485 // the processes will exchange the vertices each other │ │ │ │ │ +1486 // │ │ │ │ │ +1487 // 4.3) Create the IndexSet, RemoteIndices and the new MPI │ │ │ │ │ +1488 // communicator │ │ │ │ │ +1489 // │ │ │ │ │ +1490 │ │ │ │ │ +1491 // │ │ │ │ │ +1492 // 4.1) Let's start... │ │ │ │ │ +1493 // │ │ │ │ │ +1494 int npes = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size(); │ │ │ │ │ +1495 int *sendTo = 0; │ │ │ │ │ +1496 int noSendTo = 0; │ │ │ │ │ +1497 std::set recvFrom; │ │ │ │ │ +1498 │ │ │ │ │ +1499 // the max number of vertices is stored in the sendTo buffer, │ │ │ │ │ +1500 // not the number of vertices to send! Because the max number of Vtx │ │ │ │ │ +1501 // is used as the fixed buffer size by the MPI send/receive calls │ │ │ │ │ +1502 │ │ │ │ │ +1503 int mype = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank(); │ │ │ │ │ +1504 │ │ │ │ │ +1505 { │ │ │ │ │ +1506 std::set tsendTo; │ │ │ │ │ +1507 for(auto i=setPartition.begin(), iend = setPartition.end(); i!=iend; ++i) │ │ │ │ │ +1508 tsendTo.insert(*i); │ │ │ │ │ +1509 │ │ │ │ │ +1510 noSendTo = tsendTo.size(); │ │ │ │ │ +1511 sendTo = new int[noSendTo]; │ │ │ │ │ +1512 int idx=0; │ │ │ │ │ +1513 for(auto i=tsendTo.begin(); i != tsendTo.end(); ++i, ++idx) │ │ │ │ │ +1514 sendTo[idx]=*i; │ │ │ │ │ +1515 } │ │ │ │ │ +1516 │ │ │ │ │ +1517 // │ │ │ │ │ +1518 int* gnoSend= new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()]; │ │ │ │ │ +1519 int* gsendToDispl = new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()+1]; │ │ │ │ │ +1520 │ │ │ │ │ +1521 MPI_Allgather(&noSendTo, 1, MPI_INT, gnoSend, 1, │ │ │ │ │ +1522 MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1523 │ │ │ │ │ +1524 // calculate total receive message size │ │ │ │ │ +1525 int totalNoRecv = 0; │ │ │ │ │ +1526 for(int i=0; i0; │ │ │ │ │ +1547 │ │ │ │ │ +1548 // Delete memory │ │ │ │ │ +1549 delete[] gnoSend; │ │ │ │ │ +1550 delete[] gsendToDispl; │ │ │ │ │ +1551 delete[] gsendTo; │ │ │ │ │ +1552 │ │ │ │ │ +1553 │ │ │ │ │ +1554#ifdef DEBUG_REPART │ │ │ │ │ +1555 if(recvFrom.size()) { │ │ │ │ │ +1556 std::cout< GlobalVector; │ │ │ │ │ +1589 std::vector > myOwnerVec; │ │ │ │ │ +1590 std::set myOverlapSet; │ │ │ │ │ +1591 GlobalVector sendOwnerVec; │ │ │ │ │ +1592 std::set sendOverlapSet; │ │ │ │ │ +1593 std::set myNeighbors; │ │ │ │ │ +1594 │ │ │ │ │ +1595 // getOwnerOverlapVec(graph, setPartition, oocomm.globalLookup │ │ │ │ │ +(), │ │ │ │ │ +1596 // mype, mype, myOwnerVec, myOverlapSet, redistInf, myNeighbors); │ │ │ │ │ +1597 │ │ │ │ │ +1598 char **sendBuffers=new char*[noSendTo]; │ │ │ │ │ +1599 MPI_Request *requests = new MPI_Request[noSendTo]; │ │ │ │ │ +1600 │ │ │ │ │ +1601 // Create all messages to be sent │ │ │ │ │ +1602 for(int i=0; i < noSendTo; ++i) { │ │ │ │ │ +1603 // clear the vector for sending │ │ │ │ │ +1604 sendOwnerVec.clear(); │ │ │ │ │ +1605 sendOverlapSet.clear(); │ │ │ │ │ +1606 // get all owner and overlap vertices for process j and save these │ │ │ │ │ +1607 // in the vectors sendOwnerVec and sendOverlapSet │ │ │ │ │ +1608 std::set neighbors; │ │ │ │ │ +1609 getOwnerOverlapVec(graph, setPartition, oocomm._g_l_o_b_a_l_L_o_o_k_u_p(), │ │ │ │ │ +1610 mype, sendTo[i], sendOwnerVec, sendOverlapSet, redistInf, │ │ │ │ │ +1611 neighbors); │ │ │ │ │ +1612 // +2, we need 2 integer more for the length of each part │ │ │ │ │ +1613 // (owner/overlap) of the array │ │ │ │ │ +1614 int buffersize=0; │ │ │ │ │ +1615 int tsize; │ │ │ │ │ +1616 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ │ +&buffersize); │ │ │ │ │ +1617 MPI_Pack_size(sendOwnerVec.size(), MPITraits::getType(), │ │ │ │ │ +oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +1618 buffersize +=tsize; │ │ │ │ │ +1619 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ │ +&tsize); │ │ │ │ │ +1620 buffersize +=tsize; │ │ │ │ │ +1621 MPI_Pack_size(sendOverlapSet.size(), MPITraits::getType(), │ │ │ │ │ +oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +1622 buffersize += tsize; │ │ │ │ │ +1623 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ │ +&tsize); │ │ │ │ │ +1624 buffersize += tsize; │ │ │ │ │ +1625 MPI_Pack_size(neighbors.size(), MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ │ +1626 buffersize += tsize; │ │ │ │ │ +1627 │ │ │ │ │ +1628 sendBuffers[i] = new char[buffersize]; │ │ │ │ │ +1629 │ │ │ │ │ +1630#ifdef DEBUG_REPART │ │ │ │ │ +1631 std::cout<0) { │ │ │ │ │ +1651 // probe for an incoming message │ │ │ │ │ +1652 MPI_Status stat; │ │ │ │ │ +1653 MPI_Probe(MPI_ANY_SOURCE, 99, oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &stat); │ │ │ │ │ +1654 int buffersize; │ │ │ │ │ +1655 MPI_Get_count(&stat, MPI_PACKED, &buffersize); │ │ │ │ │ +1656 │ │ │ │ │ +1657 if(oldbuffersize(outputComm,SolverCategory::category │ │ │ │ │ +(oocomm),true); │ │ │ │ │ +1727 │ │ │ │ │ +1728 // translate neighbor ranks. │ │ │ │ │ +1729 int newrank=outcomm->communicator().rank(); │ │ │ │ │ +1730 int *newranks=new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()]; │ │ │ │ │ +1731 std::vector tneighbors; │ │ │ │ │ +1732 tneighbors.reserve(myNeighbors.size()); │ │ │ │ │ +1733 │ │ │ │ │ +1734 typename OOComm::ParallelIndexSet& outputIndexSet = outcomm->indexSet(); │ │ │ │ │ +1735 │ │ │ │ │ +1736 MPI_Allgather(&newrank, 1, MPI_INT, newranks, 1, │ │ │ │ │ +1737 MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ │ +1738 │ │ │ │ │ +1739#ifdef DEBUG_REPART │ │ │ │ │ +1740 std::cout<=0); │ │ │ │ │ +1744 std::cout<<*i<<"->"<first,LocalIndexT(i, OwnerOverlapCopyAttributeSet:: │ │ │ │ │ +owner, true)); │ │ │ │ │ +1777 redistInf._a_d_d_R_e_c_e_i_v_e_I_n_d_e_x(g->second, i); │ │ │ │ │ +1778 } │ │ │ │ │ +1779 │ │ │ │ │ +1780 if(verbose) { │ │ │ │ │ +1781 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ │ +1782 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1783 std::cout<<" Adding owner indices took "<< │ │ │ │ │ +1784 time.elapsed()<local().attribute())) { │ │ │ │ │ +1820 numOfOwnVtx++; │ │ │ │ │ +1821 } │ │ │ │ │ +1822 } │ │ │ │ │ +1823 numOfOwnVtx = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().sum(numOfOwnVtx); │ │ │ │ │ +1824 // if(numOfOwnVtx!=indexMap.globalOwnerVertices) │ │ │ │ │ +1825 // { │ │ │ │ │ +1826 // std::cerr<remoteIndices().setNeighbours(tneighbors); │ │ │ │ │ +1844 outcomm->remoteIndices().template rebuild(); │ │ │ │ │ +1845 │ │ │ │ │ +1846 } │ │ │ │ │ +1847 │ │ │ │ │ +1848 // release the memory │ │ │ │ │ +1849 delete[] sendTo; │ │ │ │ │ +1850 │ │ │ │ │ +1851 if(verbose) { │ │ │ │ │ +1852 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ │ +1853 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ │ +1854 std::cout<<" Storing indexsets took "<< │ │ │ │ │ +1855 time.elapsed()< │ │ │ │ │ +1876 bool graphRepartition(const G& graph, P& oocomm, int nparts, │ │ │ │ │ +1877 std::shared_ptr

& outcomm, │ │ │ │ │ +1878 R& redistInf, │ │ │ │ │ +1879 bool v=false) │ │ │ │ │ +1880 { │ │ │ │ │ +1881 if(nparts!=oocomm.size()) │ │ │ │ │ +1882 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ │ +1883 } │ │ │ │ │ +1884 │ │ │ │ │ +1885 │ │ │ │ │ +1886 template │ │ │ │ │ +1887 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, │ │ │ │ │ +1888 std::shared_ptr

& outcomm, │ │ │ │ │ +1889 R& redistInf, │ │ │ │ │ +1890 bool v=false) │ │ │ │ │ +1891 { │ │ │ │ │ +1892 if(nparts!=oocomm.size()) │ │ │ │ │ +1893 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ │ +1894 } │ │ │ │ │ +1895#endif // HAVE_MPI │ │ │ │ │ +1896} // end of namespace Dune │ │ │ │ │ +1897#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... │ │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ -_p_i_n_f_o_._h_h │ │ │ │ │ -_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ │ -implementation wraps a matrix. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ -const int Arguments │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ │ -SequentialCommunicationArgs(Communication< void * > comm, int cat) │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ │ -OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat) │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ │ -MPI_Comm comm_ │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_a_t__ │ │ │ │ │ -SolverCategory::Category cat_ │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ │ -const C & comm_ │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s │ │ │ │ │ -ParallelOperatorArgs(std::shared_ptr< M > matrix, const C &comm) │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_m_a_t_r_i_x__ │ │ │ │ │ -std::shared_ptr< M > matrix_ │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ -const void * Arguments │ │ │ │ │ -A type holding all the arguments needed to call the constructor. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ │ -Communication< void * > comm_ │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:97 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -static std::shared_ptr< BlockVector< T, A > > construct(Arguments &n) │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:62 │ │ │ │ │ +_g_l_o_b_a_l_O_w_n_e_r_V_e_r_t_i_c_e_s │ │ │ │ │ +int globalOwnerVertices │ │ │ │ │ +DDeeffiinniittiioonn repartition.hh:175 │ │ │ │ │ +_g_r_a_p_h_._h_h │ │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ │ -A vector of blocks with memory management. │ │ │ │ │ -DDeeffiinniittiioonn bvector.hh:395 │ │ │ │ │ -_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:137 │ │ │ │ │ +_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:1456 │ │ │ │ │ +_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:829 │ │ │ │ │ +_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:778 │ │ │ │ │ +_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:785 │ │ │ │ │ +_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:1235 │ │ │ │ │ +_D_u_n_e_:_:_M_e_t_i_s_:_:_r_e_a_l___t │ │ │ │ │ +float real_t │ │ │ │ │ +DDeeffiinniittiioonn repartition.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_M_e_t_i_s_:_:_i_d_x___t │ │ │ │ │ +std::size_t idx_t │ │ │ │ │ +DDeeffiinniittiioonn repartition.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r │ │ │ │ │ +@ owner │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ │ _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ owner/overlap/copy sema... │ │ │ │ │ DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ -_D_u_n_e_:_:_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 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ +const GlobalLookupIndexSet & globalLookup() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:526 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ │ +const ParallelIndexSet & indexSet() const │ │ │ │ │ +Get the underlying parallel index set. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:462 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ │ +void copyCopyToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from copy data points to all other data points. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ │ +The type of the reverse lookup of indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ +void buildGlobalLookup() │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:495 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +const Communication< MPI_Comm > & communicator() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ +void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from owner data points to all other data points. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +const RemoteIndices & remoteIndices() const │ │ │ │ │ +Get the underlying remote indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ │ +void freeGlobalLookup() │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:520 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ │ +The type of the parallel index set. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +The (undirected) graph of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ │ +DDeeffiinniittiioonn repartition.hh:260 │ │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_r_e_s_e_r_v_e_S_p_a_c_e_F_o_r_R_e_c_e_i_v_e_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void reserveSpaceForReceiveInterface(int proc, int size) │ │ │ │ │ +DDeeffiinniittiioonn repartition.hh:284 │ │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_b_u_i_l_d_R_e_c_e_i_v_e_I_n_t_e_r_f_a_c_e │ │ │ │ │ +void buildReceiveInterface(std::vector< std::pair< TG, int > > &indices) │ │ │ │ │ +DDeeffiinniittiioonn repartition.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_~_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ │ +~RedistributeInterface() │ │ │ │ │ +DDeeffiinniittiioonn repartition.hh:301 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamgsmoother.hh File Reference │ │ │ │ +dune-istl: multitypeblockvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,41 +65,63 @@ │ │ │ │

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
fastamgsmoother.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
multitypeblockvector.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <cstddef>
│ │ │ │ +
#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::GaussSeidelPresmoothDefect< level >
struct  Dune::FieldTraits< MultiTypeBlockVector< Args... > >
 
struct  Dune::Amg::GaussSeidelPostsmoothDefect< level >
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...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ +

│ │ │ │ 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,23 +1,42 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -#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 │ │ │ │ │ +multitypeblockvector.hh File Reference │ │ │ │ │ +#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 "_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_:_:_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_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_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_ _> │ │ │ │ │ + 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_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ +namespace   _s_t_d │ │ │ │ │ +  STL namespace. │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &s, const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r< │ │ │ │ │ + Args... > &v) │ │ │ │ │ +  Send _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r to an outstream. │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamgsmoother.hh Source File │ │ │ │ +dune-istl: multitypeblockvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,131 +70,358 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
fastamgsmoother.hh
│ │ │ │ +
multitypeblockvector.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_MULTITYPEBLOCKVECTOR_HH
│ │ │ │ +
6#define DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH
│ │ │ │
7
│ │ │ │ -
8#include <cstddef>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune
│ │ │ │ -
11{
│ │ │ │ -
12 namespace Amg
│ │ │ │ -
13 {
│ │ │ │ -
14
│ │ │ │ -
15 template<std::size_t level>
│ │ │ │ -
│ │ │ │ - │ │ │ │ +
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 template<typename M, typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
19 static void apply(const M& A, X& x, Y& d,
│ │ │ │ -
20 const Y& b)
│ │ │ │ -
21 {
│ │ │ │ -
22 typedef typename M::ConstRowIterator RowIterator;
│ │ │ │ -
23 typedef typename M::ConstColIterator ColIterator;
│ │ │ │ -
24
│ │ │ │ -
25 typename Y::iterator dIter=d.begin();
│ │ │ │ -
26 typename Y::const_iterator bIter=b.begin();
│ │ │ │ -
27 typename X::iterator xIter=x.begin();
│ │ │ │ -
28
│ │ │ │ -
29 for(RowIterator row=A.begin(), end=A.end(); row != end;
│ │ │ │ -
30 ++row, ++dIter, ++xIter, ++bIter)
│ │ │ │ -
31 {
│ │ │ │ -
32 ColIterator col=(*row).begin();
│ │ │ │ -
33 *dIter = *bIter;
│ │ │ │ -
34
│ │ │ │ -
35 for (; col.index()<row.index(); ++col)
│ │ │ │ -
36 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ -
37 assert(row.index()==col.index());
│ │ │ │ -
38 ColIterator diag=col; // upper diagonal matrix not needed as x was 0 before.
│ │ │ │ -
39
│ │ │ │ -
40 // Not recursive yet. Just solve with the diagonal
│ │ │ │ -
41 diag->solve(*xIter,*dIter);
│ │ │ │ -
42 *dIter=0; //as r=v
│ │ │ │ -
43
│ │ │ │ -
44 // Update residual for the symmetric case
│ │ │ │ -
45 for(col=(*row).begin(); col.index()<row.index(); ++col)
│ │ │ │ -
46 col->mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ │ -
47 }
│ │ │ │ -
48 }
│ │ │ │ -
│ │ │ │ -
49 };
│ │ │ │ -
│ │ │ │ -
50
│ │ │ │ -
51 template<std::size_t level>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
53
│ │ │ │ -
54 template<typename M, typename X, typename Y>
│ │ │ │ -
│ │ │ │ -
55 static void apply(const M& A, X& x, Y& d,
│ │ │ │ -
56 const Y& b)
│ │ │ │ -
57 {
│ │ │ │ -
58 typedef typename M::ConstRowIterator RowIterator;
│ │ │ │ -
59 typedef typename M::ConstColIterator ColIterator;
│ │ │ │ -
60 typedef typename Y::block_type YBlock;
│ │ │ │ -
61
│ │ │ │ -
62 typename Y::iterator dIter=d.beforeEnd();
│ │ │ │ -
63 typename X::iterator xIter=x.beforeEnd();
│ │ │ │ -
64 typename Y::const_iterator bIter=b.beforeEnd();
│ │ │ │ -
65
│ │ │ │ -
66 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end;
│ │ │ │ -
67 --row, --dIter, --xIter, --bIter)
│ │ │ │ -
68 {
│ │ │ │ -
69 ColIterator endCol=(*row).beforeBegin();
│ │ │ │ -
70 ColIterator col=(*row).beforeEnd();
│ │ │ │ -
71 *dIter = *bIter;
│ │ │ │ -
72
│ │ │ │ -
73 for (; col.index()>row.index(); --col)
│ │ │ │ -
74 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{i>j} a_ij * xnew_j
│ │ │ │ -
75 assert(row.index()==col.index());
│ │ │ │ -
76 ColIterator diag=col;
│ │ │ │ -
77 YBlock v=*dIter;
│ │ │ │ -
78 // upper diagonal matrix
│ │ │ │ -
79 for (--col; col!=endCol; --col)
│ │ │ │ -
80 (*col).mmv(x[col.index()],v); // v -= sum_{j<i} a_ij * xold_j
│ │ │ │ -
81
│ │ │ │ -
82 // Not recursive yet. Just solve with the diagonal
│ │ │ │ -
83 diag->solve(*xIter,v);
│ │ │ │ -
84
│ │ │ │ -
85 *dIter-=v;
│ │ │ │ -
86
│ │ │ │ -
87 // Update residual for the symmetric case
│ │ │ │ -
88 // Skip residual computation as it is not needed.
│ │ │ │ -
89 //for(col=(*row).begin();col.index()<row.index(); ++col)
│ │ │ │ -
90 //col.mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ │ -
91 }
│ │ │ │ -
92 }
│ │ │ │ -
│ │ │ │ -
93 };
│ │ │ │ -
│ │ │ │ -
94 } // end namespace Amg
│ │ │ │ -
95} // end namespace Dune
│ │ │ │ -
96#endif
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
18#include "istlexception.hh"
│ │ │ │ +
19
│ │ │ │ +
20// forward declaration
│ │ │ │ +
21namespace Dune {
│ │ │ │ +
22 template < typename... Args >
│ │ │ │ +
23 class MultiTypeBlockVector;
│ │ │ │ +
24}
│ │ │ │ +
25
│ │ │ │ +
26#include "gsetc.hh"
│ │ │ │ +
27
│ │ │ │ +
28namespace Dune {
│ │ │ │ +
29
│ │ │ │ +
41 template <typename... Args>
│ │ │ │ +
│ │ │ │ +
42 struct FieldTraits< MultiTypeBlockVector<Args...> >
│ │ │ │ +
43 {
│ │ │ │ +
44 using field_type = typename MultiTypeBlockVector<Args...>::field_type;
│ │ │ │ +
45 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
46 };
│ │ │ │ +
│ │ │ │ +
56 template < typename... Args >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
58 : public std::tuple<Args...>
│ │ │ │ +
59 {
│ │ │ │ +
61 typedef std::tuple<Args...> TupleType;
│ │ │ │ +
62 public:
│ │ │ │ +
63
│ │ │ │ +
65 using size_type = std::size_t;
│ │ │ │ +
66
│ │ │ │ +
70 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
│ │ │ │ +
84 // make sure that we have an std::common_type: using an assertion produces a more readable error message
│ │ │ │ +
85 // than a compiler template instantiation error
│ │ │ │ +
86 static_assert ( sizeof...(Args) == 0 or not std::is_same_v<field_type, Std::nonesuch>,
│ │ │ │ +
87 "No std::common_type implemented for the given field_types of the Args. Please provide an implementation and check that a FieldTraits class is present for your type.");
│ │ │ │ +
88
│ │ │ │ +
89
│ │ │ │ +
│ │ │ │ +
95 static constexpr size_type size()
│ │ │ │ +
96 {
│ │ │ │ +
97 return sizeof...(Args);
│ │ │ │ +
98 }
│ │ │ │ +
│ │ │ │ +
99
│ │ │ │ +
│ │ │ │ +
102 static constexpr size_type N()
│ │ │ │ +
103 {
│ │ │ │ +
104 return sizeof...(Args);
│ │ │ │ +
105 }
│ │ │ │ +
│ │ │ │ +
106
│ │ │ │ +
113 [[deprecated("Use method 'N' instead")]]
│ │ │ │ +
│ │ │ │ +
114 int count() const
│ │ │ │ +
115 {
│ │ │ │ +
116 return sizeof...(Args);
│ │ │ │ +
117 }
│ │ │ │ +
│ │ │ │ +
118
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
121 {
│ │ │ │ +
122 size_type result = 0;
│ │ │ │ +
123 Hybrid::forEach(std::make_index_sequence<N()>{},
│ │ │ │ +
124 [&](auto i){result += std::get<i>(*this).dim();});
│ │ │ │ +
125
│ │ │ │ +
126 return result;
│ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │ +
128
│ │ │ │ +
147 template< size_type index >
│ │ │ │ +
148 typename std::tuple_element<index,TupleType>::type&
│ │ │ │ +
│ │ │ │ +
149 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable)
│ │ │ │ +
150 {
│ │ │ │ +
151 return std::get<index>(*this);
│ │ │ │ +
152 }
│ │ │ │ +
│ │ │ │ +
153
│ │ │ │ +
159 template< size_type index >
│ │ │ │ +
160 const typename std::tuple_element<index,TupleType>::type&
│ │ │ │ +
│ │ │ │ +
161 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable) const
│ │ │ │ +
162 {
│ │ │ │ +
163 return std::get<index>(*this);
│ │ │ │ +
164 }
│ │ │ │ +
│ │ │ │ +
165
│ │ │ │ +
168 template<typename T>
│ │ │ │ +
│ │ │ │ +
169 void operator= (const T& newval) {
│ │ │ │ +
170 Dune::Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ │ +
171 entry = newval;
│ │ │ │ +
172 });
│ │ │ │ +
173 }
│ │ │ │ +
│ │ │ │ +
174
│ │ │ │ +
│ │ │ │ +
178 void operator+= (const type& newv) {
│ │ │ │ +
179 using namespace Dune::Hybrid;
│ │ │ │ +
180 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ │ +
181 (*this)[i] += newv[i];
│ │ │ │ +
182 });
│ │ │ │ +
183 }
│ │ │ │ +
│ │ │ │ +
184
│ │ │ │ +
│ │ │ │ +
188 void operator-= (const type& newv) {
│ │ │ │ +
189 using namespace Dune::Hybrid;
│ │ │ │ +
190 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ │ +
191 (*this)[i] -= newv[i];
│ │ │ │ +
192 });
│ │ │ │ +
193 }
│ │ │ │ +
│ │ │ │ +
194
│ │ │ │ +
196 template<class T,
│ │ │ │ +
197 std::enable_if_t< IsNumber<T>::value, int> = 0>
│ │ │ │ +
│ │ │ │ +
198 void operator*= (const T& w) {
│ │ │ │ +
199 Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ │ +
200 entry *= w;
│ │ │ │ +
201 });
│ │ │ │ +
202 }
│ │ │ │ +
│ │ │ │ +
203
│ │ │ │ +
205 template<class T,
│ │ │ │ +
206 std::enable_if_t< IsNumber<T>::value, int> = 0>
│ │ │ │ +
│ │ │ │ +
207 void operator/= (const T& w) {
│ │ │ │ +
208 Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ │ +
209 entry /= w;
│ │ │ │ +
210 });
│ │ │ │ +
211 }
│ │ │ │ +
│ │ │ │ +
212
│ │ │ │ +
│ │ │ │ +
213 field_type operator* (const type& newv) const {
│ │ │ │ +
214 using namespace Dune::Hybrid;
│ │ │ │ +
215 return accumulate(integralRange(Hybrid::size(*this)), field_type(0), [&](auto&& a, auto&& i) {
│ │ │ │ +
216 return a + (*this)[i]*newv[i];
│ │ │ │ +
217 });
│ │ │ │ +
218 }
│ │ │ │ +
│ │ │ │ +
219
│ │ │ │ +
│ │ │ │ +
220 field_type dot (const type& newv) const {
│ │ │ │ +
221 using namespace Dune::Hybrid;
│ │ │ │ +
222 return accumulate(integralRange(Hybrid::size(*this)), field_type(0), [&](auto&& a, auto&& i) {
│ │ │ │ +
223 return a + (*this)[i].dot(newv[i]);
│ │ │ │ +
224 });
│ │ │ │ +
225 }
│ │ │ │ +
│ │ │ │ +
226
│ │ │ │ +
│ │ │ │ +
229 auto one_norm() const {
│ │ │ │ +
230 using namespace Dune::Hybrid;
│ │ │ │ +
231 return accumulate(*this, typename FieldTraits<field_type>::real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ │ +
232 return a + entry.one_norm();
│ │ │ │ +
233 });
│ │ │ │ +
234 }
│ │ │ │ +
│ │ │ │ +
235
│ │ │ │ +
│ │ │ │ +
238 auto one_norm_real() const {
│ │ │ │ +
239 using namespace Dune::Hybrid;
│ │ │ │ +
240 return accumulate(*this, typename FieldTraits<field_type>::real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ │ +
241 return a + entry.one_norm_real();
│ │ │ │ +
242 });
│ │ │ │ +
243 }
│ │ │ │ +
│ │ │ │ +
244
│ │ │ │ +
│ │ │ │ +
247 typename FieldTraits<field_type>::real_type two_norm2() const {
│ │ │ │ +
248 using namespace Dune::Hybrid;
│ │ │ │ +
249 return accumulate(*this, typename FieldTraits<field_type>::real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ │ +
250 return a + entry.two_norm2();
│ │ │ │ +
251 });
│ │ │ │ +
252 }
│ │ │ │ +
│ │ │ │ +
253
│ │ │ │ +
256 typename FieldTraits<field_type>::real_type two_norm() const {return sqrt(this->two_norm2());}
│ │ │ │ +
257
│ │ │ │ +
│ │ │ │ +
260 typename FieldTraits<field_type>::real_type infinity_norm() const
│ │ │ │ +
261 {
│ │ │ │ +
262 using namespace Dune::Hybrid;
│ │ │ │ +
263 using std::max;
│ │ │ │ +
264 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
265
│ │ │ │ +
266 real_type result = 0.0;
│ │ │ │ +
267 // Compute max norm tracking appearing nan values
│ │ │ │ +
268 // if the field type supports nan.
│ │ │ │ +
269 if constexpr (HasNaN<field_type>()) {
│ │ │ │ +
270 // This variable will preserve any nan value
│ │ │ │ +
271 real_type nanTracker = 1.0;
│ │ │ │ +
272 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
273 forEach(*this, [&](auto&& entry) {
│ │ │ │ +
274 real_type entryNorm = entry.infinity_norm();
│ │ │ │ +
275 result = max(entryNorm, result);
│ │ │ │ +
276 nanTracker += entryNorm;
│ │ │ │ +
277 });
│ │ │ │ +
278 // Incorporate possible nan value into result
│ │ │ │ +
279 result *= (nanTracker / nanTracker);
│ │ │ │ +
280 } else {
│ │ │ │ +
281 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
282 forEach(*this, [&](auto&& entry) {
│ │ │ │ +
283 result = max(entry.infinity_norm(), result);
│ │ │ │ +
284 });
│ │ │ │ +
285 }
│ │ │ │ +
286 return result;
│ │ │ │ +
287 }
│ │ │ │ +
│ │ │ │ +
288
│ │ │ │ +
│ │ │ │ +
291 typename FieldTraits<field_type>::real_type infinity_norm_real() const
│ │ │ │ +
292 {
│ │ │ │ +
293 using namespace Dune::Hybrid;
│ │ │ │ +
294 using std::max;
│ │ │ │ +
295 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
296
│ │ │ │ +
297 real_type result = 0.0;
│ │ │ │ +
298 // Compute max norm tracking appearing nan values
│ │ │ │ +
299 // if the field type supports nan.
│ │ │ │ +
300 if constexpr (HasNaN<field_type>()) {
│ │ │ │ +
301 // This variable will preserve any nan value
│ │ │ │ +
302 real_type nanTracker = 1.0;
│ │ │ │ +
303 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
304 forEach(*this, [&](auto&& entry) {
│ │ │ │ +
305 real_type entryNorm = entry.infinity_norm_real();
│ │ │ │ +
306 result = max(entryNorm, result);
│ │ │ │ +
307 nanTracker += entryNorm;
│ │ │ │ +
308 });
│ │ │ │ +
309 // Incorporate possible nan value into result
│ │ │ │ +
310 result *= (nanTracker / nanTracker);
│ │ │ │ +
311 } else {
│ │ │ │ +
312 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ +
313 forEach(*this, [&](auto&& entry) {
│ │ │ │ +
314 result = max(entry.infinity_norm_real(), result);
│ │ │ │ +
315 });
│ │ │ │ +
316 }
│ │ │ │ +
317 return result;
│ │ │ │ +
318 }
│ │ │ │ +
│ │ │ │ +
319
│ │ │ │ +
324 template<typename Ta>
│ │ │ │ +
│ │ │ │ +
325 void axpy (const Ta& a, const type& y) {
│ │ │ │ +
326 using namespace Dune::Hybrid;
│ │ │ │ +
327 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ │ +
328 (*this)[i].axpy(a, y[i]);
│ │ │ │ +
329 });
│ │ │ │ +
330 }
│ │ │ │ +
│ │ │ │ +
331
│ │ │ │ +
332 };
│ │ │ │ +
│ │ │ │ +
333
│ │ │ │ +
334
│ │ │ │ +
335
│ │ │ │ +
338 template <typename... Args>
│ │ │ │ +
│ │ │ │ +
339 std::ostream& operator<< (std::ostream& s, const MultiTypeBlockVector<Args...>& v) {
│ │ │ │ +
340 using namespace Dune::Hybrid;
│ │ │ │ +
341 forEach(integralRange(Dune::Hybrid::size(v)), [&](auto&& i) {
│ │ │ │ +
342 s << "\t(" << i << "):\n" << v[i] << "\n";
│ │ │ │ +
343 });
│ │ │ │ +
344 return s;
│ │ │ │ +
345 }
│ │ │ │ +
│ │ │ │ +
346
│ │ │ │ +
347} // end namespace Dune
│ │ │ │ +
348
│ │ │ │ +
349namespace std
│ │ │ │ +
350{
│ │ │ │ +
355 template <size_t i, typename... Args>
│ │ │ │ +
│ │ │ │ +
356 struct tuple_element<i,Dune::MultiTypeBlockVector<Args...> >
│ │ │ │ +
357 {
│ │ │ │ +
358 using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
│ │ │ │ +
359 };
│ │ │ │ +
│ │ │ │ +
360}
│ │ │ │ +
361
│ │ │ │ +
362#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:169
│ │ │ │ +
std::size_t size_type
Type used for vector sizes.
Definition multitypeblockvector.hh:65
│ │ │ │ +
typename FieldTraits< field_type >::real_type real_type
Definition multitypeblockvector.hh:45
│ │ │ │ +
int count() const
Definition multitypeblockvector.hh:114
│ │ │ │ +
static constexpr size_type N()
Number of elements.
Definition multitypeblockvector.hh:102
│ │ │ │ +
Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > >::field_type... > field_type
The type used for scalars.
Definition multitypeblockvector.hh:82
│ │ │ │ +
static constexpr size_type size()
Return the number of non-zero vector entries.
Definition multitypeblockvector.hh:95
│ │ │ │ +
std::tuple_element< index, TupleType >::type & operator[](const std::integral_constant< size_type, index > indexVariable)
Random-access operator.
Definition multitypeblockvector.hh:149
│ │ │ │ +
FieldTraits< field_type >::real_type two_norm() const
Compute the Euclidean norm.
Definition multitypeblockvector.hh:256
│ │ │ │ +
typename MultiTypeBlockVector< Args... >::field_type field_type
Definition multitypeblockvector.hh:44
│ │ │ │ +
size_type dim() const
Number of scalar elements.
Definition multitypeblockvector.hh:120
│ │ │ │ +
field_type dot(const type &newv) const
Definition multitypeblockvector.hh:220
│ │ │ │ +
void operator*=(const T &w)
Multiplication with a scalar.
Definition multitypeblockvector.hh:198
│ │ │ │ +
void axpy(const Ta &a, const type &y)
Axpy operation on this vector (*this += a * y)
Definition multitypeblockvector.hh:325
│ │ │ │ +
void operator/=(const T &w)
Division by a scalar.
Definition multitypeblockvector.hh:207
│ │ │ │ +
MultiTypeBlockVector< Args... > type
Definition multitypeblockvector.hh:75
│ │ │ │ +
FieldTraits< field_type >::real_type infinity_norm_real() const
Compute the simplified maximum norm (uses 1-norm for complex values)
Definition multitypeblockvector.hh:291
│ │ │ │ +
auto one_norm() const
Compute the 1-norm.
Definition multitypeblockvector.hh:229
│ │ │ │ +
void operator-=(const type &newv)
Definition multitypeblockvector.hh:188
│ │ │ │ +
field_type operator*(const type &newv) const
Definition multitypeblockvector.hh:213
│ │ │ │ +
void operator+=(const type &newv)
Definition multitypeblockvector.hh:178
│ │ │ │ +
typename std::tuple_element< i, std::tuple< Args... > >::type type
Definition multitypeblockvector.hh:358
│ │ │ │ +
FieldTraits< field_type >::real_type infinity_norm() const
Compute the maximum norm.
Definition multitypeblockvector.hh:260
│ │ │ │ +
auto one_norm_real() const
Compute the simplified 1-norm (uses 1-norm also for complex values)
Definition multitypeblockvector.hh:238
│ │ │ │ +
FieldTraits< field_type >::real_type two_norm2() const
Compute the squared Euclidean norm.
Definition multitypeblockvector.hh:247
│ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Definition fastamgsmoother.hh:16
│ │ │ │ -
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:19
│ │ │ │ -
Definition fastamgsmoother.hh:52
│ │ │ │ -
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:55
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:590
│ │ │ │ +
A Vector class to support different block types.
Definition multitypeblockvector.hh:59
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,123 +1,393 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -fastamgsmoother.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 (C) 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_MULTITYPEBLOCKVECTOR_HH │ │ │ │ │ +6#define DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10namespace _D_u_n_e │ │ │ │ │ -11{ │ │ │ │ │ -12 namespace Amg │ │ │ │ │ -13 { │ │ │ │ │ -14 │ │ │ │ │ -15 template │ │ │ │ │ -_1_6 struct _G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t { │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ 17 │ │ │ │ │ -18 template │ │ │ │ │ -_1_9 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ │ -20 const Y& b) │ │ │ │ │ -21 { │ │ │ │ │ -22 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ │ -23 typedef typename M::ConstColIterator ColIterator; │ │ │ │ │ -24 │ │ │ │ │ -25 typename Y::iterator dIter=d.begin(); │ │ │ │ │ -26 typename Y::const_iterator bIter=b.begin(); │ │ │ │ │ -27 typename X::iterator xIter=x.begin(); │ │ │ │ │ -28 │ │ │ │ │ -29 for(RowIterator row=A.begin(), end=A.end(); row != end; │ │ │ │ │ -30 ++row, ++dIter, ++xIter, ++bIter) │ │ │ │ │ -31 { │ │ │ │ │ -32 ColIterator _c_o_l=(*row).begin(); │ │ │ │ │ -33 *dIter = *bIter; │ │ │ │ │ -34 │ │ │ │ │ -35 for (; _c_o_l.index()solve(*xIter,*dIter); │ │ │ │ │ -42 *dIter=0; //as r=v │ │ │ │ │ -43 │ │ │ │ │ -44 // Update residual for the symmetric case │ │ │ │ │ -45 for(_c_o_l=(*row).begin(); _c_o_l.index()mmv(*xIter, d[_c_o_l.index()]); //d_j-=A_ij x_i │ │ │ │ │ -47 } │ │ │ │ │ -48 } │ │ │ │ │ -49 }; │ │ │ │ │ -50 │ │ │ │ │ -51 template │ │ │ │ │ -_5_2 struct _G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t { │ │ │ │ │ -53 │ │ │ │ │ -54 template │ │ │ │ │ -_5_5 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ │ -56 const Y& b) │ │ │ │ │ -57 { │ │ │ │ │ -58 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ │ -59 typedef typename M::ConstColIterator ColIterator; │ │ │ │ │ -60 typedef typename Y::block_type YBlock; │ │ │ │ │ -61 │ │ │ │ │ -62 typename Y::iterator dIter=d.beforeEnd(); │ │ │ │ │ -63 typename X::iterator xIter=x.beforeEnd(); │ │ │ │ │ -64 typename Y::const_iterator bIter=b.beforeEnd(); │ │ │ │ │ -65 │ │ │ │ │ -66 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end; │ │ │ │ │ -67 --row, --dIter, --xIter, --bIter) │ │ │ │ │ -68 { │ │ │ │ │ -69 ColIterator endCol=(*row).beforeBegin(); │ │ │ │ │ -70 ColIterator _c_o_l=(*row).beforeEnd(); │ │ │ │ │ -71 *dIter = *bIter; │ │ │ │ │ -72 │ │ │ │ │ -73 for (; _c_o_l.index()>row.index(); --_c_o_l) │ │ │ │ │ -74 (*col).mmv(x[_c_o_l.index()],*dIter); // rhs -= sum_{i>j} a_ij * xnew_j │ │ │ │ │ -75 assert(row.index()==_c_o_l.index()); │ │ │ │ │ -76 ColIterator diag=_c_o_l; │ │ │ │ │ -77 YBlock v=*dIter; │ │ │ │ │ -78 // upper diagonal matrix │ │ │ │ │ -79 for (--_c_o_l; _c_o_l!=endCol; --_c_o_l) │ │ │ │ │ -80 (*col).mmv(x[_c_o_l.index()],v); // v -= sum_{jsolve(*xIter,v); │ │ │ │ │ -84 │ │ │ │ │ -85 *dIter-=v; │ │ │ │ │ -86 │ │ │ │ │ -87 // Update residual for the symmetric case │ │ │ │ │ -88 // Skip residual computation as it is not needed. │ │ │ │ │ -89 //for(col=(*row).begin();col.index() │ │ │ │ │ +23 class MultiTypeBlockVector; │ │ │ │ │ +24} │ │ │ │ │ +25 │ │ │ │ │ +26#include "_g_s_e_t_c_._h_h" │ │ │ │ │ +27 │ │ │ │ │ +28namespace _D_u_n_e { │ │ │ │ │ +29 │ │ │ │ │ +41 template │ │ │ │ │ +_4_2 struct FieldTraits< _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ │ +43 { │ │ │ │ │ +_4_4 using _f_i_e_l_d___t_y_p_e = typename _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r::field_type; │ │ │ │ │ +_4_5 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ +46 }; │ │ │ │ │ +56 template < typename... Args > │ │ │ │ │ +_5_7 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ │ +58 : public std::tuple │ │ │ │ │ +59 { │ │ │ │ │ +61 typedef std::tuple TupleType; │ │ │ │ │ +62 public: │ │ │ │ │ +63 │ │ │ │ │ +_6_5 using _s_i_z_e___t_y_p_e = std::size_t; │ │ │ │ │ +66 │ │ │ │ │ +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 │ │ │ │ │ +84 // make sure that we have an std::common_type: using an assertion produces a │ │ │ │ │ +more readable error message │ │ │ │ │ +85 // than a compiler template instantiation error │ │ │ │ │ +86 static_assert ( sizeof...(Args) == 0 or not std::is_same_v, │ │ │ │ │ +87 "No std::common_type implemented for the given field_types of the Args. │ │ │ │ │ +Please provide an implementation and check that a FieldTraits class is present │ │ │ │ │ +for your type."); │ │ │ │ │ +88 │ │ │ │ │ +89 │ │ │ │ │ +_9_5 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e() │ │ │ │ │ +96 { │ │ │ │ │ +97 return sizeof...(Args); │ │ │ │ │ +98 } │ │ │ │ │ +99 │ │ │ │ │ +_1_0_2 static constexpr _s_i_z_e___t_y_p_e _N() │ │ │ │ │ +103 { │ │ │ │ │ +104 return sizeof...(Args); │ │ │ │ │ +105 } │ │ │ │ │ +106 │ │ │ │ │ +113 [[deprecated("Use method 'N' instead")]] │ │ │ │ │ +_1_1_4 int _c_o_u_n_t() const │ │ │ │ │ +115 { │ │ │ │ │ +116 return sizeof...(Args); │ │ │ │ │ +117 } │ │ │ │ │ +118 │ │ │ │ │ +_1_2_0 _s_i_z_e___t_y_p_e _d_i_m() const │ │ │ │ │ +121 { │ │ │ │ │ +122 _s_i_z_e___t_y_p_e result = 0; │ │ │ │ │ +123 Hybrid::forEach(std::make_index_sequence<_N()>{}, │ │ │ │ │ +124 [&](auto i){result += std::get(*this).dim();}); │ │ │ │ │ +125 │ │ │ │ │ +126 return result; │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +147 template< size_type index > │ │ │ │ │ +148 typename std::tuple_element::type& │ │ │ │ │ +_1_4_9 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ +> indexVariable) │ │ │ │ │ +150 { │ │ │ │ │ +151 return std::get(*this); │ │ │ │ │ +152 } │ │ │ │ │ +153 │ │ │ │ │ +159 template< size_type index > │ │ │ │ │ +160 const typename std::tuple_element::type& │ │ │ │ │ +_1_6_1 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ +> indexVariable) const │ │ │ │ │ +162 { │ │ │ │ │ +163 return std::get(*this); │ │ │ │ │ +164 } │ │ │ │ │ +165 │ │ │ │ │ +168 template │ │ │ │ │ +_1_6_9 void _o_p_e_r_a_t_o_r_=_ (const T& newval) { │ │ │ │ │ +170 Dune::Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ │ +171 entry = newval; │ │ │ │ │ +172 }); │ │ │ │ │ +173 } │ │ │ │ │ +174 │ │ │ │ │ +_1_7_8 void _o_p_e_r_a_t_o_r_+_=_ (const _t_y_p_e& newv) { │ │ │ │ │ +179 using namespace Dune::Hybrid; │ │ │ │ │ +180 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ │ +181 (*this)[i] += newv[i]; │ │ │ │ │ +182 }); │ │ │ │ │ +183 } │ │ │ │ │ +184 │ │ │ │ │ +_1_8_8 void _o_p_e_r_a_t_o_r_-_=_ (const _t_y_p_e& newv) { │ │ │ │ │ +189 using namespace Dune::Hybrid; │ │ │ │ │ +190 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ │ +191 (*this)[i] -= newv[i]; │ │ │ │ │ +192 }); │ │ │ │ │ +193 } │ │ │ │ │ +194 │ │ │ │ │ +196 template::value, int> = 0> │ │ │ │ │ +_1_9_8 void _o_p_e_r_a_t_o_r_*_=_ (const T& w) { │ │ │ │ │ +199 Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ │ +200 entry *= w; │ │ │ │ │ +201 }); │ │ │ │ │ +202 } │ │ │ │ │ +203 │ │ │ │ │ +205 template::value, int> = 0> │ │ │ │ │ +_2_0_7 void _o_p_e_r_a_t_o_r_/_=_ (const T& w) { │ │ │ │ │ +208 Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ │ +209 entry /= w; │ │ │ │ │ +210 }); │ │ │ │ │ +211 } │ │ │ │ │ +212 │ │ │ │ │ +_2_1_3 _f_i_e_l_d___t_y_p_e _o_p_e_r_a_t_o_r_*_ (const _t_y_p_e& newv) const { │ │ │ │ │ +214 using namespace Dune::Hybrid; │ │ │ │ │ +215 return accumulate(integralRange(Hybrid::size(*this)), _f_i_e_l_d___t_y_p_e(0), [&] │ │ │ │ │ +(auto&& a, auto&& i) { │ │ │ │ │ +216 return a + (*this)[i]*newv[i]; │ │ │ │ │ +217 }); │ │ │ │ │ +218 } │ │ │ │ │ +219 │ │ │ │ │ +_2_2_0 _f_i_e_l_d___t_y_p_e _d_o_t (const _t_y_p_e& newv) const { │ │ │ │ │ +221 using namespace Dune::Hybrid; │ │ │ │ │ +222 return accumulate(integralRange(Hybrid::size(*this)), _f_i_e_l_d___t_y_p_e(0), [&] │ │ │ │ │ +(auto&& a, auto&& i) { │ │ │ │ │ +223 return a + (*this)[i].dot(newv[i]); │ │ │ │ │ +224 }); │ │ │ │ │ +225 } │ │ │ │ │ +226 │ │ │ │ │ +_2_2_9 auto _o_n_e___n_o_r_m() const { │ │ │ │ │ +230 using namespace Dune::Hybrid; │ │ │ │ │ +231 return accumulate(*this, typename FieldTraits::real_type(0), │ │ │ │ │ +[&](auto&& a, auto&& entry) { │ │ │ │ │ +232 return a + entry.one_norm(); │ │ │ │ │ +233 }); │ │ │ │ │ +234 } │ │ │ │ │ +235 │ │ │ │ │ +_2_3_8 auto _o_n_e___n_o_r_m___r_e_a_l() const { │ │ │ │ │ +239 using namespace Dune::Hybrid; │ │ │ │ │ +240 return accumulate(*this, typename FieldTraits::real_type(0), │ │ │ │ │ +[&](auto&& a, auto&& entry) { │ │ │ │ │ +241 return a + entry.one_norm_real(); │ │ │ │ │ +242 }); │ │ │ │ │ +243 } │ │ │ │ │ +244 │ │ │ │ │ +_2_4_7 typename FieldTraits::real_type _t_w_o___n_o_r_m_2() const { │ │ │ │ │ +248 using namespace Dune::Hybrid; │ │ │ │ │ +249 return accumulate(*this, typename FieldTraits::real_type(0), │ │ │ │ │ +[&](auto&& a, auto&& entry) { │ │ │ │ │ +250 return a + entry.two_norm2(); │ │ │ │ │ +251 }); │ │ │ │ │ +252 } │ │ │ │ │ +253 │ │ │ │ │ +_2_5_6 typename FieldTraits::real_type _t_w_o___n_o_r_m() const {return sqrt │ │ │ │ │ +(this->_t_w_o___n_o_r_m_2());} │ │ │ │ │ +257 │ │ │ │ │ +_2_6_0 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const │ │ │ │ │ +261 { │ │ │ │ │ +262 using namespace Dune::Hybrid; │ │ │ │ │ +263 using std::max; │ │ │ │ │ +264 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +265 │ │ │ │ │ +266 real_type result = 0.0; │ │ │ │ │ +267 // Compute max norm tracking appearing nan values │ │ │ │ │ +268 // if the field type supports nan. │ │ │ │ │ +269 if constexpr (HasNaN()) { │ │ │ │ │ +270 // This variable will preserve any nan value │ │ │ │ │ +271 real_type nanTracker = 1.0; │ │ │ │ │ +272 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +273 forEach(*this, [&](auto&& entry) { │ │ │ │ │ +274 real_type entryNorm = entry.infinity_norm(); │ │ │ │ │ +275 result = max(entryNorm, result); │ │ │ │ │ +276 nanTracker += entryNorm; │ │ │ │ │ +277 }); │ │ │ │ │ +278 // Incorporate possible nan value into result │ │ │ │ │ +279 result *= (nanTracker / nanTracker); │ │ │ │ │ +280 } else { │ │ │ │ │ +281 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +282 forEach(*this, [&](auto&& entry) { │ │ │ │ │ +283 result = max(entry.infinity_norm(), result); │ │ │ │ │ +284 }); │ │ │ │ │ +285 } │ │ │ │ │ +286 return result; │ │ │ │ │ +287 } │ │ │ │ │ +288 │ │ │ │ │ +_2_9_1 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const │ │ │ │ │ +292 { │ │ │ │ │ +293 using namespace Dune::Hybrid; │ │ │ │ │ +294 using std::max; │ │ │ │ │ +295 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +296 │ │ │ │ │ +297 real_type result = 0.0; │ │ │ │ │ +298 // Compute max norm tracking appearing nan values │ │ │ │ │ +299 // if the field type supports nan. │ │ │ │ │ +300 if constexpr (HasNaN()) { │ │ │ │ │ +301 // This variable will preserve any nan value │ │ │ │ │ +302 real_type nanTracker = 1.0; │ │ │ │ │ +303 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +304 forEach(*this, [&](auto&& entry) { │ │ │ │ │ +305 real_type entryNorm = entry.infinity_norm_real(); │ │ │ │ │ +306 result = max(entryNorm, result); │ │ │ │ │ +307 nanTracker += entryNorm; │ │ │ │ │ +308 }); │ │ │ │ │ +309 // Incorporate possible nan value into result │ │ │ │ │ +310 result *= (nanTracker / nanTracker); │ │ │ │ │ +311 } else { │ │ │ │ │ +312 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ +313 forEach(*this, [&](auto&& entry) { │ │ │ │ │ +314 result = max(entry.infinity_norm_real(), result); │ │ │ │ │ +315 }); │ │ │ │ │ +316 } │ │ │ │ │ +317 return result; │ │ │ │ │ +318 } │ │ │ │ │ +319 │ │ │ │ │ +324 template │ │ │ │ │ +_3_2_5 void _a_x_p_y (const Ta& a, const _t_y_p_e& y) { │ │ │ │ │ +326 using namespace Dune::Hybrid; │ │ │ │ │ +327 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ │ +328 (*this)[i].axpy(a, y[i]); │ │ │ │ │ +329 }); │ │ │ │ │ +330 } │ │ │ │ │ +331 │ │ │ │ │ +332 }; │ │ │ │ │ +333 │ │ │ │ │ +334 │ │ │ │ │ +335 │ │ │ │ │ +338 template │ │ │ │ │ +_3_3_9 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) { │ │ │ │ │ +340 using namespace Dune::Hybrid; │ │ │ │ │ +341 forEach(integralRange(Dune::Hybrid::size(v)), [&](auto&& i) { │ │ │ │ │ +342 s << "\t(" << i << "):\n" << v[i] << "\n"; │ │ │ │ │ +343 }); │ │ │ │ │ +344 return s; │ │ │ │ │ +345 } │ │ │ │ │ +346 │ │ │ │ │ +347} // end namespace Dune │ │ │ │ │ +348 │ │ │ │ │ +349namespace _s_t_d │ │ │ │ │ +350{ │ │ │ │ │ +355 template │ │ │ │ │ +_3_5_6 struct tuple_element > │ │ │ │ │ +357 { │ │ │ │ │ +_3_5_8 using _t_y_p_e = typename std::tuple_element >::type; │ │ │ │ │ +359 }; │ │ │ │ │ +360} │ │ │ │ │ +361 │ │ │ │ │ +362#endif │ │ │ │ │ +_g_s_e_t_c_._h_h │ │ │ │ │ +Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ +generic way. │ │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_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:169 │ │ │ │ │ +_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_:_:_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 FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_c_o_u_n_t │ │ │ │ │ +int count() const │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:114 │ │ │ │ │ +_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:102 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > │ │ │ │ │ +>::field_type... > field_type │ │ │ │ │ +The type used for scalars. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ +static constexpr size_type size() │ │ │ │ │ +Return the number of non-zero vector entries. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:95 │ │ │ │ │ +_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:149 │ │ │ │ │ +_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 │ │ │ │ │ +FieldTraits< field_type >::real_type two_norm() const │ │ │ │ │ +Compute the Euclidean norm. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:256 │ │ │ │ │ +_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:120 │ │ │ │ │ +_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:220 │ │ │ │ │ +_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:198 │ │ │ │ │ +_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:325 │ │ │ │ │ +_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:207 │ │ │ │ │ +_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_:_:_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 │ │ │ │ │ +Compute the simplified maximum norm (uses 1-norm for complex values) │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:291 │ │ │ │ │ +_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:229 │ │ │ │ │ +_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:188 │ │ │ │ │ +_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:213 │ │ │ │ │ +_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:178 │ │ │ │ │ +_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:358 │ │ │ │ │ +_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 │ │ │ │ │ +FieldTraits< field_type >::real_type infinity_norm() const │ │ │ │ │ +Compute the maximum norm. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:260 │ │ │ │ │ +_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:238 │ │ │ │ │ +_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 │ │ │ │ │ +FieldTraits< field_type >::real_type two_norm2() const │ │ │ │ │ +Compute the squared Euclidean norm. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:247 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t │ │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:16 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ │ -static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t │ │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ │ -static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_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:590 │ │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ │ +A Vector class to support different block types. │ │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:59 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: smoother.hh File Reference │ │ │ │ +dune-istl: istlexception.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,126 +65,52 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ +
istlexception.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 <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/fmatrix.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::ISTLError
 derive error class from the base class in common More...
 
class  Dune::Amg::ConstructionArgs< SeqILU< M, X, Y > >
class  Dune::BCRSMatrixError
 Error specific to BCRSMatrix. More...
 
struct  Dune::Amg::ConstructionTraits< SeqILU< M, X, Y > >
 Policy for the construction of the SeqILU smoother. More...
class  Dune::ImplicitModeCompressionBufferExhausted
 Thrown when the compression buffer used by the implicit BCRSMatrix construction is exhausted. More...
 
struct  Dune::Amg::ConstructionTraits< ParSSOR< M, X, Y, C > >
 Policy for the construction of the ParSSOR smoother. More...
class  Dune::SolverAbort
 Thrown when a solver aborts due to some problem. 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 > >
class  Dune::MatrixBlockError
 Error when performing an operation on a matrix block. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

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

Detailed Description

│ │ │ │ -

Classes for the generic construction and application of the smoothers.

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

provides functions for sparse matrix matrix multiplication. │ │ │ │ +More...

│ │ │ │
#include <tuple>
│ │ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ +#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <dune/common/timer.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Amg::ApplyHelper< i >
struct  Dune::MatMultMatResult< M1, M2 >
 Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$) More...
 
struct  Dune::MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >
 
struct  Dune::MatMultMatResult< BCRSMatrix< FieldMatrix< T, n, k >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > >
 
struct  Dune::Amg::ApplyHelper< 0 >
struct  Dune::TransposedMatMultMatResult< M1, M2 >
 Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$) More...
 
class  Dune::Amg::CombinedFunctor< T >
struct  Dune::TransposedMatMultMatResult< FieldMatrix< T, k, n >, FieldMatrix< T, k, m > >
 
struct  Dune::TransposedMatMultMatResult< BCRSMatrix< FieldMatrix< T, k, n >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<class T , class A , class A1 , class A2 , int n, int m, int k>
void Dune::matMultTransposeMat (BCRSMatrix< FieldMatrix< T, n, k >, A > &res, const BCRSMatrix< FieldMatrix< T, n, m >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
 Calculate product of a sparse matrix with a transposed sparse matrices ( $C=A*B^T$).
 
template<class T , class A , class A1 , class A2 , int n, int m, int k>
void Dune::matMultMat (BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, n, k >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
 Calculate product of two sparse matrices ( $C=A*B$).
 
template<class T , class A , class A1 , class A2 , int n, int m, int k>
void Dune::transposeMatMultMat (BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, k, n >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
 Calculate product of a transposed sparse matrix with another sparse matrices ( $C=A^T*B$).
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

provides functions for sparse matrix matrix multiplication.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,25 +1,66 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -combinedfunctor.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 │ │ │ │ │ +matrixmatrix.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 │ │ │ │ │ +provides functions for sparse matrix matrix multiplication. _M_o_r_e_._._. │ │ │ │ │ #include │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_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_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _i_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _M_1_,_ _M_2_ _> │ │ │ │ │ +  Helper TMP to get the result type of a sparse matrix matrix │ │ │ │ │ + multiplication ( [$C=A*B$]) _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _0_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _> │ │ │ │ │ + _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_<_ _T_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _A_ _>_, │ │ │ │ │ + _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _M_1_,_ _M_2_ _> │ │ │ │ │ +  Helper TMP to get the result type of a sparse matrix matrix │ │ │ │ │ + multiplication ( [$C=A*B$]) _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_< │ │ │ │ │ + _T_,_ _k_,_ _m_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_, │ │ │ │ │ + _A_ _>_,_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_m_a_t_M_u_l_t_T_r_a_n_s_p_o_s_e_M_a_t (_B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, n, k >, A > &res, │ │ │ │ │ + const _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, n, m >, A1 > &_m_a_t, const _B_C_R_S_M_a_t_r_i_x< │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ +  Calculate product of a sparse matrix with a transposed sparse matrices ( │ │ │ │ │ + [$C=A*B^T$]). │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_m_a_t_M_u_l_t_M_a_t (_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 > &res, const │ │ │ │ │ + _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, n, k >, A1 > &_m_a_t, const _B_C_R_S_M_a_t_r_i_x< │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ +  Calculate product of two sparse matrices ( [$C=A*B$]). │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_t_r_a_n_s_p_o_s_e_M_a_t_M_u_l_t_M_a_t (_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 > &res, │ │ │ │ │ + const _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, k, n >, A1 > &_m_a_t, const _B_C_R_S_M_a_t_r_i_x< │ │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ +  Calculate product of a transposed sparse matrix with another sparse │ │ │ │ │ + matrices ( [$C=A^T*B$]). │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +provides functions for sparse matrix matrix multiplication. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: combinedfunctor.hh Source File │ │ │ │ +dune-istl: matrixmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,94 +70,626 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
combinedfunctor.hh
│ │ │ │ +
matrixmatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_COMBINEDFUNCTOR_HH
│ │ │ │ -
6#define DUNE_AMG_COMBINEDFUNCTOR_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_MATRIXMATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_MATRIXMATRIX_HH
│ │ │ │
7
│ │ │ │
8#include <tuple>
│ │ │ │
9
│ │ │ │ -
10namespace Dune
│ │ │ │ -
11{
│ │ │ │ -
12 namespace Amg
│ │ │ │ -
13 {
│ │ │ │ -
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 {}
│ │ │ │ -
│ │ │ │ + │ │ │ │ +
11#include <dune/common/fmatrix.hh>
│ │ │ │ +
12#include <dune/common/timer.hh>
│ │ │ │ +
13namespace Dune
│ │ │ │ +
14{
│ │ │ │ +
15
│ │ │ │ +
26 namespace
│ │ │ │ +
27 {
│ │ │ │ +
28
│ │ │ │ +
37 template<int b>
│ │ │ │ +
38 struct NonzeroPatternTraverser
│ │ │ │ +
39 {};
│ │ │ │ +
40
│ │ │ │
41
│ │ │ │ -
42 template<class T1>
│ │ │ │ -
│ │ │ │ -
43 void operator()(const T1& t)
│ │ │ │ -
44 {
│ │ │ │ - │ │ │ │ -
46 }
│ │ │ │ -
│ │ │ │ -
47 };
│ │ │ │ -
│ │ │ │ -
48
│ │ │ │ -
49
│ │ │ │ -
50 } //namespace Amg
│ │ │ │ -
51} // namespace Dune
│ │ │ │ -
52#endif
│ │ │ │ +
42 template<>
│ │ │ │ +
43 struct NonzeroPatternTraverser<0>
│ │ │ │ +
44 {
│ │ │ │ +
45 template<class T,class A1, class A2, class F, int n, int m, int k>
│ │ │ │ +
46 static void traverse(const Dune::BCRSMatrix<Dune::FieldMatrix<T,n,k>,A1>& A,
│ │ │ │ + │ │ │ │ +
48 F& func)
│ │ │ │ +
49 {
│ │ │ │ +
50 if(A.M()!=B.N())
│ │ │ │ +
51 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "<<A.M()<<"!="<<B.N());
│ │ │ │ +
52
│ │ │ │ +
53 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,n,k>,A1>::ConstRowIterator Row;
│ │ │ │ +
54 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,n,k>,A1>::ConstColIterator Col;
│ │ │ │ +
55 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,m>,A2>::ConstColIterator BCol;
│ │ │ │ +
56 for(Row row= A.begin(); row != A.end(); ++row) {
│ │ │ │ +
57 // Loop over all column entries
│ │ │ │ +
58 for(Col col = row->begin(); col != row->end(); ++col) {
│ │ │ │ +
59 // entry at i,k
│ │ │ │ +
60 // search for all nonzeros in row k
│ │ │ │ +
61 for(BCol bcol = B[col.index()].begin(); bcol != B[col.index()].end(); ++bcol) {
│ │ │ │ +
62 func(*col, *bcol, row.index(), bcol.index());
│ │ │ │ +
63 }
│ │ │ │ +
64 }
│ │ │ │ +
65 }
│ │ │ │ +
66 }
│ │ │ │ +
67
│ │ │ │ +
68 };
│ │ │ │ +
69
│ │ │ │ +
70 template<>
│ │ │ │ +
71 struct NonzeroPatternTraverser<1>
│ │ │ │ +
72 {
│ │ │ │ +
73 template<class T, class A1, class A2, class F, int n, int m, int k>
│ │ │ │ +
74 static void traverse(const Dune::BCRSMatrix<Dune::FieldMatrix<T,k,n>,A1>& A,
│ │ │ │ + │ │ │ │ +
76 F& func)
│ │ │ │ +
77 {
│ │ │ │ +
78
│ │ │ │ +
79 if(A.N()!=B.N())
│ │ │ │ +
80 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "<<A.N()<<"!="<<B.N());
│ │ │ │ +
81
│ │ │ │ +
82 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,n>,A1>::ConstRowIterator Row;
│ │ │ │ +
83 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,n>,A1>::ConstColIterator Col;
│ │ │ │ +
84 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,m>,A2>::ConstColIterator BCol;
│ │ │ │ +
85
│ │ │ │ +
86 for(Row row=A.begin(); row!=A.end(); ++row) {
│ │ │ │ +
87 for(Col col=row->begin(); col!=row->end(); ++col) {
│ │ │ │ +
88 for(BCol bcol = B[row.index()].begin(); bcol != B[row.index()].end(); ++bcol) {
│ │ │ │ +
89 func(*col, *bcol, col.index(), bcol.index());
│ │ │ │ +
90 }
│ │ │ │ +
91 }
│ │ │ │ +
92 }
│ │ │ │ +
93 }
│ │ │ │ +
94 };
│ │ │ │ +
95
│ │ │ │ +
96 template<>
│ │ │ │ +
97 struct NonzeroPatternTraverser<2>
│ │ │ │ +
98 {
│ │ │ │ +
99 template<class T, class A1, class A2, class F, int n, int m, int k>
│ │ │ │ +
100 static void traverse(const BCRSMatrix<FieldMatrix<T,n,m>,A1>& mat,
│ │ │ │ +
101 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt,
│ │ │ │ +
102 F& func)
│ │ │ │ +
103 {
│ │ │ │ +
104 if(mat.M()!=matt.M())
│ │ │ │ +
105 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "<<mat.M()<<"!="<<matt.M());
│ │ │ │ +
106
│ │ │ │ +
107 typedef typename BCRSMatrix<FieldMatrix<T,n,m>,A1>::ConstRowIterator row_iterator;
│ │ │ │ +
108 typedef typename BCRSMatrix<FieldMatrix<T,n,m>,A1>::ConstColIterator col_iterator;
│ │ │ │ +
109 typedef typename BCRSMatrix<FieldMatrix<T,k,m>,A2>::ConstRowIterator row_iterator_t;
│ │ │ │ +
110 typedef typename BCRSMatrix<FieldMatrix<T,k,m>,A2>::ConstColIterator col_iterator_t;
│ │ │ │ +
111
│ │ │ │ +
112 for(row_iterator mrow=mat.begin(); mrow != mat.end(); ++mrow) {
│ │ │ │ +
113 //iterate over the column entries
│ │ │ │ +
114 // mt is a transposed matrix crs therefore it is treated as a ccs matrix
│ │ │ │ +
115 // and the row_iterator iterates over the columns of the transposed matrix.
│ │ │ │ +
116 // search the row of the transposed matrix for an entry with the same index
│ │ │ │ +
117 // as the mcol iterator
│ │ │ │ +
118
│ │ │ │ +
119 for(row_iterator_t mtcol=matt.begin(); mtcol != matt.end(); ++mtcol) {
│ │ │ │ +
120 //Search for col entries in mat that have a corrsponding row index in matt
│ │ │ │ +
121 // (i.e. corresponding col index in the as this is the transposed matrix
│ │ │ │ +
122 col_iterator_t mtrow=mtcol->begin();
│ │ │ │ +
123 bool funcCalled = false;
│ │ │ │ +
124 for(col_iterator mcol=mrow->begin(); mcol != mrow->end(); ++mcol) {
│ │ │ │ +
125 // search
│ │ │ │ +
126 // TODO: This should probably be substituted by a binary search
│ │ │ │ +
127 for( ; mtrow != mtcol->end(); ++mtrow)
│ │ │ │ +
128 if(mtrow.index()>=mcol.index())
│ │ │ │ +
129 break;
│ │ │ │ +
130 if(mtrow != mtcol->end() && mtrow.index()==mcol.index()) {
│ │ │ │ +
131 func(*mcol, *mtrow, mtcol.index());
│ │ │ │ +
132 funcCalled = true;
│ │ │ │ +
133 // In some cases we only search for one pair, then we break here
│ │ │ │ +
134 // and continue with the next column.
│ │ │ │ +
135 if(F::do_break)
│ │ │ │ +
136 break;
│ │ │ │ +
137 }
│ │ │ │ +
138 }
│ │ │ │ +
139 // move on with func only if func was called, otherwise they might
│ │ │ │ +
140 // get out of sync
│ │ │ │ +
141 if (funcCalled)
│ │ │ │ +
142 func.nextCol();
│ │ │ │ +
143 }
│ │ │ │ +
144 func.nextRow();
│ │ │ │ +
145 }
│ │ │ │ +
146 }
│ │ │ │ +
147 };
│ │ │ │ +
148
│ │ │ │ +
149
│ │ │ │ +
150
│ │ │ │ +
151 template<class T, class A, int n, int m>
│ │ │ │ +
152 class SparsityPatternInitializer
│ │ │ │ +
153 {
│ │ │ │ +
154 public:
│ │ │ │ +
155 enum {do_break=true};
│ │ │ │ + │ │ │ │ + │ │ │ │ +
158
│ │ │ │ +
159 SparsityPatternInitializer(CreateIterator iter)
│ │ │ │ +
160 : rowiter(iter)
│ │ │ │ +
161 {}
│ │ │ │ +
162
│ │ │ │ +
163 template<class T1, class T2>
│ │ │ │ +
164 void operator()(const T1&, const T2&, size_type j)
│ │ │ │ +
165 {
│ │ │ │ +
166 rowiter.insert(j);
│ │ │ │ +
167 }
│ │ │ │ +
168
│ │ │ │ +
169 void nextRow()
│ │ │ │ +
170 {
│ │ │ │ +
171 ++rowiter;
│ │ │ │ +
172 }
│ │ │ │ +
173 void nextCol()
│ │ │ │ +
174 {}
│ │ │ │ +
175
│ │ │ │ +
176 private:
│ │ │ │ +
177 CreateIterator rowiter;
│ │ │ │ +
178 };
│ │ │ │ +
179
│ │ │ │ +
180
│ │ │ │ +
181 template<int transpose, class T, class TA, int n, int m>
│ │ │ │ +
182 class MatrixInitializer
│ │ │ │ +
183 {
│ │ │ │ +
184 public:
│ │ │ │ +
185 enum {do_break=true};
│ │ │ │ + │ │ │ │ + │ │ │ │ +
188 typedef typename Matrix::size_type size_type;
│ │ │ │ +
189
│ │ │ │ +
190 MatrixInitializer(Matrix& A_, size_type)
│ │ │ │ +
191 : count(0), A(A_)
│ │ │ │ +
192 {}
│ │ │ │ +
193 template<class T1, class T2>
│ │ │ │ +
194 void operator()(const T1&, const T2&, int)
│ │ │ │ +
195 {
│ │ │ │ +
196 ++count;
│ │ │ │ +
197 }
│ │ │ │ +
198
│ │ │ │ +
199 void nextCol()
│ │ │ │ +
200 {}
│ │ │ │ +
201
│ │ │ │ +
202 void nextRow()
│ │ │ │ +
203 {}
│ │ │ │ +
204
│ │ │ │ +
205 std::size_t nonzeros()
│ │ │ │ +
206 {
│ │ │ │ +
207 return count;
│ │ │ │ +
208 }
│ │ │ │ +
209
│ │ │ │ +
210 template<class A1, class A2, int n2, int m2, int n3, int m3>
│ │ │ │ +
211 void initPattern(const BCRSMatrix<FieldMatrix<T,n2,m2>,A1>& mat1,
│ │ │ │ +
212 const BCRSMatrix<FieldMatrix<T,n3,m3>,A2>& mat2)
│ │ │ │ +
213 {
│ │ │ │ +
214 SparsityPatternInitializer<T, TA, n, m> sparsity(A.createbegin());
│ │ │ │ +
215 NonzeroPatternTraverser<transpose>::traverse(mat1,mat2,sparsity);
│ │ │ │ +
216 }
│ │ │ │ +
217
│ │ │ │ +
218 private:
│ │ │ │ +
219 std::size_t count;
│ │ │ │ +
220 Matrix& A;
│ │ │ │ +
221 };
│ │ │ │ +
222
│ │ │ │ +
223 template<class T, class TA, int n, int m>
│ │ │ │ +
224 class MatrixInitializer<1,T,TA,n,m>
│ │ │ │ +
225 {
│ │ │ │ +
226 public:
│ │ │ │ +
227 enum {do_break=false};
│ │ │ │ + │ │ │ │ + │ │ │ │ +
230 typedef typename Matrix::size_type size_type;
│ │ │ │ +
231
│ │ │ │ +
232 MatrixInitializer(Matrix& A_, size_type rows)
│ │ │ │ +
233 : A(A_), entries(rows)
│ │ │ │ +
234 {}
│ │ │ │ +
235
│ │ │ │ +
236 template<class T1, class T2>
│ │ │ │ +
237 void operator()(const T1&, const T2&, size_type i, size_type j)
│ │ │ │ +
238 {
│ │ │ │ +
239 entries[i].insert(j);
│ │ │ │ +
240 }
│ │ │ │ +
241
│ │ │ │ +
242 void nextCol()
│ │ │ │ +
243 {}
│ │ │ │ +
244
│ │ │ │ +
245 size_type nonzeros()
│ │ │ │ +
246 {
│ │ │ │ +
247 size_type nnz=0;
│ │ │ │ +
248 typedef typename std::vector<std::set<size_t> >::const_iterator Iter;
│ │ │ │ +
249 for(Iter iter = entries.begin(); iter != entries.end(); ++iter)
│ │ │ │ +
250 nnz+=(*iter).size();
│ │ │ │ +
251 return nnz;
│ │ │ │ +
252 }
│ │ │ │ +
253 template<class A1, class A2, int n2, int m2, int n3, int m3>
│ │ │ │ +
254 void initPattern(const BCRSMatrix<FieldMatrix<T,n2,m2>,A1>&,
│ │ │ │ +
255 const BCRSMatrix<FieldMatrix<T,n3,m3>,A2>&)
│ │ │ │ +
256 {
│ │ │ │ +
257 typedef typename std::vector<std::set<size_t> >::const_iterator Iter;
│ │ │ │ +
258 CreateIterator citer = A.createbegin();
│ │ │ │ +
259 for(Iter iter = entries.begin(); iter != entries.end(); ++iter, ++citer) {
│ │ │ │ +
260 typedef std::set<size_t>::const_iterator SetIter;
│ │ │ │ +
261 for(SetIter index=iter->begin(); index != iter->end(); ++index)
│ │ │ │ +
262 citer.insert(*index);
│ │ │ │ +
263 }
│ │ │ │ +
264 }
│ │ │ │ +
265
│ │ │ │ +
266 private:
│ │ │ │ +
267 Matrix& A;
│ │ │ │ +
268 std::vector<std::set<size_t> > entries;
│ │ │ │ +
269 };
│ │ │ │ +
270
│ │ │ │ +
271 template<class T, class TA, int n, int m>
│ │ │ │ +
272 struct MatrixInitializer<0,T,TA,n,m>
│ │ │ │ +
273 : public MatrixInitializer<1,T,TA,n,m>
│ │ │ │ +
274 {
│ │ │ │ +
275 MatrixInitializer(Dune::BCRSMatrix<Dune::FieldMatrix<T,n,m>,TA>& A_,
│ │ │ │ + │ │ │ │ +
277 : MatrixInitializer<1,T,TA,n,m>(A_,rows)
│ │ │ │ +
278 {}
│ │ │ │ +
279 };
│ │ │ │ +
280
│ │ │ │ +
281
│ │ │ │ +
282 template<class T, class T1, class T2, int n, int m, int k>
│ │ │ │ +
283 void addMatMultTransposeMat(FieldMatrix<T,n,k>& res, const FieldMatrix<T1,n,m>& mat,
│ │ │ │ +
284 const FieldMatrix<T2,k,m>& matt)
│ │ │ │ +
285 {
│ │ │ │ +
286 typedef typename FieldMatrix<T,n,k>::size_type size_type;
│ │ │ │ +
287
│ │ │ │ +
288 for(size_type row=0; row<n; ++row)
│ │ │ │ +
289 for(size_type col=0; col<k; ++col) {
│ │ │ │ +
290 for(size_type i=0; i < m; ++i)
│ │ │ │ +
291 res[row][col]+=mat[row][i]*matt[col][i];
│ │ │ │ +
292 }
│ │ │ │ +
293 }
│ │ │ │ +
294
│ │ │ │ +
295 template<class T, class T1, class T2, int n, int m, int k>
│ │ │ │ +
296 void addTransposeMatMultMat(FieldMatrix<T,n,k>& res, const FieldMatrix<T1,m,n>& mat,
│ │ │ │ +
297 const FieldMatrix<T2,m,k>& matt)
│ │ │ │ +
298 {
│ │ │ │ +
299 typedef typename FieldMatrix<T,n,k>::size_type size_type;
│ │ │ │ +
300 for(size_type i=0; i<m; ++i)
│ │ │ │ +
301 for(size_type row=0; row<n; ++row) {
│ │ │ │ +
302 for(size_type col=0; col < k; ++col)
│ │ │ │ +
303 res[row][col]+=mat[i][row]*matt[i][col];
│ │ │ │ +
304 }
│ │ │ │ +
305 }
│ │ │ │ +
306
│ │ │ │ +
307 template<class T, class T1, class T2, int n, int m, int k>
│ │ │ │ +
308 void addMatMultMat(FieldMatrix<T,n,m>& res, const FieldMatrix<T1,n,k>& mat,
│ │ │ │ +
309 const FieldMatrix<T2,k,m>& matt)
│ │ │ │ +
310 {
│ │ │ │ +
311 typedef typename FieldMatrix<T,n,k>::size_type size_type;
│ │ │ │ +
312 for(size_type row=0; row<n; ++row)
│ │ │ │ +
313 for(size_type col=0; col<m; ++col) {
│ │ │ │ +
314 for(size_type i=0; i < k; ++i)
│ │ │ │ +
315 res[row][col]+=mat[row][i]*matt[i][col];
│ │ │ │ +
316 }
│ │ │ │ +
317 }
│ │ │ │ +
318
│ │ │ │ +
319
│ │ │ │ +
320 template<class T, class A, int n, int m>
│ │ │ │ +
321 class EntryAccumulatorFather
│ │ │ │ +
322 {
│ │ │ │ +
323 public:
│ │ │ │ +
324 enum {do_break=false};
│ │ │ │ + │ │ │ │ +
326 typedef typename Matrix::RowIterator Row;
│ │ │ │ +
327 typedef typename Matrix::ColIterator Col;
│ │ │ │ +
328
│ │ │ │ +
329 EntryAccumulatorFather(Matrix& mat_)
│ │ │ │ +
330 : mat(mat_), row(mat.begin())
│ │ │ │ +
331 {
│ │ │ │ +
332 mat=0;
│ │ │ │ +
333 col=row->begin();
│ │ │ │ +
334 }
│ │ │ │ +
335 void nextRow()
│ │ │ │ +
336 {
│ │ │ │ +
337 ++row;
│ │ │ │ +
338 if(row!=mat.end())
│ │ │ │ +
339 col=row->begin();
│ │ │ │ +
340 }
│ │ │ │ +
341
│ │ │ │ +
342 void nextCol()
│ │ │ │ +
343 {
│ │ │ │ +
344 ++this->col;
│ │ │ │ +
345 }
│ │ │ │ +
346 protected:
│ │ │ │ +
347 Matrix& mat;
│ │ │ │ +
348 private:
│ │ │ │ +
349 Row row;
│ │ │ │ +
350 protected:
│ │ │ │ + │ │ │ │ +
352 };
│ │ │ │ +
353
│ │ │ │ +
354 template<class T, class A, int n, int m, int transpose>
│ │ │ │ +
355 class EntryAccumulator
│ │ │ │ +
356 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ +
357 {
│ │ │ │ +
358 public:
│ │ │ │ + │ │ │ │ +
360 typedef typename Matrix::size_type size_type;
│ │ │ │ +
361
│ │ │ │ +
362 EntryAccumulator(Matrix& mat_)
│ │ │ │ +
363 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ +
364 {}
│ │ │ │ +
365
│ │ │ │ +
366 template<class T1, class T2>
│ │ │ │ +
367 void operator()(const T1& t1, const T2& t2, size_type i)
│ │ │ │ +
368 {
│ │ │ │ +
369 assert(this->col.index()==i);
│ │ │ │ +
370 addMatMultMat(*(this->col),t1,t2);
│ │ │ │ +
371 }
│ │ │ │ +
372 };
│ │ │ │ +
373
│ │ │ │ +
374 template<class T, class A, int n, int m>
│ │ │ │ +
375 class EntryAccumulator<T,A,n,m,0>
│ │ │ │ +
376 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ +
377 {
│ │ │ │ +
378 public:
│ │ │ │ + │ │ │ │ +
380 typedef typename Matrix::size_type size_type;
│ │ │ │ +
381
│ │ │ │ +
382 EntryAccumulator(Matrix& mat_)
│ │ │ │ +
383 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ +
384 {}
│ │ │ │ +
385
│ │ │ │ +
386 template<class T1, class T2>
│ │ │ │ +
387 void operator()(const T1& t1, const T2& t2, size_type i, size_type j)
│ │ │ │ +
388 {
│ │ │ │ +
389 addMatMultMat(this->mat[i][j], t1, t2);
│ │ │ │ +
390 }
│ │ │ │ +
391 };
│ │ │ │ +
392
│ │ │ │ +
393 template<class T, class A, int n, int m>
│ │ │ │ +
394 class EntryAccumulator<T,A,n,m,1>
│ │ │ │ +
395 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ +
396 {
│ │ │ │ +
397 public:
│ │ │ │ + │ │ │ │ +
399 typedef typename Matrix::size_type size_type;
│ │ │ │ +
400
│ │ │ │ +
401 EntryAccumulator(Matrix& mat_)
│ │ │ │ +
402 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ +
403 {}
│ │ │ │ +
404
│ │ │ │ +
405 template<class T1, class T2>
│ │ │ │ +
406 void operator()(const T1& t1, const T2& t2, size_type i, size_type j)
│ │ │ │ +
407 {
│ │ │ │ +
408 addTransposeMatMultMat(this->mat[i][j], t1, t2);
│ │ │ │ +
409 }
│ │ │ │ +
410 };
│ │ │ │ +
411
│ │ │ │ +
412 template<class T, class A, int n, int m>
│ │ │ │ +
413 class EntryAccumulator<T,A,n,m,2>
│ │ │ │ +
414 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ +
415 {
│ │ │ │ +
416 public:
│ │ │ │ + │ │ │ │ +
418 typedef typename Matrix::size_type size_type;
│ │ │ │ +
419
│ │ │ │ +
420 EntryAccumulator(Matrix& mat_)
│ │ │ │ +
421 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ +
422 {}
│ │ │ │ +
423
│ │ │ │ +
424 template<class T1, class T2>
│ │ │ │ +
425 void operator()(const T1& t1, const T2& t2, [[maybe_unused]] size_type i)
│ │ │ │ +
426 {
│ │ │ │ +
427 assert(this->col.index()==i);
│ │ │ │ +
428 addMatMultTransposeMat(*this->col,t1,t2);
│ │ │ │ +
429 }
│ │ │ │ +
430 };
│ │ │ │ +
431
│ │ │ │ +
432
│ │ │ │ +
433 template<int transpose>
│ │ │ │ +
434 struct SizeSelector
│ │ │ │ +
435 {};
│ │ │ │ +
436
│ │ │ │ +
437 template<>
│ │ │ │ +
438 struct SizeSelector<0>
│ │ │ │ +
439 {
│ │ │ │ +
440 template<class M1, class M2>
│ │ │ │ +
441 static std::tuple<typename M1::size_type, typename M2::size_type>
│ │ │ │ +
442 size(const M1& m1, const M2& m2)
│ │ │ │ +
443 {
│ │ │ │ +
444 return std::make_tuple(m1.N(), m2.M());
│ │ │ │ +
445 }
│ │ │ │ +
446 };
│ │ │ │ +
447
│ │ │ │ +
448 template<>
│ │ │ │ +
449 struct SizeSelector<1>
│ │ │ │ +
450 {
│ │ │ │ +
451 template<class M1, class M2>
│ │ │ │ +
452 static std::tuple<typename M1::size_type, typename M2::size_type>
│ │ │ │ +
453 size(const M1& m1, const M2& m2)
│ │ │ │ +
454 {
│ │ │ │ +
455 return std::make_tuple(m1.M(), m2.M());
│ │ │ │ +
456 }
│ │ │ │ +
457 };
│ │ │ │ +
458
│ │ │ │ +
459
│ │ │ │ +
460 template<>
│ │ │ │ +
461 struct SizeSelector<2>
│ │ │ │ +
462 {
│ │ │ │ +
463 template<class M1, class M2>
│ │ │ │ +
464 static std::tuple<typename M1::size_type, typename M2::size_type>
│ │ │ │ +
465 size(const M1& m1, const M2& m2)
│ │ │ │ +
466 {
│ │ │ │ +
467 return std::make_tuple(m1.N(), m2.N());
│ │ │ │ +
468 }
│ │ │ │ +
469 };
│ │ │ │ +
470
│ │ │ │ +
471 template<int transpose, class T, class A, class A1, class A2, int n1, int m1, int n2, int m2, int n3, int m3>
│ │ │ │ +
472 void matMultMat(BCRSMatrix<FieldMatrix<T,n1,m1>,A>& res, const BCRSMatrix<FieldMatrix<T,n2,m2>,A1>& mat1,
│ │ │ │ +
473 const BCRSMatrix<FieldMatrix<T,n3,m3>,A2>& mat2)
│ │ │ │ +
474 {
│ │ │ │ +
475 // First step is to count the number of nonzeros
│ │ │ │ +
476 typename BCRSMatrix<FieldMatrix<T,n1,m1>,A>::size_type rows, cols;
│ │ │ │ +
477 std::tie(rows,cols)=SizeSelector<transpose>::size(mat1, mat2);
│ │ │ │ +
478 MatrixInitializer<transpose,T,A,n1,m1> patternInit(res, rows);
│ │ │ │ +
479 Timer timer;
│ │ │ │ +
480 NonzeroPatternTraverser<transpose>::traverse(mat1,mat2,patternInit);
│ │ │ │ +
481 res.setSize(rows, cols, patternInit.nonzeros());
│ │ │ │ +
482 res.setBuildMode(BCRSMatrix<FieldMatrix<T,n1,m1>,A>::row_wise);
│ │ │ │ +
483
│ │ │ │ +
484 //std::cout<<"Counting nonzeros took "<<timer.elapsed()<<std::endl;
│ │ │ │ +
485 timer.reset();
│ │ │ │ +
486
│ │ │ │ +
487 // Second step is to allocate the storage for the result and initialize the nonzero pattern
│ │ │ │ +
488 patternInit.initPattern(mat1, mat2);
│ │ │ │ +
489
│ │ │ │ +
490 //std::cout<<"Setting up sparsity pattern took "<<timer.elapsed()<<std::endl;
│ │ │ │ +
491 timer.reset();
│ │ │ │ +
492 // As a last step calculate the entries
│ │ │ │ +
493 res = 0.0;
│ │ │ │ +
494 EntryAccumulator<T,A,n1,m1, transpose> entriesAccu(res);
│ │ │ │ +
495 NonzeroPatternTraverser<transpose>::traverse(mat1,mat2,entriesAccu);
│ │ │ │ +
496 //std::cout<<"Calculating entries took "<<timer.elapsed()<<std::endl;
│ │ │ │ +
497 }
│ │ │ │ +
498
│ │ │ │ +
499 }
│ │ │ │ +
500
│ │ │ │ +
508 template<typename M1, typename M2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
510 {};
│ │ │ │ +
│ │ │ │ +
511
│ │ │ │ +
512 template<typename T, int n, int k, int m>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
514 {
│ │ │ │ + │ │ │ │ +
516 };
│ │ │ │ +
│ │ │ │ +
517
│ │ │ │ +
518 template<typename T, typename A, typename A1, int n, int k, int m>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
520 {
│ │ │ │ + │ │ │ │ +
522 std::allocator<typename MatMultMatResult<FieldMatrix<T,n,k>,FieldMatrix<T,k,m> >::type> > type;
│ │ │ │ +
523 };
│ │ │ │ +
│ │ │ │ +
524
│ │ │ │ +
525
│ │ │ │ +
533 template<typename M1, typename M2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
535 {};
│ │ │ │ +
│ │ │ │ +
536
│ │ │ │ +
537 template<typename T, int n, int k, int m>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
539 {
│ │ │ │ + │ │ │ │ +
541 };
│ │ │ │ +
│ │ │ │ +
542
│ │ │ │ +
543 template<typename T, typename A, typename A1, int n, int k, int m>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
545 {
│ │ │ │ + │ │ │ │ +
547 std::allocator<typename MatMultMatResult<FieldMatrix<T,n,k>,FieldMatrix<T,k,m> >::type> > type;
│ │ │ │ +
548 };
│ │ │ │ +
│ │ │ │ +
549
│ │ │ │ +
550
│ │ │ │ +
559 template<class T, class A, class A1, class A2, int n, int m, int k>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
561 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt, [[maybe_unused]] bool tryHard=false)
│ │ │ │ +
562 {
│ │ │ │ +
563 matMultMat<2>(res,mat, matt);
│ │ │ │ +
564 }
│ │ │ │ +
│ │ │ │ +
565
│ │ │ │ +
574 template<class T, class A, class A1, class A2, int n, int m, int k>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
576 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt, bool tryHard=false)
│ │ │ │ +
577 {
│ │ │ │ +
578 matMultMat<0>(res,mat, matt);
│ │ │ │ +
579 }
│ │ │ │ +
│ │ │ │ +
580
│ │ │ │ +
589 template<class T, class A, class A1, class A2, int n, int m, int k>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
591 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt, [[maybe_unused]] bool tryHard=false)
│ │ │ │ +
592 {
│ │ │ │ +
593 matMultMat<1>(res,mat, matt);
│ │ │ │ +
594 }
│ │ │ │ +
│ │ │ │ +
595
│ │ │ │ +
596}
│ │ │ │ +
597#endif
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:379
│ │ │ │ +
FieldMatrix< T, n, m > type
Definition matrixmatrix.hh:515
│ │ │ │ +
void transposeMatMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, k, n >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
Calculate product of a transposed sparse matrix with another sparse matrices ( ).
Definition matrixmatrix.hh:590
│ │ │ │ +
void matMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, n, k >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
Calculate product of two sparse matrices ( ).
Definition matrixmatrix.hh:575
│ │ │ │ +
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:359
│ │ │ │ +
Matrix::RowIterator Row
Definition matrixmatrix.hh:326
│ │ │ │ +
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:417
│ │ │ │ +
Dune::BCRSMatrix< Dune::FieldMatrix< T, n, m >, TA > Matrix
Definition matrixmatrix.hh:228
│ │ │ │ +
Matrix::size_type size_type
Definition matrixmatrix.hh:360
│ │ │ │ +
Matrix::size_type size_type
Definition matrixmatrix.hh:380
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
Matrix::ColIterator Col
Definition matrixmatrix.hh:327
│ │ │ │ +
Matrix::size_type size_type
Definition matrixmatrix.hh:188
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
Matrix::size_type size_type
Definition matrixmatrix.hh:230
│ │ │ │ + │ │ │ │ +
void matMultTransposeMat(BCRSMatrix< FieldMatrix< T, n, k >, A > &res, const BCRSMatrix< FieldMatrix< T, n, m >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
Calculate product of a sparse matrix with a transposed sparse matrices ( ).
Definition matrixmatrix.hh:560
│ │ │ │ +
BCRSMatrix< FieldMatrix< T, n, m >, A >::CreateIterator CreateIterator
Definition matrixmatrix.hh:156
│ │ │ │ +
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:398
│ │ │ │ +
Dune::BCRSMatrix< FieldMatrix< T, n, m >, TA > Matrix
Definition matrixmatrix.hh:186
│ │ │ │ +
BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type > > type
Definition matrixmatrix.hh:522
│ │ │ │ +
Matrix::CreateIterator CreateIterator
Definition matrixmatrix.hh:229
│ │ │ │ +
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:325
│ │ │ │ +
Matrix::size_type size_type
Definition matrixmatrix.hh:399
│ │ │ │ +
Matrix::CreateIterator CreateIterator
Definition matrixmatrix.hh:187
│ │ │ │ +
BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type > > type
Definition matrixmatrix.hh:547
│ │ │ │ +
Matrix::size_type size_type
Definition matrixmatrix.hh:418
│ │ │ │ +
BCRSMatrix< FieldMatrix< T, n, m >, A >::size_type size_type
Definition matrixmatrix.hh:157
│ │ │ │ +
@ do_break
Definition matrixmatrix.hh:155
│ │ │ │ +
@ do_break
Definition matrixmatrix.hh:324
│ │ │ │ +
@ do_break
Definition matrixmatrix.hh:185
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Definition combinedfunctor.hh:17
│ │ │ │ -
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:19
│ │ │ │ -
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:29
│ │ │ │ -
Definition combinedfunctor.hh:36
│ │ │ │ -
CombinedFunctor(const T &tuple_)
Definition combinedfunctor.hh:38
│ │ │ │ -
void operator()(const T1 &t)
Definition combinedfunctor.hh:43
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:681
│ │ │ │ +
row_type::Iterator ColIterator
Iterator for the entries of each row.
Definition bcrsmatrix.hh:704
│ │ │ │ +
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ +
CreateIterator createbegin()
get initial create iterator
Definition bcrsmatrix.hh:1097
│ │ │ │ +
Iterator access to matrix rows
Definition bcrsmatrix.hh:579
│ │ │ │ +
Iterator class for sequential creation of blocks
Definition bcrsmatrix.hh:957
│ │ │ │ +
void insert(size_type j)
put column index in row
Definition bcrsmatrix.hh:1064
│ │ │ │ +
Helper TMP to get the result type of a sparse matrix matrix multiplication ( )
Definition matrixmatrix.hh:510
│ │ │ │ +
Helper TMP to get the result type of a sparse matrix matrix multiplication ( )
Definition matrixmatrix.hh:535
│ │ │ │ +
Definition matrixutils.hh:27
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,82 +1,742 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -combinedfunctor.hh │ │ │ │ │ +matrixmatrix.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 (C) 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_COMBINEDFUNCTOR_HH │ │ │ │ │ -6#define DUNE_AMG_COMBINEDFUNCTOR_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_MATRIXMATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_MATRIXMATRIX_HH │ │ │ │ │ 7 │ │ │ │ │ 8#include │ │ │ │ │ 9 │ │ │ │ │ -10namespace _D_u_n_e │ │ │ │ │ -11{ │ │ │ │ │ -12 namespace Amg │ │ │ │ │ -13 { │ │ │ │ │ -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> │ │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13namespace _D_u_n_e │ │ │ │ │ +14{ │ │ │ │ │ +15 │ │ │ │ │ +26 namespace │ │ │ │ │ 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 {} │ │ │ │ │ +28 │ │ │ │ │ +37 template │ │ │ │ │ +38 struct NonzeroPatternTraverser │ │ │ │ │ +39 {}; │ │ │ │ │ +40 │ │ │ │ │ 41 │ │ │ │ │ -42 template │ │ │ │ │ -_4_3 void _o_p_e_r_a_t_o_r_(_)(const T1& t) │ │ │ │ │ +42 template<> │ │ │ │ │ +43 struct NonzeroPatternTraverser<0> │ │ │ │ │ 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 } //namespace Amg │ │ │ │ │ -51} // namespace Dune │ │ │ │ │ -52#endif │ │ │ │ │ +45 template │ │ │ │ │ +46 static void traverse(const _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_<_T_,_n_,_k_>,A1>& A, │ │ │ │ │ +47 const _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_<_T_,_k_,_m_>,A2>& B, │ │ │ │ │ +48 F& func) │ │ │ │ │ +49 { │ │ │ │ │ +50 if(A.M()!=B.N()) │ │ │ │ │ +51 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "< entriesAccu(res); │ │ │ │ │ +495 NonzeroPatternTraverser::traverse(mat1,mat2,entriesAccu); │ │ │ │ │ +496 //std::cout<<"Calculating entries took "< │ │ │ │ │ +_5_0_9 struct _M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ +510 {}; │ │ │ │ │ +511 │ │ │ │ │ +512 template │ │ │ │ │ +_5_1_3 struct _M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_F_i_e_l_d_M_a_t_r_i_x,_F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ │ +514 { │ │ │ │ │ +_5_1_5 typedef _F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_> _t_y_p_e; │ │ │ │ │ +516 }; │ │ │ │ │ +517 │ │ │ │ │ +518 template │ │ │ │ │ +_5_1_9 struct _M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A │ │ │ │ │ +>,_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A1 > > │ │ │ │ │ +520 { │ │ │ │ │ +521 typedef _B_C_R_S_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e │ │ │ │ │ +_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type, │ │ │ │ │ +_5_2_2 std::allocator,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type> > _t_y_p_e; │ │ │ │ │ +523 }; │ │ │ │ │ +524 │ │ │ │ │ +525 │ │ │ │ │ +533 template │ │ │ │ │ +_5_3_4 struct _T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ +535 {}; │ │ │ │ │ +536 │ │ │ │ │ +537 template │ │ │ │ │ +_5_3_8 struct _T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_F_i_e_l_d_M_a_t_r_i_x,_F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ │ +539 { │ │ │ │ │ +_5_4_0 typedef _F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_> _t_y_p_e; │ │ │ │ │ +541 }; │ │ │ │ │ +542 │ │ │ │ │ +543 template │ │ │ │ │ +_5_4_4 struct _T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A │ │ │ │ │ +>,_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A1 > > │ │ │ │ │ +545 { │ │ │ │ │ +546 typedef _B_C_R_S_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e │ │ │ │ │ +_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type, │ │ │ │ │ +_5_4_7 std::allocator,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type> > _t_y_p_e; │ │ │ │ │ +548 }; │ │ │ │ │ +549 │ │ │ │ │ +550 │ │ │ │ │ +559 template │ │ │ │ │ +_5_6_0 void _m_a_t_M_u_l_t_T_r_a_n_s_p_o_s_e_M_a_t(_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,A>& res, const │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_>,A1>& _m_a_t, │ │ │ │ │ +561 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_>,A2>& matt, [[maybe_unused]] bool │ │ │ │ │ +tryHard=false) │ │ │ │ │ +562 { │ │ │ │ │ +563 matMultMat<2>(res,_m_a_t, matt); │ │ │ │ │ +564 } │ │ │ │ │ +565 │ │ │ │ │ +574 template │ │ │ │ │ +_5_7_5 void _m_a_t_M_u_l_t_M_a_t(_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>& res, const │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,A1>& _m_a_t, │ │ │ │ │ +576 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_>,A2>& matt, bool tryHard=false) │ │ │ │ │ +577 { │ │ │ │ │ +578 matMultMat<0>(res,_m_a_t, matt); │ │ │ │ │ +579 } │ │ │ │ │ +580 │ │ │ │ │ +589 template │ │ │ │ │ +_5_9_0 void _t_r_a_n_s_p_o_s_e_M_a_t_M_u_l_t_M_a_t(_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>& res, const │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_n_>,A1>& _m_a_t, │ │ │ │ │ +591 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_>,A2>& matt, [[maybe_unused]] bool │ │ │ │ │ +tryHard=false) │ │ │ │ │ +592 { │ │ │ │ │ +593 matMultMat<1>(res,_m_a_t, matt); │ │ │ │ │ +594 } │ │ │ │ │ +595 │ │ │ │ │ +596} │ │ │ │ │ +597#endif │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _0_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:379 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +FieldMatrix< T, n, m > type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:515 │ │ │ │ │ +_D_u_n_e_:_:_t_r_a_n_s_p_o_s_e_M_a_t_M_u_l_t_M_a_t │ │ │ │ │ +void transposeMatMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, k, n >, A1 > &mat, const BCRSMatrix< FieldMatrix< │ │ │ │ │ +T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ +Calculate product of a transposed sparse matrix with another sparse matrices │ │ │ │ │ +( ). │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:590 │ │ │ │ │ +_D_u_n_e_:_:_m_a_t_M_u_l_t_M_a_t │ │ │ │ │ +void matMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< │ │ │ │ │ +FieldMatrix< T, n, k >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 │ │ │ │ │ +> &matt, bool tryHard=false) │ │ │ │ │ +Calculate product of two sparse matrices ( ). │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:575 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:359 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_R_o_w │ │ │ │ │ +Matrix::RowIterator Row │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:326 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _2_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:417 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _1_,_ _T_,_ _T_A_,_ _n_,_ _m_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +Dune::BCRSMatrix< Dune::FieldMatrix< T, n, m >, TA > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:228 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:360 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _0_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:380 │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_C_o_l │ │ │ │ │ +Matrix::ColIterator Col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:327 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _1_,_ _T_,_ _T_A_,_ _n_,_ _m_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:230 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m │ │ │ │ │ +_>_ _>_:_:_t_y_p_e │ │ │ │ │ +FieldMatrix< T, n, m > type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:540 │ │ │ │ │ +_D_u_n_e_:_:_m_a_t_M_u_l_t_T_r_a_n_s_p_o_s_e_M_a_t │ │ │ │ │ +void matMultTransposeMat(BCRSMatrix< FieldMatrix< T, n, k >, A > &res, const │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A1 > &mat, const BCRSMatrix< FieldMatrix< │ │ │ │ │ +T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ +Calculate product of a sparse matrix with a transposed sparse matrices ( ). │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_I_n_i_t_i_a_l_i_z_e_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A >::CreateIterator CreateIterator │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:156 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _1_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:398 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ +Dune::BCRSMatrix< FieldMatrix< T, n, m >, TA > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:186 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _A_ _>_,_ _B_C_R_S_M_a_t_r_i_x_< │ │ │ │ │ +_F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, │ │ │ │ │ +k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k │ │ │ │ │ +>, FieldMatrix< T, k, m > >::type > > type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:522 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _1_,_ _T_,_ _T_A_,_ _n_,_ _m_ _>_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Matrix::CreateIterator CreateIterator │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:325 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _1_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:399 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Matrix::CreateIterator CreateIterator │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:187 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_,_ _A_ _>_, │ │ │ │ │ +_B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ +BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, │ │ │ │ │ +k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k │ │ │ │ │ +>, FieldMatrix< T, k, m > >::type > > type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:547 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _2_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:418 │ │ │ │ │ +_D_u_n_e_:_:_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_I_n_i_t_i_a_l_i_z_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +BCRSMatrix< FieldMatrix< T, n, m >, A >::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_I_n_i_t_i_a_l_i_z_e_r_:_:_d_o___b_r_e_a_k │ │ │ │ │ +@ do_break │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_d_o___b_r_e_a_k │ │ │ │ │ +@ do_break │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_d_o___b_r_e_a_k │ │ │ │ │ +@ do_break │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:185 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r │ │ │ │ │ -DDeeffiinniittiioonn combinedfunctor.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_:_:_a_p_p_l_y │ │ │ │ │ -static void apply(TT tuple, const T &t) │ │ │ │ │ -DDeeffiinniittiioonn combinedfunctor.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _0_ _>_:_:_a_p_p_l_y │ │ │ │ │ -static void apply(TT tuple, const T &t) │ │ │ │ │ -DDeeffiinniittiioonn combinedfunctor.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn combinedfunctor.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r │ │ │ │ │ -CombinedFunctor(const T &tuple_) │ │ │ │ │ -DDeeffiinniittiioonn combinedfunctor.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const T1 &t) │ │ │ │ │ -DDeeffiinniittiioonn combinedfunctor.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +Iterator end() │ │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:681 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::Iterator ColIterator │ │ │ │ │ +Iterator for the entries of each row. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:704 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The type for the index access and the size. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ +_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_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator access to matrix rows │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:579 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator class for sequential creation of blocks │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:957 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_n_s_e_r_t │ │ │ │ │ +void insert(size_type j) │ │ │ │ │ +put column index in row │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1064 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ +Helper TMP to get the result type of a sparse matrix matrix multiplication ( ) │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:510 │ │ │ │ │ +_D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ +Helper TMP to get the result type of a sparse matrix matrix multiplication ( ) │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:535 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: transfer.hh File Reference │ │ │ │ +dune-istl: cholmod.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,55 +65,23 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +
cholmod.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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::Amg::Transfer< V1, V2, T >
 
class  Dune::Amg::Transfer< V, V1, SequentialInformation >
 
class  Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > >
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Namespaces

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

Detailed Description

│ │ │ │ -

Prolongation and restriction for amg.

│ │ │ │ -
Author
Markus Blatt
│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +1,10 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -_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 │ │ │ │ │ +cholmod.hh File Reference │ │ │ │ │ _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_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -NNaammeessppaacceess │ │ │ │ │ -namespace   _D_u_n_e │ │ │ │ │ -  │ │ │ │ │ -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.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: transfer.hh Source File │ │ │ │ +dune-istl: cholmod.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,250 +70,382 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
transfer.hh
│ │ │ │ +
cholmod.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ -
7
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
13#include <dune/common/exceptions.hh>
│ │ │ │ +
3#pragma once
│ │ │ │ +
4
│ │ │ │ +
5#if HAVE_SUITESPARSE_CHOLMOD
│ │ │ │ +
6
│ │ │ │ +
7#include <dune/common/fmatrix.hh>
│ │ │ │ +
8#include <dune/common/fvector.hh>
│ │ │ │ + │ │ │ │ +
10#include <dune/istl/bvector.hh>
│ │ │ │ +
11#include<dune/istl/solver.hh>
│ │ │ │ + │ │ │ │ +
13#include <dune/istl/foreach.hh>
│ │ │ │
14
│ │ │ │ -
15namespace Dune
│ │ │ │ -
16{
│ │ │ │ -
17 namespace Amg
│ │ │ │ -
18 {
│ │ │ │ +
15#include <vector>
│ │ │ │ +
16#include <memory>
│ │ │ │ +
17
│ │ │ │ +
18#include <cholmod.h>
│ │ │ │
19
│ │ │ │ -
30 template<class V1, class V2, class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
32 {
│ │ │ │ -
33
│ │ │ │ -
34 public:
│ │ │ │ -
35 typedef V1 Vertex;
│ │ │ │ -
36 typedef V2 Vector;
│ │ │ │ +
20namespace Dune {
│ │ │ │ +
21
│ │ │ │ +
22namespace Impl{
│ │ │ │ +
23
│ │ │ │ +
32 struct NoIgnore
│ │ │ │ +
33 {
│ │ │ │ +
34 const NoIgnore& operator[](std::size_t) const { return *this; }
│ │ │ │ +
35 explicit operator bool() const { return false; }
│ │ │ │ +
36 static constexpr std::size_t size() { return 0; }
│ │ │ │
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 };
│ │ │ │ -
│ │ │ │ +
38 };
│ │ │ │ +
39
│ │ │ │ +
40
│ │ │ │ +
41 template<class BlockedVector, class FlatVector>
│ │ │ │ +
42 void copyToFlatVector(const BlockedVector& blockedVector, FlatVector& flatVector)
│ │ │ │ +
43 {
│ │ │ │ +
44 // traverse the vector once just to compute the size
│ │ │ │ +
45 std::size_t len = flatVectorForEach(blockedVector, [&](auto&&, auto...){});
│ │ │ │ +
46 flatVector.resize(len);
│ │ │ │ +
47
│ │ │ │ +
48 flatVectorForEach(blockedVector, [&](auto&& entry, auto offset){
│ │ │ │ +
49 flatVector[offset] = entry;
│ │ │ │ +
50 });
│ │ │ │ +
51 }
│ │ │ │ +
52
│ │ │ │ +
53 // special (dummy) case for NoIgnore
│ │ │ │ +
54 template<class FlatVector>
│ │ │ │ +
55 void copyToFlatVector(const NoIgnore&, FlatVector&)
│ │ │ │ +
56 {
│ │ │ │ +
57 // just do nothing
│ │ │ │ +
58 return;
│ │ │ │ +
59 }
│ │ │ │ +
60
│ │ │ │ +
61 template<class FlatVector, class BlockedVector>
│ │ │ │ +
62 void copyToBlockedVector(const FlatVector& flatVector, BlockedVector& blockedVector)
│ │ │ │ +
63 {
│ │ │ │ +
64 flatVectorForEach(blockedVector, [&](auto& entry, auto offset){
│ │ │ │ +
65 entry = flatVector[offset];
│ │ │ │ +
66 });
│ │ │ │ +
67 }
│ │ │ │ +
68
│ │ │ │ +
69
│ │ │ │ +
70} //namespace Impl
│ │ │ │
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#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();
│ │ │ │ +
76template<class Vector>
│ │ │ │ +
77class Cholmod : public InverseOperator<Vector, Vector>
│ │ │ │ +
78{
│ │ │ │ +
79public:
│ │ │ │ +
80
│ │ │ │ +
86 Cholmod()
│ │ │ │ +
87 {
│ │ │ │ +
88 cholmod_start(&c_);
│ │ │ │ +
89 }
│ │ │ │ +
90
│ │ │ │ +
96 ~Cholmod()
│ │ │ │ +
97 {
│ │ │ │ +
98 if (L_)
│ │ │ │ +
99 cholmod_free_factor(&L_, &c_);
│ │ │ │ +
100 cholmod_finish(&c_);
│ │ │ │ +
101 }
│ │ │ │ +
102
│ │ │ │ +
103 // forbid copying to avoid freeing memory twice
│ │ │ │ +
104 Cholmod(const Cholmod&) = delete;
│ │ │ │ +
105 Cholmod& operator=(const Cholmod&) = delete;
│ │ │ │ +
106
│ │ │ │ +
107
│ │ │ │ +
110 void apply (Vector& x, Vector& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ │ +
111 {
│ │ │ │ +
112 apply(x,b,res);
│ │ │ │ +
113 }
│ │ │ │ +
114
│ │ │ │ +
120 void apply(Vector& x, Vector& b, InverseOperatorResult& res)
│ │ │ │ +
121 {
│ │ │ │ +
122 // do nothing if N=0
│ │ │ │ +
123 if ( nIsZero_ )
│ │ │ │ +
124 {
│ │ │ │ +
125 return;
│ │ │ │ +
126 }
│ │ │ │ +
127
│ │ │ │ +
128 if (x.size() != b.size())
│ │ │ │ +
129 DUNE_THROW(Exception, "Error in apply(): sizes of x and b do not match!");
│ │ │ │ +
130
│ │ │ │ +
131 // cast to double array
│ │ │ │ +
132 auto b2 = std::make_unique<double[]>(L_->n);
│ │ │ │ +
133 auto x2 = std::make_unique<double[]>(L_->n);
│ │ │ │ +
134
│ │ │ │ +
135 // copy to cholmod
│ │ │ │ +
136 auto bp = b2.get();
│ │ │ │ +
137
│ │ │ │ +
138 flatVectorForEach(b, [&](auto&& entry, auto&& flatIndex){
│ │ │ │ +
139 if ( subIndices_.empty() )
│ │ │ │ +
140 bp[ flatIndex ] = entry;
│ │ │ │ +
141 else
│ │ │ │ +
142 if( subIndices_[ flatIndex ] != std::numeric_limits<std::size_t>::max() )
│ │ │ │ +
143 bp[ subIndices_[ flatIndex ] ] = entry;
│ │ │ │ +
144 });
│ │ │ │
145
│ │ │ │ -
146 for(Iterator block=begin; block != end; ++block) {
│ │ │ │ -
147 const Vertex& vertex = aggregates[block-begin];
│ │ │ │ - │ │ │ │ -
149 coarse[vertex] += *block;
│ │ │ │ -
150 }
│ │ │ │ -
151 }
│ │ │ │ -
│ │ │ │ -
152
│ │ │ │ -
153#if HAVE_MPI
│ │ │ │ -
154 template<class V, class V1, class T1, class T2>
│ │ │ │ -
155 template<typename T3>
│ │ │ │ -
│ │ │ │ -
156 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::prolongateVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
157 Vector& coarse, Vector& fine,
│ │ │ │ -
158 Vector& fineRedist, T3 damp,
│ │ │ │ - │ │ │ │ -
160 const Redist& redist)
│ │ │ │ -
161 {
│ │ │ │ -
162 if(fineRedist.size()>0)
│ │ │ │ -
163 // we operated on the coarse level
│ │ │ │ -
164 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fineRedist, damp);
│ │ │ │ +
146 // create a cholmod dense object
│ │ │ │ +
147 auto b3 = make_cholmod_dense(cholmod_allocate_dense(L_->n, 1, L_->n, CHOLMOD_REAL, &c_), &c_);
│ │ │ │ +
148 // cast because void-ptr
│ │ │ │ +
149 auto b4 = static_cast<double*>(b3->x);
│ │ │ │ +
150 std::copy(b2.get(), b2.get() + L_->n, b4);
│ │ │ │ +
151
│ │ │ │ +
152 // solve for a cholmod x object
│ │ │ │ +
153 auto x3 = make_cholmod_dense(cholmod_solve(CHOLMOD_A, L_, b3.get(), &c_), &c_);
│ │ │ │ +
154 // cast because void-ptr
│ │ │ │ +
155 auto xp = static_cast<double*>(x3->x);
│ │ │ │ +
156
│ │ │ │ +
157 // copy into x
│ │ │ │ +
158 flatVectorForEach(x, [&](auto&& entry, auto&& flatIndex){
│ │ │ │ +
159 if ( subIndices_.empty() )
│ │ │ │ +
160 entry = xp[ flatIndex ];
│ │ │ │ +
161 else
│ │ │ │ +
162 if( subIndices_[ flatIndex ] != std::numeric_limits<std::size_t>::max() )
│ │ │ │ +
163 entry = xp[ subIndices_[ flatIndex ] ];
│ │ │ │ +
164 });
│ │ │ │
165
│ │ │ │ -
166 // TODO This could be accomplished with one communication, too!
│ │ │ │ -
167 redist.redistributeBackward(fine, fineRedist);
│ │ │ │ -
168 comm.copyOwnerToAll(fine,fine);
│ │ │ │ -
169 }
│ │ │ │ -
│ │ │ │ +
166 // statistics for a direct solver
│ │ │ │ +
167 res.iterations = 1;
│ │ │ │ +
168 res.converged = true;
│ │ │ │ +
169 }
│ │ │ │
170
│ │ │ │ -
171 template<class V, class V1, class T1, class T2>
│ │ │ │ -
172 template<typename T3>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
174 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
175 Vector& coarse, Vector& fine, T3 damp,
│ │ │ │ -
176 [[maybe_unused]] OwnerOverlapCopyCommunication<T1,T2>& comm)
│ │ │ │ -
177 {
│ │ │ │ -
178 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fine, damp);
│ │ │ │ -
179 }
│ │ │ │ -
│ │ │ │ -
180 template<class V, class V1, class T1, class T2>
│ │ │ │ -
│ │ │ │ -
181 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::restrictVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
182 Vector& coarse, const Vector& fine,
│ │ │ │ - │ │ │ │ -
184 {
│ │ │ │ - │ │ │ │ -
186 // We need this here to avoid it in the smoothers on the coarse level.
│ │ │ │ -
187 // There (in the preconditioner d is const.
│ │ │ │ -
188 comm.project(coarse);
│ │ │ │ -
189 }
│ │ │ │ -
│ │ │ │ -
190#endif
│ │ │ │ -
192 } // namspace Amg
│ │ │ │ -
193} // namspace Dune
│ │ │ │ -
194#endif
│ │ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ -
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.
│ │ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ │ - │ │ │ │ -
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │ +
171
│ │ │ │ +
177 template<class Matrix>
│ │ │ │ +
178 void setMatrix(const Matrix& matrix)
│ │ │ │ +
179 {
│ │ │ │ +
180 const Impl::NoIgnore* noIgnore = nullptr;
│ │ │ │ +
181 setMatrix(matrix, noIgnore);
│ │ │ │ +
182 }
│ │ │ │ +
183
│ │ │ │ +
198 template<class Matrix, class Ignore>
│ │ │ │ +
199 void setMatrix(const Matrix& matrix, const Ignore* ignore)
│ │ │ │ +
200 {
│ │ │ │ +
201 // count the number of entries and diagonal entries
│ │ │ │ +
202 int nonZeros = 0;
│ │ │ │ +
203 int numberOfIgnoredDofs = 0;
│ │ │ │ +
204
│ │ │ │ +
205
│ │ │ │ +
206 auto [flatRows,flatCols] = flatMatrixForEach( matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex){
│ │ │ │ +
207 if( flatRowIndex <= flatColIndex )
│ │ │ │ +
208 nonZeros++;
│ │ │ │ +
209 });
│ │ │ │ +
210
│ │ │ │ +
211 std::vector<bool> flatIgnore;
│ │ │ │ +
212
│ │ │ │ +
213 if ( ignore )
│ │ │ │ +
214 {
│ │ │ │ +
215 Impl::copyToFlatVector(*ignore,flatIgnore);
│ │ │ │ +
216 numberOfIgnoredDofs = std::count(flatIgnore.begin(),flatIgnore.end(),true);
│ │ │ │ +
217 }
│ │ │ │ +
218
│ │ │ │ +
219 // Total number of rows
│ │ │ │ +
220 int N = flatRows - numberOfIgnoredDofs;
│ │ │ │ +
221
│ │ │ │ +
222 nIsZero_ = (N <= 0);
│ │ │ │ +
223
│ │ │ │ +
224 if ( nIsZero_ )
│ │ │ │ +
225 {
│ │ │ │ +
226 return;
│ │ │ │ +
227 }
│ │ │ │ +
228
│ │ │ │ +
229 /*
│ │ │ │ +
230 * CHOLMOD uses compressed-column sparse matrices, but for symmetric
│ │ │ │ +
231 * matrices this is the same as the compressed-row sparse matrix used
│ │ │ │ +
232 * by DUNE. So we can just store Mᵀ instead of M (as M = Mᵀ).
│ │ │ │ +
233 */
│ │ │ │ +
234 const auto deleter = [c = &this->c_](auto* p) {
│ │ │ │ +
235 cholmod_free_sparse(&p, c);
│ │ │ │ +
236 };
│ │ │ │ +
237 auto M = std::unique_ptr<cholmod_sparse, decltype(deleter)>(
│ │ │ │ +
238 cholmod_allocate_sparse(N, // # rows
│ │ │ │ +
239 N, // # cols
│ │ │ │ +
240 nonZeros, // # of nonzeroes
│ │ │ │ +
241 1, // indices are sorted ( 1 = true)
│ │ │ │ +
242 1, // matrix is "packed" ( 1 = true)
│ │ │ │ +
243 -1, // stype of matrix ( -1 = consider the lower part only )
│ │ │ │ +
244 CHOLMOD_REAL, // xtype of matrix ( CHOLMOD_REAL = single array, no complex numbers)
│ │ │ │ +
245 &c_ // cholmod_common ptr
│ │ │ │ +
246 ), deleter);
│ │ │ │ +
247
│ │ │ │ +
248 // copy the data of BCRS matrix to Cholmod Sparse matrix
│ │ │ │ +
249 int* Ap = static_cast<int*>(M->p);
│ │ │ │ +
250 int* Ai = static_cast<int*>(M->i);
│ │ │ │ +
251 double* Ax = static_cast<double*>(M->x);
│ │ │ │ +
252
│ │ │ │ +
253
│ │ │ │ +
254 if ( ignore )
│ │ │ │ +
255 {
│ │ │ │ +
256 // init the mapping
│ │ │ │ +
257 subIndices_.resize(flatRows,std::numeric_limits<std::size_t>::max());
│ │ │ │ +
258
│ │ │ │ +
259 std::size_t subIndexCounter = 0;
│ │ │ │ +
260
│ │ │ │ +
261 for ( std::size_t i=0; i<flatRows; i++ )
│ │ │ │ +
262 {
│ │ │ │ +
263 if ( not flatIgnore[ i ] )
│ │ │ │ +
264 {
│ │ │ │ +
265 subIndices_[ i ] = subIndexCounter++;
│ │ │ │ +
266 }
│ │ │ │ +
267 }
│ │ │ │ +
268 }
│ │ │ │ +
269
│ │ │ │ +
270 // at first, we need to compute the row starts "Ap"
│ │ │ │ +
271 // therefore, we count all (not ignored) entries in each row and in the end we accumulate everything
│ │ │ │ +
272 flatMatrixForEach(matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex){
│ │ │ │ +
273
│ │ │ │ +
274 // stop if ignored
│ │ │ │ +
275 if ( ignore and ( flatIgnore[flatRowIndex] or flatIgnore[flatColIndex] ) )
│ │ │ │ +
276 return;
│ │ │ │ +
277
│ │ │ │ +
278 // stop if in lower half
│ │ │ │ +
279 if ( flatRowIndex > flatColIndex )
│ │ │ │ +
280 return;
│ │ │ │ +
281
│ │ │ │ +
282 // ok, count the entry
│ │ │ │ +
283 auto idx = ignore ? subIndices_[flatRowIndex] : flatRowIndex;
│ │ │ │ +
284 Ap[idx+1]++;
│ │ │ │ +
285
│ │ │ │ +
286 });
│ │ │ │ +
287
│ │ │ │ +
288 // now accumulate
│ │ │ │ +
289 Ap[0] = 0;
│ │ │ │ +
290 for ( int i=0; i<N; i++ )
│ │ │ │ +
291 {
│ │ │ │ +
292 Ap[i+1] += Ap[i];
│ │ │ │ +
293 }
│ │ │ │ +
294
│ │ │ │ +
295 // we need a compressed row position counter
│ │ │ │ +
296 std::vector<std::size_t> rowPosition(N,0);
│ │ │ │ +
297
│ │ │ │ +
298 // now we can set the entries
│ │ │ │ +
299 flatMatrixForEach(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& flatColIndex){
│ │ │ │ +
300
│ │ │ │ +
301 // stop if ignored
│ │ │ │ +
302 if ( ignore and ( flatIgnore[flatRowIndex] or flatIgnore[flatColIndex] ) )
│ │ │ │ +
303 return;
│ │ │ │ +
304
│ │ │ │ +
305 // stop if in lower half
│ │ │ │ +
306 if ( flatRowIndex > flatColIndex )
│ │ │ │ +
307 return;
│ │ │ │ +
308
│ │ │ │ +
309 // ok, set the entry
│ │ │ │ +
310 auto rowIdx = ignore ? subIndices_[flatRowIndex] : flatRowIndex;
│ │ │ │ +
311 auto colIdx = ignore ? subIndices_[flatColIndex] : flatColIndex;
│ │ │ │ +
312 auto rowStart = Ap[rowIdx];
│ │ │ │ +
313 auto rowPos = rowPosition[rowIdx];
│ │ │ │ +
314 Ai[ rowStart + rowPos ] = colIdx;
│ │ │ │ +
315 Ax[ rowStart + rowPos ] = entry;
│ │ │ │ +
316 rowPosition[rowIdx]++;
│ │ │ │ +
317
│ │ │ │ +
318 });
│ │ │ │ +
319
│ │ │ │ +
320 // Now analyse the pattern and optimal row order
│ │ │ │ +
321 L_ = cholmod_analyze(M.get(), &c_);
│ │ │ │ +
322
│ │ │ │ +
323 // Do the factorization (this may take some time)
│ │ │ │ +
324 cholmod_factorize(M.get(), L_, &c_);
│ │ │ │ +
325 }
│ │ │ │ +
326
│ │ │ │ +
327 virtual SolverCategory::Category category() const
│ │ │ │ +
328 {
│ │ │ │ +
329 return SolverCategory::Category::sequential;
│ │ │ │ +
330 }
│ │ │ │ +
331
│ │ │ │ +
337 cholmod_common& cholmodCommonObject()
│ │ │ │ +
338 {
│ │ │ │ +
339 return c_;
│ │ │ │ +
340 }
│ │ │ │ +
341
│ │ │ │ +
347 cholmod_factor& cholmodFactor()
│ │ │ │ +
348 {
│ │ │ │ +
349 return *L_;
│ │ │ │ +
350 }
│ │ │ │ +
351
│ │ │ │ +
357 const cholmod_factor& cholmodFactor() const
│ │ │ │ +
358 {
│ │ │ │ +
359 return *L_;
│ │ │ │ +
360 }
│ │ │ │ +
361private:
│ │ │ │ +
362
│ │ │ │ +
363 // create a std::unique_ptr to a cholmod_dense object with a deleter
│ │ │ │ +
364 // that calls the appropriate cholmod cleanup routine
│ │ │ │ +
365 auto make_cholmod_dense(cholmod_dense* x, cholmod_common* c)
│ │ │ │ +
366 {
│ │ │ │ +
367 const auto deleter = [c](auto* p) {
│ │ │ │ +
368 cholmod_free_dense(&p, c);
│ │ │ │ +
369 };
│ │ │ │ +
370 return std::unique_ptr<cholmod_dense, decltype(deleter)>(x, deleter);
│ │ │ │ +
371 }
│ │ │ │ +
372
│ │ │ │ +
373 cholmod_common c_;
│ │ │ │ +
374 cholmod_factor* L_ = nullptr;
│ │ │ │ +
375
│ │ │ │ +
376 // indicator for a 0x0 problem (due to ignore dof's)
│ │ │ │ +
377 bool nIsZero_ = false;
│ │ │ │ +
378
│ │ │ │ +
379 // vector mapping all indices in flat order to the not ignored indices
│ │ │ │ +
380 std::vector<std::size_t> subIndices_;
│ │ │ │ +
381};
│ │ │ │ +
382
│ │ │ │ +
383 struct CholmodCreator{
│ │ │ │ +
384 template<class F> struct isValidBlock : std::false_type{};
│ │ │ │ +
385 template<int k> struct isValidBlock<FieldVector<double,k>> : std::true_type{};
│ │ │ │ +
386 template<int k> struct isValidBlock<FieldVector<float,k>> : std::true_type{};
│ │ │ │ +
387
│ │ │ │ +
388 template<class TL, typename M>
│ │ │ │ +
389 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ +
390 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ +
391 operator()(TL /*tl*/, const M& mat, const Dune::ParameterTree& /*config*/,
│ │ │ │ +
392 std::enable_if_t<isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ +
393 {
│ │ │ │ +
394 using D = typename Dune::TypeListElement<1, TL>::type;
│ │ │ │ +
395 auto solver = std::make_shared<Dune::Cholmod<D>>();
│ │ │ │ +
396 solver->setMatrix(mat);
│ │ │ │ +
397 return solver;
│ │ │ │ +
398 }
│ │ │ │ +
399
│ │ │ │ +
400 // second version with SFINAE to validate the template parameters of Cholmod
│ │ │ │ +
401 template<typename TL, typename M>
│ │ │ │ +
402 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ +
403 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ +
404 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ │ +
405 std::enable_if_t<!isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ +
406 {
│ │ │ │ +
407 DUNE_THROW(UnsupportedType, "Unsupported Type in Cholmod");
│ │ │ │ +
408 }
│ │ │ │ +
409 };
│ │ │ │ +
410 DUNE_REGISTER_DIRECT_SOLVER("cholmod", Dune::CholmodCreator());
│ │ │ │ +
411
│ │ │ │ +
412} /* namespace Dune */
│ │ │ │ +
413
│ │ │ │ +
414#endif // HAVE_SUITESPARSE_CHOLMOD
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ + │ │ │ │ + │ │ │ │ +
Define general, extensible interface for inverse operators.
│ │ │ │ +
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Definition matrixredistribute.hh:22
│ │ │ │ -
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:32
│ │ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ -
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition owneroverlapcopy.hh:538
│ │ │ │ -
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ -
Definition pinfo.hh:28
│ │ │ │ -
Definition transfer.hh:32
│ │ │ │ -
static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, const Vector &fine, T &comm)
│ │ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp)
│ │ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R())
│ │ │ │ -
V1 Vertex
Definition transfer.hh:35
│ │ │ │ -
V2 Vector
Definition transfer.hh:36
│ │ │ │ -
RedistributeInformation< SequentialInformation > Redist
Definition transfer.hh:56
│ │ │ │ - │ │ │ │ - │ │ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation &comm=SequentialInformation(), const Redist &redist=Redist())
│ │ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp, const SequentialInformation &comm=SequentialInformation())
│ │ │ │ - │ │ │ │ -
RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist
Definition transfer.hh:80
│ │ │ │ - │ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,294 +1,406 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -transfer.hh │ │ │ │ │ +cholmod.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 (C) 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 │ │ │ │ │ -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 │ │ │ │ │ +3#pragma once │ │ │ │ │ +4 │ │ │ │ │ +5#if HAVE_SUITESPARSE_CHOLMOD │ │ │ │ │ +6 │ │ │ │ │ +7#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ +11#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_f_o_r_e_a_c_h_._h_h> │ │ │ │ │ 14 │ │ │ │ │ -15namespace _D_u_n_e │ │ │ │ │ -16{ │ │ │ │ │ -17 namespace Amg │ │ │ │ │ -18 { │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17 │ │ │ │ │ +18#include │ │ │ │ │ 19 │ │ │ │ │ -30 template │ │ │ │ │ -_3_1 class _T_r_a_n_s_f_e_r │ │ │ │ │ -32 { │ │ │ │ │ -33 │ │ │ │ │ -34 public: │ │ │ │ │ -_3_5 typedef V1 _V_e_r_t_e_x; │ │ │ │ │ -_3_6 typedef V2 _V_e_c_t_o_r; │ │ │ │ │ +20namespace _D_u_n_e { │ │ │ │ │ +21 │ │ │ │ │ +22namespace Impl{ │ │ │ │ │ +23 │ │ │ │ │ +32 struct NoIgnore │ │ │ │ │ +33 { │ │ │ │ │ +34 const NoIgnore& operator[](std::size_t) const { return *this; } │ │ │ │ │ +35 explicit operator bool() const { return false; } │ │ │ │ │ +36 static constexpr std::size_t size() { return 0; } │ │ │ │ │ 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 }; │ │ │ │ │ +38 }; │ │ │ │ │ +39 │ │ │ │ │ +40 │ │ │ │ │ +41 template │ │ │ │ │ +42 void copyToFlatVector(const BlockedVector& blockedVector, FlatVector& │ │ │ │ │ +flatVector) │ │ │ │ │ +43 { │ │ │ │ │ +44 // traverse the vector once just to compute the size │ │ │ │ │ +45 std::size_t len = _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(blockedVector, [&](auto&&, auto...){}); │ │ │ │ │ +46 flatVector.resize(len); │ │ │ │ │ +47 │ │ │ │ │ +48 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(blockedVector, [&](auto&& entry, auto offset){ │ │ │ │ │ +49 flatVector[offset] = entry; │ │ │ │ │ +50 }); │ │ │ │ │ +51 } │ │ │ │ │ +52 │ │ │ │ │ +53 // special (dummy) case for NoIgnore │ │ │ │ │ +54 template │ │ │ │ │ +55 void copyToFlatVector(const NoIgnore&, FlatVector&) │ │ │ │ │ +56 { │ │ │ │ │ +57 // just do nothing │ │ │ │ │ +58 return; │ │ │ │ │ +59 } │ │ │ │ │ +60 │ │ │ │ │ +61 template │ │ │ │ │ +62 void copyToBlockedVector(const FlatVector& flatVector, BlockedVector& │ │ │ │ │ +blockedVector) │ │ │ │ │ +63 { │ │ │ │ │ +64 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(blockedVector, [&](auto& entry, auto offset){ │ │ │ │ │ +65 entry = flatVector[offset]; │ │ │ │ │ +66 }); │ │ │ │ │ +67 } │ │ │ │ │ +68 │ │ │ │ │ +69 │ │ │ │ │ +70} //namespace Impl │ │ │ │ │ 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#endif │ │ │ │ │ -94 │ │ │ │ │ -95 template │ │ │ │ │ -96 template │ │ │ │ │ -97 inline void │ │ │ │ │ -_9_8 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -99 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ -100 [[maybe_unused]] _V_e_c_t_o_r& fineRedist, │ │ │ │ │ -101 T damp, │ │ │ │ │ -102 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm, │ │ │ │ │ -103 [[maybe_unused]] const _R_e_d_i_s_t& redist) │ │ │ │ │ -104 { │ │ │ │ │ -105 prolongateVector(aggregates, coarse, fine, damp); │ │ │ │ │ -106 } │ │ │ │ │ -107 template │ │ │ │ │ -108 template │ │ │ │ │ -109 inline void │ │ │ │ │ -_1_1_0 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -111 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ -112 T damp, │ │ │ │ │ -113 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ │ -114 { │ │ │ │ │ -115 typedef typename Vector::iterator Iterator; │ │ │ │ │ -116 │ │ │ │ │ -117 Iterator end = coarse.end(); │ │ │ │ │ -118 Iterator begin= coarse.begin(); │ │ │ │ │ -119 for(; begin!=end; ++begin) │ │ │ │ │ -120 *begin*=damp; │ │ │ │ │ -121 end=fine.end(); │ │ │ │ │ -122 begin=fine.begin(); │ │ │ │ │ -123 │ │ │ │ │ -124 for(Iterator block=begin; block != end; ++block) { │ │ │ │ │ -125 std::ptrdiff_t index=block-begin; │ │ │ │ │ -126 const _V_e_r_t_e_x& vertex = aggregates[index]; │ │ │ │ │ -127 if(vertex != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ │ -128 *block += coarse[aggregates[index]]; │ │ │ │ │ -129 } │ │ │ │ │ -130 } │ │ │ │ │ -131 │ │ │ │ │ -132 template │ │ │ │ │ -133 inline void │ │ │ │ │ -_1_3_4 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -135 _V_e_c_t_o_r& coarse, │ │ │ │ │ -136 const _V_e_c_t_o_r& fine, │ │ │ │ │ -137 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ │ -138 { │ │ │ │ │ -139 // Set coarse vector to zero │ │ │ │ │ -140 coarse=0; │ │ │ │ │ -141 │ │ │ │ │ -142 typedef typename Vector::const_iterator Iterator; │ │ │ │ │ -143 Iterator end = fine._e_n_d(); │ │ │ │ │ -144 Iterator begin=fine.begin(); │ │ │ │ │ +76template │ │ │ │ │ +77class Cholmod : public InverseOperator │ │ │ │ │ +78{ │ │ │ │ │ +79public: │ │ │ │ │ +80 │ │ │ │ │ +86 Cholmod() │ │ │ │ │ +87 { │ │ │ │ │ +88 cholmod_start(&c_); │ │ │ │ │ +89 } │ │ │ │ │ +90 │ │ │ │ │ +96 ~Cholmod() │ │ │ │ │ +97 { │ │ │ │ │ +98 if (L_) │ │ │ │ │ +99 cholmod_free_factor(&L_, &c_); │ │ │ │ │ +100 cholmod_finish(&c_); │ │ │ │ │ +101 } │ │ │ │ │ +102 │ │ │ │ │ +103 // forbid copying to avoid freeing memory twice │ │ │ │ │ +104 Cholmod(const Cholmod&) = delete; │ │ │ │ │ +105 Cholmod& operator=(const Cholmod&) = delete; │ │ │ │ │ +106 │ │ │ │ │ +107 │ │ │ │ │ +110 void apply (Vector& x, Vector& b, [[maybe_unused]] double reduction, │ │ │ │ │ +InverseOperatorResult& res) │ │ │ │ │ +111 { │ │ │ │ │ +112 apply(x,b,res); │ │ │ │ │ +113 } │ │ │ │ │ +114 │ │ │ │ │ +120 void apply(Vector& x, Vector& b, InverseOperatorResult& res) │ │ │ │ │ +121 { │ │ │ │ │ +122 // do nothing if N=0 │ │ │ │ │ +123 if ( nIsZero_ ) │ │ │ │ │ +124 { │ │ │ │ │ +125 return; │ │ │ │ │ +126 } │ │ │ │ │ +127 │ │ │ │ │ +128 if (x.size() != b.size()) │ │ │ │ │ +129 DUNE_THROW(Exception, "Error in apply(): sizes of x and b do not match!"); │ │ │ │ │ +130 │ │ │ │ │ +131 // cast to double array │ │ │ │ │ +132 auto b2 = std::make_unique(L_->n); │ │ │ │ │ +133 auto x2 = std::make_unique(L_->n); │ │ │ │ │ +134 │ │ │ │ │ +135 // copy to cholmod │ │ │ │ │ +136 auto bp = b2.get(); │ │ │ │ │ +137 │ │ │ │ │ +138 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(b, [&](auto&& entry, auto&& flatIndex){ │ │ │ │ │ +139 if ( subIndices_.empty() ) │ │ │ │ │ +140 bp[ flatIndex ] = entry; │ │ │ │ │ +141 else │ │ │ │ │ +142 if( subIndices_[ flatIndex ] != std::numeric_limits::max() ) │ │ │ │ │ +143 bp[ subIndices_[ flatIndex ] ] = entry; │ │ │ │ │ +144 }); │ │ │ │ │ 145 │ │ │ │ │ -146 for(Iterator block=begin; block != end; ++block) { │ │ │ │ │ -147 const _V_e_r_t_e_x& vertex = aggregates[block-begin]; │ │ │ │ │ -148 if(vertex != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ │ -149 coarse[vertex] += *block; │ │ │ │ │ -150 } │ │ │ │ │ -151 } │ │ │ │ │ -152 │ │ │ │ │ -153#if HAVE_MPI │ │ │ │ │ -154 template │ │ │ │ │ -155 template │ │ │ │ │ -_1_5_6 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ │ -prolongateVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -157 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ -158 _V_e_c_t_o_r& fineRedist, T3 damp, │ │ │ │ │ -159 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm, │ │ │ │ │ -160 const _R_e_d_i_s_t& redist) │ │ │ │ │ -161 { │ │ │ │ │ -162 if(fineRedist.size()>0) │ │ │ │ │ -163 // we operated on the coarse level │ │ │ │ │ -164 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ │ -fineRedist, damp); │ │ │ │ │ +146 // create a cholmod dense object │ │ │ │ │ +147 auto b3 = make_cholmod_dense(cholmod_allocate_dense(L_->n, 1, L_->n, │ │ │ │ │ +CHOLMOD_REAL, &c_), &c_); │ │ │ │ │ +148 // cast because void-ptr │ │ │ │ │ +149 auto b4 = static_cast(b3->x); │ │ │ │ │ +150 std::copy(b2.get(), b2.get() + L_->n, b4); │ │ │ │ │ +151 │ │ │ │ │ +152 // solve for a cholmod x object │ │ │ │ │ +153 auto x3 = make_cholmod_dense(cholmod_solve(CHOLMOD_A, L_, b3.get(), &c_), │ │ │ │ │ +&c_); │ │ │ │ │ +154 // cast because void-ptr │ │ │ │ │ +155 auto xp = static_cast(x3->x); │ │ │ │ │ +156 │ │ │ │ │ +157 // copy into x │ │ │ │ │ +158 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(x, [&](auto&& entry, auto&& flatIndex){ │ │ │ │ │ +159 if ( subIndices_.empty() ) │ │ │ │ │ +160 entry = xp[ flatIndex ]; │ │ │ │ │ +161 else │ │ │ │ │ +162 if( subIndices_[ flatIndex ] != std::numeric_limits::max() ) │ │ │ │ │ +163 entry = xp[ subIndices_[ flatIndex ] ]; │ │ │ │ │ +164 }); │ │ │ │ │ 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); │ │ │ │ │ +166 // statistics for a direct solver │ │ │ │ │ +167 res.iterations = 1; │ │ │ │ │ +168 res.converged = true; │ │ │ │ │ 169 } │ │ │ │ │ 170 │ │ │ │ │ -171 template │ │ │ │ │ -172 template │ │ │ │ │ -_1_7_3 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ │ -prolongateVector( │ │ │ │ │ -174 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -175 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, T3 damp, │ │ │ │ │ -176 [[maybe_unused]] _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ │ -177 { │ │ │ │ │ -178 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ │ -fine, damp); │ │ │ │ │ -179 } │ │ │ │ │ -180 template │ │ │ │ │ -_1_8_1 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ │ -restrictVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -182 _V_e_c_t_o_r& coarse, const _V_e_c_t_o_r& fine, │ │ │ │ │ -183 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ │ -184 { │ │ │ │ │ -185 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ │ -fine, _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ -186 // We need this here to avoid it in the smoothers on the coarse level. │ │ │ │ │ -187 // There (in the preconditioner d is const. │ │ │ │ │ -188 comm._p_r_o_j_e_c_t(coarse); │ │ │ │ │ -189 } │ │ │ │ │ -190#endif │ │ │ │ │ -192 } // namspace Amg │ │ │ │ │ -193} // namspace Dune │ │ │ │ │ -194#endif │ │ │ │ │ -_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ │ -Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ │ +171 │ │ │ │ │ +177 template │ │ │ │ │ +178 void setMatrix(const Matrix& matrix) │ │ │ │ │ +179 { │ │ │ │ │ +180 const Impl::NoIgnore* noIgnore = nullptr; │ │ │ │ │ +181 setMatrix(matrix, noIgnore); │ │ │ │ │ +182 } │ │ │ │ │ +183 │ │ │ │ │ +198 template │ │ │ │ │ +199 void setMatrix(const Matrix& matrix, const Ignore* ignore) │ │ │ │ │ +200 { │ │ │ │ │ +201 // count the number of entries and diagonal entries │ │ │ │ │ +202 int nonZeros = 0; │ │ │ │ │ +203 int numberOfIgnoredDofs = 0; │ │ │ │ │ +204 │ │ │ │ │ +205 │ │ │ │ │ +206 auto [flatRows,flatCols] = _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h( matrix, [&](auto&& /*entry*/, │ │ │ │ │ +auto&& flatRowIndex, auto&& flatColIndex){ │ │ │ │ │ +207 if( flatRowIndex <= flatColIndex ) │ │ │ │ │ +208 nonZeros++; │ │ │ │ │ +209 }); │ │ │ │ │ +210 │ │ │ │ │ +211 std::vector flatIgnore; │ │ │ │ │ +212 │ │ │ │ │ +213 if ( ignore ) │ │ │ │ │ +214 { │ │ │ │ │ +215 Impl::copyToFlatVector(*ignore,flatIgnore); │ │ │ │ │ +216 numberOfIgnoredDofs = std::count(flatIgnore.begin(),flatIgnore.end(),true); │ │ │ │ │ +217 } │ │ │ │ │ +218 │ │ │ │ │ +219 // Total number of rows │ │ │ │ │ +220 int N = flatRows - numberOfIgnoredDofs; │ │ │ │ │ +221 │ │ │ │ │ +222 nIsZero_ = (N <= 0); │ │ │ │ │ +223 │ │ │ │ │ +224 if ( nIsZero_ ) │ │ │ │ │ +225 { │ │ │ │ │ +226 return; │ │ │ │ │ +227 } │ │ │ │ │ +228 │ │ │ │ │ +229 /* │ │ │ │ │ +230 * CHOLMOD uses compressed-column sparse matrices, but for symmetric │ │ │ │ │ +231 * matrices this is the same as the compressed-row sparse matrix used │ │ │ │ │ +232 * by DUNE. So we can just store Mᵀ instead of M (as M = Mᵀ). │ │ │ │ │ +233 */ │ │ │ │ │ +234 const auto deleter = [c = &this->c_](auto* p) { │ │ │ │ │ +235 cholmod_free_sparse(&p, c); │ │ │ │ │ +236 }; │ │ │ │ │ +237 auto M = std::unique_ptr( │ │ │ │ │ +238 cholmod_allocate_sparse(N, // # rows │ │ │ │ │ +239 N, // # cols │ │ │ │ │ +240 nonZeros, // # of nonzeroes │ │ │ │ │ +241 1, // indices are sorted ( 1 = true) │ │ │ │ │ +242 1, // matrix is "packed" ( 1 = true) │ │ │ │ │ +243 -1, // stype of matrix ( -1 = consider the lower part only ) │ │ │ │ │ +244 CHOLMOD_REAL, // xtype of matrix ( CHOLMOD_REAL = single array, no complex │ │ │ │ │ +numbers) │ │ │ │ │ +245 &c_ // cholmod_common ptr │ │ │ │ │ +246 ), deleter); │ │ │ │ │ +247 │ │ │ │ │ +248 // copy the data of BCRS matrix to Cholmod Sparse matrix │ │ │ │ │ +249 int* Ap = static_cast(M->p); │ │ │ │ │ +250 int* Ai = static_cast(M->i); │ │ │ │ │ +251 double* Ax = static_cast(M->x); │ │ │ │ │ +252 │ │ │ │ │ +253 │ │ │ │ │ +254 if ( ignore ) │ │ │ │ │ +255 { │ │ │ │ │ +256 // init the mapping │ │ │ │ │ +257 subIndices_.resize(flatRows,std::numeric_limits::max()); │ │ │ │ │ +258 │ │ │ │ │ +259 std::size_t subIndexCounter = 0; │ │ │ │ │ +260 │ │ │ │ │ +261 for ( std::size_t i=0; i flatColIndex ) │ │ │ │ │ +280 return; │ │ │ │ │ +281 │ │ │ │ │ +282 // ok, count the entry │ │ │ │ │ +283 auto idx = ignore ? subIndices_[flatRowIndex] : flatRowIndex; │ │ │ │ │ +284 Ap[idx+1]++; │ │ │ │ │ +285 │ │ │ │ │ +286 }); │ │ │ │ │ +287 │ │ │ │ │ +288 // now accumulate │ │ │ │ │ +289 Ap[0] = 0; │ │ │ │ │ +290 for ( int i=0; i rowPosition(N,0); │ │ │ │ │ +297 │ │ │ │ │ +298 // now we can set the entries │ │ │ │ │ +299 _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& │ │ │ │ │ +flatColIndex){ │ │ │ │ │ +300 │ │ │ │ │ +301 // stop if ignored │ │ │ │ │ +302 if ( ignore and ( flatIgnore[flatRowIndex] or flatIgnore[flatColIndex] ) ) │ │ │ │ │ +303 return; │ │ │ │ │ +304 │ │ │ │ │ +305 // stop if in lower half │ │ │ │ │ +306 if ( flatRowIndex > flatColIndex ) │ │ │ │ │ +307 return; │ │ │ │ │ +308 │ │ │ │ │ +309 // ok, set the entry │ │ │ │ │ +310 auto rowIdx = ignore ? subIndices_[flatRowIndex] : flatRowIndex; │ │ │ │ │ +311 auto colIdx = ignore ? subIndices_[flatColIndex] : flatColIndex; │ │ │ │ │ +312 auto rowStart = Ap[rowIdx]; │ │ │ │ │ +313 auto rowPos = rowPosition[rowIdx]; │ │ │ │ │ +314 Ai[ rowStart + rowPos ] = colIdx; │ │ │ │ │ +315 Ax[ rowStart + rowPos ] = entry; │ │ │ │ │ +316 rowPosition[rowIdx]++; │ │ │ │ │ +317 │ │ │ │ │ +318 }); │ │ │ │ │ +319 │ │ │ │ │ +320 // Now analyse the pattern and optimal row order │ │ │ │ │ +321 L_ = cholmod_analyze(M.get(), &c_); │ │ │ │ │ +322 │ │ │ │ │ +323 // Do the factorization (this may take some time) │ │ │ │ │ +324 cholmod_factorize(M.get(), L_, &c_); │ │ │ │ │ +325 } │ │ │ │ │ +326 │ │ │ │ │ +327 virtual SolverCategory::Category category() const │ │ │ │ │ +328 { │ │ │ │ │ +329 return SolverCategory::Category::sequential; │ │ │ │ │ +330 } │ │ │ │ │ +331 │ │ │ │ │ +337 cholmod_common& cholmodCommonObject() │ │ │ │ │ +338 { │ │ │ │ │ +339 return c_; │ │ │ │ │ +340 } │ │ │ │ │ +341 │ │ │ │ │ +347 cholmod_factor& cholmodFactor() │ │ │ │ │ +348 { │ │ │ │ │ +349 return *L_; │ │ │ │ │ +350 } │ │ │ │ │ +351 │ │ │ │ │ +357 const cholmod_factor& cholmodFactor() const │ │ │ │ │ +358 { │ │ │ │ │ +359 return *L_; │ │ │ │ │ +360 } │ │ │ │ │ +361private: │ │ │ │ │ +362 │ │ │ │ │ +363 // create a std::unique_ptr to a cholmod_dense object with a deleter │ │ │ │ │ +364 // that calls the appropriate cholmod cleanup routine │ │ │ │ │ +365 auto make_cholmod_dense(cholmod_dense* x, cholmod_common* c) │ │ │ │ │ +366 { │ │ │ │ │ +367 const auto deleter = [c](auto* p) { │ │ │ │ │ +368 cholmod_free_dense(&p, c); │ │ │ │ │ +369 }; │ │ │ │ │ +370 return std::unique_ptr(x, deleter); │ │ │ │ │ +371 } │ │ │ │ │ +372 │ │ │ │ │ +373 cholmod_common c_; │ │ │ │ │ +374 cholmod_factor* L_ = nullptr; │ │ │ │ │ +375 │ │ │ │ │ +376 // indicator for a 0x0 problem (due to ignore dof's) │ │ │ │ │ +377 bool nIsZero_ = false; │ │ │ │ │ +378 │ │ │ │ │ +379 // vector mapping all indices in flat order to the not ignored indices │ │ │ │ │ +380 std::vector subIndices_; │ │ │ │ │ +381}; │ │ │ │ │ +382 │ │ │ │ │ +383 struct CholmodCreator{ │ │ │ │ │ +384 template struct isValidBlock : std::false_type{}; │ │ │ │ │ +385 template struct isValidBlock> : std::true_type │ │ │ │ │ +{}; │ │ │ │ │ +386 template struct isValidBlock> : std::true_type │ │ │ │ │ +{}; │ │ │ │ │ +387 │ │ │ │ │ +388 template │ │ │ │ │ +389 std::shared_ptr::type, │ │ │ │ │ +390 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ +391 operator()(TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& /*config*/, │ │ │ │ │ +392 std::enable_if_t::type:: │ │ │ │ │ +block_type>::value,int> = 0) const │ │ │ │ │ +393 { │ │ │ │ │ +394 using D = typename Dune::TypeListElement<1, TL>::type; │ │ │ │ │ +395 auto solver = std::make_shared>(); │ │ │ │ │ +396 solver->setMatrix(_m_a_t); │ │ │ │ │ +397 return solver; │ │ │ │ │ +398 } │ │ │ │ │ +399 │ │ │ │ │ +400 // second version with SFINAE to validate the template parameters of │ │ │ │ │ +Cholmod │ │ │ │ │ +401 template │ │ │ │ │ +402 std::shared_ptr::type, │ │ │ │ │ +403 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ +404 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& / │ │ │ │ │ +*config*/, │ │ │ │ │ +405 std::enable_if_t:: │ │ │ │ │ +type::block_type>::value,int> = 0) const │ │ │ │ │ +406 { │ │ │ │ │ +407 DUNE_THROW(UnsupportedType, "Unsupported Type in Cholmod"); │ │ │ │ │ +408 } │ │ │ │ │ +409 }; │ │ │ │ │ +410 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("cholmod", Dune::CholmodCreator()); │ │ │ │ │ +411 │ │ │ │ │ +412} /* namespace Dune */ │ │ │ │ │ +413 │ │ │ │ │ +414#endif // HAVE_SUITESPARSE_CHOLMOD │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h │ │ │ │ │ +_f_o_r_e_a_c_h_._h_h │ │ │ │ │ +_s_o_l_v_e_r_._h_h │ │ │ │ │ +Define general, extensible interface for inverse operators. │ │ │ │ │ +_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ │ +#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ │ _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. │ │ │ │ │ -_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ │ -Provides classes for the Coloring process of AMG. │ │ │ │ │ -_p_i_n_f_o_._h_h │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_:_:_r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d │ │ │ │ │ -void redistributeBackward(D &from, const D &to) const │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ -owner/overlap/copy sema... │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ │ -void project(T1 &x) const │ │ │ │ │ -Set vector to zero at copy dofs. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:538 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ -void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from owner data points to all other data points. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r │ │ │ │ │ -static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ -&coarse, const Vector &fine, T &comm) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ -&coarse, Vector &fine, T1 damp) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ -&coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R()) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_r_t_e_x │ │ │ │ │ -V1 Vertex │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:35 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_c_t_o_r │ │ │ │ │ -V2 Vector │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_R_e_d_i_s_t │ │ │ │ │ -RedistributeInformation< SequentialInformation > Redist │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_r_t_e_x │ │ │ │ │ -V Vertex │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_c_t_o_r │ │ │ │ │ -V1 Vector │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ -&coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation │ │ │ │ │ -&comm=SequentialInformation(), const Redist &redist=Redist()) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ -&coarse, Vector &fine, T1 damp, const SequentialInformation │ │ │ │ │ -&comm=SequentialInformation()) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_r_t_e_x │ │ │ │ │ -V Vertex │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_R_e_d_i_s_t │ │ │ │ │ -RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_c_t_o_r │ │ │ │ │ -V1 Vector │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:79 │ │ │ │ │ +_D_u_n_e_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00116.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixhierarchy.hh File Reference │ │ │ │ +dune-istl: vbvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,86 +65,58 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Enumerations | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ +
vbvector.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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>
│ │ │ │ +
#include <cmath>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <iterator>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <dune/common/iteratorfacades.hh>
│ │ │ │ +#include "istlexception.hh"
│ │ │ │ +#include "bvector.hh"
│ │ │ │ +#include <dune/istl/blocklevel.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...
class  Dune::VariableBlockVector< B, A >
 A Vector of blocks with different blocksizes. More...
 
struct  Dune::Amg::MatrixHierarchy< M, PI, A >::MatrixStats< Matrix, true >::calc
class  Dune::VariableBlockVector< B, A >::CreateIterator
 Iterator class for sequential creation of blocks. More...
 
class  Dune::Amg::CoarsenCriterion< T >
 The criterion describing the stop criteria for the coarsening process. More...
class  Dune::VariableBlockVector< B, A >::RealIterator< T, R >
 Iterator class for sequential access. 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,68 +1,36 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -_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> │ │ │ │ │ +_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 "_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> │ │ │ │ │ _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_._._. │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ -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_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +  Iterator class for sequential creation of blocks. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_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_._._. │ │ │ │ │ +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_ _>_:_:_R_e_a_l_I_t_e_r_a_t_o_r_<_ _T_,_ _R_ _> │ │ │ │ │ +  Iterator class for sequential access. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ -  │ │ │ │ │ -EEnnuummeerraattiioonnss │ │ │ │ │ -enum   { _D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S = 72000 } │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (const M &origMatrix, std:: │ │ │ │ │ - shared_ptr< M > newMatrix, _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n &origComm, std:: │ │ │ │ │ - shared_ptr< _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n > &newComm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< │ │ │ │ │ - _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n > &ri, int nparts, C1 &criterion) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -bool  _D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (const M &origMatrix, std:: │ │ │ │ │ - shared_ptr< M > newMatrix, C &origComm, std::shared_ptr< C > &newComm, │ │ │ │ │ - _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< C > &ri, int nparts, C1 &criterion) │ │ │ │ │ -  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides a classes representing the hierarchies in AMG. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ +??? │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00116_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixhierarchy.hh Source File │ │ │ │ +dune-istl: vbvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1008 +70,857 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
matrixhierarchy.hh
│ │ │ │ +
vbvector.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ISTL_VBVECTOR_HH
│ │ │ │ +
6#define DUNE_ISTL_VBVECTOR_HH
│ │ │ │
7
│ │ │ │ -
8#include <algorithm>
│ │ │ │ -
9#include <tuple>
│ │ │ │ -
10#include "aggregates.hh"
│ │ │ │ -
11#include "graph.hh"
│ │ │ │ -
12#include "galerkin.hh"
│ │ │ │ -
13#include "renumberer.hh"
│ │ │ │ -
14#include "graphcreator.hh"
│ │ │ │ -
15#include "hierarchy.hh"
│ │ │ │ -
16#include <dune/istl/bvector.hh>
│ │ │ │ -
17#include <dune/common/parallel/indexset.hh>
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
27
│ │ │ │ -
28namespace Dune
│ │ │ │ -
29{
│ │ │ │ -
30 namespace Amg
│ │ │ │ -
31 {
│ │ │ │ -
42 enum {
│ │ │ │ -
50 MAX_PROCESSES = 72000
│ │ │ │ -
51 };
│ │ │ │ -
52
│ │ │ │ -
59 template<class M, class PI, class A=std::allocator<M> >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
61 {
│ │ │ │ -
62 public:
│ │ │ │ -
64 typedef M MatrixOperator;
│ │ │ │ +
8#include <cmath>
│ │ │ │ +
9#include <complex>
│ │ │ │ +
10#include <iostream>
│ │ │ │ +
11#include <iterator>
│ │ │ │ +
12#include <memory>
│ │ │ │ +
13
│ │ │ │ +
14#include <dune/common/iteratorfacades.hh>
│ │ │ │ +
15#include "istlexception.hh"
│ │ │ │ +
16#include "bvector.hh"
│ │ │ │ +
17
│ │ │ │ + │ │ │ │ +
19
│ │ │ │ +
24namespace Dune {
│ │ │ │ +
25
│ │ │ │ +
41 template<class B, class A=std::allocator<B> >
│ │ │ │ +
│ │ │ │ +
42 class VariableBlockVector : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ +
43 // this derivation gives us all the blas level 1 and norms
│ │ │ │ +
44 // on the large array. However, access operators have to be
│ │ │ │ +
45 // overwritten.
│ │ │ │ +
46 {
│ │ │ │ +
47 // just a shorthand
│ │ │ │ +
48 typedef Imp::BlockVectorWindow<B,A> window_type;
│ │ │ │ +
49
│ │ │ │ +
50 public:
│ │ │ │ +
51
│ │ │ │ +
52 //===== type definitions and constants
│ │ │ │ +
53
│ │ │ │ +
55 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
56
│ │ │ │ +
58 typedef A allocator_type;
│ │ │ │ +
59
│ │ │ │ +
64 typedef window_type& reference;
│ │ │ │
65
│ │ │ │ -
67 typedef typename MatrixOperator::matrix_type Matrix;
│ │ │ │ -
68
│ │ │ │ - │ │ │ │ +
70 typedef const window_type& const_reference;
│ │ │ │
71
│ │ │ │ -
73 typedef A Allocator;
│ │ │ │ +
73 typedef typename A::size_type size_type;
│ │ │ │
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>
│ │ │ │ -
140 void coarsenSmoother(Hierarchy<S,TA>& smoothers,
│ │ │ │ -
141 const typename SmootherTraits<S>::Arguments& args) const;
│ │ │ │ -
142
│ │ │ │ -
147 std::size_t levels() const;
│ │ │ │ + │ │ │ │ +
81
│ │ │ │ + │ │ │ │ +
85
│ │ │ │ +
89 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
90 static constexpr auto blocklevel = blockLevel<B>()+2;
│ │ │ │ +
91
│ │ │ │ +
92 //===== constructors and such
│ │ │ │ +
93
│ │ │ │ +
│ │ │ │ +
97 VariableBlockVector () : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ +
98 {
│ │ │ │ +
99 // nothing is known ...
│ │ │ │ +
100 nblocks = 0;
│ │ │ │ +
101 block = nullptr;
│ │ │ │ +
102 initialized = false;
│ │ │ │ +
103 }
│ │ │ │ +
│ │ │ │ +
104
│ │ │ │ +
│ │ │ │ +
108 explicit VariableBlockVector (size_type _nblocks) : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ +
109 {
│ │ │ │ +
110 // we can allocate the windows now
│ │ │ │ +
111 nblocks = _nblocks;
│ │ │ │ +
112 if (nblocks>0)
│ │ │ │ +
113 {
│ │ │ │ +
114 block = windowAllocator_.allocate(nblocks);
│ │ │ │ +
115 new (block) window_type[nblocks];
│ │ │ │ +
116 }
│ │ │ │ +
117 else
│ │ │ │ +
118 {
│ │ │ │ +
119 nblocks = 0;
│ │ │ │ +
120 block = nullptr;
│ │ │ │ +
121 }
│ │ │ │ +
122
│ │ │ │ +
123 // Note: memory in base class still not allocated
│ │ │ │ +
124 // the vector not usable
│ │ │ │ +
125 initialized = false;
│ │ │ │ +
126 }
│ │ │ │ +
│ │ │ │ +
127
│ │ │ │ +
│ │ │ │ +
134 VariableBlockVector (size_type _nblocks, size_type m) : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ +
135 {
│ │ │ │ +
136 // and we can allocate the big array in the base class
│ │ │ │ +
137 this->n = _nblocks*m;
│ │ │ │ +
138 if (this->n>0)
│ │ │ │ +
139 {
│ │ │ │ +
140 this->p = allocator_.allocate(this->n);
│ │ │ │ +
141 new (this->p)B[this->n];
│ │ │ │ +
142 }
│ │ │ │ +
143 else
│ │ │ │ +
144 {
│ │ │ │ +
145 this->n = 0;
│ │ │ │ +
146 this->p = nullptr;
│ │ │ │ +
147 }
│ │ │ │
148
│ │ │ │ -
153 std::size_t maxlevels() const;
│ │ │ │ -
154
│ │ │ │ -
155 bool hasCoarsest() const;
│ │ │ │ +
149 // we can allocate the windows now
│ │ │ │ +
150 nblocks = _nblocks;
│ │ │ │ +
151 if (nblocks>0)
│ │ │ │ +
152 {
│ │ │ │ +
153 // allocate and construct the windows
│ │ │ │ +
154 block = windowAllocator_.allocate(nblocks);
│ │ │ │ +
155 new (block) window_type[nblocks];
│ │ │ │
156
│ │ │ │ -
161 bool isBuilt() const;
│ │ │ │ -
162
│ │ │ │ -
167 const ParallelMatrixHierarchy& matrices() const;
│ │ │ │ -
168
│ │ │ │ - │ │ │ │ -
174
│ │ │ │ -
179 const AggregatesMapList& aggregatesMaps() const;
│ │ │ │ -
180
│ │ │ │ - │ │ │ │ -
187
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
189 {
│ │ │ │ -
190 return prolongDamp_;
│ │ │ │ -
191 }
│ │ │ │ -
│ │ │ │ -
192
│ │ │ │ -
203 void getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const;
│ │ │ │ -
204
│ │ │ │ -
205 private:
│ │ │ │ -
206 typedef typename ConstructionTraits<MatrixOperator>::Arguments MatrixArgs;
│ │ │ │ -
207 typedef typename ConstructionTraits<ParallelInformation>::Arguments CommunicationArgs;
│ │ │ │ -
209 AggregatesMapList aggregatesMaps_;
│ │ │ │ -
211 RedistributeInfoList redistributes_;
│ │ │ │ -
213 ParallelMatrixHierarchy matrices_;
│ │ │ │ -
215 ParallelInformationHierarchy parallelInformation_;
│ │ │ │ -
216
│ │ │ │ -
218 bool built_;
│ │ │ │ -
219
│ │ │ │ -
221 int maxlevels_;
│ │ │ │ -
222
│ │ │ │ -
223 double prolongDamp_;
│ │ │ │ -
224
│ │ │ │ -
228 template<class Matrix, bool print>
│ │ │ │ -
229 struct MatrixStats
│ │ │ │ -
230 {
│ │ │ │ +
157 // set the windows into the big array
│ │ │ │ +
158 for (size_type i=0; i<nblocks; ++i)
│ │ │ │ +
159 block[i].set(m,this->p+(i*m));
│ │ │ │ +
160 }
│ │ │ │ +
161 else
│ │ │ │ +
162 {
│ │ │ │ +
163 nblocks = 0;
│ │ │ │ +
164 block = nullptr;
│ │ │ │ +
165 }
│ │ │ │ +
166
│ │ │ │ +
167 // and the vector is usable
│ │ │ │ +
168 initialized = true;
│ │ │ │ +
169 }
│ │ │ │ +
│ │ │ │ +
170
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
173 {
│ │ │ │ +
174 // allocate the big array in the base class
│ │ │ │ +
175 this->n = a.n;
│ │ │ │ +
176 if (this->n>0)
│ │ │ │ +
177 {
│ │ │ │ +
178 // allocate and construct objects
│ │ │ │ +
179 this->p = allocator_.allocate(this->n);
│ │ │ │ +
180 new (this->p)B[this->n];
│ │ │ │ +
181
│ │ │ │ +
182 // copy data
│ │ │ │ +
183 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ +
184 }
│ │ │ │ +
185 else
│ │ │ │ +
186 {
│ │ │ │ +
187 this->n = 0;
│ │ │ │ +
188 this->p = nullptr;
│ │ │ │ +
189 }
│ │ │ │ +
190
│ │ │ │ +
191 // we can allocate the windows now
│ │ │ │ +
192 nblocks = a.nblocks;
│ │ │ │ +
193 if (nblocks>0)
│ │ │ │ +
194 {
│ │ │ │ +
195 // alloc
│ │ │ │ +
196 block = windowAllocator_.allocate(nblocks);
│ │ │ │ +
197 new (block) window_type[nblocks];
│ │ │ │ +
198
│ │ │ │ +
199 // and we must set the windows
│ │ │ │ +
200 block[0].set(a.block[0].getsize(),this->p); // first block
│ │ │ │ +
201 for (size_type i=1; i<nblocks; ++i) // and the rest
│ │ │ │ +
202 block[i].set(a.block[i].getsize(),block[i-1].getptr()+block[i-1].getsize());
│ │ │ │ +
203 }
│ │ │ │ +
204 else
│ │ │ │ +
205 {
│ │ │ │ +
206 nblocks = 0;
│ │ │ │ +
207 block = nullptr;
│ │ │ │ +
208 }
│ │ │ │ +
209
│ │ │ │ +
210 // and we have a usable vector
│ │ │ │ +
211 initialized = true;
│ │ │ │ +
212 }
│ │ │ │ +
│ │ │ │ +
213
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
216 {
│ │ │ │ +
217 if (this->n>0) {
│ │ │ │ +
218 size_type i=this->n;
│ │ │ │ +
219 while (i)
│ │ │ │ +
220 this->p[--i].~B();
│ │ │ │ +
221 allocator_.deallocate(this->p,this->n);
│ │ │ │ +
222 }
│ │ │ │ +
223 if (nblocks>0) {
│ │ │ │ +
224 size_type i=nblocks;
│ │ │ │ +
225 while (i)
│ │ │ │ +
226 block[--i].~window_type();
│ │ │ │ +
227 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ +
228 }
│ │ │ │ +
229
│ │ │ │ +
230 }
│ │ │ │ +
│ │ │ │
231
│ │ │ │ -
235 static void stats([[maybe_unused]] const Matrix& matrix)
│ │ │ │ -
236 {}
│ │ │ │ -
237 };
│ │ │ │ -
238
│ │ │ │ -
239 template<class Matrix>
│ │ │ │ -
240 struct MatrixStats<Matrix,true>
│ │ │ │ -
241 {
│ │ │ │ -
│ │ │ │ -
242 struct calc
│ │ │ │ -
243 {
│ │ │ │ -
244 typedef typename Matrix::size_type size_type;
│ │ │ │ -
245 typedef typename Matrix::row_type matrix_row;
│ │ │ │ -
246
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
248 {
│ │ │ │ -
249 min=std::numeric_limits<size_type>::max();
│ │ │ │ -
250 max=0;
│ │ │ │ -
251 sum=0;
│ │ │ │ -
252 }
│ │ │ │ -
│ │ │ │ -
253
│ │ │ │ -
│ │ │ │ -
254 void operator()(const matrix_row& row)
│ │ │ │ -
255 {
│ │ │ │ -
256 min=std::min(min, row.size());
│ │ │ │ -
257 max=std::max(max, row.size());
│ │ │ │ -
258 sum += row.size();
│ │ │ │ -
259 }
│ │ │ │ -
│ │ │ │ -
260
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
264 };
│ │ │ │ -
│ │ │ │ -
268 static void stats(const Matrix& matrix)
│ │ │ │ -
269 {
│ │ │ │ -
270 calc c= for_each(matrix.begin(), matrix.end(), calc());
│ │ │ │ -
271 dinfo<<"Matrix row: min="<<c.min<<" max="<<c.max
│ │ │ │ -
272 <<" average="<<static_cast<double>(c.sum)/matrix.N()
│ │ │ │ -
273 <<std::endl;
│ │ │ │ -
274 }
│ │ │ │ -
275 };
│ │ │ │ -
276 };
│ │ │ │ -
│ │ │ │ -
277
│ │ │ │ -
281 template<class T>
│ │ │ │ -
│ │ │ │ -
282 class CoarsenCriterion : public T
│ │ │ │ -
283 {
│ │ │ │ -
284 public:
│ │ │ │ - │ │ │ │ -
290
│ │ │ │ -
│ │ │ │ -
301 CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ │ -
302 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
│ │ │ │ -
303 : AggregationCriterion(Dune::Amg::Parameters(maxLevel, coarsenTarget, minCoarsenRate, prolongDamp, accumulate))
│ │ │ │ -
304 {}
│ │ │ │ -
│ │ │ │ -
305
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
307 : AggregationCriterion(parms)
│ │ │ │ -
308 {}
│ │ │ │ -
│ │ │ │ -
309
│ │ │ │ -
310 };
│ │ │ │ -
│ │ │ │ -
311
│ │ │ │ -
312 template<typename M, typename C1>
│ │ │ │ -
│ │ │ │ -
313 bool repartitionAndDistributeMatrix([[maybe_unused]] const M& origMatrix,
│ │ │ │ -
314 [[maybe_unused]] std::shared_ptr<M> newMatrix,
│ │ │ │ -
315 [[maybe_unused]] SequentialInformation& origComm,
│ │ │ │ -
316 [[maybe_unused]] std::shared_ptr<SequentialInformation>& newComm,
│ │ │ │ - │ │ │ │ -
318 [[maybe_unused]] int nparts,
│ │ │ │ -
319 [[maybe_unused]] C1& criterion)
│ │ │ │ -
320 {
│ │ │ │ -
321 DUNE_THROW(NotImplemented, "Redistribution does not make sense in sequential code!");
│ │ │ │ -
322 }
│ │ │ │ -
│ │ │ │ -
323
│ │ │ │ -
324
│ │ │ │ -
325 template<typename M, typename C, typename C1>
│ │ │ │ -
│ │ │ │ -
326 bool repartitionAndDistributeMatrix(const M& origMatrix,
│ │ │ │ -
327 std::shared_ptr<M> newMatrix,
│ │ │ │ -
328 C& origComm,
│ │ │ │ -
329 std::shared_ptr<C>& newComm,
│ │ │ │ - │ │ │ │ -
331 int nparts, C1& criterion)
│ │ │ │ -
332 {
│ │ │ │ -
333 Timer time;
│ │ │ │ -
334#ifdef AMG_REPART_ON_COMM_GRAPH
│ │ │ │ -
335 // Done not repartition the matrix graph, but a graph of the communication scheme.
│ │ │ │ -
336 bool existentOnRedist=Dune::commGraphRepartition(origMatrix, origComm, nparts, newComm,
│ │ │ │ -
337 ri.getInterface(),
│ │ │ │ -
338 criterion.debugLevel()>1);
│ │ │ │ -
339
│ │ │ │ -
340#else
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
345 IdentityMap,
│ │ │ │ -
346 IdentityMap> PropertiesGraph;
│ │ │ │ -
347 MatrixGraph graph(origMatrix);
│ │ │ │ -
348 PropertiesGraph pgraph(graph);
│ │ │ │ -
349 buildDependency(pgraph, origMatrix, criterion, false);
│ │ │ │ -
350
│ │ │ │ -
351#ifdef DEBUG_REPART
│ │ │ │ -
352 if(origComm.communicator().rank()==0)
│ │ │ │ -
353 std::cout<<"Original matrix"<<std::endl;
│ │ │ │ -
354 origComm.communicator().barrier();
│ │ │ │ -
355 printGlobalSparseMatrix(origMatrix, origComm, std::cout);
│ │ │ │ -
356#endif
│ │ │ │ -
357 bool existentOnRedist=Dune::graphRepartition(pgraph, origComm, nparts,
│ │ │ │ -
358 newComm, ri.getInterface(),
│ │ │ │ -
359 criterion.debugLevel()>1);
│ │ │ │ -
360#endif // if else AMG_REPART
│ │ │ │ -
361
│ │ │ │ -
362 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ │ -
363 std::cout<<"Repartitioning took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
364
│ │ │ │ -
365 ri.setSetup();
│ │ │ │ -
366
│ │ │ │ -
367#ifdef DEBUG_REPART
│ │ │ │ -
368 ri.checkInterface(origComm.indexSet(), newComm->indexSet(), origComm.communicator());
│ │ │ │ -
369#endif
│ │ │ │ -
370
│ │ │ │ -
371 redistributeMatrix(const_cast<M&>(origMatrix), *newMatrix, origComm, *newComm, ri);
│ │ │ │ +
232
│ │ │ │ +
│ │ │ │ +
234 void resize (size_type _nblocks)
│ │ │ │ +
235 {
│ │ │ │ +
236 // deconstruct objects and deallocate memory if necessary
│ │ │ │ +
237 if (this->n>0) {
│ │ │ │ +
238 size_type i=this->n;
│ │ │ │ +
239 while (i)
│ │ │ │ +
240 this->p[--i].~B();
│ │ │ │ +
241 allocator_.deallocate(this->p,this->n);
│ │ │ │ +
242 }
│ │ │ │ +
243 if (nblocks>0) {
│ │ │ │ +
244 size_type i=nblocks;
│ │ │ │ +
245 while (i)
│ │ │ │ +
246 block[--i].~window_type();
│ │ │ │ +
247 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ +
248 }
│ │ │ │ +
249 this->n = 0;
│ │ │ │ +
250 this->p = nullptr;
│ │ │ │ +
251
│ │ │ │ +
252 // we can allocate the windows now
│ │ │ │ +
253 nblocks = _nblocks;
│ │ │ │ +
254 if (nblocks>0)
│ │ │ │ +
255 {
│ │ │ │ +
256 block = windowAllocator_.allocate(nblocks);
│ │ │ │ +
257 new (block) window_type[nblocks];
│ │ │ │ +
258 }
│ │ │ │ +
259 else
│ │ │ │ +
260 {
│ │ │ │ +
261 nblocks = 0;
│ │ │ │ +
262 block = nullptr;
│ │ │ │ +
263 }
│ │ │ │ +
264
│ │ │ │ +
265 // and the vector not fully usable
│ │ │ │ +
266 initialized = false;
│ │ │ │ +
267 }
│ │ │ │ +
│ │ │ │ +
268
│ │ │ │ +
│ │ │ │ +
270 void resize (size_type _nblocks, size_type m)
│ │ │ │ +
271 {
│ │ │ │ +
272 // deconstruct objects and deallocate memory if necessary
│ │ │ │ +
273 if (this->n>0) {
│ │ │ │ +
274 size_type i=this->n;
│ │ │ │ +
275 while (i)
│ │ │ │ +
276 this->p[--i].~B();
│ │ │ │ +
277 allocator_.deallocate(this->p,this->n);
│ │ │ │ +
278 }
│ │ │ │ +
279 if (nblocks>0) {
│ │ │ │ +
280 size_type i=nblocks;
│ │ │ │ +
281 while (i)
│ │ │ │ +
282 block[--i].~window_type();
│ │ │ │ +
283 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ +
284 }
│ │ │ │ +
285
│ │ │ │ +
286 // and we can allocate the big array in the base class
│ │ │ │ +
287 this->n = _nblocks*m;
│ │ │ │ +
288 if (this->n>0)
│ │ │ │ +
289 {
│ │ │ │ +
290 this->p = allocator_.allocate(this->n);
│ │ │ │ +
291 new (this->p)B[this->n];
│ │ │ │ +
292 }
│ │ │ │ +
293 else
│ │ │ │ +
294 {
│ │ │ │ +
295 this->n = 0;
│ │ │ │ +
296 this->p = nullptr;
│ │ │ │ +
297 }
│ │ │ │ +
298
│ │ │ │ +
299 // we can allocate the windows now
│ │ │ │ +
300 nblocks = _nblocks;
│ │ │ │ +
301 if (nblocks>0)
│ │ │ │ +
302 {
│ │ │ │ +
303 // allocate and construct objects
│ │ │ │ +
304 block = windowAllocator_.allocate(nblocks);
│ │ │ │ +
305 new (block) window_type[nblocks];
│ │ │ │ +
306
│ │ │ │ +
307 // set the windows into the big array
│ │ │ │ +
308 for (size_type i=0; i<nblocks; ++i)
│ │ │ │ +
309 block[i].set(m,this->p+(i*m));
│ │ │ │ +
310 }
│ │ │ │ +
311 else
│ │ │ │ +
312 {
│ │ │ │ +
313 nblocks = 0;
│ │ │ │ +
314 block = nullptr;
│ │ │ │ +
315 }
│ │ │ │ +
316
│ │ │ │ +
317 // and the vector is usable
│ │ │ │ +
318 initialized = true;
│ │ │ │ +
319 }
│ │ │ │ +
│ │ │ │ +
320
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
323 {
│ │ │ │ +
324 if (&a!=this) // check if this and a are different objects
│ │ │ │ +
325 {
│ │ │ │ +
326 // reallocate arrays if necessary
│ │ │ │ +
327 // Note: still the block sizes may vary !
│ │ │ │ +
328 if (this->n!=a.n || nblocks!=a.nblocks)
│ │ │ │ +
329 {
│ │ │ │ +
330 // deconstruct objects and deallocate memory if necessary
│ │ │ │ +
331 if (this->n>0) {
│ │ │ │ +
332 size_type i=this->n;
│ │ │ │ +
333 while (i)
│ │ │ │ +
334 this->p[--i].~B();
│ │ │ │ +
335 allocator_.deallocate(this->p,this->n);
│ │ │ │ +
336 }
│ │ │ │ +
337 if (nblocks>0) {
│ │ │ │ +
338 size_type i=nblocks;
│ │ │ │ +
339 while (i)
│ │ │ │ +
340 block[--i].~window_type();
│ │ │ │ +
341 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ +
342 }
│ │ │ │ +
343
│ │ │ │ +
344 // allocate the big array in the base class
│ │ │ │ +
345 this->n = a.n;
│ │ │ │ +
346 if (this->n>0)
│ │ │ │ +
347 {
│ │ │ │ +
348 // allocate and construct objects
│ │ │ │ +
349 this->p = allocator_.allocate(this->n);
│ │ │ │ +
350 new (this->p)B[this->n];
│ │ │ │ +
351 }
│ │ │ │ +
352 else
│ │ │ │ +
353 {
│ │ │ │ +
354 this->n = 0;
│ │ │ │ +
355 this->p = nullptr;
│ │ │ │ +
356 }
│ │ │ │ +
357
│ │ │ │ +
358 // we can allocate the windows now
│ │ │ │ +
359 nblocks = a.nblocks;
│ │ │ │ +
360 if (nblocks>0)
│ │ │ │ +
361 {
│ │ │ │ +
362 // alloc
│ │ │ │ +
363 block = windowAllocator_.allocate(nblocks);
│ │ │ │ +
364 new (block) window_type[nblocks];
│ │ │ │ +
365 }
│ │ │ │ +
366 else
│ │ │ │ +
367 {
│ │ │ │ +
368 nblocks = 0;
│ │ │ │ +
369 block = nullptr;
│ │ │ │ +
370 }
│ │ │ │ +
371 }
│ │ │ │
372
│ │ │ │ -
373#ifdef DEBUG_REPART
│ │ │ │ -
374 if(origComm.communicator().rank()==0)
│ │ │ │ -
375 std::cout<<"Original matrix"<<std::endl;
│ │ │ │ -
376 origComm.communicator().barrier();
│ │ │ │ -
377 if(newComm->communicator().size()>0)
│ │ │ │ -
378 printGlobalSparseMatrix(*newMatrix, *newComm, std::cout);
│ │ │ │ -
379 origComm.communicator().barrier();
│ │ │ │ -
380#endif
│ │ │ │ +
373 // copy block structure, might be different although
│ │ │ │ +
374 // sizes are the same !
│ │ │ │ +
375 if (nblocks>0)
│ │ │ │ +
376 {
│ │ │ │ +
377 block[0].set(a.block[0].getsize(),this->p); // first block
│ │ │ │ +
378 for (size_type i=1; i<nblocks; ++i) // and the rest
│ │ │ │ +
379 block[i].set(a.block[i].getsize(),block[i-1].getptr()+block[i-1].getsize());
│ │ │ │ +
380 }
│ │ │ │
381
│ │ │ │ -
382 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ │ -
383 std::cout<<"Redistributing matrix took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
384 return existentOnRedist;
│ │ │ │ +
382 // and copy the data
│ │ │ │ +
383 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ +
384 }
│ │ │ │
385
│ │ │ │ -
386 }
│ │ │ │ -
│ │ │ │ -
387
│ │ │ │ -
388 template<class M, class IS, class A>
│ │ │ │ -
│ │ │ │ -
389 MatrixHierarchy<M,IS,A>::MatrixHierarchy(std::shared_ptr<MatrixOperator> fineMatrix,
│ │ │ │ -
390 std::shared_ptr<ParallelInformation> pinfo)
│ │ │ │ -
391 : matrices_(fineMatrix),
│ │ │ │ -
392 parallelInformation_(pinfo)
│ │ │ │ -
393 {
│ │ │ │ -
394 if (SolverCategory::category(*fineMatrix) != SolverCategory::category(*pinfo))
│ │ │ │ -
395 DUNE_THROW(ISTLError, "MatrixOperator and ParallelInformation must belong to the same category!");
│ │ │ │ -
396 }
│ │ │ │ -
│ │ │ │ -
397
│ │ │ │ -
398 template<class M, class IS, class A>
│ │ │ │ -
399 template<typename O, typename T>
│ │ │ │ -
│ │ │ │ -
400 void MatrixHierarchy<M,IS,A>::build(const T& criterion)
│ │ │ │ -
401 {
│ │ │ │ -
402 prolongDamp_ = criterion.getProlongationDampingFactor();
│ │ │ │ -
403 typedef O OverlapFlags;
│ │ │ │ -
404 typedef typename ParallelMatrixHierarchy::Iterator MatIterator;
│ │ │ │ -
405 typedef typename ParallelInformationHierarchy::Iterator PInfoIterator;
│ │ │ │ +
386 // and we have a usable vector
│ │ │ │ +
387 initialized = true;
│ │ │ │ +
388
│ │ │ │ +
389 return *this; // Gebe Referenz zurueck damit a=b=c; klappt
│ │ │ │ +
390 }
│ │ │ │ +
│ │ │ │ +
391
│ │ │ │ +
392
│ │ │ │ +
393 //===== assignment from scalar
│ │ │ │ +
394
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
397 {
│ │ │ │ +
398 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ +
399 return *this;
│ │ │ │ +
400 }
│ │ │ │ +
│ │ │ │ +
401
│ │ │ │ +
402
│ │ │ │ +
403 //===== the creation interface
│ │ │ │ +
404
│ │ │ │ +
405 class CreateIterator;
│ │ │ │
406
│ │ │ │ -
407 static const int noints=(Dune::Amg::MAX_PROCESSES/4096>0) ? (Dune::Amg::MAX_PROCESSES/4096) : 1;
│ │ │ │ +
407#ifndef DOXYGEN
│ │ │ │
408
│ │ │ │ -
409 typedef bigunsignedint<sizeof(int)*8*noints> BIGINT;
│ │ │ │ - │ │ │ │ -
411 MatIterator mlevel = matrices_.finest();
│ │ │ │ -
412 MatrixStats<typename M::matrix_type,MINIMAL_DEBUG_LEVEL<=INFO_DEBUG_LEVEL>::stats(mlevel->getmat());
│ │ │ │ -
413
│ │ │ │ -
414 PInfoIterator infoLevel = parallelInformation_.finest();
│ │ │ │ -
415 BIGINT finenonzeros=countNonZeros(mlevel->getmat());
│ │ │ │ -
416 finenonzeros = infoLevel->communicator().sum(finenonzeros);
│ │ │ │ -
417 BIGINT allnonzeros = finenonzeros;
│ │ │ │ -
418
│ │ │ │ -
419
│ │ │ │ -
420 int level = 0;
│ │ │ │ -
421 int rank = 0;
│ │ │ │ -
422
│ │ │ │ -
423 BIGINT unknowns = mlevel->getmat().N();
│ │ │ │ -
424
│ │ │ │ -
425 unknowns = infoLevel->communicator().sum(unknowns);
│ │ │ │ -
426 double dunknowns=unknowns.todouble();
│ │ │ │ -
427 infoLevel->buildGlobalLookup(mlevel->getmat().N());
│ │ │ │ -
428 redistributes_.push_back(RedistributeInfoType());
│ │ │ │ +
409 // The window_type does not hand out a reference to its size,
│ │ │ │ +
410 // so in order to provide a valid iterator, we need a workaround
│ │ │ │ +
411 // to make assignment possible. This proxy enables just that by
│ │ │ │ +
412 // implicitly converting to the stored size for read access and
│ │ │ │ +
413 // tunneling assignment to the accessor method of the window.
│ │ │ │ +
414 struct SizeProxy
│ │ │ │ +
415 {
│ │ │ │ +
416
│ │ │ │ +
417 operator size_type() const
│ │ │ │ +
418 {
│ │ │ │ +
419 return target->getsize();
│ │ │ │ +
420 }
│ │ │ │ +
421
│ │ │ │ +
422 SizeProxy& operator=(size_type size)
│ │ │ │ +
423 {
│ │ │ │ +
424 target->setsize(size);
│ │ │ │ +
425 return *this;
│ │ │ │ +
426 }
│ │ │ │ +
427
│ │ │ │ +
428 private:
│ │ │ │
429
│ │ │ │ -
430 for(; level < criterion.maxLevel(); ++level, ++mlevel) {
│ │ │ │ -
431 assert(matrices_.levels()==redistributes_.size());
│ │ │ │ -
432 rank = infoLevel->communicator().rank();
│ │ │ │ -
433 if(rank==0 && criterion.debugLevel()>1)
│ │ │ │ -
434 std::cout<<"Level "<<level<<" has "<<dunknowns<<" unknowns, "<<dunknowns/infoLevel->communicator().size()
│ │ │ │ -
435 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ │ -
436
│ │ │ │ -
437 MatrixOperator* matrix=&(*mlevel);
│ │ │ │ -
438 ParallelInformation* info =&(*infoLevel);
│ │ │ │ -
439
│ │ │ │ -
440 if((
│ │ │ │ -
441#if HAVE_PARMETIS
│ │ │ │ -
442 criterion.accumulate()==successiveAccu
│ │ │ │ -
443#else
│ │ │ │ -
444 false
│ │ │ │ -
445#endif
│ │ │ │ -
446 || (criterion.accumulate()==atOnceAccu
│ │ │ │ -
447 && dunknowns < 30*infoLevel->communicator().size()))
│ │ │ │ -
448 && infoLevel->communicator().size()>1 &&
│ │ │ │ -
449 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget())
│ │ │ │ -
450 {
│ │ │ │ -
451 // accumulate to fewer processors
│ │ │ │ -
452 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ │ -
453 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ │ -
454 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/(criterion.minAggregateSize()
│ │ │ │ -
455 *criterion.coarsenTarget()));
│ │ │ │ -
456 if( nodomains<=criterion.minAggregateSize()/2 ||
│ │ │ │ -
457 dunknowns <= criterion.coarsenTarget() )
│ │ │ │ -
458 nodomains=1;
│ │ │ │ -
459
│ │ │ │ -
460 bool existentOnNextLevel =
│ │ │ │ -
461 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ │ -
462 redistComm, redistributes_.back(), nodomains,
│ │ │ │ -
463 criterion);
│ │ │ │ -
464 BIGINT unknownsRedist = redistMat->N();
│ │ │ │ -
465 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ │ -
466 dunknowns= unknownsRedist.todouble();
│ │ │ │ -
467 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ │ -
468 std::cout<<"Level "<<level<<" (redistributed) has "<<dunknowns<<" unknowns, "<<dunknowns/redistComm->communicator().size()
│ │ │ │ -
469 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ │ -
470 MatrixArgs args(redistMat, *redistComm);
│ │ │ │ -
471 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ │ -
472 assert(mlevel.isRedistributed());
│ │ │ │ -
473 infoLevel.addRedistributed(redistComm);
│ │ │ │ -
474 infoLevel->freeGlobalLookup();
│ │ │ │ -
475
│ │ │ │ -
476 if(!existentOnNextLevel)
│ │ │ │ -
477 // We do not hold any data on the redistributed partitioning
│ │ │ │ -
478 break;
│ │ │ │ -
479
│ │ │ │ -
480 // Work on the redistributed Matrix from now on
│ │ │ │ -
481 matrix = &(mlevel.getRedistributed());
│ │ │ │ -
482 info = &(infoLevel.getRedistributed());
│ │ │ │ -
483 info->buildGlobalLookup(matrix->getmat().N());
│ │ │ │ -
484 }
│ │ │ │ -
485
│ │ │ │ -
486 rank = info->communicator().rank();
│ │ │ │ -
487 if(dunknowns <= criterion.coarsenTarget())
│ │ │ │ -
488 // No further coarsening needed
│ │ │ │ -
489 break;
│ │ │ │ -
490
│ │ │ │ - │ │ │ │ -
492 typedef typename GraphCreator::PropertiesGraph PropertiesGraph;
│ │ │ │ -
493 typedef typename GraphCreator::GraphTuple GraphTuple;
│ │ │ │ -
494
│ │ │ │ -
495 typedef typename PropertiesGraph::VertexDescriptor Vertex;
│ │ │ │ -
496
│ │ │ │ -
497 std::vector<bool> excluded(matrix->getmat().N(), false);
│ │ │ │ -
498
│ │ │ │ -
499 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, OverlapFlags());
│ │ │ │ -
500
│ │ │ │ -
501 AggregatesMap* aggregatesMap=new AggregatesMap(std::get<1>(graphs)->maxVertex()+1);
│ │ │ │ -
502
│ │ │ │ -
503 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ │ -
504
│ │ │ │ -
505 Timer watch;
│ │ │ │ -
506 watch.reset();
│ │ │ │ -
507 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] =
│ │ │ │ -
508 aggregatesMap->buildAggregates(matrix->getmat(), *(std::get<1>(graphs)), criterion, level==0);
│ │ │ │ +
430 friend class CreateIterator;
│ │ │ │ +
431
│ │ │ │ +
432 SizeProxy(window_type& t)
│ │ │ │ +
433 : target(&t)
│ │ │ │ +
434 {}
│ │ │ │ +
435
│ │ │ │ +
436 window_type* target;
│ │ │ │ +
437 };
│ │ │ │ +
438
│ │ │ │ +
439#endif // DOXYGEN
│ │ │ │ +
440
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
443 {
│ │ │ │ +
444 public:
│ │ │ │ +
446 using iterator_category = std::output_iterator_tag;
│ │ │ │ +
447
│ │ │ │ + │ │ │ │ +
450
│ │ │ │ +
457 using difference_type = void;
│ │ │ │ +
458
│ │ │ │ + │ │ │ │ +
461
│ │ │ │ +
463 using reference = SizeProxy;
│ │ │ │ +
464
│ │ │ │ +
│ │ │ │ +
466 CreateIterator (VariableBlockVector& _v, int _i, bool _isEnd) :
│ │ │ │ +
467 v(_v),
│ │ │ │ +
468 i(_i),
│ │ │ │ +
469 isEnd(_isEnd) {}
│ │ │ │ +
│ │ │ │ +
470
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
472 // When the iterator gets destructed, we allocate the memory
│ │ │ │ +
473 // for the VariableBlockVector if
│ │ │ │ +
474 // 1. the current iterator was not created as enditerator
│ │ │ │ +
475 // 2. we're at the last block
│ │ │ │ +
476 // 3. the vector hasn't been initialized earlier
│ │ │ │ +
477 if (not isEnd && i==v.nblocks && not v.initialized)
│ │ │ │ +
478 v.allocate();
│ │ │ │ +
479 }
│ │ │ │ +
│ │ │ │ +
480
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
483 {
│ │ │ │ +
484 // go to next block
│ │ │ │ +
485 ++i;
│ │ │ │ +
486
│ │ │ │ +
487 return *this;
│ │ │ │ +
488 }
│ │ │ │ +
│ │ │ │ +
489
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
492 {
│ │ │ │ +
493 CreateIterator tmp(*this);
│ │ │ │ +
494 this->operator++();
│ │ │ │ +
495 return tmp;
│ │ │ │ +
496 }
│ │ │ │ +
│ │ │ │ +
497
│ │ │ │ +
│ │ │ │ +
499 bool operator!= (const CreateIterator& it) const
│ │ │ │ +
500 {
│ │ │ │ +
501 return (i!=it.i) || (&v!=&it.v);
│ │ │ │ +
502 }
│ │ │ │ +
│ │ │ │ +
503
│ │ │ │ +
│ │ │ │ +
505 bool operator== (const CreateIterator& it) const
│ │ │ │ +
506 {
│ │ │ │ +
507 return (i==it.i) && (&v==&it.v);
│ │ │ │ +
508 }
│ │ │ │ +
│ │ │ │
509
│ │ │ │ -
510 if(rank==0 && criterion.debugLevel()>2)
│ │ │ │ -
511 std::cout<<" Have built "<<noAggregates<<" aggregates totally ("<<isoAggregates<<" isolated aggregates, "<<
│ │ │ │ -
512 oneAggregates<<" aggregates of one vertex, and skipped "<<
│ │ │ │ -
513 skippedAggregates<<" aggregates)."<<std::endl;
│ │ │ │ -
514#ifdef TEST_AGGLO
│ │ │ │ -
515 {
│ │ │ │ -
516 // calculate size of local matrix in the distributed direction
│ │ │ │ -
517 int start, end, overlapStart, overlapEnd;
│ │ │ │ -
518 int procs=info->communicator().rank();
│ │ │ │ -
519 int n = UNKNOWNS/procs; // number of unknowns per process
│ │ │ │ -
520 int bigger = UNKNOWNS%procs; // number of process with n+1 unknows
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
512 {
│ │ │ │ +
513 return i;
│ │ │ │ +
514 }
│ │ │ │ +
│ │ │ │ +
515
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
518 {
│ │ │ │ +
519 v.block[i].setsize(_k);
│ │ │ │ +
520 }
│ │ │ │ +
│ │ │ │
521
│ │ │ │ -
522 // Compute owner region
│ │ │ │ -
523 if(rank<bigger) {
│ │ │ │ -
524 start = rank*(n+1);
│ │ │ │ -
525 end = (rank+1)*(n+1);
│ │ │ │ -
526 }else{
│ │ │ │ -
527 start = bigger + rank * n;
│ │ │ │ -
528 end = bigger + (rank + 1) * n;
│ │ │ │ -
529 }
│ │ │ │ -
530
│ │ │ │ -
531 // Compute overlap region
│ │ │ │ -
532 if(start>0)
│ │ │ │ -
533 overlapStart = start - 1;
│ │ │ │ -
534 else
│ │ │ │ -
535 overlapStart = start;
│ │ │ │ -
536
│ │ │ │ -
537 if(end<UNKNOWNS)
│ │ │ │ -
538 overlapEnd = end + 1;
│ │ │ │ -
539 else
│ │ │ │ -
540 overlapEnd = end;
│ │ │ │ +
523#ifdef DOXYGEN
│ │ │ │ +
524 size_type&
│ │ │ │ +
525#else
│ │ │ │ +
526 SizeProxy
│ │ │ │ +
527#endif
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
529 {
│ │ │ │ +
530 return {v.block[i]};
│ │ │ │ +
531 }
│ │ │ │ +
│ │ │ │ +
532
│ │ │ │ +
533 private:
│ │ │ │ +
534 VariableBlockVector& v; // my vector
│ │ │ │ +
535 size_type i; // current block to be defined
│ │ │ │ +
536 const bool isEnd; // flag if this object was created as the end iterator.
│ │ │ │ +
537 };
│ │ │ │ +
│ │ │ │ +
538
│ │ │ │ +
539 // CreateIterator wants to set all the arrays ...
│ │ │ │ +
540 friend class CreateIterator;
│ │ │ │
541
│ │ │ │ -
542 assert((UNKNOWNS)*(overlapEnd-overlapStart)==aggregatesMap->noVertices());
│ │ │ │ -
543 for(int j=0; j< UNKNOWNS; ++j)
│ │ │ │ -
544 for(int i=0; i < UNKNOWNS; ++i)
│ │ │ │ -
545 {
│ │ │ │ -
546 if(i>=overlapStart && i<overlapEnd)
│ │ │ │ -
547 {
│ │ │ │ -
548 int no = (j/2)*((UNKNOWNS)/2)+i/2;
│ │ │ │ -
549 (*aggregatesMap)[j*(overlapEnd-overlapStart)+i-overlapStart]=no;
│ │ │ │ -
550 }
│ │ │ │ -
551 }
│ │ │ │ -
552 }
│ │ │ │ -
553#endif
│ │ │ │ -
554 if(criterion.debugLevel()>1 && info->communicator().rank()==0)
│ │ │ │ -
555 std::cout<<"aggregating finished."<<std::endl;
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
544 {
│ │ │ │ +
545#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
546 if (initialized) DUNE_THROW(ISTLError,"no CreateIterator in initialized state");
│ │ │ │ +
547#endif
│ │ │ │ +
548 return CreateIterator(*this,0, false);
│ │ │ │ +
549 }
│ │ │ │ +
│ │ │ │ +
550
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
553 {
│ │ │ │ +
554 return CreateIterator(*this,nblocks, true);
│ │ │ │ +
555 }
│ │ │ │ +
│ │ │ │
556
│ │ │ │ -
557 BIGINT gnoAggregates=noAggregates;
│ │ │ │ -
558 gnoAggregates = info->communicator().sum(gnoAggregates);
│ │ │ │ -
559 double dgnoAggregates = gnoAggregates.todouble();
│ │ │ │ -
560#ifdef TEST_AGGLO
│ │ │ │ -
561 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2);
│ │ │ │ -
562#endif
│ │ │ │ -
563
│ │ │ │ -
564 if(criterion.debugLevel()>2 && rank==0)
│ │ │ │ -
565 std::cout << "Building "<<dgnoAggregates<<" aggregates took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
566
│ │ │ │ -
567 if(dgnoAggregates==0 || dunknowns/dgnoAggregates<criterion.minCoarsenRate())
│ │ │ │ -
568 {
│ │ │ │ -
569 if(rank==0)
│ │ │ │ -
570 {
│ │ │ │ -
571 if(dgnoAggregates>0)
│ │ │ │ -
572 std::cerr << "Stopped coarsening because of rate breakdown "<<dunknowns<<"/"<<dgnoAggregates
│ │ │ │ -
573 <<"="<<dunknowns/dgnoAggregates<<"<"
│ │ │ │ -
574 <<criterion.minCoarsenRate()<<std::endl;
│ │ │ │ -
575 else
│ │ │ │ -
576 std::cerr<< "Could not build any aggregates. Probably no connected nodes."<<std::endl;
│ │ │ │ -
577 }
│ │ │ │ -
578 aggregatesMap->free();
│ │ │ │ -
579 delete aggregatesMap;
│ │ │ │ -
580 aggregatesMaps_.pop_back();
│ │ │ │ -
581
│ │ │ │ -
582 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator().size()>1) {
│ │ │ │ -
583 // coarse level matrix was already redistributed, but to more than 1 process
│ │ │ │ -
584 // Therefore need to delete the redistribution. Further down it will
│ │ │ │ -
585 // then be redistributed to 1 process
│ │ │ │ -
586 delete &(mlevel.getRedistributed().getmat());
│ │ │ │ -
587 mlevel.deleteRedistributed();
│ │ │ │ -
588 delete &(infoLevel.getRedistributed());
│ │ │ │ -
589 infoLevel.deleteRedistributed();
│ │ │ │ -
590 redistributes_.back().resetSetup();
│ │ │ │ -
591 }
│ │ │ │ +
557
│ │ │ │ +
558 //===== access to components
│ │ │ │ +
559 // has to be overwritten from base class because it must
│ │ │ │ +
560 // return access to the windows
│ │ │ │ +
561
│ │ │ │ +
│ │ │ │ +
563 window_type& operator[] (size_type i)
│ │ │ │ +
564 {
│ │ │ │ +
565#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
566 if (i>=nblocks) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
567#endif
│ │ │ │ +
568 return block[i];
│ │ │ │ +
569 }
│ │ │ │ +
│ │ │ │ +
570
│ │ │ │ +
│ │ │ │ +
572 const window_type& operator[] (size_type i) const
│ │ │ │ +
573 {
│ │ │ │ +
574#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
575 if (i<0 || i>=nblocks) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ +
576#endif
│ │ │ │ +
577 return block[i];
│ │ │ │ +
578 }
│ │ │ │ +
│ │ │ │ +
579
│ │ │ │ +
581 template <class T, class R>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
583 : public RandomAccessIteratorFacade<RealIterator<T,R>, T, R>
│ │ │ │ +
584 {
│ │ │ │ +
585 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
588 {
│ │ │ │ +
589 p = nullptr;
│ │ │ │ +
590 i = 0;
│ │ │ │ +
591 }
│ │ │ │ +
│ │ │ │
592
│ │ │ │ -
593 break;
│ │ │ │ -
594 }
│ │ │ │ -
595 unknowns = noAggregates;
│ │ │ │ -
596 dunknowns = dgnoAggregates;
│ │ │ │ +
│ │ │ │ +
594 RealIterator (window_type* _p, size_type _i)
│ │ │ │ +
595 : p(_p), i(_i)
│ │ │ │ +
596 {}
│ │ │ │ +
│ │ │ │
597
│ │ │ │ -
598 CommunicationArgs commargs(info->communicator(),info->category());
│ │ │ │ -
599 parallelInformation_.addCoarser(commargs);
│ │ │ │ -
600
│ │ │ │ -
601 ++infoLevel; // parallel information on coarse level
│ │ │ │ -
602
│ │ │ │ -
603 typename PropertyMapTypeSelector<VertexVisitedTag,PropertiesGraph>::Type visitedMap =
│ │ │ │ -
604 get(VertexVisitedTag(), *(std::get<1>(graphs)));
│ │ │ │ -
605
│ │ │ │ -
606 watch.reset();
│ │ │ │ - │ │ │ │ -
608 ::coarsen(*info,
│ │ │ │ -
609 *(std::get<1>(graphs)),
│ │ │ │ -
610 visitedMap,
│ │ │ │ -
611 *aggregatesMap,
│ │ │ │ -
612 *infoLevel,
│ │ │ │ -
613 noAggregates);
│ │ │ │ -
614 GraphCreator::free(graphs);
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
600 {
│ │ │ │ +
601 ++i;
│ │ │ │ +
602 }
│ │ │ │ +
│ │ │ │ +
603
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
606 {
│ │ │ │ +
607 --i;
│ │ │ │ +
608 }
│ │ │ │ +
│ │ │ │ +
609
│ │ │ │ +
│ │ │ │ +
611 bool equals (const RealIterator& it) const
│ │ │ │ +
612 {
│ │ │ │ +
613 return (p+i)==(it.p+it.i);
│ │ │ │ +
614 }
│ │ │ │ +
│ │ │ │
615
│ │ │ │ -
616 if(criterion.debugLevel()>2) {
│ │ │ │ -
617 if(rank==0)
│ │ │ │ -
618 std::cout<<"Coarsening of index sets took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
619 }
│ │ │ │ -
620
│ │ │ │ -
621 watch.reset();
│ │ │ │ -
622
│ │ │ │ -
623 infoLevel->buildGlobalLookup(aggregates);
│ │ │ │ - │ │ │ │ -
625 *info,
│ │ │ │ -
626 infoLevel->globalLookup());
│ │ │ │ -
627
│ │ │ │ -
628
│ │ │ │ -
629 if(criterion.debugLevel()>2) {
│ │ │ │ -
630 if(rank==0)
│ │ │ │ -
631 std::cout<<"Communicating global aggregate numbers took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
632 }
│ │ │ │ -
633
│ │ │ │ -
634 watch.reset();
│ │ │ │ -
635 std::vector<bool>& visited=excluded;
│ │ │ │ -
636
│ │ │ │ -
637 typedef std::vector<bool>::iterator Iterator;
│ │ │ │ -
638 typedef IteratorPropertyMap<Iterator, IdentityMap> VisitedMap2;
│ │ │ │ -
639 Iterator end = visited.end();
│ │ │ │ -
640 for(Iterator iter= visited.begin(); iter != end; ++iter)
│ │ │ │ -
641 *iter=false;
│ │ │ │ -
642
│ │ │ │ -
643 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap());
│ │ │ │ -
644
│ │ │ │ -
645 std::shared_ptr<typename MatrixOperator::matrix_type>
│ │ │ │ -
646 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2,
│ │ │ │ -
647 *info,
│ │ │ │ -
648 *aggregatesMap,
│ │ │ │ -
649 aggregates,
│ │ │ │ -
650 OverlapFlags()));
│ │ │ │ -
651 dverb<<"Building of sparsity pattern took "<<watch.elapsed()<<std::endl;
│ │ │ │ -
652 watch.reset();
│ │ │ │ -
653 info->freeGlobalLookup();
│ │ │ │ -
654
│ │ │ │ -
655 delete std::get<0>(graphs);
│ │ │ │ -
656 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, *infoLevel, OverlapFlags());
│ │ │ │ -
657
│ │ │ │ -
658 if(criterion.debugLevel()>2) {
│ │ │ │ -
659 if(rank==0)
│ │ │ │ -
660 std::cout<<"Calculation entries of Galerkin product took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
661 }
│ │ │ │ +
│ │ │ │ +
617 window_type& dereference () const
│ │ │ │ +
618 {
│ │ │ │ +
619 return p[i];
│ │ │ │ +
620 }
│ │ │ │ +
│ │ │ │ +
621
│ │ │ │ +
│ │ │ │ +
622 void advance(std::ptrdiff_t d)
│ │ │ │ +
623 {
│ │ │ │ +
624 i+=d;
│ │ │ │ +
625 }
│ │ │ │ +
│ │ │ │ +
626
│ │ │ │ +
│ │ │ │ +
627 std::ptrdiff_t distanceTo(const RealIterator& o) const
│ │ │ │ +
628 {
│ │ │ │ +
629 return o.i-i;
│ │ │ │ +
630 }
│ │ │ │ +
│ │ │ │ +
631
│ │ │ │ +
632 // Needed for operator[] of the iterator
│ │ │ │ +
│ │ │ │ +
633 window_type& elementAt (std::ptrdiff_t offset) const
│ │ │ │ +
634 {
│ │ │ │ +
635 return p[i+offset];
│ │ │ │ +
636 }
│ │ │ │ +
│ │ │ │ +
637
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
640 {
│ │ │ │ +
641 return i;
│ │ │ │ +
642 }
│ │ │ │ +
│ │ │ │ +
643
│ │ │ │ +
644 private:
│ │ │ │ +
645 window_type* p;
│ │ │ │ +
646 size_type i;
│ │ │ │ +
647 };
│ │ │ │ +
│ │ │ │ +
648
│ │ │ │ + │ │ │ │ +
650
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
653 {
│ │ │ │ +
654 return Iterator(block,0);
│ │ │ │ +
655 }
│ │ │ │ +
│ │ │ │ +
656
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
659 {
│ │ │ │ +
660 return Iterator(block,nblocks);
│ │ │ │ +
661 }
│ │ │ │ +
│ │ │ │
662
│ │ │ │ -
663 BIGINT nonzeros = countNonZeros(*coarseMatrix);
│ │ │ │ -
664 allnonzeros = allnonzeros + infoLevel->communicator().sum(nonzeros);
│ │ │ │ -
665 MatrixArgs args(coarseMatrix, *infoLevel);
│ │ │ │ -
666
│ │ │ │ -
667 matrices_.addCoarser(args);
│ │ │ │ -
668 redistributes_.push_back(RedistributeInfoType());
│ │ │ │ -
669 } // end level loop
│ │ │ │ -
670
│ │ │ │ -
671
│ │ │ │ -
672 infoLevel->freeGlobalLookup();
│ │ │ │ -
673
│ │ │ │ -
674 built_=true;
│ │ │ │ -
675 AggregatesMap* aggregatesMap=new AggregatesMap(0);
│ │ │ │ -
676 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ │ -
677
│ │ │ │ -
678 if(criterion.debugLevel()>0) {
│ │ │ │ -
679 if(level==criterion.maxLevel()) {
│ │ │ │ -
680 BIGINT unknownsLevel = mlevel->getmat().N();
│ │ │ │ -
681 unknownsLevel = infoLevel->communicator().sum(unknownsLevel);
│ │ │ │ -
682 double dunknownsLevel = unknownsLevel.todouble();
│ │ │ │ -
683 if(rank==0 && criterion.debugLevel()>1) {
│ │ │ │ -
684 std::cout<<"Level "<<level<<" has "<<dunknownsLevel<<" unknowns, "<<dunknownsLevel/infoLevel->communicator().size()
│ │ │ │ -
685 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ │ -
686 }
│ │ │ │ -
687 }
│ │ │ │ -
688 }
│ │ │ │ -
689
│ │ │ │ -
690 if(criterion.accumulate() && !redistributes_.back().isSetup() &&
│ │ │ │ -
691 infoLevel->communicator().size()>1) {
│ │ │ │ -
692#if HAVE_MPI && !HAVE_PARMETIS
│ │ │ │ -
693 if(criterion.accumulate()==successiveAccu &&
│ │ │ │ -
694 infoLevel->communicator().rank()==0)
│ │ │ │ -
695 std::cerr<<"Successive accumulation of data on coarse levels only works with ParMETIS installed."
│ │ │ │ -
696 <<" Fell back to accumulation to one domain on coarsest level"<<std::endl;
│ │ │ │ -
697#endif
│ │ │ │ -
698
│ │ │ │ -
699 // accumulate to fewer processors
│ │ │ │ -
700 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ │ -
701 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ │ -
702 int nodomains = 1;
│ │ │ │ -
703
│ │ │ │ -
704 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ │ -
705 redistComm, redistributes_.back(), nodomains,criterion);
│ │ │ │ -
706 MatrixArgs args(redistMat, *redistComm);
│ │ │ │ -
707 BIGINT unknownsRedist = redistMat->N();
│ │ │ │ -
708 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ │ -
709
│ │ │ │ -
710 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) {
│ │ │ │ -
711 double dunknownsRedist = unknownsRedist.todouble();
│ │ │ │ -
712 std::cout<<"Level "<<level<<" redistributed has "<<dunknownsRedist<<" unknowns, "<<dunknownsRedist/redistComm->communicator().size()
│ │ │ │ -
713 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ │ -
714 }
│ │ │ │ -
715 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ │ -
716 infoLevel.addRedistributed(redistComm);
│ │ │ │ -
717 infoLevel->freeGlobalLookup();
│ │ │ │ -
718 }
│ │ │ │ -
719
│ │ │ │ -
720 int levels = matrices_.levels();
│ │ │ │ -
721 maxlevels_ = parallelInformation_.finest()->communicator().max(levels);
│ │ │ │ -
722 assert(matrices_.levels()==redistributes_.size());
│ │ │ │ -
723 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1)
│ │ │ │ -
724 std::cout<<"operator complexity: "<<allnonzeros.todouble()/finenonzeros.todouble()<<std::endl;
│ │ │ │ -
725
│ │ │ │ -
726 }
│ │ │ │ -
│ │ │ │ -
727
│ │ │ │ -
728 template<class M, class IS, class A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
731 {
│ │ │ │ -
732 return matrices_;
│ │ │ │ -
733 }
│ │ │ │ -
│ │ │ │ -
734
│ │ │ │ -
735 template<class M, class IS, class A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
738 {
│ │ │ │ -
739 return parallelInformation_;
│ │ │ │ -
740 }
│ │ │ │ -
│ │ │ │ -
741
│ │ │ │ -
742 template<class M, class IS, class A>
│ │ │ │ -
│ │ │ │ -
743 void MatrixHierarchy<M,IS,A>::getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const
│ │ │ │ -
744 {
│ │ │ │ -
745 int levels=aggregatesMaps().size();
│ │ │ │ -
746 int maxlevels=parallelInformation_.finest()->communicator().max(levels);
│ │ │ │ -
747 std::size_t size=(*(aggregatesMaps().begin()))->noVertices();
│ │ │ │ -
748 // We need an auxiliary vector for the consecutive prolongation.
│ │ │ │ -
749 std::vector<std::size_t> tmp;
│ │ │ │ -
750 std::vector<std::size_t> *coarse, *fine;
│ │ │ │ -
751
│ │ │ │ -
752 // make sure the allocated space suffices.
│ │ │ │ -
753 tmp.reserve(size);
│ │ │ │ -
754 data.reserve(size);
│ │ │ │ -
755
│ │ │ │ -
756 // Correctly assign coarse and fine for the first prolongation such that
│ │ │ │ -
757 // we end up in data in the end.
│ │ │ │ -
758 if(levels%2==0) {
│ │ │ │ -
759 coarse=&tmp;
│ │ │ │ -
760 fine=&data;
│ │ │ │ -
761 }else{
│ │ │ │ -
762 coarse=&data;
│ │ │ │ -
763 fine=&tmp;
│ │ │ │ -
764 }
│ │ │ │ -
765
│ │ │ │ -
766 // Number the unknowns on the coarsest level consecutively for each process.
│ │ │ │ -
767 if(levels==maxlevels) {
│ │ │ │ -
768 const AggregatesMap& map = *(*(++aggregatesMaps().rbegin()));
│ │ │ │ -
769 std::size_t m=0;
│ │ │ │ -
770
│ │ │ │ -
771 for(typename AggregatesMap::const_iterator iter = map.begin(); iter != map.end(); ++iter)
│ │ │ │ -
772 if(*iter< AggregatesMap::ISOLATED)
│ │ │ │ -
773 m=std::max(*iter,m);
│ │ │ │ -
774
│ │ │ │ -
775 coarse->resize(m+1);
│ │ │ │ -
776 std::size_t i=0;
│ │ │ │ -
777 srand((unsigned)std::clock());
│ │ │ │ -
778 std::set<size_t> used;
│ │ │ │ -
779 for(typename std::vector<std::size_t>::iterator iter=coarse->begin(); iter != coarse->end();
│ │ │ │ -
780 ++iter, ++i)
│ │ │ │ -
781 {
│ │ │ │ -
782 std::pair<std::set<std::size_t>::iterator,bool> ibpair
│ │ │ │ -
783 = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0)))*coarse->size());
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
666 {
│ │ │ │ +
667 return Iterator(block,nblocks-1);
│ │ │ │ +
668 }
│ │ │ │ +
│ │ │ │ +
669
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
673 {
│ │ │ │ +
674 return Iterator(block,-1);
│ │ │ │ +
675 }
│ │ │ │ +
│ │ │ │ +
676
│ │ │ │ + │ │ │ │ +
679
│ │ │ │ + │ │ │ │ +
682
│ │ │ │ + │ │ │ │ +
685
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
688 {
│ │ │ │ +
689 return ConstIterator(block,0);
│ │ │ │ +
690 }
│ │ │ │ +
│ │ │ │ +
691
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
694 {
│ │ │ │ +
695 return ConstIterator(block,nblocks);
│ │ │ │ +
696 }
│ │ │ │ +
│ │ │ │ +
697
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
701 {
│ │ │ │ +
702 return ConstIterator(block,nblocks-1);
│ │ │ │ +
703 }
│ │ │ │ +
│ │ │ │ +
704
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
707 {
│ │ │ │ +
708 return ConstIterator(block,-1);
│ │ │ │ +
709 }
│ │ │ │ +
│ │ │ │ +
710
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
713 {
│ │ │ │ +
714 return Iterator(block,std::min(i,nblocks));
│ │ │ │ +
715 }
│ │ │ │ +
│ │ │ │ +
716
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
719 {
│ │ │ │ +
720 return ConstIterator(block,std::min(i,nblocks));
│ │ │ │ +
721 }
│ │ │ │ +
│ │ │ │ +
722
│ │ │ │ +
723 //===== sizes
│ │ │ │ +
724
│ │ │ │ +
│ │ │ │ +
726 size_type N () const
│ │ │ │ +
727 {
│ │ │ │ +
728 return nblocks;
│ │ │ │ +
729 }
│ │ │ │ +
│ │ │ │ +
730
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
736 {
│ │ │ │ +
737 return nblocks;
│ │ │ │ +
738 }
│ │ │ │ +
│ │ │ │ +
739
│ │ │ │ +
740
│ │ │ │ +
741 private:
│ │ │ │ +
742
│ │ │ │ +
743 void allocate() {
│ │ │ │ +
744 if (this->initialized)
│ │ │ │ +
745 DUNE_THROW(ISTLError, "Attempt to re-allocate already initialized VariableBlockVector");
│ │ │ │ +
746
│ │ │ │ +
747 // calculate space needed:
│ │ │ │ +
748 this->n=0;
│ │ │ │ +
749 for(size_type i = 0; i < nblocks; i++) {
│ │ │ │ +
750 this->n += block[i].size();
│ │ │ │ +
751 }
│ │ │ │ +
752
│ │ │ │ +
753 // now we can allocate the big array in the base class of v
│ │ │ │ +
754 if (this->n>0)
│ │ │ │ +
755 {
│ │ │ │ +
756 // allocate and construct objects
│ │ │ │ +
757 this->p = allocator_.allocate(this->n);
│ │ │ │ +
758 new (this->p)B[this->n];
│ │ │ │ +
759 }
│ │ │ │ +
760 else
│ │ │ │ +
761 {
│ │ │ │ +
762 this->p = nullptr;
│ │ │ │ +
763 }
│ │ │ │ +
764
│ │ │ │ +
765 // and we set the window pointers
│ │ │ │ +
766 this->block[0].setptr(this->p); // pointer to first block
│ │ │ │ +
767 for (size_type j=1; j<nblocks; ++j) // and the rest
│ │ │ │ +
768 block[j].setptr(block[j-1].getptr()+block[j-1].getsize());
│ │ │ │ +
769
│ │ │ │ +
770 // and the vector is ready
│ │ │ │ +
771 this->initialized = true;
│ │ │ │ +
772 }
│ │ │ │ +
773
│ │ │ │ +
774 size_type nblocks; // number of blocks in vector
│ │ │ │ +
775 window_type* block; // array of blocks pointing to the array in the base class
│ │ │ │ +
776 bool initialized; // true if vector has been initialized
│ │ │ │ +
777
│ │ │ │ +
778 A allocator_;
│ │ │ │ +
779
│ │ │ │ +
780 typename std::allocator_traits<A>::template rebind_alloc<window_type> windowAllocator_;
│ │ │ │ +
781 };
│ │ │ │ +
│ │ │ │ +
782
│ │ │ │ +
783
│ │ │ │
784
│ │ │ │ -
785 while(!ibpair.second)
│ │ │ │ -
786 ibpair = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0))*coarse->size()));
│ │ │ │ -
787 *iter=*(ibpair.first);
│ │ │ │ -
788 }
│ │ │ │ -
789 }
│ │ │ │ -
790
│ │ │ │ -
791 typename ParallelInformationHierarchy::Iterator pinfo = parallelInformation().coarsest();
│ │ │ │ -
792 --pinfo;
│ │ │ │ -
793
│ │ │ │ -
794 // Now consecutively project the numbers to the finest level.
│ │ │ │ -
795 for(typename AggregatesMapList::const_reverse_iterator aggregates=++aggregatesMaps().rbegin();
│ │ │ │ -
796 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) {
│ │ │ │ -
797
│ │ │ │ -
798 fine->resize((*aggregates)->noVertices());
│ │ │ │ -
799 fine->assign(fine->size(), 0);
│ │ │ │ - │ │ │ │ -
801 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast<std::size_t>(1), *pinfo);
│ │ │ │ -
802 --pinfo;
│ │ │ │ -
803 std::swap(coarse, fine);
│ │ │ │ -
804 }
│ │ │ │ -
805
│ │ │ │ -
806 // Assertion to check that we really projected to data on the last step.
│ │ │ │ -
807 assert(coarse==&data);
│ │ │ │ -
808 }
│ │ │ │ -
│ │ │ │ -
809
│ │ │ │ -
810 template<class M, class IS, class A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
813 {
│ │ │ │ -
814 return aggregatesMaps_;
│ │ │ │ -
815 }
│ │ │ │ -
│ │ │ │ -
816 template<class M, class IS, class A>
│ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
819 {
│ │ │ │ -
820 return redistributes_;
│ │ │ │ -
821 }
│ │ │ │ -
│ │ │ │ -
822
│ │ │ │ -
823 template<class M, class IS, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
825 {
│ │ │ │ -
826 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator;
│ │ │ │ -
827 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ │ -
828 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ │ -
829
│ │ │ │ -
830 AggregatesMapIterator amap = aggregatesMaps_.rbegin();
│ │ │ │ -
831 InfoIterator info = parallelInformation_.coarsest();
│ │ │ │ -
832 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level != finest; --level, --info, ++amap) {
│ │ │ │ -
833 (*amap)->free();
│ │ │ │ -
834 delete *amap;
│ │ │ │ -
835 }
│ │ │ │ -
836 delete *amap;
│ │ │ │ -
837 }
│ │ │ │ -
│ │ │ │ -
838
│ │ │ │ -
839 template<class M, class IS, class A>
│ │ │ │ -
840 template<class V, class BA, class TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
842 {
│ │ │ │ -
843 assert(hierarchy.levels()==1);
│ │ │ │ -
844 typedef typename ParallelMatrixHierarchy::ConstIterator Iterator;
│ │ │ │ -
845 typedef typename RedistributeInfoList::const_iterator RIter;
│ │ │ │ -
846 RIter redist = redistributes_.begin();
│ │ │ │ -
847
│ │ │ │ -
848 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ │ -
849 int level=0;
│ │ │ │ -
850 if(redist->isSetup())
│ │ │ │ -
851 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ │ -
852 Dune::dvverb<<"Level "<<level<<" has "<<matrices_.finest()->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ │ -
853
│ │ │ │ -
854 while(matrix != coarsest) {
│ │ │ │ -
855 ++matrix; ++level; ++redist;
│ │ │ │ -
856 Dune::dvverb<<"Level "<<level<<" has "<<matrix->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ │ -
857
│ │ │ │ -
858 hierarchy.addCoarser(matrix->getmat().N());
│ │ │ │ -
859 if(redist->isSetup())
│ │ │ │ -
860 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ │ -
861
│ │ │ │ -
862 }
│ │ │ │ -
863
│ │ │ │ -
864 }
│ │ │ │ -
│ │ │ │ -
865
│ │ │ │ -
866 template<class M, class IS, class A>
│ │ │ │ -
867 template<class S, class TA>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
869 const typename SmootherTraits<S>::Arguments& sargs) const
│ │ │ │ -
870 {
│ │ │ │ -
871 assert(smoothers.levels()==0);
│ │ │ │ -
872 typedef typename ParallelMatrixHierarchy::ConstIterator MatrixIterator;
│ │ │ │ -
873 typedef typename ParallelInformationHierarchy::ConstIterator PinfoIterator;
│ │ │ │ -
874 typedef typename AggregatesMapList::const_iterator AggregatesIterator;
│ │ │ │ -
875
│ │ │ │ - │ │ │ │ -
877 cargs.setArgs(sargs);
│ │ │ │ -
878 PinfoIterator pinfo = parallelInformation_.finest();
│ │ │ │ -
879 AggregatesIterator aggregates = aggregatesMaps_.begin();
│ │ │ │ -
880 int level=0;
│ │ │ │ -
881 for(MatrixIterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ │ -
882 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) {
│ │ │ │ -
883 cargs.setMatrix(matrix->getmat(), **aggregates);
│ │ │ │ -
884 cargs.setComm(*pinfo);
│ │ │ │ -
885 smoothers.addCoarser(cargs);
│ │ │ │ -
886 }
│ │ │ │ -
887 if(maxlevels()>levels()) {
│ │ │ │ -
888 // This is not the globally coarsest level and therefore smoothing is needed
│ │ │ │ -
889 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates);
│ │ │ │ -
890 cargs.setComm(*pinfo);
│ │ │ │ -
891 smoothers.addCoarser(cargs);
│ │ │ │ -
892 ++level;
│ │ │ │ -
893 }
│ │ │ │ -
894 }
│ │ │ │ -
│ │ │ │ -
895
│ │ │ │ -
896 template<class M, class IS, class A>
│ │ │ │ -
897 template<class F>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
899 {
│ │ │ │ -
900 typedef typename AggregatesMapList::iterator AggregatesMapIterator;
│ │ │ │ -
901 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ │ -
902 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ │ -
903
│ │ │ │ -
904 AggregatesMapIterator amap = aggregatesMaps_.begin();
│ │ │ │ -
905 BaseGalerkinProduct productBuilder;
│ │ │ │ -
906 InfoIterator info = parallelInformation_.finest();
│ │ │ │ -
907 typename RedistributeInfoList::iterator riIter = redistributes_.begin();
│ │ │ │ -
908 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest();
│ │ │ │ -
909 if(level.isRedistributed()) {
│ │ │ │ -
910 info->buildGlobalLookup(level->getmat().N());
│ │ │ │ -
911 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ │ -
912 const_cast<Matrix&>(level.getRedistributed().getmat()),
│ │ │ │ -
913 *info,info.getRedistributed(), *riIter);
│ │ │ │ -
914 info->freeGlobalLookup();
│ │ │ │ -
915 }
│ │ │ │ -
916
│ │ │ │ -
917 for(; level!=coarsest; ++amap) {
│ │ │ │ -
918 const Matrix& fine = (level.isRedistributed() ? level.getRedistributed() : *level).getmat();
│ │ │ │ -
919 ++level;
│ │ │ │ -
920 ++info;
│ │ │ │ -
921 ++riIter;
│ │ │ │ -
922 productBuilder.calculate(fine, *(*amap), const_cast<Matrix&>(level->getmat()), *info, copyFlags);
│ │ │ │ -
923 if(level.isRedistributed()) {
│ │ │ │ -
924 info->buildGlobalLookup(level->getmat().N());
│ │ │ │ -
925 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ │ -
926 const_cast<Matrix&>(level.getRedistributed().getmat()), *info,
│ │ │ │ -
927 info.getRedistributed(), *riIter);
│ │ │ │ -
928 info->freeGlobalLookup();
│ │ │ │ -
929 }
│ │ │ │ -
930 }
│ │ │ │ -
931 }
│ │ │ │ -
│ │ │ │ -
932
│ │ │ │ -
933 template<class M, class IS, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
935 {
│ │ │ │ -
936 return matrices_.levels();
│ │ │ │ -
937 }
│ │ │ │ -
│ │ │ │ -
938
│ │ │ │ -
939 template<class M, class IS, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
941 {
│ │ │ │ -
942 return maxlevels_;
│ │ │ │ -
943 }
│ │ │ │ -
│ │ │ │ -
944
│ │ │ │ -
945 template<class M, class IS, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
947 {
│ │ │ │ -
948 return levels()==maxlevels() &&
│ │ │ │ -
949 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N()>0);
│ │ │ │ -
950 }
│ │ │ │ -
│ │ │ │ -
951
│ │ │ │ -
952 template<class M, class IS, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
954 {
│ │ │ │ -
955 return built_;
│ │ │ │ -
956 }
│ │ │ │ -
│ │ │ │ -
957
│ │ │ │ -
959 } // namespace Amg
│ │ │ │ -
960} // namespace Dune
│ │ │ │ -
961
│ │ │ │ -
962#endif // end DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ │ -
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.
│ │ │ │ -
Some handy generic functions for ISTL matrices.
│ │ │ │ -
Provides classes for initializing the link attributes of a matrix graph.
│ │ │ │ -
Helper classes for the construction of classes without empty constructor.
│ │ │ │ -
Classes for the generic construction and application of the smoothers.
│ │ │ │ -
Prolongation and restriction for amg.
│ │ │ │ -
Provdes class for identifying aggregates globally.
│ │ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ │ - │ │ │ │ - │ │ │ │ -
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ │ -
Provides classes for building the matrix graph.
│ │ │ │ -
Provides a classes representing the hierarchies in AMG.
│ │ │ │ -
Provides a class for building the index set and remote indices on the coarse level.
│ │ │ │ -
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:812
│ │ │ │ -
bool isBuilt() const
Whether the hierarchy was built.
Definition matrixhierarchy.hh:953
│ │ │ │ -
bool hasCoarsest() const
Definition matrixhierarchy.hh:946
│ │ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition matrixhierarchy.hh:934
│ │ │ │ -
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ │ -
const RedistributeInfoList & redistributeInformation() const
Get the hierarchy of the information about redistributions,.
Definition matrixhierarchy.hh:818
│ │ │ │ -
const ParallelInformationHierarchy & parallelInformation() const
Get the hierarchy of the parallel data distribution information.
Definition matrixhierarchy.hh:737
│ │ │ │ -
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:313
│ │ │ │ -
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ │ -
const ParallelMatrixHierarchy & matrices() const
Get the matrix hierarchy.
Definition matrixhierarchy.hh:730
│ │ │ │ -
std::size_t maxlevels() const
Get the max number of levels in the hierarchy of processors.
Definition matrixhierarchy.hh:940
│ │ │ │ -
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ │ -
void recalculateGalerkin(const F &copyFlags)
Recalculate the galerkin products.
Definition matrixhierarchy.hh:898
│ │ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ -
std::size_t noVertices() const
Get the number of vertices.
│ │ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ -
void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const
Coarsen the vector hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:841
│ │ │ │ -
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ │ -
MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< ParallelInformation > pinfo=std::make_shared< ParallelInformation >())
Constructor.
Definition matrixhierarchy.hh:389
│ │ │ │ -
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:232
│ │ │ │ -
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ │ -
void build(const T &criterion)
Build the matrix hierarchy using aggregation.
Definition matrixhierarchy.hh:400
│ │ │ │ -
void free()
Free the allocated memory.
│ │ │ │ -
void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename SmootherTraits< S >::Arguments &args) const
Coarsen the smoother hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:868
│ │ │ │ -
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
│ │ │ │ -
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
│ │ │ │ -
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ │ -
void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const
Get the mapping of fine level unknowns to coarse level aggregates.
Definition matrixhierarchy.hh:743
│ │ │ │ -
~MatrixHierarchy()
Definition matrixhierarchy.hh:824
│ │ │ │ -
@ MAX_PROCESSES
Hard limit for the number of processes allowed.
Definition matrixhierarchy.hh:50
│ │ │ │ -
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:244
│ │ │ │ -
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:248
│ │ │ │ +
787} // end namespace
│ │ │ │ +
788
│ │ │ │ +
789#endif
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ + │ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │
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:829
│ │ │ │ -
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:1235
│ │ │ │
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ │ -
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ │ -
Definition matrixredistribute.hh:22
│ │ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ -
Class representing the properties of an ede in the matrix graph.
Definition dependency.hh:39
│ │ │ │ -
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ │ -
Definition galerkin.hh:99
│ │ │ │ -
Definition galerkin.hh:118
│ │ │ │ -
Definition globalaggregates.hh:131
│ │ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ │ -
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ │ -
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:988
│ │ │ │ -
Definition graphcreator.hh:22
│ │ │ │ -
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ │ -
LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ -
LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const MatrixOperator > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ │ -
Definition indicescoarsener.hh:36
│ │ │ │ -
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │ -
typename std::allocator_traits< Allocator >::template rebind_alloc< AggregatesMap * > AAllocator
Allocator for pointers.
Definition matrixhierarchy.hh:85
│ │ │ │ -
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
The type of the parallel informarion hierarchy.
Definition matrixhierarchy.hh:82
│ │ │ │ -
std::list< AggregatesMap *, AAllocator > AggregatesMapList
The type of the aggregates maps list.
Definition matrixhierarchy.hh:88
│ │ │ │ -
PI ParallelInformation
The type of the index set.
Definition matrixhierarchy.hh:70
│ │ │ │ -
Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy
The type of the parallel matrix hierarchy.
Definition matrixhierarchy.hh:79
│ │ │ │ -
A Allocator
The allocator to use.
Definition matrixhierarchy.hh:73
│ │ │ │ -
RedistributeInformation< ParallelInformation > RedistributeInfoType
The type of the redistribute information.
Definition matrixhierarchy.hh:91
│ │ │ │ -
double getProlongationDampingFactor() const
Definition matrixhierarchy.hh:188
│ │ │ │ -
typename std::allocator_traits< Allocator >::template rebind_alloc< RedistributeInfoType > RILAllocator
Allocator for RedistributeInfoType.
Definition matrixhierarchy.hh:94
│ │ │ │ -
std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList
The type of the list of redistribute information.
Definition matrixhierarchy.hh:97
│ │ │ │ -
Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > AggregatesMap
The type of the aggregates map we use.
Definition matrixhierarchy.hh:76
│ │ │ │ -
MatrixOperator::matrix_type Matrix
The type of the matrix.
Definition matrixhierarchy.hh:67
│ │ │ │ -
M MatrixOperator
The type of the matrix operator.
Definition matrixhierarchy.hh:64
│ │ │ │ -
void operator()(const matrix_row &row)
Definition matrixhierarchy.hh:254
│ │ │ │ -
Matrix::row_type matrix_row
Definition matrixhierarchy.hh:245
│ │ │ │ -
size_type min
Definition matrixhierarchy.hh:261
│ │ │ │ - │ │ │ │ -
size_type max
Definition matrixhierarchy.hh:262
│ │ │ │ -
size_type sum
Definition matrixhierarchy.hh:263
│ │ │ │ -
Matrix::size_type size_type
Definition matrixhierarchy.hh:244
│ │ │ │ -
The criterion describing the stop criteria for the coarsening process.
Definition matrixhierarchy.hh:283
│ │ │ │ -
CoarsenCriterion(const Dune::Amg::Parameters &parms)
Definition matrixhierarchy.hh:306
│ │ │ │ -
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)
Constructor.
Definition matrixhierarchy.hh:301
│ │ │ │ -
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ -
Definition pinfo.hh:28
│ │ │ │ -
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ -
Definition transfer.hh:32
│ │ │ │ -
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │ │ +
A Vector of blocks with different blocksizes.
Definition vbvector.hh:46
│ │ │ │ +
RealIterator< value_type, window_type & > Iterator
Definition vbvector.hh:649
│ │ │ │ +
VariableBlockVector()
Definition vbvector.hh:97
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition vbvector.hh:55
│ │ │ │ +
A allocator_type
export the allocator type
Definition vbvector.hh:58
│ │ │ │ +
VariableBlockVector(size_type _nblocks, size_type m)
Definition vbvector.hh:134
│ │ │ │ +
size_type size() const
Definition vbvector.hh:735
│ │ │ │ +
size_type N() const
number of blocks in the vector (are of variable size here)
Definition vbvector.hh:726
│ │ │ │ +
VariableBlockVector(const VariableBlockVector &a)
copy constructor, has copy semantics
Definition vbvector.hh:172
│ │ │ │ +
VariableBlockVector(size_type _nblocks)
Definition vbvector.hh:108
│ │ │ │ +
~VariableBlockVector()
free dynamic memory
Definition vbvector.hh:215
│ │ │ │ +
window_type & operator[](size_type i)
random access to blocks
Definition vbvector.hh:563
│ │ │ │ +
CreateIterator createend()
get create iterator pointing to one after the last block
Definition vbvector.hh:552
│ │ │ │ +
Iterator beforeBegin() const
Definition vbvector.hh:672
│ │ │ │ +
CreateIterator createbegin()
get initial create iterator
Definition vbvector.hh:543
│ │ │ │ +
VariableBlockVector & operator=(const VariableBlockVector &a)
assignment
Definition vbvector.hh:322
│ │ │ │ +
static constexpr auto blocklevel
Definition vbvector.hh:90
│ │ │ │ +
ConstIterator rend() const
end ConstIterator
Definition vbvector.hh:706
│ │ │ │ +
A::size_type size_type
The size type for the index access.
Definition vbvector.hh:73
│ │ │ │ +
ConstIterator find(size_type i) const
random access returning iterator (end if not contained)
Definition vbvector.hh:718
│ │ │ │ +
ConstIterator beforeEnd() const
Definition vbvector.hh:700
│ │ │ │ +
Iterator find(size_type i)
random access returning iterator (end if not contained)
Definition vbvector.hh:712
│ │ │ │ +
const window_type & const_reference
Export type used for const references to container entries.
Definition vbvector.hh:70
│ │ │ │ +
RealIterator< const value_type, const window_type & > ConstIterator
Const iterator.
Definition vbvector.hh:681
│ │ │ │ +
Iterator end()
end Iterator
Definition vbvector.hh:658
│ │ │ │ +
ConstIterator begin() const
begin ConstIterator
Definition vbvector.hh:687
│ │ │ │ +
BlockVector< B, A > value_type
Type of the elements of the outer vector, i.e., dynamic vectors of B.
Definition vbvector.hh:80
│ │ │ │ +
ConstIterator end() const
end ConstIterator
Definition vbvector.hh:693
│ │ │ │ +
BlockVector< B, A > block_type
Same as value_type, here for historical reasons.
Definition vbvector.hh:84
│ │ │ │ +
void resize(size_type _nblocks, size_type m)
same effect as constructor with same argument
Definition vbvector.hh:270
│ │ │ │ +
window_type & reference
Export type used for references to container entries.
Definition vbvector.hh:64
│ │ │ │ +
void resize(size_type _nblocks)
same effect as constructor with same argument
Definition vbvector.hh:234
│ │ │ │ +
Iterator beforeEnd()
Definition vbvector.hh:665
│ │ │ │ +
Iterator begin()
begin Iterator
Definition vbvector.hh:652
│ │ │ │ +
Iterator class for sequential creation of blocks.
Definition vbvector.hh:443
│ │ │ │ +
bool operator==(const CreateIterator &it) const
equality
Definition vbvector.hh:505
│ │ │ │ +
size_type index() const
dereferencing
Definition vbvector.hh:511
│ │ │ │ +
SizeProxy reference
reference type
Definition vbvector.hh:463
│ │ │ │ +
size_type * pointer
pointer type
Definition vbvector.hh:460
│ │ │ │ +
bool operator!=(const CreateIterator &it) const
inequality
Definition vbvector.hh:499
│ │ │ │ +
~CreateIterator()
Definition vbvector.hh:471
│ │ │ │ +
size_type value_type
value type
Definition vbvector.hh:449
│ │ │ │ +
CreateIterator(VariableBlockVector &_v, int _i, bool _isEnd)
constructor
Definition vbvector.hh:466
│ │ │ │ +
void setblocksize(size_type _k)
set size of current block
Definition vbvector.hh:517
│ │ │ │ +
size_type & operator*()
Access size of current block.
Definition vbvector.hh:528
│ │ │ │ +
std::output_iterator_tag iterator_category
iterator category
Definition vbvector.hh:446
│ │ │ │ +
CreateIterator & operator++()
prefix increment
Definition vbvector.hh:482
│ │ │ │ +
void difference_type
difference type (unused)
Definition vbvector.hh:457
│ │ │ │ +
Iterator class for sequential access.
Definition vbvector.hh:584
│ │ │ │ +
RealIterator(window_type *_p, size_type _i)
constructor
Definition vbvector.hh:594
│ │ │ │ +
bool equals(const RealIterator &it) const
equality
Definition vbvector.hh:611
│ │ │ │ +
size_type index() const
Return the index of the entry this iterator is pointing to.
Definition vbvector.hh:639
│ │ │ │ +
window_type & elementAt(std::ptrdiff_t offset) const
Definition vbvector.hh:633
│ │ │ │ +
void decrement()
prefix decrement
Definition vbvector.hh:605
│ │ │ │ +
void advance(std::ptrdiff_t d)
Definition vbvector.hh:622
│ │ │ │ +
void increment()
prefix increment
Definition vbvector.hh:599
│ │ │ │ +
RealIterator()
constructor, no arguments
Definition vbvector.hh:587
│ │ │ │ +
std::ptrdiff_t distanceTo(const RealIterator &o) const
Definition vbvector.hh:627
│ │ │ │ +
window_type & dereference() const
dereferencing
Definition vbvector.hh:617
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1288 +1,930 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _p_a_a_m_g │ │ │ │ │ -matrixhierarchy.hh │ │ │ │ │ +vbvector.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 (C) 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_ISTL_VBVECTOR_HH │ │ │ │ │ +6#define DUNE_ISTL_VBVECTOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ │ -11#include "_g_r_a_p_h_._h_h" │ │ │ │ │ -12#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ │ -13#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ │ -14#include "_g_r_a_p_h_c_r_e_a_t_o_r_._h_h" │ │ │ │ │ -15#include "_h_i_e_r_a_r_c_h_y_._h_h" │ │ │ │ │ -16#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ -17#include │ │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> │ │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_d_e_p_e_n_d_e_n_c_y_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ │ -22#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h> │ │ │ │ │ -23#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ │ -25#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ │ -26#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ │ -27 │ │ │ │ │ -28namespace _D_u_n_e │ │ │ │ │ -29{ │ │ │ │ │ -30 namespace Amg │ │ │ │ │ -31 { │ │ │ │ │ -42 enum { │ │ │ │ │ -50 _M_A_X___P_R_O_C_E_S_S_E_S = 72000 │ │ │ │ │ -_5_1 }; │ │ │ │ │ -52 │ │ │ │ │ -59 template > │ │ │ │ │ -_6_0 class _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ -61 { │ │ │ │ │ -62 public: │ │ │ │ │ -_6_4 typedef M _M_a_t_r_i_x_O_p_e_r_a_t_o_r; │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13 │ │ │ │ │ +14#include │ │ │ │ │ +15#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +16#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ +17 │ │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +19 │ │ │ │ │ +24namespace _D_u_n_e { │ │ │ │ │ +25 │ │ │ │ │ +41 template > │ │ │ │ │ +_4_2 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 │ │ │ │ │ +43 // this derivation gives us all the blas level 1 and norms │ │ │ │ │ +44 // on the large array. However, access operators have to be │ │ │ │ │ +45 // overwritten. │ │ │ │ │ +46 { │ │ │ │ │ +47 // just a shorthand │ │ │ │ │ +48 typedef Imp::BlockVectorWindow window_type; │ │ │ │ │ +49 │ │ │ │ │ +50 public: │ │ │ │ │ +51 │ │ │ │ │ +52 //===== type definitions and constants │ │ │ │ │ +53 │ │ │ │ │ +_5_5 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ +56 │ │ │ │ │ +_5_8 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +59 │ │ │ │ │ +_6_4 typedef window_type& _r_e_f_e_r_e_n_c_e; │ │ │ │ │ 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; │ │ │ │ │ +_7_0 typedef const window_type& _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ 71 │ │ │ │ │ -_7_3 typedef A _A_l_l_o_c_a_t_o_r; │ │ │ │ │ +_7_3 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ 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; │ │ │ │ │ -95 │ │ │ │ │ -_9_7 typedef std::list _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t; │ │ │ │ │ -98 │ │ │ │ │ -104 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(std::shared_ptr fineMatrix, │ │ │ │ │ -105 std::shared_ptr pinfo = std:: │ │ │ │ │ -make_shared()); │ │ │ │ │ -106 │ │ │ │ │ -107 _~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(); │ │ │ │ │ -108 │ │ │ │ │ -114 template │ │ │ │ │ -115 void _b_u_i_l_d(const T& criterion); │ │ │ │ │ -116 │ │ │ │ │ -124 template │ │ │ │ │ -125 void _r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n(const F& copyFlags); │ │ │ │ │ -126 │ │ │ │ │ -131 template │ │ │ │ │ -132 void _c_o_a_r_s_e_n_V_e_c_t_o_r(_H_i_e_r_a_r_c_h_y<_B_l_o_c_k_V_e_c_t_o_r_<_V_,_B_A_>, TA>& hierarchy) const; │ │ │ │ │ -133 │ │ │ │ │ -139 template │ │ │ │ │ -140 void _c_o_a_r_s_e_n_S_m_o_o_t_h_e_r(_H_i_e_r_a_r_c_h_y_<_S_,_T_A_>& smoothers, │ │ │ │ │ -141 const typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s& args) const; │ │ │ │ │ -142 │ │ │ │ │ -147 std::size_t _l_e_v_e_l_s() const; │ │ │ │ │ +_8_0 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +81 │ │ │ │ │ +_8_4 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +85 │ │ │ │ │ +89 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]] │ │ │ │ │ +_9_0 static constexpr auto _b_l_o_c_k_l_e_v_e_l = blockLevel()+2; │ │ │ │ │ +91 │ │ │ │ │ +92 //===== constructors and such │ │ │ │ │ +93 │ │ │ │ │ +_9_7 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r () : Imp::block_vector_unmanaged() │ │ │ │ │ +98 { │ │ │ │ │ +99 // nothing is known ... │ │ │ │ │ +100 nblocks = 0; │ │ │ │ │ +101 block = nullptr; │ │ │ │ │ +102 initialized = false; │ │ │ │ │ +103 } │ │ │ │ │ +104 │ │ │ │ │ +_1_0_8 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 _nblocks) : Imp:: │ │ │ │ │ +block_vector_unmanaged() │ │ │ │ │ +109 { │ │ │ │ │ +110 // we can allocate the windows now │ │ │ │ │ +111 nblocks = _nblocks; │ │ │ │ │ +112 if (nblocks>0) │ │ │ │ │ +113 { │ │ │ │ │ +114 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ +115 new (block) window_type[nblocks]; │ │ │ │ │ +116 } │ │ │ │ │ +117 else │ │ │ │ │ +118 { │ │ │ │ │ +119 nblocks = 0; │ │ │ │ │ +120 block = nullptr; │ │ │ │ │ +121 } │ │ │ │ │ +122 │ │ │ │ │ +123 // Note: memory in base class still not allocated │ │ │ │ │ +124 // the vector not usable │ │ │ │ │ +125 initialized = false; │ │ │ │ │ +126 } │ │ │ │ │ +127 │ │ │ │ │ +_1_3_4 _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 _nblocks, _s_i_z_e___t_y_p_e m) : Imp:: │ │ │ │ │ +block_vector_unmanaged() │ │ │ │ │ +135 { │ │ │ │ │ +136 // and we can allocate the big array in the base class │ │ │ │ │ +137 this->n = _nblocks*m; │ │ │ │ │ +138 if (this->n>0) │ │ │ │ │ +139 { │ │ │ │ │ +140 this->p = allocator_.allocate(this->n); │ │ │ │ │ +141 new (this->p)B[this->n]; │ │ │ │ │ +142 } │ │ │ │ │ +143 else │ │ │ │ │ +144 { │ │ │ │ │ +145 this->n = 0; │ │ │ │ │ +146 this->p = nullptr; │ │ │ │ │ +147 } │ │ │ │ │ 148 │ │ │ │ │ -153 std::size_t _m_a_x_l_e_v_e_l_s() const; │ │ │ │ │ -154 │ │ │ │ │ -155 bool _h_a_s_C_o_a_r_s_e_s_t() const; │ │ │ │ │ +149 // we can allocate the windows now │ │ │ │ │ +150 nblocks = _nblocks; │ │ │ │ │ +151 if (nblocks>0) │ │ │ │ │ +152 { │ │ │ │ │ +153 // allocate and construct the windows │ │ │ │ │ +154 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ +155 new (block) window_type[nblocks]; │ │ │ │ │ 156 │ │ │ │ │ -161 bool _i_s_B_u_i_l_t() const; │ │ │ │ │ -162 │ │ │ │ │ -167 const _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y& _m_a_t_r_i_c_e_s() const; │ │ │ │ │ -168 │ │ │ │ │ -173 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y& _p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ │ -174 │ │ │ │ │ -179 const _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t& _a_g_g_r_e_g_a_t_e_s_M_a_p_s() const; │ │ │ │ │ -180 │ │ │ │ │ -186 const _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t& _r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ │ -187 │ │ │ │ │ -_1_8_8 double _g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r() const │ │ │ │ │ -189 { │ │ │ │ │ -190 return prolongDamp_; │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -203 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t(std::vector& data) const; │ │ │ │ │ -204 │ │ │ │ │ -205 private: │ │ │ │ │ -206 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_a_t_r_i_x_O_p_e_r_a_t_o_r_>_:_:_A_r_g_u_m_e_n_t_s MatrixArgs; │ │ │ │ │ -207 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ -CommunicationArgs; │ │ │ │ │ -209 _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t aggregatesMaps_; │ │ │ │ │ -211 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t redistributes_; │ │ │ │ │ -213 _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y matrices_; │ │ │ │ │ -215 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y parallelInformation_; │ │ │ │ │ -216 │ │ │ │ │ -218 bool built_; │ │ │ │ │ -219 │ │ │ │ │ -221 int maxlevels_; │ │ │ │ │ -222 │ │ │ │ │ -223 double prolongDamp_; │ │ │ │ │ -224 │ │ │ │ │ -228 template │ │ │ │ │ -229 struct MatrixStats │ │ │ │ │ -230 { │ │ │ │ │ +157 // set the windows into the big array │ │ │ │ │ +158 for (_s_i_z_e___t_y_p_e i=0; ip+(i*m)); │ │ │ │ │ +160 } │ │ │ │ │ +161 else │ │ │ │ │ +162 { │ │ │ │ │ +163 nblocks = 0; │ │ │ │ │ +164 block = nullptr; │ │ │ │ │ +165 } │ │ │ │ │ +166 │ │ │ │ │ +167 // and the vector is usable │ │ │ │ │ +168 initialized = true; │ │ │ │ │ +169 } │ │ │ │ │ +170 │ │ │ │ │ +_1_7_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) │ │ │ │ │ +173 { │ │ │ │ │ +174 // allocate the big array in the base class │ │ │ │ │ +175 this->n = a.n; │ │ │ │ │ +176 if (this->n>0) │ │ │ │ │ +177 { │ │ │ │ │ +178 // allocate and construct objects │ │ │ │ │ +179 this->p = allocator_.allocate(this->n); │ │ │ │ │ +180 new (this->p)B[this->n]; │ │ │ │ │ +181 │ │ │ │ │ +182 // copy data │ │ │ │ │ +183 for (_s_i_z_e___t_y_p_e i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ │ +184 } │ │ │ │ │ +185 else │ │ │ │ │ +186 { │ │ │ │ │ +187 this->n = 0; │ │ │ │ │ +188 this->p = nullptr; │ │ │ │ │ +189 } │ │ │ │ │ +190 │ │ │ │ │ +191 // we can allocate the windows now │ │ │ │ │ +192 nblocks = a.nblocks; │ │ │ │ │ +193 if (nblocks>0) │ │ │ │ │ +194 { │ │ │ │ │ +195 // alloc │ │ │ │ │ +196 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ +197 new (block) window_type[nblocks]; │ │ │ │ │ +198 │ │ │ │ │ +199 // and we must set the windows │ │ │ │ │ +200 block[0].set(a.block[0].getsize(),this->p); // first block │ │ │ │ │ +201 for (_s_i_z_e___t_y_p_e i=1; in>0) { │ │ │ │ │ +218 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ +219 while (i) │ │ │ │ │ +220 this->p[--i].~B(); │ │ │ │ │ +221 allocator_.deallocate(this->p,this->n); │ │ │ │ │ +222 } │ │ │ │ │ +223 if (nblocks>0) { │ │ │ │ │ +224 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ +225 while (i) │ │ │ │ │ +226 block[--i].~window_type(); │ │ │ │ │ +227 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ +228 } │ │ │ │ │ +229 │ │ │ │ │ +230 } │ │ │ │ │ 231 │ │ │ │ │ -235 static void stats([[maybe_unused]] const _M_a_t_r_i_x& matrix) │ │ │ │ │ -236 {} │ │ │ │ │ -237 }; │ │ │ │ │ -238 │ │ │ │ │ -239 template │ │ │ │ │ -240 struct MatrixStats<_M_a_t_r_i_x,true> │ │ │ │ │ -241 { │ │ │ │ │ -_2_4_2 struct calc │ │ │ │ │ -243 { │ │ │ │ │ -_2_4_4 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ -_2_4_5 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _m_a_t_r_i_x___r_o_w; │ │ │ │ │ -246 │ │ │ │ │ -_2_4_7 _c_a_l_c() │ │ │ │ │ -248 { │ │ │ │ │ -249 min=std::numeric_limits::max(); │ │ │ │ │ -250 max=0; │ │ │ │ │ -251 sum=0; │ │ │ │ │ -252 } │ │ │ │ │ -253 │ │ │ │ │ -_2_5_4 void _o_p_e_r_a_t_o_r_(_)(const _m_a_t_r_i_x___r_o_w& row) │ │ │ │ │ +232 │ │ │ │ │ +_2_3_4 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e _nblocks) │ │ │ │ │ +235 { │ │ │ │ │ +236 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ +237 if (this->n>0) { │ │ │ │ │ +238 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ +239 while (i) │ │ │ │ │ +240 this->p[--i].~B(); │ │ │ │ │ +241 allocator_.deallocate(this->p,this->n); │ │ │ │ │ +242 } │ │ │ │ │ +243 if (nblocks>0) { │ │ │ │ │ +244 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ +245 while (i) │ │ │ │ │ +246 block[--i].~window_type(); │ │ │ │ │ +247 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ +248 } │ │ │ │ │ +249 this->n = 0; │ │ │ │ │ +250 this->p = nullptr; │ │ │ │ │ +251 │ │ │ │ │ +252 // we can allocate the windows now │ │ │ │ │ +253 nblocks = _nblocks; │ │ │ │ │ +254 if (nblocks>0) │ │ │ │ │ 255 { │ │ │ │ │ -256 min=std::min(min, row.size()); │ │ │ │ │ -257 max=std::max(max, row.size()); │ │ │ │ │ -258 sum += row.size(); │ │ │ │ │ -259 } │ │ │ │ │ -260 │ │ │ │ │ -_2_6_1 _s_i_z_e___t_y_p_e _m_i_n; │ │ │ │ │ -_2_6_2 _s_i_z_e___t_y_p_e _m_a_x; │ │ │ │ │ -_2_6_3 _s_i_z_e___t_y_p_e _s_u_m; │ │ │ │ │ -264 }; │ │ │ │ │ -268 static void stats(const _M_a_t_r_i_x& matrix) │ │ │ │ │ -269 { │ │ │ │ │ -270 calc c= for_each(matrix.begin(), matrix.end(), calc()); │ │ │ │ │ -271 dinfo<<"Matrix row: min="< │ │ │ │ │ -_3_2_6 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, │ │ │ │ │ -327 std::shared_ptr newMatrix, │ │ │ │ │ -328 C& origComm, │ │ │ │ │ -329 std::shared_ptr& newComm, │ │ │ │ │ -330 _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, │ │ │ │ │ -331 int nparts, C1& criterion) │ │ │ │ │ -332 { │ │ │ │ │ -333 Timer time; │ │ │ │ │ -334#ifdef AMG_REPART_ON_COMM_GRAPH │ │ │ │ │ -335 // Done not repartition the matrix graph, but a graph of the communication │ │ │ │ │ -scheme. │ │ │ │ │ -336 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, │ │ │ │ │ -337 ri.getInterface(), │ │ │ │ │ -338 criterion.debugLevel()>1); │ │ │ │ │ -339 │ │ │ │ │ -340#else │ │ │ │ │ -341 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; │ │ │ │ │ -342 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, │ │ │ │ │ -343 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ │ -344 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ │ -345 IdentityMap, │ │ │ │ │ -346 IdentityMap> _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ │ -347 _M_a_t_r_i_x_G_r_a_p_h graph(origMatrix); │ │ │ │ │ -348 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h pgraph(graph); │ │ │ │ │ -349 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(pgraph, origMatrix, criterion, false); │ │ │ │ │ -350 │ │ │ │ │ -351#ifdef DEBUG_REPART │ │ │ │ │ -352 if(origComm.communicator().rank()==0) │ │ │ │ │ -353 std::cout<<"Original matrix"<1); │ │ │ │ │ -360#endif // if else AMG_REPART │ │ │ │ │ -361 │ │ │ │ │ -362 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ │ -363 std::cout<<"Repartitioning took "<indexSet(), │ │ │ │ │ -origComm.communicator()); │ │ │ │ │ -369#endif │ │ │ │ │ -370 │ │ │ │ │ -371 _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); │ │ │ │ │ +256 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ +257 new (block) window_type[nblocks]; │ │ │ │ │ +258 } │ │ │ │ │ +259 else │ │ │ │ │ +260 { │ │ │ │ │ +261 nblocks = 0; │ │ │ │ │ +262 block = nullptr; │ │ │ │ │ +263 } │ │ │ │ │ +264 │ │ │ │ │ +265 // and the vector not fully usable │ │ │ │ │ +266 initialized = false; │ │ │ │ │ +267 } │ │ │ │ │ +268 │ │ │ │ │ +_2_7_0 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e _nblocks, _s_i_z_e___t_y_p_e m) │ │ │ │ │ +271 { │ │ │ │ │ +272 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ +273 if (this->n>0) { │ │ │ │ │ +274 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ +275 while (i) │ │ │ │ │ +276 this->p[--i].~B(); │ │ │ │ │ +277 allocator_.deallocate(this->p,this->n); │ │ │ │ │ +278 } │ │ │ │ │ +279 if (nblocks>0) { │ │ │ │ │ +280 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ +281 while (i) │ │ │ │ │ +282 block[--i].~window_type(); │ │ │ │ │ +283 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ +284 } │ │ │ │ │ +285 │ │ │ │ │ +286 // and we can allocate the big array in the base class │ │ │ │ │ +287 this->n = _nblocks*m; │ │ │ │ │ +288 if (this->n>0) │ │ │ │ │ +289 { │ │ │ │ │ +290 this->p = allocator_.allocate(this->n); │ │ │ │ │ +291 new (this->p)B[this->n]; │ │ │ │ │ +292 } │ │ │ │ │ +293 else │ │ │ │ │ +294 { │ │ │ │ │ +295 this->n = 0; │ │ │ │ │ +296 this->p = nullptr; │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +299 // we can allocate the windows now │ │ │ │ │ +300 nblocks = _nblocks; │ │ │ │ │ +301 if (nblocks>0) │ │ │ │ │ +302 { │ │ │ │ │ +303 // allocate and construct objects │ │ │ │ │ +304 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ +305 new (block) window_type[nblocks]; │ │ │ │ │ +306 │ │ │ │ │ +307 // set the windows into the big array │ │ │ │ │ +308 for (_s_i_z_e___t_y_p_e i=0; ip+(i*m)); │ │ │ │ │ +310 } │ │ │ │ │ +311 else │ │ │ │ │ +312 { │ │ │ │ │ +313 nblocks = 0; │ │ │ │ │ +314 block = nullptr; │ │ │ │ │ +315 } │ │ │ │ │ +316 │ │ │ │ │ +317 // and the vector is usable │ │ │ │ │ +318 initialized = true; │ │ │ │ │ +319 } │ │ │ │ │ +320 │ │ │ │ │ +_3_2_2 _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 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& a) │ │ │ │ │ +323 { │ │ │ │ │ +324 if (&a!=this) // check if this and a are different objects │ │ │ │ │ +325 { │ │ │ │ │ +326 // reallocate arrays if necessary │ │ │ │ │ +327 // Note: still the block sizes may vary ! │ │ │ │ │ +328 if (this->n!=a.n || nblocks!=a.nblocks) │ │ │ │ │ +329 { │ │ │ │ │ +330 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ +331 if (this->n>0) { │ │ │ │ │ +332 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ +333 while (i) │ │ │ │ │ +334 this->p[--i].~B(); │ │ │ │ │ +335 allocator_.deallocate(this->p,this->n); │ │ │ │ │ +336 } │ │ │ │ │ +337 if (nblocks>0) { │ │ │ │ │ +338 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ +339 while (i) │ │ │ │ │ +340 block[--i].~window_type(); │ │ │ │ │ +341 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ +342 } │ │ │ │ │ +343 │ │ │ │ │ +344 // allocate the big array in the base class │ │ │ │ │ +345 this->n = a.n; │ │ │ │ │ +346 if (this->n>0) │ │ │ │ │ +347 { │ │ │ │ │ +348 // allocate and construct objects │ │ │ │ │ +349 this->p = allocator_.allocate(this->n); │ │ │ │ │ +350 new (this->p)B[this->n]; │ │ │ │ │ +351 } │ │ │ │ │ +352 else │ │ │ │ │ +353 { │ │ │ │ │ +354 this->n = 0; │ │ │ │ │ +355 this->p = nullptr; │ │ │ │ │ +356 } │ │ │ │ │ +357 │ │ │ │ │ +358 // we can allocate the windows now │ │ │ │ │ +359 nblocks = a.nblocks; │ │ │ │ │ +360 if (nblocks>0) │ │ │ │ │ +361 { │ │ │ │ │ +362 // alloc │ │ │ │ │ +363 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ +364 new (block) window_type[nblocks]; │ │ │ │ │ +365 } │ │ │ │ │ +366 else │ │ │ │ │ +367 { │ │ │ │ │ +368 nblocks = 0; │ │ │ │ │ +369 block = nullptr; │ │ │ │ │ +370 } │ │ │ │ │ +371 } │ │ │ │ │ 372 │ │ │ │ │ -373#ifdef DEBUG_REPART │ │ │ │ │ -374 if(origComm.communicator().rank()==0) │ │ │ │ │ -375 std::cout<<"Original matrix"<communicator().size()>0) │ │ │ │ │ -378 _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); │ │ │ │ │ -379 origComm.communicator().barrier(); │ │ │ │ │ -380#endif │ │ │ │ │ +373 // copy block structure, might be different although │ │ │ │ │ +374 // sizes are the same ! │ │ │ │ │ +375 if (nblocks>0) │ │ │ │ │ +376 { │ │ │ │ │ +377 block[0].set(a.block[0].getsize(),this->p); // first block │ │ │ │ │ +378 for (_s_i_z_e___t_y_p_e i=1; i1) │ │ │ │ │ -383 std::cout<<"Redistributing matrix took "<n; i++) this->p[i]=a.p[i]; │ │ │ │ │ +384 } │ │ │ │ │ 385 │ │ │ │ │ -386 } │ │ │ │ │ -387 │ │ │ │ │ -388 template │ │ │ │ │ -_3_8_9 _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, │ │ │ │ │ -390 std::shared_ptr pinfo) │ │ │ │ │ -391 : matrices_(fineMatrix), │ │ │ │ │ -392 parallelInformation_(pinfo) │ │ │ │ │ -393 { │ │ │ │ │ -394 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)) │ │ │ │ │ -395 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "MatrixOperator and ParallelInformation must belong │ │ │ │ │ -to the same category!"); │ │ │ │ │ -396 } │ │ │ │ │ -397 │ │ │ │ │ -398 template │ │ │ │ │ -399 template │ │ │ │ │ -_4_0_0 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) │ │ │ │ │ -401 { │ │ │ │ │ -402 prolongDamp_ = criterion.getProlongationDampingFactor(); │ │ │ │ │ -403 typedef O OverlapFlags; │ │ │ │ │ -404 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; │ │ │ │ │ -405 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; │ │ │ │ │ +386 // and we have a usable vector │ │ │ │ │ +387 initialized = true; │ │ │ │ │ +388 │ │ │ │ │ +389 return *this; // Gebe Referenz zurueck damit a=b=c; klappt │ │ │ │ │ +390 } │ │ │ │ │ +391 │ │ │ │ │ +392 │ │ │ │ │ +393 //===== assignment from scalar │ │ │ │ │ +394 │ │ │ │ │ +_3_9_6 _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) │ │ │ │ │ +397 { │ │ │ │ │ +398 (static_cast&>(*this)) = k; │ │ │ │ │ +399 return *this; │ │ │ │ │ +400 } │ │ │ │ │ +401 │ │ │ │ │ +402 │ │ │ │ │ +403 //===== the creation interface │ │ │ │ │ +404 │ │ │ │ │ +405 class CreateIterator; │ │ │ │ │ 406 │ │ │ │ │ -407 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; │ │ │ │ │ +407#ifndef DOXYGEN │ │ │ │ │ 408 │ │ │ │ │ -409 typedef bigunsignedint BIGINT; │ │ │ │ │ -410 _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; │ │ │ │ │ -411 MatIterator mlevel = matrices_.finest(); │ │ │ │ │ -412 MatrixStats::stats(mlevel->getmat()); │ │ │ │ │ -413 │ │ │ │ │ -414 PInfoIterator infoLevel = parallelInformation_.finest(); │ │ │ │ │ -415 BIGINT finenonzeros=_c_o_u_n_t_N_o_n_Z_e_r_o_s(mlevel->getmat()); │ │ │ │ │ -416 finenonzeros = infoLevel->communicator().sum(finenonzeros); │ │ │ │ │ -417 BIGINT allnonzeros = finenonzeros; │ │ │ │ │ -418 │ │ │ │ │ -419 │ │ │ │ │ -420 int level = 0; │ │ │ │ │ -421 int rank = 0; │ │ │ │ │ -422 │ │ │ │ │ -423 BIGINT unknowns = mlevel->getmat().N(); │ │ │ │ │ -424 │ │ │ │ │ -425 unknowns = infoLevel->communicator().sum(unknowns); │ │ │ │ │ -426 double dunknowns=unknowns.todouble(); │ │ │ │ │ -427 infoLevel->buildGlobalLookup(mlevel->getmat().N()); │ │ │ │ │ -428 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ │ +409 // The window_type does not hand out a reference to its size, │ │ │ │ │ +410 // so in order to provide a valid iterator, we need a workaround │ │ │ │ │ +411 // to make assignment possible. This proxy enables just that by │ │ │ │ │ +412 // implicitly converting to the stored size for read access and │ │ │ │ │ +413 // tunneling assignment to the accessor method of the window. │ │ │ │ │ +414 struct SizeProxy │ │ │ │ │ +415 { │ │ │ │ │ +416 │ │ │ │ │ +417 operator size_type() const │ │ │ │ │ +418 { │ │ │ │ │ +419 return target->getsize(); │ │ │ │ │ +420 } │ │ │ │ │ +421 │ │ │ │ │ +422 SizeProxy& operator=(size_type size) │ │ │ │ │ +423 { │ │ │ │ │ +424 target->setsize(size); │ │ │ │ │ +425 return *this; │ │ │ │ │ +426 } │ │ │ │ │ +427 │ │ │ │ │ +428 private: │ │ │ │ │ 429 │ │ │ │ │ -430 for(; level < criterion.maxLevel(); ++level, ++mlevel) { │ │ │ │ │ -431 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ │ -432 rank = infoLevel->communicator().rank(); │ │ │ │ │ -433 if(rank==0 && criterion.debugLevel()>1) │ │ │ │ │ -434 std::cout<<"Level "<communicator().size() │ │ │ │ │ -435 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ -()<<")"<communicator().size())) │ │ │ │ │ -448 && infoLevel->communicator().size()>1 && │ │ │ │ │ -449 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget()) │ │ │ │ │ -450 { │ │ │ │ │ -451 // accumulate to fewer processors │ │ │ │ │ -452 std::shared_ptr redistMat = std::make_shared(); │ │ │ │ │ -453 std::shared_ptr redistComm; │ │ │ │ │ -454 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/ │ │ │ │ │ -(criterion.minAggregateSize() │ │ │ │ │ -455 *criterion.coarsenTarget())); │ │ │ │ │ -456 if( nodomains<=criterion.minAggregateSize()/2 || │ │ │ │ │ -457 dunknowns <= criterion.coarsenTarget() ) │ │ │ │ │ -458 nodomains=1; │ │ │ │ │ -459 │ │ │ │ │ -460 bool existentOnNextLevel = │ │ │ │ │ -461 _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, │ │ │ │ │ -462 redistComm, redistributes_.back(), nodomains, │ │ │ │ │ -463 criterion); │ │ │ │ │ -464 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ │ -465 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ │ -466 dunknowns= unknownsRedist.todouble(); │ │ │ │ │ -467 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ │ -468 std::cout<<"Level "<communicator().size() │ │ │ │ │ -469 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ -()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -(args)); │ │ │ │ │ -472 assert(mlevel.isRedistributed()); │ │ │ │ │ -473 infoLevel.addRedistributed(redistComm); │ │ │ │ │ -474 infoLevel->freeGlobalLookup(); │ │ │ │ │ -475 │ │ │ │ │ -476 if(!existentOnNextLevel) │ │ │ │ │ -477 // We do not hold any data on the redistributed partitioning │ │ │ │ │ -478 break; │ │ │ │ │ -479 │ │ │ │ │ -480 // Work on the redistributed Matrix from now on │ │ │ │ │ -481 matrix = &(mlevel.getRedistributed()); │ │ │ │ │ -482 info = &(infoLevel.getRedistributed()); │ │ │ │ │ -483 info->buildGlobalLookup(matrix->getmat().N()); │ │ │ │ │ -484 } │ │ │ │ │ -485 │ │ │ │ │ -486 rank = info->communicator().rank(); │ │ │ │ │ -487 if(dunknowns <= criterion.coarsenTarget()) │ │ │ │ │ -488 // No further coarsening needed │ │ │ │ │ -489 break; │ │ │ │ │ -490 │ │ │ │ │ -491 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; │ │ │ │ │ -492 typedef typename GraphCreator::PropertiesGraph _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ │ -493 typedef typename GraphCreator::GraphTuple GraphTuple; │ │ │ │ │ -494 │ │ │ │ │ -495 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; │ │ │ │ │ -496 │ │ │ │ │ -497 std::vector excluded(matrix->getmat().N(), false); │ │ │ │ │ -498 │ │ │ │ │ -499 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, │ │ │ │ │ -OverlapFlags()); │ │ │ │ │ -500 │ │ │ │ │ -501 _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); │ │ │ │ │ -502 │ │ │ │ │ -503 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ │ -504 │ │ │ │ │ -505 Timer watch; │ │ │ │ │ -506 watch.reset(); │ │ │ │ │ -507 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] = │ │ │ │ │ -508 aggregatesMap->_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(matrix->getmat(), *(std::get<1>(graphs)), │ │ │ │ │ -criterion, level==0); │ │ │ │ │ +430 friend class CreateIterator; │ │ │ │ │ +431 │ │ │ │ │ +432 SizeProxy(window_type& t) │ │ │ │ │ +433 : target(&t) │ │ │ │ │ +434 {} │ │ │ │ │ +435 │ │ │ │ │ +436 window_type* target; │ │ │ │ │ +437 }; │ │ │ │ │ +438 │ │ │ │ │ +439#endif // DOXYGEN │ │ │ │ │ +440 │ │ │ │ │ +_4_4_2 class _C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ +443 { │ │ │ │ │ +444 public: │ │ │ │ │ +_4_4_6 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::output_iterator_tag; │ │ │ │ │ +447 │ │ │ │ │ +_4_4_9 using _v_a_l_u_e___t_y_p_e = _s_i_z_e___t_y_p_e; │ │ │ │ │ +450 │ │ │ │ │ +_4_5_7 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = void; │ │ │ │ │ +458 │ │ │ │ │ +_4_6_0 using _p_o_i_n_t_e_r = _s_i_z_e___t_y_p_e*; │ │ │ │ │ +461 │ │ │ │ │ +_4_6_3 using _r_e_f_e_r_e_n_c_e = SizeProxy; │ │ │ │ │ +464 │ │ │ │ │ +_4_6_6 _C_r_e_a_t_e_I_t_e_r_a_t_o_r (_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& _v, int _i, bool _isEnd) : │ │ │ │ │ +467 v(_v), │ │ │ │ │ +468 i(_i), │ │ │ │ │ +469 isEnd(_isEnd) {} │ │ │ │ │ +470 │ │ │ │ │ +_4_7_1 _~_C_r_e_a_t_e_I_t_e_r_a_t_o_r() { │ │ │ │ │ +472 // When the iterator gets destructed, we allocate the memory │ │ │ │ │ +473 // for the VariableBlockVector if │ │ │ │ │ +474 // 1. the current iterator was not created as enditerator │ │ │ │ │ +475 // 2. we're at the last block │ │ │ │ │ +476 // 3. the vector hasn't been initialized earlier │ │ │ │ │ +477 if (not isEnd && i==v.nblocks && not v.initialized) │ │ │ │ │ +478 v.allocate(); │ │ │ │ │ +479 } │ │ │ │ │ +480 │ │ │ │ │ +_4_8_2 _C_r_e_a_t_e_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ +483 { │ │ │ │ │ +484 // go to next block │ │ │ │ │ +485 ++i; │ │ │ │ │ +486 │ │ │ │ │ +487 return *this; │ │ │ │ │ +488 } │ │ │ │ │ +489 │ │ │ │ │ +_4_9_1 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_+_+_ (int) │ │ │ │ │ +492 { │ │ │ │ │ +493 _C_r_e_a_t_e_I_t_e_r_a_t_o_r tmp(*this); │ │ │ │ │ +494 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +495 return tmp; │ │ │ │ │ +496 } │ │ │ │ │ +497 │ │ │ │ │ +_4_9_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 │ │ │ │ │ +500 { │ │ │ │ │ +501 return (i!=it.i) || (&v!=&it.v); │ │ │ │ │ +502 } │ │ │ │ │ +503 │ │ │ │ │ +_5_0_5 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 │ │ │ │ │ +506 { │ │ │ │ │ +507 return (i==it.i) && (&v==&it.v); │ │ │ │ │ +508 } │ │ │ │ │ 509 │ │ │ │ │ -510 if(rank==0 && criterion.debugLevel()>2) │ │ │ │ │ -511 std::cout<<" Have built "<communicator().rank(); │ │ │ │ │ -519 int n = UNKNOWNS/procs; // number of unknowns per process │ │ │ │ │ -520 int bigger = UNKNOWNS%procs; // number of process with n+1 unknows │ │ │ │ │ +_5_1_1 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ +512 { │ │ │ │ │ +513 return i; │ │ │ │ │ +514 } │ │ │ │ │ +515 │ │ │ │ │ +_5_1_7 void _s_e_t_b_l_o_c_k_s_i_z_e (_s_i_z_e___t_y_p_e _k) │ │ │ │ │ +518 { │ │ │ │ │ +519 v.block[i].setsize(_k); │ │ │ │ │ +520 } │ │ │ │ │ 521 │ │ │ │ │ -522 // Compute owner region │ │ │ │ │ -523 if(rank0) │ │ │ │ │ -533 overlapStart = start - 1; │ │ │ │ │ -534 else │ │ │ │ │ -535 overlapStart = start; │ │ │ │ │ -536 │ │ │ │ │ -537 if(end_n_o_V_e_r_t_i_c_e_s()); │ │ │ │ │ -543 for(int j=0; j< UNKNOWNS; ++j) │ │ │ │ │ -544 for(int i=0; i < UNKNOWNS; ++i) │ │ │ │ │ -545 { │ │ │ │ │ -546 if(i>=overlapStart && i1 && info->communicator().rank()==0) │ │ │ │ │ -555 std::cout<<"aggregating finished."<communicator().sum(gnoAggregates); │ │ │ │ │ -559 double dgnoAggregates = gnoAggregates.todouble(); │ │ │ │ │ -560#ifdef TEST_AGGLO │ │ │ │ │ -561 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2); │ │ │ │ │ -562#endif │ │ │ │ │ -563 │ │ │ │ │ -564 if(criterion.debugLevel()>2 && rank==0) │ │ │ │ │ -565 std::cout << "Building "<0) │ │ │ │ │ -572 std::cerr << "Stopped coarsening because of rate breakdown "<_f_r_e_e(); │ │ │ │ │ -579 delete aggregatesMap; │ │ │ │ │ -580 aggregatesMaps_.pop_back(); │ │ │ │ │ -581 │ │ │ │ │ -582 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator │ │ │ │ │ -().size()>1) { │ │ │ │ │ -583 // coarse level matrix was already redistributed, but to more than 1 │ │ │ │ │ -process │ │ │ │ │ -584 // Therefore need to delete the redistribution. Further down it will │ │ │ │ │ -585 // then be redistributed to 1 process │ │ │ │ │ -586 delete &(mlevel.getRedistributed().getmat()); │ │ │ │ │ -587 mlevel.deleteRedistributed(); │ │ │ │ │ -588 delete &(infoLevel.getRedistributed()); │ │ │ │ │ -589 infoLevel.deleteRedistributed(); │ │ │ │ │ -590 redistributes_.back().resetSetup(); │ │ │ │ │ +557 │ │ │ │ │ +558 //===== access to components │ │ │ │ │ +559 // has to be overwritten from base class because it must │ │ │ │ │ +560 // return access to the windows │ │ │ │ │ +561 │ │ │ │ │ +_5_6_3 window_type& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) │ │ │ │ │ +564 { │ │ │ │ │ +565#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +566 if (i>=nblocks) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ +567#endif │ │ │ │ │ +568 return block[i]; │ │ │ │ │ +569 } │ │ │ │ │ +570 │ │ │ │ │ +_5_7_2 const window_type& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ +573 { │ │ │ │ │ +574#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +575 if (i<0 || i>=nblocks) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ +576#endif │ │ │ │ │ +577 return block[i]; │ │ │ │ │ +578 } │ │ │ │ │ +579 │ │ │ │ │ +581 template │ │ │ │ │ +_5_8_2 class _R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ +583 : public RandomAccessIteratorFacade, T, R> │ │ │ │ │ +584 { │ │ │ │ │ +585 public: │ │ │ │ │ +_5_8_7 _R_e_a_l_I_t_e_r_a_t_o_r () │ │ │ │ │ +588 { │ │ │ │ │ +589 p = nullptr; │ │ │ │ │ +590 i = 0; │ │ │ │ │ 591 } │ │ │ │ │ 592 │ │ │ │ │ -593 break; │ │ │ │ │ -594 } │ │ │ │ │ -595 unknowns = noAggregates; │ │ │ │ │ -596 dunknowns = dgnoAggregates; │ │ │ │ │ +_5_9_4 _R_e_a_l_I_t_e_r_a_t_o_r (window_type* _p, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ +595 : p(_p), i(_i) │ │ │ │ │ +596 {} │ │ │ │ │ 597 │ │ │ │ │ -598 CommunicationArgs commargs(info->communicator(),info->category()); │ │ │ │ │ -599 parallelInformation_.addCoarser(commargs); │ │ │ │ │ -600 │ │ │ │ │ -601 ++infoLevel; // parallel information on coarse level │ │ │ │ │ -602 │ │ │ │ │ -603 typename PropertyMapTypeSelector::Type │ │ │ │ │ -visitedMap = │ │ │ │ │ -604 _g_e_t(_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g(), *(std::get<1>(graphs))); │ │ │ │ │ -605 │ │ │ │ │ -606 watch.reset(); │ │ │ │ │ -607 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_> │ │ │ │ │ -608_ _:_:_c_o_a_r_s_e_n(*info, │ │ │ │ │ -609 *(std::get<1>(graphs)), │ │ │ │ │ -610 visitedMap, │ │ │ │ │ -611 *aggregatesMap, │ │ │ │ │ -612 *infoLevel, │ │ │ │ │ -613 noAggregates); │ │ │ │ │ -614 GraphCreator::free(graphs); │ │ │ │ │ +_5_9_9 void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ +600 { │ │ │ │ │ +601 ++i; │ │ │ │ │ +602 } │ │ │ │ │ +603 │ │ │ │ │ +_6_0_5 void _d_e_c_r_e_m_e_n_t() │ │ │ │ │ +606 { │ │ │ │ │ +607 --i; │ │ │ │ │ +608 } │ │ │ │ │ +609 │ │ │ │ │ +_6_1_1 bool _e_q_u_a_l_s (const _R_e_a_l_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ +612 { │ │ │ │ │ +613 return (p+i)==(it.p+it.i); │ │ │ │ │ +614 } │ │ │ │ │ 615 │ │ │ │ │ -616 if(criterion.debugLevel()>2) { │ │ │ │ │ -617 if(rank==0) │ │ │ │ │ -618 std::cout<<"Coarsening of index sets took "<buildGlobalLookup(aggregates); │ │ │ │ │ -624 _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, │ │ │ │ │ -625 *info, │ │ │ │ │ -626 infoLevel->globalLookup()); │ │ │ │ │ -627 │ │ │ │ │ -628 │ │ │ │ │ -629 if(criterion.debugLevel()>2) { │ │ │ │ │ -630 if(rank==0) │ │ │ │ │ -631 std::cout<<"Communicating global aggregate numbers took "<& visited=excluded; │ │ │ │ │ -636 │ │ │ │ │ -637 typedef std::vector::iterator Iterator; │ │ │ │ │ -638 typedef IteratorPropertyMap VisitedMap2; │ │ │ │ │ -639 Iterator end = visited.end(); │ │ │ │ │ -640 for(Iterator iter= visited.begin(); iter != end; ++iter) │ │ │ │ │ -641 *iter=false; │ │ │ │ │ -642 │ │ │ │ │ -643 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap()); │ │ │ │ │ -644 │ │ │ │ │ -645 std::shared_ptr │ │ │ │ │ -646 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2, │ │ │ │ │ -647 *info, │ │ │ │ │ -648 *aggregatesMap, │ │ │ │ │ -649 aggregates, │ │ │ │ │ -650 OverlapFlags())); │ │ │ │ │ -651 dverb<<"Building of sparsity pattern took "<freeGlobalLookup(); │ │ │ │ │ -654 │ │ │ │ │ -655 delete std::get<0>(graphs); │ │ │ │ │ -656 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, │ │ │ │ │ -*infoLevel, OverlapFlags()); │ │ │ │ │ -657 │ │ │ │ │ -658 if(criterion.debugLevel()>2) { │ │ │ │ │ -659 if(rank==0) │ │ │ │ │ -660 std::cout<<"Calculation entries of Galerkin product took "<; │ │ │ │ │ +650 │ │ │ │ │ +_6_5_2 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ +653 { │ │ │ │ │ +654 return _I_t_e_r_a_t_o_r(block,0); │ │ │ │ │ +655 } │ │ │ │ │ +656 │ │ │ │ │ +_6_5_8 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ +659 { │ │ │ │ │ +660 return _I_t_e_r_a_t_o_r(block,nblocks); │ │ │ │ │ 661 } │ │ │ │ │ 662 │ │ │ │ │ -663 BIGINT nonzeros = _c_o_u_n_t_N_o_n_Z_e_r_o_s(*coarseMatrix); │ │ │ │ │ -664 allnonzeros = allnonzeros + infoLevel->communicator().sum(nonzeros); │ │ │ │ │ -665 MatrixArgs args(coarseMatrix, *infoLevel); │ │ │ │ │ -666 │ │ │ │ │ -667 matrices_.addCoarser(args); │ │ │ │ │ -668 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ │ -669 } // end level loop │ │ │ │ │ -670 │ │ │ │ │ -671 │ │ │ │ │ -672 infoLevel->freeGlobalLookup(); │ │ │ │ │ -673 │ │ │ │ │ -674 built_=true; │ │ │ │ │ -675 _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); │ │ │ │ │ -676 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ │ -677 │ │ │ │ │ -678 if(criterion.debugLevel()>0) { │ │ │ │ │ -679 if(level==criterion.maxLevel()) { │ │ │ │ │ -680 BIGINT unknownsLevel = mlevel->getmat().N(); │ │ │ │ │ -681 unknownsLevel = infoLevel->communicator().sum(unknownsLevel); │ │ │ │ │ -682 double dunknownsLevel = unknownsLevel.todouble(); │ │ │ │ │ -683 if(rank==0 && criterion.debugLevel()>1) { │ │ │ │ │ -684 std::cout<<"Level "<communicator().size() │ │ │ │ │ -685 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ -()<<")"<communicator().size()>1) { │ │ │ │ │ -692#if HAVE_MPI && !HAVE_PARMETIS │ │ │ │ │ -693 if(criterion.accumulate()==_s_u_c_c_e_s_s_i_v_e_A_c_c_u && │ │ │ │ │ -694 infoLevel->communicator().rank()==0) │ │ │ │ │ -695 std::cerr<<"Successive accumulation of data on coarse levels only works │ │ │ │ │ -with ParMETIS installed." │ │ │ │ │ -696 <<" Fell back to accumulation to one domain on coarsest level"< redistMat = std::make_shared(); │ │ │ │ │ -701 std::shared_ptr redistComm; │ │ │ │ │ -702 int nodomains = 1; │ │ │ │ │ -703 │ │ │ │ │ -704 _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, │ │ │ │ │ -705 redistComm, redistributes_.back(), nodomains,criterion); │ │ │ │ │ -706 MatrixArgs args(redistMat, *redistComm); │ │ │ │ │ -707 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ │ -708 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ │ -709 │ │ │ │ │ -710 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) { │ │ │ │ │ -711 double dunknownsRedist = unknownsRedist.todouble(); │ │ │ │ │ -712 std::cout<<"Level "<communicator().size() │ │ │ │ │ -713 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ -()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -(args)); │ │ │ │ │ -716 infoLevel.addRedistributed(redistComm); │ │ │ │ │ -717 infoLevel->freeGlobalLookup(); │ │ │ │ │ -718 } │ │ │ │ │ -719 │ │ │ │ │ -720 int levels = matrices_.levels(); │ │ │ │ │ -721 maxlevels_ = parallelInformation_.finest()->communicator().max(levels); │ │ │ │ │ -722 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ │ -723 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1) │ │ │ │ │ -724 std::cout<<"operator complexity: "< │ │ │ │ │ -729 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_0 _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 │ │ │ │ │ -731 { │ │ │ │ │ -732 return matrices_; │ │ │ │ │ -733 } │ │ │ │ │ -734 │ │ │ │ │ -735 template │ │ │ │ │ -736 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_3_7 _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 │ │ │ │ │ -738 { │ │ │ │ │ -739 return parallelInformation_; │ │ │ │ │ -740 } │ │ │ │ │ -741 │ │ │ │ │ -742 template │ │ │ │ │ -_7_4_3 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 │ │ │ │ │ -744 { │ │ │ │ │ -745 int levels=aggregatesMaps().size(); │ │ │ │ │ -746 int maxlevels=parallelInformation_._f_i_n_e_s_t()->communicator().max(levels); │ │ │ │ │ -747 std::size_t size=(*(aggregatesMaps().begin()))->noVertices(); │ │ │ │ │ -748 // We need an auxiliary vector for the consecutive prolongation. │ │ │ │ │ -749 std::vector tmp; │ │ │ │ │ -750 std::vector *coarse, *fine; │ │ │ │ │ -751 │ │ │ │ │ -752 // make sure the allocated space suffices. │ │ │ │ │ -753 tmp.reserve(size); │ │ │ │ │ -754 data.reserve(size); │ │ │ │ │ -755 │ │ │ │ │ -756 // Correctly assign coarse and fine for the first prolongation such that │ │ │ │ │ -757 // we end up in data in the end. │ │ │ │ │ -758 if(levels%2==0) { │ │ │ │ │ -759 coarse=&tmp; │ │ │ │ │ -760 fine=&data; │ │ │ │ │ -761 }else{ │ │ │ │ │ -762 coarse=&data; │ │ │ │ │ -763 fine=&tmp; │ │ │ │ │ -764 } │ │ │ │ │ -765 │ │ │ │ │ -766 // Number the unknowns on the coarsest level consecutively for each │ │ │ │ │ -process. │ │ │ │ │ -767 if(levels==maxlevels) { │ │ │ │ │ -768 const _A_g_g_r_e_g_a_t_e_s_M_a_p& map = *(*(++aggregatesMaps().rbegin())); │ │ │ │ │ -769 std::size_t m=0; │ │ │ │ │ -770 │ │ │ │ │ -771 for(typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r iter = map._b_e_g_i_n(); iter != │ │ │ │ │ -map._e_n_d(); ++iter) │ │ │ │ │ -772 if(*iter< _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) │ │ │ │ │ -773 m=std::max(*iter,m); │ │ │ │ │ -774 │ │ │ │ │ -775 coarse->resize(m+1); │ │ │ │ │ -776 std::size_t i=0; │ │ │ │ │ -777 srand((unsigned)std::clock()); │ │ │ │ │ -778 std::set used; │ │ │ │ │ -779 for(typename std::vector::iterator iter=coarse->begin(); iter │ │ │ │ │ -!= coarse->end(); │ │ │ │ │ -780 ++iter, ++i) │ │ │ │ │ -781 { │ │ │ │ │ -782 std::pair::iterator,bool> ibpair │ │ │ │ │ -783 = used.insert(static_cast((((double)rand())/ │ │ │ │ │ -(RAND_MAX+1.0)))*coarse->size()); │ │ │ │ │ +_6_6_5 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ +666 { │ │ │ │ │ +667 return _I_t_e_r_a_t_o_r(block,nblocks-1); │ │ │ │ │ +668 } │ │ │ │ │ +669 │ │ │ │ │ +_6_7_2 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ │ +673 { │ │ │ │ │ +674 return _I_t_e_r_a_t_o_r(block,-1); │ │ │ │ │ +675 } │ │ │ │ │ +676 │ │ │ │ │ +_6_7_8 using _i_t_e_r_a_t_o_r = _I_t_e_r_a_t_o_r; │ │ │ │ │ +679 │ │ │ │ │ +_6_8_1 using _C_o_n_s_t_I_t_e_r_a_t_o_r = _R_e_a_l_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _v_a_l_u_e___t_y_p_e_,_ _c_o_n_s_t_ _w_i_n_d_o_w___t_y_p_e_&_>; │ │ │ │ │ +682 │ │ │ │ │ +_6_8_4 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; │ │ │ │ │ +685 │ │ │ │ │ +_6_8_7 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ +688 { │ │ │ │ │ +689 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,0); │ │ │ │ │ +690 } │ │ │ │ │ +691 │ │ │ │ │ +_6_9_3 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ +694 { │ │ │ │ │ +695 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,nblocks); │ │ │ │ │ +696 } │ │ │ │ │ +697 │ │ │ │ │ +_7_0_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ +701 { │ │ │ │ │ +702 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,nblocks-1); │ │ │ │ │ +703 } │ │ │ │ │ +704 │ │ │ │ │ +_7_0_6 _C_o_n_s_t_I_t_e_r_a_t_o_r _r_e_n_d () const │ │ │ │ │ +707 { │ │ │ │ │ +708 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,-1); │ │ │ │ │ +709 } │ │ │ │ │ +710 │ │ │ │ │ +_7_1_2 _I_t_e_r_a_t_o_r _f_i_n_d (_s_i_z_e___t_y_p_e i) │ │ │ │ │ +713 { │ │ │ │ │ +714 return _I_t_e_r_a_t_o_r(block,std::min(i,nblocks)); │ │ │ │ │ +715 } │ │ │ │ │ +716 │ │ │ │ │ +_7_1_8 _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 │ │ │ │ │ +719 { │ │ │ │ │ +720 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,std::min(i,nblocks)); │ │ │ │ │ +721 } │ │ │ │ │ +722 │ │ │ │ │ +723 //===== sizes │ │ │ │ │ +724 │ │ │ │ │ +_7_2_6 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ +727 { │ │ │ │ │ +728 return nblocks; │ │ │ │ │ +729 } │ │ │ │ │ +730 │ │ │ │ │ +_7_3_5 _s_i_z_e___t_y_p_e _s_i_z_e () const │ │ │ │ │ +736 { │ │ │ │ │ +737 return nblocks; │ │ │ │ │ +738 } │ │ │ │ │ +739 │ │ │ │ │ +740 │ │ │ │ │ +741 private: │ │ │ │ │ +742 │ │ │ │ │ +743 void allocate() { │ │ │ │ │ +744 if (this->initialized) │ │ │ │ │ +745 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Attempt to re-allocate already initialized │ │ │ │ │ +VariableBlockVector"); │ │ │ │ │ +746 │ │ │ │ │ +747 // calculate space needed: │ │ │ │ │ +748 this->n=0; │ │ │ │ │ +749 for(_s_i_z_e___t_y_p_e i = 0; i < nblocks; i++) { │ │ │ │ │ +750 this->n += block[i].size(); │ │ │ │ │ +751 } │ │ │ │ │ +752 │ │ │ │ │ +753 // now we can allocate the big array in the base class of v │ │ │ │ │ +754 if (this->n>0) │ │ │ │ │ +755 { │ │ │ │ │ +756 // allocate and construct objects │ │ │ │ │ +757 this->p = allocator_.allocate(this->n); │ │ │ │ │ +758 new (this->p)B[this->n]; │ │ │ │ │ +759 } │ │ │ │ │ +760 else │ │ │ │ │ +761 { │ │ │ │ │ +762 this->p = nullptr; │ │ │ │ │ +763 } │ │ │ │ │ +764 │ │ │ │ │ +765 // and we set the window pointers │ │ │ │ │ +766 this->block[0].setptr(this->p); // pointer to first block │ │ │ │ │ +767 for (_s_i_z_e___t_y_p_e j=1; jinitialized = true; │ │ │ │ │ +772 } │ │ │ │ │ +773 │ │ │ │ │ +774 _s_i_z_e___t_y_p_e nblocks; // number of blocks in vector │ │ │ │ │ +775 window_type* block; // array of blocks pointing to the array in the base │ │ │ │ │ +class │ │ │ │ │ +776 bool initialized; // true if vector has been initialized │ │ │ │ │ +777 │ │ │ │ │ +778 A allocator_; │ │ │ │ │ +779 │ │ │ │ │ +780 typename std::allocator_traits::template rebind_alloc │ │ │ │ │ +windowAllocator_; │ │ │ │ │ +781 }; │ │ │ │ │ +782 │ │ │ │ │ +783 │ │ │ │ │ 784 │ │ │ │ │ -785 while(!ibpair.second) │ │ │ │ │ -786 ibpair = used.insert(static_cast((((double)rand())/ │ │ │ │ │ -(RAND_MAX+1.0))*coarse->size())); │ │ │ │ │ -787 *iter=*(ibpair.first); │ │ │ │ │ -788 } │ │ │ │ │ -789 } │ │ │ │ │ -790 │ │ │ │ │ -791 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r pinfo = parallelInformation │ │ │ │ │ -().coarsest(); │ │ │ │ │ -792 --pinfo; │ │ │ │ │ -793 │ │ │ │ │ -794 // Now consecutively project the numbers to the finest level. │ │ │ │ │ -795 for(typename AggregatesMapList::const_reverse_iterator │ │ │ │ │ -aggregates=++aggregatesMaps().rbegin(); │ │ │ │ │ -796 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) { │ │ │ │ │ -797 │ │ │ │ │ -798 fine->resize((*aggregates)->noVertices()); │ │ │ │ │ -799 fine->assign(fine->size(), 0); │ │ │ │ │ -800 _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> │ │ │ │ │ -801 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast │ │ │ │ │ -(1), *pinfo); │ │ │ │ │ -802 --pinfo; │ │ │ │ │ -803 std::swap(coarse, fine); │ │ │ │ │ -804 } │ │ │ │ │ -805 │ │ │ │ │ -806 // Assertion to check that we really projected to data on the last step. │ │ │ │ │ -807 assert(coarse==&data); │ │ │ │ │ -808 } │ │ │ │ │ -809 │ │ │ │ │ -810 template │ │ │ │ │ -811 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_2 _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 │ │ │ │ │ -813 { │ │ │ │ │ -814 return aggregatesMaps_; │ │ │ │ │ -815 } │ │ │ │ │ -816 template │ │ │ │ │ -817 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_1_8 _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 │ │ │ │ │ -819 { │ │ │ │ │ -820 return redistributes_; │ │ │ │ │ -821 } │ │ │ │ │ -822 │ │ │ │ │ -823 template │ │ │ │ │ -_8_2_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_x_H_i_e_r_a_r_c_h_y() │ │ │ │ │ -825 { │ │ │ │ │ -826 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator; │ │ │ │ │ -827 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; │ │ │ │ │ -828 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; │ │ │ │ │ -829 │ │ │ │ │ -830 AggregatesMapIterator amap = aggregatesMaps_.rbegin(); │ │ │ │ │ -831 InfoIterator info = parallelInformation_.coarsest(); │ │ │ │ │ -832 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level │ │ │ │ │ -!= finest; --level, --info, ++amap) { │ │ │ │ │ -833 (*amap)->free(); │ │ │ │ │ -834 delete *amap; │ │ │ │ │ -835 } │ │ │ │ │ -836 delete *amap; │ │ │ │ │ -837 } │ │ │ │ │ -838 │ │ │ │ │ -839 template │ │ │ │ │ -840 template │ │ │ │ │ -_8_4_1 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 │ │ │ │ │ -842 { │ │ │ │ │ -843 assert(hierarchy.levels()==1); │ │ │ │ │ -844 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; │ │ │ │ │ -845 typedef typename RedistributeInfoList::const_iterator RIter; │ │ │ │ │ -846 RIter redist = redistributes_.begin(); │ │ │ │ │ -847 │ │ │ │ │ -848 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest(); │ │ │ │ │ -849 int level=0; │ │ │ │ │ -850 if(redist->isSetup()) │ │ │ │ │ -851 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ │ -()); │ │ │ │ │ -852 Dune::dvverb<<"Level "<getmat().N()<<" │ │ │ │ │ -unknowns!"<getmat().N()<<" │ │ │ │ │ -unknowns!"<getmat().N()); │ │ │ │ │ -859 if(redist->isSetup()) │ │ │ │ │ -860 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ │ -()); │ │ │ │ │ -861 │ │ │ │ │ -862 } │ │ │ │ │ -863 │ │ │ │ │ -864 } │ │ │ │ │ -865 │ │ │ │ │ -866 template │ │ │ │ │ -867 template │ │ │ │ │ -_8_6_8 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, │ │ │ │ │ -869 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 │ │ │ │ │ -870 { │ │ │ │ │ -871 assert(smoothers._l_e_v_e_l_s()==0); │ │ │ │ │ -872 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; │ │ │ │ │ -873 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; │ │ │ │ │ -874 typedef typename AggregatesMapList::const_iterator AggregatesIterator; │ │ │ │ │ -875 │ │ │ │ │ -876 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; │ │ │ │ │ -877 cargs.setArgs(sargs); │ │ │ │ │ -878 PinfoIterator pinfo = parallelInformation_.finest(); │ │ │ │ │ -879 AggregatesIterator aggregates = aggregatesMaps_.begin(); │ │ │ │ │ -880 int level=0; │ │ │ │ │ -881 for(MatrixIterator matrix = matrices_.finest(), coarsest = │ │ │ │ │ -matrices_.coarsest(); │ │ │ │ │ -882 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) { │ │ │ │ │ -883 cargs.setMatrix(matrix->getmat(), **aggregates); │ │ │ │ │ -884 cargs.setComm(*pinfo); │ │ │ │ │ -885 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ │ -886 } │ │ │ │ │ -887 if(maxlevels()>levels()) { │ │ │ │ │ -888 // This is not the globally coarsest level and therefore smoothing is │ │ │ │ │ -needed │ │ │ │ │ -889 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates); │ │ │ │ │ -890 cargs.setComm(*pinfo); │ │ │ │ │ -891 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ │ -892 ++level; │ │ │ │ │ -893 } │ │ │ │ │ -894 } │ │ │ │ │ -895 │ │ │ │ │ -896 template │ │ │ │ │ -897 template │ │ │ │ │ -_8_9_8 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) │ │ │ │ │ -899 { │ │ │ │ │ -900 typedef typename AggregatesMapList::iterator AggregatesMapIterator; │ │ │ │ │ -901 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; │ │ │ │ │ -902 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; │ │ │ │ │ -903 │ │ │ │ │ -904 AggregatesMapIterator amap = aggregatesMaps_.begin(); │ │ │ │ │ -905 _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t productBuilder; │ │ │ │ │ -906 InfoIterator info = parallelInformation_.finest(); │ │ │ │ │ -907 typename RedistributeInfoList::iterator riIter = redistributes_.begin(); │ │ │ │ │ -908 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest(); │ │ │ │ │ -909 if(level.isRedistributed()) { │ │ │ │ │ -910 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ │ -911 _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()), │ │ │ │ │ -912 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), │ │ │ │ │ -913 *info,info.getRedistributed(), *riIter); │ │ │ │ │ -914 info->freeGlobalLookup(); │ │ │ │ │ -915 } │ │ │ │ │ -916 │ │ │ │ │ -917 for(; level!=coarsest; ++amap) { │ │ │ │ │ -918 const _M_a_t_r_i_x& fine = (level.isRedistributed() ? level.getRedistributed() : │ │ │ │ │ -*level).getmat(); │ │ │ │ │ -919 ++level; │ │ │ │ │ -920 ++info; │ │ │ │ │ -921 ++riIter; │ │ │ │ │ -922 productBuilder._c_a_l_c_u_l_a_t_e(fine, *(*amap), const_cast<_M_a_t_r_i_x&>(level->getmat │ │ │ │ │ -()), *info, copyFlags); │ │ │ │ │ -923 if(level.isRedistributed()) { │ │ │ │ │ -924 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ │ -925 _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()), │ │ │ │ │ -926 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), *info, │ │ │ │ │ -927 info.getRedistributed(), *riIter); │ │ │ │ │ -928 info->freeGlobalLookup(); │ │ │ │ │ -929 } │ │ │ │ │ -930 } │ │ │ │ │ -931 } │ │ │ │ │ -932 │ │ │ │ │ -933 template │ │ │ │ │ -_9_3_4 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 │ │ │ │ │ -935 { │ │ │ │ │ -936 return matrices_.levels(); │ │ │ │ │ -937 } │ │ │ │ │ -938 │ │ │ │ │ -939 template │ │ │ │ │ -_9_4_0 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 │ │ │ │ │ -941 { │ │ │ │ │ -942 return maxlevels_; │ │ │ │ │ -943 } │ │ │ │ │ -944 │ │ │ │ │ -945 template │ │ │ │ │ -_9_4_6 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 │ │ │ │ │ -947 { │ │ │ │ │ -948 return levels()==maxlevels() && │ │ │ │ │ -949 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N │ │ │ │ │ -()>0); │ │ │ │ │ -950 } │ │ │ │ │ -951 │ │ │ │ │ -952 template │ │ │ │ │ -_9_5_3 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 │ │ │ │ │ -954 { │ │ │ │ │ -955 return built_; │ │ │ │ │ -956 } │ │ │ │ │ -957 │ │ │ │ │ -959 } // namespace Amg │ │ │ │ │ -960} // namespace Dune │ │ │ │ │ -961 │ │ │ │ │ -962#endif // end DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ │ +787} // end namespace │ │ │ │ │ +788 │ │ │ │ │ +789#endif │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ +_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... │ │ │ │ │ -_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. │ │ │ │ │ -_m_a_t_r_i_x_u_t_i_l_s_._h_h │ │ │ │ │ -Some handy generic functions for ISTL matrices. │ │ │ │ │ -_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. │ │ │ │ │ -_s_m_o_o_t_h_e_r_._h_h │ │ │ │ │ -Classes for the generic construction and application of the smoothers. │ │ │ │ │ -_t_r_a_n_s_f_e_r_._h_h │ │ │ │ │ -Prolongation and restriction for amg. │ │ │ │ │ -_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ │ -Provdes class for identifying aggregates globally. │ │ │ │ │ -_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_c_r_e_a_t_o_r_._h_h │ │ │ │ │ -_g_a_l_e_r_k_i_n_._h_h │ │ │ │ │ -Provides a class for building the galerkin product based on a aggregation │ │ │ │ │ -scheme. │ │ │ │ │ -_g_r_a_p_h_._h_h │ │ │ │ │ -Provides classes for building the matrix graph. │ │ │ │ │ -_h_i_e_r_a_r_c_h_y_._h_h │ │ │ │ │ -Provides a classes representing the hierarchies in AMG. │ │ │ │ │ -_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. │ │ │ │ │ -_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:812 │ │ │ │ │ -_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:953 │ │ │ │ │ -_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:946 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ │ -std::size_t levels() const │ │ │ │ │ -Get the number of levels in the hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ │ -std::size_t levels() const │ │ │ │ │ -Get the number of levels in the hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:934 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ │ -void addCoarser(Arguments &args) │ │ │ │ │ -Add an element on a coarser level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -const RedistributeInfoList & redistributeInformation() const │ │ │ │ │ -Get the hierarchy of the information about redistributions,. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:818 │ │ │ │ │ -_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:737 │ │ │ │ │ -_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:313 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_m_a_t_r_i_c_e_s │ │ │ │ │ -const ParallelMatrixHierarchy & matrices() const │ │ │ │ │ -Get the matrix hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:730 │ │ │ │ │ -_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:940 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ │ -static const V ISOLATED │ │ │ │ │ -Identifier of isolated vertices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n │ │ │ │ │ -void recalculateGalerkin(const F ©Flags) │ │ │ │ │ -Recalculate the galerkin products. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:898 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ -const void * Arguments │ │ │ │ │ -A type holding all the arguments needed to call the constructor. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ -std::size_t noVertices() const │ │ │ │ │ -Get the number of vertices. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_V_e_c_t_o_r │ │ │ │ │ -void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const │ │ │ │ │ -Coarsen the vector hierarchy according to the matrix hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:841 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -const AggregateDescriptor * const_iterator │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ -MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< │ │ │ │ │ -ParallelInformation > pinfo=std::make_shared< ParallelInformation >()) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:389 │ │ │ │ │ -_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:232 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ │ -Iterator finest() │ │ │ │ │ -Get an iterator positioned at the finest level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_b_u_i_l_d │ │ │ │ │ -void build(const T &criterion) │ │ │ │ │ -Build the matrix hierarchy using aggregation. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:400 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_f_r_e_e │ │ │ │ │ -void free() │ │ │ │ │ -Free the allocated memory. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_S_m_o_o_t_h_e_r │ │ │ │ │ -void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename │ │ │ │ │ -SmootherTraits< S >::Arguments &args) const │ │ │ │ │ -Coarsen the smoother hierarchy according to the matrix hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:868 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, │ │ │ │ │ -bool finestLevel) │ │ │ │ │ -Build the dependency of the matrix graph. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s │ │ │ │ │ -std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, │ │ │ │ │ -const C &criterion, bool finestLevel) │ │ │ │ │ -Build the aggregates. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_:_:_c_a_l_c_u_l_a_t_e │ │ │ │ │ -void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, │ │ │ │ │ -const I &pinfo, const O ©) │ │ │ │ │ -Calculate the galerkin product. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t │ │ │ │ │ -void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const │ │ │ │ │ -Get the mapping of fine level unknowns to coarse level aggregates. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:743 │ │ │ │ │ -_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:824 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S │ │ │ │ │ -@ MAX_PROCESSES │ │ │ │ │ -Hard limit for the number of processes allowed. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ │ -@ atOnceAccu │ │ │ │ │ -Accumulate data to one process at once. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:244 │ │ │ │ │ -_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:248 │ │ │ │ │ _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:829 │ │ │ │ │ -_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:1235 │ │ │ │ │ _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:395 │ │ │ │ │ _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 │ │ │ │ │ +_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:46 │ │ │ │ │ +_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 │ │ │ │ │ +RealIterator< value_type, window_type & > Iterator │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:649 │ │ │ │ │ +_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() │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:97 │ │ │ │ │ +_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:55 │ │ │ │ │ +_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:58 │ │ │ │ │ +_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 _nblocks, size_type m) │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:134 │ │ │ │ │ +_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 │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:735 │ │ │ │ │ +_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 │ │ │ │ │ +number of blocks in the vector (are of variable size here) │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:726 │ │ │ │ │ +_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:172 │ │ │ │ │ +_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 _nblocks) │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:108 │ │ │ │ │ +_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() │ │ │ │ │ +free dynamic memory │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:215 │ │ │ │ │ +_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:563 │ │ │ │ │ +_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:552 │ │ │ │ │ +_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() const │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:672 │ │ │ │ │ +_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:543 │ │ │ │ │ +_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=(const VariableBlockVector &a) │ │ │ │ │ +assignment │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:322 │ │ │ │ │ +_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_l_e_v_e_l │ │ │ │ │ +static constexpr auto blocklevel │ │ │ │ │ +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_:_:_r_e_n_d │ │ │ │ │ +ConstIterator rend() const │ │ │ │ │ +end ConstIterator │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:706 │ │ │ │ │ +_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 │ │ │ │ │ A::size_type size_type │ │ │ │ │ -Type for indices and sizes. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:577 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ -MatrixImp::DenseMatrixBase< T, A >::window_type row_type │ │ │ │ │ -The type implementing a matrix row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:574 │ │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ -Class representing the properties of an ede in the matrix graph. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ -Class representing a node in the matrix graph. │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:99 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:131 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ -The (undirected) graph of a matrix. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ -Attaches properties to the edges and vertices of a graph. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:978 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ -Graph::VertexDescriptor VertexDescriptor │ │ │ │ │ -The vertex descriptor. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:988 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:22 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ -A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > │ │ │ │ │ -Iterator │ │ │ │ │ -Type of the mutable iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const │ │ │ │ │ -MatrixOperator > ConstIterator │ │ │ │ │ -Type of the const iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ -The hierarchies build by the coarsening process. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_A_l_l_o_c_a_t_o_r │ │ │ │ │ -typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ │ -AggregatesMap * > AAllocator │ │ │ │ │ -Allocator for pointers. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ -Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ │ -ParallelInformationHierarchy │ │ │ │ │ -The type of the parallel informarion hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t │ │ │ │ │ -std::list< AggregatesMap *, AAllocator > AggregatesMapList │ │ │ │ │ -The type of the aggregates maps list. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:88 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -PI ParallelInformation │ │ │ │ │ -The type of the index set. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ -Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy │ │ │ │ │ -The type of the parallel matrix hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:79 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ -A Allocator │ │ │ │ │ -The allocator to use. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e │ │ │ │ │ -RedistributeInformation< ParallelInformation > RedistributeInfoType │ │ │ │ │ -The type of the redistribute information. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ │ -double getProlongationDampingFactor() const │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_I_L_A_l_l_o_c_a_t_o_r │ │ │ │ │ -typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ │ -RedistributeInfoType > RILAllocator │ │ │ │ │ -Allocator for RedistributeInfoType. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t │ │ │ │ │ -std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList │ │ │ │ │ -The type of the list of redistribute information. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:97 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > │ │ │ │ │ -AggregatesMap │ │ │ │ │ -The type of the aggregates map we use. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x │ │ │ │ │ -MatrixOperator::matrix_type Matrix │ │ │ │ │ -The type of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ │ -M MatrixOperator │ │ │ │ │ -The type of the matrix operator. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const matrix_row &row) │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:254 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_t_r_i_x___r_o_w │ │ │ │ │ -Matrix::row_type matrix_row │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:245 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_i_n │ │ │ │ │ -size_type min │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_c_a_l_c │ │ │ │ │ -calc() │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:247 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_x │ │ │ │ │ -size_type max │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:262 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_u_m │ │ │ │ │ -size_type sum │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:244 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ -The criterion describing the stop criteria for the coarsening process. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:283 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ -CoarsenCriterion(const Dune::Amg::Parameters &parms) │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:306 │ │ │ │ │ -_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) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:301 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -All parameters for AMG. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ -Tag idnetifying the visited property of a vertex. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ -The default class for the smoother arguments. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ │ -DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ │ -Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ │ -newly introduced virtu... │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ │ +The size type for the index access. │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:73 │ │ │ │ │ +_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:718 │ │ │ │ │ +_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:700 │ │ │ │ │ +_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:712 │ │ │ │ │ +_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:70 │ │ │ │ │ +_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 │ │ │ │ │ +RealIterator< const value_type, const window_type & > ConstIterator │ │ │ │ │ +Const iterator. │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:681 │ │ │ │ │ +_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:658 │ │ │ │ │ +_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:687 │ │ │ │ │ +_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:80 │ │ │ │ │ +_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:693 │ │ │ │ │ +_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:84 │ │ │ │ │ +_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 _nblocks, size_type m) │ │ │ │ │ +same effect as constructor with same argument │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:270 │ │ │ │ │ +_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:64 │ │ │ │ │ +_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 _nblocks) │ │ │ │ │ +same effect as constructor with same argument │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:234 │ │ │ │ │ +_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:665 │ │ │ │ │ +_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:652 │ │ │ │ │ +_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: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_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const CreateIterator &it) const │ │ │ │ │ +equality │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:505 │ │ │ │ │ +_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:511 │ │ │ │ │ +_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:463 │ │ │ │ │ +_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:460 │ │ │ │ │ +_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:499 │ │ │ │ │ +_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:471 │ │ │ │ │ +_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:449 │ │ │ │ │ +_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:466 │ │ │ │ │ +_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:517 │ │ │ │ │ +_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:528 │ │ │ │ │ +_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:446 │ │ │ │ │ +_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:482 │ │ │ │ │ +_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:457 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:584 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ +RealIterator(window_type *_p, size_type _i) │ │ │ │ │ +constructor │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:594 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const RealIterator &it) const │ │ │ │ │ +equality │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:611 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ +size_type index() const │ │ │ │ │ +Return the index of the entry this iterator is pointing to. │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:639 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ +window_type & elementAt(std::ptrdiff_t offset) const │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:633 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ +void decrement() │ │ │ │ │ +prefix decrement │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:605 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ +void advance(std::ptrdiff_t d) │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:622 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +prefix increment │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:599 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ +RealIterator() │ │ │ │ │ +constructor, no arguments │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:587 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +std::ptrdiff_t distanceTo(const RealIterator &o) const │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:627 │ │ │ │ │ +_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_a_l_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +window_type & dereference() const │ │ │ │ │ +dereferencing │ │ │ │ │ +DDeeffiinniittiioonn vbvector.hh:617 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00119.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: globalaggregates.hh File Reference │ │ │ │ +dune-istl: kamg.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,54 +72,44 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ - │ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include "aggregates.hh"
│ │ │ │ -#include "pinfo.hh"
│ │ │ │ -#include <dune/common/parallel/indexset.hh>
│ │ │ │ +
#include <dune/istl/preconditioners.hh>
│ │ │ │ +#include "amg.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Amg::GlobalAggregatesMap< T, TI >
class  Dune::Amg::KAmgTwoGrid< AMG >
 Two grid operator for AMG with Krylov cycle. More...
 
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 > >
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

│ │ │ │ -

Provdes class for identifying aggregates globally.

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

Provides an algebraic multigrid using a Krylov cycle.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,44 +2,32 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -globalaggregates.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 │ │ │ │ │ -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 │ │ │ │ │ +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" │ │ │ │ │ _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_:_:_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_:_:_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_ _>_ _> │ │ │ │ │ +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 ********** │ │ │ │ │ -Provdes class for identifying aggregates globally. │ │ │ │ │ +Provides an algebraic multigrid using a Krylov cycle. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00119_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: globalaggregates.hh Source File │ │ │ │ +dune-istl: kamg.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,339 +74,332 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
globalaggregates.hh
│ │ │ │ +
kamg.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ +
5#ifndef DUNE_AMG_KAMG_HH
│ │ │ │ +
6#define DUNE_AMG_KAMG_HH
│ │ │ │
7
│ │ │ │ -
18#include "aggregates.hh"
│ │ │ │ -
19#include "pinfo.hh"
│ │ │ │ -
20#include <dune/common/parallel/indexset.hh>
│ │ │ │ -
21
│ │ │ │ -
22namespace Dune
│ │ │ │ -
23{
│ │ │ │ -
24 namespace Amg
│ │ │ │ -
25 {
│ │ │ │ -
26
│ │ │ │ -
27 template<typename T, typename TI>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
29 {
│ │ │ │ -
30 public:
│ │ │ │ -
31 typedef TI ParallelIndexSet;
│ │ │ │ -
32
│ │ │ │ -
33 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ │ -
34
│ │ │ │ -
35 typedef typename ParallelIndexSet::GlobalIndex IndexedType;
│ │ │ │ -
36
│ │ │ │ -
37 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
│ │ │ │ -
38
│ │ │ │ -
39 typedef T Vertex;
│ │ │ │ -
40
│ │ │ │ + │ │ │ │ +
9#include "amg.hh"
│ │ │ │ +
10
│ │ │ │ +
11namespace Dune
│ │ │ │ +
12{
│ │ │ │ +
13 namespace Amg
│ │ │ │ +
14 {
│ │ │ │ +
15
│ │ │ │ +
30 template<class AMG>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
32 : public Preconditioner<typename AMG::Domain,typename AMG::Range>
│ │ │ │ +
33 {
│ │ │ │ +
35 typedef typename AMG::Domain Domain;
│ │ │ │ +
37 typedef typename AMG::Range Range;
│ │ │ │ +
38 public:
│ │ │ │ +
39
│ │ │ │
│ │ │ │ - │ │ │ │ -
42 const GlobalLookupIndexSet<ParallelIndexSet>& indexset)
│ │ │ │ -
43 : aggregates_(aggregates), indexset_(indexset)
│ │ │ │ -
44 {}
│ │ │ │ + │ │ │ │ +
42 {
│ │ │ │ +
43 return amg_.category();
│ │ │ │ +
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 };
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ -
│ │ │ │ -
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 }
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
96 {
│ │ │ │ +
97 return coarseSolver_;
│ │ │ │ +
98 }
│ │ │ │
│ │ │ │ -
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 }
│ │ │ │ +
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 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 };
│ │ │ │ +
123
│ │ │ │ +
137 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ │ +
138 class K=GeneralizedPCGSolver<X>, class A=std::allocator<X> >
│ │ │ │ +
│ │ │ │ +
139 class KAMG : public Preconditioner<X,X>
│ │ │ │ +
140 {
│ │ │ │ +
141 public:
│ │ │ │ + │ │ │ │ +
145 typedef K KrylovSolver;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
155 typedef typename Amg::Operator Operator;
│ │ │ │ +
157 typedef typename Amg::Domain Domain;
│ │ │ │ +
159 typedef typename Amg::Range Range;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
164
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
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 } // 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
│ │ │ │ -
250 /* @} */
│ │ │ │ -
251#endif
│ │ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ │ - │ │ │ │ -
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:164
│ │ │ │ -
const GlobalIndex & operator[](std::size_t index) const
Definition globalaggregates.hh:46
│ │ │ │ - │ │ │ │ -
static int getSize(const Type &, int)
Definition globalaggregates.hh:242
│ │ │ │ -
Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
Definition globalaggregates.hh:240
│ │ │ │ -
GlobalIndex & get(std::size_t index)
Definition globalaggregates.hh:60
│ │ │ │ - │ │ │ │ -
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:226
│ │ │ │ -
SequentialInformation ParallelInformation
Definition globalaggregates.hh:223
│ │ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:33
│ │ │ │ -
ParallelInformation::ParallelIndexSet IndexSet
Definition globalaggregates.hh:165
│ │ │ │ -
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
│ │ │ │ -
Amg::AggregatesMap< T > Type
Definition globalaggregates.hh:239
│ │ │ │ -
static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
Definition globalaggregates.hh:123
│ │ │ │ -
OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation
Definition globalaggregates.hh:163
│ │ │ │ -
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ │ -
SizeOne IndexedTypeFlag
Definition globalaggregates.hh:241
│ │ │ │ -
Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
Definition globalaggregates.hh:72
│ │ │ │ -
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │ -
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:167
│ │ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:116
│ │ │ │ -
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
Definition globalaggregates.hh:37
│ │ │ │ -
TI ParallelIndexSet
Definition globalaggregates.hh:115
│ │ │ │ - │ │ │ │ -
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:224
│ │ │ │ -
static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, size_t i)
Definition globalaggregates.hh:118
│ │ │ │ -
Proxy & operator=(const GlobalIndex &global)
Definition globalaggregates.hh:76
│ │ │ │ -
ParallelIndexSet::GlobalIndex IndexedType
Definition globalaggregates.hh:35
│ │ │ │ -
Proxy operator[](std::size_t index)
Definition globalaggregates.hh:91
│ │ │ │ +
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 }
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ +
Define general preconditioner interface.
│ │ │ │ +
The AMG preconditioner.
│ │ │ │ +
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:300
│ │ │ │ +
X Domain
The domain type.
Definition amg.hh:87
│ │ │ │ +
KAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms, std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1)
Construct a new amg with a specific coarse solver.
Definition kamg.hh:233
│ │ │ │ +
std::size_t maxlevels()
Definition kamg.hh:320
│ │ │ │ +
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ │ +
M Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ │ +
void post(Domain &x)
Clean up.
Definition kamg.hh:293
│ │ │ │ +
X Range
The range type.
Definition amg.hh:89
│ │ │ │ +
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 pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition kamg.hh:253
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition amg.hh:194
│ │ │ │ +
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:80
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ -
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ │ -
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ │ -
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ │ -
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ -
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ │ -
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ -
Definition globalaggregates.hh:29
│ │ │ │ -
Definition globalaggregates.hh:70
│ │ │ │ -
Definition globalaggregates.hh:114
│ │ │ │ -
Definition globalaggregates.hh:131
│ │ │ │ -
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
│ │ │ │ +
an algebraic multigrid method using a Krylov-cycle.
Definition kamg.hh:140
│ │ │ │ +
Amg::Domain Domain
the type of the domain.
Definition kamg.hh:157
│ │ │ │ +
Amg::SmootherArgs SmootherArgs
The type of the arguments for construction of the smoothers.
Definition kamg.hh:153
│ │ │ │ +
Amg::ParallelInformation ParallelInformation
the type of the parallelinformation to use.
Definition kamg.hh:151
│ │ │ │ +
Amg::CoarseSolver CoarseSolver
The type of the coarse solver.
Definition kamg.hh:149
│ │ │ │ +
Amg::OperatorHierarchy OperatorHierarchy
The type of the hierarchy of operators.
Definition kamg.hh:147
│ │ │ │ +
Amg::Range Range
The type of the range.
Definition kamg.hh:159
│ │ │ │ +
Amg::ScalarProduct ScalarProduct
The type of the scalar product.
Definition kamg.hh:163
│ │ │ │ +
AMG< M, X, S, PI, A > Amg
The type of the underlying AMG.
Definition kamg.hh:143
│ │ │ │ +
Amg::Operator Operator
the type of the lineatr operator.
Definition kamg.hh:155
│ │ │ │ +
Amg::ParallelInformationHierarchy ParallelInformationHierarchy
The type of the hierarchy of parallel information.
Definition kamg.hh:161
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:166
│ │ │ │ +
K KrylovSolver
The type of the Krylov solver for the cycle.
Definition kamg.hh:145
│ │ │ │ +
Two grid operator for AMG with Krylov cycle.
Definition kamg.hh:33
│ │ │ │ +
void pre(typename AMG::Domain &x, typename AMG::Range &b)
Prepare the preconditioner.
Definition kamg.hh:58
│ │ │ │ +
KAmgTwoGrid(AMG &amg, std::shared_ptr< InverseOperator< Domain, Range > > coarseSolver)
Constructor.
Definition kamg.hh:53
│ │ │ │ +
~KAmgTwoGrid()
Destructor.
Definition kamg.hh:110
│ │ │ │ +
void post(typename AMG::Domain &x)
Clean up.
Definition kamg.hh:62
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:41
│ │ │ │ +
void setLevelContext(std::shared_ptr< typename AMG::LevelContext > p)
Set the level context pointer.
Definition kamg.hh:104
│ │ │ │ +
InverseOperator< Domain, Range > * coarseSolver()
Get a pointer to the coarse grid solver.
Definition kamg.hh:95
│ │ │ │ +
void apply(typename AMG::Domain &v, const typename AMG::Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:66
│ │ │ │ +
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ │ + │ │ │ │ +
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │ +
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ │ +
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ +
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
Generalized preconditioned conjugate gradient solver.
Definition solvers.hh:1307
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,424 +1,433 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -globalaggregates.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 (C) 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 │ │ │ │ │ +5#ifndef DUNE_AMG_KAMG_HH │ │ │ │ │ +6#define DUNE_AMG_KAMG_HH │ │ │ │ │ 7 │ │ │ │ │ -18#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ │ -19#include "_p_i_n_f_o_._h_h" │ │ │ │ │ -20#include │ │ │ │ │ -21 │ │ │ │ │ -22namespace _D_u_n_e │ │ │ │ │ -23{ │ │ │ │ │ -24 namespace Amg │ │ │ │ │ -25 { │ │ │ │ │ -26 │ │ │ │ │ -27 template │ │ │ │ │ -_2_8 struct _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -29 { │ │ │ │ │ -30 public: │ │ │ │ │ -_3_1 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -32 │ │ │ │ │ -_3_3 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -34 │ │ │ │ │ -_3_5 typedef typename ParallelIndexSet::GlobalIndex _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -36 │ │ │ │ │ -_3_7 typedef typename ParallelIndexSet::LocalIndex _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ -38 │ │ │ │ │ -_3_9 typedef T _V_e_r_t_e_x; │ │ │ │ │ -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 {} │ │ │ │ │ +8#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ │ +9#include "_a_m_g_._h_h" │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e │ │ │ │ │ +12{ │ │ │ │ │ +13 namespace Amg │ │ │ │ │ +14 { │ │ │ │ │ +15 │ │ │ │ │ +30 template │ │ │ │ │ +_3_1 class _K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ +32 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +33 { │ │ │ │ │ +35 typedef typename _A_M_G_:_:_D_o_m_a_i_n Domain; │ │ │ │ │ +37 typedef typename _A_M_G_:_:_R_a_n_g_e Range; │ │ │ │ │ +38 public: │ │ │ │ │ +39 │ │ │ │ │ +_4_1 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +42 { │ │ │ │ │ +43 return amg_._c_a_t_e_g_o_r_y(); │ │ │ │ │ +44 }; │ │ │ │ │ 45 │ │ │ │ │ -_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 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(); │ │ │ │ │ +_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 return *this; │ │ │ │ │ -85 } │ │ │ │ │ -86 private: │ │ │ │ │ -87 const GlobalLookupIndexSet* indexset_; │ │ │ │ │ -88 _V_e_r_t_e_x* aggregate_; │ │ │ │ │ -89 }; │ │ │ │ │ +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_1 inline _P_r_o_x_y _o_p_e_r_a_t_o_r_[_](std::size_t index) │ │ │ │ │ -92 { │ │ │ │ │ -93 return _P_r_o_x_y(indexset_, aggregates_[index]); │ │ │ │ │ -94 } │ │ │ │ │ -95 │ │ │ │ │ -_9_6 inline void _p_u_t(const _G_l_o_b_a_l_I_n_d_e_x& global, size_t i) │ │ │ │ │ -97 { │ │ │ │ │ -98 aggregates_[i]=indexset_[global].local(); │ │ │ │ │ +_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 │ │ │ │ │ -100 } │ │ │ │ │ -101 │ │ │ │ │ -102 private: │ │ │ │ │ -103 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ │ -104 const GlobalLookupIndexSet& indexset_; │ │ │ │ │ -105 static const _G_l_o_b_a_l_I_n_d_e_x isolatedMarker; │ │ │ │ │ -106 }; │ │ │ │ │ -107 │ │ │ │ │ -108 template │ │ │ │ │ -109 const typename TI::GlobalIndex GlobalAggregatesMap::isolatedMarker = │ │ │ │ │ -110 std::numeric_limits::max(); │ │ │ │ │ -111 │ │ │ │ │ -112 template │ │ │ │ │ -_1_1_3 struct _A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ -114 { │ │ │ │ │ -_1_1_5 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -_1_1_6 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -117 │ │ │ │ │ -_1_1_8 static const _G_l_o_b_a_l_I_n_d_e_x& _g_a_t_h_e_r(const _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, │ │ │ │ │ -size_t i) │ │ │ │ │ -119 { │ │ │ │ │ -120 return ga[i]; │ │ │ │ │ -121 } │ │ │ │ │ +_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_3 static void _s_c_a_t_t_e_r(_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, _G_l_o_b_a_l_I_n_d_e_x global, │ │ │ │ │ -size_t i) │ │ │ │ │ -124 { │ │ │ │ │ -125 ga[i]=global; │ │ │ │ │ -126 } │ │ │ │ │ -127 }; │ │ │ │ │ -128 │ │ │ │ │ -129 template │ │ │ │ │ -_1_3_0 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ │ -131 {}; │ │ │ │ │ -132 │ │ │ │ │ -133#if HAVE_MPI │ │ │ │ │ -134 │ │ │ │ │ -135#endif │ │ │ │ │ -136 │ │ │ │ │ -137 } // namespace Amg │ │ │ │ │ -138 │ │ │ │ │ -139#if HAVE_MPI │ │ │ │ │ -140 // forward declaration │ │ │ │ │ -141 template │ │ │ │ │ -142 class _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n; │ │ │ │ │ -143#endif │ │ │ │ │ -144 │ │ │ │ │ -145 namespace Amg │ │ │ │ │ -146 { │ │ │ │ │ -147 │ │ │ │ │ -148#if HAVE_MPI │ │ │ │ │ -158 template │ │ │ │ │ -_1_5_9 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r > │ │ │ │ │ -160 { │ │ │ │ │ -_1_6_1 typedef T _V_e_r_t_e_x; │ │ │ │ │ -_1_6_2 typedef O _O_v_e_r_l_a_p_F_l_a_g_s; │ │ │ │ │ -_1_6_3 typedef _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ -_1_6_4 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ │ -_1_6_5 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t _I_n_d_e_x_S_e_t; │ │ │ │ │ -166 │ │ │ │ │ -_1_6_7 static void _p_u_b_l_i_s_h(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -168 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ │ -169 const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& globalLookup) │ │ │ │ │ -170 { │ │ │ │ │ -171 typedef _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_,_I_n_d_e_x_S_e_t_> GlobalMap; │ │ │ │ │ -172 GlobalMap gmap(aggregates, globalLookup); │ │ │ │ │ -173 pinfo._c_o_p_y_O_w_n_e_r_T_o_A_l_l(gmap,gmap); │ │ │ │ │ -174 // communication only needed for ALU │ │ │ │ │ -175 // (ghosts with same global id as owners on the same process) │ │ │ │ │ -176 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo) == static_cast(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ │ -_n_o_n_o_v_e_r_l_a_p_p_i_n_g)) │ │ │ │ │ -177 pinfo._c_o_p_y_C_o_p_y_T_o_A_l_l(gmap,gmap); │ │ │ │ │ -178 │ │ │ │ │ -179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists; │ │ │ │ │ -180 Lists lists = pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().find(pinfo._c_o_m_m_u_n_i_c_a_t_o_r().rank()); │ │ │ │ │ -181 if(lists!=pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().end()) { │ │ │ │ │ -182 │ │ │ │ │ -183 // For periodic boundary conditions we must renumber │ │ │ │ │ -184 // the aggregates of vertices in the overlap whose owners are │ │ │ │ │ -185 // on the same process │ │ │ │ │ -186 _V_e_r_t_e_x maxAggregate =0; │ │ │ │ │ -187 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iter; │ │ │ │ │ -188 for(Iter i=aggregates._b_e_g_i_n(), end=aggregates._e_n_d(); i!=end; ++i) │ │ │ │ │ -189 maxAggregate = std::max(maxAggregate, *i); │ │ │ │ │ -190 │ │ │ │ │ -191 // Compute new mapping of aggregates in the overlap that we also own │ │ │ │ │ -192 std::map newMapping; │ │ │ │ │ -193 │ │ │ │ │ -194 // insert all elements into map │ │ │ │ │ -195 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList │ │ │ │ │ -196 ::const_iterator RIter; │ │ │ │ │ -197 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end │ │ │ │ │ -(); │ │ │ │ │ -198 ri!=rend; ++ri) │ │ │ │ │ -199 if(O::contains(ri->localIndexPair().local().attribute())) │ │ │ │ │ -200 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()], │ │ │ │ │ -201 maxAggregate)); │ │ │ │ │ -202 // renumber │ │ │ │ │ -203 typedef typename std::map::iterator MIter; │ │ │ │ │ -204 for(MIter mi=newMapping.begin(), mend=newMapping.end(); │ │ │ │ │ -205 mi != mend; ++mi) │ │ │ │ │ -206 mi->second=++maxAggregate; │ │ │ │ │ -207 │ │ │ │ │ -208 │ │ │ │ │ -209 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end │ │ │ │ │ -(); │ │ │ │ │ -210 ri!=rend; ++ri) │ │ │ │ │ -211 if(O::contains(ri->localIndexPair().local().attribute())) │ │ │ │ │ -212 aggregates[ri->localIndexPair().local()] = │ │ │ │ │ -213 newMapping[aggregates[ri->localIndexPair().local()]]; │ │ │ │ │ -214 } │ │ │ │ │ -215 } │ │ │ │ │ -216 }; │ │ │ │ │ -217#endif │ │ │ │ │ -218 │ │ │ │ │ -219 template │ │ │ │ │ -_2_2_0 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ │ -221 { │ │ │ │ │ -_2_2_2 typedef T _V_e_r_t_e_x; │ │ │ │ │ -_2_2_3 typedef _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ -_2_2_4 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ │ -225 │ │ │ │ │ -_2_2_6 static void _p_u_b_l_i_s_h([[maybe_unused]] _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -227 [[maybe_unused]] _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ │ -228 [[maybe_unused]] const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& globalLookup) │ │ │ │ │ -229 {} │ │ │ │ │ -230 }; │ │ │ │ │ +123 │ │ │ │ │ +137 template, class A=std::allocator > │ │ │ │ │ +_1_3_9 class _K_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +140 { │ │ │ │ │ +141 public: │ │ │ │ │ +_1_4_3 typedef _A_M_G_<_M_,_X_,_S_,_P_I_,_A_> _A_m_g; │ │ │ │ │ +_1_4_5 typedef K _K_r_y_l_o_v_S_o_l_v_e_r; │ │ │ │ │ +_1_4_7 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ │ +_1_4_9 typedef typename _A_m_g_:_:_C_o_a_r_s_e_S_o_l_v_e_r _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ │ +_1_5_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ +_1_5_3 typedef typename _A_m_g_:_:_S_m_o_o_t_h_e_r_A_r_g_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ │ +_1_5_5 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r _O_p_e_r_a_t_o_r; │ │ │ │ │ +_1_5_7 typedef typename _A_m_g_:_:_D_o_m_a_i_n _D_o_m_a_i_n; │ │ │ │ │ +_1_5_9 typedef typename _A_m_g_:_:_R_a_n_g_e _R_a_n_g_e; │ │ │ │ │ +_1_6_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ │ +_1_6_3 typedef typename _A_m_g_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t _S_c_a_l_a_r_P_r_o_d_u_c_t; │ │ │ │ │ +164 │ │ │ │ │ +_1_6_6 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +167 { │ │ │ │ │ +168 return amg._c_a_t_e_g_o_r_y(); │ │ │ │ │ +169 }; │ │ │ │ │ +170 │ │ │ │ │ +182 _K_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ │ +183 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ │ +184 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1); │ │ │ │ │ +185 │ │ │ │ │ +199 template │ │ │ │ │ +200 _K_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ +201 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs=_S_m_o_o_t_h_e_r_A_r_g_s(), │ │ │ │ │ +202 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1, │ │ │ │ │ +203 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ +204 │ │ │ │ │ +206 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ │ +208 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ │ +210 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ │ +211 │ │ │ │ │ +212 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ │ +213 │ │ │ │ │ +214 private: │ │ │ │ │ +216 _A_m_g amg; │ │ │ │ │ +217 │ │ │ │ │ +219 std::size_t maxLevelKrylovSteps; │ │ │ │ │ +220 │ │ │ │ │ +222 double levelDefectReduction; │ │ │ │ │ +223 │ │ │ │ │ +225 std::vector > scalarproducts; │ │ │ │ │ +226 │ │ │ │ │ +228 std::vector > > ksolvers; │ │ │ │ │ +229 }; │ │ │ │ │ +230 │ │ │ │ │ 231 │ │ │ │ │ -232 } // end Amg namespace │ │ │ │ │ -233 │ │ │ │ │ -234 │ │ │ │ │ -235#if HAVE_MPI │ │ │ │ │ -236 template │ │ │ │ │ -_2_3_7 struct CommPolicy > │ │ │ │ │ -238 { │ │ │ │ │ -_2_3_9 typedef _A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_> _T_y_p_e; │ │ │ │ │ -_2_4_0 typedef typename _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>_:_:_I_n_d_e_x_e_d_T_y_p_e _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -_2_4_1 typedef SizeOne _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ -_2_4_2 static int _g_e_t_S_i_z_e(const _T_y_p_e&, int) │ │ │ │ │ -243 { │ │ │ │ │ -244 return 1; │ │ │ │ │ -245 } │ │ │ │ │ -246 }; │ │ │ │ │ -247#endif │ │ │ │ │ -248 │ │ │ │ │ -249} // end Dune namespace │ │ │ │ │ -250 /* @} */ │ │ │ │ │ -251#endif │ │ │ │ │ -_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ │ -Provides classes for the Coloring process of AMG. │ │ │ │ │ -_p_i_n_f_o_._h_h │ │ │ │ │ -_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_:_:_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_:_:_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_:_:_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_:_:_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_:_:_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_,_ _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_:_:_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_:_:_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_:_:_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_:_:_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_:_:_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_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_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ │ -_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_:_:_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_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_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_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_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -const AggregateDescriptor * const_iterator │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_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_:_:_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_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_:_:_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_:_:_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_:_:_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 │ │ │ │ │ +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 │ │ │ │ │ +240 │ │ │ │ │ +241 template │ │ │ │ │ +242 template │ │ │ │ │ +_2_4_3 _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_K_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ +244 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ │ +245 std::size_t ksteps, double reduction, │ │ │ │ │ +246 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo) │ │ │ │ │ +247 : amg(fineOperator, criterion, smootherArgs, pinfo), │ │ │ │ │ +248 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction) │ │ │ │ │ +249 {} │ │ │ │ │ +250 │ │ │ │ │ +251 │ │ │ │ │ +252 template │ │ │ │ │ +_2_5_3 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ │ +254 { │ │ │ │ │ +255 amg.pre(x,b); │ │ │ │ │ +256 scalarproducts.reserve(amg.levels()); │ │ │ │ │ +257 ksolvers.reserve(amg.levels()); │ │ │ │ │ +258 │ │ │ │ │ +259 typename OperatorHierarchy::ParallelMatrixHierarchy::Iterator │ │ │ │ │ +260 matrix = amg.matrices_->matrices().coarsest(); │ │ │ │ │ +261 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +262 pinfo = amg.matrices_->parallelInformation().coarsest(); │ │ │ │ │ +263 bool hasCoarsest=(amg.levels()==amg.maxlevels()); │ │ │ │ │ +264 │ │ │ │ │ +265 if(hasCoarsest) { │ │ │ │ │ +266 if(matrix==amg.matrices_->matrices().finest()) │ │ │ │ │ +267 return; │ │ │ │ │ +268 --matrix; │ │ │ │ │ +269 --pinfo; │ │ │ │ │ +270 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ │ +(amg, amg.solver_))); │ │ │ │ │ +271 }else │ │ │ │ │ +272 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ │ +(amg, std::shared_ptr<_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_> >()))); │ │ │ │ │ +273 │ │ │ │ │ +274 std::ostringstream s; │ │ │ │ │ +275 │ │ │ │ │ +276 if(matrix!=amg.matrices_->matrices().finest()) │ │ │ │ │ +277 while(true) { │ │ │ │ │ +278 scalarproducts.push_back(createScalarProduct(*pinfo,category())); │ │ │ │ │ +279 std::shared_ptr > ks = │ │ │ │ │ +280 std::shared_ptr >(new _K_r_y_l_o_v_S_o_l_v_e_r(*matrix, * │ │ │ │ │ +(scalarproducts.back()), │ │ │ │ │ +281 *(ksolvers.back()), levelDefectReduction, │ │ │ │ │ +282 maxLevelKrylovSteps, 0)); │ │ │ │ │ +283 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ │ +(amg, ks))); │ │ │ │ │ +284 --matrix; │ │ │ │ │ +285 --pinfo; │ │ │ │ │ +286 if(matrix==amg.matrices_->matrices().finest()) │ │ │ │ │ +287 break; │ │ │ │ │ +288 } │ │ │ │ │ +289 } │ │ │ │ │ +290 │ │ │ │ │ +291 │ │ │ │ │ +292 template │ │ │ │ │ +_2_9_3 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_p_o_s_t(_D_o_m_a_i_n& x) │ │ │ │ │ +294 { │ │ │ │ │ +295 amg.post(x); │ │ │ │ │ +296 │ │ │ │ │ +297 } │ │ │ │ │ +298 │ │ │ │ │ +299 template │ │ │ │ │ +_3_0_0 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ │ +301 { │ │ │ │ │ +302 if(ksolvers.size()==0) │ │ │ │ │ +303 { │ │ │ │ │ +304 _R_a_n_g_e td=d; │ │ │ │ │ +305 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ +306 amg.solver_->apply(v,td,res); │ │ │ │ │ +307 }else │ │ │ │ │ +308 { │ │ │ │ │ +309 typedef typename Amg::LevelContext LevelContext; │ │ │ │ │ +310 std::shared_ptr levelContext(new LevelContext); │ │ │ │ │ +311 amg.initIteratorsWithFineLevel(*levelContext); │ │ │ │ │ +312 typedef typename std::vector > >::iterator │ │ │ │ │ +Iter; │ │ │ │ │ +313 for(Iter solver=ksolvers.begin(); solver!=ksolvers.end(); ++solver) │ │ │ │ │ +314 (*solver)->setLevelContext(levelContext); │ │ │ │ │ +315 ksolvers.back()->apply(v,d); │ │ │ │ │ +316 } │ │ │ │ │ +317 } │ │ │ │ │ +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 │ │ │ │ │ +_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ +Define general preconditioner interface. │ │ │ │ │ +_a_m_g_._h_h │ │ │ │ │ +The AMG preconditioner. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_a_p_p_l_y │ │ │ │ │ +void apply(Domain &v, const Range &d) │ │ │ │ │ +Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ │ +X Domain │ │ │ │ │ +The domain type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_K_A_M_G │ │ │ │ │ +KAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const │ │ │ │ │ +SmootherArgs &smootherArgs, const Parameters &parms, std::size_t │ │ │ │ │ +maxLevelKrylovSteps=3, double minDefectReduction=1e-1) │ │ │ │ │ +Construct a new amg with a specific coarse solver. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:233 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ │ +std::size_t maxlevels() │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:320 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ +SmootherTraits< Smoother >::Arguments SmootherArgs │ │ │ │ │ +The argument type for the construction of the smoother. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ │ +M Operator │ │ │ │ │ +The matrix operator type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_p_o_s_t │ │ │ │ │ +void post(Domain &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_R_a_n_g_e │ │ │ │ │ +X Range │ │ │ │ │ +The range type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:89 │ │ │ │ │ +_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_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ │ +void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ +Apply post smoothing on the current level. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_p_r_e │ │ │ │ │ +void pre(Domain &x, Range &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:253 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +PI ParallelInformation │ │ │ │ │ +The type of the parallel information. Either OwnerOverlapCommunication or │ │ │ │ │ +another type describing the... │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:80 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ -A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ -owner/overlap/copy sema... │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ │ -void copyCopyToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from copy data points to all other data points. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ -Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ │ -The type of the reverse lookup of indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ -const Communication< MPI_Comm > & communicator() const │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ -void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ -Communicate values from owner data points to all other data points. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ -const RemoteIndices & remoteIndices() const │ │ │ │ │ -Get the underlying remote indices. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ -Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ │ -The type of the parallel index set. │ │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y │ │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:70 │ │ │ │ │ -_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_P_u_b_l_i_s_h_e_r │ │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:131 │ │ │ │ │ -_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_:_:_A_m_g_:_:_K_A_M_G │ │ │ │ │ +an algebraic multigrid method using a Krylov-cycle. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ │ +Amg::Domain Domain │ │ │ │ │ +the type of the domain. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:157 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ +Amg::SmootherArgs SmootherArgs │ │ │ │ │ +The type of the arguments for construction of the smoothers. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:153 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +Amg::ParallelInformation ParallelInformation │ │ │ │ │ +the type of the parallelinformation to use. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ │ +Amg::CoarseSolver CoarseSolver │ │ │ │ │ +The type of the coarse solver. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ │ +Amg::OperatorHierarchy OperatorHierarchy │ │ │ │ │ +The type of the hierarchy of operators. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:147 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_R_a_n_g_e │ │ │ │ │ +Amg::Range Range │ │ │ │ │ +The type of the range. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:159 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +Amg::ScalarProduct ScalarProduct │ │ │ │ │ +The type of the scalar product. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:163 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_A_m_g │ │ │ │ │ +AMG< M, X, S, PI, A > Amg │ │ │ │ │ +The type of the underlying AMG. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:143 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ │ +Amg::Operator Operator │ │ │ │ │ +the type of the lineatr operator. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ +Amg::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ │ +The type of the hierarchy of parallel information. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:161 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_K_r_y_l_o_v_S_o_l_v_e_r │ │ │ │ │ +K KrylovSolver │ │ │ │ │ +The type of the Krylov solver for the cycle. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:145 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ +Two grid operator for AMG with Krylov cycle. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_p_r_e │ │ │ │ │ +void pre(typename AMG::Domain &x, typename AMG::Range &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ +KAmgTwoGrid(AMG &amg, std::shared_ptr< InverseOperator< Domain, Range > > │ │ │ │ │ +coarseSolver) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_~_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ +~KAmgTwoGrid() │ │ │ │ │ +Destructor. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_p_o_s_t │ │ │ │ │ +void post(typename AMG::Domain &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:62 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_s_e_t_L_e_v_e_l_C_o_n_t_e_x_t │ │ │ │ │ +void setLevelContext(std::shared_ptr< typename AMG::LevelContext > p) │ │ │ │ │ +Set the level context pointer. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_c_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ │ +InverseOperator< Domain, Range > * coarseSolver() │ │ │ │ │ +Get a pointer to the coarse grid solver. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_a_p_p_l_y │ │ │ │ │ +void apply(typename AMG::Domain &v, const typename AMG::Range &d) │ │ │ │ │ +Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G │ │ │ │ │ +Parallel algebraic multigrid based on agglomeration. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ │ +> Iterator │ │ │ │ │ +Type of the mutable iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ +The hierarchies build by the coarsening process. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +All parameters for AMG. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ +_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:32 │ │ │ │ │ +_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:48 │ │ │ │ │ +_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:99 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ +Category │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ │ +Generalized preconditioned conjugate gradient solver. │ │ │ │ │ +DDeeffiinniittiioonn solvers.hh:1307 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00122.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: aggregates.hh File Reference │ │ │ │ +dune-istl: fastamg.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,110 +72,74 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Macros
│ │ │ │ +
fastamg.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

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 "parameters.hh"
│ │ │ │ -#include "graph.hh"
│ │ │ │ -#include "properties.hh"
│ │ │ │ -#include "combinedfunctor.hh"
│ │ │ │ -#include <dune/common/timer.hh>
│ │ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ │ -#include <dune/common/poolallocator.hh>
│ │ │ │ -#include <dune/common/sllist.hh>
│ │ │ │ -#include <dune/common/ftraits.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <set>
│ │ │ │ -#include <algorithm>
│ │ │ │ -#include <complex>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <ostream>
│ │ │ │ -#include <tuple>
│ │ │ │ +
#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::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...
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
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Functions

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)
 

│ │ │ │ +Macros

#define DIRECTSOLVER   SuperLU
 
│ │ │ │

Detailed Description

│ │ │ │ -

Provides classes for the Coloring process of AMG.

│ │ │ │ +

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,104 +1,51 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_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" │ │ │ │ │ _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_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_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_<_ _M_,_ _X_,_ _P_I_,_ _A_ _> │ │ │ │ │ +  A fast (sequential) algebraic multigrid based on agglomeration that │ │ │ │ │ + saves memory bandwidth. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -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) │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_I_R_E_C_T_S_O_L_V_E_R   SuperLU │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides classes for the Coloring process of AMG. │ │ │ │ │ +A fast AMG method, that currently only allows only Gauss-Seidel smoothing and │ │ │ │ │ +is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep │ │ │ │ │ +with the defect calculation to reduce memory transfers. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDIIRREECCTTSSOOLLVVEERR ********** │ │ │ │ │ +#define DIRECTSOLVER   SuperLU │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00122_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: aggregates.hh Source File │ │ │ │ +dune-istl: fastamg.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,2255 +74,662 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
aggregates.hh
│ │ │ │ +
fastamg.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AGGREGATES_HH
│ │ │ │ -
6#define DUNE_AMG_AGGREGATES_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_FASTAMG_HH
│ │ │ │ +
6#define DUNE_ISTL_FASTAMG_HH
│ │ │ │
7
│ │ │ │ -
8
│ │ │ │ -
9#include "parameters.hh"
│ │ │ │ -
10#include "graph.hh"
│ │ │ │ -
11#include "properties.hh"
│ │ │ │ -
12#include "combinedfunctor.hh"
│ │ │ │ -
13
│ │ │ │ -
14#include <dune/common/timer.hh>
│ │ │ │ -
15#include <dune/common/stdstreams.hh>
│ │ │ │ -
16#include <dune/common/poolallocator.hh>
│ │ │ │ -
17#include <dune/common/sllist.hh>
│ │ │ │ -
18#include <dune/common/ftraits.hh>
│ │ │ │ -
19#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
20
│ │ │ │ -
21#include <utility>
│ │ │ │ -
22#include <set>
│ │ │ │ -
23#include <algorithm>
│ │ │ │ -
24#include <complex>
│ │ │ │ -
25#include <limits>
│ │ │ │ -
26#include <ostream>
│ │ │ │ -
27#include <tuple>
│ │ │ │ -
28
│ │ │ │ -
29namespace Dune
│ │ │ │ -
30{
│ │ │ │ -
31 namespace Amg
│ │ │ │ -
32 {
│ │ │ │ -
33
│ │ │ │ -
47 template<class T>
│ │ │ │ -
│ │ │ │ -
48 class AggregationCriterion : public T
│ │ │ │ -
49 {
│ │ │ │ -
50
│ │ │ │ -
51 public:
│ │ │ │ - │ │ │ │ -
56
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
67 : T()
│ │ │ │ -
68 {}
│ │ │ │ +
8#include <memory>
│ │ │ │ +
9#include <dune/common/exceptions.hh>
│ │ │ │ +
10#include <dune/common/typetraits.hh>
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
14#include <dune/istl/solvers.hh>
│ │ │ │ + │ │ │ │ +
16#include <dune/istl/superlu.hh>
│ │ │ │ +
17#include <dune/istl/umfpack.hh>
│ │ │ │ + │ │ │ │ +
19#include <dune/istl/io.hh>
│ │ │ │ + │ │ │ │ +
21
│ │ │ │ +
22#include "fastamgsmoother.hh"
│ │ │ │ +
23
│ │ │ │ +
32namespace Dune
│ │ │ │ +
33{
│ │ │ │ +
34 namespace Amg
│ │ │ │ +
35 {
│ │ │ │ +
58 template<class M, class X, class PI=SequentialInformation, class A=std::allocator<X> >
│ │ │ │ +
│ │ │ │ +
59 class FastAMG : public Preconditioner<X,X>
│ │ │ │ +
60 {
│ │ │ │ +
61 public:
│ │ │ │ +
63 typedef M Operator;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
75
│ │ │ │ +
77 typedef X Domain;
│ │ │ │ +
79 typedef X Range;
│ │ │ │ + │ │ │ │ +
82
│ │ │ │ +
90 FastAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ │ +
91 const Parameters& parms,
│ │ │ │ +
92 bool symmetric=true);
│ │ │ │ +
93
│ │ │ │ +
105 template<class C>
│ │ │ │ +
106 FastAMG(const Operator& fineOperator, const C& criterion,
│ │ │ │ +
107 const Parameters& parms=Parameters(),
│ │ │ │ +
108 bool symmetric=true,
│ │ │ │ + │ │ │ │ +
110
│ │ │ │ +
114 FastAMG(const FastAMG& amg);
│ │ │ │ +
115
│ │ │ │ +
117 void pre(Domain& x, Range& b);
│ │ │ │ +
118
│ │ │ │ +
120 void apply(Domain& v, const Range& d);
│ │ │ │ +
121
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
124 {
│ │ │ │ + │ │ │ │ +
126 }
│ │ │ │ +
│ │ │ │ +
127
│ │ │ │ +
129 void post(Domain& x);
│ │ │ │ +
130
│ │ │ │ +
135 template<class A1>
│ │ │ │ +
136 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ │ +
137
│ │ │ │ +
138 std::size_t levels();
│ │ │ │ +
139
│ │ │ │ +
140 std::size_t maxlevels();
│ │ │ │ +
141
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
151 {
│ │ │ │ +
152 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ │ +
153 }
│ │ │ │ +
│ │ │ │ +
154
│ │ │ │ +
159 bool usesDirectCoarseLevelSolver() const;
│ │ │ │ +
160
│ │ │ │ +
161 private:
│ │ │ │ +
168 template<class C>
│ │ │ │ +
169 void createHierarchies(C& criterion,
│ │ │ │ +
170 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ +
171 const PI& pinfo);
│ │ │ │ +
172
│ │ │ │ +
179 struct LevelContext
│ │ │ │ +
180 {
│ │ │ │ +
184 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ │ + │ │ │ │ +
192 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ │ +
196 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
212 std::size_t level;
│ │ │ │ +
213 };
│ │ │ │ +
214
│ │ │ │ +
216 void mgc(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ │ +
217
│ │ │ │ +
224 void presmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ │ +
225
│ │ │ │ +
232 void postsmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ │ +
233
│ │ │ │ +
240 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel,
│ │ │ │ +
241 Domain& fineX);
│ │ │ │ +
242
│ │ │ │ +
247 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ │ +
248
│ │ │ │ +
253 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ │ +
254
│ │ │ │ +
256 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ │ +
258 std::shared_ptr<CoarseSolver> solver_;
│ │ │ │ +
260 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ │ +
262 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ │ +
264 std::shared_ptr<Hierarchy<Domain,A>> residual_;
│ │ │ │ +
265
│ │ │ │ + │ │ │ │ +
269 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ │ +
271 std::size_t gamma_;
│ │ │ │ +
273 std::size_t preSteps_;
│ │ │ │ +
275 std::size_t postSteps_;
│ │ │ │ +
276 std::size_t level;
│ │ │ │ +
277 bool buildHierarchy_;
│ │ │ │ +
278 bool symmetric;
│ │ │ │ +
279 bool coarsesolverconverged;
│ │ │ │ + │ │ │ │ +
281 typedef std::shared_ptr<Smoother> SmootherPointer;
│ │ │ │ +
282 SmootherPointer coarseSmoother_;
│ │ │ │ +
284 std::size_t verbosity_;
│ │ │ │ +
285 };
│ │ │ │ +
│ │ │ │ +
286
│ │ │ │ +
287 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
289 : matrices_(amg.matrices_), solver_(amg.solver_),
│ │ │ │ +
290 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_),
│ │ │ │ +
291 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ │ +
292 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ │ +
293 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_)
│ │ │ │ +
294 {}
│ │ │ │ +
│ │ │ │ +
295
│ │ │ │ +
296 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
298 const Parameters& parms, bool symmetric_)
│ │ │ │ +
299 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver),
│ │ │ │ +
300 rhs_(), lhs_(), residual_(), scalarProduct_(),
│ │ │ │ +
301 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ │ +
302 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ │ +
303 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ │ +
304 coarseSmoother_(), verbosity_(parms.debugLevel())
│ │ │ │ +
305 {
│ │ │ │ +
306 if(preSteps_>1||postSteps_>1)
│ │ │ │ +
307 {
│ │ │ │ +
308 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ │ +
309 preSteps_=postSteps_=0;
│ │ │ │ +
310 }
│ │ │ │ +
311 assert(matrices_->isBuilt());
│ │ │ │ +
312 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ │ +
313 "Currently only sequential runs are supported");
│ │ │ │ +
314 }
│ │ │ │ +
│ │ │ │ +
315 template<class M, class X, class PI, class A>
│ │ │ │ +
316 template<class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
318 const C& criterion,
│ │ │ │ +
319 const Parameters& parms,
│ │ │ │ +
320 bool symmetric_,
│ │ │ │ +
321 const PI& pinfo)
│ │ │ │ +
322 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_(parms.getGamma()),
│ │ │ │ +
323 preSteps_(parms.getNoPreSmoothSteps()), postSteps_(parms.getNoPostSmoothSteps()),
│ │ │ │ +
324 buildHierarchy_(true),
│ │ │ │ +
325 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ │ +
326 coarseSmoother_(), verbosity_(criterion.debugLevel())
│ │ │ │ +
327 {
│ │ │ │ +
328 if(preSteps_>1||postSteps_>1)
│ │ │ │ +
329 {
│ │ │ │ +
330 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ │ +
331 preSteps_=postSteps_=1;
│ │ │ │ +
332 }
│ │ │ │ +
333 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ │ +
334 "Currently only sequential runs are supported");
│ │ │ │ +
335 // TODO: reestablish compile time checks.
│ │ │ │ +
336 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ │ +
337 // "Matrix and Solver must match in terms of category!");
│ │ │ │ +
338 auto matrixptr = stackobject_to_shared_ptr(matrix);
│ │ │ │ +
339 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ │ +
340 }
│ │ │ │
│ │ │ │ -
69
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
71 : T(parms)
│ │ │ │ -
72 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
82 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
│ │ │ │ -
83 {
│ │ │ │ -
84 this->setMaxDistance(diameter-1);
│ │ │ │ -
85 std::size_t csize=1;
│ │ │ │ -
86
│ │ │ │ -
87 for(; dim>0; dim--) {
│ │ │ │ -
88 csize*=diameter;
│ │ │ │ -
89 this->setMaxDistance(this->maxDistance()+diameter-1);
│ │ │ │ -
90 }
│ │ │ │ -
91 this->setMinAggregateSize(csize);
│ │ │ │ -
92 this->setMaxAggregateSize(static_cast<std::size_t>(csize*1.5));
│ │ │ │ -
93 }
│ │ │ │ -
│ │ │ │ -
94
│ │ │ │ -
│ │ │ │ -
105 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
│ │ │ │ -
106 {
│ │ │ │ -
107 setDefaultValuesIsotropic(dim, diameter);
│ │ │ │ -
108 this->setMaxDistance(this->maxDistance()+dim-1);
│ │ │ │ -
109 }
│ │ │ │ -
│ │ │ │ -
110 };
│ │ │ │ -
│ │ │ │ -
111
│ │ │ │ -
112 template<class T>
│ │ │ │ -
│ │ │ │ -
113 std::ostream& operator<<(std::ostream& os, const AggregationCriterion<T>& criterion)
│ │ │ │ -
114 {
│ │ │ │ -
115 os<<"{ maxdistance="<<criterion.maxDistance()<<" minAggregateSize="
│ │ │ │ -
116 <<criterion.minAggregateSize()<< " maxAggregateSize="<<criterion.maxAggregateSize()
│ │ │ │ -
117 <<" connectivity="<<criterion.maxConnectivity()<<" debugLevel="<<criterion.debugLevel()<<"}";
│ │ │ │ -
118 return os;
│ │ │ │ -
119 }
│ │ │ │ -
│ │ │ │ -
120
│ │ │ │ -
132 template<class M, class N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
134 {
│ │ │ │ -
135 public:
│ │ │ │ -
139 typedef M Matrix;
│ │ │ │ -
140
│ │ │ │ -
144 typedef N Norm;
│ │ │ │ -
145
│ │ │ │ -
149 typedef typename Matrix::row_type Row;
│ │ │ │ -
150
│ │ │ │ - │ │ │ │ -
155
│ │ │ │ -
156 void init(const Matrix* matrix);
│ │ │ │ -
157
│ │ │ │ -
158 void initRow(const Row& row, int index);
│ │ │ │ -
159
│ │ │ │ -
160 void examine(const ColIter& col);
│ │ │ │ -
161
│ │ │ │ -
162 template<class G>
│ │ │ │ -
163 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ │ -
164
│ │ │ │ -
165 bool isIsolated();
│ │ │ │ -
166
│ │ │ │ -
167
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
169 : Parameters(parms)
│ │ │ │ -
170 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
172 : Parameters()
│ │ │ │ -
173 {}
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
175 protected:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
180 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
185 int row_;
│ │ │ │ - │ │ │ │ -
188 std::vector<real_type> vals_;
│ │ │ │ -
189 typename std::vector<real_type>::iterator valIter_;
│ │ │ │ -
190
│ │ │ │ -
191 };
│ │ │ │ -
│ │ │ │ -
192
│ │ │ │ -
193
│ │ │ │ -
194 template<class M, class N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
196 {
│ │ │ │ -
197 matrix_ = matrix;
│ │ │ │ -
198 }
│ │ │ │ -
│ │ │ │ -
199
│ │ │ │ -
200 template<class M, class N>
│ │ │ │ -
│ │ │ │ -
201 inline void SymmetricMatrixDependency<M,N>::initRow(const Row& row, int index)
│ │ │ │ -
202 {
│ │ │ │ -
203 using std::min;
│ │ │ │ -
204 vals_.assign(row.size(), 0.0);
│ │ │ │ -
205 assert(vals_.size()==row.size());
│ │ │ │ -
206 valIter_=vals_.begin();
│ │ │ │ -
207
│ │ │ │ -
208 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ │ -
209 diagonal_=norm_(row[index]);
│ │ │ │ -
210 row_ = index;
│ │ │ │ -
211 }
│ │ │ │ -
│ │ │ │ -
212
│ │ │ │ -
213 template<class M, class N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
215 {
│ │ │ │ -
216 using std::max;
│ │ │ │ -
217 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ │ -
218 real_type eij = norm_(*col);
│ │ │ │ -
219 if(!N::is_sign_preserving || eij<0) // || eji<0)
│ │ │ │ -
220 {
│ │ │ │ -
221 *valIter_ = eij/diagonal_*eij/norm_(matrix_->operator[](col.index())[col.index()]);
│ │ │ │ -
222 maxValue_ = max(maxValue_, *valIter_);
│ │ │ │ -
223 }else
│ │ │ │ -
224 *valIter_ =0;
│ │ │ │ -
225 ++valIter_;
│ │ │ │ -
226 }
│ │ │ │ -
│ │ │ │ -
227
│ │ │ │ -
228 template<class M, class N>
│ │ │ │ -
229 template<class G>
│ │ │ │ -
│ │ │ │ -
230 inline void SymmetricMatrixDependency<M,N>::examine(G&, const typename G::EdgeIterator& edge, const ColIter&)
│ │ │ │ -
231 {
│ │ │ │ -
232 if(*valIter_ > alpha() * maxValue_) {
│ │ │ │ -
233 edge.properties().setDepends();
│ │ │ │ -
234 edge.properties().setInfluences();
│ │ │ │ -
235 }
│ │ │ │ -
236 ++valIter_;
│ │ │ │ -
237 }
│ │ │ │ -
│ │ │ │ -
238
│ │ │ │ -
239 template<class M, class N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
241 {
│ │ │ │ -
242 if(diagonal_==0)
│ │ │ │ -
243 DUNE_THROW(Dune::ISTLError, "No diagonal entry for row "<<row_<<".");
│ │ │ │ -
244 valIter_=vals_.begin();
│ │ │ │ -
245 return maxValue_ < beta();
│ │ │ │ -
246 }
│ │ │ │ -
│ │ │ │ -
247
│ │ │ │ -
251 template<class M, class N>
│ │ │ │ -
│ │ │ │ -
252 class Dependency : public Parameters
│ │ │ │ -
253 {
│ │ │ │ -
254 public:
│ │ │ │ -
258 typedef M Matrix;
│ │ │ │ -
259
│ │ │ │ -
263 typedef N Norm;
│ │ │ │ -
264
│ │ │ │ -
268 typedef typename Matrix::row_type Row;
│ │ │ │ -
269
│ │ │ │ - │ │ │ │ -
274
│ │ │ │ -
275 void init(const Matrix* matrix);
│ │ │ │ -
276
│ │ │ │ -
277 void initRow(const Row& row, int index);
│ │ │ │ -
278
│ │ │ │ -
279 void examine(const ColIter& col);
│ │ │ │ -
280
│ │ │ │ -
281 template<class G>
│ │ │ │ -
282 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ │ -
283
│ │ │ │ - │ │ │ │ -
285
│ │ │ │ -
│ │ │ │ -
286 Dependency(const Parameters& parms)
│ │ │ │ -
287 : Parameters(parms)
│ │ │ │ -
288 {}
│ │ │ │ -
│ │ │ │ -
289
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
291 : Parameters()
│ │ │ │ -
292 {}
│ │ │ │ -
│ │ │ │ -
293
│ │ │ │ -
294 protected:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
299 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
304 int row_;
│ │ │ │ - │ │ │ │ -
307 };
│ │ │ │ -
│ │ │ │ -
308
│ │ │ │ -
312 template<class M, class N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
314 {
│ │ │ │ -
315 public:
│ │ │ │ -
319 typedef M Matrix;
│ │ │ │ -
320
│ │ │ │ -
324 typedef N Norm;
│ │ │ │ -
325
│ │ │ │ -
329 typedef typename Matrix::row_type Row;
│ │ │ │ -
330
│ │ │ │ - │ │ │ │ -
335
│ │ │ │ -
336 void init(const Matrix* matrix);
│ │ │ │ -
337
│ │ │ │ -
338 void initRow(const Row& row, int index);
│ │ │ │ -
339
│ │ │ │ -
340 void examine(const ColIter& col);
│ │ │ │
341
│ │ │ │ -
342 template<class G>
│ │ │ │ -
343 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ │ -
344
│ │ │ │ - │ │ │ │ -
346
│ │ │ │ -
347
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
349 : Parameters(parms)
│ │ │ │ -
350 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
352 : Parameters()
│ │ │ │ -
353 {}
│ │ │ │ -
│ │ │ │ +
342 template<class M, class X, class PI, class A>
│ │ │ │ +
343 template<class C>
│ │ │ │ +
344 void FastAMG<M,X,PI,A>::createHierarchies(C& criterion,
│ │ │ │ +
345 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ +
346 const PI& pinfo)
│ │ │ │ +
347 {
│ │ │ │ +
348 Timer watch;
│ │ │ │ +
349 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ │ +
350 std::const_pointer_cast<Operator>(matrixptr),
│ │ │ │ +
351 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ │ +
352
│ │ │ │ +
353 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ │
354
│ │ │ │ -
355 protected:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
360 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
365 int row_;
│ │ │ │ - │ │ │ │ -
368 private:
│ │ │ │ -
369 void initRow(const Row& row, int index, const std::true_type&);
│ │ │ │ -
370 void initRow(const Row& row, int index, const std::false_type&);
│ │ │ │ -
371 };
│ │ │ │ -
│ │ │ │ -
372
│ │ │ │ -
377 template<int N>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
379 {
│ │ │ │ -
380 public:
│ │ │ │ -
381 enum { /* @brief We preserve the sign.*/
│ │ │ │ -
382 is_sign_preserving = true
│ │ │ │ -
383 };
│ │ │ │ -
384
│ │ │ │ -
389 template<class M>
│ │ │ │ -
│ │ │ │ -
390 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m,
│ │ │ │ -
391 [[maybe_unused]] typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr) const
│ │ │ │ -
392 {
│ │ │ │ -
393 typedef typename M::field_type field_type;
│ │ │ │ -
394 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ -
395 static_assert( std::is_convertible<field_type, real_type >::value,
│ │ │ │ -
396 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ │ -
397 return m[N][N];
│ │ │ │ -
398 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ │ -
399 }
│ │ │ │ -
│ │ │ │ -
400
│ │ │ │ -
405 template<class M>
│ │ │ │ -
│ │ │ │ -
406 auto operator()(const M& m,
│ │ │ │ -
407 typename std::enable_if_t<Dune::IsNumber<M>::value>* sfinae = nullptr) const
│ │ │ │ -
408 {
│ │ │ │ -
409 typedef typename FieldTraits<M>::real_type real_type;
│ │ │ │ -
410 static_assert( std::is_convertible<M, real_type >::value,
│ │ │ │ -
411 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ │ -
412 return m;
│ │ │ │ -
413 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ │ -
414 }
│ │ │ │ -
│ │ │ │ -
415
│ │ │ │ -
416 private:
│ │ │ │ -
417
│ │ │ │ -
419 template<typename T>
│ │ │ │ -
420 static T signed_abs(const T & v)
│ │ │ │ -
421 {
│ │ │ │ -
422 return v;
│ │ │ │ -
423 }
│ │ │ │ +
355 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ │ +
356 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
357
│ │ │ │ +
358 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()) {
│ │ │ │ +
359 // We have the carsest level. Create the coarse Solver
│ │ │ │ +
360 typedef typename SmootherTraits<Smoother>::Arguments SmootherArgs;
│ │ │ │ +
361 SmootherArgs sargs;
│ │ │ │ +
362 sargs.iterations = 1;
│ │ │ │ +
363
│ │ │ │ + │ │ │ │ +
365 cargs.setArgs(sargs);
│ │ │ │ +
366 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ │ +
367 // Solve on the redistributed partitioning
│ │ │ │ +
368 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ │ +
369 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ │ +
370 }else{
│ │ │ │ +
371 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ │ +
372 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ │ +
373 }
│ │ │ │ +
374
│ │ │ │ +
375 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ │ +
376 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ │ +
377
│ │ │ │ +
378#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
379#if HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
380#define DIRECTSOLVER UMFPack
│ │ │ │ +
381#else
│ │ │ │ +
382#define DIRECTSOLVER SuperLU
│ │ │ │ +
383#endif
│ │ │ │ +
384 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ │ +
385 if(std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ │ +
386 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ │ +
387 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ │ +
388 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ │ +
389 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0)) { // redistribute and 1 proc
│ │ │ │ +
390 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ │ +
391 std::cout<<"Using superlu"<<std::endl;
│ │ │ │ +
392 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ +
393 {
│ │ │ │ +
394 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ +
395 // We are still participating on this level
│ │ │ │ +
396 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ │ +
397 else
│ │ │ │ +
398 solver_.reset();
│ │ │ │ +
399 }else
│ │ │ │ +
400 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ │ +
401 }else
│ │ │ │ +
402#undef DIRECTSOLVER
│ │ │ │ +
403#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
404 {
│ │ │ │ +
405 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ +
406 {
│ │ │ │ +
407 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ +
408 // We are still participating on this level
│ │ │ │ +
409 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ │ +
410 *scalarProduct_,
│ │ │ │ +
411 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ +
412 else
│ │ │ │ +
413 solver_.reset();
│ │ │ │ +
414 }else
│ │ │ │ +
415 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ │ +
416 *scalarProduct_,
│ │ │ │ +
417 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ +
418 }
│ │ │ │ +
419 }
│ │ │ │ +
420
│ │ │ │ +
421 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ │ +
422 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
423 }
│ │ │ │
424
│ │ │ │ -
426 template<typename T>
│ │ │ │ -
427 static T signed_abs(const std::complex<T> & v)
│ │ │ │ -
428 {
│ │ │ │ -
429 // return sign * abs_value
│ │ │ │ -
430 // in case of complex numbers this extends to using the csgn function to determine the sign
│ │ │ │ -
431 return csgn(v) * std::abs(v);
│ │ │ │ -
432 }
│ │ │ │ -
433
│ │ │ │ -
435 template<typename T>
│ │ │ │ -
436 static T csgn(const T & v)
│ │ │ │ -
437 {
│ │ │ │ -
438 return (T(0) < v) - (v < T(0));
│ │ │ │ -
439 }
│ │ │ │ +
425
│ │ │ │ +
426 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
428 {
│ │ │ │ +
429 Timer watch, watch1;
│ │ │ │ +
430 // Detect Matrix rows where all offdiagonal entries are
│ │ │ │ +
431 // zero and set x such that A_dd*x_d=b_d
│ │ │ │ +
432 // Thus users can be more careless when setting up their linear
│ │ │ │ +
433 // systems.
│ │ │ │ +
434 typedef typename M::matrix_type Matrix;
│ │ │ │ +
435 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ │ +
436 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ │ +
437 typedef typename Matrix::block_type Block;
│ │ │ │ +
438 Block zero;
│ │ │ │ +
439 zero=typename Matrix::field_type();
│ │ │ │
440
│ │ │ │ -
442 template<typename T>
│ │ │ │ -
443 static T csgn(std::complex<T> a)
│ │ │ │ -
444 {
│ │ │ │ -
445 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag());
│ │ │ │ -
446 }
│ │ │ │ -
447
│ │ │ │ -
448 };
│ │ │ │ -
│ │ │ │ -
449
│ │ │ │ -
│ │ │ │ -
454 class FirstDiagonal : public Diagonal<0>
│ │ │ │ -
455 {};
│ │ │ │ -
│ │ │ │ -
456
│ │ │ │ -
│ │ │ │ -
462 struct RowSum
│ │ │ │ -
463 {
│ │ │ │ -
464
│ │ │ │ -
465 enum { /* @brief We preserve the sign.*/
│ │ │ │ -
466 is_sign_preserving = false
│ │ │ │ -
467 };
│ │ │ │ -
472 template<class M>
│ │ │ │ -
│ │ │ │ -
473 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ │ -
474 {
│ │ │ │ -
475 return m.infinity_norm();
│ │ │ │ -
476 }
│ │ │ │ -
│ │ │ │ -
477 };
│ │ │ │ -
│ │ │ │ -
478
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
480 {
│ │ │ │ -
481
│ │ │ │ -
482 enum { /* @brief We preserve the sign.*/
│ │ │ │ -
483 is_sign_preserving = false
│ │ │ │ -
484 };
│ │ │ │ -
489 template<class M>
│ │ │ │ -
│ │ │ │ -
490 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ │ -
491 {
│ │ │ │ -
492 return m.frobenius_norm();
│ │ │ │ -
493 }
│ │ │ │ -
│ │ │ │ -
494 };
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
496 {
│ │ │ │ -
497
│ │ │ │ -
498 enum { /* @brief We preserve the sign.*/
│ │ │ │ -
499 is_sign_preserving = false
│ │ │ │ -
500 };
│ │ │ │ -
505 template<class M>
│ │ │ │ -
│ │ │ │ -
506 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ │ -
507 {
│ │ │ │ -
508 return 1;
│ │ │ │ -
509 }
│ │ │ │ -
│ │ │ │ -
510 };
│ │ │ │ -
│ │ │ │ -
517 template<class M, class Norm>
│ │ │ │ -
│ │ │ │ -
518 class SymmetricCriterion : public AggregationCriterion<SymmetricDependency<M,Norm> >
│ │ │ │ -
519 {
│ │ │ │ -
520 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
523 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
525 {}
│ │ │ │ -
│ │ │ │ -
526 };
│ │ │ │ -
│ │ │ │ -
527
│ │ │ │ -
528
│ │ │ │ -
537 template<class M, class Norm>
│ │ │ │ -
│ │ │ │ -
538 class UnSymmetricCriterion : public AggregationCriterion<Dependency<M,Norm> >
│ │ │ │ -
539 {
│ │ │ │ -
540 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
543 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
545 {}
│ │ │ │ -
│ │ │ │ -
546 };
│ │ │ │ -
│ │ │ │ -
547 // forward declaration
│ │ │ │ -
548 template<class G> class Aggregator;
│ │ │ │ -
549
│ │ │ │ -
550
│ │ │ │ -
558 template<class V>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
560 {
│ │ │ │ -
561 public:
│ │ │ │ -
562
│ │ │ │ -
566 static const V UNAGGREGATED;
│ │ │ │ +
441 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ │ +
442 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ │ +
443 bool isDirichlet = true;
│ │ │ │ +
444 bool hasDiagonal = false;
│ │ │ │ +
445 ColIter diag;
│ │ │ │ +
446 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ │ +
447 if(row.index()==col.index()) {
│ │ │ │ +
448 diag = col;
│ │ │ │ +
449 hasDiagonal = (*col != zero);
│ │ │ │ +
450 }else{
│ │ │ │ +
451 if(*col!=zero)
│ │ │ │ +
452 isDirichlet = false;
│ │ │ │ +
453 }
│ │ │ │ +
454 }
│ │ │ │ +
455 if(isDirichlet && hasDiagonal)
│ │ │ │ +
456 diag->solve(x[row.index()], b[row.index()]);
│ │ │ │ +
457 }
│ │ │ │ +
458 if (verbosity_>0)
│ │ │ │ +
459 std::cout<<" Preprocessing Dirichlet took "<<watch1.elapsed()<<std::endl;
│ │ │ │ +
460 watch1.reset();
│ │ │ │ +
461 // No smoother to make x consistent! Do it by hand
│ │ │ │ +
462 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ │ +
463 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ │ +
464 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ +
465 residual_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ +
466 matrices_->coarsenVector(*rhs_);
│ │ │ │ +
467 matrices_->coarsenVector(*lhs_);
│ │ │ │ +
468 matrices_->coarsenVector(*residual_);
│ │ │ │ +
469
│ │ │ │ +
470 // The preconditioner might change x and b. So we have to
│ │ │ │ +
471 // copy the changes to the original vectors.
│ │ │ │ +
472 x = *lhs_->finest();
│ │ │ │ +
473 b = *rhs_->finest();
│ │ │ │ +
474 }
│ │ │ │ +
│ │ │ │ +
475 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
477 {
│ │ │ │ +
478 return matrices_->levels();
│ │ │ │ +
479 }
│ │ │ │ +
│ │ │ │ +
480 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
482 {
│ │ │ │ +
483 return matrices_->maxlevels();
│ │ │ │ +
484 }
│ │ │ │ +
│ │ │ │ +
485
│ │ │ │ +
487 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
489 {
│ │ │ │ +
490 LevelContext levelContext;
│ │ │ │ +
491 // Init all iterators for the current level
│ │ │ │ +
492 initIteratorsWithFineLevel(levelContext);
│ │ │ │ +
493
│ │ │ │ +
494 assert(v.two_norm()==0);
│ │ │ │ +
495
│ │ │ │ +
496 level=0;
│ │ │ │ +
497 if(matrices_->maxlevels()==1){
│ │ │ │ +
498 // The coarse solver might modify the d!
│ │ │ │ +
499 Range b(d);
│ │ │ │ +
500 mgc(levelContext, v, b);
│ │ │ │ +
501 }else
│ │ │ │ +
502 mgc(levelContext, v, d);
│ │ │ │ +
503 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ │ +
504 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ │ +
505 }
│ │ │ │ +
│ │ │ │ +
506
│ │ │ │ +
507 template<class M, class X, class PI, class A>
│ │ │ │ +
508 void FastAMG<M,X,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ │ +
509 {
│ │ │ │ +
510 levelContext.matrix = matrices_->matrices().finest();
│ │ │ │ +
511 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ │ +
512 levelContext.redist =
│ │ │ │ +
513 matrices_->redistributeInformation().begin();
│ │ │ │ +
514 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ │ +
515 levelContext.lhs = lhs_->finest();
│ │ │ │ +
516 levelContext.residual = residual_->finest();
│ │ │ │ +
517 levelContext.rhs = rhs_->finest();
│ │ │ │ +
518 levelContext.level=0;
│ │ │ │ +
519 }
│ │ │ │ +
520
│ │ │ │ +
521 template<class M, class X, class PI, class A>
│ │ │ │ +
522 bool FastAMG<M,X,PI,A>
│ │ │ │ +
523 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ │ +
524 {
│ │ │ │ +
525 bool processNextLevel=true;
│ │ │ │ +
526
│ │ │ │ +
527 if(levelContext.redist->isSetup()) {
│ │ │ │ +
528 throw "bla";
│ │ │ │ +
529 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.residual),
│ │ │ │ +
530 levelContext.residual.getRedistributed());
│ │ │ │ +
531 processNextLevel = levelContext.residual.getRedistributed().size()>0;
│ │ │ │ +
532 if(processNextLevel) {
│ │ │ │ +
533 //restrict defect to coarse level right hand side.
│ │ │ │ +
534 ++levelContext.pinfo;
│ │ │ │ +
535 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
536 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ │ +
537 static_cast<const Range&>(levelContext.residual.getRedistributed()),
│ │ │ │ +
538 *levelContext.pinfo);
│ │ │ │ +
539 }
│ │ │ │ +
540 }else{
│ │ │ │ +
541 //restrict defect to coarse level right hand side.
│ │ │ │ +
542 ++levelContext.rhs;
│ │ │ │ +
543 ++levelContext.pinfo;
│ │ │ │ +
544 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
545 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ │ +
546 static_cast<const Range&>(*levelContext.residual), *levelContext.pinfo);
│ │ │ │ +
547 }
│ │ │ │ +
548
│ │ │ │ +
549 if(processNextLevel) {
│ │ │ │ +
550 // prepare coarse system
│ │ │ │ +
551 ++levelContext.residual;
│ │ │ │ +
552 ++levelContext.lhs;
│ │ │ │ +
553 ++levelContext.matrix;
│ │ │ │ +
554 ++levelContext.level;
│ │ │ │ +
555 ++levelContext.redist;
│ │ │ │ +
556
│ │ │ │ +
557 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ +
558 // next level is not the globally coarsest one
│ │ │ │ +
559 ++levelContext.aggregates;
│ │ │ │ +
560 }
│ │ │ │ +
561 // prepare the lhs on the next level
│ │ │ │ +
562 *levelContext.lhs=0;
│ │ │ │ +
563 *levelContext.residual=0;
│ │ │ │ +
564 }
│ │ │ │ +
565 return processNextLevel;
│ │ │ │ +
566 }
│ │ │ │
567
│ │ │ │ -
571 static const V ISOLATED;
│ │ │ │ - │ │ │ │ -
576
│ │ │ │ - │ │ │ │ -
581
│ │ │ │ -
586 typedef PoolAllocator<VertexDescriptor,100> Allocator;
│ │ │ │ +
568 template<class M, class X, class PI, class A>
│ │ │ │ +
569 void FastAMG<M,X,PI,A>
│ │ │ │ +
570 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, Domain& x)
│ │ │ │ +
571 {
│ │ │ │ +
572 if(processNextLevel) {
│ │ │ │ +
573 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ +
574 // previous level is not the globally coarsest one
│ │ │ │ +
575 --levelContext.aggregates;
│ │ │ │ +
576 }
│ │ │ │ +
577 --levelContext.redist;
│ │ │ │ +
578 --levelContext.level;
│ │ │ │ +
579 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ │ +
580 --levelContext.matrix;
│ │ │ │ +
581 --levelContext.residual;
│ │ │ │ +
582
│ │ │ │ +
583 }
│ │ │ │ +
584
│ │ │ │ +
585 typename Hierarchy<Domain,A>::Iterator coarseLhs = levelContext.lhs--;
│ │ │ │ +
586 if(levelContext.redist->isSetup()) {
│ │ │ │
587
│ │ │ │ -
592 typedef SLList<VertexDescriptor,Allocator> VertexList;
│ │ │ │ -
593
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
598 {
│ │ │ │ -
599 public:
│ │ │ │ -
600 template<class EdgeIterator>
│ │ │ │ -
│ │ │ │ -
601 void operator()([[maybe_unused]] const EdgeIterator& edge) const
│ │ │ │ -
602 {}
│ │ │ │ -
│ │ │ │ -
603 };
│ │ │ │ -
│ │ │ │ -
604
│ │ │ │ -
605
│ │ │ │ - │ │ │ │ -
610
│ │ │ │ - │ │ │ │ -
617
│ │ │ │ - │ │ │ │ -
622
│ │ │ │ -
634 template<class M, class G, class C>
│ │ │ │ -
635 std::tuple<int,int,int,int> buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ │ -
636 bool finestLevel);
│ │ │ │ -
637
│ │ │ │ -
655 template<bool reset, class G, class F, class VM>
│ │ │ │ -
656 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ │ -
657 const AggregateDescriptor& aggregate,
│ │ │ │ -
658 const G& graph,
│ │ │ │ -
659 F& aggregateVisitor,
│ │ │ │ -
660 VM& visitedMap) const;
│ │ │ │ -
661
│ │ │ │ -
685 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ │ -
686 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ │ -
687 const AggregateDescriptor& aggregate,
│ │ │ │ -
688 const G& graph, L& visited, F1& aggregateVisitor,
│ │ │ │ -
689 F2& nonAggregateVisitor,
│ │ │ │ -
690 VM& visitedMap) const;
│ │ │ │ +
588 // Need to redistribute during prolongate
│ │ │ │ +
589 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
590 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ │ +
591 levelContext.lhs.getRedistributed(),
│ │ │ │ +
592 matrices_->getProlongationDampingFactor(),
│ │ │ │ +
593 *levelContext.pinfo, *levelContext.redist);
│ │ │ │ +
594 }else{
│ │ │ │ +
595 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
596 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ │ +
597 matrices_->getProlongationDampingFactor(), *levelContext.pinfo);
│ │ │ │ +
598
│ │ │ │ +
599 // printvector(std::cout, *lhs, "prolongated coarse grid correction", "lhs", 10, 10, 10);
│ │ │ │ +
600 }
│ │ │ │ +
601
│ │ │ │ +
602
│ │ │ │ +
603 if(processNextLevel) {
│ │ │ │ +
604 --levelContext.rhs;
│ │ │ │ +
605 }
│ │ │ │ +
606
│ │ │ │ +
607 }
│ │ │ │ +
608
│ │ │ │ +
609
│ │ │ │ +
610 template<class M, class X, class PI, class A>
│ │ │ │ +
611 void FastAMG<M,X,PI,A>
│ │ │ │ +
612 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ │ +
613 {
│ │ │ │ +
614 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ │ +
615 GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(),
│ │ │ │ +
616 x,
│ │ │ │ +
617 *levelContext.residual,
│ │ │ │ +
618 b);
│ │ │ │ +
619 }
│ │ │ │ +
620
│ │ │ │ +
621 template<class M, class X, class PI, class A>
│ │ │ │ +
622 void FastAMG<M,X,PI,A>
│ │ │ │ +
623 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ │ +
624 {
│ │ │ │ +
625 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ │ +
626 GaussSeidelPostsmoothDefect<bl>
│ │ │ │ +
627 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b);
│ │ │ │ +
628 }
│ │ │ │ +
629
│ │ │ │ +
630
│ │ │ │ +
631 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
633 {
│ │ │ │ + │ │ │ │ +
635 }
│ │ │ │ +
│ │ │ │ +
636
│ │ │ │ +
637 template<class M, class X, class PI, class A>
│ │ │ │ +
638 void FastAMG<M,X,PI,A>::mgc(LevelContext& levelContext, Domain& v, const Range& b){
│ │ │ │ +
639
│ │ │ │ +
640 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ │ +
641 // Solve directly
│ │ │ │ + │ │ │ │ +
643 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ │ +
644 if(levelContext.redist->isSetup()) {
│ │ │ │ +
645 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed());
│ │ │ │ +
646 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ │ +
647 // We are still participating in the computation
│ │ │ │ +
648 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ │ +
649 levelContext.rhs.getRedistributed());
│ │ │ │ +
650 solver_->apply(levelContext.lhs.getRedistributed(), levelContext.rhs.getRedistributed(), res);
│ │ │ │ +
651 }
│ │ │ │ +
652 levelContext.redist->redistributeBackward(v, levelContext.lhs.getRedistributed());
│ │ │ │ +
653 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ │ +
654 }else{
│ │ │ │ +
655 levelContext.pinfo->copyOwnerToAll(b, b);
│ │ │ │ +
656 solver_->apply(v, const_cast<Range&>(b), res);
│ │ │ │ +
657 }
│ │ │ │ +
658
│ │ │ │ +
659 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10);
│ │ │ │ +
660 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10);
│ │ │ │ +
661 if (!res.converged)
│ │ │ │ +
662 coarsesolverconverged = false;
│ │ │ │ +
663 }else{
│ │ │ │ +
664 // presmoothing
│ │ │ │ +
665 presmooth(levelContext, v, b);
│ │ │ │ +
666 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10);
│ │ │ │ +
667 // printvector(std::cout, *residual, "post presmooth residual", "r", 10);
│ │ │ │ +
668#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ │ +
669 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ │ +
670
│ │ │ │ +
671 if(processNextLevel) {
│ │ │ │ +
672 // next level
│ │ │ │ +
673 for(std::size_t i=0; i<gamma_; i++)
│ │ │ │ +
674 mgc(levelContext, *levelContext.lhs, *levelContext.rhs);
│ │ │ │ +
675 }
│ │ │ │ +
676
│ │ │ │ +
677 moveToFineLevel(levelContext, processNextLevel, v);
│ │ │ │ +
678#else
│ │ │ │ +
679 *lhs=0;
│ │ │ │ +
680#endif
│ │ │ │ +
681
│ │ │ │ +
682 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ │ +
683 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ │ +
684 if(!coarsesolverconverged)
│ │ │ │ +
685 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ │ +
686 }
│ │ │ │ +
687
│ │ │ │ +
688 postsmooth(levelContext, v, b);
│ │ │ │ +
689 }
│ │ │ │ +
690 }
│ │ │ │
691
│ │ │ │ -
697 void allocate(std::size_t noVertices);
│ │ │ │ -
698
│ │ │ │ -
702 std::size_t noVertices() const;
│ │ │ │ -
703
│ │ │ │ -
707 void free();
│ │ │ │ -
708
│ │ │ │ - │ │ │ │ -
715
│ │ │ │ - │ │ │ │ -
722
│ │ │ │ - │ │ │ │ -
724
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
726 {
│ │ │ │ -
727 return aggregates_;
│ │ │ │ -
728 }
│ │ │ │ -
│ │ │ │ -
729
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
731 {
│ │ │ │ -
732 return aggregates_+noVertices();
│ │ │ │ -
733 }
│ │ │ │ -
│ │ │ │ -
734
│ │ │ │ - │ │ │ │ -
736
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
738 {
│ │ │ │ -
739 return aggregates_;
│ │ │ │ -
740 }
│ │ │ │ -
│ │ │ │ -
741
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
743 {
│ │ │ │ -
744 return aggregates_+noVertices();
│ │ │ │ -
745 }
│ │ │ │ -
│ │ │ │ -
746 private:
│ │ │ │ -
748 AggregatesMap(const AggregatesMap<V>&) = delete;
│ │ │ │ -
750 AggregatesMap<V>& operator=(const AggregatesMap<V>&) = delete;
│ │ │ │ -
751
│ │ │ │ -
755 AggregateDescriptor* aggregates_;
│ │ │ │ -
756
│ │ │ │ -
760 std::size_t noVertices_;
│ │ │ │ -
761 };
│ │ │ │ +
692
│ │ │ │ +
694 template<class M, class X, class PI, class A>
│ │ │ │ +
│ │ │ │ +
695 void FastAMG<M,X,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ │ +
696 {
│ │ │ │ +
697 lhs_=nullptr;
│ │ │ │ +
698 rhs_=nullptr;
│ │ │ │ +
699 residual_=nullptr;
│ │ │ │ +
700 }
│ │ │ │ +
│ │ │ │ +
701
│ │ │ │ +
702 template<class M, class X, class PI, class A>
│ │ │ │ +
703 template<class A1>
│ │ │ │ +
│ │ │ │ +
704 void FastAMG<M,X,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ │ +
705 {
│ │ │ │ +
706 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ │ +
707 }
│ │ │ │
│ │ │ │ -
762
│ │ │ │ -
766 template<class G, class C>
│ │ │ │ -
767 void buildDependency(G& graph,
│ │ │ │ -
768 const typename C::Matrix& matrix,
│ │ │ │ -
769 C criterion,
│ │ │ │ -
770 bool finestLevel);
│ │ │ │ -
771
│ │ │ │ -
776 template<class G, class S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
778 {
│ │ │ │ -
779
│ │ │ │ -
780 public:
│ │ │ │ -
781
│ │ │ │ -
782 /***
│ │ │ │ -
783 * @brief The type of the matrix graph we work with.
│ │ │ │ -
784 */
│ │ │ │ -
785 typedef G MatrixGraph;
│ │ │ │ - │ │ │ │ -
790
│ │ │ │ -
795 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ │ -
796
│ │ │ │ -
801 typedef S VertexSet;
│ │ │ │ -
802
│ │ │ │ -
804 typedef typename VertexSet::const_iterator const_iterator;
│ │ │ │ -
805
│ │ │ │ -
809 typedef std::size_t* SphereMap;
│ │ │ │ -
810
│ │ │ │ - │ │ │ │ -
820 VertexSet& connectivity, std::vector<Vertex>& front_);
│ │ │ │ -
821
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
823 {
│ │ │ │ -
824 --id_;
│ │ │ │ -
825 }
│ │ │ │ -
│ │ │ │ -
826
│ │ │ │ -
833 void reconstruct(const Vertex& vertex);
│ │ │ │ -
834
│ │ │ │ -
838 void seed(const Vertex& vertex);
│ │ │ │ -
839
│ │ │ │ -
843 void add(const Vertex& vertex);
│ │ │ │ -
844
│ │ │ │ -
845 void add(std::vector<Vertex>& vertex);
│ │ │ │ -
849 void clear();
│ │ │ │ -
850
│ │ │ │ -
854 typename VertexSet::size_type size();
│ │ │ │ -
858 typename VertexSet::size_type connectSize();
│ │ │ │ -
859
│ │ │ │ -
863 int id();
│ │ │ │ -
864
│ │ │ │ - │ │ │ │ -
867
│ │ │ │ - │ │ │ │ -
870
│ │ │ │ -
871 private:
│ │ │ │ -
875 VertexSet vertices_;
│ │ │ │ -
876
│ │ │ │ -
881 int id_;
│ │ │ │ -
882
│ │ │ │ -
886 MatrixGraph& graph_;
│ │ │ │ -
887
│ │ │ │ -
891 AggregatesMap<Vertex>& aggregates_;
│ │ │ │ -
892
│ │ │ │ -
896 VertexSet& connected_;
│ │ │ │ -
897
│ │ │ │ -
901 std::vector<Vertex>& front_;
│ │ │ │ -
902 };
│ │ │ │ -
│ │ │ │ -
903
│ │ │ │ -
907 template<class G>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
909 {
│ │ │ │ -
910 public:
│ │ │ │ -
911
│ │ │ │ -
915 typedef G MatrixGraph;
│ │ │ │ -
916
│ │ │ │ - │ │ │ │ -
921
│ │ │ │ - │ │ │ │ -
924
│ │ │ │ - │ │ │ │ -
929
│ │ │ │ - │ │ │ │ -
934
│ │ │ │ -
951 template<class M, class C>
│ │ │ │ -
952 std::tuple<int,int,int,int> build(const M& m, G& graph,
│ │ │ │ -
953 AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ │ -
954 bool finestLevel);
│ │ │ │ -
955 private:
│ │ │ │ -
960 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ │ -
961
│ │ │ │ -
965 typedef SLList<Vertex,Allocator> VertexList;
│ │ │ │ -
966
│ │ │ │ -
970 typedef std::set<Vertex,std::less<Vertex>,Allocator> VertexSet;
│ │ │ │ -
971
│ │ │ │ -
975 typedef std::size_t* SphereMap;
│ │ │ │ -
976
│ │ │ │ -
980 MatrixGraph* graph_;
│ │ │ │ -
981
│ │ │ │ - │ │ │ │ -
986
│ │ │ │ -
990 std::vector<Vertex> front_;
│ │ │ │ -
991
│ │ │ │ -
995 VertexSet connected_;
│ │ │ │ -
996
│ │ │ │ -
1000 int size_;
│ │ │ │ -
1001
│ │ │ │ -
1005 class Stack
│ │ │ │ -
1006 {
│ │ │ │ -
1007 public:
│ │ │ │ -
1008 static const Vertex NullEntry;
│ │ │ │ -
1009
│ │ │ │ -
1010 Stack(const MatrixGraph& graph,
│ │ │ │ -
1011 const Aggregator<G>& aggregatesBuilder,
│ │ │ │ -
1012 const AggregatesMap<Vertex>& aggregates);
│ │ │ │ - │ │ │ │ - │ │ │ │ -
1015 private:
│ │ │ │ -
1016 enum { N = 1300000 };
│ │ │ │ -
1017
│ │ │ │ -
1019 const MatrixGraph& graph_;
│ │ │ │ -
1021 const Aggregator<G>& aggregatesBuilder_;
│ │ │ │ -
1023 const AggregatesMap<Vertex>& aggregates_;
│ │ │ │ -
1025 int size_;
│ │ │ │ -
1026 Vertex maxSize_;
│ │ │ │ -
1028 typename MatrixGraph::ConstVertexIterator begin_;
│ │ │ │ - │ │ │ │ -
1030
│ │ │ │ -
1032 Vertex* vals_;
│ │ │ │ -
1033
│ │ │ │ -
1034 };
│ │ │ │ -
1035
│ │ │ │ -
1036 friend class Stack;
│ │ │ │ -
1037
│ │ │ │ -
1048 template<class V>
│ │ │ │ -
1049 void visitAggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ -
1050 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
1051 V& visitor) const;
│ │ │ │ -
1052
│ │ │ │ -
1057 template<class V>
│ │ │ │ -
1058 class AggregateVisitor
│ │ │ │ -
1059 {
│ │ │ │ -
1060 public:
│ │ │ │ -
1064 typedef V Visitor;
│ │ │ │ - │ │ │ │ -
1073 Visitor& visitor);
│ │ │ │ -
1074
│ │ │ │ -
1081 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ -
1082
│ │ │ │ -
1083 private:
│ │ │ │ -
1085 const AggregatesMap<Vertex>& aggregates_;
│ │ │ │ -
1087 AggregateDescriptor aggregate_;
│ │ │ │ -
1089 Visitor* visitor_;
│ │ │ │ -
1090 };
│ │ │ │ -
1091
│ │ │ │ -
1095 class Counter
│ │ │ │ -
1096 {
│ │ │ │ -
1097 public:
│ │ │ │ - │ │ │ │ -
1101 int value();
│ │ │ │ -
1102
│ │ │ │ -
1103 protected:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
1108
│ │ │ │ -
1109 private:
│ │ │ │ -
1110 int count_;
│ │ │ │ -
1111 };
│ │ │ │ -
1112
│ │ │ │ -
1113
│ │ │ │ -
1118 class FrontNeighbourCounter : public Counter
│ │ │ │ -
1119 {
│ │ │ │ -
1120 public:
│ │ │ │ - │ │ │ │ -
1126
│ │ │ │ -
1127 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ -
1128
│ │ │ │ -
1129 private:
│ │ │ │ -
1130 const MatrixGraph& graph_;
│ │ │ │ -
1131 };
│ │ │ │ -
1132
│ │ │ │ -
1137 int noFrontNeighbours(const Vertex& vertex) const;
│ │ │ │ -
1138
│ │ │ │ -
1142 class TwoWayCounter : public Counter
│ │ │ │ -
1143 {
│ │ │ │ -
1144 public:
│ │ │ │ -
1145 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ -
1146 };
│ │ │ │ -
1147
│ │ │ │ -
1159 int twoWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ │ -
1160 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1161
│ │ │ │ -
1165 class OneWayCounter : public Counter
│ │ │ │ -
1166 {
│ │ │ │ -
1167 public:
│ │ │ │ -
1168 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ -
1169 };
│ │ │ │ -
1170
│ │ │ │ -
1182 int oneWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ │ -
1183 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1184
│ │ │ │ -
1191 class ConnectivityCounter : public Counter
│ │ │ │ -
1192 {
│ │ │ │ -
1193 public:
│ │ │ │ -
1200 ConnectivityCounter(const VertexSet& connected, const AggregatesMap<Vertex>& aggregates);
│ │ │ │ -
1201
│ │ │ │ -
1202 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ -
1203
│ │ │ │ -
1204 private:
│ │ │ │ -
1206 const VertexSet& connected_;
│ │ │ │ -
1208 const AggregatesMap<Vertex>& aggregates_;
│ │ │ │ -
1209
│ │ │ │ -
1210 };
│ │ │ │ -
1211
│ │ │ │ -
1223 double connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1231 bool connected(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ -
1232 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1233
│ │ │ │ -
1241 bool connected(const Vertex& vertex, const SLList<AggregateDescriptor>& aggregateList,
│ │ │ │ -
1242 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1243
│ │ │ │ -
1251 class DependencyCounter : public Counter
│ │ │ │ -
1252 {
│ │ │ │ -
1253 public:
│ │ │ │ - │ │ │ │ -
1258
│ │ │ │ -
1259 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ -
1260 };
│ │ │ │ -
1261
│ │ │ │ -
1268 class FrontMarker
│ │ │ │ -
1269 {
│ │ │ │ -
1270 public:
│ │ │ │ -
1277 FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph);
│ │ │ │ -
1278
│ │ │ │ -
1279 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ -
1280
│ │ │ │ -
1281 private:
│ │ │ │ -
1283 std::vector<Vertex>& front_;
│ │ │ │ -
1285 MatrixGraph& graph_;
│ │ │ │ -
1286 };
│ │ │ │ -
1287
│ │ │ │ -
1291 void unmarkFront();
│ │ │ │ -
1292
│ │ │ │ -
1307 int unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1308
│ │ │ │ -
1322 std::pair<int,int> neighbours(const Vertex& vertex,
│ │ │ │ -
1323 const AggregateDescriptor& aggregate,
│ │ │ │ -
1324 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1341 int aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1342
│ │ │ │ -
1350 bool admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1351
│ │ │ │ -
1359 std::size_t distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates);
│ │ │ │ -
1360
│ │ │ │ -
1369 Vertex mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ -
1370
│ │ │ │ -
1379 void nonisoNeighbourAggregate(const Vertex& vertex,
│ │ │ │ -
1380 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
1381 SLList<Vertex>& neighbours) const;
│ │ │ │ -
1382
│ │ │ │ -
1390 template<class C>
│ │ │ │ -
1391 void growAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ │ -
1392 template<class C>
│ │ │ │ -
1393 void growIsolatedAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ │ -
1394 };
│ │ │ │ -
│ │ │ │ -
1395
│ │ │ │ -
1396#ifndef DOXYGEN
│ │ │ │ -
1397
│ │ │ │ -
1398 template<class M, class N>
│ │ │ │ -
1399 inline void SymmetricDependency<M,N>::init(const Matrix* matrix)
│ │ │ │ -
1400 {
│ │ │ │ -
1401 matrix_ = matrix;
│ │ │ │ -
1402 }
│ │ │ │ -
1403
│ │ │ │ -
1404 template<class M, class N>
│ │ │ │ -
1405 inline void SymmetricDependency<M,N>::initRow(const Row& row, int index)
│ │ │ │ -
1406 {
│ │ │ │ -
1407 initRow(row, index, std::is_convertible<field_type, real_type>());
│ │ │ │ -
1408 }
│ │ │ │ -
1409
│ │ │ │ -
1410 template<class M, class N>
│ │ │ │ -
1411 inline void SymmetricDependency<M,N>::initRow(const Row& row, int index, const std::false_type&)
│ │ │ │ -
1412 {
│ │ │ │ -
1413 DUNE_THROW(InvalidStateException, "field_type needs to convertible to real_type");
│ │ │ │ -
1414 }
│ │ │ │ -
1415
│ │ │ │ -
1416 template<class M, class N>
│ │ │ │ -
1417 inline void SymmetricDependency<M,N>::initRow([[maybe_unused]] const Row& row, int index, const std::true_type&)
│ │ │ │ -
1418 {
│ │ │ │ -
1419 using std::min;
│ │ │ │ -
1420 maxValue_ = min(- std::numeric_limits<typename Matrix::field_type>::max(), std::numeric_limits<typename Matrix::field_type>::min());
│ │ │ │ -
1421 row_ = index;
│ │ │ │ -
1422 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ │ -
1423 }
│ │ │ │ -
1424
│ │ │ │ -
1425 template<class M, class N>
│ │ │ │ -
1426 inline void SymmetricDependency<M,N>::examine(const ColIter& col)
│ │ │ │ -
1427 {
│ │ │ │ -
1428 using std::max;
│ │ │ │ -
1429 real_type eij = norm_(*col);
│ │ │ │ -
1430 typename Matrix::ConstColIterator opposite_entry =
│ │ │ │ -
1431 matrix_->operator[](col.index()).find(row_);
│ │ │ │ -
1432 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ │ -
1433 {
│ │ │ │ -
1434 // Consider this a weak connection we disregard.
│ │ │ │ -
1435 return;
│ │ │ │ -
1436 }
│ │ │ │ -
1437 real_type eji = norm_(*opposite_entry);
│ │ │ │ -
1438
│ │ │ │ -
1439 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ │ -
1440 if(!N::is_sign_preserving || eij<0 || eji<0)
│ │ │ │ -
1441 maxValue_ = max(maxValue_,
│ │ │ │ -
1442 eij /diagonal_ * eji/
│ │ │ │ -
1443 norm_(matrix_->operator[](col.index())[col.index()]));
│ │ │ │ -
1444 }
│ │ │ │ -
1445
│ │ │ │ -
1446 template<class M, class N>
│ │ │ │ -
1447 template<class G>
│ │ │ │ -
1448 inline void SymmetricDependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ │ -
1449 {
│ │ │ │ -
1450 real_type eij = norm_(*col);
│ │ │ │ -
1451 typename Matrix::ConstColIterator opposite_entry =
│ │ │ │ -
1452 matrix_->operator[](col.index()).find(row_);
│ │ │ │ -
1453
│ │ │ │ -
1454 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ │ -
1455 {
│ │ │ │ -
1456 // Consider this as a weak connection we disregard.
│ │ │ │ -
1457 return;
│ │ │ │ -
1458 }
│ │ │ │ -
1459 real_type eji = norm_(*opposite_entry);
│ │ │ │ -
1460 // skip positve offdiagonals if norm preserves sign of them.
│ │ │ │ -
1461 if(!N::is_sign_preserving || (eij<0 || eji<0))
│ │ │ │ -
1462 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) *
│ │ │ │ -
1463 eij/ diagonal_ > alpha() * maxValue_) {
│ │ │ │ -
1464 edge.properties().setDepends();
│ │ │ │ -
1465 edge.properties().setInfluences();
│ │ │ │ -
1466 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), edge.source());
│ │ │ │ -
1467 other.setInfluences();
│ │ │ │ -
1468 other.setDepends();
│ │ │ │ -
1469 }
│ │ │ │ -
1470 }
│ │ │ │ -
1471
│ │ │ │ -
1472 template<class M, class N>
│ │ │ │ - │ │ │ │ -
1474 {
│ │ │ │ -
1475 return maxValue_ < beta();
│ │ │ │ -
1476 }
│ │ │ │ -
1477
│ │ │ │ -
1478
│ │ │ │ -
1479 template<class M, class N>
│ │ │ │ -
1480 inline void Dependency<M,N>::init(const Matrix* matrix)
│ │ │ │ -
1481 {
│ │ │ │ -
1482 matrix_ = matrix;
│ │ │ │ -
1483 }
│ │ │ │ -
1484
│ │ │ │ -
1485 template<class M, class N>
│ │ │ │ -
1486 inline void Dependency<M,N>::initRow([[maybe_unused]] const Row& row, int index)
│ │ │ │ -
1487 {
│ │ │ │ -
1488 using std::min;
│ │ │ │ -
1489 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ │ -
1490 row_ = index;
│ │ │ │ -
1491 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ │ -
1492 }
│ │ │ │ -
1493
│ │ │ │ -
1494 template<class M, class N>
│ │ │ │ -
1495 inline void Dependency<M,N>::examine(const ColIter& col)
│ │ │ │ -
1496 {
│ │ │ │ -
1497 using std::max;
│ │ │ │ -
1498 maxValue_ = max(maxValue_, -norm_(*col));
│ │ │ │ -
1499 }
│ │ │ │ -
1500
│ │ │ │ -
1501 template<class M, class N>
│ │ │ │ -
1502 template<class G>
│ │ │ │ -
1503 inline void Dependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ │ -
1504 {
│ │ │ │ -
1505 if(-norm_(*col) >= maxValue_ * alpha()) {
│ │ │ │ -
1506 edge.properties().setDepends();
│ │ │ │ -
1507 typedef typename G::EdgeDescriptor ED;
│ │ │ │ -
1508 ED e= graph.findEdge(edge.target(), edge.source());
│ │ │ │ -
1509 if(e!=std::numeric_limits<ED>::max())
│ │ │ │ -
1510 {
│ │ │ │ -
1511 typename G::EdgeProperties& other = graph.getEdgeProperties(e);
│ │ │ │ -
1512 other.setInfluences();
│ │ │ │ -
1513 }
│ │ │ │ -
1514 }
│ │ │ │ -
1515 }
│ │ │ │ -
1516
│ │ │ │ -
1517 template<class M, class N>
│ │ │ │ -
1518 inline bool Dependency<M,N>::isIsolated()
│ │ │ │ -
1519 {
│ │ │ │ -
1520 return maxValue_ < beta() * diagonal_;
│ │ │ │ -
1521 }
│ │ │ │ -
1522
│ │ │ │ -
1523 template<class G,class S>
│ │ │ │ -
1524 Aggregate<G,S>::Aggregate(MatrixGraph& graph, AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
1525 VertexSet& connected, std::vector<Vertex>& front)
│ │ │ │ -
1526 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates),
│ │ │ │ -
1527 connected_(connected), front_(front)
│ │ │ │ -
1528 {}
│ │ │ │ -
1529
│ │ │ │ -
1530 template<class G,class S>
│ │ │ │ -
1531 void Aggregate<G,S>::reconstruct(const Vertex& vertex)
│ │ │ │ -
1532 {
│ │ │ │ -
1533 /*
│ │ │ │ -
1534 vertices_.push_back(vertex);
│ │ │ │ -
1535 typedef typename VertexList::const_iterator iterator;
│ │ │ │ -
1536 iterator begin = vertices_.begin();
│ │ │ │ -
1537 iterator end = vertices_.end();*/
│ │ │ │ -
1538 throw "Not yet implemented";
│ │ │ │ -
1539
│ │ │ │ -
1540 // while(begin!=end){
│ │ │ │ -
1541 //for();
│ │ │ │ -
1542 // }
│ │ │ │ -
1543
│ │ │ │ -
1544 }
│ │ │ │ -
1545
│ │ │ │ -
1546 template<class G,class S>
│ │ │ │ -
1547 inline void Aggregate<G,S>::seed(const Vertex& vertex)
│ │ │ │ -
1548 {
│ │ │ │ -
1549 dvverb<<"Connected cleared"<<std::endl;
│ │ │ │ -
1550 connected_.clear();
│ │ │ │ -
1551 vertices_.clear();
│ │ │ │ -
1552 connected_.insert(vertex);
│ │ │ │ -
1553 dvverb << " Inserting "<<vertex<<" size="<<connected_.size();
│ │ │ │ -
1554 ++id_ ;
│ │ │ │ -
1555 add(vertex);
│ │ │ │ -
1556 }
│ │ │ │ -
1557
│ │ │ │ -
1558
│ │ │ │ -
1559 template<class G,class S>
│ │ │ │ -
1560 inline void Aggregate<G,S>::add(const Vertex& vertex)
│ │ │ │ -
1561 {
│ │ │ │ -
1562 vertices_.insert(vertex);
│ │ │ │ -
1563 aggregates_[vertex]=id_;
│ │ │ │ -
1564 if(front_.size())
│ │ │ │ -
1565 front_.erase(std::lower_bound(front_.begin(), front_.end(), vertex));
│ │ │ │ -
1566
│ │ │ │ -
1567
│ │ │ │ -
1568 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ │ -
1569 const iterator end = graph_.endEdges(vertex);
│ │ │ │ -
1570 for(iterator edge = graph_.beginEdges(vertex); edge != end; ++edge) {
│ │ │ │ -
1571 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ │ -
1572 connected_.insert(aggregates_[edge.target()]);
│ │ │ │ -
1573 dvverb <<" size="<<connected_.size();
│ │ │ │ -
1574 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ │ -
1575 !graph_.getVertexProperties(edge.target()).front())
│ │ │ │ -
1576 {
│ │ │ │ -
1577 front_.push_back(edge.target());
│ │ │ │ -
1578 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ │ -
1579 }
│ │ │ │ -
1580 }
│ │ │ │ -
1581 dvverb <<std::endl;
│ │ │ │ -
1582 std::sort(front_.begin(), front_.end());
│ │ │ │ -
1583 }
│ │ │ │ -
1584
│ │ │ │ -
1585 template<class G,class S>
│ │ │ │ -
1586 inline void Aggregate<G,S>::add(std::vector<Vertex>& vertices)
│ │ │ │ -
1587 {
│ │ │ │ -
1588#ifndef NDEBUG
│ │ │ │ -
1589 std::size_t oldsize = vertices_.size();
│ │ │ │ -
1590#endif
│ │ │ │ -
1591 typedef typename std::vector<Vertex>::iterator Iterator;
│ │ │ │ -
1592
│ │ │ │ -
1593 typedef typename VertexSet::iterator SIterator;
│ │ │ │ -
1594
│ │ │ │ -
1595 SIterator pos=vertices_.begin();
│ │ │ │ -
1596 std::vector<Vertex> newFront;
│ │ │ │ -
1597 newFront.reserve(front_.capacity());
│ │ │ │ -
1598
│ │ │ │ -
1599 std::set_difference(front_.begin(), front_.end(), vertices.begin(), vertices.end(),
│ │ │ │ -
1600 std::back_inserter(newFront));
│ │ │ │ -
1601 front_=newFront;
│ │ │ │ -
1602
│ │ │ │ -
1603 for(Iterator vertex=vertices.begin(); vertex != vertices.end(); ++vertex)
│ │ │ │ -
1604 {
│ │ │ │ -
1605 pos=vertices_.insert(pos,*vertex);
│ │ │ │ -
1606 vertices_.insert(*vertex);
│ │ │ │ -
1607 graph_.getVertexProperties(*vertex).resetFront(); // Not a front node any more.
│ │ │ │ -
1608 aggregates_[*vertex]=id_;
│ │ │ │ -
1609
│ │ │ │ -
1610 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ │ -
1611 const iterator end = graph_.endEdges(*vertex);
│ │ │ │ -
1612 for(iterator edge = graph_.beginEdges(*vertex); edge != end; ++edge) {
│ │ │ │ -
1613 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ │ -
1614 connected_.insert(aggregates_[edge.target()]);
│ │ │ │ -
1615 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ │ -
1616 !graph_.getVertexProperties(edge.target()).front())
│ │ │ │ -
1617 {
│ │ │ │ -
1618 front_.push_back(edge.target());
│ │ │ │ -
1619 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ │ -
1620 }
│ │ │ │ -
1621 dvverb <<" size="<<connected_.size();
│ │ │ │ -
1622 }
│ │ │ │ -
1623 dvverb <<std::endl;
│ │ │ │ -
1624 }
│ │ │ │ -
1625 std::sort(front_.begin(), front_.end());
│ │ │ │ -
1626 assert(oldsize+vertices.size()==vertices_.size());
│ │ │ │ -
1627 }
│ │ │ │ -
1628 template<class G,class S>
│ │ │ │ -
1629 inline void Aggregate<G,S>::clear()
│ │ │ │ -
1630 {
│ │ │ │ -
1631 vertices_.clear();
│ │ │ │ -
1632 connected_.clear();
│ │ │ │ -
1633 id_=-1;
│ │ │ │ -
1634 }
│ │ │ │ -
1635
│ │ │ │ -
1636 template<class G,class S>
│ │ │ │ -
1637 inline typename Aggregate<G,S>::VertexSet::size_type
│ │ │ │ - │ │ │ │ -
1639 {
│ │ │ │ -
1640 return vertices_.size();
│ │ │ │ -
1641 }
│ │ │ │ -
1642
│ │ │ │ -
1643 template<class G,class S>
│ │ │ │ -
1644 inline typename Aggregate<G,S>::VertexSet::size_type
│ │ │ │ - │ │ │ │ -
1646 {
│ │ │ │ -
1647 return connected_.size();
│ │ │ │ -
1648 }
│ │ │ │ -
1649
│ │ │ │ -
1650 template<class G,class S>
│ │ │ │ -
1651 inline int Aggregate<G,S>::id()
│ │ │ │ -
1652 {
│ │ │ │ -
1653 return id_;
│ │ │ │ -
1654 }
│ │ │ │ -
1655
│ │ │ │ -
1656 template<class G,class S>
│ │ │ │ - │ │ │ │ -
1658 {
│ │ │ │ -
1659 return vertices_.begin();
│ │ │ │ -
1660 }
│ │ │ │ -
1661
│ │ │ │ -
1662 template<class G,class S>
│ │ │ │ - │ │ │ │ -
1664 {
│ │ │ │ -
1665 return vertices_.end();
│ │ │ │ -
1666 }
│ │ │ │ -
1667
│ │ │ │ -
1668 template<class V>
│ │ │ │ -
1669 const V AggregatesMap<V>::UNAGGREGATED = std::numeric_limits<V>::max();
│ │ │ │ -
1670
│ │ │ │ -
1671 template<class V>
│ │ │ │ -
1672 const V AggregatesMap<V>::ISOLATED = std::numeric_limits<V>::max()-1;
│ │ │ │ -
1673
│ │ │ │ -
1674 template<class V>
│ │ │ │ - │ │ │ │ -
1676 : aggregates_(0)
│ │ │ │ -
1677 {}
│ │ │ │ -
1678
│ │ │ │ -
1679 template<class V>
│ │ │ │ - │ │ │ │ -
1681 {
│ │ │ │ -
1682 if(aggregates_!=0)
│ │ │ │ -
1683 delete[] aggregates_;
│ │ │ │ -
1684 }
│ │ │ │ -
1685
│ │ │ │ -
1686
│ │ │ │ -
1687 template<class V>
│ │ │ │ -
1688 inline AggregatesMap<V>::AggregatesMap(std::size_t noVertices)
│ │ │ │ -
1689 {
│ │ │ │ -
1690 allocate(noVertices);
│ │ │ │ -
1691 }
│ │ │ │ -
1692
│ │ │ │ -
1693 template<class V>
│ │ │ │ -
1694 inline std::size_t AggregatesMap<V>::noVertices() const
│ │ │ │ -
1695 {
│ │ │ │ -
1696 return noVertices_;
│ │ │ │ -
1697 }
│ │ │ │ -
1698
│ │ │ │ -
1699 template<class V>
│ │ │ │ -
1700 inline void AggregatesMap<V>::allocate(std::size_t noVertices)
│ │ │ │ -
1701 {
│ │ │ │ -
1702 aggregates_ = new AggregateDescriptor[noVertices];
│ │ │ │ -
1703 noVertices_ = noVertices;
│ │ │ │ -
1704
│ │ │ │ -
1705 for(std::size_t i=0; i < noVertices; i++)
│ │ │ │ -
1706 aggregates_[i]=UNAGGREGATED;
│ │ │ │ -
1707 }
│ │ │ │ -
1708
│ │ │ │ -
1709 template<class V>
│ │ │ │ -
1710 inline void AggregatesMap<V>::free()
│ │ │ │ -
1711 {
│ │ │ │ -
1712 assert(aggregates_ != 0);
│ │ │ │ -
1713 delete[] aggregates_;
│ │ │ │ -
1714 aggregates_=0;
│ │ │ │ -
1715 }
│ │ │ │ -
1716
│ │ │ │ -
1717 template<class V>
│ │ │ │ - │ │ │ │ -
1719 AggregatesMap<V>::operator[](const VertexDescriptor& v)
│ │ │ │ -
1720 {
│ │ │ │ -
1721 return aggregates_[v];
│ │ │ │ -
1722 }
│ │ │ │ -
1723
│ │ │ │ -
1724 template<class V>
│ │ │ │ -
1725 inline const typename AggregatesMap<V>::AggregateDescriptor&
│ │ │ │ -
1726 AggregatesMap<V>::operator[](const VertexDescriptor& v) const
│ │ │ │ -
1727 {
│ │ │ │ -
1728 return aggregates_[v];
│ │ │ │ -
1729 }
│ │ │ │ -
1730
│ │ │ │ -
1731 template<class V>
│ │ │ │ -
1732 template<bool reset, class G, class F,class VM>
│ │ │ │ -
1733 inline std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ │ -
1734 const AggregateDescriptor& aggregate,
│ │ │ │ -
1735 const G& graph, F& aggregateVisitor,
│ │ │ │ -
1736 VM& visitedMap) const
│ │ │ │ -
1737 {
│ │ │ │ -
1738 VertexList vlist;
│ │ │ │ -
1739
│ │ │ │ -
1740 DummyEdgeVisitor dummy;
│ │ │ │ -
1741 return breadthFirstSearch<true,reset>(start, aggregate, graph, vlist, aggregateVisitor, dummy, visitedMap);
│ │ │ │ -
1742 }
│ │ │ │ -
1743
│ │ │ │ -
1744 template<class V>
│ │ │ │ -
1745 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ │ -
1746 std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ │ -
1747 const AggregateDescriptor& aggregate,
│ │ │ │ -
1748 const G& graph,
│ │ │ │ -
1749 L& visited,
│ │ │ │ -
1750 F1& aggregateVisitor,
│ │ │ │ -
1751 F2& nonAggregateVisitor,
│ │ │ │ -
1752 VM& visitedMap) const
│ │ │ │ -
1753 {
│ │ │ │ -
1754 typedef typename L::const_iterator ListIterator;
│ │ │ │ -
1755 int visitedSpheres = 0;
│ │ │ │ -
1756
│ │ │ │ -
1757 visited.push_back(start);
│ │ │ │ -
1758 put(visitedMap, start, true);
│ │ │ │ -
1759
│ │ │ │ -
1760 ListIterator current = visited.begin();
│ │ │ │ -
1761 ListIterator end = visited.end();
│ │ │ │ -
1762 std::size_t i=0, size=visited.size();
│ │ │ │ -
1763
│ │ │ │ -
1764 // visit the neighbours of all vertices of the
│ │ │ │ -
1765 // current sphere.
│ │ │ │ -
1766 while(current != end) {
│ │ │ │ -
1767
│ │ │ │ -
1768 for(; i<size; ++current, ++i) {
│ │ │ │ -
1769 typedef typename G::ConstEdgeIterator EdgeIterator;
│ │ │ │ -
1770 const EdgeIterator endEdge = graph.endEdges(*current);
│ │ │ │ -
1771
│ │ │ │ -
1772 for(EdgeIterator edge = graph.beginEdges(*current);
│ │ │ │ -
1773 edge != endEdge; ++edge) {
│ │ │ │ -
1774
│ │ │ │ -
1775 if(aggregates_[edge.target()]==aggregate) {
│ │ │ │ -
1776 if(!get(visitedMap, edge.target())) {
│ │ │ │ -
1777 put(visitedMap, edge.target(), true);
│ │ │ │ -
1778 visited.push_back(edge.target());
│ │ │ │ -
1779 aggregateVisitor(edge);
│ │ │ │ -
1780 }
│ │ │ │ -
1781 }else
│ │ │ │ -
1782 nonAggregateVisitor(edge);
│ │ │ │ -
1783 }
│ │ │ │ -
1784 }
│ │ │ │ -
1785 end = visited.end();
│ │ │ │ -
1786 size = visited.size();
│ │ │ │ -
1787 if(current != end)
│ │ │ │ -
1788 visitedSpheres++;
│ │ │ │ -
1789 }
│ │ │ │ -
1790
│ │ │ │ -
1791 if(reset)
│ │ │ │ -
1792 for(current = visited.begin(); current != end; ++current)
│ │ │ │ -
1793 put(visitedMap, *current, false);
│ │ │ │ -
1794
│ │ │ │ -
1795
│ │ │ │ -
1796 if(remove)
│ │ │ │ -
1797 visited.clear();
│ │ │ │ -
1798
│ │ │ │ -
1799 return visitedSpheres;
│ │ │ │ -
1800 }
│ │ │ │ -
1801
│ │ │ │ -
1802 template<class G>
│ │ │ │ - │ │ │ │ -
1804 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1)
│ │ │ │ -
1805 {}
│ │ │ │ -
1806
│ │ │ │ -
1807 template<class G>
│ │ │ │ - │ │ │ │ -
1809 {
│ │ │ │ -
1810 size_=-1;
│ │ │ │ -
1811 }
│ │ │ │ -
1812
│ │ │ │ -
1813 template<class G, class C>
│ │ │ │ -
1814 void buildDependency(G& graph,
│ │ │ │ -
1815 const typename C::Matrix& matrix,
│ │ │ │ -
1816 C criterion, bool firstlevel)
│ │ │ │ -
1817 {
│ │ │ │ -
1818 // assert(graph.isBuilt());
│ │ │ │ -
1819 typedef typename C::Matrix Matrix;
│ │ │ │ -
1820 typedef typename G::VertexIterator VertexIterator;
│ │ │ │ -
1821
│ │ │ │ -
1822 criterion.init(&matrix);
│ │ │ │ -
1823
│ │ │ │ -
1824 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); ++vertex) {
│ │ │ │ -
1825 typedef typename Matrix::row_type Row;
│ │ │ │ -
1826
│ │ │ │ -
1827 const Row& row = matrix[*vertex];
│ │ │ │ -
1828
│ │ │ │ -
1829 // Tell the criterion what row we will examine now
│ │ │ │ -
1830 // This might for example be used for calculating the
│ │ │ │ -
1831 // maximum offdiagonal value
│ │ │ │ -
1832 criterion.initRow(row, *vertex);
│ │ │ │ -
1833
│ │ │ │ -
1834 // On a first path all columns are examined. After this
│ │ │ │ -
1835 // the calculator should know whether the vertex is isolated.
│ │ │ │ -
1836 typedef typename Matrix::ConstColIterator ColIterator;
│ │ │ │ -
1837 ColIterator end = row.end();
│ │ │ │ -
1838 typename FieldTraits<typename Matrix::field_type>::real_type absoffdiag=0.;
│ │ │ │ -
1839
│ │ │ │ -
1840 using std::max;
│ │ │ │ -
1841 if(firstlevel) {
│ │ │ │ -
1842 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ │ -
1843 if(col.index()!=*vertex) {
│ │ │ │ -
1844 criterion.examine(col);
│ │ │ │ -
1845 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm());
│ │ │ │ -
1846 }
│ │ │ │ -
1847
│ │ │ │ -
1848 if(absoffdiag==0)
│ │ │ │ -
1849 vertex.properties().setExcludedBorder();
│ │ │ │ -
1850 }
│ │ │ │ -
1851 else
│ │ │ │ -
1852 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ │ -
1853 if(col.index()!=*vertex)
│ │ │ │ -
1854 criterion.examine(col);
│ │ │ │ -
1855
│ │ │ │ -
1856 // reset the vertex properties
│ │ │ │ -
1857 //vertex.properties().reset();
│ │ │ │ -
1858
│ │ │ │ -
1859 // Check whether the vertex is isolated.
│ │ │ │ -
1860 if(criterion.isIsolated()) {
│ │ │ │ -
1861 //std::cout<<"ISOLATED: "<<*vertex<<std::endl;
│ │ │ │ -
1862 vertex.properties().setIsolated();
│ │ │ │ -
1863 }else{
│ │ │ │ -
1864 // Examine all the edges beginning at this vertex.
│ │ │ │ -
1865 auto eEnd = vertex.end();
│ │ │ │ -
1866 auto col = matrix[*vertex].begin();
│ │ │ │ -
1867
│ │ │ │ -
1868 for(auto edge = vertex.begin(); edge!= eEnd; ++edge, ++col) {
│ │ │ │ -
1869 // Move to the right column.
│ │ │ │ -
1870 while(col.index()!=edge.target())
│ │ │ │ -
1871 ++col;
│ │ │ │ -
1872 criterion.examine(graph, edge, col);
│ │ │ │ -
1873 }
│ │ │ │ -
1874 }
│ │ │ │ -
1875
│ │ │ │ -
1876 }
│ │ │ │ -
1877 }
│ │ │ │ -
1878
│ │ │ │ -
1879
│ │ │ │ -
1880 template<class G>
│ │ │ │ -
1881 template<class V>
│ │ │ │ -
1882 inline Aggregator<G>::AggregateVisitor<V>::AggregateVisitor(const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
1883 const AggregateDescriptor& aggregate, V& visitor)
│ │ │ │ -
1884 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor)
│ │ │ │ -
1885 {}
│ │ │ │ -
1886
│ │ │ │ -
1887 template<class G>
│ │ │ │ -
1888 template<class V>
│ │ │ │ - │ │ │ │ -
1890 {
│ │ │ │ -
1891 if(aggregates_[edge.target()]==aggregate_)
│ │ │ │ -
1892 visitor_->operator()(edge);
│ │ │ │ -
1893 }
│ │ │ │ -
1894
│ │ │ │ -
1895 template<class G>
│ │ │ │ -
1896 template<class V>
│ │ │ │ -
1897 inline void Aggregator<G>::visitAggregateNeighbours(const Vertex& vertex,
│ │ │ │ -
1898 const AggregateDescriptor& aggregate,
│ │ │ │ -
1899 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
1900 V& visitor) const
│ │ │ │ -
1901 {
│ │ │ │ -
1902 // Only evaluates for edge pointing to the aggregate
│ │ │ │ -
1903 AggregateVisitor<V> v(aggregates, aggregate, visitor);
│ │ │ │ -
1904 visitNeighbours(*graph_, vertex, v);
│ │ │ │ -
1905 }
│ │ │ │ -
1906
│ │ │ │ -
1907
│ │ │ │ -
1908 template<class G>
│ │ │ │ - │ │ │ │ -
1910 : count_(0)
│ │ │ │ -
1911 {}
│ │ │ │ -
1912
│ │ │ │ -
1913 template<class G>
│ │ │ │ - │ │ │ │ -
1915 {
│ │ │ │ -
1916 ++count_;
│ │ │ │ -
1917 }
│ │ │ │ -
1918
│ │ │ │ -
1919 template<class G>
│ │ │ │ - │ │ │ │ -
1921 {
│ │ │ │ -
1922 --count_;
│ │ │ │ -
1923 }
│ │ │ │ -
1924 template<class G>
│ │ │ │ - │ │ │ │ -
1926 {
│ │ │ │ -
1927 return count_;
│ │ │ │ -
1928 }
│ │ │ │ -
1929
│ │ │ │ -
1930 template<class G>
│ │ │ │ - │ │ │ │ -
1932 {
│ │ │ │ -
1933 if(edge.properties().isTwoWay())
│ │ │ │ - │ │ │ │ -
1935 }
│ │ │ │ -
1936
│ │ │ │ -
1937 template<class G>
│ │ │ │ -
1938 int Aggregator<G>::twoWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ -
1939 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
1940 {
│ │ │ │ -
1941 TwoWayCounter counter;
│ │ │ │ -
1942 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ │ -
1943 return counter.value();
│ │ │ │ -
1944 }
│ │ │ │ -
1945
│ │ │ │ -
1946 template<class G>
│ │ │ │ -
1947 int Aggregator<G>::oneWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ -
1948 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
1949 {
│ │ │ │ -
1950 OneWayCounter counter;
│ │ │ │ -
1951 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ │ -
1952 return counter.value();
│ │ │ │ -
1953 }
│ │ │ │ -
1954
│ │ │ │ -
1955 template<class G>
│ │ │ │ - │ │ │ │ -
1957 {
│ │ │ │ -
1958 if(edge.properties().isOneWay())
│ │ │ │ - │ │ │ │ -
1960 }
│ │ │ │ -
1961
│ │ │ │ -
1962 template<class G>
│ │ │ │ -
1963 inline Aggregator<G>::ConnectivityCounter::ConnectivityCounter(const VertexSet& connected,
│ │ │ │ -
1964 const AggregatesMap<Vertex>& aggregates)
│ │ │ │ -
1965 : Counter(), connected_(connected), aggregates_(aggregates)
│ │ │ │ -
1966 {}
│ │ │ │ -
1967
│ │ │ │ -
1968
│ │ │ │ -
1969 template<class G>
│ │ │ │ - │ │ │ │ -
1971 {
│ │ │ │ -
1972 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED)
│ │ │ │ -
1973 // Would be a new connection
│ │ │ │ - │ │ │ │ -
1975 else{
│ │ │ │ - │ │ │ │ - │ │ │ │ -
1978 }
│ │ │ │ -
1979 }
│ │ │ │ -
1980
│ │ │ │ -
1981 template<class G>
│ │ │ │ -
1982 inline double Aggregator<G>::connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
1983 {
│ │ │ │ -
1984 ConnectivityCounter counter(connected_, aggregates);
│ │ │ │ -
1985 double noNeighbours=visitNeighbours(*graph_, vertex, counter);
│ │ │ │ -
1986 return (double)counter.value()/noNeighbours;
│ │ │ │ -
1987 }
│ │ │ │ -
1988
│ │ │ │ -
1989 template<class G>
│ │ │ │ - │ │ │ │ -
1991 : Counter()
│ │ │ │ -
1992 {}
│ │ │ │ -
1993
│ │ │ │ -
1994 template<class G>
│ │ │ │ - │ │ │ │ -
1996 {
│ │ │ │ -
1997 if(edge.properties().depends())
│ │ │ │ - │ │ │ │ -
1999 if(edge.properties().influences())
│ │ │ │ - │ │ │ │ -
2001 }
│ │ │ │ -
2002
│ │ │ │ -
2003 template<class G>
│ │ │ │ -
2004 int Aggregator<G>::unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
2005 {
│ │ │ │ -
2006 return aggregateNeighbours(vertex, AggregatesMap<Vertex>::UNAGGREGATED, aggregates);
│ │ │ │ -
2007 }
│ │ │ │ -
2008
│ │ │ │ -
2009 template<class G>
│ │ │ │ -
2010 std::pair<int,int> Aggregator<G>::neighbours(const Vertex& vertex,
│ │ │ │ -
2011 const AggregateDescriptor& aggregate,
│ │ │ │ -
2012 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
2013 {
│ │ │ │ -
2014 DependencyCounter unused, aggregated;
│ │ │ │ -
2015 typedef AggregateVisitor<DependencyCounter> CounterT;
│ │ │ │ -
2016 typedef std::tuple<CounterT,CounterT> CounterTuple;
│ │ │ │ -
2017 CombinedFunctor<CounterTuple> visitors(CounterTuple(CounterT(aggregates, AggregatesMap<Vertex>::UNAGGREGATED, unused), CounterT(aggregates, aggregate, aggregated)));
│ │ │ │ -
2018 visitNeighbours(*graph_, vertex, visitors);
│ │ │ │ -
2019 return std::make_pair(unused.value(), aggregated.value());
│ │ │ │ -
2020 }
│ │ │ │ -
2021
│ │ │ │ -
2022
│ │ │ │ -
2023 template<class G>
│ │ │ │ -
2024 int Aggregator<G>::aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
2025 {
│ │ │ │ -
2026 DependencyCounter counter;
│ │ │ │ -
2027 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ │ -
2028 return counter.value();
│ │ │ │ -
2029 }
│ │ │ │ -
2030
│ │ │ │ -
2031 template<class G>
│ │ │ │ -
2032 std::size_t Aggregator<G>::distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates)
│ │ │ │ -
2033 {
│ │ │ │ -
2034 return 0;
│ │ │ │ -
2035 typename PropertyMapTypeSelector<VertexVisitedTag,G>::Type visitedMap = get(VertexVisitedTag(), *graph_);
│ │ │ │ -
2036 VertexList vlist;
│ │ │ │ -
2037 typename AggregatesMap<Vertex>::DummyEdgeVisitor dummy;
│ │ │ │ -
2038 return aggregates.template breadthFirstSearch<true,true>(vertex,
│ │ │ │ -
2039 aggregate_->id(), *graph_,
│ │ │ │ -
2040 vlist, dummy, dummy, visitedMap);
│ │ │ │ -
2041 }
│ │ │ │ -
2042
│ │ │ │ -
2043 template<class G>
│ │ │ │ -
2044 inline Aggregator<G>::FrontMarker::FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph)
│ │ │ │ -
2045 : front_(front), graph_(graph)
│ │ │ │ -
2046 {}
│ │ │ │ -
2047
│ │ │ │ -
2048 template<class G>
│ │ │ │ - │ │ │ │ -
2050 {
│ │ │ │ -
2051 Vertex target = edge.target();
│ │ │ │ -
2052
│ │ │ │ -
2053 if(!graph_.getVertexProperties(target).front()) {
│ │ │ │ -
2054 front_.push_back(target);
│ │ │ │ -
2055 graph_.getVertexProperties(target).setFront();
│ │ │ │ -
2056 }
│ │ │ │ -
2057 }
│ │ │ │ -
2058
│ │ │ │ -
2059 template<class G>
│ │ │ │ -
2060 inline bool Aggregator<G>::admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
2061 {
│ │ │ │ -
2062 // Todo
│ │ │ │ -
2063 Dune::dvverb<<" Admissible not yet implemented!"<<std::endl;
│ │ │ │ -
2064 return true;
│ │ │ │ -
2065 //Situation 1: front node depends on two nodes. Then these
│ │ │ │ -
2066 // have to be strongly connected to each other
│ │ │ │ -
2067
│ │ │ │ -
2068 // Iterate over all all neighbours of front node
│ │ │ │ -
2069 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ │ -
2070 Iterator vend = graph_->endEdges(vertex);
│ │ │ │ -
2071 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ │ -
2072 // if(edge.properties().depends() && !edge.properties().influences()
│ │ │ │ -
2073 if(edge.properties().isStrong()
│ │ │ │ -
2074 && aggregates[edge.target()]==aggregate)
│ │ │ │ -
2075 {
│ │ │ │ -
2076 // Search for another link to the aggregate
│ │ │ │ -
2077 Iterator edge1 = edge;
│ │ │ │ -
2078 for(++edge1; edge1 != vend; ++edge1) {
│ │ │ │ -
2079 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ │ -
2080 if(edge1.properties().isStrong()
│ │ │ │ -
2081 && aggregates[edge.target()]==aggregate)
│ │ │ │ -
2082 {
│ │ │ │ -
2083 //Search for an edge connecting the two vertices that is
│ │ │ │ -
2084 //strong
│ │ │ │ -
2085 bool found=false;
│ │ │ │ -
2086 Iterator v2end = graph_->endEdges(edge.target());
│ │ │ │ -
2087 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; ++edge2) {
│ │ │ │ -
2088 if(edge2.target()==edge1.target() &&
│ │ │ │ -
2089 edge2.properties().isStrong()) {
│ │ │ │ -
2090 found =true;
│ │ │ │ -
2091 break;
│ │ │ │ -
2092 }
│ │ │ │ -
2093 }
│ │ │ │ -
2094 if(found)
│ │ │ │ -
2095 {
│ │ │ │ -
2096 return true;
│ │ │ │ -
2097 }
│ │ │ │ -
2098 }
│ │ │ │ -
2099 }
│ │ │ │ -
2100 }
│ │ │ │ -
2101 }
│ │ │ │ -
2102
│ │ │ │ -
2103 // Situation 2: cluster node depends on front node and other cluster node
│ │ │ │ -
2105 vend = graph_->endEdges(vertex);
│ │ │ │ -
2106 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ │ -
2107 //if(!edge.properties().depends() && edge.properties().influences()
│ │ │ │ -
2108 if(edge.properties().isStrong()
│ │ │ │ -
2109 && aggregates[edge.target()]==aggregate)
│ │ │ │ -
2110 {
│ │ │ │ -
2111 // Search for a link from target that stays within the aggregate
│ │ │ │ -
2112 Iterator v1end = graph_->endEdges(edge.target());
│ │ │ │ -
2113
│ │ │ │ -
2114 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; ++edge1) {
│ │ │ │ -
2115 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ │ -
2116 if(edge1.properties().isStrong()
│ │ │ │ -
2117 && aggregates[edge1.target()]==aggregate)
│ │ │ │ -
2118 {
│ │ │ │ -
2119 bool found=false;
│ │ │ │ -
2120 // Check if front node is also connected to this one
│ │ │ │ -
2121 Iterator v2end = graph_->endEdges(vertex);
│ │ │ │ -
2122 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) {
│ │ │ │ -
2123 if(edge2.target()==edge1.target()) {
│ │ │ │ -
2124 if(edge2.properties().isStrong())
│ │ │ │ -
2125 found=true;
│ │ │ │ -
2126 break;
│ │ │ │ -
2127 }
│ │ │ │ -
2128 }
│ │ │ │ -
2129 if(found)
│ │ │ │ -
2130 {
│ │ │ │ -
2131 return true;
│ │ │ │ -
2132 }
│ │ │ │ -
2133 }
│ │ │ │ -
2134 }
│ │ │ │ -
2135 }
│ │ │ │ -
2136 }
│ │ │ │ -
2137 return false;
│ │ │ │ -
2138 }
│ │ │ │ -
2139
│ │ │ │ -
2140 template<class G>
│ │ │ │ -
2141 void Aggregator<G>::unmarkFront()
│ │ │ │ -
2142 {
│ │ │ │ -
2143 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ -
2144
│ │ │ │ -
2145 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex)
│ │ │ │ -
2146 graph_->getVertexProperties(*vertex).resetFront();
│ │ │ │ -
2147
│ │ │ │ -
2148 front_.clear();
│ │ │ │ -
2149 }
│ │ │ │ -
2150
│ │ │ │ -
2151 template<class G>
│ │ │ │ -
2152 inline void
│ │ │ │ -
2153 Aggregator<G>::nonisoNeighbourAggregate(const Vertex& vertex,
│ │ │ │ -
2154 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
2155 SLList<Vertex>& neighbours) const
│ │ │ │ -
2156 {
│ │ │ │ -
2157 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ │ -
2158 Iterator end=graph_->beginEdges(vertex);
│ │ │ │ -
2159 neighbours.clear();
│ │ │ │ -
2160
│ │ │ │ -
2161 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge)
│ │ │ │ -
2162 {
│ │ │ │ -
2163 if(aggregates[edge.target()]!=AggregatesMap<Vertex>::UNAGGREGATED && graph_->getVertexProperties(edge.target()).isolated())
│ │ │ │ -
2164 neighbours.push_back(aggregates[edge.target()]);
│ │ │ │ -
2165 }
│ │ │ │ -
2166 }
│ │ │ │ -
2167
│ │ │ │ -
2168 template<class G>
│ │ │ │ -
2169 inline typename G::VertexDescriptor Aggregator<G>::mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
2170 {
│ │ │ │ -
2171 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ │ -
2172
│ │ │ │ -
2173 Iterator end = graph_->endEdges(vertex);
│ │ │ │ -
2174 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) {
│ │ │ │ -
2175 if(aggregates[edge.target()] != AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ │ -
2176 graph_->getVertexProperties(edge.target()).isolated() == graph_->getVertexProperties(edge.source()).isolated()) {
│ │ │ │ -
2177 if( graph_->getVertexProperties(vertex).isolated() ||
│ │ │ │ -
2178 ((edge.properties().depends() || edge.properties().influences())
│ │ │ │ -
2179 && admissible(vertex, aggregates[edge.target()], aggregates)))
│ │ │ │ -
2180 return edge.target();
│ │ │ │ -
2181 }
│ │ │ │ -
2182 }
│ │ │ │ -
2183 return AggregatesMap<Vertex>::UNAGGREGATED;
│ │ │ │ -
2184 }
│ │ │ │ -
2185
│ │ │ │ -
2186 template<class G>
│ │ │ │ - │ │ │ │ -
2188 : Counter(), graph_(graph)
│ │ │ │ -
2189 {}
│ │ │ │ -
2190
│ │ │ │ -
2191 template<class G>
│ │ │ │ - │ │ │ │ -
2193 {
│ │ │ │ -
2194 if(graph_.getVertexProperties(edge.target()).front())
│ │ │ │ - │ │ │ │ -
2196 }
│ │ │ │ -
2197
│ │ │ │ -
2198 template<class G>
│ │ │ │ -
2199 int Aggregator<G>::noFrontNeighbours(const Vertex& vertex) const
│ │ │ │ -
2200 {
│ │ │ │ -
2201 FrontNeighbourCounter counter(*graph_);
│ │ │ │ -
2202 visitNeighbours(*graph_, vertex, counter);
│ │ │ │ -
2203 return counter.value();
│ │ │ │ -
2204 }
│ │ │ │ -
2205 template<class G>
│ │ │ │ -
2206 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ │ -
2207 const AggregateDescriptor& aggregate,
│ │ │ │ -
2208 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
2209 {
│ │ │ │ -
2210 typedef typename G::ConstEdgeIterator iterator;
│ │ │ │ -
2211 const iterator end = graph_->endEdges(vertex);
│ │ │ │ -
2212 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge)
│ │ │ │ -
2213 if(aggregates[edge.target()]==aggregate)
│ │ │ │ -
2214 return true;
│ │ │ │ -
2215 return false;
│ │ │ │ -
2216 }
│ │ │ │ -
2217 template<class G>
│ │ │ │ -
2218 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ │ -
2219 const SLList<AggregateDescriptor>& aggregateList,
│ │ │ │ -
2220 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ -
2221 {
│ │ │ │ -
2222 typedef typename SLList<AggregateDescriptor>::const_iterator Iter;
│ │ │ │ -
2223 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i)
│ │ │ │ -
2224 if(connected(vertex, *i, aggregates))
│ │ │ │ -
2225 return true;
│ │ │ │ -
2226 return false;
│ │ │ │ -
2227 }
│ │ │ │ -
2228
│ │ │ │ -
2229 template<class G>
│ │ │ │ -
2230 template<class C>
│ │ │ │ -
2231 void Aggregator<G>::growIsolatedAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ │ -
2232 {
│ │ │ │ -
2233 SLList<Vertex> connectedAggregates;
│ │ │ │ -
2234 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates);
│ │ │ │ -
2235
│ │ │ │ -
2236 while(aggregate_->size()< c.minAggregateSize() && aggregate_->connectSize() < c.maxConnectivity()) {
│ │ │ │ -
2237 double maxCon=-1;
│ │ │ │ -
2238 std::size_t maxFrontNeighbours=0;
│ │ │ │ -
2239
│ │ │ │ -
2240 Vertex candidate=AggregatesMap<Vertex>::UNAGGREGATED;
│ │ │ │ -
2241
│ │ │ │ -
2242 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ -
2243
│ │ │ │ -
2244 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ │ -
2245 if(distance(*vertex, aggregates)>c.maxDistance())
│ │ │ │ -
2246 continue; // distance of proposes aggregate too big
│ │ │ │ -
2247
│ │ │ │ -
2248 if(connectedAggregates.size()>0) {
│ │ │ │ -
2249 // there is already a neighbour cluster
│ │ │ │ -
2250 // front node must be connected to same neighbour cluster
│ │ │ │ -
2251
│ │ │ │ -
2252 if(!connected(*vertex, connectedAggregates, aggregates))
│ │ │ │ -
2253 continue;
│ │ │ │ -
2254 }
│ │ │ │ -
2255
│ │ │ │ -
2256 double con = connectivity(*vertex, aggregates);
│ │ │ │ -
2257
│ │ │ │ -
2258 if(con == maxCon) {
│ │ │ │ -
2259 std::size_t frontNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2260
│ │ │ │ -
2261 if(frontNeighbours >= maxFrontNeighbours) {
│ │ │ │ -
2262 maxFrontNeighbours = frontNeighbours;
│ │ │ │ -
2263 candidate = *vertex;
│ │ │ │ -
2264 }
│ │ │ │ -
2265 }else if(con > maxCon) {
│ │ │ │ -
2266 maxCon = con;
│ │ │ │ -
2267 maxFrontNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2268 candidate = *vertex;
│ │ │ │ -
2269 }
│ │ │ │ -
2270 }
│ │ │ │ -
2271
│ │ │ │ -
2272 if(candidate==AggregatesMap<Vertex>::UNAGGREGATED)
│ │ │ │ -
2273 break;
│ │ │ │ -
2274
│ │ │ │ -
2275 aggregate_->add(candidate);
│ │ │ │ -
2276 }
│ │ │ │ -
2277 }
│ │ │ │ -
2278
│ │ │ │ -
2279 template<class G>
│ │ │ │ -
2280 template<class C>
│ │ │ │ -
2281 void Aggregator<G>::growAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ │ -
2282 {
│ │ │ │ -
2283 using std::min;
│ │ │ │ -
2284
│ │ │ │ -
2285 std::size_t distance_ =0;
│ │ │ │ -
2286 while(aggregate_->size() < c.minAggregateSize()&& distance_<c.maxDistance()) {
│ │ │ │ -
2287 int maxTwoCons=0, maxOneCons=0, maxNeighbours=-1;
│ │ │ │ -
2288 double maxCon=-1;
│ │ │ │ -
2289
│ │ │ │ -
2290 std::vector<Vertex> candidates;
│ │ │ │ -
2291 candidates.reserve(30);
│ │ │ │ -
2292
│ │ │ │ -
2293 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ -
2294
│ │ │ │ -
2295 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ │ -
2296 // Only nonisolated nodes are considered
│ │ │ │ -
2297 if(graph_->getVertexProperties(*vertex).isolated())
│ │ │ │ -
2298 continue;
│ │ │ │ -
2299
│ │ │ │ -
2300 int twoWayCons = twoWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ │ -
2301
│ │ │ │ -
2302 /* The case of two way connections. */
│ │ │ │ -
2303 if( maxTwoCons == twoWayCons && twoWayCons > 0) {
│ │ │ │ -
2304 double con = connectivity(*vertex, aggregates);
│ │ │ │ -
2305
│ │ │ │ -
2306 if(con == maxCon) {
│ │ │ │ -
2307 int neighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2308
│ │ │ │ -
2309 if(neighbours > maxNeighbours) {
│ │ │ │ -
2310 maxNeighbours = neighbours;
│ │ │ │ -
2311 candidates.clear();
│ │ │ │ -
2312 candidates.push_back(*vertex);
│ │ │ │ -
2313 }else{
│ │ │ │ -
2314 candidates.push_back(*vertex);
│ │ │ │ -
2315 }
│ │ │ │ -
2316 }else if( con > maxCon) {
│ │ │ │ -
2317 maxCon = con;
│ │ │ │ -
2318 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2319 candidates.clear();
│ │ │ │ -
2320 candidates.push_back(*vertex);
│ │ │ │ -
2321 }
│ │ │ │ -
2322 }else if(twoWayCons > maxTwoCons) {
│ │ │ │ -
2323 maxTwoCons = twoWayCons;
│ │ │ │ -
2324 maxCon = connectivity(*vertex, aggregates);
│ │ │ │ -
2325 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2326 candidates.clear();
│ │ │ │ -
2327 candidates.push_back(*vertex);
│ │ │ │ -
2328
│ │ │ │ -
2329 // two way connections precede
│ │ │ │ -
2330 maxOneCons = std::numeric_limits<int>::max();
│ │ │ │ -
2331 }
│ │ │ │ -
2332
│ │ │ │ -
2333 if(twoWayCons > 0)
│ │ │ │ -
2334 {
│ │ │ │ -
2335 continue; // THis is a two-way node, skip tests for one way nodes
│ │ │ │ -
2336 }
│ │ │ │ -
2337
│ │ │ │ -
2338 /* The one way case */
│ │ │ │ -
2339 int oneWayCons = oneWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ │ -
2340
│ │ │ │ -
2341 if(oneWayCons==0)
│ │ │ │ -
2342 continue; // No strong connections, skip the tests.
│ │ │ │ -
2343
│ │ │ │ -
2344 if(!admissible(*vertex, aggregate_->id(), aggregates))
│ │ │ │ -
2345 continue;
│ │ │ │ -
2346
│ │ │ │ -
2347 if( maxOneCons == oneWayCons && oneWayCons > 0) {
│ │ │ │ -
2348 double con = connectivity(*vertex, aggregates);
│ │ │ │ -
2349
│ │ │ │ -
2350 if(con == maxCon) {
│ │ │ │ -
2351 int neighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2352
│ │ │ │ -
2353 if(neighbours > maxNeighbours) {
│ │ │ │ -
2354 maxNeighbours = neighbours;
│ │ │ │ -
2355 candidates.clear();
│ │ │ │ -
2356 candidates.push_back(*vertex);
│ │ │ │ -
2357 }else{
│ │ │ │ -
2358 if(neighbours==maxNeighbours)
│ │ │ │ -
2359 {
│ │ │ │ -
2360 candidates.push_back(*vertex);
│ │ │ │ -
2361 }
│ │ │ │ -
2362 }
│ │ │ │ -
2363 }else if( con > maxCon) {
│ │ │ │ -
2364 maxCon = con;
│ │ │ │ -
2365 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2366 candidates.clear();
│ │ │ │ -
2367 candidates.push_back(*vertex);
│ │ │ │ -
2368 }
│ │ │ │ -
2369 }else if(oneWayCons > maxOneCons) {
│ │ │ │ -
2370 maxOneCons = oneWayCons;
│ │ │ │ -
2371 maxCon = connectivity(*vertex, aggregates);
│ │ │ │ -
2372 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ -
2373 candidates.clear();
│ │ │ │ -
2374 candidates.push_back(*vertex);
│ │ │ │ -
2375 }
│ │ │ │ -
2376 }
│ │ │ │ -
2377
│ │ │ │ -
2378
│ │ │ │ -
2379 if(!candidates.size())
│ │ │ │ -
2380 break; // No more candidates found
│ │ │ │ -
2381 distance_=distance(seed, aggregates);
│ │ │ │ -
2382 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ │ -
2383 aggregate_->size()));
│ │ │ │ -
2384 aggregate_->add(candidates);
│ │ │ │ -
2385 }
│ │ │ │ -
2386 }
│ │ │ │ -
2387
│ │ │ │ -
2388 template<typename V>
│ │ │ │ -
2389 template<typename M, typename G, typename C>
│ │ │ │ -
2390 std::tuple<int,int,int,int> AggregatesMap<V>::buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ │ -
2391 bool finestLevel)
│ │ │ │ -
2392 {
│ │ │ │ -
2393 Aggregator<G> aggregator;
│ │ │ │ -
2394 return aggregator.build(matrix, graph, *this, criterion, finestLevel);
│ │ │ │ -
2395 }
│ │ │ │ -
2396
│ │ │ │ -
2397 template<class G>
│ │ │ │ -
2398 template<class M, class C>
│ │ │ │ -
2399 std::tuple<int,int,int,int> Aggregator<G>::build(const M& m, G& graph, AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ │ -
2400 bool finestLevel)
│ │ │ │ -
2401 {
│ │ │ │ -
2402 using std::max;
│ │ │ │ -
2403 using std::min;
│ │ │ │ -
2404 // Stack for fast vertex access
│ │ │ │ -
2405 Stack stack_(graph, *this, aggregates);
│ │ │ │ -
2406
│ │ │ │ -
2407 graph_ = &graph;
│ │ │ │ -
2408
│ │ │ │ -
2409 aggregate_ = new Aggregate<G,VertexSet>(graph, aggregates, connected_, front_);
│ │ │ │ -
2410
│ │ │ │ -
2411 Timer watch;
│ │ │ │ -
2412 watch.reset();
│ │ │ │ -
2413
│ │ │ │ -
2414 buildDependency(graph, m, c, finestLevel);
│ │ │ │ -
2415
│ │ │ │ -
2416 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
2417 int noAggregates, conAggregates, isoAggregates, oneAggregates;
│ │ │ │ -
2418 std::size_t maxA=0, minA=1000000, avg=0;
│ │ │ │ -
2419 int skippedAggregates;
│ │ │ │ -
2420 noAggregates = conAggregates = isoAggregates = oneAggregates =
│ │ │ │ -
2421 skippedAggregates = 0;
│ │ │ │ -
2422
│ │ │ │ -
2423 while(true) {
│ │ │ │ -
2424 Vertex seed = stack_.pop();
│ │ │ │ -
2425
│ │ │ │ -
2426 if(seed == Stack::NullEntry)
│ │ │ │ -
2427 // No more unaggregated vertices. We are finished!
│ │ │ │ -
2428 break;
│ │ │ │ -
2429
│ │ │ │ -
2430 // Debugging output
│ │ │ │ -
2431 if((noAggregates+1)%10000 == 0)
│ │ │ │ -
2432 Dune::dverb<<"c";
│ │ │ │ -
2433 unmarkFront();
│ │ │ │ -
2434
│ │ │ │ -
2435 if(graph.getVertexProperties(seed).excludedBorder()) {
│ │ │ │ -
2436 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ │ -
2437 ++skippedAggregates;
│ │ │ │ -
2438 continue;
│ │ │ │ -
2439 }
│ │ │ │ -
2440
│ │ │ │ -
2441 if(graph.getVertexProperties(seed).isolated()) {
│ │ │ │ -
2442 if(c.skipIsolated()) {
│ │ │ │ -
2443 // isolated vertices are not aggregated but skipped on the coarser levels.
│ │ │ │ -
2444 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ │ -
2445 ++skippedAggregates;
│ │ │ │ -
2446 // skip rest as no agglomeration is done.
│ │ │ │ -
2447 continue;
│ │ │ │ -
2448 }else{
│ │ │ │ -
2449 aggregate_->seed(seed);
│ │ │ │ -
2450 growIsolatedAggregate(seed, aggregates, c);
│ │ │ │ -
2451 }
│ │ │ │ -
2452 }else{
│ │ │ │ -
2453 aggregate_->seed(seed);
│ │ │ │ -
2454 growAggregate(seed, aggregates, c);
│ │ │ │ -
2455 }
│ │ │ │ -
2456
│ │ │ │ -
2457 /* The rounding step. */
│ │ │ │ -
2458 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->size() < c.maxAggregateSize()) {
│ │ │ │ -
2459
│ │ │ │ -
2460 std::vector<Vertex> candidates;
│ │ │ │ -
2461 candidates.reserve(30);
│ │ │ │ -
2462
│ │ │ │ -
2463 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ -
2464
│ │ │ │ -
2465 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ │ -
2466
│ │ │ │ -
2467 if(graph.getVertexProperties(*vertex).isolated())
│ │ │ │ -
2468 continue; // No isolated nodes here
│ │ │ │ -
2469
│ │ │ │ -
2470 if(twoWayConnections( *vertex, aggregate_->id(), aggregates) == 0 &&
│ │ │ │ -
2471 (oneWayConnections( *vertex, aggregate_->id(), aggregates) == 0 ||
│ │ │ │ -
2472 !admissible( *vertex, aggregate_->id(), aggregates) ))
│ │ │ │ -
2473 continue;
│ │ │ │ -
2474
│ │ │ │ -
2475 std::pair<int,int> neighbourPair=neighbours(*vertex, aggregate_->id(),
│ │ │ │ -
2476 aggregates);
│ │ │ │ -
2477
│ │ │ │ -
2478 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= unusedNeighbours(*vertex, aggregates))
│ │ │ │ -
2479 // continue;
│ │ │ │ -
2480
│ │ │ │ -
2481 if(neighbourPair.first >= neighbourPair.second)
│ │ │ │ -
2482 continue;
│ │ │ │ -
2483
│ │ │ │ -
2484 if(distance(*vertex, aggregates) > c.maxDistance())
│ │ │ │ -
2485 continue; // Distance too far
│ │ │ │ -
2486 candidates.push_back(*vertex);
│ │ │ │ -
2487 break;
│ │ │ │ -
2488 }
│ │ │ │ -
2489
│ │ │ │ -
2490 if(!candidates.size()) break; // no more candidates found.
│ │ │ │ -
2491
│ │ │ │ -
2492 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ │ -
2493 aggregate_->size()));
│ │ │ │ -
2494 aggregate_->add(candidates);
│ │ │ │ -
2495
│ │ │ │ -
2496 }
│ │ │ │ -
2497
│ │ │ │ -
2498 // try to merge aggregates consisting of only one nonisolated vertex with other aggregates
│ │ │ │ -
2499 if(aggregate_->size()==1 && c.maxAggregateSize()>1) {
│ │ │ │ -
2500 if(!graph.getVertexProperties(seed).isolated()) {
│ │ │ │ -
2501 Vertex mergedNeighbour = mergeNeighbour(seed, aggregates);
│ │ │ │ -
2502
│ │ │ │ -
2503 if(mergedNeighbour != AggregatesMap<Vertex>::UNAGGREGATED) {
│ │ │ │ -
2504 // assign vertex to the neighbouring cluster
│ │ │ │ -
2505 aggregates[seed] = aggregates[mergedNeighbour];
│ │ │ │ -
2506 aggregate_->invalidate();
│ │ │ │ -
2507 }else{
│ │ │ │ -
2508 ++avg;
│ │ │ │ -
2509 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ │ -
2510 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ │ -
2511 ++oneAggregates;
│ │ │ │ -
2512 ++conAggregates;
│ │ │ │ -
2513 }
│ │ │ │ -
2514 }else{
│ │ │ │ -
2515 ++avg;
│ │ │ │ -
2516 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ │ -
2517 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ │ -
2518 ++oneAggregates;
│ │ │ │ -
2519 ++isoAggregates;
│ │ │ │ -
2520 }
│ │ │ │ -
2521 ++avg;
│ │ │ │ -
2522 }else{
│ │ │ │ -
2523 avg+=aggregate_->size();
│ │ │ │ -
2524 minA=min(minA,aggregate_->size());
│ │ │ │ -
2525 maxA=max(maxA,aggregate_->size());
│ │ │ │ -
2526 if(graph.getVertexProperties(seed).isolated())
│ │ │ │ -
2527 ++isoAggregates;
│ │ │ │ -
2528 else
│ │ │ │ -
2529 ++conAggregates;
│ │ │ │ -
2530 }
│ │ │ │ -
2531
│ │ │ │ -
2532 }
│ │ │ │ -
2533
│ │ │ │ -
2534 Dune::dinfo<<"connected aggregates: "<<conAggregates;
│ │ │ │ -
2535 Dune::dinfo<<" isolated aggregates: "<<isoAggregates;
│ │ │ │ -
2536 if(conAggregates+isoAggregates>0)
│ │ │ │ -
2537 Dune::dinfo<<" one node aggregates: "<<oneAggregates<<" min size="
│ │ │ │ -
2538 <<minA<<" max size="<<maxA
│ │ │ │ -
2539 <<" avg="<<avg/(conAggregates+isoAggregates)<<std::endl;
│ │ │ │ -
2540
│ │ │ │ -
2541 delete aggregate_;
│ │ │ │ -
2542 return std::make_tuple(conAggregates+isoAggregates,isoAggregates,
│ │ │ │ -
2543 oneAggregates,skippedAggregates);
│ │ │ │ -
2544 }
│ │ │ │ -
2545
│ │ │ │ -
2546
│ │ │ │ -
2547 template<class G>
│ │ │ │ -
2548 Aggregator<G>::Stack::Stack(const MatrixGraph& graph, const Aggregator<G>& aggregatesBuilder,
│ │ │ │ -
2549 const AggregatesMap<Vertex>& aggregates)
│ │ │ │ -
2550 : graph_(graph), aggregatesBuilder_(aggregatesBuilder), aggregates_(aggregates), begin_(graph.begin()), end_(graph.end())
│ │ │ │ -
2551 {
│ │ │ │ -
2552 //vals_ = new Vertex[N];
│ │ │ │ -
2553 }
│ │ │ │ -
2554
│ │ │ │ -
2555 template<class G>
│ │ │ │ - │ │ │ │ -
2557 {
│ │ │ │ -
2558 //Dune::dverb << "Max stack size was "<<maxSize_<<" filled="<<filled_<<std::endl;
│ │ │ │ -
2559 //delete[] vals_;
│ │ │ │ -
2560 }
│ │ │ │ -
2561
│ │ │ │ -
2562 template<class G>
│ │ │ │ - │ │ │ │ -
2564 = std::numeric_limits<typename G::VertexDescriptor>::max();
│ │ │ │ -
2565
│ │ │ │ -
2566 template<class G>
│ │ │ │ -
2567 inline typename G::VertexDescriptor Aggregator<G>::Stack::pop()
│ │ │ │ -
2568 {
│ │ │ │ -
2569 for(; begin_!=end_ && aggregates_[*begin_] != AggregatesMap<Vertex>::UNAGGREGATED; ++begin_) ;
│ │ │ │ -
2570
│ │ │ │ -
2571 if(begin_!=end_)
│ │ │ │ -
2572 {
│ │ │ │ -
2573 typename G::VertexDescriptor current=*begin_;
│ │ │ │ -
2574 ++begin_;
│ │ │ │ -
2575 return current;
│ │ │ │ -
2576 }else
│ │ │ │ -
2577 return NullEntry;
│ │ │ │ -
2578 }
│ │ │ │ -
2579
│ │ │ │ -
2580#endif // DOXYGEN
│ │ │ │ -
2581
│ │ │ │ -
2582 template<class V>
│ │ │ │ -
│ │ │ │ -
2583 void printAggregates2d(const AggregatesMap<V>& aggregates, int n, int m, std::ostream& os)
│ │ │ │ -
2584 {
│ │ │ │ -
2585 using std::max;
│ │ │ │ -
2586
│ │ │ │ -
2587 std::ios_base::fmtflags oldOpts=os.flags();
│ │ │ │ -
2588
│ │ │ │ -
2589 os.setf(std::ios_base::right, std::ios_base::adjustfield);
│ │ │ │ -
2590
│ │ │ │ -
2591 V maxVal=0;
│ │ │ │ -
2592 int width=1;
│ │ │ │ -
2593
│ │ │ │ -
2594 for(int i=0; i< n*m; i++)
│ │ │ │ -
2595 maxVal=max(maxVal, aggregates[i]);
│ │ │ │ -
2596
│ │ │ │ -
2597 for(int i=10; i < 1000000; i*=10)
│ │ │ │ -
2598 if(maxVal/i>0)
│ │ │ │ -
2599 width++;
│ │ │ │ -
2600 else
│ │ │ │ -
2601 break;
│ │ │ │ -
2602
│ │ │ │ -
2603 for(int j=0, entry=0; j < m; j++) {
│ │ │ │ -
2604 for(int i=0; i<n; i++, entry++) {
│ │ │ │ -
2605 os.width(width);
│ │ │ │ -
2606 os<<aggregates[entry]<<" ";
│ │ │ │ -
2607 }
│ │ │ │ -
2608
│ │ │ │ -
2609 os<<std::endl;
│ │ │ │ -
2610 }
│ │ │ │ -
2611 os<<std::endl;
│ │ │ │ -
2612 os.flags(oldOpts);
│ │ │ │ -
2613 }
│ │ │ │ -
│ │ │ │ -
2614
│ │ │ │ -
2615
│ │ │ │ -
2616 } // namespace Amg
│ │ │ │ -
2617
│ │ │ │ -
2618} // namespace Dune
│ │ │ │ -
2619
│ │ │ │ -
2620
│ │ │ │ -
2621#endif
│ │ │ │ -
Parameter classes for customizing AMG.
│ │ │ │ - │ │ │ │ -
Provides classes for handling internal properties in a graph.
│ │ │ │ -
Provides classes for building the matrix graph.
│ │ │ │ +
708
│ │ │ │ +
709 } // end namespace Amg
│ │ │ │ +
710} // end namespace Dune
│ │ │ │ +
711
│ │ │ │ +
712#endif
│ │ │ │ +
Define general preconditioner interface.
│ │ │ │ +
Classes for using SuperLU with ISTL matrices.
│ │ │ │ +
Implementations of the inverse operator interface.
│ │ │ │ +
Templates characterizing the type of a solver.
│ │ │ │ + │ │ │ │ +
Provides a classes representing the hierarchies in AMG.
│ │ │ │ +
Classes for the generic construction and application of the smoothers.
│ │ │ │ +
Prolongation and restriction for amg.
│ │ │ │ +
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ +
Classes for using UMFPack with ISTL matrices.
│ │ │ │ +
Define base class for scalar product and norm.
│ │ │ │
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:273
│ │ │ │ -
std::vector< real_type >::iterator valIter_
Definition aggregates.hh:189
│ │ │ │ -
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:154
│ │ │ │ -
std::size_t breadthFirstSearch(const VertexDescriptor &start, const AggregateDescriptor &aggregate, const G &graph, L &visited, F1 &aggregateVisitor, F2 &nonAggregateVisitor, VM &visitedMap) const
Breadth first search within an aggregate.
│ │ │ │ -
PoolAllocator< VertexDescriptor, 100 > Allocator
The allocator we use for our lists and the set.
Definition aggregates.hh:586
│ │ │ │ -
iterator begin()
Definition aggregates.hh:737
│ │ │ │ -
int id()
Get the id identifying the aggregate.
│ │ │ │ -
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:302
│ │ │ │ -
MatrixGraph::VertexDescriptor Vertex
The vertex identifier.
Definition aggregates.hh:920
│ │ │ │ -
AggregationCriterion()
Constructor.
Definition aggregates.hh:66
│ │ │ │ -
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:357
│ │ │ │ -
auto operator()(const M &m, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr) const
Compute the norm of a scalar.
Definition aggregates.hh:406
│ │ │ │ -
void initRow(const Row &row, int index)
│ │ │ │ -
SymmetricMatrixDependency(const Parameters &parms)
Definition aggregates.hh:168
│ │ │ │ -
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:258
│ │ │ │ - │ │ │ │ -
G MatrixGraph
The matrix graph type used.
Definition aggregates.hh:915
│ │ │ │ -
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:363
│ │ │ │ -
void operator()(const EdgeIterator &edge) const
Definition aggregates.hh:601
│ │ │ │ -
SymmetricCriterion()
Definition aggregates.hh:524
│ │ │ │ -
Dependency()
Definition aggregates.hh:290
│ │ │ │ -
void examine(const ColIter &col)
│ │ │ │ -
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:319
│ │ │ │ -
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:187
│ │ │ │ -
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:263
│ │ │ │ -
iterator end()
Definition aggregates.hh:742
│ │ │ │ -
UnSymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:541
│ │ │ │ -
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ -
void initRow(const Row &row, int index)
Definition aggregates.hh:201
│ │ │ │ - │ │ │ │ -
static const Vertex NullEntry
Definition aggregates.hh:1008
│ │ │ │ -
void examine(const ColIter &col)
Definition aggregates.hh:214
│ │ │ │ -
Dependency(const Parameters &parms)
Definition aggregates.hh:286
│ │ │ │ -
int row_
index of the currently evaluated row.
Definition aggregates.hh:185
│ │ │ │ -
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ -
std::tuple< int, int, int, int > build(const M &m, G &graph, AggregatesMap< Vertex > &aggregates, const C &c, bool finestLevel)
Build the aggregates.
│ │ │ │ -
FrontNeighbourCounter(const MatrixGraph &front)
Constructor.
│ │ │ │ -
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:329
│ │ │ │ -
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:296
│ │ │ │ -
const AggregateDescriptor & operator[](const VertexDescriptor &v) const
Get the aggregate a vertex belongs to.
│ │ │ │ -
void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter &col)
│ │ │ │ -
AggregateVisitor(const AggregatesMap< Vertex > &aggregates, const AggregateDescriptor &aggregate, Visitor &visitor)
Constructor.
│ │ │ │ -
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:334
│ │ │ │ -
~AggregatesMap()
Destructor.
│ │ │ │ -
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:179
│ │ │ │ -
void decrement()
Decrement counter.
│ │ │ │ -
Aggregate(MatrixGraph &graph, AggregatesMap< Vertex > &aggregates, VertexSet &connectivity, std::vector< Vertex > &front_)
Constructor.
│ │ │ │ -
V Visitor
The type of the adapted visitor.
Definition aggregates.hh:1064
│ │ │ │ -
std::size_t * SphereMap
Type of the mapping of aggregate members onto distance spheres.
Definition aggregates.hh:809
│ │ │ │ -
AggregationCriterion(const Parameters &parms)
Definition aggregates.hh:70
│ │ │ │ -
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:268
│ │ │ │ -
VertexSet::size_type connectSize()
Get tne number of connections to other aggregates.
│ │ │ │ -
std::vector< real_type > vals_
Definition aggregates.hh:188
│ │ │ │ -
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:324
│ │ │ │ -
void printAggregates2d(const AggregatesMap< V > &aggregates, int n, int m, std::ostream &os)
Definition aggregates.hh:2583
│ │ │ │ -
void invalidate()
Definition aggregates.hh:822
│ │ │ │ -
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ │ -
real_type maxValue_
Definition aggregates.hh:181
│ │ │ │ -
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:183
│ │ │ │ -
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ -
VertexSet::const_iterator const_iterator
Const iterator over a vertex list.
Definition aggregates.hh:804
│ │ │ │ -
SymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:521
│ │ │ │ -
MatrixGraph::VertexDescriptor AggregateDescriptor
The type of the aggregate descriptor.
Definition aggregates.hh:923
│ │ │ │ -
real_type maxValue_
Definition aggregates.hh:361
│ │ │ │ -
void init(const Matrix *matrix)
Definition aggregates.hh:195
│ │ │ │ -
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:367
│ │ │ │ -
AggregateDescriptor * iterator
Definition aggregates.hh:735
│ │ │ │ -
SymmetricDependency(const Parameters &parms)
Definition aggregates.hh:348
│ │ │ │ -
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:360
│ │ │ │ -
~Aggregator()
Destructor.
│ │ │ │ -
void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter &col)
│ │ │ │ -
void add(const Vertex &vertex)
Add a vertex to the aggregate.
│ │ │ │ -
T DependencyPolicy
The policy for calculating the dependency graph.
Definition aggregates.hh:55
│ │ │ │ -
void add(std::vector< Vertex > &vertex)
│ │ │ │ -
void examine(const ColIter &col)
│ │ │ │ -
Aggregator()
Constructor.
│ │ │ │ -
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
Examine an edge.
│ │ │ │ -
FrontMarker(std::vector< Vertex > &front, MatrixGraph &graph)
Constructor.
│ │ │ │ -
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:506
│ │ │ │ -
void init(const Matrix *matrix)
│ │ │ │ -
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ │ -
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition aggregates.hh:82
│ │ │ │ -
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │ -
V AggregateDescriptor
The aggregate descriptor type.
Definition aggregates.hh:580
│ │ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ │ -
int row_
index of the currently evaluated row.
Definition aggregates.hh:365
│ │ │ │ -
SymmetricMatrixDependency()
Definition aggregates.hh:171
│ │ │ │ - │ │ │ │ - │ │ │ │ -
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:306
│ │ │ │ -
std::size_t noVertices() const
Get the number of vertices.
│ │ │ │ -
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an aisotropic problem.
Definition aggregates.hh:105
│ │ │ │ -
AggregatesMap(std::size_t noVertices)
Constructs with allocating memory.
│ │ │ │ -
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:359
│ │ │ │ -
AggregateDescriptor & operator[](const VertexDescriptor &v)
Get the aggregate a vertex belongs to.
│ │ │ │ -
AggregatesMap()
Constructs without allocating memory.
│ │ │ │ -
int value()
Access the current count.
│ │ │ │ -
SLList< VertexDescriptor, Allocator > VertexList
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:592
│ │ │ │ - │ │ │ │ -
ConnectivityCounter(const VertexSet &connected, const AggregatesMap< Vertex > &aggregates)
Constructor.
│ │ │ │ -
VertexSet::size_type size()
Get the size of the aggregate.
│ │ │ │ -
const_iterator end() const
get an iterator over the vertices of the aggregate.
│ │ │ │ -
void init(const Matrix *matrix)
│ │ │ │ -
UnSymmetricCriterion()
Definition aggregates.hh:544
│ │ │ │ -
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ -
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ │ -
int row_
index of the currently evaluated row.
Definition aggregates.hh:304
│ │ │ │ -
Stack(const MatrixGraph &graph, const Aggregator< G > &aggregatesBuilder, const AggregatesMap< Vertex > &aggregates)
│ │ │ │ -
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:180
│ │ │ │ -
void initRow(const Row &row, int index)
│ │ │ │ -
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:139
│ │ │ │ -
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:299
│ │ │ │ -
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:177
│ │ │ │ -
S VertexSet
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:801
│ │ │ │ -
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:490
│ │ │ │ -
static const V UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition aggregates.hh:566
│ │ │ │ -
std::size_t breadthFirstSearch(const VertexDescriptor &start, const AggregateDescriptor &aggregate, const G &graph, F &aggregateVisitor, VM &visitedMap) const
Breadth first search within an aggregate.
│ │ │ │ -
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:298
│ │ │ │ -
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ -
std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > &criterion)
Definition aggregates.hh:113
│ │ │ │ -
bool isIsolated()
Definition aggregates.hh:240
│ │ │ │ -
void allocate(std::size_t noVertices)
Allocate memory for holding the information.
│ │ │ │ -
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:144
│ │ │ │ -
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:473
│ │ │ │ -
void reconstruct(const Vertex &vertex)
Reconstruct the aggregat from an seed node.
│ │ │ │ -
const_iterator begin() const
get an iterator over the vertices of the aggregate.
│ │ │ │ -
FieldTraits< typenameM::field_type >::real_type operator()(const M &m, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr) const
compute the norm of a matrix.
Definition aggregates.hh:390
│ │ │ │ -
MatrixGraph::VertexDescriptor Vertex
The vertex descriptor type.
Definition aggregates.hh:789
│ │ │ │ -
void seed(const Vertex &vertex)
Initialize the aggregate with one vertex.
│ │ │ │ - │ │ │ │ -
SymmetricDependency()
Definition aggregates.hh:351
│ │ │ │ -
void clear()
Clear the aggregate.
│ │ │ │ -
void free()
Free the allocated memory.
│ │ │ │ -
void increment()
Increment counter.
│ │ │ │ -
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
│ │ │ │ -
V VertexDescriptor
The vertex descriptor type.
Definition aggregates.hh:575
│ │ │ │ -
real_type maxValue_
Definition aggregates.hh:300
│ │ │ │ -
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
│ │ │ │ -
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:149
│ │ │ │ -
PoolAllocator< Vertex, 100 > Allocator
The allocator we use for our lists and the set.
Definition aggregates.hh:795
│ │ │ │ -
G MatrixGraph
Definition aggregates.hh:785
│ │ │ │ -
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ -
@ is_sign_preserving
Definition aggregates.hh:483
│ │ │ │ -
@ is_sign_preserving
Definition aggregates.hh:382
│ │ │ │ -
@ is_sign_preserving
Definition aggregates.hh:499
│ │ │ │ -
@ is_sign_preserving
Definition aggregates.hh:466
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ +
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ │ +
int iterations
The numbe of iterations to perform.
Definition smoother.hh:47
│ │ │ │ +
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition fastamg.hh:184
│ │ │ │ +
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition fastamg.hh:704
│ │ │ │ +
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition fastamg.hh:188
│ │ │ │ +
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition fastamg.hh:150
│ │ │ │ +
void post(Domain &x)
Clean up.
Definition fastamg.hh:695
│ │ │ │ +
std::size_t maxlevels()
Definition fastamg.hh:481
│ │ │ │ +
X Domain
The domain type.
Definition fastamg.hh:77
│ │ │ │ +
Hierarchy< Domain, A >::Iterator residual
The iterator over the residuals.
Definition fastamg.hh:204
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition fastamg.hh:123
│ │ │ │ +
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:192
│ │ │ │ +
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:476
│ │ │ │ +
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:632
│ │ │ │ +
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition fastamg.hh:200
│ │ │ │ +
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition fastamg.hh:208
│ │ │ │ +
std::size_t level
The level index.
Definition fastamg.hh:212
│ │ │ │ +
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition fastamg.hh:488
│ │ │ │ +
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:427
│ │ │ │ +
FastAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const Parameters &parms, bool symmetric=true)
Construct a new amg with a specific coarse solver.
Definition fastamg.hh:297
│ │ │ │ +
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition fastamg.hh:196
│ │ │ │
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
│ │ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ │
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ │ -
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ │ -
Base class of all aggregation criterions.
Definition aggregates.hh:49
│ │ │ │ -
Dependency policy for symmetric matrices.
Definition aggregates.hh:134
│ │ │ │ -
Dependency policy for symmetric matrices.
Definition aggregates.hh:253
│ │ │ │ -
Dependency policy for symmetric matrices.
Definition aggregates.hh:314
│ │ │ │ -
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:379
│ │ │ │ -
Norm that uses only the [0][0] entry of the block to determine couplings.
Definition aggregates.hh:455
│ │ │ │ -
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:463
│ │ │ │ -
Definition aggregates.hh:480
│ │ │ │ -
Definition aggregates.hh:496
│ │ │ │ -
Criterion taking advantage of symmetric matrices.
Definition aggregates.hh:519
│ │ │ │ -
Criterion suitable for unsymmetric matrices.
Definition aggregates.hh:539
│ │ │ │ -
Class for building the aggregates.
Definition aggregates.hh:909
│ │ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ -
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:598
│ │ │ │ -
A class for temporarily storing the vertices of an aggregate in.
Definition aggregates.hh:778
│ │ │ │ -
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ │ -
EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:298
│ │ │ │ -
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ │ -
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │ │ +
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ +
A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth.
Definition fastamg.hh:60
│ │ │ │ +
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:19
│ │ │ │ + │ │ │ │ +
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ +
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
Sequential SSOR preconditioner.
Definition preconditioners.hh:141
│ │ │ │ +
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ │ +
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ +
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
│ │ │ │ +
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ +
Definition solvertype.hh:16
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,2654 +1,825 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -aggregates.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 (C) 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_AGGREGATES_HH │ │ │ │ │ -6#define DUNE_AMG_AGGREGATES_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_FASTAMG_HH │ │ │ │ │ +6#define DUNE_ISTL_FASTAMG_HH │ │ │ │ │ 7 │ │ │ │ │ -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 │ │ │ │ │ -21#include │ │ │ │ │ -22#include │ │ │ │ │ -23#include │ │ │ │ │ -24#include │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27#include │ │ │ │ │ -28 │ │ │ │ │ -29namespace _D_u_n_e │ │ │ │ │ -30{ │ │ │ │ │ -31 namespace Amg │ │ │ │ │ -32 { │ │ │ │ │ -33 │ │ │ │ │ -47 template │ │ │ │ │ -_4_8 class _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n : public T │ │ │ │ │ -49 { │ │ │ │ │ -50 │ │ │ │ │ -51 public: │ │ │ │ │ -_5_5 typedef T _D_e_p_e_n_d_e_n_c_y_P_o_l_i_c_y; │ │ │ │ │ -56 │ │ │ │ │ -_6_6 _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n() │ │ │ │ │ -67 : T() │ │ │ │ │ -68 {} │ │ │ │ │ -69 │ │ │ │ │ -_7_0 _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ -71 : T(parms) │ │ │ │ │ -72 {} │ │ │ │ │ -_8_2 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(std::size_t dim, std::size_t diameter=2) │ │ │ │ │ -83 { │ │ │ │ │ -84 this->setMaxDistance(diameter-1); │ │ │ │ │ -85 std::size_t csize=1; │ │ │ │ │ -86 │ │ │ │ │ -87 for(; dim>0; dim--) { │ │ │ │ │ -88 csize*=diameter; │ │ │ │ │ -89 this->setMaxDistance(this->maxDistance()+diameter-1); │ │ │ │ │ -90 } │ │ │ │ │ -91 this->setMinAggregateSize(csize); │ │ │ │ │ -92 this->setMaxAggregateSize(static_cast(csize*1.5)); │ │ │ │ │ -93 } │ │ │ │ │ -94 │ │ │ │ │ -_1_0_5 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c(std::size_t dim,std::size_t diameter=2) │ │ │ │ │ -106 { │ │ │ │ │ -107 _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(dim, diameter); │ │ │ │ │ -108 this->setMaxDistance(this->maxDistance()+dim-1); │ │ │ │ │ -109 } │ │ │ │ │ -110 }; │ │ │ │ │ -111 │ │ │ │ │ -112 template │ │ │ │ │ -_1_1_3 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_<_T_>& │ │ │ │ │ -criterion) │ │ │ │ │ -114 { │ │ │ │ │ -115 os<<"{ maxdistance="< │ │ │ │ │ -_1_3_3 class _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y : public _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -134 { │ │ │ │ │ -135 public: │ │ │ │ │ -_1_3_9 typedef M _M_a_t_r_i_x; │ │ │ │ │ -140 │ │ │ │ │ -_1_4_4 typedef N _N_o_r_m; │ │ │ │ │ -145 │ │ │ │ │ -_1_4_9 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ │ -150 │ │ │ │ │ -_1_5_4 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ │ -155 │ │ │ │ │ -156 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ │ -157 │ │ │ │ │ -158 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ │ -159 │ │ │ │ │ -160 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ │ -161 │ │ │ │ │ -162 template │ │ │ │ │ -163 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ │ -_c_o_l); │ │ │ │ │ -164 │ │ │ │ │ -165 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ │ -166 │ │ │ │ │ -167 │ │ │ │ │ -_1_6_8 _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ -169 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ │ -170 {} │ │ │ │ │ -_1_7_1 _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y() │ │ │ │ │ -172 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ -173 {} │ │ │ │ │ -174 │ │ │ │ │ -175 protected: │ │ │ │ │ -_1_7_7 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ │ -_1_7_9 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_1_8_0 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ -_1_8_1 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ │ -_1_8_3 _N_o_r_m _n_o_r_m__; │ │ │ │ │ -_1_8_5 int _r_o_w__; │ │ │ │ │ -_1_8_7 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ │ -_1_8_8 std::vector _v_a_l_s__; │ │ │ │ │ -_1_8_9 typename std::vector::iterator _v_a_l_I_t_e_r__; │ │ │ │ │ -190 │ │ │ │ │ -191 }; │ │ │ │ │ -192 │ │ │ │ │ -193 │ │ │ │ │ -194 template │ │ │ │ │ -_1_9_5 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const _M_a_t_r_i_x* matrix) │ │ │ │ │ -196 { │ │ │ │ │ -197 matrix_ = matrix; │ │ │ │ │ -198 } │ │ │ │ │ -199 │ │ │ │ │ -200 template │ │ │ │ │ -_2_0_1 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w(const _R_o_w& row, int │ │ │ │ │ -index) │ │ │ │ │ -202 { │ │ │ │ │ -203 using std::min; │ │ │ │ │ -204 vals_.assign(row.size(), 0.0); │ │ │ │ │ -205 assert(vals_.size()==row.size()); │ │ │ │ │ -206 valIter_=vals_.begin(); │ │ │ │ │ -207 │ │ │ │ │ -208 maxValue_ = min(- std::numeric_limits::max(), std:: │ │ │ │ │ -numeric_limits::min()); │ │ │ │ │ -209 diagonal_=norm_(row[index]); │ │ │ │ │ -210 row_ = index; │ │ │ │ │ -211 } │ │ │ │ │ -212 │ │ │ │ │ -213 template │ │ │ │ │ -_2_1_4 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l) │ │ │ │ │ -215 { │ │ │ │ │ -216 using std::max; │ │ │ │ │ -217 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ │ -218 _r_e_a_l___t_y_p_e eij = norm_(*_c_o_l); │ │ │ │ │ -219 if(!N::is_sign_preserving || eij<0) // || eji<0) │ │ │ │ │ -220 { │ │ │ │ │ -221 *valIter_ = eij/diagonal_*eij/norm_(matrix_->operator[](_c_o_l.index()) │ │ │ │ │ -[_c_o_l.index()]); │ │ │ │ │ -222 maxValue_ = max(maxValue_, *valIter_); │ │ │ │ │ -223 }else │ │ │ │ │ -224 *valIter_ =0; │ │ │ │ │ -225 ++valIter_; │ │ │ │ │ -226 } │ │ │ │ │ -227 │ │ │ │ │ -228 template │ │ │ │ │ -229 template │ │ │ │ │ -_2_3_0 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G&, const typename G:: │ │ │ │ │ -EdgeIterator& edge, const _C_o_l_I_t_e_r&) │ │ │ │ │ -231 { │ │ │ │ │ -232 if(*valIter_ > alpha() * maxValue_) { │ │ │ │ │ -233 edge.properties().setDepends(); │ │ │ │ │ -234 edge.properties().setInfluences(); │ │ │ │ │ -235 } │ │ │ │ │ -236 ++valIter_; │ │ │ │ │ -237 } │ │ │ │ │ -238 │ │ │ │ │ -239 template │ │ │ │ │ -_2_4_0 inline bool _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ │ -241 { │ │ │ │ │ -242 if(diagonal_==0) │ │ │ │ │ -243 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r, "No diagonal entry for row "< │ │ │ │ │ -_2_5_2 class _D_e_p_e_n_d_e_n_c_y : public _P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -253 { │ │ │ │ │ -254 public: │ │ │ │ │ -_2_5_8 typedef M _M_a_t_r_i_x; │ │ │ │ │ -259 │ │ │ │ │ -_2_6_3 typedef N _N_o_r_m; │ │ │ │ │ -264 │ │ │ │ │ -_2_6_8 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ │ -269 │ │ │ │ │ -_2_7_3 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ │ -274 │ │ │ │ │ -_2_7_5 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ │ -276 │ │ │ │ │ -_2_7_7 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ │ -278 │ │ │ │ │ -_2_7_9 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ │ -280 │ │ │ │ │ -281 template │ │ │ │ │ -_2_8_2 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ │ -_c_o_l); │ │ │ │ │ -283 │ │ │ │ │ -_2_8_4 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ │ -285 │ │ │ │ │ -_2_8_6 _D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ -287 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ │ -288 {} │ │ │ │ │ -289 │ │ │ │ │ -_2_9_0 _D_e_p_e_n_d_e_n_c_y() │ │ │ │ │ -291 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ -292 {} │ │ │ │ │ -293 │ │ │ │ │ -294 protected: │ │ │ │ │ -_2_9_6 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ │ -_2_9_8 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_2_9_9 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ -_3_0_0 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ │ -_3_0_2 _N_o_r_m _n_o_r_m__; │ │ │ │ │ -_3_0_4 int _r_o_w__; │ │ │ │ │ -_3_0_6 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ │ -307 }; │ │ │ │ │ -308 │ │ │ │ │ -312 template │ │ │ │ │ -_3_1_3 class _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y : public _P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -314 { │ │ │ │ │ -315 public: │ │ │ │ │ -_3_1_9 typedef M _M_a_t_r_i_x; │ │ │ │ │ -320 │ │ │ │ │ -_3_2_4 typedef N _N_o_r_m; │ │ │ │ │ -325 │ │ │ │ │ -_3_2_9 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ │ -330 │ │ │ │ │ -_3_3_4 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ │ -335 │ │ │ │ │ -_3_3_6 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ │ -337 │ │ │ │ │ -_3_3_8 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ │ -339 │ │ │ │ │ -_3_4_0 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ +15#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ │ +16#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ │ +17#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ │ +21 │ │ │ │ │ +22#include "_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h" │ │ │ │ │ +23 │ │ │ │ │ +32namespace _D_u_n_e │ │ │ │ │ +33{ │ │ │ │ │ +34 namespace Amg │ │ │ │ │ +35 { │ │ │ │ │ +58 template > │ │ │ │ │ +_5_9 class _F_a_s_t_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +60 { │ │ │ │ │ +61 public: │ │ │ │ │ +_6_3 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ │ +_7_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ +_7_2 typedef _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_> _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ │ +_7_4 typedef typename _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ │ +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(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ +107 const _P_a_r_a_m_e_t_e_r_s& parms=_P_a_r_a_m_e_t_e_r_s(), │ │ │ │ │ +108 bool symmetric=true, │ │ │ │ │ +109 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()); │ │ │ │ │ +110 │ │ │ │ │ +114 _F_a_s_t_A_M_G(const _F_a_s_t_A_M_G& amg); │ │ │ │ │ +115 │ │ │ │ │ +117 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ │ +118 │ │ │ │ │ +120 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ │ +121 │ │ │ │ │ +_1_2_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +124 { │ │ │ │ │ +125 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; │ │ │ │ │ +126 } │ │ │ │ │ +127 │ │ │ │ │ +129 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ │ +130 │ │ │ │ │ +135 template │ │ │ │ │ +136 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); │ │ │ │ │ +137 │ │ │ │ │ +138 std::size_t _l_e_v_e_l_s(); │ │ │ │ │ +139 │ │ │ │ │ +140 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ │ +141 │ │ │ │ │ +_1_5_0 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ │ +151 { │ │ │ │ │ +152 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ │ +153 } │ │ │ │ │ +154 │ │ │ │ │ +159 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; │ │ │ │ │ +160 │ │ │ │ │ +161 private: │ │ │ │ │ +168 template │ │ │ │ │ +169 void createHierarchies(C& criterion, │ │ │ │ │ +170 const std::shared_ptr& matrixptr, │ │ │ │ │ +171 const PI& pinfo); │ │ │ │ │ +172 │ │ │ │ │ +179 struct LevelContext │ │ │ │ │ +180 { │ │ │ │ │ +_1_8_4 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ │ +_1_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; │ │ │ │ │ +_1_9_2 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ │ +_1_9_6 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ │ +_2_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; │ │ │ │ │ +_2_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 _r_e_s_i_d_u_a_l; │ │ │ │ │ +_2_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; │ │ │ │ │ +_2_1_2 std::size_t _l_e_v_e_l; │ │ │ │ │ +213 }; │ │ │ │ │ +214 │ │ │ │ │ +216 void mgc(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ │ +217 │ │ │ │ │ +224 void presmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ │ +225 │ │ │ │ │ +232 void postsmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ │ +233 │ │ │ │ │ +240 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel, │ │ │ │ │ +241 _D_o_m_a_i_n& fineX); │ │ │ │ │ +242 │ │ │ │ │ +247 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ │ +248 │ │ │ │ │ +253 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ │ +254 │ │ │ │ │ +256 std::shared_ptr matrices_; │ │ │ │ │ +258 std::shared_ptr solver_; │ │ │ │ │ +260 std::shared_ptr> rhs_; │ │ │ │ │ +262 std::shared_ptr> lhs_; │ │ │ │ │ +264 std::shared_ptr> residual_; │ │ │ │ │ +265 │ │ │ │ │ +267 using _S_c_a_l_a_r_P_r_o_d_u_c_t = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ │ +269 std::shared_ptr scalarProduct_; │ │ │ │ │ +271 std::size_t gamma_; │ │ │ │ │ +273 std::size_t preSteps_; │ │ │ │ │ +275 std::size_t postSteps_; │ │ │ │ │ +276 std::size_t level; │ │ │ │ │ +277 bool buildHierarchy_; │ │ │ │ │ +278 bool symmetric; │ │ │ │ │ +279 bool coarsesolverconverged; │ │ │ │ │ +280 typedef _S_e_q_S_S_O_R_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_X_,_X_> _S_m_o_o_t_h_e_r; │ │ │ │ │ +281 typedef std::shared_ptr SmootherPointer; │ │ │ │ │ +282 SmootherPointer coarseSmoother_; │ │ │ │ │ +284 std::size_t verbosity_; │ │ │ │ │ +285 }; │ │ │ │ │ +286 │ │ │ │ │ +287 template │ │ │ │ │ +_2_8_8 _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) │ │ │ │ │ +289 : matrices_(amg.matrices_), solver_(amg.solver_), │ │ │ │ │ +290 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_), │ │ │ │ │ +291 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ │ +292 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ │ +293 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_) │ │ │ │ │ +294 {} │ │ │ │ │ +295 │ │ │ │ │ +296 template │ │ │ │ │ +_2_9_7 _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, │ │ │ │ │ +298 const _P_a_r_a_m_e_t_e_r_s& parms, bool symmetric_) │ │ │ │ │ +299 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver), │ │ │ │ │ +300 rhs_(), lhs_(), residual_(), scalarProduct_(), │ │ │ │ │ +301 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ │ +302 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ │ +303 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ │ +304 coarseSmoother_(), verbosity_(parms.debugLevel()) │ │ │ │ │ +305 { │ │ │ │ │ +306 if(preSteps_>1||postSteps_>1) │ │ │ │ │ +307 { │ │ │ │ │ +308 std::cerr<<"WARNING only one step of smoothing is supported!"<isBuilt()); │ │ │ │ │ +312 static_assert(std::is_same::value, │ │ │ │ │ +313 "Currently only sequential runs are supported"); │ │ │ │ │ +314 } │ │ │ │ │ +315 template │ │ │ │ │ +316 template │ │ │ │ │ +_3_1_7 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(const _O_p_e_r_a_t_o_r& matrix, │ │ │ │ │ +318 const C& criterion, │ │ │ │ │ +319 const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ │ +320 bool symmetric_, │ │ │ │ │ +321 const PI& pinfo) │ │ │ │ │ +322 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_ │ │ │ │ │ +(parms.getGamma()), │ │ │ │ │ +323 preSteps_(parms.getNoPreSmoothSteps()), postSteps_ │ │ │ │ │ +(parms.getNoPostSmoothSteps()), │ │ │ │ │ +324 buildHierarchy_(true), │ │ │ │ │ +325 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ │ +326 coarseSmoother_(), verbosity_(criterion.debugLevel()) │ │ │ │ │ +327 { │ │ │ │ │ +328 if(preSteps_>1||postSteps_>1) │ │ │ │ │ +329 { │ │ │ │ │ +330 std::cerr<<"WARNING only one step of smoothing is supported!"<::value, │ │ │ │ │ +334 "Currently only sequential runs are supported"); │ │ │ │ │ +335 // TODO: reestablish compile time checks. │ │ │ │ │ +336 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ │ +category), │ │ │ │ │ +337 // "Matrix and Solver must match in terms of category!"); │ │ │ │ │ +338 auto matrixptr = stackobject_to_shared_ptr(matrix); │ │ │ │ │ +339 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ │ +340 } │ │ │ │ │ 341 │ │ │ │ │ -342 template │ │ │ │ │ -_3_4_3 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ │ -_c_o_l); │ │ │ │ │ -344 │ │ │ │ │ -_3_4_5 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ │ -346 │ │ │ │ │ -347 │ │ │ │ │ -_3_4_8 _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ -349 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ │ -350 {} │ │ │ │ │ -_3_5_1 _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y() │ │ │ │ │ -352 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ -353 {} │ │ │ │ │ +342 template │ │ │ │ │ +343 template │ │ │ │ │ +344 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_c_r_e_a_t_e_H_i_e_r_a_r_c_h_i_e_s(C& criterion, │ │ │ │ │ +345 const std::shared_ptr& matrixptr, │ │ │ │ │ +346 const PI& pinfo) │ │ │ │ │ +347 { │ │ │ │ │ +348 Timer watch; │ │ │ │ │ +349 matrices_ = std::make_shared( │ │ │ │ │ +350 std::const_pointer_cast(matrixptr), │ │ │ │ │ +351 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ │ +352 │ │ │ │ │ +353 matrices_->template build >(criterion); │ │ │ │ │ 354 │ │ │ │ │ -355 protected: │ │ │ │ │ -_3_5_7 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ │ -_3_5_9 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_3_6_0 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ -_3_6_1 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ │ -_3_6_3 _N_o_r_m _n_o_r_m__; │ │ │ │ │ -_3_6_5 int _r_o_w__; │ │ │ │ │ -_3_6_7 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ │ -368 private: │ │ │ │ │ -369 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::true_type&); │ │ │ │ │ -370 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::false_type&); │ │ │ │ │ -371 }; │ │ │ │ │ -372 │ │ │ │ │ -377 template │ │ │ │ │ -_3_7_8 class _D_i_a_g_o_n_a_l │ │ │ │ │ -379 { │ │ │ │ │ -380 public: │ │ │ │ │ -381 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ -382 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = true │ │ │ │ │ -_3_8_3 }; │ │ │ │ │ -384 │ │ │ │ │ -389 template │ │ │ │ │ -_3_9_0 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ -m, │ │ │ │ │ -391 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ -sfinae = nullptr) const │ │ │ │ │ -392 { │ │ │ │ │ -393 typedef typename M::field_type field_type; │ │ │ │ │ -394 typedef typename FieldTraits::real_type real_type; │ │ │ │ │ -395 static_assert( std::is_convertible::value, │ │ │ │ │ -396 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ │ -397 return m[N][N]; │ │ │ │ │ -398 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ │ -399 } │ │ │ │ │ -400 │ │ │ │ │ -405 template │ │ │ │ │ -_4_0_6 auto _o_p_e_r_a_t_o_r_(_)(const M& m, │ │ │ │ │ -407 typename std::enable_if_t::value>* sfinae = nullptr) │ │ │ │ │ -const │ │ │ │ │ -408 { │ │ │ │ │ -409 typedef typename FieldTraits::real_type real_type; │ │ │ │ │ -410 static_assert( std::is_convertible::value, │ │ │ │ │ -411 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ │ -412 return m; │ │ │ │ │ -413 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ │ -414 } │ │ │ │ │ -415 │ │ │ │ │ -416 private: │ │ │ │ │ -417 │ │ │ │ │ -419 template │ │ │ │ │ -420 static T signed_abs(const T & v) │ │ │ │ │ -421 { │ │ │ │ │ -422 return v; │ │ │ │ │ +355 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ │ +().rank()==0) │ │ │ │ │ +356 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ │ +"<levels()==matrices_->maxlevels()) { │ │ │ │ │ +359 // We have the carsest level. Create the coarse Solver │ │ │ │ │ +360 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; │ │ │ │ │ +361 SmootherArgs sargs; │ │ │ │ │ +362 sargs._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ │ +363 │ │ │ │ │ +364 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; │ │ │ │ │ +365 cargs.setArgs(sargs); │ │ │ │ │ +366 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ │ +367 // Solve on the redistributed partitioning │ │ │ │ │ +368 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ │ +()); │ │ │ │ │ +369 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ +()); │ │ │ │ │ +370 }else{ │ │ │ │ │ +371 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ │ +372 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ │ +373 } │ │ │ │ │ +374 │ │ │ │ │ +375 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); │ │ │ │ │ +376 scalarProduct_ = createScalarProduct(cargs.getComm(),category()); │ │ │ │ │ +377 │ │ │ │ │ +378#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +379#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +380#define DIRECTSOLVER UMFPack │ │ │ │ │ +381#else │ │ │ │ │ +382#define DIRECTSOLVER SuperLU │ │ │ │ │ +383#endif │ │ │ │ │ +384 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ │ +the coarsest level. │ │ │ │ │ +385 if(std::is_same::value / │ │ │ │ │ +/ sequential mode │ │ │ │ │ +386 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ │ +parallel mode and only one processor │ │ │ │ │ +387 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ │ +388 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ +().communicator().size()==1 │ │ │ │ │ +389 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ +().communicator().size()>0)) { // redistribute and 1 proc │ │ │ │ │ +390 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ │ +>communicator().rank()==0) │ │ │ │ │ +391 std::cout<<"Using superlu"<parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ +393 { │ │ │ │ │ +394 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ +395 // We are still participating on this level │ │ │ │ │ +396 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ │ +().coarsest().getRedistributed().getmat(), false, false)); │ │ │ │ │ +397 else │ │ │ │ │ +398 solver_.reset(); │ │ │ │ │ +399 }else │ │ │ │ │ +400 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ │ +().coarsest()->getmat(), false, false)); │ │ │ │ │ +401 }else │ │ │ │ │ +402#undef DIRECTSOLVER │ │ │ │ │ +403#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +404 { │ │ │ │ │ +405 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ +406 { │ │ │ │ │ +407 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ +408 // We are still participating on this level │ │ │ │ │ +409 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ │ +().coarsest().getRedistributed()), │ │ │ │ │ +410 *scalarProduct_, │ │ │ │ │ +411 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ +412 else │ │ │ │ │ +413 solver_.reset(); │ │ │ │ │ +414 }else │ │ │ │ │ +415 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ │ +().coarsest()), │ │ │ │ │ +416 *scalarProduct_, │ │ │ │ │ +417 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ +418 } │ │ │ │ │ +419 } │ │ │ │ │ +420 │ │ │ │ │ +421 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ │ +().rank()==0) │ │ │ │ │ +422 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ │ +"< │ │ │ │ │ -427 static T signed_abs(const std::complex & v) │ │ │ │ │ +425 │ │ │ │ │ +426 template │ │ │ │ │ +_4_2_7 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) │ │ │ │ │ 428 { │ │ │ │ │ -429 // return sign * abs_value │ │ │ │ │ -430 // in case of complex numbers this extends to using the csgn function to │ │ │ │ │ -determine the sign │ │ │ │ │ -431 return csgn(v) * std::abs(v); │ │ │ │ │ -432 } │ │ │ │ │ -433 │ │ │ │ │ -435 template │ │ │ │ │ -436 static T csgn(const T & v) │ │ │ │ │ -437 { │ │ │ │ │ -438 return (T(0) < v) - (v < T(0)); │ │ │ │ │ -439 } │ │ │ │ │ +429 Timer watch, watch1; │ │ │ │ │ +430 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ │ +431 // zero and set x such that A_dd*x_d=b_d │ │ │ │ │ +432 // Thus users can be more careless when setting up their linear │ │ │ │ │ +433 // systems. │ │ │ │ │ +434 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ │ +435 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; │ │ │ │ │ +436 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; │ │ │ │ │ +437 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ │ +438 Block zero; │ │ │ │ │ +439 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ │ 440 │ │ │ │ │ -442 template │ │ │ │ │ -443 static T csgn(std::complex a) │ │ │ │ │ -444 { │ │ │ │ │ -445 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag()); │ │ │ │ │ -446 } │ │ │ │ │ -447 │ │ │ │ │ -448 }; │ │ │ │ │ -449 │ │ │ │ │ -_4_5_4 class _F_i_r_s_t_D_i_a_g_o_n_a_l : public _D_i_a_g_o_n_a_l<0> │ │ │ │ │ -455 {}; │ │ │ │ │ -456 │ │ │ │ │ -_4_6_2 struct _R_o_w_S_u_m │ │ │ │ │ -463 { │ │ │ │ │ -464 │ │ │ │ │ -465 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ -466 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ │ -_4_6_7 }; │ │ │ │ │ -472 template │ │ │ │ │ -_4_7_3 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ -m) const │ │ │ │ │ -474 { │ │ │ │ │ -475 return m.infinity_norm(); │ │ │ │ │ -476 } │ │ │ │ │ -477 }; │ │ │ │ │ -478 │ │ │ │ │ -_4_7_9 struct _F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ │ -480 { │ │ │ │ │ -481 │ │ │ │ │ -482 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ -483 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ │ -_4_8_4 }; │ │ │ │ │ -489 template │ │ │ │ │ -_4_9_0 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ -m) const │ │ │ │ │ -491 { │ │ │ │ │ -492 return m.frobenius_norm(); │ │ │ │ │ -493 } │ │ │ │ │ -494 }; │ │ │ │ │ -_4_9_5 struct _A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ │ -496 { │ │ │ │ │ -497 │ │ │ │ │ -498 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ -499 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ │ -_5_0_0 }; │ │ │ │ │ -505 template │ │ │ │ │ -_5_0_6 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ -m) const │ │ │ │ │ -507 { │ │ │ │ │ -508 return 1; │ │ │ │ │ -509 } │ │ │ │ │ -510 }; │ │ │ │ │ -517 template │ │ │ │ │ -_5_1_8 class _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n : public │ │ │ │ │ -_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n > │ │ │ │ │ -519 { │ │ │ │ │ -520 public: │ │ │ │ │ -_5_2_1 _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ -522 : _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n<_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y >(parms) │ │ │ │ │ -523 {} │ │ │ │ │ -_5_2_4 _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ │ -525 {} │ │ │ │ │ -526 }; │ │ │ │ │ -527 │ │ │ │ │ -528 │ │ │ │ │ -537 template │ │ │ │ │ -_5_3_8 class _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n : public _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ -> │ │ │ │ │ -539 { │ │ │ │ │ -540 public: │ │ │ │ │ -_5_4_1 _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ -542 : _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n<_D_e_p_e_n_d_e_n_c_y >(parms) │ │ │ │ │ -543 {} │ │ │ │ │ -_5_4_4 _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ │ -545 {} │ │ │ │ │ -546 }; │ │ │ │ │ -547 // forward declaration │ │ │ │ │ -548 template class Aggregator; │ │ │ │ │ -549 │ │ │ │ │ -550 │ │ │ │ │ -558 template │ │ │ │ │ -_5_5_9 class _A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -560 { │ │ │ │ │ -561 public: │ │ │ │ │ -562 │ │ │ │ │ -_5_6_6 static const V _U_N_A_G_G_R_E_G_A_T_E_D; │ │ │ │ │ +441 const _M_a_t_r_i_x& _m_a_t=matrices_->matrices().finest()->getmat(); │ │ │ │ │ +442 for(RowIter row=_m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ │ +443 bool isDirichlet = true; │ │ │ │ │ +444 bool hasDiagonal = false; │ │ │ │ │ +445 ColIter diag; │ │ │ │ │ +446 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ │ +447 if(row.index()==_c_o_l.index()) { │ │ │ │ │ +448 diag = _c_o_l; │ │ │ │ │ +449 hasDiagonal = (*_c_o_l != zero); │ │ │ │ │ +450 }else{ │ │ │ │ │ +451 if(*_c_o_l!=zero) │ │ │ │ │ +452 isDirichlet = false; │ │ │ │ │ +453 } │ │ │ │ │ +454 } │ │ │ │ │ +455 if(isDirichlet && hasDiagonal) │ │ │ │ │ +456 diag->solve(x[row.index()], b[row.index()]); │ │ │ │ │ +457 } │ │ │ │ │ +458 if (verbosity_>0) │ │ │ │ │ +459 std::cout<<" Preprocessing Dirichlet took "<parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ │ +463 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ │ +464 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ │ +465 residual_ = std::make_shared>(std::make_shared │ │ │ │ │ +(x)); │ │ │ │ │ +466 matrices_->coarsenVector(*rhs_); │ │ │ │ │ +467 matrices_->coarsenVector(*lhs_); │ │ │ │ │ +468 matrices_->coarsenVector(*residual_); │ │ │ │ │ +469 │ │ │ │ │ +470 // The preconditioner might change x and b. So we have to │ │ │ │ │ +471 // copy the changes to the original vectors. │ │ │ │ │ +472 x = *lhs_->finest(); │ │ │ │ │ +473 b = *rhs_->finest(); │ │ │ │ │ +474 } │ │ │ │ │ +475 template │ │ │ │ │ +_4_7_6 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ │ +477 { │ │ │ │ │ +478 return matrices_->levels(); │ │ │ │ │ +479 } │ │ │ │ │ +480 template │ │ │ │ │ +_4_8_1 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ │ +482 { │ │ │ │ │ +483 return matrices_->maxlevels(); │ │ │ │ │ +484 } │ │ │ │ │ +485 │ │ │ │ │ +487 template │ │ │ │ │ +_4_8_8 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) │ │ │ │ │ +489 { │ │ │ │ │ +490 LevelContext levelContext; │ │ │ │ │ +491 // Init all iterators for the current level │ │ │ │ │ +492 initIteratorsWithFineLevel(levelContext); │ │ │ │ │ +493 │ │ │ │ │ +494 assert(v.two_norm()==0); │ │ │ │ │ +495 │ │ │ │ │ +496 level=0; │ │ │ │ │ +497 if(matrices_->maxlevels()==1){ │ │ │ │ │ +498 // The coarse solver might modify the d! │ │ │ │ │ +499 _R_a_n_g_e b(d); │ │ │ │ │ +500 mgc(levelContext, v, b); │ │ │ │ │ +501 }else │ │ │ │ │ +502 mgc(levelContext, v, d); │ │ │ │ │ +503 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ │ +504 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ │ +505 } │ │ │ │ │ +506 │ │ │ │ │ +507 template │ │ │ │ │ +508 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_i_n_i_t_I_t_e_r_a_t_o_r_s_W_i_t_h_F_i_n_e_L_e_v_e_l(LevelContext& │ │ │ │ │ +levelContext) │ │ │ │ │ +509 { │ │ │ │ │ +510 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ │ +511 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ │ +512 levelContext.redist = │ │ │ │ │ +513 matrices_->redistributeInformation().begin(); │ │ │ │ │ +514 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ │ +515 levelContext.lhs = lhs_->finest(); │ │ │ │ │ +516 levelContext.residual = residual_->finest(); │ │ │ │ │ +517 levelContext.rhs = rhs_->finest(); │ │ │ │ │ +518 levelContext.level=0; │ │ │ │ │ +519 } │ │ │ │ │ +520 │ │ │ │ │ +521 template │ │ │ │ │ +522 bool FastAMG │ │ │ │ │ +523 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ │ +524 { │ │ │ │ │ +525 bool processNextLevel=true; │ │ │ │ │ +526 │ │ │ │ │ +527 if(levelContext.redist->isSetup()) { │ │ │ │ │ +528 throw "bla"; │ │ │ │ │ +529 levelContext.redist->redistribute(static_cast │ │ │ │ │ +(*levelContext.residual), │ │ │ │ │ +530 levelContext.residual.getRedistributed()); │ │ │ │ │ +531 processNextLevel = levelContext.residual.getRedistributed().size()>0; │ │ │ │ │ +532 if(processNextLevel) { │ │ │ │ │ +533 //restrict defect to coarse level right hand side. │ │ │ │ │ +534 ++levelContext.pinfo; │ │ │ │ │ +535 Transfer │ │ │ │ │ +536 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ │ +537 static_cast(levelContext.residual.getRedistributed()), │ │ │ │ │ +538 *levelContext.pinfo); │ │ │ │ │ +539 } │ │ │ │ │ +540 }else{ │ │ │ │ │ +541 //restrict defect to coarse level right hand side. │ │ │ │ │ +542 ++levelContext.rhs; │ │ │ │ │ +543 ++levelContext.pinfo; │ │ │ │ │ +544 Transfer │ │ │ │ │ +545 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ │ +546 static_cast(*levelContext.residual), *levelContext.pinfo); │ │ │ │ │ +547 } │ │ │ │ │ +548 │ │ │ │ │ +549 if(processNextLevel) { │ │ │ │ │ +550 // prepare coarse system │ │ │ │ │ +551 ++levelContext.residual; │ │ │ │ │ +552 ++levelContext.lhs; │ │ │ │ │ +553 ++levelContext.matrix; │ │ │ │ │ +554 ++levelContext.level; │ │ │ │ │ +555 ++levelContext.redist; │ │ │ │ │ +556 │ │ │ │ │ +557 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ +>levels()maxlevels()) { │ │ │ │ │ +558 // next level is not the globally coarsest one │ │ │ │ │ +559 ++levelContext.aggregates; │ │ │ │ │ +560 } │ │ │ │ │ +561 // prepare the lhs on the next level │ │ │ │ │ +562 *levelContext.lhs=0; │ │ │ │ │ +563 *levelContext.residual=0; │ │ │ │ │ +564 } │ │ │ │ │ +565 return processNextLevel; │ │ │ │ │ +566 } │ │ │ │ │ 567 │ │ │ │ │ -_5_7_1 static const V _I_S_O_L_A_T_E_D; │ │ │ │ │ -_5_7_5 typedef V _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ -576 │ │ │ │ │ -_5_8_0 typedef V _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ -581 │ │ │ │ │ -_5_8_6 typedef PoolAllocator _A_l_l_o_c_a_t_o_r; │ │ │ │ │ +568 template │ │ │ │ │ +569 void FastAMG │ │ │ │ │ +570 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, │ │ │ │ │ +Domain& x) │ │ │ │ │ +571 { │ │ │ │ │ +572 if(processNextLevel) { │ │ │ │ │ +573 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ +>levels()maxlevels()) { │ │ │ │ │ +574 // previous level is not the globally coarsest one │ │ │ │ │ +575 --levelContext.aggregates; │ │ │ │ │ +576 } │ │ │ │ │ +577 --levelContext.redist; │ │ │ │ │ +578 --levelContext.level; │ │ │ │ │ +579 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ │ +580 --levelContext.matrix; │ │ │ │ │ +581 --levelContext.residual; │ │ │ │ │ +582 │ │ │ │ │ +583 } │ │ │ │ │ +584 │ │ │ │ │ +585 typename Hierarchy::Iterator coarseLhs = levelContext.lhs--; │ │ │ │ │ +586 if(levelContext.redist->isSetup()) { │ │ │ │ │ 587 │ │ │ │ │ -_5_9_2 typedef SLList _V_e_r_t_e_x_L_i_s_t; │ │ │ │ │ -593 │ │ │ │ │ -_5_9_7 class _D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ │ -598 { │ │ │ │ │ -599 public: │ │ │ │ │ -600 template │ │ │ │ │ -_6_0_1 void _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const EdgeIterator& edge) const │ │ │ │ │ -602 {} │ │ │ │ │ -603 }; │ │ │ │ │ -604 │ │ │ │ │ -605 │ │ │ │ │ -_6_0_9 _A_g_g_r_e_g_a_t_e_s_M_a_p(); │ │ │ │ │ -610 │ │ │ │ │ -_6_1_6 _A_g_g_r_e_g_a_t_e_s_M_a_p(std::size_t _n_o_V_e_r_t_i_c_e_s); │ │ │ │ │ -617 │ │ │ │ │ -_6_2_1 _~_A_g_g_r_e_g_a_t_e_s_M_a_p(); │ │ │ │ │ -622 │ │ │ │ │ -634 template │ │ │ │ │ -_6_3_5 std::tuple _b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(const M& matrix, G& graph, │ │ │ │ │ -const C& criterion, │ │ │ │ │ -636 bool finestLevel); │ │ │ │ │ -637 │ │ │ │ │ -655 template │ │ │ │ │ -_6_5_6 std::size_t _b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& start, │ │ │ │ │ -657 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -658 const G& graph, │ │ │ │ │ -659 F& aggregateVisitor, │ │ │ │ │ -660 VM& visitedMap) const; │ │ │ │ │ -661 │ │ │ │ │ -685 template │ │ │ │ │ -_6_8_6 std::size_t _b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& start, │ │ │ │ │ -687 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -688 const G& graph, L& visited, F1& aggregateVisitor, │ │ │ │ │ -689 F2& nonAggregateVisitor, │ │ │ │ │ -690 VM& visitedMap) const; │ │ │ │ │ +588 // Need to redistribute during prolongate │ │ │ │ │ +589 Transfer │ │ │ │ │ +590 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ │ +591 levelContext.lhs.getRedistributed(), │ │ │ │ │ +592 matrices_->getProlongationDampingFactor(), │ │ │ │ │ +593 *levelContext.pinfo, *levelContext.redist); │ │ │ │ │ +594 }else{ │ │ │ │ │ +595 Transfer │ │ │ │ │ +596 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ │ +597 matrices_->getProlongationDampingFactor(), *levelContext.pinfo); │ │ │ │ │ +598 │ │ │ │ │ +599 // printvector(std::cout, *lhs, "prolongated coarse grid correction", │ │ │ │ │ +"lhs", 10, 10, 10); │ │ │ │ │ +600 } │ │ │ │ │ +601 │ │ │ │ │ +602 │ │ │ │ │ +603 if(processNextLevel) { │ │ │ │ │ +604 --levelContext.rhs; │ │ │ │ │ +605 } │ │ │ │ │ +606 │ │ │ │ │ +607 } │ │ │ │ │ +608 │ │ │ │ │ +609 │ │ │ │ │ +610 template │ │ │ │ │ +611 void FastAMG │ │ │ │ │ +612 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ │ +613 { │ │ │ │ │ +614 constexpr auto bl = blockLevel(); │ │ │ │ │ +615 _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(), │ │ │ │ │ +616 x, │ │ │ │ │ +617 *levelContext.residual, │ │ │ │ │ +618 b); │ │ │ │ │ +619 } │ │ │ │ │ +620 │ │ │ │ │ +621 template │ │ │ │ │ +622 void FastAMG │ │ │ │ │ +623 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ │ +624 { │ │ │ │ │ +625 constexpr auto bl = blockLevel(); │ │ │ │ │ +626 GaussSeidelPostsmoothDefect │ │ │ │ │ +627 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b); │ │ │ │ │ +628 } │ │ │ │ │ +629 │ │ │ │ │ +630 │ │ │ │ │ +631 template │ │ │ │ │ +_6_3_2 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 │ │ │ │ │ +633 { │ │ │ │ │ +634 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; │ │ │ │ │ +635 } │ │ │ │ │ +636 │ │ │ │ │ +637 template │ │ │ │ │ +638 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_g_c(LevelContext& levelContext, Domain& v, const │ │ │ │ │ +Range& b){ │ │ │ │ │ +639 │ │ │ │ │ +640 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ │ +()==maxlevels()) { │ │ │ │ │ +641 // Solve directly │ │ │ │ │ +642 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ +643 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ │ +644 if(levelContext.redist->isSetup()) { │ │ │ │ │ +645 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed()); │ │ │ │ │ +646 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ │ +647 // We are still participating in the computation │ │ │ │ │ +648 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ │ +(levelContext.rhs.getRedistributed(), │ │ │ │ │ +649 levelContext.rhs.getRedistributed()); │ │ │ │ │ +650 solver_->apply(levelContext.lhs.getRedistributed(), │ │ │ │ │ +levelContext.rhs.getRedistributed(), res); │ │ │ │ │ +651 } │ │ │ │ │ +652 levelContext.redist->redistributeBackward(v, │ │ │ │ │ +levelContext.lhs.getRedistributed()); │ │ │ │ │ +653 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ │ +654 }else{ │ │ │ │ │ +655 levelContext.pinfo->copyOwnerToAll(b, b); │ │ │ │ │ +656 solver_->apply(v, const_cast(b), res); │ │ │ │ │ +657 } │ │ │ │ │ +658 │ │ │ │ │ +659 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10); │ │ │ │ │ +660 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10); │ │ │ │ │ +661 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ │ +662 coarsesolverconverged = false; │ │ │ │ │ +663 }else{ │ │ │ │ │ +664 // presmoothing │ │ │ │ │ +665 _p_r_e_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ │ +666 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10); │ │ │ │ │ +667 // printvector(std::cout, *residual, "post presmooth residual", "r", 10); │ │ │ │ │ +668#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ │ +669 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ │ +670 │ │ │ │ │ +671 if(processNextLevel) { │ │ │ │ │ +672 // next level │ │ │ │ │ +673 for(std::size_t i=0; imatrices().finest()) { │ │ │ │ │ +683 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ │ +>communicator().prod(coarsesolverconverged); │ │ │ │ │ +684 if(!coarsesolverconverged) │ │ │ │ │ +685 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ │ +686 } │ │ │ │ │ +687 │ │ │ │ │ +688 _p_o_s_t_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ │ +689 } │ │ │ │ │ +690 } │ │ │ │ │ 691 │ │ │ │ │ -_6_9_7 void _a_l_l_o_c_a_t_e(std::size_t _n_o_V_e_r_t_i_c_e_s); │ │ │ │ │ -698 │ │ │ │ │ -_7_0_2 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ │ -703 │ │ │ │ │ -_7_0_7 void _f_r_e_e(); │ │ │ │ │ +692 │ │ │ │ │ +694 template │ │ │ │ │ +_6_9_5 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) │ │ │ │ │ +696 { │ │ │ │ │ +697 lhs_=nullptr; │ │ │ │ │ +698 rhs_=nullptr; │ │ │ │ │ +699 residual_=nullptr; │ │ │ │ │ +700 } │ │ │ │ │ +701 │ │ │ │ │ +702 template │ │ │ │ │ +703 template │ │ │ │ │ +_7_0_4 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) │ │ │ │ │ +705 { │ │ │ │ │ +706 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ │ +707 } │ │ │ │ │ 708 │ │ │ │ │ -_7_1_4 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& v); │ │ │ │ │ -715 │ │ │ │ │ -_7_2_1 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& v) const; │ │ │ │ │ -722 │ │ │ │ │ -_7_2_3 typedef const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r* _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -724 │ │ │ │ │ -_7_2_5 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const │ │ │ │ │ -726 { │ │ │ │ │ -727 return aggregates_; │ │ │ │ │ -728 } │ │ │ │ │ -729 │ │ │ │ │ -_7_3_0 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const │ │ │ │ │ -731 { │ │ │ │ │ -732 return aggregates_+_n_o_V_e_r_t_i_c_e_s(); │ │ │ │ │ -733 } │ │ │ │ │ -734 │ │ │ │ │ -_7_3_5 typedef _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r* _i_t_e_r_a_t_o_r; │ │ │ │ │ -736 │ │ │ │ │ -_7_3_7 _i_t_e_r_a_t_o_r _b_e_g_i_n() │ │ │ │ │ -738 { │ │ │ │ │ -739 return aggregates_; │ │ │ │ │ -740 } │ │ │ │ │ -741 │ │ │ │ │ -_7_4_2 _i_t_e_r_a_t_o_r _e_n_d() │ │ │ │ │ -743 { │ │ │ │ │ -744 return aggregates_+_n_o_V_e_r_t_i_c_e_s(); │ │ │ │ │ -745 } │ │ │ │ │ -746 private: │ │ │ │ │ -748 _A_g_g_r_e_g_a_t_e_s_M_a_p(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>&) = delete; │ │ │ │ │ -750 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>& operator=(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>&) = delete; │ │ │ │ │ -751 │ │ │ │ │ -755 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r* aggregates_; │ │ │ │ │ -756 │ │ │ │ │ -760 std::size_t noVertices_; │ │ │ │ │ -761 }; │ │ │ │ │ -762 │ │ │ │ │ -766 template │ │ │ │ │ -_7_6_7 void _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(G& graph, │ │ │ │ │ -768 const typename C::Matrix& matrix, │ │ │ │ │ -769 C criterion, │ │ │ │ │ -770 bool finestLevel); │ │ │ │ │ -771 │ │ │ │ │ -776 template │ │ │ │ │ -_7_7_7 class _A_g_g_r_e_g_a_t_e │ │ │ │ │ -778 { │ │ │ │ │ -779 │ │ │ │ │ -780 public: │ │ │ │ │ -781 │ │ │ │ │ -782 /*** │ │ │ │ │ -783 * @brief The type of the matrix graph we work with. │ │ │ │ │ -784 */ │ │ │ │ │ -_7_8_5 typedef G _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ │ -_7_8_9 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _V_e_r_t_e_x; │ │ │ │ │ -790 │ │ │ │ │ -_7_9_5 typedef PoolAllocator _A_l_l_o_c_a_t_o_r; │ │ │ │ │ -796 │ │ │ │ │ -_8_0_1 typedef S _V_e_r_t_e_x_S_e_t; │ │ │ │ │ -802 │ │ │ │ │ -_8_0_4 typedef typename VertexSet::const_iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -805 │ │ │ │ │ -_8_0_9 typedef std::size_t* _S_p_h_e_r_e_M_a_p; │ │ │ │ │ -810 │ │ │ │ │ -_8_1_9 _A_g_g_r_e_g_a_t_e(_M_a_t_r_i_x_G_r_a_p_h& graph, _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -820 _V_e_r_t_e_x_S_e_t& connectivity, std::vector& front_); │ │ │ │ │ -821 │ │ │ │ │ -_8_2_2 void _i_n_v_a_l_i_d_a_t_e() │ │ │ │ │ -823 { │ │ │ │ │ -824 --id_; │ │ │ │ │ -825 } │ │ │ │ │ -826 │ │ │ │ │ -_8_3_3 void _r_e_c_o_n_s_t_r_u_c_t(const _V_e_r_t_e_x& vertex); │ │ │ │ │ -834 │ │ │ │ │ -_8_3_8 void _s_e_e_d(const _V_e_r_t_e_x& vertex); │ │ │ │ │ -839 │ │ │ │ │ -_8_4_3 void _a_d_d(const _V_e_r_t_e_x& vertex); │ │ │ │ │ -844 │ │ │ │ │ -_8_4_5 void _a_d_d(std::vector& vertex); │ │ │ │ │ -_8_4_9 void _c_l_e_a_r(); │ │ │ │ │ -850 │ │ │ │ │ -_8_5_4 typename VertexSet::size_type _s_i_z_e(); │ │ │ │ │ -_8_5_8 typename VertexSet::size_type _c_o_n_n_e_c_t_S_i_z_e(); │ │ │ │ │ -859 │ │ │ │ │ -_8_6_3 int _i_d(); │ │ │ │ │ -864 │ │ │ │ │ -_8_6_6 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ -867 │ │ │ │ │ -_8_6_9 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ -870 │ │ │ │ │ -871 private: │ │ │ │ │ -875 _V_e_r_t_e_x_S_e_t vertices_; │ │ │ │ │ -876 │ │ │ │ │ -881 int id_; │ │ │ │ │ -882 │ │ │ │ │ -886 _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ │ -887 │ │ │ │ │ -891 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ │ -892 │ │ │ │ │ -896 _V_e_r_t_e_x_S_e_t& connected_; │ │ │ │ │ -897 │ │ │ │ │ -901 std::vector& front_; │ │ │ │ │ -902 }; │ │ │ │ │ -903 │ │ │ │ │ -907 template │ │ │ │ │ -_9_0_8 class _A_g_g_r_e_g_a_t_o_r │ │ │ │ │ -909 { │ │ │ │ │ -910 public: │ │ │ │ │ -911 │ │ │ │ │ -_9_1_5 typedef G _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ │ -916 │ │ │ │ │ -_9_2_0 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _V_e_r_t_e_x; │ │ │ │ │ -921 │ │ │ │ │ -_9_2_3 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ -924 │ │ │ │ │ -_9_2_8 _A_g_g_r_e_g_a_t_o_r(); │ │ │ │ │ -929 │ │ │ │ │ -_9_3_3 _~_A_g_g_r_e_g_a_t_o_r(); │ │ │ │ │ -934 │ │ │ │ │ -951 template │ │ │ │ │ -_9_5_2 std::tuple _b_u_i_l_d(const M& m, G& graph, │ │ │ │ │ -953 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const C& c, │ │ │ │ │ -954 bool finestLevel); │ │ │ │ │ -955 private: │ │ │ │ │ -960 typedef PoolAllocator Allocator; │ │ │ │ │ -961 │ │ │ │ │ -965 typedef SLList VertexList; │ │ │ │ │ -966 │ │ │ │ │ -970 typedef std::set,Allocator> VertexSet; │ │ │ │ │ -971 │ │ │ │ │ -975 typedef std::size_t* SphereMap; │ │ │ │ │ -976 │ │ │ │ │ -980 _M_a_t_r_i_x_G_r_a_p_h* graph_; │ │ │ │ │ -981 │ │ │ │ │ -985 _A_g_g_r_e_g_a_t_e_<_M_a_t_r_i_x_G_r_a_p_h_,_V_e_r_t_e_x_S_e_t_>* aggregate_; │ │ │ │ │ -986 │ │ │ │ │ -990 std::vector front_; │ │ │ │ │ -991 │ │ │ │ │ -995 VertexSet connected_; │ │ │ │ │ -996 │ │ │ │ │ -1000 int size_; │ │ │ │ │ -1001 │ │ │ │ │ -1005 class Stack │ │ │ │ │ -1006 { │ │ │ │ │ -1007 public: │ │ │ │ │ -_1_0_0_8 static const _V_e_r_t_e_x _N_u_l_l_E_n_t_r_y; │ │ │ │ │ -1009 │ │ │ │ │ -_1_0_1_0 _S_t_a_c_k(const _M_a_t_r_i_x_G_r_a_p_h& graph, │ │ │ │ │ -1011 const _A_g_g_r_e_g_a_t_o_r_<_G_>& aggregatesBuilder, │ │ │ │ │ -1012 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates); │ │ │ │ │ -_1_0_1_3 _~_S_t_a_c_k(); │ │ │ │ │ -_1_0_1_4 _V_e_r_t_e_x _p_o_p(); │ │ │ │ │ -1015 private: │ │ │ │ │ -1016 enum { N = 1300000 }; │ │ │ │ │ -1017 │ │ │ │ │ -1019 const _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ │ -1021 const _A_g_g_r_e_g_a_t_o_r_<_G_>& aggregatesBuilder_; │ │ │ │ │ -1023 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ │ -1025 int size_; │ │ │ │ │ -1026 _V_e_r_t_e_x maxSize_; │ │ │ │ │ -1028 typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r begin_; │ │ │ │ │ -1029 typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r end_; │ │ │ │ │ -1030 │ │ │ │ │ -1032 _V_e_r_t_e_x* vals_; │ │ │ │ │ -1033 │ │ │ │ │ -1034 }; │ │ │ │ │ -1035 │ │ │ │ │ -_1_0_3_6 friend class Stack; │ │ │ │ │ -1037 │ │ │ │ │ -1048 template │ │ │ │ │ -1049 void visitAggregateNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1050 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -1051 V& visitor) const; │ │ │ │ │ -1052 │ │ │ │ │ -1057 template │ │ │ │ │ -1058 class AggregateVisitor │ │ │ │ │ -1059 { │ │ │ │ │ -1060 public: │ │ │ │ │ -_1_0_6_4 typedef V _V_i_s_i_t_o_r; │ │ │ │ │ -_1_0_7_2 _A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1073 _V_i_s_i_t_o_r& visitor); │ │ │ │ │ -1074 │ │ │ │ │ -_1_0_8_1 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ │ -1082 │ │ │ │ │ -1083 private: │ │ │ │ │ -1085 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ │ -1087 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r aggregate_; │ │ │ │ │ -1089 _V_i_s_i_t_o_r* visitor_; │ │ │ │ │ -1090 }; │ │ │ │ │ -1091 │ │ │ │ │ -1095 class Counter │ │ │ │ │ -1096 { │ │ │ │ │ -1097 public: │ │ │ │ │ -_1_0_9_9 _C_o_u_n_t_e_r(); │ │ │ │ │ -_1_1_0_1 int _v_a_l_u_e(); │ │ │ │ │ -1102 │ │ │ │ │ -1103 protected: │ │ │ │ │ -_1_1_0_5 void _i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -_1_1_0_7 void _d_e_c_r_e_m_e_n_t(); │ │ │ │ │ -1108 │ │ │ │ │ -1109 private: │ │ │ │ │ -1110 int count_; │ │ │ │ │ -1111 }; │ │ │ │ │ -1112 │ │ │ │ │ -1113 │ │ │ │ │ -1118 class FrontNeighbourCounter : public Counter │ │ │ │ │ -1119 { │ │ │ │ │ -1120 public: │ │ │ │ │ -_1_1_2_5 _F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r(const _M_a_t_r_i_x_G_r_a_p_h& front); │ │ │ │ │ -1126 │ │ │ │ │ -_1_1_2_7 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ │ -1128 │ │ │ │ │ -1129 private: │ │ │ │ │ -1130 const _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ │ -1131 }; │ │ │ │ │ -1132 │ │ │ │ │ -1137 int noFrontNeighbours(const _V_e_r_t_e_x& vertex) const; │ │ │ │ │ -1138 │ │ │ │ │ -1142 class TwoWayCounter : public Counter │ │ │ │ │ -1143 { │ │ │ │ │ -1144 public: │ │ │ │ │ -_1_1_4_5 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ │ -1146 }; │ │ │ │ │ -1147 │ │ │ │ │ -1159 int twoWayConnections(const _V_e_r_t_e_x&, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1160 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ │ -1161 │ │ │ │ │ -1165 class OneWayCounter : public Counter │ │ │ │ │ -1166 { │ │ │ │ │ -1167 public: │ │ │ │ │ -_1_1_6_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); │ │ │ │ │ -1169 }; │ │ │ │ │ -1170 │ │ │ │ │ -1182 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, │ │ │ │ │ -1183 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ │ -1184 │ │ │ │ │ -1191 class ConnectivityCounter : public Counter │ │ │ │ │ -1192 { │ │ │ │ │ -1193 public: │ │ │ │ │ -_1_2_0_0 _C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r(const VertexSet& connected, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates); │ │ │ │ │ -1201 │ │ │ │ │ -_1_2_0_2 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ │ -1203 │ │ │ │ │ -1204 private: │ │ │ │ │ -1206 const VertexSet& connected_; │ │ │ │ │ -1208 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ │ -1209 │ │ │ │ │ -1210 }; │ │ │ │ │ -1211 │ │ │ │ │ -1223 double connectivity(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ │ -aggregates) const; │ │ │ │ │ -1231 bool connected(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1232 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ │ -1233 │ │ │ │ │ -1241 bool connected(const _V_e_r_t_e_x& vertex, const SLList& │ │ │ │ │ -aggregateList, │ │ │ │ │ -1242 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ │ -1243 │ │ │ │ │ -1251 class DependencyCounter : public Counter │ │ │ │ │ -1252 { │ │ │ │ │ -1253 public: │ │ │ │ │ -_1_2_5_7 _D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r(); │ │ │ │ │ -1258 │ │ │ │ │ -_1_2_5_9 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ │ -1260 }; │ │ │ │ │ -1261 │ │ │ │ │ -1268 class FrontMarker │ │ │ │ │ -1269 { │ │ │ │ │ -1270 public: │ │ │ │ │ -_1_2_7_7 _F_r_o_n_t_M_a_r_k_e_r(std::vector& front, _M_a_t_r_i_x_G_r_a_p_h& graph); │ │ │ │ │ -1278 │ │ │ │ │ -_1_2_7_9 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ │ -1280 │ │ │ │ │ -1281 private: │ │ │ │ │ -1283 std::vector& front_; │ │ │ │ │ -1285 _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ │ -1286 }; │ │ │ │ │ -1287 │ │ │ │ │ -1291 void unmarkFront(); │ │ │ │ │ -1292 │ │ │ │ │ -1307 int unusedNeighbours(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ │ -aggregates) const; │ │ │ │ │ -1308 │ │ │ │ │ -1322 std::pair neighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ │ -1323 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1324 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ │ -1341 int aggregateNeighbours(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ │ -aggregate, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ │ -1342 │ │ │ │ │ -1350 bool admissible(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ │ -aggregate, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ │ -1351 │ │ │ │ │ -1359 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); │ │ │ │ │ -1360 │ │ │ │ │ -1369 _V_e_r_t_e_x mergeNeighbour(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ │ -aggregates) const; │ │ │ │ │ -1370 │ │ │ │ │ -1379 void nonisoNeighbourAggregate(const _V_e_r_t_e_x& vertex, │ │ │ │ │ -1380 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -1381 SLList& neighbours) const; │ │ │ │ │ -1382 │ │ │ │ │ -1390 template │ │ │ │ │ -1391 void growAggregate(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ │ -aggregates, const C& c); │ │ │ │ │ -1392 template │ │ │ │ │ -1393 void growIsolatedAggregate(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const C& c); │ │ │ │ │ -1394 }; │ │ │ │ │ -1395 │ │ │ │ │ -1396#ifndef DOXYGEN │ │ │ │ │ -1397 │ │ │ │ │ -1398 template │ │ │ │ │ -1399 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const _M_a_t_r_i_x* matrix) │ │ │ │ │ -1400 { │ │ │ │ │ -1401 matrix_ = matrix; │ │ │ │ │ -1402 } │ │ │ │ │ -1403 │ │ │ │ │ -1404 template │ │ │ │ │ -1405 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w(const Row& row, int index) │ │ │ │ │ -1406 { │ │ │ │ │ -1407 initRow(row, index, std::is_convertible()); │ │ │ │ │ -1408 } │ │ │ │ │ -1409 │ │ │ │ │ -1410 template │ │ │ │ │ -1411 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w(const Row& row, int index, │ │ │ │ │ -const std::false_type&) │ │ │ │ │ -1412 { │ │ │ │ │ -1413 DUNE_THROW(InvalidStateException, "field_type needs to convertible to │ │ │ │ │ -real_type"); │ │ │ │ │ -1414 } │ │ │ │ │ -1415 │ │ │ │ │ -1416 template │ │ │ │ │ -1417 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w([[maybe_unused]] const Row& │ │ │ │ │ -row, int index, const std::true_type&) │ │ │ │ │ -1418 { │ │ │ │ │ -1419 using std::min; │ │ │ │ │ -1420 maxValue_ = min(- std::numeric_limits::max(), │ │ │ │ │ -std::numeric_limits::min()); │ │ │ │ │ -1421 row_ = index; │ │ │ │ │ -1422 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ │ -1423 } │ │ │ │ │ -1424 │ │ │ │ │ -1425 template │ │ │ │ │ -1426 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const ColIter& _c_o_l) │ │ │ │ │ -1427 { │ │ │ │ │ -1428 using std::max; │ │ │ │ │ -1429 real_type eij = norm_(*_c_o_l); │ │ │ │ │ -1430 typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r opposite_entry = │ │ │ │ │ -1431 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ │ -1432 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ │ -1433 { │ │ │ │ │ -1434 // Consider this a weak connection we disregard. │ │ │ │ │ -1435 return; │ │ │ │ │ -1436 } │ │ │ │ │ -1437 real_type eji = norm_(*opposite_entry); │ │ │ │ │ -1438 │ │ │ │ │ -1439 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ │ -1440 if(!N::is_sign_preserving || eij<0 || eji<0) │ │ │ │ │ -1441 maxValue_ = max(maxValue_, │ │ │ │ │ -1442 eij /diagonal_ * eji/ │ │ │ │ │ -1443 norm_(matrix_->operator[](_c_o_l.index())[_c_o_l.index()])); │ │ │ │ │ -1444 } │ │ │ │ │ -1445 │ │ │ │ │ -1446 template │ │ │ │ │ -1447 template │ │ │ │ │ -1448 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G& graph, const typename G:: │ │ │ │ │ -EdgeIterator& edge, const ColIter& _c_o_l) │ │ │ │ │ -1449 { │ │ │ │ │ -1450 real_type eij = norm_(*_c_o_l); │ │ │ │ │ -1451 typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r opposite_entry = │ │ │ │ │ -1452 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ │ -1453 │ │ │ │ │ -1454 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ │ -1455 { │ │ │ │ │ -1456 // Consider this as a weak connection we disregard. │ │ │ │ │ -1457 return; │ │ │ │ │ -1458 } │ │ │ │ │ -1459 real_type eji = norm_(*opposite_entry); │ │ │ │ │ -1460 // skip positve offdiagonals if norm preserves sign of them. │ │ │ │ │ -1461 if(!N::is_sign_preserving || (eij<0 || eji<0)) │ │ │ │ │ -1462 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) * │ │ │ │ │ -1463 eij/ diagonal_ > alpha() * maxValue_) { │ │ │ │ │ -1464 edge.properties().setDepends(); │ │ │ │ │ -1465 edge.properties().setInfluences(); │ │ │ │ │ -1466 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), │ │ │ │ │ -edge.source()); │ │ │ │ │ -1467 other.setInfluences(); │ │ │ │ │ -1468 other.setDepends(); │ │ │ │ │ -1469 } │ │ │ │ │ -1470 } │ │ │ │ │ -1471 │ │ │ │ │ -1472 template │ │ │ │ │ -1473 inline bool _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ │ -1474 { │ │ │ │ │ -1475 return maxValue_ < beta(); │ │ │ │ │ -1476 } │ │ │ │ │ -1477 │ │ │ │ │ -1478 │ │ │ │ │ -1479 template │ │ │ │ │ -1480 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const Matrix* matrix) │ │ │ │ │ -1481 { │ │ │ │ │ -1482 matrix_ = matrix; │ │ │ │ │ -1483 } │ │ │ │ │ -1484 │ │ │ │ │ -1485 template │ │ │ │ │ -1486 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w([[maybe_unused]] const Row& row, int │ │ │ │ │ -index) │ │ │ │ │ -1487 { │ │ │ │ │ -1488 using std::min; │ │ │ │ │ -1489 maxValue_ = min(- std::numeric_limits::max(), std:: │ │ │ │ │ -numeric_limits::min()); │ │ │ │ │ -1490 row_ = index; │ │ │ │ │ -1491 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ │ -1492 } │ │ │ │ │ -1493 │ │ │ │ │ -1494 template │ │ │ │ │ -1495 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const ColIter& _c_o_l) │ │ │ │ │ -1496 { │ │ │ │ │ -1497 using std::max; │ │ │ │ │ -1498 maxValue_ = max(maxValue_, -norm_(*_c_o_l)); │ │ │ │ │ -1499 } │ │ │ │ │ -1500 │ │ │ │ │ -1501 template │ │ │ │ │ -1502 template │ │ │ │ │ -1503 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G& graph, const typename G:: │ │ │ │ │ -EdgeIterator& edge, const ColIter& _c_o_l) │ │ │ │ │ -1504 { │ │ │ │ │ -1505 if(-norm_(*_c_o_l) >= maxValue_ * alpha()) { │ │ │ │ │ -1506 edge.properties().setDepends(); │ │ │ │ │ -1507 typedef typename G::EdgeDescriptor ED; │ │ │ │ │ -1508 ED e= graph.findEdge(edge.target(), edge.source()); │ │ │ │ │ -1509 if(e!=std::numeric_limits::max()) │ │ │ │ │ -1510 { │ │ │ │ │ -1511 typename G::EdgeProperties& other = graph.getEdgeProperties(e); │ │ │ │ │ -1512 other.setInfluences(); │ │ │ │ │ -1513 } │ │ │ │ │ -1514 } │ │ │ │ │ -1515 } │ │ │ │ │ -1516 │ │ │ │ │ -1517 template │ │ │ │ │ -1518 inline bool _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ │ -1519 { │ │ │ │ │ -1520 return maxValue_ < beta() * diagonal_; │ │ │ │ │ -1521 } │ │ │ │ │ -1522 │ │ │ │ │ -1523 template │ │ │ │ │ -1524 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_A_g_g_r_e_g_a_t_e(MatrixGraph& graph, AggregatesMap& │ │ │ │ │ -aggregates, │ │ │ │ │ -1525 VertexSet& connected, std::vector& front) │ │ │ │ │ -1526 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates), │ │ │ │ │ -1527 connected_(connected), front_(front) │ │ │ │ │ -1528 {} │ │ │ │ │ -1529 │ │ │ │ │ -1530 template │ │ │ │ │ -1531 void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_r_e_c_o_n_s_t_r_u_c_t(const _V_e_r_t_e_x& vertex) │ │ │ │ │ -1532 { │ │ │ │ │ -1533 /* │ │ │ │ │ -1534 vertices_.push_back(vertex); │ │ │ │ │ -1535 typedef typename VertexList::const_iterator iterator; │ │ │ │ │ -1536 iterator begin = vertices_.begin(); │ │ │ │ │ -1537 iterator end = vertices_.end();*/ │ │ │ │ │ -1538 throw "Not yet implemented"; │ │ │ │ │ -1539 │ │ │ │ │ -1540 // while(begin!=end){ │ │ │ │ │ -1541 //for(); │ │ │ │ │ -1542 // } │ │ │ │ │ -1543 │ │ │ │ │ -1544 } │ │ │ │ │ -1545 │ │ │ │ │ -1546 template │ │ │ │ │ -1547 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_e_e_d(const _V_e_r_t_e_x& vertex) │ │ │ │ │ -1548 { │ │ │ │ │ -1549 dvverb<<"Connected cleared"<::UNAGGREGATED && │ │ │ │ │ -1616 !graph_.getVertexProperties(edge.target()).front()) │ │ │ │ │ -1617 { │ │ │ │ │ -1618 front_.push_back(edge.target()); │ │ │ │ │ -1619 graph_.getVertexProperties(edge.target()).setFront(); │ │ │ │ │ -1620 } │ │ │ │ │ -1621 dvverb <<" size="< │ │ │ │ │ -1629 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_l_e_a_r() │ │ │ │ │ -1630 { │ │ │ │ │ -1631 vertices_.clear(); │ │ │ │ │ -1632 connected_.clear(); │ │ │ │ │ -1633 id_=-1; │ │ │ │ │ -1634 } │ │ │ │ │ -1635 │ │ │ │ │ -1636 template │ │ │ │ │ -1637 inline typename Aggregate::VertexSet::size_type │ │ │ │ │ -1638 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_i_z_e() │ │ │ │ │ -1639 { │ │ │ │ │ -1640 return vertices_.size(); │ │ │ │ │ -1641 } │ │ │ │ │ -1642 │ │ │ │ │ -1643 template │ │ │ │ │ -1644 inline typename Aggregate::VertexSet::size_type │ │ │ │ │ -1645 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_n_e_c_t_S_i_z_e() │ │ │ │ │ -1646 { │ │ │ │ │ -1647 return connected_.size(); │ │ │ │ │ -1648 } │ │ │ │ │ -1649 │ │ │ │ │ -1650 template │ │ │ │ │ -1651 inline int _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_i_d() │ │ │ │ │ -1652 { │ │ │ │ │ -1653 return id_; │ │ │ │ │ -1654 } │ │ │ │ │ -1655 │ │ │ │ │ -1656 template │ │ │ │ │ -1657 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_b_e_g_i_n() │ │ │ │ │ -const │ │ │ │ │ -1658 { │ │ │ │ │ -1659 return vertices_.begin(); │ │ │ │ │ -1660 } │ │ │ │ │ -1661 │ │ │ │ │ -1662 template │ │ │ │ │ -1663 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_e_n_d() const │ │ │ │ │ -1664 { │ │ │ │ │ -1665 return vertices_.end(); │ │ │ │ │ -1666 } │ │ │ │ │ -1667 │ │ │ │ │ -1668 template │ │ │ │ │ -1669 const V _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D = std::numeric_limits::max(); │ │ │ │ │ -1670 │ │ │ │ │ -1671 template │ │ │ │ │ -1672 const V _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_I_S_O_L_A_T_E_D = std::numeric_limits::max()-1; │ │ │ │ │ -1673 │ │ │ │ │ -1674 template │ │ │ │ │ -1675 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p() │ │ │ │ │ -1676 : aggregates_(0) │ │ │ │ │ -1677 {} │ │ │ │ │ -1678 │ │ │ │ │ -1679 template │ │ │ │ │ -1680 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_~_A_g_g_r_e_g_a_t_e_s_M_a_p() │ │ │ │ │ -1681 { │ │ │ │ │ -1682 if(aggregates_!=0) │ │ │ │ │ -1683 delete[] aggregates_; │ │ │ │ │ -1684 } │ │ │ │ │ -1685 │ │ │ │ │ -1686 │ │ │ │ │ -1687 template │ │ │ │ │ -1688 inline _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p(std::size_t noVertices) │ │ │ │ │ -1689 { │ │ │ │ │ -1690 allocate(noVertices); │ │ │ │ │ -1691 } │ │ │ │ │ -1692 │ │ │ │ │ -1693 template │ │ │ │ │ -1694 inline std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_n_o_V_e_r_t_i_c_e_s() const │ │ │ │ │ -1695 { │ │ │ │ │ -1696 return noVertices_; │ │ │ │ │ -1697 } │ │ │ │ │ -1698 │ │ │ │ │ -1699 template │ │ │ │ │ -1700 inline void _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_a_l_l_o_c_a_t_e(std::size_t noVertices) │ │ │ │ │ -1701 { │ │ │ │ │ -1702 aggregates_ = new _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r[noVertices]; │ │ │ │ │ -1703 noVertices_ = noVertices; │ │ │ │ │ -1704 │ │ │ │ │ -1705 for(std::size_t i=0; i < noVertices; i++) │ │ │ │ │ -1706 aggregates_[i]=UNAGGREGATED; │ │ │ │ │ -1707 } │ │ │ │ │ -1708 │ │ │ │ │ -1709 template │ │ │ │ │ -1710 inline void _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_f_r_e_e() │ │ │ │ │ -1711 { │ │ │ │ │ -1712 assert(aggregates_ != 0); │ │ │ │ │ -1713 delete[] aggregates_; │ │ │ │ │ -1714 aggregates_=0; │ │ │ │ │ -1715 } │ │ │ │ │ -1716 │ │ │ │ │ -1717 template │ │ │ │ │ -1718 inline typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ │ -1719 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_o_p_e_r_a_t_o_r_[_](const VertexDescriptor& v) │ │ │ │ │ -1720 { │ │ │ │ │ -1721 return aggregates_[v]; │ │ │ │ │ -1722 } │ │ │ │ │ -1723 │ │ │ │ │ -1724 template │ │ │ │ │ -1725 inline const typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ │ -1726 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_o_p_e_r_a_t_o_r_[_](const VertexDescriptor& v) const │ │ │ │ │ -1727 { │ │ │ │ │ -1728 return aggregates_[v]; │ │ │ │ │ -1729 } │ │ │ │ │ -1730 │ │ │ │ │ -1731 template │ │ │ │ │ -1732 template │ │ │ │ │ -1733 inline std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const V& start, │ │ │ │ │ -1734 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1735 const G& graph, F& aggregateVisitor, │ │ │ │ │ -1736 VM& visitedMap) const │ │ │ │ │ -1737 { │ │ │ │ │ -1738 VertexList vlist; │ │ │ │ │ -1739 │ │ │ │ │ -1740 DummyEdgeVisitor dummy; │ │ │ │ │ -1741 return breadthFirstSearch(start, aggregate, graph, vlist, │ │ │ │ │ -aggregateVisitor, dummy, visitedMap); │ │ │ │ │ -1742 } │ │ │ │ │ -1743 │ │ │ │ │ -1744 template │ │ │ │ │ -1745 template │ │ │ │ │ -1746 std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const V& start, │ │ │ │ │ -1747 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1748 const G& graph, │ │ │ │ │ -1749 L& visited, │ │ │ │ │ -1750 F1& aggregateVisitor, │ │ │ │ │ -1751 F2& nonAggregateVisitor, │ │ │ │ │ -1752 VM& visitedMap) const │ │ │ │ │ -1753 { │ │ │ │ │ -1754 typedef typename L::const_iterator ListIterator; │ │ │ │ │ -1755 int visitedSpheres = 0; │ │ │ │ │ -1756 │ │ │ │ │ -1757 visited.push_back(start); │ │ │ │ │ -1758 put(visitedMap, start, true); │ │ │ │ │ -1759 │ │ │ │ │ -1760 ListIterator current = visited.begin(); │ │ │ │ │ -1761 ListIterator end = visited.end(); │ │ │ │ │ -1762 std::size_t i=0, size=visited.size(); │ │ │ │ │ -1763 │ │ │ │ │ -1764 // visit the neighbours of all vertices of the │ │ │ │ │ -1765 // current sphere. │ │ │ │ │ -1766 while(current != end) { │ │ │ │ │ -1767 │ │ │ │ │ -1768 for(; i │ │ │ │ │ -1803 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_o_r() │ │ │ │ │ -1804 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1) │ │ │ │ │ -1805 {} │ │ │ │ │ -1806 │ │ │ │ │ -1807 template │ │ │ │ │ -1808 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_~_A_g_g_r_e_g_a_t_o_r() │ │ │ │ │ -1809 { │ │ │ │ │ -1810 size_=-1; │ │ │ │ │ -1811 } │ │ │ │ │ -1812 │ │ │ │ │ -1813 template │ │ │ │ │ -1814 void _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(G& graph, │ │ │ │ │ -1815 const typename C::Matrix& matrix, │ │ │ │ │ -1816 C criterion, bool firstlevel) │ │ │ │ │ -1817 { │ │ │ │ │ -1818 // assert(graph.isBuilt()); │ │ │ │ │ -1819 typedef typename C::Matrix Matrix; │ │ │ │ │ -1820 typedef typename G::VertexIterator VertexIterator; │ │ │ │ │ -1821 │ │ │ │ │ -1822 criterion.init(&matrix); │ │ │ │ │ -1823 │ │ │ │ │ -1824 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); │ │ │ │ │ -++vertex) { │ │ │ │ │ -1825 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e Row; │ │ │ │ │ -1826 │ │ │ │ │ -1827 const Row& row = matrix[*vertex]; │ │ │ │ │ -1828 │ │ │ │ │ -1829 // Tell the criterion what row we will examine now │ │ │ │ │ -1830 // This might for example be used for calculating the │ │ │ │ │ -1831 // maximum offdiagonal value │ │ │ │ │ -1832 criterion.initRow(row, *vertex); │ │ │ │ │ -1833 │ │ │ │ │ -1834 // On a first path all columns are examined. After this │ │ │ │ │ -1835 // the calculator should know whether the vertex is isolated. │ │ │ │ │ -1836 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIterator; │ │ │ │ │ -1837 ColIterator end = row.end(); │ │ │ │ │ -1838 typename FieldTraits::real_type │ │ │ │ │ -absoffdiag=0.; │ │ │ │ │ -1839 │ │ │ │ │ -1840 using std::max; │ │ │ │ │ -1841 if(firstlevel) { │ │ │ │ │ -1842 for(ColIterator _c_o_l = row.begin(); _c_o_l != end; ++_c_o_l) │ │ │ │ │ -1843 if(_c_o_l.index()!=*vertex) { │ │ │ │ │ -1844 criterion.examine(_c_o_l); │ │ │ │ │ -1845 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm()); │ │ │ │ │ -1846 } │ │ │ │ │ -1847 │ │ │ │ │ -1848 if(absoffdiag==0) │ │ │ │ │ -1849 vertex.properties().setExcludedBorder(); │ │ │ │ │ -1850 } │ │ │ │ │ -1851 else │ │ │ │ │ -1852 for(ColIterator _c_o_l = row.begin(); _c_o_l != end; ++_c_o_l) │ │ │ │ │ -1853 if(_c_o_l.index()!=*vertex) │ │ │ │ │ -1854 criterion.examine(_c_o_l); │ │ │ │ │ -1855 │ │ │ │ │ -1856 // reset the vertex properties │ │ │ │ │ -1857 //vertex.properties().reset(); │ │ │ │ │ -1858 │ │ │ │ │ -1859 // Check whether the vertex is isolated. │ │ │ │ │ -1860 if(criterion.isIsolated()) { │ │ │ │ │ -1861 //std::cout<<"ISOLATED: "<<*vertex< │ │ │ │ │ -1881 template │ │ │ │ │ -1882 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_<_V_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r(const │ │ │ │ │ -AggregatesMap& aggregates, │ │ │ │ │ -1883 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, V& visitor) │ │ │ │ │ -1884 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor) │ │ │ │ │ -1885 {} │ │ │ │ │ -1886 │ │ │ │ │ -1887 template │ │ │ │ │ -1888 template │ │ │ │ │ -1889 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_<_V_>_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -1890 { │ │ │ │ │ -1891 if(aggregates_[edge.target()]==aggregate_) │ │ │ │ │ -1892 visitor_->operator()(edge); │ │ │ │ │ -1893 } │ │ │ │ │ -1894 │ │ │ │ │ -1895 template │ │ │ │ │ -1896 template │ │ │ │ │ -1897 inline void Aggregator::visitAggregateNeighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ │ -1898 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1899 const AggregatesMap& aggregates, │ │ │ │ │ -1900 V& visitor) const │ │ │ │ │ -1901 { │ │ │ │ │ -1902 // Only evaluates for edge pointing to the aggregate │ │ │ │ │ -1903 AggregateVisitor v(aggregates, aggregate, visitor); │ │ │ │ │ -1904 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, v); │ │ │ │ │ -1905 } │ │ │ │ │ -1906 │ │ │ │ │ -1907 │ │ │ │ │ -1908 template │ │ │ │ │ -1909 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_C_o_u_n_t_e_r() │ │ │ │ │ -1910 : count_(0) │ │ │ │ │ -1911 {} │ │ │ │ │ -1912 │ │ │ │ │ -1913 template │ │ │ │ │ -1914 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t() │ │ │ │ │ -1915 { │ │ │ │ │ -1916 ++count_; │ │ │ │ │ -1917 } │ │ │ │ │ -1918 │ │ │ │ │ -1919 template │ │ │ │ │ -1920 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_d_e_c_r_e_m_e_n_t() │ │ │ │ │ -1921 { │ │ │ │ │ -1922 --count_; │ │ │ │ │ -1923 } │ │ │ │ │ -1924 template │ │ │ │ │ -1925 inline int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_v_a_l_u_e() │ │ │ │ │ -1926 { │ │ │ │ │ -1927 return count_; │ │ │ │ │ -1928 } │ │ │ │ │ -1929 │ │ │ │ │ -1930 template │ │ │ │ │ -1931 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_T_w_o_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -1932 { │ │ │ │ │ -1933 if(edge.properties().isTwoWay()) │ │ │ │ │ -1934 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -1935 } │ │ │ │ │ -1936 │ │ │ │ │ -1937 template │ │ │ │ │ -1938 int Aggregator::twoWayConnections(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1939 const AggregatesMap& aggregates) const │ │ │ │ │ -1940 { │ │ │ │ │ -1941 TwoWayCounter counter; │ │ │ │ │ -1942 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ │ -1943 return counter.value(); │ │ │ │ │ -1944 } │ │ │ │ │ -1945 │ │ │ │ │ -1946 template │ │ │ │ │ -1947 int Aggregator::oneWayConnections(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -1948 const AggregatesMap& aggregates) const │ │ │ │ │ -1949 { │ │ │ │ │ -1950 OneWayCounter counter; │ │ │ │ │ -1951 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ │ -1952 return counter.value(); │ │ │ │ │ -1953 } │ │ │ │ │ -1954 │ │ │ │ │ -1955 template │ │ │ │ │ -1956 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_O_n_e_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -1957 { │ │ │ │ │ -1958 if(edge.properties().isOneWay()) │ │ │ │ │ -1959 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -1960 } │ │ │ │ │ -1961 │ │ │ │ │ -1962 template │ │ │ │ │ -1963 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r(const │ │ │ │ │ -VertexSet& connected, │ │ │ │ │ -1964 const AggregatesMap& aggregates) │ │ │ │ │ -1965 : Counter(), connected_(connected), aggregates_(aggregates) │ │ │ │ │ -1966 {} │ │ │ │ │ -1967 │ │ │ │ │ -1968 │ │ │ │ │ -1969 template │ │ │ │ │ -1970 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -1971 { │ │ │ │ │ -1972 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || │ │ │ │ │ -aggregates_[edge.target()]==AggregatesMap::UNAGGREGATED) │ │ │ │ │ -1973 // Would be a new connection │ │ │ │ │ -1974 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -1975 else{ │ │ │ │ │ -1976 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -1977 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -1978 } │ │ │ │ │ -1979 } │ │ │ │ │ -1980 │ │ │ │ │ -1981 template │ │ │ │ │ -1982 inline double Aggregator::connectivity(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -AggregatesMap& aggregates) const │ │ │ │ │ -1983 { │ │ │ │ │ -1984 ConnectivityCounter counter(connected_, aggregates); │ │ │ │ │ -1985 double noNeighbours=_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ │ -1986 return (double)counter.value()/noNeighbours; │ │ │ │ │ -1987 } │ │ │ │ │ -1988 │ │ │ │ │ -1989 template │ │ │ │ │ -1990 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r() │ │ │ │ │ -1991 : Counter() │ │ │ │ │ -1992 {} │ │ │ │ │ -1993 │ │ │ │ │ -1994 template │ │ │ │ │ -1995 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -1996 { │ │ │ │ │ -1997 if(edge.properties().depends()) │ │ │ │ │ -1998 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -1999 if(edge.properties().influences()) │ │ │ │ │ -2000 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -2001 } │ │ │ │ │ -2002 │ │ │ │ │ -2003 template │ │ │ │ │ -2004 int Aggregator::unusedNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -AggregatesMap& aggregates) const │ │ │ │ │ -2005 { │ │ │ │ │ -2006 return aggregateNeighbours(vertex, AggregatesMap::UNAGGREGATED, │ │ │ │ │ -aggregates); │ │ │ │ │ -2007 } │ │ │ │ │ -2008 │ │ │ │ │ -2009 template │ │ │ │ │ -2010 std::pair Aggregator::neighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ │ -2011 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -2012 const AggregatesMap& aggregates) const │ │ │ │ │ -2013 { │ │ │ │ │ -2014 DependencyCounter unused, aggregated; │ │ │ │ │ -2015 typedef AggregateVisitor CounterT; │ │ │ │ │ -2016 typedef std::tuple CounterTuple; │ │ │ │ │ -2017 CombinedFunctor visitors(CounterTuple(CounterT(aggregates, │ │ │ │ │ -AggregatesMap::UNAGGREGATED, unused), CounterT(aggregates, aggregate, │ │ │ │ │ -aggregated))); │ │ │ │ │ -2018 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, visitors); │ │ │ │ │ -2019 return std::make_pair(unused.value(), aggregated.value()); │ │ │ │ │ -2020 } │ │ │ │ │ -2021 │ │ │ │ │ -2022 │ │ │ │ │ -2023 template │ │ │ │ │ -2024 int Aggregator::aggregateNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, const AggregatesMap& aggregates) const │ │ │ │ │ -2025 { │ │ │ │ │ -2026 DependencyCounter counter; │ │ │ │ │ -2027 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ │ -2028 return counter.value(); │ │ │ │ │ -2029 } │ │ │ │ │ -2030 │ │ │ │ │ -2031 template │ │ │ │ │ -2032 std::size_t Aggregator::distance(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -AggregatesMap& aggregates) │ │ │ │ │ -2033 { │ │ │ │ │ -2034 return 0; │ │ │ │ │ -2035 typename PropertyMapTypeSelector::Type visitedMap = │ │ │ │ │ -_g_e_t(VertexVisitedTag(), *graph_); │ │ │ │ │ -2036 VertexList vlist; │ │ │ │ │ -2037 typename AggregatesMap::DummyEdgeVisitor dummy; │ │ │ │ │ -2038 return aggregates.template breadthFirstSearch(vertex, │ │ │ │ │ -2039 aggregate_->_i_d(), *graph_, │ │ │ │ │ -2040 vlist, dummy, dummy, visitedMap); │ │ │ │ │ -2041 } │ │ │ │ │ -2042 │ │ │ │ │ -2043 template │ │ │ │ │ -2044 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_F_r_o_n_t_M_a_r_k_e_r(std::vector& front, │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h& graph) │ │ │ │ │ -2045 : front_(front), graph_(graph) │ │ │ │ │ -2046 {} │ │ │ │ │ -2047 │ │ │ │ │ -2048 template │ │ │ │ │ -2049 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -2050 { │ │ │ │ │ -2051 _V_e_r_t_e_x target = edge.target(); │ │ │ │ │ -2052 │ │ │ │ │ -2053 if(!graph_.getVertexProperties(target).front()) { │ │ │ │ │ -2054 front_.push_back(target); │ │ │ │ │ -2055 graph_.getVertexProperties(target).setFront(); │ │ │ │ │ -2056 } │ │ │ │ │ -2057 } │ │ │ │ │ -2058 │ │ │ │ │ -2059 template │ │ │ │ │ -2060 inline bool Aggregator::admissible(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, const AggregatesMap& aggregates) const │ │ │ │ │ -2061 { │ │ │ │ │ -2062 // Todo │ │ │ │ │ -2063 Dune::dvverb<<" Admissible not yet implemented!"<endEdges(vertex); │ │ │ │ │ -2071 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ │ -2072 // if(edge.properties().depends() && !edge.properties().influences() │ │ │ │ │ -2073 if(edge.properties().isStrong() │ │ │ │ │ -2074 && aggregates[edge.target()]==aggregate) │ │ │ │ │ -2075 { │ │ │ │ │ -2076 // Search for another link to the aggregate │ │ │ │ │ -2077 Iterator edge1 = edge; │ │ │ │ │ -2078 for(++edge1; edge1 != vend; ++edge1) { │ │ │ │ │ -2079 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ │ -2080 if(edge1.properties().isStrong() │ │ │ │ │ -2081 && aggregates[edge.target()]==aggregate) │ │ │ │ │ -2082 { │ │ │ │ │ -2083 //Search for an edge connecting the two vertices that is │ │ │ │ │ -2084 //strong │ │ │ │ │ -2085 bool found=false; │ │ │ │ │ -2086 Iterator v2end = graph_->endEdges(edge.target()); │ │ │ │ │ -2087 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; │ │ │ │ │ -++edge2) { │ │ │ │ │ -2088 if(edge2.target()==edge1.target() && │ │ │ │ │ -2089 edge2.properties().isStrong()) { │ │ │ │ │ -2090 found =true; │ │ │ │ │ -2091 break; │ │ │ │ │ -2092 } │ │ │ │ │ -2093 } │ │ │ │ │ -2094 if(found) │ │ │ │ │ -2095 { │ │ │ │ │ -2096 return true; │ │ │ │ │ -2097 } │ │ │ │ │ -2098 } │ │ │ │ │ -2099 } │ │ │ │ │ -2100 } │ │ │ │ │ -2101 } │ │ │ │ │ -2102 │ │ │ │ │ -2103 // Situation 2: cluster node depends on front node and other cluster node │ │ │ │ │ -2105 vend = graph_->endEdges(vertex); │ │ │ │ │ -2106 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ │ -2107 //if(!edge.properties().depends() && edge.properties().influences() │ │ │ │ │ -2108 if(edge.properties().isStrong() │ │ │ │ │ -2109 && aggregates[edge.target()]==aggregate) │ │ │ │ │ -2110 { │ │ │ │ │ -2111 // Search for a link from target that stays within the aggregate │ │ │ │ │ -2112 Iterator v1end = graph_->endEdges(edge.target()); │ │ │ │ │ -2113 │ │ │ │ │ -2114 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; │ │ │ │ │ -++edge1) { │ │ │ │ │ -2115 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ │ -2116 if(edge1.properties().isStrong() │ │ │ │ │ -2117 && aggregates[edge1.target()]==aggregate) │ │ │ │ │ -2118 { │ │ │ │ │ -2119 bool found=false; │ │ │ │ │ -2120 // Check if front node is also connected to this one │ │ │ │ │ -2121 Iterator v2end = graph_->endEdges(vertex); │ │ │ │ │ -2122 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) │ │ │ │ │ -{ │ │ │ │ │ -2123 if(edge2.target()==edge1.target()) { │ │ │ │ │ -2124 if(edge2.properties().isStrong()) │ │ │ │ │ -2125 found=true; │ │ │ │ │ -2126 break; │ │ │ │ │ -2127 } │ │ │ │ │ -2128 } │ │ │ │ │ -2129 if(found) │ │ │ │ │ -2130 { │ │ │ │ │ -2131 return true; │ │ │ │ │ -2132 } │ │ │ │ │ -2133 } │ │ │ │ │ -2134 } │ │ │ │ │ -2135 } │ │ │ │ │ -2136 } │ │ │ │ │ -2137 return false; │ │ │ │ │ -2138 } │ │ │ │ │ -2139 │ │ │ │ │ -2140 template │ │ │ │ │ -2141 void Aggregator::unmarkFront() │ │ │ │ │ -2142 { │ │ │ │ │ -2143 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ -2144 │ │ │ │ │ -2145 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex) │ │ │ │ │ -2146 graph_->getVertexProperties(*vertex).resetFront(); │ │ │ │ │ -2147 │ │ │ │ │ -2148 front_.clear(); │ │ │ │ │ -2149 } │ │ │ │ │ -2150 │ │ │ │ │ -2151 template │ │ │ │ │ -2152 inline void │ │ │ │ │ -2153 Aggregator::nonisoNeighbourAggregate(const _V_e_r_t_e_x& vertex, │ │ │ │ │ -2154 const AggregatesMap& aggregates, │ │ │ │ │ -2155 SLList& neighbours) const │ │ │ │ │ -2156 { │ │ │ │ │ -2157 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ -2158 Iterator end=graph_->beginEdges(vertex); │ │ │ │ │ -2159 neighbours.clear(); │ │ │ │ │ -2160 │ │ │ │ │ -2161 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge) │ │ │ │ │ -2162 { │ │ │ │ │ -2163 if(aggregates[edge.target()]!=AggregatesMap::UNAGGREGATED && │ │ │ │ │ -graph_->getVertexProperties(edge.target()).isolated()) │ │ │ │ │ -2164 neighbours.push_back(aggregates[edge.target()]); │ │ │ │ │ -2165 } │ │ │ │ │ -2166 } │ │ │ │ │ -2167 │ │ │ │ │ -2168 template │ │ │ │ │ -2169 inline typename G::VertexDescriptor Aggregator::mergeNeighbour(const │ │ │ │ │ -_V_e_r_t_e_x& vertex, const AggregatesMap& aggregates) const │ │ │ │ │ -2170 { │ │ │ │ │ -2171 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ -2172 │ │ │ │ │ -2173 Iterator end = graph_->endEdges(vertex); │ │ │ │ │ -2174 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) { │ │ │ │ │ -2175 if(aggregates[edge.target()] != AggregatesMap::UNAGGREGATED && │ │ │ │ │ -2176 graph_->getVertexProperties(edge.target()).isolated() == graph_- │ │ │ │ │ ->getVertexProperties(edge.source()).isolated()) { │ │ │ │ │ -2177 if( graph_->getVertexProperties(vertex).isolated() || │ │ │ │ │ -2178 ((edge.properties().depends() || edge.properties().influences()) │ │ │ │ │ -2179 && admissible(vertex, aggregates[edge.target()], aggregates))) │ │ │ │ │ -2180 return edge.target(); │ │ │ │ │ -2181 } │ │ │ │ │ -2182 } │ │ │ │ │ -2183 return AggregatesMap::UNAGGREGATED; │ │ │ │ │ -2184 } │ │ │ │ │ -2185 │ │ │ │ │ -2186 template │ │ │ │ │ -2187 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r(const │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h& graph) │ │ │ │ │ -2188 : Counter(), graph_(graph) │ │ │ │ │ -2189 {} │ │ │ │ │ -2190 │ │ │ │ │ -2191 template │ │ │ │ │ -2192 void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -2193 { │ │ │ │ │ -2194 if(graph_.getVertexProperties(edge.target()).front()) │ │ │ │ │ -2195 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ -2196 } │ │ │ │ │ -2197 │ │ │ │ │ -2198 template │ │ │ │ │ -2199 int Aggregator::noFrontNeighbours(const _V_e_r_t_e_x& vertex) const │ │ │ │ │ -2200 { │ │ │ │ │ -2201 FrontNeighbourCounter counter(*graph_); │ │ │ │ │ -2202 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ │ -2203 return counter.value(); │ │ │ │ │ -2204 } │ │ │ │ │ -2205 template │ │ │ │ │ -2206 inline bool Aggregator::connected(const _V_e_r_t_e_x& vertex, │ │ │ │ │ -2207 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ -2208 const AggregatesMap& aggregates) const │ │ │ │ │ -2209 { │ │ │ │ │ -2210 typedef typename G::ConstEdgeIterator iterator; │ │ │ │ │ -2211 const iterator end = graph_->endEdges(vertex); │ │ │ │ │ -2212 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) │ │ │ │ │ -2213 if(aggregates[edge.target()]==aggregate) │ │ │ │ │ -2214 return true; │ │ │ │ │ -2215 return false; │ │ │ │ │ -2216 } │ │ │ │ │ -2217 template │ │ │ │ │ -2218 inline bool Aggregator::connected(const _V_e_r_t_e_x& vertex, │ │ │ │ │ -2219 const SLList& aggregateList, │ │ │ │ │ -2220 const AggregatesMap& aggregates) const │ │ │ │ │ -2221 { │ │ │ │ │ -2222 typedef typename SLList::const_iterator Iter; │ │ │ │ │ -2223 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i) │ │ │ │ │ -2224 if(connected(vertex, *i, aggregates)) │ │ │ │ │ -2225 return true; │ │ │ │ │ -2226 return false; │ │ │ │ │ -2227 } │ │ │ │ │ -2228 │ │ │ │ │ -2229 template │ │ │ │ │ -2230 template │ │ │ │ │ -2231 void Aggregator::growIsolatedAggregate(const _V_e_r_t_e_x& seed, const │ │ │ │ │ -AggregatesMap& aggregates, const C& c) │ │ │ │ │ -2232 { │ │ │ │ │ -2233 SLList connectedAggregates; │ │ │ │ │ -2234 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates); │ │ │ │ │ -2235 │ │ │ │ │ -2236 while(aggregate_->_s_i_z_e()< c.minAggregateSize() && aggregate_->_c_o_n_n_e_c_t_S_i_z_e │ │ │ │ │ -() < c.maxConnectivity()) { │ │ │ │ │ -2237 double maxCon=-1; │ │ │ │ │ -2238 std::size_t maxFrontNeighbours=0; │ │ │ │ │ -2239 │ │ │ │ │ -2240 _V_e_r_t_e_x candidate=AggregatesMap::UNAGGREGATED; │ │ │ │ │ -2241 │ │ │ │ │ -2242 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ -2243 │ │ │ │ │ -2244 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ │ -2245 if(distance(*vertex, aggregates)>c.maxDistance()) │ │ │ │ │ -2246 continue; // distance of proposes aggregate too big │ │ │ │ │ -2247 │ │ │ │ │ -2248 if(connectedAggregates.size()>0) { │ │ │ │ │ -2249 // there is already a neighbour cluster │ │ │ │ │ -2250 // front node must be connected to same neighbour cluster │ │ │ │ │ -2251 │ │ │ │ │ -2252 if(!connected(*vertex, connectedAggregates, aggregates)) │ │ │ │ │ -2253 continue; │ │ │ │ │ -2254 } │ │ │ │ │ -2255 │ │ │ │ │ -2256 double con = connectivity(*vertex, aggregates); │ │ │ │ │ -2257 │ │ │ │ │ -2258 if(con == maxCon) { │ │ │ │ │ -2259 std::size_t frontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2260 │ │ │ │ │ -2261 if(frontNeighbours >= maxFrontNeighbours) { │ │ │ │ │ -2262 maxFrontNeighbours = frontNeighbours; │ │ │ │ │ -2263 candidate = *vertex; │ │ │ │ │ -2264 } │ │ │ │ │ -2265 }else if(con > maxCon) { │ │ │ │ │ -2266 maxCon = con; │ │ │ │ │ -2267 maxFrontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2268 candidate = *vertex; │ │ │ │ │ -2269 } │ │ │ │ │ -2270 } │ │ │ │ │ -2271 │ │ │ │ │ -2272 if(candidate==AggregatesMap::UNAGGREGATED) │ │ │ │ │ -2273 break; │ │ │ │ │ -2274 │ │ │ │ │ -2275 aggregate_->_a_d_d(candidate); │ │ │ │ │ -2276 } │ │ │ │ │ -2277 } │ │ │ │ │ -2278 │ │ │ │ │ -2279 template │ │ │ │ │ -2280 template │ │ │ │ │ -2281 void Aggregator::growAggregate(const _V_e_r_t_e_x& seed, const │ │ │ │ │ -AggregatesMap& aggregates, const C& c) │ │ │ │ │ -2282 { │ │ │ │ │ -2283 using std::min; │ │ │ │ │ -2284 │ │ │ │ │ -2285 std::size_t distance_ =0; │ │ │ │ │ -2286 while(aggregate_->_s_i_z_e() < c.minAggregateSize()&& distance_ candidates; │ │ │ │ │ -2291 candidates.reserve(30); │ │ │ │ │ -2292 │ │ │ │ │ -2293 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ -2294 │ │ │ │ │ -2295 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ │ -2296 // Only nonisolated nodes are considered │ │ │ │ │ -2297 if(graph_->getVertexProperties(*vertex).isolated()) │ │ │ │ │ -2298 continue; │ │ │ │ │ -2299 │ │ │ │ │ -2300 int twoWayCons = twoWayConnections(*vertex, aggregate_->_i_d(), aggregates); │ │ │ │ │ -2301 │ │ │ │ │ -2302 /* The case of two way connections. */ │ │ │ │ │ -2303 if( maxTwoCons == twoWayCons && twoWayCons > 0) { │ │ │ │ │ -2304 double con = connectivity(*vertex, aggregates); │ │ │ │ │ -2305 │ │ │ │ │ -2306 if(con == maxCon) { │ │ │ │ │ -2307 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2308 │ │ │ │ │ -2309 if(neighbours > maxNeighbours) { │ │ │ │ │ -2310 maxNeighbours = neighbours; │ │ │ │ │ -2311 candidates.clear(); │ │ │ │ │ -2312 candidates.push_back(*vertex); │ │ │ │ │ -2313 }else{ │ │ │ │ │ -2314 candidates.push_back(*vertex); │ │ │ │ │ -2315 } │ │ │ │ │ -2316 }else if( con > maxCon) { │ │ │ │ │ -2317 maxCon = con; │ │ │ │ │ -2318 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2319 candidates.clear(); │ │ │ │ │ -2320 candidates.push_back(*vertex); │ │ │ │ │ -2321 } │ │ │ │ │ -2322 }else if(twoWayCons > maxTwoCons) { │ │ │ │ │ -2323 maxTwoCons = twoWayCons; │ │ │ │ │ -2324 maxCon = connectivity(*vertex, aggregates); │ │ │ │ │ -2325 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2326 candidates.clear(); │ │ │ │ │ -2327 candidates.push_back(*vertex); │ │ │ │ │ -2328 │ │ │ │ │ -2329 // two way connections precede │ │ │ │ │ -2330 maxOneCons = std::numeric_limits::max(); │ │ │ │ │ -2331 } │ │ │ │ │ -2332 │ │ │ │ │ -2333 if(twoWayCons > 0) │ │ │ │ │ -2334 { │ │ │ │ │ -2335 continue; // THis is a two-way node, skip tests for one way nodes │ │ │ │ │ -2336 } │ │ │ │ │ -2337 │ │ │ │ │ -2338 /* The one way case */ │ │ │ │ │ -2339 int oneWayCons = oneWayConnections(*vertex, aggregate_->_i_d(), aggregates); │ │ │ │ │ -2340 │ │ │ │ │ -2341 if(oneWayCons==0) │ │ │ │ │ -2342 continue; // No strong connections, skip the tests. │ │ │ │ │ -2343 │ │ │ │ │ -2344 if(!admissible(*vertex, aggregate_->_i_d(), aggregates)) │ │ │ │ │ -2345 continue; │ │ │ │ │ -2346 │ │ │ │ │ -2347 if( maxOneCons == oneWayCons && oneWayCons > 0) { │ │ │ │ │ -2348 double con = connectivity(*vertex, aggregates); │ │ │ │ │ -2349 │ │ │ │ │ -2350 if(con == maxCon) { │ │ │ │ │ -2351 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2352 │ │ │ │ │ -2353 if(neighbours > maxNeighbours) { │ │ │ │ │ -2354 maxNeighbours = neighbours; │ │ │ │ │ -2355 candidates.clear(); │ │ │ │ │ -2356 candidates.push_back(*vertex); │ │ │ │ │ -2357 }else{ │ │ │ │ │ -2358 if(neighbours==maxNeighbours) │ │ │ │ │ -2359 { │ │ │ │ │ -2360 candidates.push_back(*vertex); │ │ │ │ │ -2361 } │ │ │ │ │ -2362 } │ │ │ │ │ -2363 }else if( con > maxCon) { │ │ │ │ │ -2364 maxCon = con; │ │ │ │ │ -2365 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2366 candidates.clear(); │ │ │ │ │ -2367 candidates.push_back(*vertex); │ │ │ │ │ -2368 } │ │ │ │ │ -2369 }else if(oneWayCons > maxOneCons) { │ │ │ │ │ -2370 maxOneCons = oneWayCons; │ │ │ │ │ -2371 maxCon = connectivity(*vertex, aggregates); │ │ │ │ │ -2372 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ -2373 candidates.clear(); │ │ │ │ │ -2374 candidates.push_back(*vertex); │ │ │ │ │ -2375 } │ │ │ │ │ -2376 } │ │ │ │ │ -2377 │ │ │ │ │ -2378 │ │ │ │ │ -2379 if(!candidates.size()) │ │ │ │ │ -2380 break; // No more candidates found │ │ │ │ │ -2381 distance_=distance(seed, aggregates); │ │ │ │ │ -2382 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ │ -2383 aggregate_->_s_i_z_e())); │ │ │ │ │ -2384 aggregate_->_a_d_d(candidates); │ │ │ │ │ -2385 } │ │ │ │ │ -2386 } │ │ │ │ │ -2387 │ │ │ │ │ -2388 template │ │ │ │ │ -2389 template │ │ │ │ │ -2390 std::tuple _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(const M& │ │ │ │ │ -matrix, G& graph, const C& criterion, │ │ │ │ │ -2391 bool finestLevel) │ │ │ │ │ -2392 { │ │ │ │ │ -2393 Aggregator aggregator; │ │ │ │ │ -2394 return aggregator.build(matrix, graph, *this, criterion, finestLevel); │ │ │ │ │ -2395 } │ │ │ │ │ -2396 │ │ │ │ │ -2397 template │ │ │ │ │ -2398 template │ │ │ │ │ -2399 std::tuple _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_b_u_i_l_d(const M& m, G& graph, │ │ │ │ │ -AggregatesMap& aggregates, const C& c, │ │ │ │ │ -2400 bool finestLevel) │ │ │ │ │ -2401 { │ │ │ │ │ -2402 using std::max; │ │ │ │ │ -2403 using std::min; │ │ │ │ │ -2404 // Stack for fast vertex access │ │ │ │ │ -2405 Stack stack_(graph, *this, aggregates); │ │ │ │ │ -2406 │ │ │ │ │ -2407 graph_ = &graph; │ │ │ │ │ -2408 │ │ │ │ │ -2409 aggregate_ = new Aggregate(graph, aggregates, connected_, │ │ │ │ │ -front_); │ │ │ │ │ -2410 │ │ │ │ │ -2411 Timer watch; │ │ │ │ │ -2412 watch.reset(); │ │ │ │ │ -2413 │ │ │ │ │ -2414 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(graph, m, c, finestLevel); │ │ │ │ │ -2415 │ │ │ │ │ -2416 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<::ISOLATED; │ │ │ │ │ -2437 ++skippedAggregates; │ │ │ │ │ -2438 continue; │ │ │ │ │ -2439 } │ │ │ │ │ -2440 │ │ │ │ │ -2441 if(graph.getVertexProperties(seed).isolated()) { │ │ │ │ │ -2442 if(c.skipIsolated()) { │ │ │ │ │ -2443 // isolated vertices are not aggregated but skipped on the coarser levels. │ │ │ │ │ -2444 aggregates[seed]=AggregatesMap::ISOLATED; │ │ │ │ │ -2445 ++skippedAggregates; │ │ │ │ │ -2446 // skip rest as no agglomeration is done. │ │ │ │ │ -2447 continue; │ │ │ │ │ -2448 }else{ │ │ │ │ │ -2449 aggregate_->_s_e_e_d(seed); │ │ │ │ │ -2450 growIsolatedAggregate(seed, aggregates, c); │ │ │ │ │ -2451 } │ │ │ │ │ -2452 }else{ │ │ │ │ │ -2453 aggregate_->_s_e_e_d(seed); │ │ │ │ │ -2454 growAggregate(seed, aggregates, c); │ │ │ │ │ -2455 } │ │ │ │ │ -2456 │ │ │ │ │ -2457 /* The rounding step. */ │ │ │ │ │ -2458 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->_s_i_z_e() │ │ │ │ │ -< c.maxAggregateSize()) { │ │ │ │ │ -2459 │ │ │ │ │ -2460 std::vector candidates; │ │ │ │ │ -2461 candidates.reserve(30); │ │ │ │ │ -2462 │ │ │ │ │ -2463 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ -2464 │ │ │ │ │ -2465 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ │ -2466 │ │ │ │ │ -2467 if(graph.getVertexProperties(*vertex).isolated()) │ │ │ │ │ -2468 continue; // No isolated nodes here │ │ │ │ │ -2469 │ │ │ │ │ -2470 if(twoWayConnections( *vertex, aggregate_->_i_d(), aggregates) == 0 && │ │ │ │ │ -2471 (oneWayConnections( *vertex, aggregate_->_i_d(), aggregates) == 0 || │ │ │ │ │ -2472 !admissible( *vertex, aggregate_->_i_d(), aggregates) )) │ │ │ │ │ -2473 continue; │ │ │ │ │ -2474 │ │ │ │ │ -2475 std::pair neighbourPair=neighbours(*vertex, aggregate_->_i_d(), │ │ │ │ │ -2476 aggregates); │ │ │ │ │ -2477 │ │ │ │ │ -2478 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= │ │ │ │ │ -unusedNeighbours(*vertex, aggregates)) │ │ │ │ │ -2479 // continue; │ │ │ │ │ -2480 │ │ │ │ │ -2481 if(neighbourPair.first >= neighbourPair.second) │ │ │ │ │ -2482 continue; │ │ │ │ │ -2483 │ │ │ │ │ -2484 if(distance(*vertex, aggregates) > c.maxDistance()) │ │ │ │ │ -2485 continue; // Distance too far │ │ │ │ │ -2486 candidates.push_back(*vertex); │ │ │ │ │ -2487 break; │ │ │ │ │ -2488 } │ │ │ │ │ -2489 │ │ │ │ │ -2490 if(!candidates.size()) break; // no more candidates found. │ │ │ │ │ -2491 │ │ │ │ │ -2492 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ │ -2493 aggregate_->_s_i_z_e())); │ │ │ │ │ -2494 aggregate_->_a_d_d(candidates); │ │ │ │ │ -2495 │ │ │ │ │ -2496 } │ │ │ │ │ -2497 │ │ │ │ │ -2498 // try to merge aggregates consisting of only one nonisolated vertex with │ │ │ │ │ -other aggregates │ │ │ │ │ -2499 if(aggregate_->_s_i_z_e()==1 && c.maxAggregateSize()>1) { │ │ │ │ │ -2500 if(!graph.getVertexProperties(seed).isolated()) { │ │ │ │ │ -2501 _V_e_r_t_e_x mergedNeighbour = mergeNeighbour(seed, aggregates); │ │ │ │ │ -2502 │ │ │ │ │ -2503 if(mergedNeighbour != AggregatesMap::UNAGGREGATED) { │ │ │ │ │ -2504 // assign vertex to the neighbouring cluster │ │ │ │ │ -2505 aggregates[seed] = aggregates[mergedNeighbour]; │ │ │ │ │ -2506 aggregate_->_i_n_v_a_l_i_d_a_t_e(); │ │ │ │ │ -2507 }else{ │ │ │ │ │ -2508 ++avg; │ │ │ │ │ -2509 minA=min(minA,static_cast(1)); │ │ │ │ │ -2510 maxA=max(maxA,static_cast(1)); │ │ │ │ │ -2511 ++oneAggregates; │ │ │ │ │ -2512 ++conAggregates; │ │ │ │ │ -2513 } │ │ │ │ │ -2514 }else{ │ │ │ │ │ -2515 ++avg; │ │ │ │ │ -2516 minA=min(minA,static_cast(1)); │ │ │ │ │ -2517 maxA=max(maxA,static_cast(1)); │ │ │ │ │ -2518 ++oneAggregates; │ │ │ │ │ -2519 ++isoAggregates; │ │ │ │ │ -2520 } │ │ │ │ │ -2521 ++avg; │ │ │ │ │ -2522 }else{ │ │ │ │ │ -2523 avg+=aggregate_->_s_i_z_e(); │ │ │ │ │ -2524 minA=min(minA,aggregate_->_s_i_z_e()); │ │ │ │ │ -2525 maxA=max(maxA,aggregate_->_s_i_z_e()); │ │ │ │ │ -2526 if(graph.getVertexProperties(seed).isolated()) │ │ │ │ │ -2527 ++isoAggregates; │ │ │ │ │ -2528 else │ │ │ │ │ -2529 ++conAggregates; │ │ │ │ │ -2530 } │ │ │ │ │ -2531 │ │ │ │ │ -2532 } │ │ │ │ │ -2533 │ │ │ │ │ -2534 Dune::dinfo<<"connected aggregates: "<0) │ │ │ │ │ -2537 Dune::dinfo<<" one node aggregates: "<::iterator valIter_ │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:189 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_C_o_l_I_t_e_r │ │ │ │ │ -Matrix::ConstColIterator ColIter │ │ │ │ │ -Constant column iterator of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:154 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h │ │ │ │ │ -std::size_t breadthFirstSearch(const VertexDescriptor &start, const │ │ │ │ │ -AggregateDescriptor &aggregate, const G &graph, L &visited, F1 │ │ │ │ │ -&aggregateVisitor, F2 &nonAggregateVisitor, VM &visitedMap) const │ │ │ │ │ -Breadth first search within an aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ -PoolAllocator< VertexDescriptor, 100 > Allocator │ │ │ │ │ -The allocator we use for our lists and the set. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:586 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ -iterator begin() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:737 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_i_d │ │ │ │ │ -int id() │ │ │ │ │ -Get the id identifying the aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ │ -Norm norm_ │ │ │ │ │ -The functor for calculating the norm. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:302 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ │ -MatrixGraph::VertexDescriptor Vertex │ │ │ │ │ -The vertex identifier. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:920 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ -AggregationCriterion() │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ │ -const Matrix * matrix_ │ │ │ │ │ -The matrix we work on. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:357 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -auto operator()(const M &m, typename std::enable_if_t< Dune::IsNumber< M >:: │ │ │ │ │ -value > *sfinae=nullptr) const │ │ │ │ │ -Compute the norm of a scalar. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:406 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ │ -void initRow(const Row &row, int index) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -SymmetricMatrixDependency(const Parameters &parms) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:168 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ │ -M Matrix │ │ │ │ │ -The matrix type we build the dependency of. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:258 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_C_o_u_n_t_e_r │ │ │ │ │ -Counter() │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ -G MatrixGraph │ │ │ │ │ -The matrix graph type used. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:915 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ │ -Norm norm_ │ │ │ │ │ -The functor for calculating the norm. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:363 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const EdgeIterator &edge) const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:601 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -SymmetricCriterion() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:524 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -Dependency() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:290 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ -void examine(const ColIter &col) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ │ -M Matrix │ │ │ │ │ -The matrix type we build the dependency of. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:319 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ │ -real_type diagonal_ │ │ │ │ │ -The norm of the current diagonal. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:187 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ │ -N Norm │ │ │ │ │ -The norm to use for examining the matrix entries. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ -iterator end() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:742 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -UnSymmetricCriterion(const Parameters &parms) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:541 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_T_w_o_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ │ -void initRow(const Row &row, int index) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:201 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ │ -bool isIsolated() │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_N_u_l_l_E_n_t_r_y │ │ │ │ │ -static const Vertex NullEntry │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:1008 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ -void examine(const ColIter &col) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:214 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -Dependency(const Parameters &parms) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:286 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ │ -int row_ │ │ │ │ │ -index of the currently evaluated row. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:185 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_b_u_i_l_d │ │ │ │ │ -std::tuple< int, int, int, int > build(const M &m, G &graph, AggregatesMap< │ │ │ │ │ -Vertex > &aggregates, const C &c, bool finestLevel) │ │ │ │ │ -Build the aggregates. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r │ │ │ │ │ -FrontNeighbourCounter(const MatrixGraph &front) │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ │ -Matrix::row_type Row │ │ │ │ │ -Constant Row iterator of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:329 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ │ -const Matrix * matrix_ │ │ │ │ │ -The matrix we work on. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:296 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -const AggregateDescriptor & operator[](const VertexDescriptor &v) const │ │ │ │ │ -Get the aggregate a vertex belongs to. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ -void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter │ │ │ │ │ -&col) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r │ │ │ │ │ -AggregateVisitor(const AggregatesMap< Vertex > &aggregates, const │ │ │ │ │ -AggregateDescriptor &aggregate, Visitor &visitor) │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_C_o_l_I_t_e_r │ │ │ │ │ -Matrix::ConstColIterator ColIter │ │ │ │ │ -Constant column iterator of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:334 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_~_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -~AggregatesMap() │ │ │ │ │ -Destructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -Matrix::field_type field_type │ │ │ │ │ -The current max value. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:179 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ -void decrement() │ │ │ │ │ -Decrement counter. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_A_g_g_r_e_g_a_t_e │ │ │ │ │ -Aggregate(MatrixGraph &graph, AggregatesMap< Vertex > &aggregates, VertexSet │ │ │ │ │ -&connectivity, std::vector< Vertex > &front_) │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_V_i_s_i_t_o_r │ │ │ │ │ -V Visitor │ │ │ │ │ -The type of the adapted visitor. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:1064 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_S_p_h_e_r_e_M_a_p │ │ │ │ │ -std::size_t * SphereMap │ │ │ │ │ -Type of the mapping of aggregate members onto distance spheres. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:809 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ -AggregationCriterion(const Parameters &parms) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ │ -Matrix::row_type Row │ │ │ │ │ -Constant Row iterator of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:268 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_o_n_n_e_c_t_S_i_z_e │ │ │ │ │ -VertexSet::size_type connectSize() │ │ │ │ │ -Get tne number of connections to other aggregates. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_v_a_l_s__ │ │ │ │ │ -std::vector< real_type > vals_ │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ │ -N Norm │ │ │ │ │ -The norm to use for examining the matrix entries. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:324 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_p_r_i_n_t_A_g_g_r_e_g_a_t_e_s_2_d │ │ │ │ │ -void printAggregates2d(const AggregatesMap< V > &aggregates, int n, int m, │ │ │ │ │ -std::ostream &os) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:2583 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_i_n_v_a_l_i_d_a_t_e │ │ │ │ │ -void invalidate() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:822 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ │ -real_type maxValue_ │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:181 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ │ -Norm norm_ │ │ │ │ │ -The functor for calculating the norm. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:183 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -VertexSet::const_iterator const_iterator │ │ │ │ │ -Const iterator over a vertex list. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:804 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -SymmetricCriterion(const Parameters &parms) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:521 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ -MatrixGraph::VertexDescriptor AggregateDescriptor │ │ │ │ │ -The type of the aggregate descriptor. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:923 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ │ -real_type maxValue_ │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:361 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ │ -void init(const Matrix *matrix) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:195 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ │ -real_type diagonal_ │ │ │ │ │ -The norm of the current diagonal. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:367 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -AggregateDescriptor * iterator │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:735 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -SymmetricDependency(const Parameters &parms) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:348 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:360 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_~_A_g_g_r_e_g_a_t_o_r │ │ │ │ │ -~Aggregator() │ │ │ │ │ -Destructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ -void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter │ │ │ │ │ -&col) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_a_d_d │ │ │ │ │ -void add(const Vertex &vertex) │ │ │ │ │ -Add a vertex to the aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_D_e_p_e_n_d_e_n_c_y_P_o_l_i_c_y │ │ │ │ │ -T DependencyPolicy │ │ │ │ │ -The policy for calculating the dependency graph. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:55 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_a_d_d │ │ │ │ │ -void add(std::vector< Vertex > &vertex) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ -void examine(const ColIter &col) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_o_r │ │ │ │ │ -Aggregator() │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ -Examine an edge. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_F_r_o_n_t_M_a_r_k_e_r │ │ │ │ │ -FrontMarker(std::vector< Vertex > &front, MatrixGraph &graph) │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ │ -compute the norm of a matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:506 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ │ -void init(const Matrix *matrix) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s │ │ │ │ │ -int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, │ │ │ │ │ -V &visitor) │ │ │ │ │ -Visit all neighbour vertices of a vertex in a graph. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c │ │ │ │ │ -void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ │ -Sets reasonable default values for an isotropic problem. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ -V AggregateDescriptor │ │ │ │ │ -The aggregate descriptor type. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:580 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ │ -static const V ISOLATED │ │ │ │ │ -Identifier of isolated vertices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ │ -int row_ │ │ │ │ │ -index of the currently evaluated row. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:365 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -SymmetricMatrixDependency() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r │ │ │ │ │ -DependencyCounter() │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_p_o_p │ │ │ │ │ -Vertex pop() │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ │ -real_type diagonal_ │ │ │ │ │ -The norm of the current diagonal. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:306 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ -std::size_t noVertices() const │ │ │ │ │ -Get the number of vertices. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c │ │ │ │ │ -void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ │ -Sets reasonable default values for an aisotropic problem. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:105 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -AggregatesMap(std::size_t noVertices) │ │ │ │ │ -Constructs with allocating memory. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -Matrix::field_type field_type │ │ │ │ │ -The current max value. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:359 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -AggregateDescriptor & operator[](const VertexDescriptor &v) │ │ │ │ │ -Get the aggregate a vertex belongs to. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -AggregatesMap() │ │ │ │ │ -Constructs without allocating memory. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_v_a_l_u_e │ │ │ │ │ -int value() │ │ │ │ │ -Access the current count. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_L_i_s_t │ │ │ │ │ -SLList< VertexDescriptor, Allocator > VertexList │ │ │ │ │ -The type of a single linked list of vertex descriptors. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:592 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_~_S_t_a_c_k │ │ │ │ │ -~Stack() │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r │ │ │ │ │ -ConnectivityCounter(const VertexSet &connected, const AggregatesMap< Vertex > │ │ │ │ │ -&aggregates) │ │ │ │ │ -Constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_i_z_e │ │ │ │ │ -VertexSet::size_type size() │ │ │ │ │ -Get the size of the aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_e_n_d │ │ │ │ │ -const_iterator end() const │ │ │ │ │ -get an iterator over the vertices of the aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ │ -void init(const Matrix *matrix) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -UnSymmetricCriterion() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:544 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -const AggregateDescriptor * const_iterator │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ │ -int row_ │ │ │ │ │ -index of the currently evaluated row. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:304 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_S_t_a_c_k │ │ │ │ │ -Stack(const MatrixGraph &graph, const Aggregator< G > &aggregatesBuilder, const │ │ │ │ │ -AggregatesMap< Vertex > &aggregates) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ │ -void initRow(const Row &row, int index) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ │ -M Matrix │ │ │ │ │ -The matrix type we build the dependency of. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:139 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ │ -const Matrix * matrix_ │ │ │ │ │ -The matrix we work on. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:177 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_V_e_r_t_e_x_S_e_t │ │ │ │ │ -S VertexSet │ │ │ │ │ -The type of a single linked list of vertex descriptors. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:801 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ │ -compute the norm of a matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:490 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_U_N_A_G_G_R_E_G_A_T_E_D │ │ │ │ │ -static const V UNAGGREGATED │ │ │ │ │ -Identifier of not yet aggregated vertices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:566 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h │ │ │ │ │ -std::size_t breadthFirstSearch(const VertexDescriptor &start, const │ │ │ │ │ -AggregateDescriptor &aggregate, const G &graph, F &aggregateVisitor, VM │ │ │ │ │ -&visitedMap) const │ │ │ │ │ -Breadth first search within an aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -Matrix::field_type field_type │ │ │ │ │ -The current max value. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:298 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_O_n_e_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > │ │ │ │ │ -&criterion) │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:113 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ │ -bool isIsolated() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:240 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ -void allocate(std::size_t noVertices) │ │ │ │ │ -Allocate memory for holding the information. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ │ -N Norm │ │ │ │ │ -The norm to use for examining the matrix entries. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:144 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ │ -compute the norm of a matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:473 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_r_e_c_o_n_s_t_r_u_c_t │ │ │ │ │ -void reconstruct(const Vertex &vertex) │ │ │ │ │ -Reconstruct the aggregat from an seed node. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_b_e_g_i_n │ │ │ │ │ -const_iterator begin() const │ │ │ │ │ -get an iterator over the vertices of the aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -FieldTraits< typenameM::field_type >::real_type operator()(const M &m, typename │ │ │ │ │ -std::enable_if_t::value > *sfinae=nullptr) const │ │ │ │ │ -compute the norm of a matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:390 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_V_e_r_t_e_x │ │ │ │ │ -MatrixGraph::VertexDescriptor Vertex │ │ │ │ │ -The vertex descriptor type. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:789 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_e_e_d │ │ │ │ │ -void seed(const Vertex &vertex) │ │ │ │ │ -Initialize the aggregate with one vertex. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ │ -bool isIsolated() │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -SymmetricDependency() │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:351 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_l_e_a_r │ │ │ │ │ -void clear() │ │ │ │ │ -Clear the aggregate. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_f_r_e_e │ │ │ │ │ -void free() │ │ │ │ │ -Free the allocated memory. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -Increment counter. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, │ │ │ │ │ -bool finestLevel) │ │ │ │ │ -Build the dependency of the matrix graph. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ -V VertexDescriptor │ │ │ │ │ -The vertex descriptor type. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:575 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ │ -real_type maxValue_ │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s │ │ │ │ │ -std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, │ │ │ │ │ -const C &criterion, bool finestLevel) │ │ │ │ │ -Build the aggregates. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ │ -Matrix::row_type Row │ │ │ │ │ -Constant Row iterator of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ -PoolAllocator< Vertex, 100 > Allocator │ │ │ │ │ -The allocator we use for our lists and the set. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:795 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ -G MatrixGraph │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:785 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ -@ is_sign_preserving │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:483 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ -@ is_sign_preserving │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:382 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ -@ is_sign_preserving │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:499 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ -@ is_sign_preserving │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:466 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h │ │ │ │ │ +void presmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ +Apply pre smoothing on the current level. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:406 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ +const void * Arguments │ │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ │ +void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ +Apply post smoothing on the current level. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ │ +int iterations │ │ │ │ │ +The numbe of iterations to perform. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_m_a_t_r_i_x │ │ │ │ │ +OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix │ │ │ │ │ +The iterator over the matrices. │ │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:184 │ │ │ │ │ +_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:704 │ │ │ │ │ +_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:188 │ │ │ │ │ +_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:150 │ │ │ │ │ +_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:695 │ │ │ │ │ +_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:481 │ │ │ │ │ +_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:204 │ │ │ │ │ +_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:123 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ │ +MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy │ │ │ │ │ +The operator hierarchy type. │ │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_d_i_s_t │ │ │ │ │ +OperatorHierarchy::RedistributeInfoList::const_iterator redist │ │ │ │ │ +The iterator over the redistribution information. │ │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:192 │ │ │ │ │ +_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:476 │ │ │ │ │ +_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:632 │ │ │ │ │ +_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:200 │ │ │ │ │ +_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:208 │ │ │ │ │ +_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:212 │ │ │ │ │ +_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:488 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ +OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ │ +The parallal data distribution hierarchy type. │ │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_p_r_e │ │ │ │ │ +void pre(Domain &x, Range &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:427 │ │ │ │ │ +_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:297 │ │ │ │ │ +_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:196 │ │ │ │ │ _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_:_:_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_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ _D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ A generic dynamic dense matrix. │ │ │ │ │ DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ _D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ │ Export the type representing the underlying field. │ │ │ │ │ DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ │ _D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ row_type::const_iterator ConstColIterator │ │ │ │ │ Const iterator for the entries of each row. │ │ │ │ │ DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ -MatrixImp::DenseMatrixBase< T, A >::window_type row_type │ │ │ │ │ -The type implementing a matrix row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:574 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ -Base class of all aggregation criterions. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -Dependency policy for symmetric matrices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:134 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -Dependency policy for symmetric matrices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:253 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ -Dependency policy for symmetric matrices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:314 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l │ │ │ │ │ -Norm that uses only the [N][N] entry of the block to determine couplings. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:379 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_i_r_s_t_D_i_a_g_o_n_a_l │ │ │ │ │ -Norm that uses only the [0][0] entry of the block to determine couplings. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:455 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m │ │ │ │ │ -Functor using the row sum (infinity) norm to determine strong couplings. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:463 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:480 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:496 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -Criterion taking advantage of symmetric matrices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:519 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -Criterion suitable for unsymmetric matrices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:539 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r │ │ │ │ │ -Class for building the aggregates. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:909 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ │ -A Dummy visitor that does nothing for each visited edge. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:598 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e │ │ │ │ │ -A class for temporarily storing the vertices of an aggregate in. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:778 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ -M::size_type VertexDescriptor │ │ │ │ │ -The vertex descriptor. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ -EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator │ │ │ │ │ -The constant edge iterator type. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:298 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ -Iterator over all edges starting from a vertex. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ -The vertex iterator type of the graph. │ │ │ │ │ -DDeeffiinniittiioonn graph.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +T block_type │ │ │ │ │ +Export the type representing the components. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:568 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G │ │ │ │ │ +A fast (sequential) algebraic multigrid based on agglomeration that saves │ │ │ │ │ +memory bandwidth. │ │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ │ +static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ │ +DDeeffiinniittiioonn fastamgsmoother.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ │ +> Iterator │ │ │ │ │ +Type of the mutable iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator over the levels in the hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ +The hierarchies build by the coarsening process. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ All parameters for AMG. │ │ │ │ │ DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ +The default class for the smoother arguments. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +Base class for matrix free definition of preconditioners. │ │ │ │ │ +DDeeffiinniittiioonn preconditioner.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R │ │ │ │ │ +Sequential SSOR preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:141 │ │ │ │ │ +_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:48 │ │ │ │ │ +_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:73 │ │ │ │ │ +_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:99 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ +Category │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ │ +@ sequential │ │ │ │ │ +Category for sequential solvers. │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00125.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: renumberer.hh File Reference │ │ │ │ +dune-istl: galerkin.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,41 +71,68 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
renumberer.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ -
#include "aggregates.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

class  Dune::Amg::AggregateRenumberer< G >
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
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

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

Detailed Description

│ │ │ │ +

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

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

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

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

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Amg::KAmgTwoGrid< AMG >
 Two grid operator for AMG with Krylov cycle. More...
struct  Dune::Amg::ApplyHelper< i >
 
struct  Dune::Amg::ApplyHelper< 0 >
 
class  Dune::Amg::KAMG< M, X, S, PI, K, A >
 an algebraic multigrid method using a Krylov-cycle. More...
class  Dune::Amg::CombinedFunctor< T >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ -

Provides an algebraic multigrid using a Krylov cycle.

│ │ │ │ -
Author
Markus Blatt
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,32 +2,24 @@ │ │ │ │ │ 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_._._. │ │ │ │ │ -#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" │ │ │ │ │ +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_:_:_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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _i_ _> │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides an algebraic multigrid using a Krylov cycle. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00128_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: kamg.hh Source File │ │ │ │ +dune-istl: combinedfunctor.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,332 +74,90 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
kamg.hh
│ │ │ │ +
combinedfunctor.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AMG_COMBINEDFUNCTOR_HH
│ │ │ │ +
6#define DUNE_AMG_COMBINEDFUNCTOR_HH
│ │ │ │
7
│ │ │ │ - │ │ │ │ -
9#include "amg.hh"
│ │ │ │ -
10
│ │ │ │ -
11namespace Dune
│ │ │ │ -
12{
│ │ │ │ -
13 namespace Amg
│ │ │ │ -
14 {
│ │ │ │ -
15
│ │ │ │ -
30 template<class AMG>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
32 : public Preconditioner<typename AMG::Domain,typename AMG::Range>
│ │ │ │ -
33 {
│ │ │ │ -
35 typedef typename AMG::Domain Domain;
│ │ │ │ -
37 typedef typename AMG::Range Range;
│ │ │ │ -
38 public:
│ │ │ │ -
39
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
42 {
│ │ │ │ -
43 return amg_.category();
│ │ │ │ -
44 };
│ │ │ │ -
│ │ │ │ -
45
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
54 : amg_(amg), coarseSolver_(coarseSolver)
│ │ │ │ -
55 {}
│ │ │ │ -
│ │ │ │ -
56
│ │ │ │ -
│ │ │ │ -
58 void pre([[maybe_unused]] typename AMG::Domain& x, [[maybe_unused]] typename AMG::Range& b)
│ │ │ │ -
59 {}
│ │ │ │ -
│ │ │ │ -
60
│ │ │ │ -
│ │ │ │ -
62 void post([[maybe_unused]] typename AMG::Domain& x)
│ │ │ │ -
63 {}
│ │ │ │ -
│ │ │ │ -
64
│ │ │ │ -
│ │ │ │ -
66 void apply(typename AMG::Domain& v, const typename AMG::Range& d)
│ │ │ │ -
67 {
│ │ │ │ -
68 // Copy data
│ │ │ │ -
69 *levelContext_->update=0;
│ │ │ │ -
70 *levelContext_->rhs = d;
│ │ │ │ -
71 *levelContext_->lhs = v;
│ │ │ │ -
72
│ │ │ │ -
73 presmooth(*levelContext_, amg_.preSteps_);
│ │ │ │ -
74 bool processFineLevel =
│ │ │ │ -
75 amg_.moveToCoarseLevel(*levelContext_);
│ │ │ │ -
76
│ │ │ │ -
77 if(processFineLevel) {
│ │ │ │ -
78 typename AMG::Range b=*levelContext_->rhs;
│ │ │ │ -
79 typename AMG::Domain x=*levelContext_->update;
│ │ │ │ - │ │ │ │ -
81 coarseSolver_->apply(x, b, res);
│ │ │ │ -
82 *levelContext_->update=x;
│ │ │ │ -
83 }
│ │ │ │ -
84
│ │ │ │ -
85 amg_.moveToFineLevel(*levelContext_, processFineLevel);
│ │ │ │ -
86
│ │ │ │ -
87 postsmooth(*levelContext_, amg_.postSteps_);
│ │ │ │ -
88 v=*levelContext_->update;
│ │ │ │ -
89 }
│ │ │ │ -
│ │ │ │ -
90
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
96 {
│ │ │ │ -
97 return coarseSolver_;
│ │ │ │ -
98 }
│ │ │ │ -
│ │ │ │ -
99
│ │ │ │ -
│ │ │ │ -
104 void setLevelContext(std::shared_ptr<typename AMG::LevelContext> p)
│ │ │ │ -
105 {
│ │ │ │ -
106 levelContext_=p;
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
111 {}
│ │ │ │ -
│ │ │ │ -
112
│ │ │ │ -
113 private:
│ │ │ │ -
115 AMG& amg_;
│ │ │ │ -
117 std::shared_ptr<InverseOperator<Domain,Range> > coarseSolver_;
│ │ │ │ -
119 std::shared_ptr<typename AMG::LevelContext> levelContext_;
│ │ │ │ -
120 };
│ │ │ │ -
│ │ │ │ -
121
│ │ │ │ -
122
│ │ │ │ -
123
│ │ │ │ -
137 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ │ -
138 class K=GeneralizedPCGSolver<X>, class A=std::allocator<X> >
│ │ │ │ -
│ │ │ │ -
139 class KAMG : public Preconditioner<X,X>
│ │ │ │ -
140 {
│ │ │ │ -
141 public:
│ │ │ │ - │ │ │ │ -
145 typedef K KrylovSolver;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
155 typedef typename Amg::Operator Operator;
│ │ │ │ -
157 typedef typename Amg::Domain Domain;
│ │ │ │ -
159 typedef typename Amg::Range Range;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
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 }
│ │ │ │ -
│ │ │ │ -
318
│ │ │ │ -
319 template<class M, class X, class S, class P, class K, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
321 {
│ │ │ │ -
322 return amg.maxlevels();
│ │ │ │ -
323 }
│ │ │ │ -
│ │ │ │ -
324
│ │ │ │ -
326 } // Amg
│ │ │ │ -
327} // Dune
│ │ │ │ -
328
│ │ │ │ -
329#endif
│ │ │ │ -
The AMG preconditioner.
│ │ │ │ -
Define general preconditioner interface.
│ │ │ │ -
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:300
│ │ │ │ -
X Domain
The domain type.
Definition amg.hh:87
│ │ │ │ -
KAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms, std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1)
Construct a new amg with a specific coarse solver.
Definition kamg.hh:233
│ │ │ │ -
std::size_t maxlevels()
Definition kamg.hh:320
│ │ │ │ -
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ │ -
M Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ │ -
void post(Domain &x)
Clean up.
Definition kamg.hh:293
│ │ │ │ -
X Range
The range type.
Definition amg.hh:89
│ │ │ │ -
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ │ -
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ │ -
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition kamg.hh:253
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition amg.hh:194
│ │ │ │ -
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:80
│ │ │ │ +
8#include <tuple>
│ │ │ │ +
9
│ │ │ │ +
10namespace Dune
│ │ │ │ +
11{
│ │ │ │ +
12 namespace Amg
│ │ │ │ +
13 {
│ │ │ │ +
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 } //namespace Amg
│ │ │ │ +
51} // namespace Dune
│ │ │ │ +
52#endif
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
an algebraic multigrid method using a Krylov-cycle.
Definition kamg.hh:140
│ │ │ │ -
Amg::Domain Domain
the type of the domain.
Definition kamg.hh:157
│ │ │ │ -
Amg::SmootherArgs SmootherArgs
The type of the arguments for construction of the smoothers.
Definition kamg.hh:153
│ │ │ │ -
Amg::ParallelInformation ParallelInformation
the type of the parallelinformation to use.
Definition kamg.hh:151
│ │ │ │ -
Amg::CoarseSolver CoarseSolver
The type of the coarse solver.
Definition kamg.hh:149
│ │ │ │ -
Amg::OperatorHierarchy OperatorHierarchy
The type of the hierarchy of operators.
Definition kamg.hh:147
│ │ │ │ -
Amg::Range Range
The type of the range.
Definition kamg.hh:159
│ │ │ │ -
Amg::ScalarProduct ScalarProduct
The type of the scalar product.
Definition kamg.hh:163
│ │ │ │ -
AMG< M, X, S, PI, A > Amg
The type of the underlying AMG.
Definition kamg.hh:143
│ │ │ │ -
Amg::Operator Operator
the type of the lineatr operator.
Definition kamg.hh:155
│ │ │ │ -
Amg::ParallelInformationHierarchy ParallelInformationHierarchy
The type of the hierarchy of parallel information.
Definition kamg.hh:161
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:166
│ │ │ │ -
K KrylovSolver
The type of the Krylov solver for the cycle.
Definition kamg.hh:145
│ │ │ │ -
Two grid operator for AMG with Krylov cycle.
Definition kamg.hh:33
│ │ │ │ -
void pre(typename AMG::Domain &x, typename AMG::Range &b)
Prepare the preconditioner.
Definition kamg.hh:58
│ │ │ │ -
KAmgTwoGrid(AMG &amg, std::shared_ptr< InverseOperator< Domain, Range > > coarseSolver)
Constructor.
Definition kamg.hh:53
│ │ │ │ -
~KAmgTwoGrid()
Destructor.
Definition kamg.hh:110
│ │ │ │ -
void post(typename AMG::Domain &x)
Clean up.
Definition kamg.hh:62
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:41
│ │ │ │ -
void setLevelContext(std::shared_ptr< typename AMG::LevelContext > p)
Set the level context pointer.
Definition kamg.hh:104
│ │ │ │ -
InverseOperator< Domain, Range > * coarseSolver()
Get a pointer to the coarse grid solver.
Definition kamg.hh:95
│ │ │ │ -
void apply(typename AMG::Domain &v, const typename AMG::Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:66
│ │ │ │ -
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ │ - │ │ │ │ -
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ -
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │ -
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ -
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ -
Generalized preconditioned conjugate gradient solver.
Definition solvers.hh:1307
│ │ │ │ +
Definition combinedfunctor.hh:17
│ │ │ │ +
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:19
│ │ │ │ +
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:29
│ │ │ │ +
Definition combinedfunctor.hh:36
│ │ │ │ +
CombinedFunctor(const T &tuple_)
Definition combinedfunctor.hh:38
│ │ │ │ +
void operator()(const T1 &t)
Definition combinedfunctor.hh:43
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,433 +1,82 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -kamg.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 (C) 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_AMG_COMBINEDFUNCTOR_HH │ │ │ │ │ +6#define DUNE_AMG_COMBINEDFUNCTOR_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ │ -9#include "_a_m_g_._h_h" │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e │ │ │ │ │ -12{ │ │ │ │ │ -13 namespace Amg │ │ │ │ │ -14 { │ │ │ │ │ -15 │ │ │ │ │ -30 template │ │ │ │ │ -_3_1 class _K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ -32 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -33 { │ │ │ │ │ -35 typedef typename _A_M_G_:_:_D_o_m_a_i_n Domain; │ │ │ │ │ -37 typedef typename _A_M_G_:_:_R_a_n_g_e Range; │ │ │ │ │ -38 public: │ │ │ │ │ -39 │ │ │ │ │ -_4_1 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -42 { │ │ │ │ │ -43 return amg_._c_a_t_e_g_o_r_y(); │ │ │ │ │ -44 }; │ │ │ │ │ -45 │ │ │ │ │ -_5_3 _K_A_m_g_T_w_o_G_r_i_d(_A_M_G& amg, std::shared_ptr<_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_> > │ │ │ │ │ -_c_o_a_r_s_e_S_o_l_v_e_r) │ │ │ │ │ -54 : amg_(amg), coarseSolver_(_c_o_a_r_s_e_S_o_l_v_e_r) │ │ │ │ │ -55 {} │ │ │ │ │ -56 │ │ │ │ │ -_5_8 void _p_r_e([[maybe_unused]] typename _A_M_G_:_:_D_o_m_a_i_n& x, [[maybe_unused]] typename │ │ │ │ │ -_A_M_G_:_:_R_a_n_g_e& b) │ │ │ │ │ -59 {} │ │ │ │ │ -60 │ │ │ │ │ -_6_2 void _p_o_s_t([[maybe_unused]] typename _A_M_G_:_:_D_o_m_a_i_n& x) │ │ │ │ │ -63 {} │ │ │ │ │ -64 │ │ │ │ │ -_6_6 void _a_p_p_l_y(typename _A_M_G_:_:_D_o_m_a_i_n& v, const typename _A_M_G_:_:_R_a_n_g_e& d) │ │ │ │ │ -67 { │ │ │ │ │ -68 // Copy data │ │ │ │ │ -69 *levelContext_->update=0; │ │ │ │ │ -70 *levelContext_->rhs = d; │ │ │ │ │ -71 *levelContext_->lhs = v; │ │ │ │ │ -72 │ │ │ │ │ -73 _p_r_e_s_m_o_o_t_h(*levelContext_, amg_.preSteps_); │ │ │ │ │ -74 bool processFineLevel = │ │ │ │ │ -75 amg_.moveToCoarseLevel(*levelContext_); │ │ │ │ │ -76 │ │ │ │ │ -77 if(processFineLevel) { │ │ │ │ │ -78 typename _A_M_G_:_:_R_a_n_g_e b=*levelContext_->rhs; │ │ │ │ │ -79 typename _A_M_G_:_:_D_o_m_a_i_n x=*levelContext_->update; │ │ │ │ │ -80 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ -81 coarseSolver_->apply(x, b, res); │ │ │ │ │ -82 *levelContext_->update=x; │ │ │ │ │ -83 } │ │ │ │ │ -84 │ │ │ │ │ -85 amg_.moveToFineLevel(*levelContext_, processFineLevel); │ │ │ │ │ -86 │ │ │ │ │ -87 _p_o_s_t_s_m_o_o_t_h(*levelContext_, amg_.postSteps_); │ │ │ │ │ -88 v=*levelContext_->update; │ │ │ │ │ -89 } │ │ │ │ │ -90 │ │ │ │ │ -_9_5 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_>* _c_o_a_r_s_e_S_o_l_v_e_r() │ │ │ │ │ -96 { │ │ │ │ │ -97 return coarseSolver_; │ │ │ │ │ -98 } │ │ │ │ │ -99 │ │ │ │ │ -_1_0_4 void _s_e_t_L_e_v_e_l_C_o_n_t_e_x_t(std::shared_ptr p) │ │ │ │ │ -105 { │ │ │ │ │ -106 levelContext_=p; │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -_1_1_0 _~_K_A_m_g_T_w_o_G_r_i_d() │ │ │ │ │ -111 {} │ │ │ │ │ -112 │ │ │ │ │ -113 private: │ │ │ │ │ -115 _A_M_G& amg_; │ │ │ │ │ -117 std::shared_ptr > coarseSolver_; │ │ │ │ │ -119 std::shared_ptr levelContext_; │ │ │ │ │ -120 }; │ │ │ │ │ -121 │ │ │ │ │ -122 │ │ │ │ │ -123 │ │ │ │ │ -137 template, class A=std::allocator > │ │ │ │ │ -_1_3_9 class _K_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -140 { │ │ │ │ │ -141 public: │ │ │ │ │ -_1_4_3 typedef _A_M_G_<_M_,_X_,_S_,_P_I_,_A_> _A_m_g; │ │ │ │ │ -_1_4_5 typedef K _K_r_y_l_o_v_S_o_l_v_e_r; │ │ │ │ │ -_1_4_7 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ │ -_1_4_9 typedef typename _A_m_g_:_:_C_o_a_r_s_e_S_o_l_v_e_r _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ │ -_1_5_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ -_1_5_3 typedef typename _A_m_g_:_:_S_m_o_o_t_h_e_r_A_r_g_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ │ -_1_5_5 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r _O_p_e_r_a_t_o_r; │ │ │ │ │ -_1_5_7 typedef typename _A_m_g_:_:_D_o_m_a_i_n _D_o_m_a_i_n; │ │ │ │ │ -_1_5_9 typedef typename _A_m_g_:_:_R_a_n_g_e _R_a_n_g_e; │ │ │ │ │ -_1_6_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ │ -_1_6_3 typedef typename _A_m_g_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t _S_c_a_l_a_r_P_r_o_d_u_c_t; │ │ │ │ │ -164 │ │ │ │ │ -_1_6_6 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -167 { │ │ │ │ │ -168 return amg._c_a_t_e_g_o_r_y(); │ │ │ │ │ -169 }; │ │ │ │ │ -170 │ │ │ │ │ -182 _K_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ │ -183 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ │ -184 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1); │ │ │ │ │ -185 │ │ │ │ │ -199 template │ │ │ │ │ -200 _K_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ -201 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs=_S_m_o_o_t_h_e_r_A_r_g_s(), │ │ │ │ │ -202 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1, │ │ │ │ │ -203 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ -204 │ │ │ │ │ -206 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ │ -208 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ │ -210 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ │ -211 │ │ │ │ │ -212 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ │ -213 │ │ │ │ │ -214 private: │ │ │ │ │ -216 _A_m_g amg; │ │ │ │ │ -217 │ │ │ │ │ -219 std::size_t maxLevelKrylovSteps; │ │ │ │ │ -220 │ │ │ │ │ -222 double levelDefectReduction; │ │ │ │ │ -223 │ │ │ │ │ -225 std::vector > scalarproducts; │ │ │ │ │ -226 │ │ │ │ │ -228 std::vector > > ksolvers; │ │ │ │ │ -229 }; │ │ │ │ │ -230 │ │ │ │ │ -231 │ │ │ │ │ -232 template │ │ │ │ │ -_2_3_3 _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_K_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& │ │ │ │ │ -coarseSolver, │ │ │ │ │ -234 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& params, │ │ │ │ │ -235 std::size_t ksteps, double reduction) │ │ │ │ │ -236 : amg(matrices, coarseSolver, smootherArgs, params), │ │ │ │ │ -237 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction) │ │ │ │ │ -238 {} │ │ │ │ │ -239 │ │ │ │ │ -240 │ │ │ │ │ -241 template │ │ │ │ │ -242 template │ │ │ │ │ -_2_4_3 _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_K_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ -244 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ │ -245 std::size_t ksteps, double reduction, │ │ │ │ │ -246 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo) │ │ │ │ │ -247 : amg(fineOperator, criterion, smootherArgs, pinfo), │ │ │ │ │ -248 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction) │ │ │ │ │ -249 {} │ │ │ │ │ -250 │ │ │ │ │ -251 │ │ │ │ │ -252 template │ │ │ │ │ -_2_5_3 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ │ -254 { │ │ │ │ │ -255 amg.pre(x,b); │ │ │ │ │ -256 scalarproducts.reserve(amg.levels()); │ │ │ │ │ -257 ksolvers.reserve(amg.levels()); │ │ │ │ │ -258 │ │ │ │ │ -259 typename OperatorHierarchy::ParallelMatrixHierarchy::Iterator │ │ │ │ │ -260 matrix = amg.matrices_->matrices().coarsest(); │ │ │ │ │ -261 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -262 pinfo = amg.matrices_->parallelInformation().coarsest(); │ │ │ │ │ -263 bool hasCoarsest=(amg.levels()==amg.maxlevels()); │ │ │ │ │ -264 │ │ │ │ │ -265 if(hasCoarsest) { │ │ │ │ │ -266 if(matrix==amg.matrices_->matrices().finest()) │ │ │ │ │ -267 return; │ │ │ │ │ -268 --matrix; │ │ │ │ │ -269 --pinfo; │ │ │ │ │ -270 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ │ -(amg, amg.solver_))); │ │ │ │ │ -271 }else │ │ │ │ │ -272 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ │ -(amg, std::shared_ptr<_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_> >()))); │ │ │ │ │ -273 │ │ │ │ │ -274 std::ostringstream s; │ │ │ │ │ -275 │ │ │ │ │ -276 if(matrix!=amg.matrices_->matrices().finest()) │ │ │ │ │ -277 while(true) { │ │ │ │ │ -278 scalarproducts.push_back(createScalarProduct(*pinfo,category())); │ │ │ │ │ -279 std::shared_ptr > ks = │ │ │ │ │ -280 std::shared_ptr >(new _K_r_y_l_o_v_S_o_l_v_e_r(*matrix, * │ │ │ │ │ -(scalarproducts.back()), │ │ │ │ │ -281 *(ksolvers.back()), levelDefectReduction, │ │ │ │ │ -282 maxLevelKrylovSteps, 0)); │ │ │ │ │ -283 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ │ -(amg, ks))); │ │ │ │ │ -284 --matrix; │ │ │ │ │ -285 --pinfo; │ │ │ │ │ -286 if(matrix==amg.matrices_->matrices().finest()) │ │ │ │ │ -287 break; │ │ │ │ │ -288 } │ │ │ │ │ -289 } │ │ │ │ │ -290 │ │ │ │ │ -291 │ │ │ │ │ -292 template │ │ │ │ │ -_2_9_3 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_p_o_s_t(_D_o_m_a_i_n& x) │ │ │ │ │ -294 { │ │ │ │ │ -295 amg.post(x); │ │ │ │ │ -296 │ │ │ │ │ -297 } │ │ │ │ │ -298 │ │ │ │ │ -299 template │ │ │ │ │ -_3_0_0 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ │ -301 { │ │ │ │ │ -302 if(ksolvers.size()==0) │ │ │ │ │ -303 { │ │ │ │ │ -304 _R_a_n_g_e td=d; │ │ │ │ │ -305 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ -306 amg.solver_->apply(v,td,res); │ │ │ │ │ -307 }else │ │ │ │ │ -308 { │ │ │ │ │ -309 typedef typename Amg::LevelContext LevelContext; │ │ │ │ │ -310 std::shared_ptr levelContext(new LevelContext); │ │ │ │ │ -311 amg.initIteratorsWithFineLevel(*levelContext); │ │ │ │ │ -312 typedef typename std::vector > >::iterator │ │ │ │ │ -Iter; │ │ │ │ │ -313 for(Iter solver=ksolvers.begin(); solver!=ksolvers.end(); ++solver) │ │ │ │ │ -314 (*solver)->setLevelContext(levelContext); │ │ │ │ │ -315 ksolvers.back()->apply(v,d); │ │ │ │ │ -316 } │ │ │ │ │ -317 } │ │ │ │ │ -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 │ │ │ │ │ -_a_m_g_._h_h │ │ │ │ │ -The AMG preconditioner. │ │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ -Define general preconditioner interface. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_a_p_p_l_y │ │ │ │ │ -void apply(Domain &v, const Range &d) │ │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ │ -X Domain │ │ │ │ │ -The domain type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_K_A_M_G │ │ │ │ │ -KAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const │ │ │ │ │ -SmootherArgs &smootherArgs, const Parameters &parms, std::size_t │ │ │ │ │ -maxLevelKrylovSteps=3, double minDefectReduction=1e-1) │ │ │ │ │ -Construct a new amg with a specific coarse solver. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:233 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ │ -std::size_t maxlevels() │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:320 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ -SmootherTraits< Smoother >::Arguments SmootherArgs │ │ │ │ │ -The argument type for the construction of the smoother. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ │ -M Operator │ │ │ │ │ -The matrix operator type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_p_o_s_t │ │ │ │ │ -void post(Domain &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_R_a_n_g_e │ │ │ │ │ -X Range │ │ │ │ │ -The range type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:89 │ │ │ │ │ -_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_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ │ -void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ -Apply post smoothing on the current level. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_p_r_e │ │ │ │ │ -void pre(Domain &x, Range &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:253 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -PI ParallelInformation │ │ │ │ │ -The type of the parallel information. Either OwnerOverlapCommunication or │ │ │ │ │ -another type describing the... │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:80 │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e │ │ │ │ │ +11{ │ │ │ │ │ +12 namespace Amg │ │ │ │ │ +13 { │ │ │ │ │ +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 } //namespace Amg │ │ │ │ │ +51} // namespace Dune │ │ │ │ │ +52#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G │ │ │ │ │ -an algebraic multigrid method using a Krylov-cycle. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ │ -Amg::Domain Domain │ │ │ │ │ -the type of the domain. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:157 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ -Amg::SmootherArgs SmootherArgs │ │ │ │ │ -The type of the arguments for construction of the smoothers. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -Amg::ParallelInformation ParallelInformation │ │ │ │ │ -the type of the parallelinformation to use. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:151 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ │ -Amg::CoarseSolver CoarseSolver │ │ │ │ │ -The type of the coarse solver. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ │ -Amg::OperatorHierarchy OperatorHierarchy │ │ │ │ │ -The type of the hierarchy of operators. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_R_a_n_g_e │ │ │ │ │ -Amg::Range Range │ │ │ │ │ -The type of the range. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:159 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ -Amg::ScalarProduct ScalarProduct │ │ │ │ │ -The type of the scalar product. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:163 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_A_m_g │ │ │ │ │ -AMG< M, X, S, PI, A > Amg │ │ │ │ │ -The type of the underlying AMG. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ │ -Amg::Operator Operator │ │ │ │ │ -the type of the lineatr operator. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ -Amg::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ │ -The type of the hierarchy of parallel information. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:161 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:166 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_K_r_y_l_o_v_S_o_l_v_e_r │ │ │ │ │ -K KrylovSolver │ │ │ │ │ -The type of the Krylov solver for the cycle. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ -Two grid operator for AMG with Krylov cycle. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_p_r_e │ │ │ │ │ -void pre(typename AMG::Domain &x, typename AMG::Range &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ -KAmgTwoGrid(AMG &amg, std::shared_ptr< InverseOperator< Domain, Range > > │ │ │ │ │ -coarseSolver) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_~_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ -~KAmgTwoGrid() │ │ │ │ │ -Destructor. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_p_o_s_t │ │ │ │ │ -void post(typename AMG::Domain &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:62 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_s_e_t_L_e_v_e_l_C_o_n_t_e_x_t │ │ │ │ │ -void setLevelContext(std::shared_ptr< typename AMG::LevelContext > p) │ │ │ │ │ -Set the level context pointer. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_c_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ │ -InverseOperator< Domain, Range > * coarseSolver() │ │ │ │ │ -Get a pointer to the coarse grid solver. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_a_p_p_l_y │ │ │ │ │ -void apply(typename AMG::Domain &v, const typename AMG::Range &d) │ │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G │ │ │ │ │ -Parallel algebraic multigrid based on agglomeration. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ │ -> Iterator │ │ │ │ │ -Type of the mutable iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ -The hierarchies build by the coarsening process. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -All parameters for AMG. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ -_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:32 │ │ │ │ │ -_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:48 │ │ │ │ │ -_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:99 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -Category │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ │ -Generalized preconditioned conjugate gradient solver. │ │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1307 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r │ │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_:_:_a_p_p_l_y │ │ │ │ │ +static void apply(TT tuple, const T &t) │ │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _0_ _>_:_:_a_p_p_l_y │ │ │ │ │ +static void apply(TT tuple, const T &t) │ │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r │ │ │ │ │ +CombinedFunctor(const T &tuple_) │ │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const T1 &t) │ │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:43 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00131.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: amg.hh File Reference │ │ │ │ +dune-istl: globalaggregates.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,72 +71,54 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

The AMG preconditioner. │ │ │ │ +

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

│ │ │ │ -
#include <memory>
│ │ │ │ -#include <sstream>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/istl/paamg/smoother.hh>
│ │ │ │ -#include <dune/istl/paamg/transfer.hh>
│ │ │ │ -#include <dune/istl/paamg/matrixhierarchy.hh>
│ │ │ │ -#include <dune/istl/solvers.hh>
│ │ │ │ -#include <dune/istl/scalarproducts.hh>
│ │ │ │ -#include <dune/istl/superlu.hh>
│ │ │ │ -#include <dune/istl/umfpack.hh>
│ │ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/scalarvectorview.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <dune/common/parametertree.hh>
│ │ │ │ +
#include "aggregates.hh"
│ │ │ │ +#include "pinfo.hh"
│ │ │ │ +#include <dune/common/parallel/indexset.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::Amg::AMG< M, X, S, PI, A >
 Parallel algebraic multigrid based on agglomeration. More...
struct  Dune::Amg::GlobalAggregatesMap< T, TI >
 
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >
class  Dune::Amg::GlobalAggregatesMap< T, TI >::Proxy
 
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, SolverType >
struct  Dune::Amg::AggregatesGatherScatter< T, TI >
 
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, superlu >
struct  Dune::Amg::AggregatesPublisher< T, O, I >
 
struct  Dune::AMGCreator
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::AMGCreator::isValidBlockType< class >
struct  Dune::Amg::AggregatesPublisher< T, O, SequentialInformation >
 
struct  Dune::AMGCreator::isValidBlockType< FieldMatrix< T, n, m > >
struct  Dune::CommPolicy< Amg::GlobalAggregatesMap< T, TI > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

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

Detailed Description

│ │ │ │ -

The AMG preconditioner.

│ │ │ │ +

Provdes class for identifying aggregates globally.

│ │ │ │
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,60 +1,45 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -amg.hh File Reference │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +globalaggregates.hh File Reference │ │ │ │ │ _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ │ » _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ │ -The AMG preconditioner. _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 │ │ │ │ │ -#include │ │ │ │ │ -#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 "_p_i_n_f_o_._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_:_:_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_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _> │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_<_ _M_a_t_r_i_x_,_ _V_e_c_t_o_r_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_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_:_:_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_:_:_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_:_:_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_:_:_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_C_r_e_a_t_o_r │ │ │ │ │ +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_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_ _c_l_a_s_s_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_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_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_ _> │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ -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 ********** │ │ │ │ │ -The AMG preconditioner. │ │ │ │ │ +Provdes class for identifying aggregates globally. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00131_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: amg.hh Source File │ │ │ │ +dune-istl: globalaggregates.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,1278 +74,339 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
amg.hh
│ │ │ │ +
globalaggregates.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AMG_HH
│ │ │ │ -
6#define DUNE_AMG_AMG_HH
│ │ │ │ +
5#ifndef DUNE_GLOBALAGGREGATES_HH
│ │ │ │ +
6#define DUNE_GLOBALAGGREGATES_HH
│ │ │ │
7
│ │ │ │ -
8#include <memory>
│ │ │ │ -
9#include <sstream>
│ │ │ │ -
10#include <dune/common/exceptions.hh>
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
14#include <dune/istl/solvers.hh>
│ │ │ │ - │ │ │ │ -
16#include <dune/istl/superlu.hh>
│ │ │ │ -
17#include <dune/istl/umfpack.hh>
│ │ │ │ - │ │ │ │ -
19#include <dune/common/typetraits.hh>
│ │ │ │ -
20#include <dune/common/exceptions.hh>
│ │ │ │ -
21#include <dune/common/scalarvectorview.hh>
│ │ │ │ -
22#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
23#include <dune/common/parametertree.hh>
│ │ │ │ -
24
│ │ │ │ -
25namespace Dune
│ │ │ │ -
26{
│ │ │ │ -
27 namespace Amg
│ │ │ │ -
28 {
│ │ │ │ -
46 template<class M, class X, class S, class P, class K, class A>
│ │ │ │ -
47 class KAMG;
│ │ │ │ -
48
│ │ │ │ -
49 template<class T>
│ │ │ │ -
50 class KAmgTwoGrid;
│ │ │ │ -
51
│ │ │ │ -
62 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ │ -
63 class A=std::allocator<X> >
│ │ │ │ -
│ │ │ │ -
64 class AMG : public Preconditioner<X,X>
│ │ │ │ -
65 {
│ │ │ │ -
66 template<class M1, class X1, class S1, class P1, class K1, class A1>
│ │ │ │ -
67 friend class KAMG;
│ │ │ │ +
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 friend class KAmgTwoGrid<AMG>;
│ │ │ │ -
70
│ │ │ │ -
71 public:
│ │ │ │ -
73 typedef M Operator;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
85
│ │ │ │ -
87 typedef X Domain;
│ │ │ │ -
89 typedef X Range;
│ │ │ │ - │ │ │ │ -
97 typedef S Smoother;
│ │ │ │ -
98
│ │ │ │ - │ │ │ │ +
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ -
111 AMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ │ -
112 const SmootherArgs& smootherArgs, const Parameters& parms);
│ │ │ │ -
113
│ │ │ │ -
125 template<class C>
│ │ │ │ -
│ │ │ │ -
126 AMG(const Operator& fineOperator, const C& criterion,
│ │ │ │ -
127 const SmootherArgs& smootherArgs=SmootherArgs(),
│ │ │ │ - │ │ │ │ -
129
│ │ │ │ -
│ │ │ │ -
180 AMG(std::shared_ptr<const Operator> fineOperator, const ParameterTree& configuration, const ParallelInformation& pinfo=ParallelInformation());
│ │ │ │ -
181
│ │ │ │ -
│ │ │ │ -
185 AMG(const AMG& amg);
│ │ │ │ -
186
│ │ │ │ -
│ │ │ │ -
188 void pre(Domain& x, Range& b);
│ │ │ │ -
189
│ │ │ │ -
│ │ │ │ -
191 void apply(Domain& v, const Range& d);
│ │ │ │ -
192
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
195 {
│ │ │ │ -
196 return category_;
│ │ │ │ -
197 }
│ │ │ │ -
│ │ │ │ -
198
│ │ │ │ -
│ │ │ │ -
200 void post(Domain& x);
│ │ │ │ -
201
│ │ │ │ -
206 template<class A1>
│ │ │ │ -
│ │ │ │ -
207 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ │ +
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 std::size_t levels();
│ │ │ │ -
210
│ │ │ │ -
│ │ │ │ -
211 std::size_t maxlevels();
│ │ │ │ -
212
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
222 {
│ │ │ │ -
223 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ │ -
224 }
│ │ │ │ -
│ │ │ │ +
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 private:
│ │ │ │ -
233 /*
│ │ │ │ -
234 * @brief Helper function to create hierarchies with parameter tree.
│ │ │ │ -
235 *
│ │ │ │ -
236 * Will create the coarsen criterion with the norm and create the
│ │ │ │ -
237 * Hierarchies
│ │ │ │ -
238 * \tparam Norm Type of the norm to use.
│ │ │ │ -
239 */
│ │ │ │ -
240 template<class Norm>
│ │ │ │ -
241 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ │ -
242 const PI& pinfo, const Norm&,
│ │ │ │ -
243 const ParameterTree& configuration,
│ │ │ │ -
244 std::true_type compiles = std::true_type());
│ │ │ │ -
245 template<class Norm>
│ │ │ │ -
246 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ │ -
247 const PI& pinfo, const Norm&,
│ │ │ │ -
248 const ParameterTree& configuration,
│ │ │ │ -
249 std::false_type);
│ │ │ │ -
254 template<class C>
│ │ │ │ -
255 void createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr,
│ │ │ │ -
256 const PI& pinfo, const ParameterTree& configuration);
│ │ │ │ -
263 template<class C>
│ │ │ │ -
264 void createHierarchies(C& criterion,
│ │ │ │ -
265 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ -
266 const PI& pinfo);
│ │ │ │ -
273 struct LevelContext
│ │ │ │ -
274 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
283 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ │ - │ │ │ │ -
291 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ │ -
295 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
311 std::size_t level;
│ │ │ │ -
312 };
│ │ │ │ -
313
│ │ │ │ -
314
│ │ │ │ -
319 void mgc(LevelContext& levelContext);
│ │ │ │ -
320
│ │ │ │ -
321 void additiveMgc();
│ │ │ │ -
322
│ │ │ │ -
329 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel);
│ │ │ │ -
330
│ │ │ │ -
335 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ │ -
336
│ │ │ │ -
341 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ │ -
342
│ │ │ │ -
344 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ │ -
346 SmootherArgs smootherArgs_;
│ │ │ │ -
348 std::shared_ptr<Hierarchy<Smoother,A> > smoothers_;
│ │ │ │ -
350 std::shared_ptr<CoarseSolver> solver_;
│ │ │ │ -
352 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ │ -
354 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ │ -
356 std::shared_ptr<Hierarchy<Domain,A>> update_;
│ │ │ │ - │ │ │ │ -
360 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ │ -
362 std::size_t gamma_;
│ │ │ │ -
364 std::size_t preSteps_;
│ │ │ │ -
366 std::size_t postSteps_;
│ │ │ │ -
367 bool buildHierarchy_;
│ │ │ │ -
368 bool additive;
│ │ │ │ -
369 bool coarsesolverconverged;
│ │ │ │ -
370 std::shared_ptr<Smoother> coarseSmoother_;
│ │ │ │ -
372 SolverCategory::Category category_;
│ │ │ │ -
374 std::size_t verbosity_;
│ │ │ │ -
375
│ │ │ │ -
376 struct ToLower
│ │ │ │ -
377 {
│ │ │ │ -
│ │ │ │ -
378 std::string operator()(const std::string& str)
│ │ │ │ -
379 {
│ │ │ │ -
380 std::stringstream retval;
│ │ │ │ -
381 std::ostream_iterator<char> out(retval);
│ │ │ │ -
382 std::transform(str.begin(), str.end(), out,
│ │ │ │ -
383 [](char c){
│ │ │ │ -
384 return std::tolower(c, std::locale::classic());
│ │ │ │ -
385 });
│ │ │ │ -
386 return retval.str();
│ │ │ │ -
387 }
│ │ │ │ -
│ │ │ │ -
388 };
│ │ │ │ -
389 };
│ │ │ │ -
390
│ │ │ │ -
391 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ -
392 inline AMG<M,X,S,PI,A>::AMG(const AMG& amg)
│ │ │ │ -
393 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_),
│ │ │ │ -
394 smoothers_(amg.smoothers_), solver_(amg.solver_),
│ │ │ │ -
395 rhs_(), lhs_(), update_(),
│ │ │ │ -
396 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_),
│ │ │ │ -
397 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ │ -
398 buildHierarchy_(amg.buildHierarchy_),
│ │ │ │ -
399 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ │ -
400 coarseSmoother_(amg.coarseSmoother_),
│ │ │ │ -
401 category_(amg.category_),
│ │ │ │ -
402 verbosity_(amg.verbosity_)
│ │ │ │ -
403 {}
│ │ │ │ -
│ │ │ │ -
404
│ │ │ │ -
405 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
407 const SmootherArgs& smootherArgs,
│ │ │ │ -
408 const Parameters& parms)
│ │ │ │ -
409 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_(smootherArgs),
│ │ │ │ -
410 smoothers_(new Hierarchy<Smoother,A>), solver_(&coarseSolver),
│ │ │ │ -
411 rhs_(), lhs_(), update_(), scalarProduct_(0),
│ │ │ │ -
412 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ │ -
413 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ │ -
414 additive(parms.getAdditive()), coarsesolverconverged(true),
│ │ │ │ -
415 coarseSmoother_(),
│ │ │ │ -
416// #warning should category be retrieved from matrices?
│ │ │ │ -
417 category_(SolverCategory::category(*smoothers_->coarsest())),
│ │ │ │ -
418 verbosity_(parms.debugLevel())
│ │ │ │ -
419 {
│ │ │ │ -
420 assert(matrices_->isBuilt());
│ │ │ │ -
421
│ │ │ │ -
422 // build the necessary smoother hierarchies
│ │ │ │ -
423 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ │ -
424 }
│ │ │ │ -
│ │ │ │ -
425
│ │ │ │ -
426 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
427 template<class C>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
429 const C& criterion,
│ │ │ │ -
430 const SmootherArgs& smootherArgs,
│ │ │ │ -
431 const PI& pinfo)
│ │ │ │ -
432 : smootherArgs_(smootherArgs),
│ │ │ │ -
433 smoothers_(new Hierarchy<Smoother,A>), solver_(),
│ │ │ │ -
434 rhs_(), lhs_(), update_(), scalarProduct_(),
│ │ │ │ -
435 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()),
│ │ │ │ -
436 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true),
│ │ │ │ -
437 additive(criterion.getAdditive()), coarsesolverconverged(true),
│ │ │ │ -
438 coarseSmoother_(),
│ │ │ │ -
439 category_(SolverCategory::category(pinfo)),
│ │ │ │ -
440 verbosity_(criterion.debugLevel())
│ │ │ │ -
441 {
│ │ │ │ - │ │ │ │ -
443 DUNE_THROW(InvalidSolverCategory, "Matrix and Communication must have the same SolverCategory!");
│ │ │ │ -
444 // TODO: reestablish compile time checks.
│ │ │ │ -
445 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ │ -
446 // "Matrix and Solver must match in terms of category!");
│ │ │ │ -
447 auto matrixptr = stackobject_to_shared_ptr(matrix);
│ │ │ │ -
448 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ │ -
449 }
│ │ │ │ -
│ │ │ │ -
450
│ │ │ │ -
451 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ -
452 AMG<M,X,S,PI,A>::AMG(std::shared_ptr<const Operator> matrixptr,
│ │ │ │ -
453 const ParameterTree& configuration,
│ │ │ │ -
454 const ParallelInformation& pinfo) :
│ │ │ │ -
455 smoothers_(new Hierarchy<Smoother,A>),
│ │ │ │ -
456 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_(true),
│ │ │ │ -
457 coarsesolverconverged(true), coarseSmoother_(),
│ │ │ │ -
458 category_(SolverCategory::category(pinfo))
│ │ │ │ -
459 {
│ │ │ │ -
460
│ │ │ │ -
461 if (configuration.hasKey ("smootherIterations"))
│ │ │ │ -
462 smootherArgs_.iterations = configuration.get<int>("smootherIterations");
│ │ │ │ -
463
│ │ │ │ -
464 if (configuration.hasKey ("smootherRelaxation"))
│ │ │ │ -
465 smootherArgs_.relaxationFactor = configuration.get<typename SmootherArgs::RelaxationFactor>("smootherRelaxation");
│ │ │ │ -
466
│ │ │ │ -
467 auto normName = ToLower()(configuration.get("strengthMeasure", "diagonal"));
│ │ │ │ -
468 auto index = configuration.get<int>("diagonalRowIndex", 0);
│ │ │ │ -
469
│ │ │ │ -
470 if ( normName == "diagonal")
│ │ │ │ -
471 {
│ │ │ │ -
472 using field_type = typename M::field_type;
│ │ │ │ -
473 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
474 std::is_convertible<field_type, real_type> compiles;
│ │ │ │ -
475
│ │ │ │ -
476 switch (index)
│ │ │ │ -
477 {
│ │ │ │ -
478 case 0:
│ │ │ │ -
479 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<0>(), configuration, compiles);
│ │ │ │ -
480 break;
│ │ │ │ -
481 case 1:
│ │ │ │ -
482 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<1>(), configuration, compiles);
│ │ │ │ -
483 break;
│ │ │ │ -
484 case 2:
│ │ │ │ -
485 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<2>(), configuration, compiles);
│ │ │ │ -
486 break;
│ │ │ │ -
487 case 3:
│ │ │ │ -
488 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<3>(), configuration, compiles);
│ │ │ │ -
489 break;
│ │ │ │ -
490 case 4:
│ │ │ │ -
491 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<4>(), configuration, compiles);
│ │ │ │ -
492 break;
│ │ │ │ -
493 default:
│ │ │ │ -
494 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not supported.");
│ │ │ │ -
495 }
│ │ │ │ -
496 }
│ │ │ │ -
497 else if (normName == "rowsum")
│ │ │ │ -
498 createCriterionAndHierarchies(matrixptr, pinfo, RowSum(), configuration);
│ │ │ │ -
499 else if (normName == "frobenius")
│ │ │ │ -
500 createCriterionAndHierarchies(matrixptr, pinfo, FrobeniusNorm(), configuration);
│ │ │ │ -
501 else if (normName == "one")
│ │ │ │ -
502 createCriterionAndHierarchies(matrixptr, pinfo, AlwaysOneNorm(), configuration);
│ │ │ │ -
503 else
│ │ │ │ -
504 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure "<<normName<<" is not supported by AMG");
│ │ │ │ -
505 }
│ │ │ │ -
│ │ │ │ -
506
│ │ │ │ -
507 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
508 template<class Norm>
│ │ │ │ -
509 void AMG<M,X,S,PI,A>::createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const Norm&, const ParameterTree& configuration, std::false_type)
│ │ │ │ -
510 {
│ │ │ │ -
511 DUNE_THROW(InvalidStateException, "Strength of connection measure does not support this type ("
│ │ │ │ -
512 << className<typename M::field_type>() << ") as it is lacking a conversion to"
│ │ │ │ -
513 << className<typename FieldTraits<typename M::field_type>::real_type>() << ".");
│ │ │ │ -
514 }
│ │ │ │ -
515
│ │ │ │ -
516 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
517 template<class Norm>
│ │ │ │ -
518 void AMG<M,X,S,PI,A>::createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const Norm&, const ParameterTree& configuration, std::true_type)
│ │ │ │ -
519 {
│ │ │ │ -
520 if (configuration.get<bool>("criterionSymmetric", true))
│ │ │ │ -
521 {
│ │ │ │ -
522 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ │ - │ │ │ │ -
524 Criterion criterion;
│ │ │ │ -
525 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ │ -
526 }
│ │ │ │ -
527 else
│ │ │ │ -
528 {
│ │ │ │ -
529 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ │ - │ │ │ │ -
531 Criterion criterion;
│ │ │ │ -
532 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ │ -
533 }
│ │ │ │ -
534 }
│ │ │ │ -
535
│ │ │ │ -
536 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
537 template<class C>
│ │ │ │ -
538 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const ParameterTree& configuration)
│ │ │ │ -
539 {
│ │ │ │ -
540 if (configuration.hasKey ("maxLevel"))
│ │ │ │ -
541 criterion.setMaxLevel(configuration.get<int>("maxLevel"));
│ │ │ │ -
542
│ │ │ │ -
543 if (configuration.hasKey ("minCoarseningRate"))
│ │ │ │ -
544 criterion.setMinCoarsenRate(configuration.get<int>("minCoarseningRate"));
│ │ │ │ -
545
│ │ │ │ -
546 if (configuration.hasKey ("coarsenTarget"))
│ │ │ │ -
547 criterion.setCoarsenTarget (configuration.get<int>("coarsenTarget"));
│ │ │ │ -
548
│ │ │ │ -
549 if (configuration.hasKey ("accumulationMode"))
│ │ │ │ -
550 {
│ │ │ │ -
551 std::string mode = ToLower()(configuration.get<std::string>("accumulationMode"));
│ │ │ │ -
552 if ( mode == "none")
│ │ │ │ -
553 criterion.setAccumulate(AccumulationMode::noAccu);
│ │ │ │ -
554 else if ( mode == "atonce" )
│ │ │ │ -
555 criterion.setAccumulate(AccumulationMode::atOnceAccu);
│ │ │ │ -
556 else if ( mode == "successive")
│ │ │ │ -
557 criterion.setCoarsenTarget (AccumulationMode::successiveAccu);
│ │ │ │ -
558 else
│ │ │ │ -
559 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ │ -
560 << mode <<".");
│ │ │ │ -
561 }
│ │ │ │ -
562
│ │ │ │ -
563 if (configuration.hasKey ("prolongationDampingFactor"))
│ │ │ │ -
564 criterion.setProlongationDampingFactor (configuration.get<double>("prolongationDampingFactor"));
│ │ │ │ -
565
│ │ │ │ -
566 if (configuration.hasKey("defaultAggregationSizeMode"))
│ │ │ │ -
567 {
│ │ │ │ -
568 auto mode = ToLower()(configuration.get<std::string>("defaultAggregationSizeMode"));
│ │ │ │ -
569 auto dim = configuration.get<std::size_t>("defaultAggregationDimension");
│ │ │ │ -
570 std::size_t maxDistance = 2;
│ │ │ │ -
571 if (configuration.hasKey("MaxAggregateDistance"))
│ │ │ │ -
572 maxDistance = configuration.get<std::size_t>("maxAggregateDistance");
│ │ │ │ -
573 if (mode == "isotropic")
│ │ │ │ -
574 criterion.setDefaultValuesIsotropic(dim, maxDistance);
│ │ │ │ -
575 else if(mode == "anisotropic")
│ │ │ │ -
576 criterion.setDefaultValuesAnisotropic(dim, maxDistance);
│ │ │ │ -
577 else
│ │ │ │ -
578 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ │ -
579 << mode <<".");
│ │ │ │ -
580 }
│ │ │ │ -
581
│ │ │ │ -
582 if (configuration.hasKey("maxAggregateDistance"))
│ │ │ │ -
583 criterion.setMaxDistance(configuration.get<std::size_t>("maxAggregateDistance"));
│ │ │ │ -
584
│ │ │ │ -
585 if (configuration.hasKey("minAggregateSize"))
│ │ │ │ -
586 criterion.setMinAggregateSize(configuration.get<std::size_t>("minAggregateSize"));
│ │ │ │ -
587
│ │ │ │ -
588 if (configuration.hasKey("maxAggregateSize"))
│ │ │ │ -
589 criterion.setMaxAggregateSize(configuration.get<std::size_t>("maxAggregateSize"));
│ │ │ │ -
590
│ │ │ │ -
591 if (configuration.hasKey("maxAggregateConnectivity"))
│ │ │ │ -
592 criterion.setMaxConnectivity(configuration.get<std::size_t>("maxAggregateConnectivity"));
│ │ │ │ -
593
│ │ │ │ -
594 if (configuration.hasKey ("alpha"))
│ │ │ │ -
595 criterion.setAlpha (configuration.get<double> ("alpha"));
│ │ │ │ -
596
│ │ │ │ -
597 if (configuration.hasKey ("beta"))
│ │ │ │ -
598 criterion.setBeta (configuration.get<double> ("beta"));
│ │ │ │ -
599
│ │ │ │ -
600 if (configuration.hasKey ("gamma"))
│ │ │ │ -
601 criterion.setGamma (configuration.get<std::size_t> ("gamma"));
│ │ │ │ -
602 gamma_ = criterion.getGamma();
│ │ │ │ -
603
│ │ │ │ -
604 if (configuration.hasKey ("additive"))
│ │ │ │ -
605 criterion.setAdditive (configuration.get<bool>("additive"));
│ │ │ │ -
606 additive = criterion.getAdditive();
│ │ │ │ -
607
│ │ │ │ -
608 if (configuration.hasKey ("preSteps"))
│ │ │ │ -
609 criterion.setNoPreSmoothSteps (configuration.get<std::size_t> ("preSteps"));
│ │ │ │ -
610 preSteps_ = criterion.getNoPreSmoothSteps ();
│ │ │ │ -
611
│ │ │ │ -
612 if (configuration.hasKey ("postSteps"))
│ │ │ │ -
613 criterion.setNoPostSmoothSteps (configuration.get<std::size_t> ("postSteps"));
│ │ │ │ -
614 postSteps_ = criterion.getNoPostSmoothSteps ();
│ │ │ │ -
615
│ │ │ │ -
616 verbosity_ = configuration.get("verbosity", 0);
│ │ │ │ -
617 criterion.setDebugLevel (verbosity_);
│ │ │ │ -
618
│ │ │ │ -
619 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ │ -
620 }
│ │ │ │ -
621
│ │ │ │ -
622 template <class Matrix,
│ │ │ │ -
623 class Vector>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
625 {
│ │ │ │ -
626 typedef typename Matrix :: field_type field_type;
│ │ │ │ - │ │ │ │ -
628
│ │ │ │ -
629 static constexpr SolverType solver =
│ │ │ │ -
630#if DISABLE_AMG_DIRECTSOLVER
│ │ │ │ -
631 none;
│ │ │ │ -
632#elif HAVE_SUITESPARSE_UMFPACK
│ │ │ │ - │ │ │ │ -
634#elif HAVE_SUPERLU
│ │ │ │ -
635 superlu ;
│ │ │ │ -
636#else
│ │ │ │ -
637 none;
│ │ │ │ -
638#endif
│ │ │ │ -
639
│ │ │ │ -
640 template <class M, SolverType>
│ │ │ │ -
│ │ │ │ -
641 struct Solver
│ │ │ │ -
642 {
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
644 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ │ -
645 {
│ │ │ │ -
646 DUNE_THROW(NotImplemented,"DirectSolver not selected");
│ │ │ │ -
647 return nullptr;
│ │ │ │ -
648 }
│ │ │ │ -
│ │ │ │ -
649 static std::string name () { return "None"; }
│ │ │ │ -
650 };
│ │ │ │ -
│ │ │ │ -
651#if HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
652 template <class M>
│ │ │ │ -
653 struct Solver< M, umfpack >
│ │ │ │ -
654 {
│ │ │ │ -
655 typedef UMFPack< M > type;
│ │ │ │ -
656 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ │ -
657 {
│ │ │ │ -
658 return new type(mat, verbose, reusevector );
│ │ │ │ -
659 }
│ │ │ │ -
660 static std::string name () { return "UMFPack"; }
│ │ │ │ -
661 };
│ │ │ │ -
662#endif
│ │ │ │ -
663#if HAVE_SUPERLU
│ │ │ │ -
664 template <class M>
│ │ │ │ -
│ │ │ │ -
665 struct Solver< M, superlu >
│ │ │ │ -
666 {
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
668 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ │ -
669 {
│ │ │ │ -
670 return new type(mat, verbose, reusevector );
│ │ │ │ -
671 }
│ │ │ │ -
│ │ │ │ -
672 static std::string name () { return "SuperLU"; }
│ │ │ │ -
673 };
│ │ │ │ -
│ │ │ │ -
674#endif
│ │ │ │ -
675
│ │ │ │ -
676 // define direct solver type to be used
│ │ │ │ - │ │ │ │ -
678 typedef typename SelectedSolver :: type DirectSolver;
│ │ │ │ -
679 static constexpr bool isDirectSolver = solver != none;
│ │ │ │ -
680 static std::string name() { return SelectedSolver :: name (); }
│ │ │ │ -
│ │ │ │ -
681 static DirectSolver* create(const Matrix& mat, bool verbose, bool reusevector )
│ │ │ │ -
682 {
│ │ │ │ -
683 return SelectedSolver :: create( mat, verbose, reusevector );
│ │ │ │ -
684 }
│ │ │ │ -
│ │ │ │ -
685 };
│ │ │ │ -
│ │ │ │ -
686
│ │ │ │ -
687 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
688 template<class C>
│ │ │ │ -
689 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion,
│ │ │ │ -
690 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ -
691 const PI& pinfo)
│ │ │ │ -
692 {
│ │ │ │ -
693 Timer watch;
│ │ │ │ -
694 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ │ -
695 std::const_pointer_cast<Operator>(matrixptr),
│ │ │ │ -
696 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ │ -
697
│ │ │ │ -
698 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ │ -
699
│ │ │ │ -
700 // build the necessary smoother hierarchies
│ │ │ │ -
701 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ │ -
702
│ │ │ │ -
703 // test whether we should solve on the coarse level. That is the case if we
│ │ │ │ -
704 // have that level and if there was a redistribution on this level then our
│ │ │ │ -
705 // communicator has to be valid (size()>0) as the smoother might try to communicate
│ │ │ │ -
706 // in the constructor.
│ │ │ │ -
707 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()
│ │ │ │ -
708 && ( ! matrices_->redistributeInformation().back().isSetup() ||
│ │ │ │ -
709 matrices_->parallelInformation().coarsest().getRedistributed().communicator().size() ) )
│ │ │ │ -
710 {
│ │ │ │ -
711 // We have the carsest level. Create the coarse Solver
│ │ │ │ -
712 SmootherArgs sargs(smootherArgs_);
│ │ │ │ -
713 sargs.iterations = 1;
│ │ │ │ -
714
│ │ │ │ - │ │ │ │ -
716 cargs.setArgs(sargs);
│ │ │ │ -
717 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ │ -
718 // Solve on the redistributed partitioning
│ │ │ │ -
719 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ │ -
720 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ │ -
721 }else{
│ │ │ │ -
722 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ │ -
723 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ │ -
724 }
│ │ │ │ -
725
│ │ │ │ -
726 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ │ -
727 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ │ -
728
│ │ │ │ -
729 typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector;
│ │ │ │ -
730
│ │ │ │ -
731 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ │ -
732 if( SolverSelector::isDirectSolver &&
│ │ │ │ -
733 (std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ │ -
734 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ │ -
735 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ │ -
736 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ │ -
737 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0) )
│ │ │ │ -
738 )
│ │ │ │ -
739 { // redistribute and 1 proc
│ │ │ │ -
740 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ -
741 {
│ │ │ │ -
742 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ -
743 {
│ │ │ │ -
744 // We are still participating on this level
│ │ │ │ -
745 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ │ -
746 }
│ │ │ │ -
747 else
│ │ │ │ -
748 solver_.reset();
│ │ │ │ -
749 }
│ │ │ │ -
750 else
│ │ │ │ -
751 {
│ │ │ │ -
752 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ │ -
753 }
│ │ │ │ -
754 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ │ -
755 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << ")" << std::endl;
│ │ │ │ -
756 }
│ │ │ │ -
757 else
│ │ │ │ -
758 {
│ │ │ │ -
759 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ -
760 {
│ │ │ │ -
761 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ -
762 // We are still participating on this level
│ │ │ │ -
763
│ │ │ │ -
764 // we have to allocate these types using the rebound allocator
│ │ │ │ -
765 // in order to ensure that we fulfill the alignment requirements
│ │ │ │ -
766 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ │ -
767 *scalarProduct_,
│ │ │ │ -
768 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ -
769 else
│ │ │ │ -
770 solver_.reset();
│ │ │ │ -
771 }else
│ │ │ │ -
772 {
│ │ │ │ -
773 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ │ -
774 *scalarProduct_,
│ │ │ │ -
775 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ -
776 // // we have to allocate these types using the rebound allocator
│ │ │ │ -
777 // // in order to ensure that we fulfill the alignment requirements
│ │ │ │ -
778 // using Alloc = typename std::allocator_traits<A>::template rebind_alloc<BiCGSTABSolver<X>>;
│ │ │ │ -
779 // Alloc alloc;
│ │ │ │ -
780 // auto p = alloc.allocate(1);
│ │ │ │ -
781 // std::allocator_traits<Alloc>::construct(alloc, p,
│ │ │ │ -
782 // const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ │ -
783 // *scalarProduct_,
│ │ │ │ -
784 // *coarseSmoother_, 1E-2, 1000, 0);
│ │ │ │ -
785 // solver_.reset(p,[](BiCGSTABSolver<X>* p){
│ │ │ │ -
786 // Alloc alloc;
│ │ │ │ -
787 // std::allocator_traits<Alloc>::destroy(alloc, p);
│ │ │ │ -
788 // alloc.deallocate(p,1);
│ │ │ │ -
789 // });
│ │ │ │ -
790 }
│ │ │ │ -
791 }
│ │ │ │ -
792 }
│ │ │ │ -
793
│ │ │ │ -
794 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ │ -
795 std::cout<<"Building hierarchy of "<<matrices_->maxlevels()<<" levels "
│ │ │ │ -
796 <<"(including coarse solver) took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
797 }
│ │ │ │ -
798
│ │ │ │ -
799
│ │ │ │ -
800 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
802 {
│ │ │ │ -
803 // Detect Matrix rows where all offdiagonal entries are
│ │ │ │ -
804 // zero and set x such that A_dd*x_d=b_d
│ │ │ │ -
805 // Thus users can be more careless when setting up their linear
│ │ │ │ -
806 // systems.
│ │ │ │ -
807 typedef typename M::matrix_type Matrix;
│ │ │ │ -
808 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ │ -
809 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ │ -
810 typedef typename Matrix::block_type Block;
│ │ │ │ -
811 Block zero;
│ │ │ │ -
812 zero=typename Matrix::field_type();
│ │ │ │ -
813
│ │ │ │ -
814 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ │ -
815 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ │ -
816 bool isDirichlet = true;
│ │ │ │ -
817 bool hasDiagonal = false;
│ │ │ │ -
818 Block diagonal{};
│ │ │ │ -
819 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ │ -
820 if(row.index()==col.index()) {
│ │ │ │ -
821 diagonal = *col;
│ │ │ │ -
822 hasDiagonal = true;
│ │ │ │ -
823 }else{
│ │ │ │ -
824 if(*col!=zero)
│ │ │ │ -
825 isDirichlet = false;
│ │ │ │ -
826 }
│ │ │ │ -
827 }
│ │ │ │ -
828 if(isDirichlet && hasDiagonal)
│ │ │ │ -
829 {
│ │ │ │ -
830 auto&& xEntry = Impl::asVector(x[row.index()]);
│ │ │ │ -
831 auto&& bEntry = Impl::asVector(b[row.index()]);
│ │ │ │ -
832 Impl::asMatrix(diagonal).solve(xEntry, bEntry);
│ │ │ │ -
833 }
│ │ │ │ -
834 }
│ │ │ │ -
835
│ │ │ │ -
836 if(smoothers_->levels()>0)
│ │ │ │ -
837 smoothers_->finest()->pre(x,b);
│ │ │ │ -
838 else
│ │ │ │ -
839 // No smoother to make x consistent! Do it by hand
│ │ │ │ -
840 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ │ -
841 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ │ -
842 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ -
843 update_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ -
844 matrices_->coarsenVector(*rhs_);
│ │ │ │ -
845 matrices_->coarsenVector(*lhs_);
│ │ │ │ -
846 matrices_->coarsenVector(*update_);
│ │ │ │ -
847
│ │ │ │ -
848 // Preprocess all smoothers
│ │ │ │ -
849 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ │ -
850 typedef typename Hierarchy<Range,A>::Iterator RIterator;
│ │ │ │ -
851 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ │ -
852 Iterator coarsest = smoothers_->coarsest();
│ │ │ │ -
853 Iterator smoother = smoothers_->finest();
│ │ │ │ -
854 RIterator rhs = rhs_->finest();
│ │ │ │ -
855 DIterator lhs = lhs_->finest();
│ │ │ │ -
856 if(smoothers_->levels()>1) {
│ │ │ │ -
857
│ │ │ │ -
858 assert(lhs_->levels()==rhs_->levels());
│ │ │ │ -
859 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels()==matrices_->maxlevels());
│ │ │ │ -
860 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels()<matrices_->maxlevels());
│ │ │ │ -
861
│ │ │ │ -
862 if(smoother!=coarsest)
│ │ │ │ -
863 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, ++rhs)
│ │ │ │ -
864 smoother->pre(*lhs,*rhs);
│ │ │ │ -
865 smoother->pre(*lhs,*rhs);
│ │ │ │ -
866 }
│ │ │ │ -
867
│ │ │ │ -
868
│ │ │ │ -
869 // The preconditioner might change x and b. So we have to
│ │ │ │ -
870 // copy the changes to the original vectors.
│ │ │ │ -
871 x = *lhs_->finest();
│ │ │ │ -
872 b = *rhs_->finest();
│ │ │ │ -
873
│ │ │ │ -
874 }
│ │ │ │ -
│ │ │ │ -
875 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
877 {
│ │ │ │ -
878 return matrices_->levels();
│ │ │ │ -
879 }
│ │ │ │ -
│ │ │ │ -
880 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
882 {
│ │ │ │ -
883 return matrices_->maxlevels();
│ │ │ │ -
884 }
│ │ │ │ -
│ │ │ │ -
885
│ │ │ │ -
887 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
889 {
│ │ │ │ -
890 LevelContext levelContext;
│ │ │ │ -
891
│ │ │ │ -
892 if(additive) {
│ │ │ │ -
893 *(rhs_->finest())=d;
│ │ │ │ -
894 additiveMgc();
│ │ │ │ -
895 v=*lhs_->finest();
│ │ │ │ -
896 }else{
│ │ │ │ -
897 // Init all iterators for the current level
│ │ │ │ -
898 initIteratorsWithFineLevel(levelContext);
│ │ │ │ -
899
│ │ │ │ -
900
│ │ │ │ -
901 *levelContext.lhs = v;
│ │ │ │ -
902 *levelContext.rhs = d;
│ │ │ │ -
903 *levelContext.update=0;
│ │ │ │ -
904 levelContext.level=0;
│ │ │ │ -
905
│ │ │ │ -
906 mgc(levelContext);
│ │ │ │ -
907
│ │ │ │ -
908 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ │ -
909 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ │ -
910
│ │ │ │ -
911 v=*levelContext.update;
│ │ │ │ -
912 }
│ │ │ │ -
913
│ │ │ │ -
914 }
│ │ │ │ -
│ │ │ │ -
915
│ │ │ │ -
916 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
917 void AMG<M,X,S,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ │ -
918 {
│ │ │ │ -
919 levelContext.smoother = smoothers_->finest();
│ │ │ │ -
920 levelContext.matrix = matrices_->matrices().finest();
│ │ │ │ -
921 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ │ -
922 levelContext.redist =
│ │ │ │ -
923 matrices_->redistributeInformation().begin();
│ │ │ │ -
924 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ │ -
925 levelContext.lhs = lhs_->finest();
│ │ │ │ -
926 levelContext.update = update_->finest();
│ │ │ │ -
927 levelContext.rhs = rhs_->finest();
│ │ │ │ -
928 }
│ │ │ │ -
929
│ │ │ │ -
930 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
931 bool AMG<M,X,S,PI,A>
│ │ │ │ -
932 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ │ -
933 {
│ │ │ │ -
934
│ │ │ │ -
935 bool processNextLevel=true;
│ │ │ │ -
936
│ │ │ │ -
937 if(levelContext.redist->isSetup()) {
│ │ │ │ -
938 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.rhs),
│ │ │ │ -
939 levelContext.rhs.getRedistributed());
│ │ │ │ -
940 processNextLevel = levelContext.rhs.getRedistributed().size()>0;
│ │ │ │ -
941 if(processNextLevel) {
│ │ │ │ -
942 //restrict defect to coarse level right hand side.
│ │ │ │ -
943 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ │ -
944 ++levelContext.pinfo;
│ │ │ │ -
945 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
946 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ │ -
947 static_cast<const Range&>(fineRhs.getRedistributed()),
│ │ │ │ -
948 *levelContext.pinfo);
│ │ │ │ -
949 }
│ │ │ │ -
950 }else{
│ │ │ │ -
951 //restrict defect to coarse level right hand side.
│ │ │ │ -
952 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ │ -
953 ++levelContext.pinfo;
│ │ │ │ -
954 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
955 ::restrictVector(*(*levelContext.aggregates),
│ │ │ │ -
956 *levelContext.rhs, static_cast<const Range&>(*fineRhs),
│ │ │ │ -
957 *levelContext.pinfo);
│ │ │ │ -
958 }
│ │ │ │ -
959
│ │ │ │ -
960 if(processNextLevel) {
│ │ │ │ -
961 // prepare coarse system
│ │ │ │ -
962 ++levelContext.lhs;
│ │ │ │ -
963 ++levelContext.update;
│ │ │ │ -
964 ++levelContext.matrix;
│ │ │ │ -
965 ++levelContext.level;
│ │ │ │ -
966 ++levelContext.redist;
│ │ │ │ -
967
│ │ │ │ -
968 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ -
969 // next level is not the globally coarsest one
│ │ │ │ -
970 ++levelContext.smoother;
│ │ │ │ -
971 ++levelContext.aggregates;
│ │ │ │ -
972 }
│ │ │ │ -
973 // prepare the update on the next level
│ │ │ │ -
974 *levelContext.update=0;
│ │ │ │ -
975 }
│ │ │ │ -
976 return processNextLevel;
│ │ │ │ -
977 }
│ │ │ │ -
978
│ │ │ │ -
979 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
980 void AMG<M,X,S,PI,A>
│ │ │ │ -
981 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel)
│ │ │ │ -
982 {
│ │ │ │ -
983 if(processNextLevel) {
│ │ │ │ -
984 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ -
985 // previous level is not the globally coarsest one
│ │ │ │ -
986 --levelContext.smoother;
│ │ │ │ -
987 --levelContext.aggregates;
│ │ │ │ -
988 }
│ │ │ │ -
989 --levelContext.redist;
│ │ │ │ -
990 --levelContext.level;
│ │ │ │ -
991 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ │ -
992 --levelContext.matrix;
│ │ │ │ -
993
│ │ │ │ -
994 //typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--;
│ │ │ │ -
995 --levelContext.lhs;
│ │ │ │ -
996 --levelContext.pinfo;
│ │ │ │ -
997 }
│ │ │ │ -
998 if(levelContext.redist->isSetup()) {
│ │ │ │ -
999 // Need to redistribute during prolongateVector
│ │ │ │ -
1000 levelContext.lhs.getRedistributed()=0;
│ │ │ │ -
1001 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
1002 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ │ -
1003 levelContext.lhs.getRedistributed(),
│ │ │ │ -
1004 matrices_->getProlongationDampingFactor(),
│ │ │ │ -
1005 *levelContext.pinfo, *levelContext.redist);
│ │ │ │ -
1006 }else{
│ │ │ │ -
1007 *levelContext.lhs=0;
│ │ │ │ -
1008 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
1009 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ │ -
1010 matrices_->getProlongationDampingFactor(),
│ │ │ │ -
1011 *levelContext.pinfo);
│ │ │ │ -
1012 }
│ │ │ │ -
1013
│ │ │ │ -
1014
│ │ │ │ -
1015 if(processNextLevel) {
│ │ │ │ -
1016 --levelContext.update;
│ │ │ │ -
1017 --levelContext.rhs;
│ │ │ │ -
1018 }
│ │ │ │ -
1019
│ │ │ │ -
1020 *levelContext.update += *levelContext.lhs;
│ │ │ │ -
1021 }
│ │ │ │ -
1022
│ │ │ │ -
1023 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1025 {
│ │ │ │ - │ │ │ │ -
1027 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
1028
│ │ │ │ -
1029 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
1030 void AMG<M,X,S,PI,A>::mgc(LevelContext& levelContext){
│ │ │ │ -
1031 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ │ -
1032 // Solve directly
│ │ │ │ - │ │ │ │ -
1034 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ │ -
1035 if(levelContext.redist->isSetup()) {
│ │ │ │ -
1036 levelContext.redist->redistribute(*levelContext.rhs, levelContext.rhs.getRedistributed());
│ │ │ │ -
1037 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ │ -
1038 // We are still participating in the computation
│ │ │ │ -
1039 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ │ -
1040 levelContext.rhs.getRedistributed());
│ │ │ │ -
1041 solver_->apply(levelContext.update.getRedistributed(),
│ │ │ │ -
1042 levelContext.rhs.getRedistributed(), res);
│ │ │ │ -
1043 }
│ │ │ │ -
1044 levelContext.redist->redistributeBackward(*levelContext.update, levelContext.update.getRedistributed());
│ │ │ │ -
1045 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ │ -
1046 }else{
│ │ │ │ -
1047 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs);
│ │ │ │ -
1048 solver_->apply(*levelContext.update, *levelContext.rhs, res);
│ │ │ │ -
1049 }
│ │ │ │ -
1050
│ │ │ │ -
1051 if (!res.converged)
│ │ │ │ -
1052 coarsesolverconverged = false;
│ │ │ │ -
1053 }else{
│ │ │ │ -
1054 // presmoothing
│ │ │ │ -
1055 presmooth(levelContext, preSteps_);
│ │ │ │ -
1056
│ │ │ │ -
1057#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ │ -
1058 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ │ -
1059
│ │ │ │ -
1060 if(processNextLevel) {
│ │ │ │ -
1061 // next level
│ │ │ │ -
1062 for(std::size_t i=0; i<gamma_; i++){
│ │ │ │ -
1063 mgc(levelContext);
│ │ │ │ -
1064 if (levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels())
│ │ │ │ -
1065 break;
│ │ │ │ -
1066 if(i+1 < gamma_){
│ │ │ │ -
1067 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, *levelContext.rhs);
│ │ │ │ -
1068 }
│ │ │ │ -
1069 }
│ │ │ │ -
1070 }
│ │ │ │ -
1071
│ │ │ │ -
1072 moveToFineLevel(levelContext, processNextLevel);
│ │ │ │ -
1073#else
│ │ │ │ -
1074 *lhs=0;
│ │ │ │ -
1075#endif
│ │ │ │ -
1076
│ │ │ │ -
1077 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ │ -
1078 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ │ -
1079 if(!coarsesolverconverged)
│ │ │ │ -
1080 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ │ -
1081 }
│ │ │ │ -
1082 // postsmoothing
│ │ │ │ -
1083 postsmooth(levelContext, postSteps_);
│ │ │ │ -
1084
│ │ │ │ -
1085 }
│ │ │ │ -
1086 }
│ │ │ │ -
1087
│ │ │ │ -
1088 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
1089 void AMG<M,X,S,PI,A>::additiveMgc(){
│ │ │ │ -
1090
│ │ │ │ -
1091 // restrict residual to all levels
│ │ │ │ -
1092 typename ParallelInformationHierarchy::Iterator pinfo=matrices_->parallelInformation().finest();
│ │ │ │ -
1093 typename Hierarchy<Range,A>::Iterator rhs=rhs_->finest();
│ │ │ │ -
1094 typename Hierarchy<Domain,A>::Iterator lhs = lhs_->finest();
│ │ │ │ -
1095 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates=matrices_->aggregatesMaps().begin();
│ │ │ │ -
1096
│ │ │ │ -
1097 for(typename Hierarchy<Range,A>::Iterator fineRhs=rhs++; fineRhs != rhs_->coarsest(); fineRhs=rhs++, ++aggregates) {
│ │ │ │ -
1098 ++pinfo;
│ │ │ │ -
1099 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
1100 ::restrictVector(*(*aggregates), *rhs, static_cast<const Range&>(*fineRhs), *pinfo);
│ │ │ │ -
1101 }
│ │ │ │ -
1102
│ │ │ │ -
1103 // pinfo is invalid, set to coarsest level
│ │ │ │ -
1104 //pinfo = matrices_->parallelInformation().coarsest
│ │ │ │ -
1105 // calculate correction for all levels
│ │ │ │ -
1106 lhs = lhs_->finest();
│ │ │ │ -
1107 typename Hierarchy<Smoother,A>::Iterator smoother = smoothers_->finest();
│ │ │ │ -
1108
│ │ │ │ -
1109 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) {
│ │ │ │ -
1110 // presmoothing
│ │ │ │ -
1111 *lhs=0;
│ │ │ │ -
1112 smoother->apply(*lhs, *rhs);
│ │ │ │ -
1113 }
│ │ │ │ -
1114
│ │ │ │ -
1115 // Coarse level solve
│ │ │ │ -
1116#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ │ -
1117 InverseOperatorResult res;
│ │ │ │ -
1118 pinfo->copyOwnerToAll(*rhs, *rhs);
│ │ │ │ -
1119 solver_->apply(*lhs, *rhs, res);
│ │ │ │ -
1120
│ │ │ │ -
1121 if(!res.converged)
│ │ │ │ -
1122 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ │ -
1123#else
│ │ │ │ -
1124 *lhs=0;
│ │ │ │ -
1125#endif
│ │ │ │ -
1126 // Prologate and add up corrections from all levels
│ │ │ │ -
1127 --pinfo;
│ │ │ │ -
1128 --aggregates;
│ │ │ │ -
1129
│ │ │ │ -
1130 for(typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--; coarseLhs != lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) {
│ │ │ │ -
1131 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
1132 ::prolongateVector(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo);
│ │ │ │ -
1133 }
│ │ │ │ -
1134 }
│ │ │ │ -
1135
│ │ │ │ -
1136
│ │ │ │ -
1138 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
│ │ │ │ -
1139 void AMG<M,X,S,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ │ -
1140 {
│ │ │ │ -
1141 // Postprocess all smoothers
│ │ │ │ -
1142 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ │ -
1143 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ │ -
1144 Iterator coarsest = smoothers_->coarsest();
│ │ │ │ -
1145 Iterator smoother = smoothers_->finest();
│ │ │ │ -
1146 DIterator lhs = lhs_->finest();
│ │ │ │ -
1147 if(smoothers_->levels()>0) {
│ │ │ │ -
1148 if(smoother != coarsest || matrices_->levels()<matrices_->maxlevels())
│ │ │ │ -
1149 smoother->post(*lhs);
│ │ │ │ -
1150 if(smoother!=coarsest)
│ │ │ │ -
1151 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs)
│ │ │ │ -
1152 smoother->post(*lhs);
│ │ │ │ -
1153 smoother->post(*lhs);
│ │ │ │ -
1154 }
│ │ │ │ -
1155 lhs_ = nullptr;
│ │ │ │ -
1156 update_ = nullptr;
│ │ │ │ -
1157 rhs_ = nullptr;
│ │ │ │ -
1158 }
│ │ │ │ -
│ │ │ │ -
1159
│ │ │ │ -
1160 template<class M, class X, class S, class PI, class A>
│ │ │ │ -
1161 template<class A1>
│ │ │ │ -
│ │ │ │ -
1162 void AMG<M,X,S,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ │ -
1163 {
│ │ │ │ -
1164 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ │ -
1165 }
│ │ │ │ -
│ │ │ │ -
1166
│ │ │ │ -
1167 } // end namespace Amg
│ │ │ │ -
1168
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1170 template<class> struct isValidBlockType : std::false_type{};
│ │ │ │ -
1171 template<class T, int n, int m> struct isValidBlockType<FieldMatrix<T,n,m>> : std::true_type{};
│ │ │ │ -
1172
│ │ │ │ -
1173 template<class OP>
│ │ │ │ -
1174 std::shared_ptr<Dune::Preconditioner<typename OP::element_type::domain_type, typename OP::element_type::range_type> >
│ │ │ │ -
│ │ │ │ -
1175 makeAMG(const OP& op, const std::string& smoother, const Dune::ParameterTree& config) const
│ │ │ │ -
1176 {
│ │ │ │ -
1177 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG");
│ │ │ │ -
1178 }
│ │ │ │ -
│ │ │ │ -
1179
│ │ │ │ -
1180 template<class M, class X, class Y>
│ │ │ │ -
1181 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ │ -
│ │ │ │ -
1182 makeAMG(const std::shared_ptr<MatrixAdapter<M,X,Y>>& op, const std::string& smoother,
│ │ │ │ -
1183 const Dune::ParameterTree& config) const
│ │ │ │ -
1184 {
│ │ │ │ -
1185 using OP = MatrixAdapter<M,X,Y>;
│ │ │ │ -
1186
│ │ │ │ -
1187 if(smoother == "ssor")
│ │ │ │ -
1188 return std::make_shared<Amg::AMG<OP, X, SeqSSOR<M,X,Y>>>(op, config);
│ │ │ │ -
1189 if(smoother == "sor")
│ │ │ │ -
1190 return std::make_shared<Amg::AMG<OP, X, SeqSOR<M,X,Y>>>(op, config);
│ │ │ │ -
1191 if(smoother == "jac")
│ │ │ │ -
1192 return std::make_shared<Amg::AMG<OP, X, SeqJac<M,X,Y>>>(op, config);
│ │ │ │ -
1193 if(smoother == "gs")
│ │ │ │ -
1194 return std::make_shared<Amg::AMG<OP, X, SeqGS<M,X,Y>>>(op, config);
│ │ │ │ -
1195 if(smoother == "ilu")
│ │ │ │ -
1196 return std::make_shared<Amg::AMG<OP, X, SeqILU<M,X,Y>>>(op, config);
│ │ │ │ -
1197 else
│ │ │ │ -
1198 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ │ -
1199 }
│ │ │ │ -
│ │ │ │ -
1200
│ │ │ │ -
1201 template<class M, class X, class Y, class C>
│ │ │ │ -
1202 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ │ -
│ │ │ │ -
1203 makeAMG(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ │ -
1204 const Dune::ParameterTree& config) const
│ │ │ │ -
1205 {
│ │ │ │ - │ │ │ │ -
1207
│ │ │ │ -
1208 auto cop = std::static_pointer_cast<const OP>(op);
│ │ │ │ -
1209
│ │ │ │ -
1210 if(smoother == "ssor")
│ │ │ │ -
1211 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ -
1212 if(smoother == "sor")
│ │ │ │ -
1213 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ -
1214 if(smoother == "jac")
│ │ │ │ -
1215 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqJac<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ -
1216 if(smoother == "gs")
│ │ │ │ -
1217 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqGS<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ -
1218 if(smoother == "ilu")
│ │ │ │ -
1219 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqILU<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ -
1220 else
│ │ │ │ -
1221 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ │ -
1222 }
│ │ │ │ -
│ │ │ │ -
1223
│ │ │ │ -
1224 template<class M, class X, class Y, class C>
│ │ │ │ -
1225 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ │ -
│ │ │ │ -
1226 makeAMG(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ │ -
1227 const Dune::ParameterTree& config) const
│ │ │ │ -
1228 {
│ │ │ │ - │ │ │ │ -
1230
│ │ │ │ -
1231 if(smoother == "ssor")
│ │ │ │ -
1232 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ -
1233 if(smoother == "sor")
│ │ │ │ -
1234 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ -
1235 if(smoother == "jac")
│ │ │ │ -
1236 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqJac<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ -
1237 if(smoother == "gs")
│ │ │ │ -
1238 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqGS<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ -
1239 if(smoother == "ilu")
│ │ │ │ -
1240 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqILU<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ -
1241 else
│ │ │ │ -
1242 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ │ -
1243 }
│ │ │ │ -
│ │ │ │ -
1244
│ │ │ │ -
1245 template<typename TL, typename OP>
│ │ │ │ -
1246 std::shared_ptr<Dune::Preconditioner<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ -
1247 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ -
│ │ │ │ -
1248 operator() (TL tl, const std::shared_ptr<OP>& op, const Dune::ParameterTree& config,
│ │ │ │ - │ │ │ │ -
1250 {
│ │ │ │ -
1251 using field_type = typename OP::matrix_type::field_type;
│ │ │ │ -
1252 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
1253 if (!std::is_convertible<field_type, real_type>())
│ │ │ │ -
1254 DUNE_THROW(UnsupportedType, "AMG needs field_type(" <<
│ │ │ │ -
1255 className<field_type>() <<
│ │ │ │ -
1256 ") to be convertible to its real_type (" <<
│ │ │ │ -
1257 className<real_type>() <<
│ │ │ │ -
1258 ").");
│ │ │ │ -
1259 using D = typename Dune::TypeListElement<1, decltype(tl)>::type;
│ │ │ │ -
1260 using R = typename Dune::TypeListElement<2, decltype(tl)>::type;
│ │ │ │ -
1261 std::shared_ptr<Preconditioner<D,R>> amg;
│ │ │ │ -
1262 std::string smoother = config.get("smoother", "ssor");
│ │ │ │ -
1263 return makeAMG(op, smoother, config);
│ │ │ │ -
1264 }
│ │ │ │ -
│ │ │ │ -
1265
│ │ │ │ -
1266 template<typename TL, typename OP>
│ │ │ │ -
1267 std::shared_ptr<Dune::Preconditioner<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ -
1268 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ -
│ │ │ │ -
1269 operator() (TL /*tl*/, const std::shared_ptr<OP>& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ │ - │ │ │ │ -
1271 {
│ │ │ │ -
1272 DUNE_THROW(UnsupportedType, "AMG needs a FieldMatrix as Matrix block_type");
│ │ │ │ -
1273 }
│ │ │ │ -
│ │ │ │ -
1274 };
│ │ │ │ -
│ │ │ │ -
1275
│ │ │ │ - │ │ │ │ -
1277} // end namespace Dune
│ │ │ │ -
1278
│ │ │ │ -
1279#endif
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
Define base class for scalar product and norm.
│ │ │ │ -
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:16
│ │ │ │ -
Templates characterizing the type of a solver.
│ │ │ │ -
Classes for the generic construction and application of the smoothers.
│ │ │ │ -
Prolongation and restriction for amg.
│ │ │ │ -
Provides a classes representing the hierarchies in AMG.
│ │ │ │ -
Implementations of the inverse operator interface.
│ │ │ │ -
Classes for using UMFPack with ISTL matrices.
│ │ │ │ -
Classes for using SuperLU with ISTL matrices.
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
AMG(const AMG &amg)
Copy constructor.
Definition amg.hh:392
│ │ │ │ -
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition amg.hh:801
│ │ │ │ -
static DirectSolver * create(const Matrix &mat, bool verbose, bool reusevector)
Definition amg.hh:681
│ │ │ │ -
static std::string name()
Definition amg.hh:680
│ │ │ │ -
Hierarchy< Domain, A >::Iterator update
The iterator over the updates.
Definition amg.hh:303
│ │ │ │ -
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition amg.hh:307
│ │ │ │ -
static std::string name()
Definition amg.hh:672
│ │ │ │ -
bool usesDirectCoarseLevelSolver() const
Check whether the coarse solver used is a direct solver.
Definition amg.hh:1024
│ │ │ │ -
X Domain
The domain type.
Definition amg.hh:87
│ │ │ │ -
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:644
│ │ │ │ -
AMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms)
Construct a new amg with a specific coarse solver.
Definition amg.hh:406
│ │ │ │ -
AMG(std::shared_ptr< const Operator > fineOperator, const ParameterTree &configuration, const ParallelInformation &pinfo=ParallelInformation())
Constructor an AMG via ParameterTree.
Definition amg.hh:452
│ │ │ │ -
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition amg.hh:287
│ │ │ │ -
SolverType
Definition amg.hh:627
│ │ │ │ -
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition amg.hh:295
│ │ │ │ -
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ │ -
Solver< Matrix, solver > SelectedSolver
Definition amg.hh:677
│ │ │ │ -
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< MatrixAdapter< M, X, Y > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1182
│ │ │ │ -
std::string operator()(const std::string &str)
Definition amg.hh:378
│ │ │ │ -
std::shared_ptr< Dune::Preconditioner< typename OP::element_type::domain_type, typename OP::element_type::range_type > > makeAMG(const OP &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1175
│ │ │ │ -
S Smoother
The type of the smoother.
Definition amg.hh:97
│ │ │ │ -
static std::string name()
Definition amg.hh:649
│ │ │ │ -
Hierarchy< Smoother, A >::Iterator smoother
The iterator over the smoothers.
Definition amg.hh:279
│ │ │ │ -
M Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ │ -
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition amg.hh:283
│ │ │ │ - │ │ │ │ -
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:668
│ │ │ │ -
OperatorHierarchy::RedistributeInfoList::const_iterator redist
The iterator over the redistribution information.
Definition amg.hh:291
│ │ │ │ -
X Range
The range type.
Definition amg.hh:89
│ │ │ │ -
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ │ -
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition amg.hh:1162
│ │ │ │ -
std::size_t levels()
Definition amg.hh:876
│ │ │ │ -
InverseOperator< Vector, Vector > type
Definition amg.hh:643
│ │ │ │ -
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1203
│ │ │ │ -
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition amg.hh:299
│ │ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ -
static constexpr SolverType solver
Definition amg.hh:629
│ │ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ -
static constexpr bool isDirectSolver
Definition amg.hh:679
│ │ │ │ -
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition amg.hh:221
│ │ │ │ -
Matrix::field_type field_type
Definition amg.hh:626
│ │ │ │ -
SelectedSolver::type DirectSolver
Definition amg.hh:678
│ │ │ │ -
std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL tl, const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std::enable_if_t< isValidBlockType< typename OP::matrix_type::block_type >::value, int >=0) const
Definition amg.hh:1248
│ │ │ │ -
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
The parallal data distribution hierarchy type.
Definition amg.hh:84
│ │ │ │ -
InverseOperator< X, X > CoarseSolver
the type of the coarse solver.
Definition amg.hh:91
│ │ │ │ -
void post(Domain &x)
Clean up.
Definition amg.hh:1139
│ │ │ │ -
std::size_t maxlevels()
Definition amg.hh:881
│ │ │ │ -
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1226
│ │ │ │ -
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ │ -
std::size_t level
The level index.
Definition amg.hh:311
│ │ │ │ -
AMG(const Operator &fineOperator, const C &criterion, const SmootherArgs &smootherArgs=SmootherArgs(), const ParallelInformation &pinfo=ParallelInformation())
Construct an AMG with an inexact coarse solver based on the smoother.
Definition amg.hh:428
│ │ │ │ -
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition amg.hh:888
│ │ │ │ -
Smoother SmootherType
Definition amg.hh:275
│ │ │ │ -
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
The operator hierarchy type.
Definition amg.hh:82
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition amg.hh:194
│ │ │ │ -
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:80
│ │ │ │ -
@ none
Definition amg.hh:627
│ │ │ │ -
@ umfpack
Definition amg.hh:627
│ │ │ │ -
@ superlu
Definition amg.hh:627
│ │ │ │ -
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:244
│ │ │ │ -
@ noAccu
No data accumulution.
Definition parameters.hh:238
│ │ │ │ -
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:248
│ │ │ │ +
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
│ │ │ │ +
250 /* @} */
│ │ │ │ +
251#endif
│ │ │ │ + │ │ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │ │ +
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:164
│ │ │ │ +
const GlobalIndex & operator[](std::size_t index) const
Definition globalaggregates.hh:46
│ │ │ │ + │ │ │ │ +
static int getSize(const Type &, int)
Definition globalaggregates.hh:242
│ │ │ │ +
Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
Definition globalaggregates.hh:240
│ │ │ │ +
GlobalIndex & get(std::size_t index)
Definition globalaggregates.hh:60
│ │ │ │ + │ │ │ │ +
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:226
│ │ │ │ +
SequentialInformation ParallelInformation
Definition globalaggregates.hh:223
│ │ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:33
│ │ │ │ +
ParallelInformation::ParallelIndexSet IndexSet
Definition globalaggregates.hh:165
│ │ │ │ +
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
│ │ │ │ +
Amg::AggregatesMap< T > Type
Definition globalaggregates.hh:239
│ │ │ │ +
static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
Definition globalaggregates.hh:123
│ │ │ │ +
OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation
Definition globalaggregates.hh:163
│ │ │ │ +
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ │ +
SizeOne IndexedTypeFlag
Definition globalaggregates.hh:241
│ │ │ │ +
Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
Definition globalaggregates.hh:72
│ │ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │ +
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:167
│ │ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:116
│ │ │ │ +
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ │ +
ParallelIndexSet::LocalIndex LocalIndex
Definition globalaggregates.hh:37
│ │ │ │ +
TI ParallelIndexSet
Definition globalaggregates.hh:115
│ │ │ │ + │ │ │ │ +
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:224
│ │ │ │ +
static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, size_t i)
Definition globalaggregates.hh:118
│ │ │ │ +
Proxy & operator=(const GlobalIndex &global)
Definition globalaggregates.hh:76
│ │ │ │ +
ParallelIndexSet::GlobalIndex IndexedType
Definition globalaggregates.hh:35
│ │ │ │ +
Proxy operator[](std::size_t index)
Definition globalaggregates.hh:91
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ │ -
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ │ -
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ -
Definition matrixutils.hh:27
│ │ │ │ -
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │ -
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ -
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:379
│ │ │ │ -
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:463
│ │ │ │ -
Definition aggregates.hh:480
│ │ │ │ -
Definition aggregates.hh:496
│ │ │ │ -
Criterion taking advantage of symmetric matrices.
Definition aggregates.hh:519
│ │ │ │ -
Criterion suitable for unsymmetric matrices.
Definition aggregates.hh:539
│ │ │ │ -
an algebraic multigrid method using a Krylov-cycle.
Definition kamg.hh:140
│ │ │ │ -
Two grid operator for AMG with Krylov cycle.
Definition kamg.hh:33
│ │ │ │ -
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ │ -
Definition amg.hh:625
│ │ │ │ - │ │ │ │ -
Definition amg.hh:1169
│ │ │ │ - │ │ │ │ -
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ │ - │ │ │ │ -
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ -
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ │ -
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │ -
The criterion describing the stop criteria for the coarsening process.
Definition matrixhierarchy.hh:283
│ │ │ │ -
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ +
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ │ +
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ │ +
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ │ +
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ +
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ +
Definition globalaggregates.hh:29
│ │ │ │ +
Definition globalaggregates.hh:70
│ │ │ │ +
Definition globalaggregates.hh:114
│ │ │ │ +
Definition globalaggregates.hh:131
│ │ │ │
Definition pinfo.hh:28
│ │ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioner.hh:39
│ │ │ │ -
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
│ │ │ │ -
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ -
Categories for the solvers.
Definition solvercategory.hh:22
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ +
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
│ │ │ │ -
Definition solvercategory.hh:54
│ │ │ │ -
Definition solverregistry.hh:77
│ │ │ │ -
Definition solvertype.hh:16
│ │ │ │ -
SuperLu Solver.
Definition superlu.hh:271
│ │ │ │ -
Definition umfpack.hh:49
│ │ │ │ -
The UMFPack direct sparse solver.
Definition umfpack.hh:215
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1596 +1,424 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -amg.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 (C) 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_AMG_HH │ │ │ │ │ -6#define DUNE_AMG_AMG_HH │ │ │ │ │ +5#ifndef DUNE_GLOBALAGGREGATES_HH │ │ │ │ │ +6#define DUNE_GLOBALAGGREGATES_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ │ -12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ -15#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ │ -16#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ │ -17#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ -19#include │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22#include │ │ │ │ │ -23#include │ │ │ │ │ -24 │ │ │ │ │ -25namespace _D_u_n_e │ │ │ │ │ -26{ │ │ │ │ │ -27 namespace Amg │ │ │ │ │ -28 { │ │ │ │ │ -46 template │ │ │ │ │ -47 class KAMG; │ │ │ │ │ -48 │ │ │ │ │ -49 template │ │ │ │ │ -50 class KAmgTwoGrid; │ │ │ │ │ -51 │ │ │ │ │ -62 template > │ │ │ │ │ -_6_4 class _A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -65 { │ │ │ │ │ -66 template │ │ │ │ │ -_6_7 friend class _K_A_M_G; │ │ │ │ │ +18#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ │ +19#include "_p_i_n_f_o_._h_h" │ │ │ │ │ +20#include │ │ │ │ │ +21 │ │ │ │ │ +22namespace _D_u_n_e │ │ │ │ │ +23{ │ │ │ │ │ +24 namespace Amg │ │ │ │ │ +25 { │ │ │ │ │ +26 │ │ │ │ │ +27 template │ │ │ │ │ +_2_8 struct _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +29 { │ │ │ │ │ +30 public: │ │ │ │ │ +_3_1 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +32 │ │ │ │ │ +_3_3 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +34 │ │ │ │ │ +_3_5 typedef typename ParallelIndexSet::GlobalIndex _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +36 │ │ │ │ │ +_3_7 typedef typename ParallelIndexSet::LocalIndex _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ +38 │ │ │ │ │ +_3_9 typedef T _V_e_r_t_e_x; │ │ │ │ │ +40 │ │ │ │ │ +_4_1 _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +42 const GlobalLookupIndexSet& indexset) │ │ │ │ │ +43 : aggregates_(aggregates), indexset_(indexset) │ │ │ │ │ +44 {} │ │ │ │ │ +45 │ │ │ │ │ +_4_6 inline const _G_l_o_b_a_l_I_n_d_e_x& _o_p_e_r_a_t_o_r_[_](std::size_t index) const │ │ │ │ │ +47 { │ │ │ │ │ +48 const _V_e_r_t_e_x& aggregate = aggregates_[index]; │ │ │ │ │ +49 if(aggregate >= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ │ +50 assert(aggregate != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ │ +51 return isolatedMarker; │ │ │ │ │ +52 }else{ │ │ │ │ │ +53 const Dune::IndexPair* pair = indexset_.pair │ │ │ │ │ +(aggregate); │ │ │ │ │ +54 assert(pair!=0); │ │ │ │ │ +55 return pair->global(); │ │ │ │ │ +56 } │ │ │ │ │ +57 } │ │ │ │ │ +58 │ │ │ │ │ +59 │ │ │ │ │ +_6_0 inline _G_l_o_b_a_l_I_n_d_e_x& _g_e_t(std::size_t index) │ │ │ │ │ +61 { │ │ │ │ │ +62 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 │ │ │ │ │ -69 friend class _K_A_m_g_T_w_o_G_r_i_d<_A_M_G>; │ │ │ │ │ -70 │ │ │ │ │ +_6_9 class _P_r_o_x_y │ │ │ │ │ +70 { │ │ │ │ │ 71 public: │ │ │ │ │ -_7_3 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ │ -_8_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ -_8_2 typedef _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_> _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ │ -_8_4 typedef typename _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ │ -85 │ │ │ │ │ -_8_7 typedef X _D_o_m_a_i_n; │ │ │ │ │ -_8_9 typedef X _R_a_n_g_e; │ │ │ │ │ -_9_1 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_X_> _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ │ -_9_7 typedef S _S_m_o_o_t_h_e_r; │ │ │ │ │ -98 │ │ │ │ │ -_1_0_0 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ │ +_7_2 _P_r_o_x_y(const GlobalLookupIndexSet& indexset, _V_e_r_t_e_x& │ │ │ │ │ +aggregate) │ │ │ │ │ +73 : indexset_(&indexset), aggregate_(&aggregate) │ │ │ │ │ +74 {} │ │ │ │ │ +75 │ │ │ │ │ +_7_6 _P_r_o_x_y& _o_p_e_r_a_t_o_r_=(const _G_l_o_b_a_l_I_n_d_e_x& global) │ │ │ │ │ +77 { │ │ │ │ │ +78 if(global==isolatedMarker) │ │ │ │ │ +79 *aggregate_ = _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D; │ │ │ │ │ +80 else{ │ │ │ │ │ +81 //assert(global < AggregatesMap::ISOLATED); │ │ │ │ │ +82 *aggregate_ = indexset_->operator[](global).local(); │ │ │ │ │ +83 } │ │ │ │ │ +84 return *this; │ │ │ │ │ +85 } │ │ │ │ │ +86 private: │ │ │ │ │ +87 const GlobalLookupIndexSet* indexset_; │ │ │ │ │ +88 _V_e_r_t_e_x* aggregate_; │ │ │ │ │ +89 }; │ │ │ │ │ +90 │ │ │ │ │ +_9_1 inline _P_r_o_x_y _o_p_e_r_a_t_o_r_[_](std::size_t index) │ │ │ │ │ +92 { │ │ │ │ │ +93 return _P_r_o_x_y(indexset_, aggregates_[index]); │ │ │ │ │ +94 } │ │ │ │ │ +95 │ │ │ │ │ +_9_6 inline void _p_u_t(const _G_l_o_b_a_l_I_n_d_e_x& global, size_t i) │ │ │ │ │ +97 { │ │ │ │ │ +98 aggregates_[i]=indexset_[global].local(); │ │ │ │ │ +99 │ │ │ │ │ +100 } │ │ │ │ │ 101 │ │ │ │ │ -_1_1_1 _A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ │ -112 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& parms); │ │ │ │ │ -113 │ │ │ │ │ -125 template │ │ │ │ │ -_1_2_6 _A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ -127 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs=_S_m_o_o_t_h_e_r_A_r_g_s(), │ │ │ │ │ -128 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ -129 │ │ │ │ │ -_1_8_0 _A_M_G(std::shared_ptr fineOperator, const ParameterTree& │ │ │ │ │ -configuration, const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ -181 │ │ │ │ │ -_1_8_5 _A_M_G(const _A_M_G& amg); │ │ │ │ │ -186 │ │ │ │ │ -_1_8_8 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ │ -189 │ │ │ │ │ -_1_9_1 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ │ -192 │ │ │ │ │ -_1_9_4 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -195 { │ │ │ │ │ -196 return category_; │ │ │ │ │ -197 } │ │ │ │ │ -198 │ │ │ │ │ -_2_0_0 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ │ -201 │ │ │ │ │ -206 template │ │ │ │ │ -_2_0_7 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont); │ │ │ │ │ +102 private: │ │ │ │ │ +103 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ │ +104 const GlobalLookupIndexSet& indexset_; │ │ │ │ │ +105 static const _G_l_o_b_a_l_I_n_d_e_x isolatedMarker; │ │ │ │ │ +106 }; │ │ │ │ │ +107 │ │ │ │ │ +108 template │ │ │ │ │ +109 const typename TI::GlobalIndex GlobalAggregatesMap::isolatedMarker = │ │ │ │ │ +110 std::numeric_limits::max(); │ │ │ │ │ +111 │ │ │ │ │ +112 template │ │ │ │ │ +_1_1_3 struct _A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ │ +114 { │ │ │ │ │ +_1_1_5 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ +_1_1_6 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +117 │ │ │ │ │ +_1_1_8 static const _G_l_o_b_a_l_I_n_d_e_x& _g_a_t_h_e_r(const _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, │ │ │ │ │ +size_t i) │ │ │ │ │ +119 { │ │ │ │ │ +120 return ga[i]; │ │ │ │ │ +121 } │ │ │ │ │ +122 │ │ │ │ │ +_1_2_3 static void _s_c_a_t_t_e_r(_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, _G_l_o_b_a_l_I_n_d_e_x global, │ │ │ │ │ +size_t i) │ │ │ │ │ +124 { │ │ │ │ │ +125 ga[i]=global; │ │ │ │ │ +126 } │ │ │ │ │ +127 }; │ │ │ │ │ +128 │ │ │ │ │ +129 template │ │ │ │ │ +_1_3_0 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ │ +131 {}; │ │ │ │ │ +132 │ │ │ │ │ +133#if HAVE_MPI │ │ │ │ │ +134 │ │ │ │ │ +135#endif │ │ │ │ │ +136 │ │ │ │ │ +137 } // namespace Amg │ │ │ │ │ +138 │ │ │ │ │ +139#if HAVE_MPI │ │ │ │ │ +140 // forward declaration │ │ │ │ │ +141 template │ │ │ │ │ +142 class _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n; │ │ │ │ │ +143#endif │ │ │ │ │ +144 │ │ │ │ │ +145 namespace Amg │ │ │ │ │ +146 { │ │ │ │ │ +147 │ │ │ │ │ +148#if HAVE_MPI │ │ │ │ │ +158 template │ │ │ │ │ +_1_5_9 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r > │ │ │ │ │ +160 { │ │ │ │ │ +_1_6_1 typedef T _V_e_r_t_e_x; │ │ │ │ │ +_1_6_2 typedef O _O_v_e_r_l_a_p_F_l_a_g_s; │ │ │ │ │ +_1_6_3 typedef _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ +_1_6_4 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ +_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ │ +_1_6_5 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t _I_n_d_e_x_S_e_t; │ │ │ │ │ +166 │ │ │ │ │ +_1_6_7 static void _p_u_b_l_i_s_h(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +168 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ │ +169 const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& globalLookup) │ │ │ │ │ +170 { │ │ │ │ │ +171 typedef _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_,_I_n_d_e_x_S_e_t_> GlobalMap; │ │ │ │ │ +172 GlobalMap gmap(aggregates, globalLookup); │ │ │ │ │ +173 pinfo._c_o_p_y_O_w_n_e_r_T_o_A_l_l(gmap,gmap); │ │ │ │ │ +174 // communication only needed for ALU │ │ │ │ │ +175 // (ghosts with same global id as owners on the same process) │ │ │ │ │ +176 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo) == static_cast(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ │ +_n_o_n_o_v_e_r_l_a_p_p_i_n_g)) │ │ │ │ │ +177 pinfo._c_o_p_y_C_o_p_y_T_o_A_l_l(gmap,gmap); │ │ │ │ │ +178 │ │ │ │ │ +179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists; │ │ │ │ │ +180 Lists lists = pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().find(pinfo._c_o_m_m_u_n_i_c_a_t_o_r().rank()); │ │ │ │ │ +181 if(lists!=pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().end()) { │ │ │ │ │ +182 │ │ │ │ │ +183 // For periodic boundary conditions we must renumber │ │ │ │ │ +184 // the aggregates of vertices in the overlap whose owners are │ │ │ │ │ +185 // on the same process │ │ │ │ │ +186 _V_e_r_t_e_x maxAggregate =0; │ │ │ │ │ +187 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iter; │ │ │ │ │ +188 for(Iter i=aggregates._b_e_g_i_n(), end=aggregates._e_n_d(); i!=end; ++i) │ │ │ │ │ +189 maxAggregate = std::max(maxAggregate, *i); │ │ │ │ │ +190 │ │ │ │ │ +191 // Compute new mapping of aggregates in the overlap that we also own │ │ │ │ │ +192 std::map newMapping; │ │ │ │ │ +193 │ │ │ │ │ +194 // insert all elements into map │ │ │ │ │ +195 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList │ │ │ │ │ +196 ::const_iterator RIter; │ │ │ │ │ +197 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end │ │ │ │ │ +(); │ │ │ │ │ +198 ri!=rend; ++ri) │ │ │ │ │ +199 if(O::contains(ri->localIndexPair().local().attribute())) │ │ │ │ │ +200 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()], │ │ │ │ │ +201 maxAggregate)); │ │ │ │ │ +202 // renumber │ │ │ │ │ +203 typedef typename std::map::iterator MIter; │ │ │ │ │ +204 for(MIter mi=newMapping.begin(), mend=newMapping.end(); │ │ │ │ │ +205 mi != mend; ++mi) │ │ │ │ │ +206 mi->second=++maxAggregate; │ │ │ │ │ +207 │ │ │ │ │ 208 │ │ │ │ │ -_2_0_9 std::size_t _l_e_v_e_l_s(); │ │ │ │ │ -210 │ │ │ │ │ -_2_1_1 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ │ -212 │ │ │ │ │ -_2_2_1 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ │ -222 { │ │ │ │ │ -223 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ │ -224 } │ │ │ │ │ +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_3_0 bool _u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const; │ │ │ │ │ +_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 private: │ │ │ │ │ -233 /* │ │ │ │ │ -234 * @brief Helper function to create hierarchies with parameter tree. │ │ │ │ │ -235 * │ │ │ │ │ -236 * Will create the coarsen criterion with the norm and create the │ │ │ │ │ -237 * Hierarchies │ │ │ │ │ -238 * \tparam Norm Type of the norm to use. │ │ │ │ │ -239 */ │ │ │ │ │ -240 template │ │ │ │ │ -241 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ │ -matrixptr, │ │ │ │ │ -242 const PI& pinfo, const Norm&, │ │ │ │ │ -243 const ParameterTree& configuration, │ │ │ │ │ -244 std::true_type compiles = std::true_type()); │ │ │ │ │ -245 template │ │ │ │ │ -246 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ │ -matrixptr, │ │ │ │ │ -247 const PI& pinfo, const Norm&, │ │ │ │ │ -248 const ParameterTree& configuration, │ │ │ │ │ -249 std::false_type); │ │ │ │ │ -254 template │ │ │ │ │ -255 void createHierarchies(C& criterion, std::shared_ptr │ │ │ │ │ -matrixptr, │ │ │ │ │ -256 const PI& pinfo, const ParameterTree& configuration); │ │ │ │ │ -263 template │ │ │ │ │ -264 void createHierarchies(C& criterion, │ │ │ │ │ -265 const std::shared_ptr& matrixptr, │ │ │ │ │ -266 const PI& pinfo); │ │ │ │ │ -273 struct LevelContext │ │ │ │ │ -274 { │ │ │ │ │ -_2_7_5 typedef _S_m_o_o_t_h_e_r _S_m_o_o_t_h_e_r_T_y_p_e; │ │ │ │ │ -_2_7_9 typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r _s_m_o_o_t_h_e_r; │ │ │ │ │ -_2_8_3 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ │ -_2_8_7 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r _p_i_n_f_o; │ │ │ │ │ -_2_9_1 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ │ -_2_9_5 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ │ -_2_9_9 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _l_h_s; │ │ │ │ │ -_3_0_3 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _u_p_d_a_t_e; │ │ │ │ │ -_3_0_7 typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r _r_h_s; │ │ │ │ │ -_3_1_1 std::size_t _l_e_v_e_l; │ │ │ │ │ -312 }; │ │ │ │ │ -313 │ │ │ │ │ -314 │ │ │ │ │ -319 void mgc(LevelContext& levelContext); │ │ │ │ │ -320 │ │ │ │ │ -321 void additiveMgc(); │ │ │ │ │ -322 │ │ │ │ │ -329 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel); │ │ │ │ │ -330 │ │ │ │ │ -335 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ │ -336 │ │ │ │ │ -341 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ │ -342 │ │ │ │ │ -344 std::shared_ptr matrices_; │ │ │ │ │ -346 _S_m_o_o_t_h_e_r_A_r_g_s smootherArgs_; │ │ │ │ │ -348 std::shared_ptr > smoothers_; │ │ │ │ │ -350 std::shared_ptr solver_; │ │ │ │ │ -352 std::shared_ptr> rhs_; │ │ │ │ │ -354 std::shared_ptr> lhs_; │ │ │ │ │ -356 std::shared_ptr> update_; │ │ │ │ │ -358 using _S_c_a_l_a_r_P_r_o_d_u_c_t = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ │ -360 std::shared_ptr scalarProduct_; │ │ │ │ │ -362 std::size_t gamma_; │ │ │ │ │ -364 std::size_t preSteps_; │ │ │ │ │ -366 std::size_t postSteps_; │ │ │ │ │ -367 bool buildHierarchy_; │ │ │ │ │ -368 bool additive; │ │ │ │ │ -369 bool coarsesolverconverged; │ │ │ │ │ -370 std::shared_ptr coarseSmoother_; │ │ │ │ │ -372 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category_; │ │ │ │ │ -374 std::size_t verbosity_; │ │ │ │ │ -375 │ │ │ │ │ -376 struct ToLower │ │ │ │ │ -377 { │ │ │ │ │ -_3_7_8 std::string _o_p_e_r_a_t_o_r_(_)(const std::string& str) │ │ │ │ │ -379 { │ │ │ │ │ -380 std::stringstream retval; │ │ │ │ │ -381 std::ostream_iterator out(retval); │ │ │ │ │ -382 std::transform(str.begin(), str.end(), out, │ │ │ │ │ -383 [](char c){ │ │ │ │ │ -384 return std::tolower(c, std::locale::classic()); │ │ │ │ │ -385 }); │ │ │ │ │ -386 return retval.str(); │ │ │ │ │ -387 } │ │ │ │ │ -388 }; │ │ │ │ │ -389 }; │ │ │ │ │ -390 │ │ │ │ │ -391 template │ │ │ │ │ -_3_9_2 inline _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _A_M_G& amg) │ │ │ │ │ -393 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_), │ │ │ │ │ -394 smoothers_(amg.smoothers_), solver_(amg.solver_), │ │ │ │ │ -395 rhs_(), lhs_(), update_(), │ │ │ │ │ -396 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_), │ │ │ │ │ -397 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ │ -398 buildHierarchy_(amg.buildHierarchy_), │ │ │ │ │ -399 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ │ -400 coarseSmoother_(amg.coarseSmoother_), │ │ │ │ │ -401 category_(amg.category_), │ │ │ │ │ -402 verbosity_(amg.verbosity_) │ │ │ │ │ -403 {} │ │ │ │ │ -404 │ │ │ │ │ -405 template │ │ │ │ │ -_4_0_6 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& │ │ │ │ │ -coarseSolver, │ │ │ │ │ -407 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ │ -408 const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ -409 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_ │ │ │ │ │ -(smootherArgs), │ │ │ │ │ -410 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(&coarseSolver), │ │ │ │ │ -411 rhs_(), lhs_(), update_(), scalarProduct_(0), │ │ │ │ │ -412 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ │ -413 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ │ -414 additive(parms.getAdditive()), coarsesolverconverged(true), │ │ │ │ │ -415 coarseSmoother_(), │ │ │ │ │ -416// #warning should category be retrieved from matrices? │ │ │ │ │ -417 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(*smoothers_->coarsest())), │ │ │ │ │ -418 verbosity_(parms.debugLevel()) │ │ │ │ │ -419 { │ │ │ │ │ -420 assert(matrices_->isBuilt()); │ │ │ │ │ -421 │ │ │ │ │ -422 // build the necessary smoother hierarchies │ │ │ │ │ -423 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ │ -424 } │ │ │ │ │ -425 │ │ │ │ │ -426 template │ │ │ │ │ -427 template │ │ │ │ │ -_4_2_8 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _O_p_e_r_a_t_o_r& matrix, │ │ │ │ │ -429 const C& criterion, │ │ │ │ │ -430 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ │ -431 const PI& pinfo) │ │ │ │ │ -432 : smootherArgs_(smootherArgs), │ │ │ │ │ -433 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(), │ │ │ │ │ -434 rhs_(), lhs_(), update_(), scalarProduct_(), │ │ │ │ │ -435 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()), │ │ │ │ │ -436 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true), │ │ │ │ │ -437 additive(criterion.getAdditive()), coarsesolverconverged(true), │ │ │ │ │ -438 coarseSmoother_(), │ │ │ │ │ -439 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(pinfo)), │ │ │ │ │ -440 verbosity_(criterion.debugLevel()) │ │ │ │ │ -441 { │ │ │ │ │ -442 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(matrix) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo)) │ │ │ │ │ -443 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "Matrix and Communication must have the │ │ │ │ │ -same SolverCategory!"); │ │ │ │ │ -444 // TODO: reestablish compile time checks. │ │ │ │ │ -445 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ │ -category), │ │ │ │ │ -446 // "Matrix and Solver must match in terms of category!"); │ │ │ │ │ -447 auto matrixptr = stackobject_to_shared_ptr(matrix); │ │ │ │ │ -448 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ │ -449 } │ │ │ │ │ -450 │ │ │ │ │ -451 template │ │ │ │ │ -_4_5_2 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(std::shared_ptr matrixptr, │ │ │ │ │ -453 const ParameterTree& configuration, │ │ │ │ │ -454 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo) : │ │ │ │ │ -455 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), │ │ │ │ │ -456 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_ │ │ │ │ │ -(true), │ │ │ │ │ -457 coarsesolverconverged(true), coarseSmoother_(), │ │ │ │ │ -458 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(pinfo)) │ │ │ │ │ -459 { │ │ │ │ │ -460 │ │ │ │ │ -461 if (configuration.hasKey ("smootherIterations")) │ │ │ │ │ -462 smootherArgs_.iterations = configuration.get("smootherIterations"); │ │ │ │ │ -463 │ │ │ │ │ -464 if (configuration.hasKey ("smootherRelaxation")) │ │ │ │ │ -465 smootherArgs_.relaxationFactor = configuration.get("smootherRelaxation"); │ │ │ │ │ -466 │ │ │ │ │ -467 auto normName = ToLower()(configuration.get("strengthMeasure", │ │ │ │ │ -"diagonal")); │ │ │ │ │ -468 auto index = configuration.get("diagonalRowIndex", 0); │ │ │ │ │ -469 │ │ │ │ │ -470 if ( normName == "diagonal") │ │ │ │ │ -471 { │ │ │ │ │ -472 using _f_i_e_l_d___t_y_p_e = typename M::field_type; │ │ │ │ │ -473 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -474 std::is_convertible compiles; │ │ │ │ │ -475 │ │ │ │ │ -476 switch (index) │ │ │ │ │ -477 { │ │ │ │ │ -478 case 0: │ │ │ │ │ -479 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_0_>(), │ │ │ │ │ -configuration, compiles); │ │ │ │ │ -480 break; │ │ │ │ │ -481 case 1: │ │ │ │ │ -482 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_1_>(), │ │ │ │ │ -configuration, compiles); │ │ │ │ │ -483 break; │ │ │ │ │ -484 case 2: │ │ │ │ │ -485 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_2_>(), │ │ │ │ │ -configuration, compiles); │ │ │ │ │ -486 break; │ │ │ │ │ -487 case 3: │ │ │ │ │ -488 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_3_>(), │ │ │ │ │ -configuration, compiles); │ │ │ │ │ -489 break; │ │ │ │ │ -490 case 4: │ │ │ │ │ -491 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_4_>(), │ │ │ │ │ -configuration, compiles); │ │ │ │ │ -492 break; │ │ │ │ │ -493 default: │ │ │ │ │ -494 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not │ │ │ │ │ -supported."); │ │ │ │ │ -495 } │ │ │ │ │ -496 } │ │ │ │ │ -497 else if (normName == "rowsum") │ │ │ │ │ -498 createCriterionAndHierarchies(matrixptr, pinfo, _R_o_w_S_u_m(), configuration); │ │ │ │ │ -499 else if (normName == "frobenius") │ │ │ │ │ -500 createCriterionAndHierarchies(matrixptr, pinfo, _F_r_o_b_e_n_i_u_s_N_o_r_m(), │ │ │ │ │ -configuration); │ │ │ │ │ -501 else if (normName == "one") │ │ │ │ │ -502 createCriterionAndHierarchies(matrixptr, pinfo, _A_l_w_a_y_s_O_n_e_N_o_r_m(), │ │ │ │ │ -configuration); │ │ │ │ │ -503 else │ │ │ │ │ -504 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure │ │ │ │ │ -"< │ │ │ │ │ -508 template │ │ │ │ │ -509 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_c_r_e_a_t_e_C_r_i_t_e_r_i_o_n_A_n_d_H_i_e_r_a_r_c_h_i_e_s(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ │ -configuration, std::false_type) │ │ │ │ │ -510 { │ │ │ │ │ -511 DUNE_THROW(InvalidStateException, "Strength of connection measure does not │ │ │ │ │ -support this type (" │ │ │ │ │ -512 << className() << ") as it is lacking a conversion │ │ │ │ │ -to" │ │ │ │ │ -513 << className::real_type>() << │ │ │ │ │ -"."); │ │ │ │ │ -514 } │ │ │ │ │ -515 │ │ │ │ │ -516 template │ │ │ │ │ -517 template │ │ │ │ │ -518 void AMG::createCriterionAndHierarchies(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ │ -configuration, std::true_type) │ │ │ │ │ -519 { │ │ │ │ │ -520 if (configuration.get("criterionSymmetric", true)) │ │ │ │ │ -521 { │ │ │ │ │ -522 using Criterion = _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n< │ │ │ │ │ -523 _D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_N_o_r_m_> >; │ │ │ │ │ -524 Criterion criterion; │ │ │ │ │ -525 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ │ -526 } │ │ │ │ │ -527 else │ │ │ │ │ -528 { │ │ │ │ │ -529 using Criterion = _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n< │ │ │ │ │ -530 _D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_N_o_r_m_> >; │ │ │ │ │ -531 Criterion criterion; │ │ │ │ │ -532 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ │ -533 } │ │ │ │ │ -534 } │ │ │ │ │ -535 │ │ │ │ │ -536 template │ │ │ │ │ -537 template │ │ │ │ │ -538 void AMG::createHierarchies(C& criterion, std::shared_ptr matrixptr, const PI& pinfo, const ParameterTree& configuration) │ │ │ │ │ -539 { │ │ │ │ │ -540 if (configuration.hasKey ("maxLevel")) │ │ │ │ │ -541 criterion.setMaxLevel(configuration.get("maxLevel")); │ │ │ │ │ -542 │ │ │ │ │ -543 if (configuration.hasKey ("minCoarseningRate")) │ │ │ │ │ -544 criterion.setMinCoarsenRate(configuration.get("minCoarseningRate")); │ │ │ │ │ -545 │ │ │ │ │ -546 if (configuration.hasKey ("coarsenTarget")) │ │ │ │ │ -547 criterion.setCoarsenTarget (configuration.get("coarsenTarget")); │ │ │ │ │ -548 │ │ │ │ │ -549 if (configuration.hasKey ("accumulationMode")) │ │ │ │ │ -550 { │ │ │ │ │ -551 std::string mode = ToLower()(configuration.get │ │ │ │ │ -("accumulationMode")); │ │ │ │ │ -552 if ( mode == "none") │ │ │ │ │ -553 criterion.setAccumulate(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_n_o_A_c_c_u); │ │ │ │ │ -554 else if ( mode == "atonce" ) │ │ │ │ │ -555 criterion.setAccumulate(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_a_t_O_n_c_e_A_c_c_u); │ │ │ │ │ -556 else if ( mode == "successive") │ │ │ │ │ -557 criterion.setCoarsenTarget (_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u); │ │ │ │ │ -558 else │ │ │ │ │ -559 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ │ -does not allow value " │ │ │ │ │ -560 << mode <<"."); │ │ │ │ │ -561 } │ │ │ │ │ -562 │ │ │ │ │ -563 if (configuration.hasKey ("prolongationDampingFactor")) │ │ │ │ │ -564 criterion.setProlongationDampingFactor (configuration.get │ │ │ │ │ -("prolongationDampingFactor")); │ │ │ │ │ -565 │ │ │ │ │ -566 if (configuration.hasKey("defaultAggregationSizeMode")) │ │ │ │ │ -567 { │ │ │ │ │ -568 auto mode = ToLower()(configuration.get │ │ │ │ │ -("defaultAggregationSizeMode")); │ │ │ │ │ -569 auto dim = configuration.get("defaultAggregationDimension"); │ │ │ │ │ -570 std::size_t maxDistance = 2; │ │ │ │ │ -571 if (configuration.hasKey("MaxAggregateDistance")) │ │ │ │ │ -572 maxDistance = configuration.get("maxAggregateDistance"); │ │ │ │ │ -573 if (mode == "isotropic") │ │ │ │ │ -574 criterion.setDefaultValuesIsotropic(dim, maxDistance); │ │ │ │ │ -575 else if(mode == "anisotropic") │ │ │ │ │ -576 criterion.setDefaultValuesAnisotropic(dim, maxDistance); │ │ │ │ │ -577 else │ │ │ │ │ -578 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ │ -does not allow value " │ │ │ │ │ -579 << mode <<"."); │ │ │ │ │ -580 } │ │ │ │ │ -581 │ │ │ │ │ -582 if (configuration.hasKey("maxAggregateDistance")) │ │ │ │ │ -583 criterion.setMaxDistance(configuration.get │ │ │ │ │ -("maxAggregateDistance")); │ │ │ │ │ -584 │ │ │ │ │ -585 if (configuration.hasKey("minAggregateSize")) │ │ │ │ │ -586 criterion.setMinAggregateSize(configuration.get │ │ │ │ │ -("minAggregateSize")); │ │ │ │ │ -587 │ │ │ │ │ -588 if (configuration.hasKey("maxAggregateSize")) │ │ │ │ │ -589 criterion.setMaxAggregateSize(configuration.get │ │ │ │ │ -("maxAggregateSize")); │ │ │ │ │ -590 │ │ │ │ │ -591 if (configuration.hasKey("maxAggregateConnectivity")) │ │ │ │ │ -592 criterion.setMaxConnectivity(configuration.get │ │ │ │ │ -("maxAggregateConnectivity")); │ │ │ │ │ -593 │ │ │ │ │ -594 if (configuration.hasKey ("alpha")) │ │ │ │ │ -595 criterion.setAlpha (configuration.get ("alpha")); │ │ │ │ │ -596 │ │ │ │ │ -597 if (configuration.hasKey ("beta")) │ │ │ │ │ -598 criterion.setBeta (configuration.get ("beta")); │ │ │ │ │ -599 │ │ │ │ │ -600 if (configuration.hasKey ("gamma")) │ │ │ │ │ -601 criterion.setGamma (configuration.get ("gamma")); │ │ │ │ │ -602 gamma_ = criterion.getGamma(); │ │ │ │ │ -603 │ │ │ │ │ -604 if (configuration.hasKey ("additive")) │ │ │ │ │ -605 criterion.setAdditive (configuration.get("additive")); │ │ │ │ │ -606 additive = criterion.getAdditive(); │ │ │ │ │ -607 │ │ │ │ │ -608 if (configuration.hasKey ("preSteps")) │ │ │ │ │ -609 criterion.setNoPreSmoothSteps (configuration.get │ │ │ │ │ -("preSteps")); │ │ │ │ │ -610 preSteps_ = criterion.getNoPreSmoothSteps (); │ │ │ │ │ -611 │ │ │ │ │ -612 if (configuration.hasKey ("postSteps")) │ │ │ │ │ -613 criterion.setNoPostSmoothSteps (configuration.get │ │ │ │ │ -("postSteps")); │ │ │ │ │ -614 postSteps_ = criterion.getNoPostSmoothSteps (); │ │ │ │ │ -615 │ │ │ │ │ -616 verbosity_ = configuration.get("verbosity", 0); │ │ │ │ │ -617 criterion.setDebugLevel (verbosity_); │ │ │ │ │ -618 │ │ │ │ │ -619 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ │ -620 } │ │ │ │ │ -621 │ │ │ │ │ -622 template │ │ │ │ │ -_6_2_4 struct _D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ -625 { │ │ │ │ │ -_6_2_6 typedef typename Matrix :: field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_6_2_7 enum _S_o_l_v_e_r_T_y_p_e { _u_m_f_p_a_c_k, _s_u_p_e_r_l_u, _n_o_n_e }; │ │ │ │ │ -628 │ │ │ │ │ -_6_2_9 static constexpr _S_o_l_v_e_r_T_y_p_e _s_o_l_v_e_r = │ │ │ │ │ -630#if DISABLE_AMG_DIRECTSOLVER │ │ │ │ │ -631 _n_o_n_e; │ │ │ │ │ -632#elif HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -633 _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _f_i_e_l_d___t_y_p_e_ _> :: valid ? _u_m_f_p_a_c_k : _n_o_n_e ; │ │ │ │ │ -634#elif HAVE_SUPERLU │ │ │ │ │ -635 _s_u_p_e_r_l_u ; │ │ │ │ │ -636#else │ │ │ │ │ -637 _n_o_n_e; │ │ │ │ │ -638#endif │ │ │ │ │ -639 │ │ │ │ │ -640 template │ │ │ │ │ -_6_4_1 struct _S_o_l_v_e_r │ │ │ │ │ -642 { │ │ │ │ │ -_6_4_3 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_V_e_c_t_o_r_,_V_e_c_t_o_r_> _t_y_p_e; │ │ │ │ │ -_6_4_4 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ │ -645 { │ │ │ │ │ -646 DUNE_THROW(NotImplemented,"DirectSolver not selected"); │ │ │ │ │ -647 return nullptr; │ │ │ │ │ -648 } │ │ │ │ │ -_6_4_9 static std::string _n_a_m_e () { return "None"; } │ │ │ │ │ -650 }; │ │ │ │ │ -651#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -652 template │ │ │ │ │ -653 struct Solver< M, _u_m_f_p_a_c_k > │ │ │ │ │ -654 { │ │ │ │ │ -655 typedef _U_M_F_P_a_c_k_<_ _M_ _> _t_y_p_e; │ │ │ │ │ -656 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ │ -657 { │ │ │ │ │ -658 return new _t_y_p_e(_m_a_t, verbose, reusevector ); │ │ │ │ │ -659 } │ │ │ │ │ -660 static std::string _n_a_m_e () { return "UMFPack"; } │ │ │ │ │ -661 }; │ │ │ │ │ -662#endif │ │ │ │ │ -663#if HAVE_SUPERLU │ │ │ │ │ -664 template │ │ │ │ │ -_6_6_5 struct _S_o_l_v_e_r< M, _s_u_p_e_r_l_u > │ │ │ │ │ -666 { │ │ │ │ │ -_6_6_7 typedef _S_u_p_e_r_L_U_<_ _M_ _> _t_y_p_e; │ │ │ │ │ -_6_6_8 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ │ -669 { │ │ │ │ │ -670 return new _t_y_p_e(_m_a_t, verbose, reusevector ); │ │ │ │ │ -671 } │ │ │ │ │ -_6_7_2 static std::string _n_a_m_e () { return "SuperLU"; } │ │ │ │ │ -673 }; │ │ │ │ │ -674#endif │ │ │ │ │ -675 │ │ │ │ │ -676 // define direct solver type to be used │ │ │ │ │ -_6_7_7 typedef _S_o_l_v_e_r_<_ _M_a_t_r_i_x_,_ _s_o_l_v_e_r_ _> _S_e_l_e_c_t_e_d_S_o_l_v_e_r ; │ │ │ │ │ -_6_7_8 typedef typename SelectedSolver :: type _D_i_r_e_c_t_S_o_l_v_e_r; │ │ │ │ │ -_6_7_9 static constexpr bool _i_s_D_i_r_e_c_t_S_o_l_v_e_r = _s_o_l_v_e_r != _n_o_n_e; │ │ │ │ │ -_6_8_0 static std::string _n_a_m_e() { return SelectedSolver :: name (); } │ │ │ │ │ -_6_8_1 static _D_i_r_e_c_t_S_o_l_v_e_r* _c_r_e_a_t_e(const _M_a_t_r_i_x& _m_a_t, bool verbose, bool │ │ │ │ │ -reusevector ) │ │ │ │ │ -682 { │ │ │ │ │ -683 return SelectedSolver :: create( _m_a_t, verbose, reusevector ); │ │ │ │ │ -684 } │ │ │ │ │ -685 }; │ │ │ │ │ -686 │ │ │ │ │ -687 template │ │ │ │ │ -688 template │ │ │ │ │ -689 void AMG::createHierarchies(C& criterion, │ │ │ │ │ -690 const std::shared_ptr& matrixptr, │ │ │ │ │ -691 const PI& pinfo) │ │ │ │ │ -692 { │ │ │ │ │ -693 Timer watch; │ │ │ │ │ -694 matrices_ = std::make_shared( │ │ │ │ │ -695 std::const_pointer_cast(matrixptr), │ │ │ │ │ -696 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ │ -697 │ │ │ │ │ -698 matrices_->template build >(criterion); │ │ │ │ │ -699 │ │ │ │ │ -700 // build the necessary smoother hierarchies │ │ │ │ │ -701 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ │ -702 │ │ │ │ │ -703 // test whether we should solve on the coarse level. That is the case if we │ │ │ │ │ -704 // have that level and if there was a redistribution on this level then our │ │ │ │ │ -705 // communicator has to be valid (size()>0) as the smoother might try to │ │ │ │ │ -communicate │ │ │ │ │ -706 // in the constructor. │ │ │ │ │ -707 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels() │ │ │ │ │ -708 && ( ! matrices_->redistributeInformation().back().isSetup() || │ │ │ │ │ -709 matrices_->parallelInformation().coarsest().getRedistributed().communicator │ │ │ │ │ -().size() ) ) │ │ │ │ │ -710 { │ │ │ │ │ -711 // We have the carsest level. Create the coarse Solver │ │ │ │ │ -712 SmootherArgs sargs(smootherArgs_); │ │ │ │ │ -713 sargs.iterations = 1; │ │ │ │ │ -714 │ │ │ │ │ -715 typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s cargs; │ │ │ │ │ -716 cargs.setArgs(sargs); │ │ │ │ │ -717 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ │ -718 // Solve on the redistributed partitioning │ │ │ │ │ -719 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ │ -()); │ │ │ │ │ -720 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ -()); │ │ │ │ │ -721 }else{ │ │ │ │ │ -722 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ │ -723 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ │ -724 } │ │ │ │ │ -725 │ │ │ │ │ -726 coarseSmoother_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_c_o_n_s_t_r_u_c_t(cargs); │ │ │ │ │ -727 scalarProduct_ = createScalarProduct(cargs.getComm(),category()); │ │ │ │ │ -728 │ │ │ │ │ -729 typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector; │ │ │ │ │ -730 │ │ │ │ │ -731 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ │ -the coarsest level. │ │ │ │ │ -732 if( SolverSelector::isDirectSolver && │ │ │ │ │ -733 (std::is_same::value / │ │ │ │ │ -/ sequential mode │ │ │ │ │ -734 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ │ -parallel mode and only one processor │ │ │ │ │ -735 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ │ -736 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ -().communicator().size()==1 │ │ │ │ │ -737 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ -().communicator().size()>0) ) │ │ │ │ │ -738 ) │ │ │ │ │ -739 { // redistribute and 1 proc │ │ │ │ │ -740 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ -741 { │ │ │ │ │ -742 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ -743 { │ │ │ │ │ -744 // We are still participating on this level │ │ │ │ │ -745 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest │ │ │ │ │ -().getRedistributed().getmat(), false, false)); │ │ │ │ │ -746 } │ │ │ │ │ -747 else │ │ │ │ │ -748 solver_.reset(); │ │ │ │ │ -749 } │ │ │ │ │ -750 else │ │ │ │ │ -751 { │ │ │ │ │ -752 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()- │ │ │ │ │ ->getmat(), false, false)); │ │ │ │ │ -753 } │ │ │ │ │ -754 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ │ ->communicator().rank()==0) │ │ │ │ │ -755 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << │ │ │ │ │ -")" << std::endl; │ │ │ │ │ -756 } │ │ │ │ │ -757 else │ │ │ │ │ -758 { │ │ │ │ │ -759 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ -760 { │ │ │ │ │ -761 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ -762 // We are still participating on this level │ │ │ │ │ -763 │ │ │ │ │ -764 // we have to allocate these types using the rebound allocator │ │ │ │ │ -765 // in order to ensure that we fulfill the alignment requirements │ │ │ │ │ -766 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ │ -().coarsest().getRedistributed()), │ │ │ │ │ -767 *scalarProduct_, │ │ │ │ │ -768 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ -769 else │ │ │ │ │ -770 solver_.reset(); │ │ │ │ │ -771 }else │ │ │ │ │ -772 { │ │ │ │ │ -773 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ │ -().coarsest()), │ │ │ │ │ -774 *scalarProduct_, │ │ │ │ │ -775 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ -776 // // we have to allocate these types using the rebound allocator │ │ │ │ │ -777 // // in order to ensure that we fulfill the alignment requirements │ │ │ │ │ -778 // using Alloc = typename std::allocator_traits::template │ │ │ │ │ -rebind_alloc>; │ │ │ │ │ -779 // Alloc alloc; │ │ │ │ │ -780 // auto p = alloc.allocate(1); │ │ │ │ │ -781 // std::allocator_traits::construct(alloc, p, │ │ │ │ │ -782 // const_cast(*matrices_->matrices().coarsest()), │ │ │ │ │ -783 // *scalarProduct_, │ │ │ │ │ -784 // *coarseSmoother_, 1E-2, 1000, 0); │ │ │ │ │ -785 // solver_.reset(p,[](BiCGSTABSolver* p){ │ │ │ │ │ -786 // Alloc alloc; │ │ │ │ │ -787 // std::allocator_traits::destroy(alloc, p); │ │ │ │ │ -788 // alloc.deallocate(p,1); │ │ │ │ │ -789 // }); │ │ │ │ │ -790 } │ │ │ │ │ -791 } │ │ │ │ │ -792 } │ │ │ │ │ -793 │ │ │ │ │ -794 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ │ -().rank()==0) │ │ │ │ │ -795 std::cout<<"Building hierarchy of "<maxlevels()<<" levels " │ │ │ │ │ -796 <<"(including coarse solver) took "< │ │ │ │ │ -_8_0_1 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ │ -802 { │ │ │ │ │ -803 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ │ -804 // zero and set x such that A_dd*x_d=b_d │ │ │ │ │ -805 // Thus users can be more careless when setting up their linear │ │ │ │ │ -806 // systems. │ │ │ │ │ -807 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ │ -808 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r RowIter; │ │ │ │ │ -809 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIter; │ │ │ │ │ -810 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ │ -811 Block zero; │ │ │ │ │ -812 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ │ -813 │ │ │ │ │ -814 const _M_a_t_r_i_x& _m_a_t=matrices_->matrices().finest()->getmat(); │ │ │ │ │ -815 for(RowIter row=_m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ │ -816 bool isDirichlet = true; │ │ │ │ │ -817 bool hasDiagonal = false; │ │ │ │ │ -818 Block diagonal{}; │ │ │ │ │ -819 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ │ -820 if(row.index()==_c_o_l.index()) { │ │ │ │ │ -821 diagonal = *_c_o_l; │ │ │ │ │ -822 hasDiagonal = true; │ │ │ │ │ -823 }else{ │ │ │ │ │ -824 if(*_c_o_l!=zero) │ │ │ │ │ -825 isDirichlet = false; │ │ │ │ │ -826 } │ │ │ │ │ -827 } │ │ │ │ │ -828 if(isDirichlet && hasDiagonal) │ │ │ │ │ -829 { │ │ │ │ │ -830 auto&& xEntry = Impl::asVector(x[row.index()]); │ │ │ │ │ -831 auto&& bEntry = Impl::asVector(b[row.index()]); │ │ │ │ │ -832 Impl::asMatrix(diagonal).solve(xEntry, bEntry); │ │ │ │ │ -833 } │ │ │ │ │ -834 } │ │ │ │ │ -835 │ │ │ │ │ -836 if(smoothers_->levels()>0) │ │ │ │ │ -837 smoothers_->finest()->pre(x,b); │ │ │ │ │ -838 else │ │ │ │ │ -839 // No smoother to make x consistent! Do it by hand │ │ │ │ │ -840 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ │ -841 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ │ -842 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ │ -843 update_ = std::make_shared>(std::make_shared │ │ │ │ │ -(x)); │ │ │ │ │ -844 matrices_->coarsenVector(*rhs_); │ │ │ │ │ -845 matrices_->coarsenVector(*lhs_); │ │ │ │ │ -846 matrices_->coarsenVector(*update_); │ │ │ │ │ -847 │ │ │ │ │ -848 // Preprocess all smoothers │ │ │ │ │ -849 typedef typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ -850 typedef typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r RIterator; │ │ │ │ │ -851 typedef typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r DIterator; │ │ │ │ │ -852 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ │ -853 Iterator smoother = smoothers_->finest(); │ │ │ │ │ -854 RIterator rhs = rhs_->finest(); │ │ │ │ │ -855 DIterator lhs = lhs_->finest(); │ │ │ │ │ -856 if(smoothers_->levels()>1) { │ │ │ │ │ -857 │ │ │ │ │ -858 assert(lhs_->levels()==rhs_->levels()); │ │ │ │ │ -859 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels │ │ │ │ │ -()==matrices_->maxlevels()); │ │ │ │ │ -860 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels │ │ │ │ │ -()maxlevels()); │ │ │ │ │ -861 │ │ │ │ │ -862 if(smoother!=coarsest) │ │ │ │ │ -863 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, │ │ │ │ │ -++rhs) │ │ │ │ │ -864 smoother->pre(*lhs,*rhs); │ │ │ │ │ -865 smoother->pre(*lhs,*rhs); │ │ │ │ │ -866 } │ │ │ │ │ -867 │ │ │ │ │ -868 │ │ │ │ │ -869 // The preconditioner might change x and b. So we have to │ │ │ │ │ -870 // copy the changes to the original vectors. │ │ │ │ │ -871 x = *lhs_->finest(); │ │ │ │ │ -872 b = *rhs_->finest(); │ │ │ │ │ -873 │ │ │ │ │ -874 } │ │ │ │ │ -875 template │ │ │ │ │ -_8_7_6 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ │ -877 { │ │ │ │ │ -878 return matrices_->levels(); │ │ │ │ │ -879 } │ │ │ │ │ -880 template │ │ │ │ │ -_8_8_1 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ │ -882 { │ │ │ │ │ -883 return matrices_->maxlevels(); │ │ │ │ │ -884 } │ │ │ │ │ -885 │ │ │ │ │ -887 template │ │ │ │ │ -_8_8_8 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ │ -889 { │ │ │ │ │ -890 LevelContext levelContext; │ │ │ │ │ -891 │ │ │ │ │ -892 if(additive) { │ │ │ │ │ -893 *(rhs_->finest())=d; │ │ │ │ │ -894 additiveMgc(); │ │ │ │ │ -895 v=*lhs_->finest(); │ │ │ │ │ -896 }else{ │ │ │ │ │ -897 // Init all iterators for the current level │ │ │ │ │ -898 initIteratorsWithFineLevel(levelContext); │ │ │ │ │ -899 │ │ │ │ │ -900 │ │ │ │ │ -901 *levelContext.lhs = v; │ │ │ │ │ -902 *levelContext.rhs = d; │ │ │ │ │ -903 *levelContext.update=0; │ │ │ │ │ -904 levelContext.level=0; │ │ │ │ │ -905 │ │ │ │ │ -906 mgc(levelContext); │ │ │ │ │ -907 │ │ │ │ │ -908 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ │ -909 levelContext.pinfo->copyOwnerToAll(*levelContext.update, │ │ │ │ │ -*levelContext.update); │ │ │ │ │ -910 │ │ │ │ │ -911 v=*levelContext.update; │ │ │ │ │ -912 } │ │ │ │ │ -913 │ │ │ │ │ -914 } │ │ │ │ │ -915 │ │ │ │ │ -916 template │ │ │ │ │ -917 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_i_n_i_t_I_t_e_r_a_t_o_r_s_W_i_t_h_F_i_n_e_L_e_v_e_l(LevelContext& │ │ │ │ │ -levelContext) │ │ │ │ │ -918 { │ │ │ │ │ -919 levelContext.smoother = smoothers_->finest(); │ │ │ │ │ -920 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ │ -921 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ │ -922 levelContext.redist = │ │ │ │ │ -923 matrices_->redistributeInformation().begin(); │ │ │ │ │ -924 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ │ -925 levelContext.lhs = lhs_->finest(); │ │ │ │ │ -926 levelContext.update = update_->finest(); │ │ │ │ │ -927 levelContext.rhs = rhs_->finest(); │ │ │ │ │ -928 } │ │ │ │ │ -929 │ │ │ │ │ -930 template │ │ │ │ │ -931 bool AMG │ │ │ │ │ -932 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ │ -933 { │ │ │ │ │ -934 │ │ │ │ │ -935 bool processNextLevel=true; │ │ │ │ │ -936 │ │ │ │ │ -937 if(levelContext.redist->isSetup()) { │ │ │ │ │ -938 levelContext.redist->redistribute(static_cast │ │ │ │ │ -(*levelContext.rhs), │ │ │ │ │ -939 levelContext.rhs.getRedistributed()); │ │ │ │ │ -940 processNextLevel = levelContext.rhs.getRedistributed().size()>0; │ │ │ │ │ -941 if(processNextLevel) { │ │ │ │ │ -942 //restrict defect to coarse level right hand side. │ │ │ │ │ -943 typename Hierarchy::Iterator fineRhs = levelContext.rhs++; │ │ │ │ │ -944 ++levelContext.pinfo; │ │ │ │ │ -945 Transfer │ │ │ │ │ -946 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ │ -947 static_cast(fineRhs.getRedistributed()), │ │ │ │ │ -948 *levelContext.pinfo); │ │ │ │ │ -949 } │ │ │ │ │ -950 }else{ │ │ │ │ │ -951 //restrict defect to coarse level right hand side. │ │ │ │ │ -952 typename Hierarchy::Iterator fineRhs = levelContext.rhs++; │ │ │ │ │ -953 ++levelContext.pinfo; │ │ │ │ │ -954 Transfer │ │ │ │ │ -955 ::restrictVector(*(*levelContext.aggregates), │ │ │ │ │ -956 *levelContext.rhs, static_cast(*fineRhs), │ │ │ │ │ -957 *levelContext.pinfo); │ │ │ │ │ -958 } │ │ │ │ │ -959 │ │ │ │ │ -960 if(processNextLevel) { │ │ │ │ │ -961 // prepare coarse system │ │ │ │ │ -962 ++levelContext.lhs; │ │ │ │ │ -963 ++levelContext.update; │ │ │ │ │ -964 ++levelContext.matrix; │ │ │ │ │ -965 ++levelContext.level; │ │ │ │ │ -966 ++levelContext.redist; │ │ │ │ │ -967 │ │ │ │ │ -968 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ ->levels()maxlevels()) { │ │ │ │ │ -969 // next level is not the globally coarsest one │ │ │ │ │ -970 ++levelContext.smoother; │ │ │ │ │ -971 ++levelContext.aggregates; │ │ │ │ │ -972 } │ │ │ │ │ -973 // prepare the update on the next level │ │ │ │ │ -974 *levelContext.update=0; │ │ │ │ │ -975 } │ │ │ │ │ -976 return processNextLevel; │ │ │ │ │ -977 } │ │ │ │ │ -978 │ │ │ │ │ -979 template │ │ │ │ │ -980 void AMG │ │ │ │ │ -981 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel) │ │ │ │ │ -982 { │ │ │ │ │ -983 if(processNextLevel) { │ │ │ │ │ -984 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ ->levels()maxlevels()) { │ │ │ │ │ -985 // previous level is not the globally coarsest one │ │ │ │ │ -986 --levelContext.smoother; │ │ │ │ │ -987 --levelContext.aggregates; │ │ │ │ │ -988 } │ │ │ │ │ -989 --levelContext.redist; │ │ │ │ │ -990 --levelContext.level; │ │ │ │ │ -991 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ │ -992 --levelContext.matrix; │ │ │ │ │ -993 │ │ │ │ │ -994 //typename Hierarchy::Iterator coarseLhs = lhs--; │ │ │ │ │ -995 --levelContext.lhs; │ │ │ │ │ -996 --levelContext.pinfo; │ │ │ │ │ -997 } │ │ │ │ │ -998 if(levelContext.redist->isSetup()) { │ │ │ │ │ -999 // Need to redistribute during prolongateVector │ │ │ │ │ -1000 levelContext.lhs.getRedistributed()=0; │ │ │ │ │ -1001 Transfer │ │ │ │ │ -1002 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ │ -*levelContext.lhs, │ │ │ │ │ -1003 levelContext.lhs.getRedistributed(), │ │ │ │ │ -1004 matrices_->getProlongationDampingFactor(), │ │ │ │ │ -1005 *levelContext.pinfo, *levelContext.redist); │ │ │ │ │ -1006 }else{ │ │ │ │ │ -1007 *levelContext.lhs=0; │ │ │ │ │ -1008 Transfer │ │ │ │ │ -1009 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ │ -*levelContext.lhs, │ │ │ │ │ -1010 matrices_->getProlongationDampingFactor(), │ │ │ │ │ -1011 *levelContext.pinfo); │ │ │ │ │ -1012 } │ │ │ │ │ -1013 │ │ │ │ │ -1014 │ │ │ │ │ -1015 if(processNextLevel) { │ │ │ │ │ -1016 --levelContext.update; │ │ │ │ │ -1017 --levelContext.rhs; │ │ │ │ │ -1018 } │ │ │ │ │ -1019 │ │ │ │ │ -1020 *levelContext.update += *levelContext.lhs; │ │ │ │ │ -1021 } │ │ │ │ │ -1022 │ │ │ │ │ -1023 template │ │ │ │ │ -_1_0_2_4 bool _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const │ │ │ │ │ -1025 { │ │ │ │ │ -1026 return _I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _C_o_a_r_s_e_S_o_l_v_e_r_>_:_:_v_a_l_u_e; │ │ │ │ │ -1027 } │ │ │ │ │ -1028 │ │ │ │ │ -1029 template │ │ │ │ │ -1030 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_m_g_c(LevelContext& levelContext){ │ │ │ │ │ -1031 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ │ -()==maxlevels()) { │ │ │ │ │ -1032 // Solve directly │ │ │ │ │ -1033 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ -1034 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ │ -1035 if(levelContext.redist->isSetup()) { │ │ │ │ │ -1036 levelContext.redist->redistribute(*levelContext.rhs, │ │ │ │ │ -levelContext.rhs.getRedistributed()); │ │ │ │ │ -1037 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ │ -1038 // We are still participating in the computation │ │ │ │ │ -1039 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ │ -(levelContext.rhs.getRedistributed(), │ │ │ │ │ -1040 levelContext.rhs.getRedistributed()); │ │ │ │ │ -1041 solver_->apply(levelContext.update.getRedistributed(), │ │ │ │ │ -1042 levelContext.rhs.getRedistributed(), res); │ │ │ │ │ -1043 } │ │ │ │ │ -1044 levelContext.redist->redistributeBackward(*levelContext.update, │ │ │ │ │ -levelContext.update.getRedistributed()); │ │ │ │ │ -1045 levelContext.pinfo->copyOwnerToAll(*levelContext.update, │ │ │ │ │ -*levelContext.update); │ │ │ │ │ -1046 }else{ │ │ │ │ │ -1047 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs); │ │ │ │ │ -1048 solver_->apply(*levelContext.update, *levelContext.rhs, res); │ │ │ │ │ -1049 } │ │ │ │ │ -1050 │ │ │ │ │ -1051 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ │ -1052 coarsesolverconverged = false; │ │ │ │ │ -1053 }else{ │ │ │ │ │ -1054 // presmoothing │ │ │ │ │ -1055 _p_r_e_s_m_o_o_t_h(levelContext, preSteps_); │ │ │ │ │ -1056 │ │ │ │ │ -1057#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ │ -1058 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ │ -1059 │ │ │ │ │ -1060 if(processNextLevel) { │ │ │ │ │ -1061 // next level │ │ │ │ │ -1062 for(std::size_t i=0; imatrices().coarsest() && levels │ │ │ │ │ -()==maxlevels()) │ │ │ │ │ -1065 break; │ │ │ │ │ -1066 if(i+1 < gamma_){ │ │ │ │ │ -1067 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, │ │ │ │ │ -*levelContext.rhs); │ │ │ │ │ -1068 } │ │ │ │ │ -1069 } │ │ │ │ │ -1070 } │ │ │ │ │ -1071 │ │ │ │ │ -1072 moveToFineLevel(levelContext, processNextLevel); │ │ │ │ │ -1073#else │ │ │ │ │ -1074 *lhs=0; │ │ │ │ │ -1075#endif │ │ │ │ │ -1076 │ │ │ │ │ -1077 if(levelContext.matrix == matrices_->matrices().finest()) { │ │ │ │ │ -1078 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ │ ->communicator().prod(coarsesolverconverged); │ │ │ │ │ -1079 if(!coarsesolverconverged) │ │ │ │ │ -1080 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ │ -1081 } │ │ │ │ │ -1082 // postsmoothing │ │ │ │ │ -1083 _p_o_s_t_s_m_o_o_t_h(levelContext, postSteps_); │ │ │ │ │ -1084 │ │ │ │ │ -1085 } │ │ │ │ │ -1086 } │ │ │ │ │ -1087 │ │ │ │ │ -1088 template │ │ │ │ │ -1089 void AMG::additiveMgc(){ │ │ │ │ │ -1090 │ │ │ │ │ -1091 // restrict residual to all levels │ │ │ │ │ -1092 typename ParallelInformationHierarchy::Iterator pinfo=matrices_- │ │ │ │ │ ->parallelInformation().finest(); │ │ │ │ │ -1093 typename Hierarchy::Iterator rhs=rhs_->finest(); │ │ │ │ │ -1094 typename Hierarchy::Iterator lhs = lhs_->finest(); │ │ │ │ │ -1095 typename OperatorHierarchy::AggregatesMapList::const_iterator │ │ │ │ │ -aggregates=matrices_->aggregatesMaps().begin(); │ │ │ │ │ -1096 │ │ │ │ │ -1097 for(typename Hierarchy::Iterator fineRhs=rhs++; fineRhs != rhs_- │ │ │ │ │ ->coarsest(); fineRhs=rhs++, ++aggregates) { │ │ │ │ │ -1098 ++pinfo; │ │ │ │ │ -1099 Transfer │ │ │ │ │ -1100 ::restrictVector(*(*aggregates), *rhs, static_cast │ │ │ │ │ -(*fineRhs), *pinfo); │ │ │ │ │ -1101 } │ │ │ │ │ -1102 │ │ │ │ │ -1103 // pinfo is invalid, set to coarsest level │ │ │ │ │ -1104 //pinfo = matrices_->parallelInformation().coarsest │ │ │ │ │ -1105 // calculate correction for all levels │ │ │ │ │ -1106 lhs = lhs_->finest(); │ │ │ │ │ -1107 typename Hierarchy::Iterator smoother = smoothers_->finest(); │ │ │ │ │ -1108 │ │ │ │ │ -1109 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) │ │ │ │ │ -{ │ │ │ │ │ -1110 // presmoothing │ │ │ │ │ -1111 *lhs=0; │ │ │ │ │ -1112 smoother->apply(*lhs, *rhs); │ │ │ │ │ -1113 } │ │ │ │ │ -1114 │ │ │ │ │ -1115 // Coarse level solve │ │ │ │ │ -1116#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ │ -1117 InverseOperatorResult res; │ │ │ │ │ -1118 pinfo->copyOwnerToAll(*rhs, *rhs); │ │ │ │ │ -1119 solver_->apply(*lhs, *rhs, res); │ │ │ │ │ -1120 │ │ │ │ │ -1121 if(!res.converged) │ │ │ │ │ -1122 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ │ -1123#else │ │ │ │ │ -1124 *lhs=0; │ │ │ │ │ -1125#endif │ │ │ │ │ -1126 // Prologate and add up corrections from all levels │ │ │ │ │ -1127 --pinfo; │ │ │ │ │ -1128 --aggregates; │ │ │ │ │ -1129 │ │ │ │ │ -1130 for(typename Hierarchy::Iterator coarseLhs = lhs--; coarseLhs != │ │ │ │ │ -lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) { │ │ │ │ │ -1131 Transfer │ │ │ │ │ -1132 ::prolongateVector(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo); │ │ │ │ │ -1133 } │ │ │ │ │ -1134 } │ │ │ │ │ -1135 │ │ │ │ │ -1136 │ │ │ │ │ -1138 template │ │ │ │ │ -_1_1_3_9 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_p_o_s_t([[maybe_unused]] _D_o_m_a_i_n& x) │ │ │ │ │ -1140 { │ │ │ │ │ -1141 // Postprocess all smoothers │ │ │ │ │ -1142 typedef typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ -1143 typedef typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r DIterator; │ │ │ │ │ -1144 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ │ -1145 Iterator smoother = smoothers_->finest(); │ │ │ │ │ -1146 DIterator lhs = lhs_->finest(); │ │ │ │ │ -1147 if(smoothers_->levels()>0) { │ │ │ │ │ -1148 if(smoother != coarsest || matrices_->levels()maxlevels()) │ │ │ │ │ -1149 smoother->post(*lhs); │ │ │ │ │ -1150 if(smoother!=coarsest) │ │ │ │ │ -1151 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs) │ │ │ │ │ -1152 smoother->post(*lhs); │ │ │ │ │ -1153 smoother->post(*lhs); │ │ │ │ │ -1154 } │ │ │ │ │ -1155 lhs_ = nullptr; │ │ │ │ │ -1156 update_ = nullptr; │ │ │ │ │ -1157 rhs_ = nullptr; │ │ │ │ │ -1158 } │ │ │ │ │ -1159 │ │ │ │ │ -1160 template │ │ │ │ │ -1161 template │ │ │ │ │ -_1_1_6_2 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont) │ │ │ │ │ -1163 { │ │ │ │ │ -1164 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ │ -1165 } │ │ │ │ │ -1166 │ │ │ │ │ -1167 } // end namespace Amg │ │ │ │ │ -1168 │ │ │ │ │ -_1_1_6_9 struct _A_M_G_C_r_e_a_t_o_r{ │ │ │ │ │ -_1_1_7_0 template struct _i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e : std::false_type{}; │ │ │ │ │ -_1_1_7_1 template struct │ │ │ │ │ -_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e<_F_i_e_l_d_M_a_t_r_i_x> : std::true_type{}; │ │ │ │ │ -1172 │ │ │ │ │ -1173 template │ │ │ │ │ -1174 std::shared_ptr > │ │ │ │ │ -_1_1_7_5 _m_a_k_e_A_M_G(const OP& op, const std::string& smoother, const Dune:: │ │ │ │ │ -ParameterTree& config) const │ │ │ │ │ -1176 { │ │ │ │ │ -1177 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG"); │ │ │ │ │ -1178 } │ │ │ │ │ -1179 │ │ │ │ │ -1180 template │ │ │ │ │ -1181 std::shared_ptr > │ │ │ │ │ -_1_1_8_2 _m_a_k_e_A_M_G(const std::shared_ptr<_M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_>>& op, const std:: │ │ │ │ │ -string& smoother, │ │ │ │ │ -1183 const Dune::ParameterTree& config) const │ │ │ │ │ -1184 { │ │ │ │ │ -1185 using OP = _M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_>; │ │ │ │ │ -1186 │ │ │ │ │ -1187 if(smoother == "ssor") │ │ │ │ │ -1188 return std::make_shared>>(op, config); │ │ │ │ │ -1189 if(smoother == "sor") │ │ │ │ │ -1190 return std::make_shared>>(op, config); │ │ │ │ │ -1191 if(smoother == "jac") │ │ │ │ │ -1192 return std::make_shared>>(op, config); │ │ │ │ │ -1193 if(smoother == "gs") │ │ │ │ │ -1194 return std::make_shared>>(op, config); │ │ │ │ │ -1195 if(smoother == "ilu") │ │ │ │ │ -1196 return std::make_shared>>(op, config); │ │ │ │ │ -1197 else │ │ │ │ │ -1198 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ │ -1199 } │ │ │ │ │ -1200 │ │ │ │ │ -1201 template │ │ │ │ │ -1202 std::shared_ptr > │ │ │ │ │ -_1_2_0_3 _m_a_k_e_A_M_G(const std::shared_ptr<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>>& op, │ │ │ │ │ -const std::string& smoother, │ │ │ │ │ -1204 const Dune::ParameterTree& config) const │ │ │ │ │ -1205 { │ │ │ │ │ -1206 using OP = _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>; │ │ │ │ │ -1207 │ │ │ │ │ -1208 auto cop = std::static_pointer_cast(op); │ │ │ │ │ -1209 │ │ │ │ │ -1210 if(smoother == "ssor") │ │ │ │ │ -1211 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ -()); │ │ │ │ │ -1212 if(smoother == "sor") │ │ │ │ │ -1213 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ -()); │ │ │ │ │ -1214 if(smoother == "jac") │ │ │ │ │ -1215 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ -()); │ │ │ │ │ -1216 if(smoother == "gs") │ │ │ │ │ -1217 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ -()); │ │ │ │ │ -1218 if(smoother == "ilu") │ │ │ │ │ -1219 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ -()); │ │ │ │ │ -1220 else │ │ │ │ │ -1221 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ │ -1222 } │ │ │ │ │ -1223 │ │ │ │ │ -1224 template │ │ │ │ │ -1225 std::shared_ptr > │ │ │ │ │ -_1_2_2_6 _m_a_k_e_A_M_G(const std::shared_ptr<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>>& op, │ │ │ │ │ -const std::string& smoother, │ │ │ │ │ -1227 const Dune::ParameterTree& config) const │ │ │ │ │ -1228 { │ │ │ │ │ -1229 using OP = _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>; │ │ │ │ │ -1230 │ │ │ │ │ -1231 if(smoother == "ssor") │ │ │ │ │ -1232 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ ->getCommunication()); │ │ │ │ │ -1233 if(smoother == "sor") │ │ │ │ │ -1234 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ ->getCommunication()); │ │ │ │ │ -1235 if(smoother == "jac") │ │ │ │ │ -1236 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ ->getCommunication()); │ │ │ │ │ -1237 if(smoother == "gs") │ │ │ │ │ -1238 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ ->getCommunication()); │ │ │ │ │ -1239 if(smoother == "ilu") │ │ │ │ │ -1240 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ ->getCommunication()); │ │ │ │ │ -1241 else │ │ │ │ │ -1242 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ │ -1243 } │ │ │ │ │ -1244 │ │ │ │ │ -1245 template │ │ │ │ │ -1246 std::shared_ptr::type, │ │ │ │ │ -1247 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ -_1_2_4_8 _o_p_e_r_a_t_o_r_(_)_ (TL tl, const std::shared_ptr& op, const Dune:: │ │ │ │ │ -ParameterTree& config, │ │ │ │ │ -1249 std::enable_if_t<_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_t_y_p_e_n_a_m_e_ _O_P_:_:_m_a_t_r_i_x___t_y_p_e_:_:_b_l_o_c_k___t_y_p_e_>_:_: │ │ │ │ │ -_v_a_l_u_e,int> = 0) const │ │ │ │ │ -1250 { │ │ │ │ │ -1251 using field_type = typename OP::matrix_type::field_type; │ │ │ │ │ -1252 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1253 if (!std::is_convertible()) │ │ │ │ │ -1254 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "AMG needs field_type(" << │ │ │ │ │ -1255 className() << │ │ │ │ │ -1256 ") to be convertible to its real_type (" << │ │ │ │ │ -1257 className() << │ │ │ │ │ -1258 ")."); │ │ │ │ │ -1259 using D = typename Dune::TypeListElement<1, decltype(tl)>::type; │ │ │ │ │ -1260 using R = typename Dune::TypeListElement<2, decltype(tl)>::type; │ │ │ │ │ -1261 std::shared_ptr> amg; │ │ │ │ │ -1262 std::string smoother = config.get("smoother", "ssor"); │ │ │ │ │ -1263 return _m_a_k_e_A_M_G(op, smoother, config); │ │ │ │ │ -1264 } │ │ │ │ │ -1265 │ │ │ │ │ -1266 template │ │ │ │ │ -1267 std::shared_ptr::type, │ │ │ │ │ -1268 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ -_1_2_6_9 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const std::shared_ptr& /*mat*/, const Dune:: │ │ │ │ │ -ParameterTree& /*config*/, │ │ │ │ │ -1270 std::enable_if_t_:_: │ │ │ │ │ -_v_a_l_u_e,int> = 0) const │ │ │ │ │ -1271 { │ │ │ │ │ -1272 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"); │ │ │ │ │ -1273 } │ │ │ │ │ -1274 }; │ │ │ │ │ -1275 │ │ │ │ │ -_1_2_7_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("amg", _A_M_G_C_r_e_a_t_o_r()); │ │ │ │ │ -1277} // end namespace Dune │ │ │ │ │ -1278 │ │ │ │ │ -1279#endif │ │ │ │ │ -_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R │ │ │ │ │ -#define DUNE_REGISTER_PRECONDITIONER(name,...) │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ │ -_s_m_o_o_t_h_e_r_._h_h │ │ │ │ │ -Classes for the generic construction and application of the smoothers. │ │ │ │ │ -_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_o_l_v_e_r_s_._h_h │ │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ │ -_u_m_f_p_a_c_k_._h_h │ │ │ │ │ -Classes for using UMFPack with ISTL matrices. │ │ │ │ │ -_s_u_p_e_r_l_u_._h_h │ │ │ │ │ -Classes for using SuperLU with ISTL matrices. │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ -AMG(const AMG &amg) │ │ │ │ │ -Copy constructor. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:392 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_p_r_e │ │ │ │ │ -void pre(Domain &x, Range &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:801 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_c_r_e_a_t_e │ │ │ │ │ -static DirectSolver * create(const Matrix &mat, bool verbose, bool reusevector) │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:681 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_n_a_m_e │ │ │ │ │ -static std::string name() │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:680 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_u_p_d_a_t_e │ │ │ │ │ -Hierarchy< Domain, A >::Iterator update │ │ │ │ │ -The iterator over the updates. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:303 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_h_s │ │ │ │ │ -Hierarchy< Range, A >::Iterator rhs │ │ │ │ │ -The iterator over the right hand sided. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:307 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_n_a_m_e │ │ │ │ │ -static std::string name() │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:672 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r │ │ │ │ │ -bool usesDirectCoarseLevelSolver() const │ │ │ │ │ -Check whether the coarse solver used is a direct solver. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1024 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ │ -X Domain │ │ │ │ │ -The domain type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:87 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_c_r_e_a_t_e │ │ │ │ │ -static type * create(const M &mat, bool verbose, bool reusevector) │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:644 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ -AMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs │ │ │ │ │ -&smootherArgs, const Parameters &parms) │ │ │ │ │ -Construct a new amg with a specific coarse solver. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:406 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ -AMG(std::shared_ptr< const Operator > fineOperator, const ParameterTree │ │ │ │ │ -&configuration, const ParallelInformation &pinfo=ParallelInformation()) │ │ │ │ │ -Constructor an AMG via ParameterTree. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:452 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_p_i_n_f_o │ │ │ │ │ -ParallelInformationHierarchy::Iterator pinfo │ │ │ │ │ -The iterator over the parallel information. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:287 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_T_y_p_e │ │ │ │ │ -SolverType │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_a_g_g_r_e_g_a_t_e_s │ │ │ │ │ -OperatorHierarchy::AggregatesMapList::const_iterator aggregates │ │ │ │ │ -The iterator over the aggregates maps. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:295 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ -SmootherTraits< Smoother >::Arguments SmootherArgs │ │ │ │ │ -The argument type for the construction of the smoother. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:100 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_e_l_e_c_t_e_d_S_o_l_v_e_r │ │ │ │ │ -Solver< Matrix, solver > SelectedSolver │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:677 │ │ │ │ │ -_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ -std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ │ -MatrixAdapter< M, X, Y > > &op, const std::string &smoother, const Dune:: │ │ │ │ │ -ParameterTree &config) const │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1182 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_T_o_L_o_w_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -std::string operator()(const std::string &str) │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:378 │ │ │ │ │ -_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ -std::shared_ptr< Dune::Preconditioner< typename OP::element_type::domain_type, │ │ │ │ │ -typename OP::element_type::range_type > > makeAMG(const OP &op, const std:: │ │ │ │ │ -string &smoother, const Dune::ParameterTree &config) const │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1175 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r │ │ │ │ │ -S Smoother │ │ │ │ │ -The type of the smoother. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:97 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_n_a_m_e │ │ │ │ │ -static std::string name() │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:649 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_s_m_o_o_t_h_e_r │ │ │ │ │ -Hierarchy< Smoother, A >::Iterator smoother │ │ │ │ │ -The iterator over the smoothers. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:279 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ │ -M Operator │ │ │ │ │ -The matrix operator type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_m_a_t_r_i_x │ │ │ │ │ -OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix │ │ │ │ │ -The iterator over the matrices. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:283 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_t_y_p_e │ │ │ │ │ -SuperLU< M > type │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:667 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_c_r_e_a_t_e │ │ │ │ │ -static type * create(const M &mat, bool verbose, bool reusevector) │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:668 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_d_i_s_t │ │ │ │ │ -OperatorHierarchy::RedistributeInfoList::const_iterator redist │ │ │ │ │ -The iterator over the redistribution information. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:291 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_R_a_n_g_e │ │ │ │ │ -X Range │ │ │ │ │ -The range type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h │ │ │ │ │ -void presmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ -Apply pre smoothing on the current level. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:406 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s │ │ │ │ │ -void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont) │ │ │ │ │ -Get the aggregate number of each unknown on the coarsest level. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1162 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_l_e_v_e_l_s │ │ │ │ │ -std::size_t levels() │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:876 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_t_y_p_e │ │ │ │ │ -InverseOperator< Vector, Vector > type │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:643 │ │ │ │ │ -_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ -std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ │ -OverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, │ │ │ │ │ -const Dune::ParameterTree &config) const │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1203 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_h_s │ │ │ │ │ -Hierarchy< Domain, A >::Iterator lhs │ │ │ │ │ -The iterator over the left hand side. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ -const void * Arguments │ │ │ │ │ -A type holding all the arguments needed to call the constructor. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_s_o_l_v_e_r │ │ │ │ │ -static constexpr SolverType solver │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:629 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_i_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ -static constexpr bool isDirectSolver │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:679 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y │ │ │ │ │ -void recalculateHierarchy() │ │ │ │ │ -Recalculate the matrix hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:221 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -Matrix::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:626 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ -SelectedSolver::type DirectSolver │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:678 │ │ │ │ │ -_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL │ │ │ │ │ ->::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL tl, │ │ │ │ │ -const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std:: │ │ │ │ │ -enable_if_t< isValidBlockType< typename OP::matrix_type::block_type >::value, │ │ │ │ │ -int >=0) const │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1248 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ -OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ │ -The parallal data distribution hierarchy type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ │ -InverseOperator< X, X > CoarseSolver │ │ │ │ │ -the type of the coarse solver. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_p_o_s_t │ │ │ │ │ -void post(Domain &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1139 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ │ -std::size_t maxlevels() │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:881 │ │ │ │ │ -_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ -std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ │ -NonoverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, │ │ │ │ │ -const Dune::ParameterTree &config) const │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1226 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ │ -void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ -Apply post smoothing on the current level. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_e_v_e_l │ │ │ │ │ -std::size_t level │ │ │ │ │ -The level index. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:311 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ -AMG(const Operator &fineOperator, const C &criterion, const SmootherArgs │ │ │ │ │ -&smootherArgs=SmootherArgs(), const ParallelInformation │ │ │ │ │ -&pinfo=ParallelInformation()) │ │ │ │ │ -Construct an AMG with an inexact coarse solver based on the smoother. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:428 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_a_p_p_l_y │ │ │ │ │ -void apply(Domain &v, const Range &d) │ │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:888 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_S_m_o_o_t_h_e_r_T_y_p_e │ │ │ │ │ -Smoother SmootherType │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ │ -MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy │ │ │ │ │ -The operator hierarchy type. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -PI ParallelInformation │ │ │ │ │ -The type of the parallel information. Either OwnerOverlapCommunication or │ │ │ │ │ -another type describing the... │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_n_o_n_e │ │ │ │ │ -@ none │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_u_m_f_p_a_c_k │ │ │ │ │ -@ umfpack │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_s_u_p_e_r_l_u │ │ │ │ │ -@ superlu │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ │ -@ atOnceAccu │ │ │ │ │ -Accumulate data to one process at once. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:244 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u │ │ │ │ │ -@ noAccu │ │ │ │ │ -No data accumulution. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:238 │ │ │ │ │ -_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:248 │ │ │ │ │ +232 } // end Amg namespace │ │ │ │ │ +233 │ │ │ │ │ +234 │ │ │ │ │ +235#if HAVE_MPI │ │ │ │ │ +236 template │ │ │ │ │ +_2_3_7 struct CommPolicy > │ │ │ │ │ +238 { │ │ │ │ │ +_2_3_9 typedef _A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_> _T_y_p_e; │ │ │ │ │ +_2_4_0 typedef typename _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>_:_:_I_n_d_e_x_e_d_T_y_p_e _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +_2_4_1 typedef SizeOne _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ +_2_4_2 static int _g_e_t_S_i_z_e(const _T_y_p_e&, int) │ │ │ │ │ +243 { │ │ │ │ │ +244 return 1; │ │ │ │ │ +245 } │ │ │ │ │ +246 }; │ │ │ │ │ +247#endif │ │ │ │ │ +248 │ │ │ │ │ +249} // end Dune namespace │ │ │ │ │ +250 /* @} */ │ │ │ │ │ +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_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_:_:_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_:_:_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_:_:_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_:_:_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_:_:_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_,_ _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_:_:_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_:_:_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_:_:_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_:_:_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_:_:_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_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_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ │ +_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_:_:_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_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_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_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_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +const AggregateDescriptor * const_iterator │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_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_:_:_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_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_:_:_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_:_:_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_:_:_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 │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ │ -Export the type representing the underlying field. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -row_type::const_iterator ConstColIterator │ │ │ │ │ -Const iterator for the entries of each row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -T block_type │ │ │ │ │ -Export the type representing the components. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:568 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ -A nonoverlapping operator with communication object. │ │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ │ -Adapter to turn a matrix into a linear operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:137 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l │ │ │ │ │ -Norm that uses only the [N][N] entry of the block to determine couplings. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:379 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m │ │ │ │ │ -Functor using the row sum (infinity) norm to determine strong couplings. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:463 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:480 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:496 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -Criterion taking advantage of symmetric matrices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:519 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ -Criterion suitable for unsymmetric matrices. │ │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:539 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G │ │ │ │ │ -an algebraic multigrid method using a Krylov-cycle. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ -Two grid operator for AMG with Krylov cycle. │ │ │ │ │ -DDeeffiinniittiioonn kamg.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G │ │ │ │ │ -Parallel algebraic multigrid based on agglomeration. │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:625 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:642 │ │ │ │ │ -_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1169 │ │ │ │ │ -_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e │ │ │ │ │ -DDeeffiinniittiioonn amg.hh:1170 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ -An overlapping Schwarz operator. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ │ -> Iterator │ │ │ │ │ -Type of the mutable iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator over the levels in the hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ -The hierarchies build by the coarsening process. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ -The criterion describing the stop criteria for the coarsening process. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:283 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -All parameters for AMG. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ +owner/overlap/copy sema... │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ │ +void copyCopyToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from copy data points to all other data points. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ │ +The type of the reverse lookup of indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ │ +const Communication< MPI_Comm > & communicator() const │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ +void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from owner data points to all other data points. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ │ +const RemoteIndices & remoteIndices() const │ │ │ │ │ +Get the underlying remote indices. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ │ +The type of the parallel index set. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y │ │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:70 │ │ │ │ │ +_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_P_u_b_l_i_s_h_e_r │ │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:131 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ -The default class for the smoother arguments. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _X_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:39 │ │ │ │ │ -_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:48 │ │ │ │ │ -_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:73 │ │ │ │ │ -_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:99 │ │ │ │ │ -_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_:_:_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_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U │ │ │ │ │ -SuperLu Solver. │ │ │ │ │ -DDeeffiinniittiioonn superlu.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ │ -The UMFPack direct sparse solver. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:215 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00134.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: properties.hh File Reference │ │ │ │ +dune-istl: hierarchy.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,42 +72,48 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ - │ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <dune/common/propertymap.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

struct  Dune::Amg::VertexVisitedTag
 Tag idnetifying the visited property of a vertex. More...
class  Dune::Amg::Hierarchy< T, A >
 A hierarchy of containers (e.g. matrices or vectors) 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::Hierarchy< T, A >::LevelIterator< C, T1 >
 Iterator over the levels in the hierarchy. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ │

Detailed Description

│ │ │ │ -

Provides classes for handling internal properties in a graph.

│ │ │ │ +

Provides a classes representing the hierarchies in AMG.

│ │ │ │
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,32 +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 │ │ │ │ │ +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 classes for handling internal properties in a graph. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ +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 │ │ │ │ │ -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_:_:_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_:_:_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_:_:_H_i_e_r_a_r_c_h_y_<_ _T_,_ _A_ _>_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_<_ _C_,_ _T_1_ _> │ │ │ │ │ +  Iterator over the levels in the hierarchy. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Provides classes for handling internal properties in a graph. │ │ │ │ │ +Provides a classes representing the hierarchies in AMG. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00134_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: properties.hh Source File │ │ │ │ +dune-istl: hierarchy.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,95 +74,419 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
properties.hh
│ │ │ │ +
hierarchy.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AMGHIERARCHY_HH
│ │ │ │ +
6#define DUNE_AMGHIERARCHY_HH
│ │ │ │
7
│ │ │ │ -
8#include <dune/common/propertymap.hh>
│ │ │ │ -
9
│ │ │ │ -
10namespace Dune
│ │ │ │ -
11{
│ │ │ │ -
12
│ │ │ │ -
13 namespace Amg
│ │ │ │ -
14 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
29 {};
│ │ │ │ -
│ │ │ │ -
30
│ │ │ │ -
31
│ │ │ │ -
38 template<typename C, typename K, std::size_t i,typename T=typename C::ValueType,
│ │ │ │ -
39 typename R = typename C::Reference>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
41 : public RAPropertyMapHelper<R,
│ │ │ │ -
42 RandomAccessBundledPropertyMap<C,K,i,T,R> >
│ │ │ │ -
43 {
│ │ │ │ -
44 public:
│ │ │ │ -
46 typedef C Container;
│ │ │ │ -
47
│ │ │ │ -
49 typedef R Reference;
│ │ │ │ -
50
│ │ │ │ -
52 typedef K Key;
│ │ │ │ -
53
│ │ │ │ -
57 typedef LvaluePropertyMapTag Category;
│ │ │ │ +
8#include <list>
│ │ │ │ +
9#include <memory>
│ │ │ │ +
10#include <limits>
│ │ │ │ +
11#include <dune/common/stdstreams.hh>
│ │ │ │ +
12#include <dune/common/timer.hh>
│ │ │ │ +
13#include <dune/common/bigunsignedint.hh>
│ │ │ │ + │ │ │ │ +
15
│ │ │ │ +
16namespace Dune
│ │ │ │ +
17{
│ │ │ │ +
18 namespace Amg
│ │ │ │ +
19 {
│ │ │ │ +
38 template<typename T, typename A=std::allocator<T> >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
40 {
│ │ │ │ +
41 public:
│ │ │ │ +
45 typedef T MemberType;
│ │ │ │ +
46
│ │ │ │ +
47 template<typename T1, typename T2>
│ │ │ │ +
48 class LevelIterator;
│ │ │ │ +
49
│ │ │ │ +
50 private:
│ │ │ │ +
54 struct Element
│ │ │ │ +
55 {
│ │ │ │ +
56 friend class LevelIterator<Hierarchy<T,A>, T>;
│ │ │ │ +
57 friend class LevelIterator<const Hierarchy<T,A>, const T>;
│ │ │ │
58
│ │ │ │ -
59 enum {
│ │ │ │ -
61 index = i
│ │ │ │ -
62 };
│ │ │ │ -
63
│ │ │ │ -
│ │ │ │ -
69 Reference operator[](const Key& key) const
│ │ │ │ -
70 {
│ │ │ │ -
71 return container_[key][index];
│ │ │ │ -
72 }
│ │ │ │ -
│ │ │ │ -
73
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
79 : container_(&container)
│ │ │ │ -
80 {}
│ │ │ │ -
│ │ │ │ -
81
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
84 : container_(0)
│ │ │ │ -
85 {}
│ │ │ │ -
│ │ │ │ -
86
│ │ │ │ -
87 private:
│ │ │ │ -
89 Container* container_;
│ │ │ │ -
90 };
│ │ │ │ -
│ │ │ │ -
91 }
│ │ │ │ -
92}
│ │ │ │ -
93
│ │ │ │ -
94#endif
│ │ │ │ -
Reference operator[](const Key &key) const
Get the property for a key.
Definition properties.hh:69
│ │ │ │ -
RandomAccessBundledPropertyMap()
The default constructor.
Definition properties.hh:83
│ │ │ │ -
R Reference
The reference type of the container.
Definition properties.hh:49
│ │ │ │ -
RandomAccessBundledPropertyMap(Container &container)
Constructor.
Definition properties.hh:78
│ │ │ │ -
K Key
The key of the property map.
Definition properties.hh:52
│ │ │ │ -
LvaluePropertyMapTag Category
The category of the property map.
Definition properties.hh:57
│ │ │ │ -
C Container
The container that holds the properties.
Definition properties.hh:46
│ │ │ │ -
@ index
The index of the property in the bundle.
Definition properties.hh:61
│ │ │ │ +
60 std::weak_ptr<Element> coarser_;
│ │ │ │ +
61
│ │ │ │ +
63 std::shared_ptr<Element> finer_;
│ │ │ │ +
64
│ │ │ │ +
66 std::shared_ptr<MemberType> element_;
│ │ │ │ +
67
│ │ │ │ +
69 std::shared_ptr<MemberType> redistributed_;
│ │ │ │ +
70 };
│ │ │ │ +
71 public:
│ │ │ │ +
72
│ │ │ │ +
76 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<Element>;
│ │ │ │ +
77
│ │ │ │ + │ │ │ │ +
79
│ │ │ │ +
│ │ │ │ +
84 Hierarchy(const std::shared_ptr<MemberType> & first);
│ │ │ │ +
85
│ │ │ │ +
│ │ │ │ +
89 Hierarchy() : levels_(0)
│ │ │ │ +
90 {}
│ │ │ │ +
│ │ │ │ +
91
│ │ │ │ +
│ │ │ │ +
95 Hierarchy(const Hierarchy& other);
│ │ │ │ +
96
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
102
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
104
│ │ │ │ +
│ │ │ │ +
109 void addFiner(Arguments& args);
│ │ │ │ +
110
│ │ │ │ +
117 template<class C, class T1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
119 : public BidirectionalIteratorFacade<LevelIterator<C,T1>,T1,T1&>
│ │ │ │ +
120 {
│ │ │ │ +
121 friend class LevelIterator<typename std::remove_const<C>::type,
│ │ │ │ +
122 typename std::remove_const<T1>::type >;
│ │ │ │ +
123 friend class LevelIterator<const typename std::remove_const<C>::type,
│ │ │ │ +
124 const typename std::remove_const<T1>::type >;
│ │ │ │ +
125
│ │ │ │ +
126 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
129 {}
│ │ │ │ +
│ │ │ │ +
130
│ │ │ │ +
│ │ │ │ +
131 LevelIterator(std::shared_ptr<Element> element)
│ │ │ │ +
132 : element_(element)
│ │ │ │ +
133 {}
│ │ │ │ +
│ │ │ │ +
134
│ │ │ │ +
│ │ │ │ +
136 LevelIterator(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ │ +
137 typename std::remove_const<T1>::type>& other)
│ │ │ │ +
138 : element_(other.element_)
│ │ │ │ +
139 {}
│ │ │ │ +
│ │ │ │ +
140
│ │ │ │ +
│ │ │ │ +
142 LevelIterator(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ │ +
143 const typename std::remove_const<T1>::type>& other)
│ │ │ │ +
144 : element_(other.element_)
│ │ │ │ +
145 {}
│ │ │ │ +
│ │ │ │ +
146
│ │ │ │ +
│ │ │ │ +
150 bool equals(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ │ +
151 typename std::remove_const<T1>::type>& other) const
│ │ │ │ +
152 {
│ │ │ │ +
153 return element_ == other.element_;
│ │ │ │ +
154 }
│ │ │ │ +
│ │ │ │ +
155
│ │ │ │ +
│ │ │ │ +
159 bool equals(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ │ +
160 const typename std::remove_const<T1>::type>& other) const
│ │ │ │ +
161 {
│ │ │ │ +
162 return element_ == other.element_;
│ │ │ │ +
163 }
│ │ │ │ +
│ │ │ │ +
164
│ │ │ │ +
│ │ │ │ +
166 T1& dereference() const
│ │ │ │ +
167 {
│ │ │ │ +
168 return *(element_->element_);
│ │ │ │ +
169 }
│ │ │ │ +
│ │ │ │ +
170
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
173 {
│ │ │ │ +
174 element_ = element_->coarser_.lock();
│ │ │ │ +
175 }
│ │ │ │ +
│ │ │ │ +
176
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
179 {
│ │ │ │ +
180 element_ = element_->finer_;
│ │ │ │ +
181 }
│ │ │ │ +
│ │ │ │ +
182
│ │ │ │ +
│ │ │ │ +
187 bool isRedistributed() const
│ │ │ │ +
188 {
│ │ │ │ +
189 return (bool)element_->redistributed_;
│ │ │ │ +
190 }
│ │ │ │ +
│ │ │ │ +
191
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
197 {
│ │ │ │ +
198 assert(element_->redistributed_);
│ │ │ │ +
199 return *element_->redistributed_;
│ │ │ │ +
200 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
201 void addRedistributed(std::shared_ptr<T1> t)
│ │ │ │ +
202 {
│ │ │ │ +
203 element_->redistributed_ = t;
│ │ │ │ +
204 }
│ │ │ │ +
│ │ │ │ +
205
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
207 {
│ │ │ │ +
208 element_->redistributed_ = nullptr;
│ │ │ │ +
209 }
│ │ │ │ +
│ │ │ │ +
210
│ │ │ │ +
211 private:
│ │ │ │ +
212 std::shared_ptr<Element> element_;
│ │ │ │ +
213 };
│ │ │ │ +
│ │ │ │ +
214
│ │ │ │ + │ │ │ │ +
217
│ │ │ │ + │ │ │ │ +
220
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
226
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
232
│ │ │ │ +
233
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
239
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
245
│ │ │ │ +
│ │ │ │ +
250 std::size_t levels() const;
│ │ │ │ +
251
│ │ │ │ +
252 private:
│ │ │ │ +
258 std::shared_ptr<MemberType> originalFinest_;
│ │ │ │ +
260 std::shared_ptr<Element> finest_;
│ │ │ │ +
262 std::shared_ptr<Element> coarsest_;
│ │ │ │ +
264 Allocator allocator_;
│ │ │ │ +
266 int levels_;
│ │ │ │ +
267 };
│ │ │ │ +
268
│ │ │ │ +
269 template<class T, class A>
│ │ │ │ +
│ │ │ │ +
270 Hierarchy<T,A>::Hierarchy(const std::shared_ptr<MemberType> & first)
│ │ │ │ +
271 : originalFinest_(first)
│ │ │ │ +
272 {
│ │ │ │ +
273 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ +
274 finest_->element_ = originalFinest_;
│ │ │ │ +
275 coarsest_ = finest_;
│ │ │ │ +
276 levels_ = 1;
│ │ │ │ +
277 }
│ │ │ │ +
│ │ │ │ +
278
│ │ │ │ +
280 //TODO: do we actually want to support this? This might be very expensive?!
│ │ │ │ +
281 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
283 : allocator_(other.allocator_),
│ │ │ │ +
284 levels_(other.levels_)
│ │ │ │ +
285 {
│ │ │ │ +
286 if(!other.finest_)
│ │ │ │ +
287 {
│ │ │ │ +
288 finest_=coarsest_=nullptr;
│ │ │ │ +
289 return;
│ │ │ │ +
290 }
│ │ │ │ +
291 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ +
292 std::shared_ptr<Element> finer_;
│ │ │ │ +
293 std::shared_ptr<Element> current_ = finest_;
│ │ │ │ +
294 std::weak_ptr<Element> otherWeak_ = other.finest_;
│ │ │ │ +
295
│ │ │ │ +
296 while(! otherWeak_.expired())
│ │ │ │ +
297 {
│ │ │ │ +
298 // create shared_ptr from weak_ptr, we just checked that this is safe
│ │ │ │ +
299 std::shared_ptr<Element> otherCurrent_ = std::shared_ptr<Element>(otherWeak_);
│ │ │ │ +
300 // clone current level
│ │ │ │ +
301 //TODO: should we use the allocator?
│ │ │ │ +
302 current_->element_ =
│ │ │ │ +
303 std::make_shared<MemberType>(*(otherCurrent_->element_));
│ │ │ │ +
304 current_->finer_=finer_;
│ │ │ │ +
305 if(otherCurrent_->redistributed_)
│ │ │ │ +
306 current_->redistributed_ =
│ │ │ │ +
307 std::make_shared<MemberType>(*(otherCurrent_->redistributed_));
│ │ │ │ +
308 finer_=current_;
│ │ │ │ +
309 if(not otherCurrent_->coarser_.expired())
│ │ │ │ +
310 {
│ │ │ │ +
311 auto c = std::allocate_shared<Element>(allocator_);
│ │ │ │ +
312 current_->coarser_ = c;
│ │ │ │ +
313 current_ = c;
│ │ │ │ +
314 }
│ │ │ │ +
315 // go to coarser level
│ │ │ │ +
316 otherWeak_ = otherCurrent_->coarser_;
│ │ │ │ +
317 }
│ │ │ │ +
318 coarsest_=current_;
│ │ │ │ +
319 }
│ │ │ │ +
│ │ │ │ +
320
│ │ │ │ +
321 template<class T, class A>
│ │ │ │ +
│ │ │ │ +
322 std::size_t Hierarchy<T,A>::levels() const
│ │ │ │ +
323 {
│ │ │ │ +
324 return levels_;
│ │ │ │ +
325 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
326
│ │ │ │ +
327 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
329 {
│ │ │ │ +
330 coarsest_->redistributed_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ +
331 }
│ │ │ │ +
│ │ │ │ +
332
│ │ │ │ +
333 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
335 {
│ │ │ │ +
336 if(!coarsest_) {
│ │ │ │ +
337 // we have no levels at all...
│ │ │ │ +
338 assert(!finest_);
│ │ │ │ +
339 // allocate into the shared_ptr
│ │ │ │ +
340 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ +
341 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ +
342 coarsest_->element_ = originalFinest_;
│ │ │ │ +
343 finest_ = coarsest_;
│ │ │ │ +
344 }else{
│ │ │ │ +
345 auto old_coarsest = coarsest_;
│ │ │ │ +
346 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ +
347 coarsest_->finer_ = old_coarsest;
│ │ │ │ +
348 coarsest_->element_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ +
349 old_coarsest->coarser_ = coarsest_;
│ │ │ │ +
350 }
│ │ │ │ +
351 ++levels_;
│ │ │ │ +
352 }
│ │ │ │ +
│ │ │ │ +
353
│ │ │ │ +
354
│ │ │ │ +
355 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
357 {
│ │ │ │ +
358 //TODO: wouldn't it be better to do this in the constructor?'
│ │ │ │ +
359 if(!finest_) {
│ │ │ │ +
360 // we have no levels at all...
│ │ │ │ +
361 assert(!coarsest_);
│ │ │ │ +
362 // allocate into the shared_ptr
│ │ │ │ +
363 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ +
364 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ +
365 finest_->element = originalFinest_;
│ │ │ │ +
366 coarsest_ = finest_;
│ │ │ │ +
367 }else{
│ │ │ │ +
368 finest_->finer_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ +
369 finest_->finer_->coarser_ = finest_;
│ │ │ │ +
370 finest_ = finest_->finer_;
│ │ │ │ +
371 finest_->element = ConstructionTraits<T>::construct(args);
│ │ │ │ +
372 }
│ │ │ │ +
373 ++levels_;
│ │ │ │ +
374 }
│ │ │ │ +
│ │ │ │ +
375
│ │ │ │ +
376 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
378 {
│ │ │ │ +
379 return Iterator(finest_);
│ │ │ │ +
380 }
│ │ │ │ +
│ │ │ │ +
381
│ │ │ │ +
382 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
384 {
│ │ │ │ +
385 return Iterator(coarsest_);
│ │ │ │ +
386 }
│ │ │ │ +
│ │ │ │ +
387
│ │ │ │ +
388 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
390 {
│ │ │ │ +
391 return ConstIterator(finest_);
│ │ │ │ +
392 }
│ │ │ │ +
│ │ │ │ +
393
│ │ │ │ +
394 template<class T, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
396 {
│ │ │ │ +
397 return ConstIterator(coarsest_);
│ │ │ │ +
398 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
400 } // namespace Amg
│ │ │ │ +
401} // namespace Dune
│ │ │ │ +
402
│ │ │ │ +
403#endif
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
Helper classes for the construction of classes without empty constructor.
│ │ │ │ +
Hierarchy(const Hierarchy &other)
Copy constructor (deep copy!).
Definition hierarchy.hh:282
│ │ │ │ +
void addRedistributedOnCoarsest(Arguments &args)
Definition hierarchy.hh:328
│ │ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ │ +
ConstIterator coarsest() const
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:395
│ │ │ │ +
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ │ +
void addFiner(Arguments &args)
Add an element on a finer level.
Definition hierarchy.hh:356
│ │ │ │ +
Hierarchy(const std::shared_ptr< MemberType > &first)
Construct a new hierarchy.
Definition hierarchy.hh:270
│ │ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ +
Iterator coarsest()
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:383
│ │ │ │ +
ConstIterator finest() const
Get an iterator positioned at the finest level.
Definition hierarchy.hh:389
│ │ │ │ +
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ │ -
A property map that extracts one property out of a bundle using operator[]()
Definition properties.hh:43
│ │ │ │ +
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ │ +
T MemberType
The type of the container we store.
Definition hierarchy.hh:45
│ │ │ │ +
LevelIterator< Hierarchy< T, A >, T > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ +
LevelIterator< const Hierarchy< T, A >, const T > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ │ +
ConstructionTraits< T >::Arguments Arguments
Definition hierarchy.hh:78
│ │ │ │ +
Hierarchy()
Construct an empty hierarchy.
Definition hierarchy.hh:89
│ │ │ │ +
typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator
The allocator to use for the list elements.
Definition hierarchy.hh:76
│ │ │ │ +
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ │ +
LevelIterator(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:136
│ │ │ │ +
void addRedistributed(std::shared_ptr< T1 > t)
Definition hierarchy.hh:201
│ │ │ │ +
T1 & dereference() const
Dereference the iterator.
Definition hierarchy.hh:166
│ │ │ │ +
bool equals(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:150
│ │ │ │ +
bool isRedistributed() const
Check whether there was a redistribution at the current level.
Definition hierarchy.hh:187
│ │ │ │ +
bool equals(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:159
│ │ │ │ +
void increment()
Move to the next coarser level.
Definition hierarchy.hh:172
│ │ │ │ +
LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:142
│ │ │ │ +
void deleteRedistributed()
Definition hierarchy.hh:206
│ │ │ │ +
void decrement()
Move to the next fine level.
Definition hierarchy.hh:178
│ │ │ │ +
LevelIterator(std::shared_ptr< Element > element)
Definition hierarchy.hh:131
│ │ │ │ +
T1 & getRedistributed() const
Get the redistributed container.
Definition hierarchy.hh:196
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,110 +1,442 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -properties.hh │ │ │ │ │ +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 (C) 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_AMGHIERARCHY_HH │ │ │ │ │ +6#define DUNE_AMGHIERARCHY_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10namespace _D_u_n_e │ │ │ │ │ -11{ │ │ │ │ │ -12 │ │ │ │ │ -13 namespace Amg │ │ │ │ │ -14 { │ │ │ │ │ -_2_8 struct _V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ -29 {}; │ │ │ │ │ -30 │ │ │ │ │ -31 │ │ │ │ │ -38 template │ │ │ │ │ -_4_0 class _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -41 : public RAPropertyMapHelper > │ │ │ │ │ -43 { │ │ │ │ │ -44 public: │ │ │ │ │ -_4_6 typedef C _C_o_n_t_a_i_n_e_r; │ │ │ │ │ -47 │ │ │ │ │ -_4_9 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ -50 │ │ │ │ │ -_5_2 typedef K _K_e_y; │ │ │ │ │ -53 │ │ │ │ │ -_5_7 typedef LvaluePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ │ +15 │ │ │ │ │ +16namespace _D_u_n_e │ │ │ │ │ +17{ │ │ │ │ │ +18 namespace Amg │ │ │ │ │ +19 { │ │ │ │ │ +38 template > │ │ │ │ │ +_3_9 class _H_i_e_r_a_r_c_h_y │ │ │ │ │ +40 { │ │ │ │ │ +41 public: │ │ │ │ │ +_4_5 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ +46 │ │ │ │ │ +47 template │ │ │ │ │ +48 class _L_e_v_e_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +49 │ │ │ │ │ +50 private: │ │ │ │ │ +54 struct Element │ │ │ │ │ +55 { │ │ │ │ │ +56 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r<_H_i_e_r_a_r_c_h_y, T>; │ │ │ │ │ +57 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r, const T>; │ │ │ │ │ 58 │ │ │ │ │ -59 enum { │ │ │ │ │ -61 _i_n_d_e_x = i │ │ │ │ │ -_6_2 }; │ │ │ │ │ -63 │ │ │ │ │ -_6_9 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](const _K_e_y& key) const │ │ │ │ │ -70 { │ │ │ │ │ -71 return container_[key][_i_n_d_e_x]; │ │ │ │ │ -72 } │ │ │ │ │ -73 │ │ │ │ │ -_7_8 _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p(_C_o_n_t_a_i_n_e_r& container) │ │ │ │ │ -79 : container_(&container) │ │ │ │ │ -80 {} │ │ │ │ │ -81 │ │ │ │ │ -_8_3 _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ │ -84 : container_(0) │ │ │ │ │ -85 {} │ │ │ │ │ -86 │ │ │ │ │ -87 private: │ │ │ │ │ -89 _C_o_n_t_a_i_n_e_r* container_; │ │ │ │ │ -90 }; │ │ │ │ │ -91 } │ │ │ │ │ -92} │ │ │ │ │ -93 │ │ │ │ │ -94#endif │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -Reference operator[](const Key &key) const │ │ │ │ │ -Get the property for a key. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -RandomAccessBundledPropertyMap() │ │ │ │ │ -The default constructor. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:83 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ │ -R Reference │ │ │ │ │ -The reference type of the container. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -RandomAccessBundledPropertyMap(Container &container) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_K_e_y │ │ │ │ │ -K Key │ │ │ │ │ -The key of the property map. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -LvaluePropertyMapTag Category │ │ │ │ │ -The category of the property map. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ │ -C Container │ │ │ │ │ -The container that holds the properties. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_i_n_d_e_x │ │ │ │ │ -@ index │ │ │ │ │ -The index of the property in the bundle. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:61 │ │ │ │ │ +60 std::weak_ptr coarser_; │ │ │ │ │ +61 │ │ │ │ │ +63 std::shared_ptr finer_; │ │ │ │ │ +64 │ │ │ │ │ +66 std::shared_ptr element_; │ │ │ │ │ +67 │ │ │ │ │ +_6_9 std::shared_ptr redistributed_; │ │ │ │ │ +70 }; │ │ │ │ │ +71 public: │ │ │ │ │ +72 │ │ │ │ │ +_7_6 using _A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ │ +rebind_alloc; │ │ │ │ │ +77 │ │ │ │ │ +_7_8 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_>_:_:_A_r_g_u_m_e_n_t_s _A_r_g_u_m_e_n_t_s; │ │ │ │ │ +79 │ │ │ │ │ +_8_4 _H_i_e_r_a_r_c_h_y(const std::shared_ptr & first); │ │ │ │ │ +85 │ │ │ │ │ +_8_9 _H_i_e_r_a_r_c_h_y() : levels_(0) │ │ │ │ │ +90 {} │ │ │ │ │ +91 │ │ │ │ │ +_9_5 _H_i_e_r_a_r_c_h_y(const _H_i_e_r_a_r_c_h_y& other); │ │ │ │ │ +96 │ │ │ │ │ +_1_0_1 void _a_d_d_C_o_a_r_s_e_r(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ │ +102 │ │ │ │ │ +_1_0_3 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ │ +104 │ │ │ │ │ +_1_0_9 void _a_d_d_F_i_n_e_r(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ │ +110 │ │ │ │ │ +117 template │ │ │ │ │ +_1_1_8 class _L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ +119 : public BidirectionalIteratorFacade,T1,T1&> │ │ │ │ │ +120 { │ │ │ │ │ +121 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ +122 typename std::remove_const::type >; │ │ │ │ │ +123 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ +124 const typename std::remove_const::type >; │ │ │ │ │ +125 │ │ │ │ │ +126 public: │ │ │ │ │ +_1_2_8 _L_e_v_e_l_I_t_e_r_a_t_o_r() │ │ │ │ │ +129 {} │ │ │ │ │ +130 │ │ │ │ │ +_1_3_1 _L_e_v_e_l_I_t_e_r_a_t_o_r(std::shared_ptr element) │ │ │ │ │ +132 : element_(element) │ │ │ │ │ +133 {} │ │ │ │ │ +134 │ │ │ │ │ +_1_3_6 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ +137 typename std::remove_const::type>& other) │ │ │ │ │ +138 : element_(other.element_) │ │ │ │ │ +139 {} │ │ │ │ │ +140 │ │ │ │ │ +_1_4_2 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r:: │ │ │ │ │ +type, │ │ │ │ │ +143 const typename std::remove_const::type>& other) │ │ │ │ │ +144 : element_(other.element_) │ │ │ │ │ +145 {} │ │ │ │ │ +146 │ │ │ │ │ +_1_5_0 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ +151 typename std::remove_const::type>& other) const │ │ │ │ │ +152 { │ │ │ │ │ +153 return element_ == other.element_; │ │ │ │ │ +154 } │ │ │ │ │ +155 │ │ │ │ │ +_1_5_9 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ +160 const typename std::remove_const::type>& other) const │ │ │ │ │ +161 { │ │ │ │ │ +162 return element_ == other.element_; │ │ │ │ │ +163 } │ │ │ │ │ +164 │ │ │ │ │ +_1_6_6 T1& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ +167 { │ │ │ │ │ +168 return *(element_->element_); │ │ │ │ │ +169 } │ │ │ │ │ +170 │ │ │ │ │ +_1_7_2 void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ +173 { │ │ │ │ │ +174 element_ = element_->coarser_.lock(); │ │ │ │ │ +175 } │ │ │ │ │ +176 │ │ │ │ │ +_1_7_8 void _d_e_c_r_e_m_e_n_t() │ │ │ │ │ +179 { │ │ │ │ │ +180 element_ = element_->finer_; │ │ │ │ │ +181 } │ │ │ │ │ +182 │ │ │ │ │ +_1_8_7 bool _i_s_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ │ +188 { │ │ │ │ │ +189 return (bool)element_->redistributed_; │ │ │ │ │ +190 } │ │ │ │ │ +191 │ │ │ │ │ +_1_9_6 T1& _g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ │ +197 { │ │ │ │ │ +198 assert(element_->redistributed_); │ │ │ │ │ +199 return *element_->redistributed_; │ │ │ │ │ +200 } │ │ │ │ │ +_2_0_1 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d(std::shared_ptr t) │ │ │ │ │ +202 { │ │ │ │ │ +203 element_->redistributed_ = t; │ │ │ │ │ +204 } │ │ │ │ │ +205 │ │ │ │ │ +_2_0_6 void _d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d() │ │ │ │ │ +207 { │ │ │ │ │ +208 element_->redistributed_ = nullptr; │ │ │ │ │ +209 } │ │ │ │ │ +210 │ │ │ │ │ +211 private: │ │ │ │ │ +212 std::shared_ptr element_; │ │ │ │ │ +213 }; │ │ │ │ │ +214 │ │ │ │ │ +_2_1_6 typedef _L_e_v_e_l_I_t_e_r_a_t_o_r_<_H_i_e_r_a_r_c_h_y_<_T_,_A_>,T> _I_t_e_r_a_t_o_r; │ │ │ │ │ +217 │ │ │ │ │ +_2_1_9 typedef _L_e_v_e_l_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _H_i_e_r_a_r_c_h_y_<_T_,_A_>, const T> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +220 │ │ │ │ │ +_2_2_5 _I_t_e_r_a_t_o_r _f_i_n_e_s_t(); │ │ │ │ │ +226 │ │ │ │ │ +_2_3_1 _I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t(); │ │ │ │ │ +232 │ │ │ │ │ +233 │ │ │ │ │ +_2_3_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _f_i_n_e_s_t() const; │ │ │ │ │ +239 │ │ │ │ │ +_2_4_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t() const; │ │ │ │ │ +245 │ │ │ │ │ +_2_5_0 std::size_t _l_e_v_e_l_s() const; │ │ │ │ │ +251 │ │ │ │ │ +252 private: │ │ │ │ │ +258 std::shared_ptr originalFinest_; │ │ │ │ │ +260 std::shared_ptr finest_; │ │ │ │ │ +262 std::shared_ptr coarsest_; │ │ │ │ │ +264 _A_l_l_o_c_a_t_o_r allocator_; │ │ │ │ │ +266 int levels_; │ │ │ │ │ +267 }; │ │ │ │ │ +268 │ │ │ │ │ +269 template │ │ │ │ │ +_2_7_0 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const std::shared_ptr & first) │ │ │ │ │ +271 : originalFinest_(first) │ │ │ │ │ +272 { │ │ │ │ │ +273 finest_ = std::allocate_shared(allocator_); │ │ │ │ │ +274 finest_->element_ = originalFinest_; │ │ │ │ │ +275 coarsest_ = finest_; │ │ │ │ │ +276 levels_ = 1; │ │ │ │ │ +277 } │ │ │ │ │ +278 │ │ │ │ │ +280 //TODO: do we actually want to support this? This might be very expensive?! │ │ │ │ │ +281 template │ │ │ │ │ +_2_8_2 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const _H_i_e_r_a_r_c_h_y& other) │ │ │ │ │ +283 : allocator_(other.allocator_), │ │ │ │ │ +284 levels_(other.levels_) │ │ │ │ │ +285 { │ │ │ │ │ +286 if(!other.finest_) │ │ │ │ │ +287 { │ │ │ │ │ +288 finest_=coarsest_=nullptr; │ │ │ │ │ +289 return; │ │ │ │ │ +290 } │ │ │ │ │ +291 finest_ = std::allocate_shared(allocator_); │ │ │ │ │ +292 std::shared_ptr finer_; │ │ │ │ │ +293 std::shared_ptr current_ = finest_; │ │ │ │ │ +294 std::weak_ptr otherWeak_ = other.finest_; │ │ │ │ │ +295 │ │ │ │ │ +296 while(! otherWeak_.expired()) │ │ │ │ │ +297 { │ │ │ │ │ +298 // create shared_ptr from weak_ptr, we just checked that this is safe │ │ │ │ │ +299 std::shared_ptr otherCurrent_ = std::shared_ptr │ │ │ │ │ +(otherWeak_); │ │ │ │ │ +300 // clone current level │ │ │ │ │ +301 //TODO: should we use the allocator? │ │ │ │ │ +302 current_->element_ = │ │ │ │ │ +303 std::make_shared(*(otherCurrent_->element_)); │ │ │ │ │ +304 current_->finer_=finer_; │ │ │ │ │ +305 if(otherCurrent_->redistributed_) │ │ │ │ │ +306 current_->redistributed_ = │ │ │ │ │ +307 std::make_shared(*(otherCurrent_->redistributed_)); │ │ │ │ │ +308 finer_=current_; │ │ │ │ │ +309 if(not otherCurrent_->coarser_.expired()) │ │ │ │ │ +310 { │ │ │ │ │ +311 auto c = std::allocate_shared(allocator_); │ │ │ │ │ +312 current_->coarser_ = c; │ │ │ │ │ +313 current_ = c; │ │ │ │ │ +314 } │ │ │ │ │ +315 // go to coarser level │ │ │ │ │ +316 otherWeak_ = otherCurrent_->coarser_; │ │ │ │ │ +317 } │ │ │ │ │ +318 coarsest_=current_; │ │ │ │ │ +319 } │ │ │ │ │ +320 │ │ │ │ │ +321 template │ │ │ │ │ +_3_2_2 std::size_t _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ │ +323 { │ │ │ │ │ +324 return levels_; │ │ │ │ │ +325 } │ │ │ │ │ +326 │ │ │ │ │ +327 template │ │ │ │ │ +_3_2_8 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ +329 { │ │ │ │ │ +330 coarsest_->redistributed_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +(args); │ │ │ │ │ +331 } │ │ │ │ │ +332 │ │ │ │ │ +333 template │ │ │ │ │ +_3_3_4 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_C_o_a_r_s_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ +335 { │ │ │ │ │ +336 if(!coarsest_) { │ │ │ │ │ +337 // we have no levels at all... │ │ │ │ │ +338 assert(!finest_); │ │ │ │ │ +339 // allocate into the shared_ptr │ │ │ │ │ +340 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ +341 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ │ +342 coarsest_->element_ = originalFinest_; │ │ │ │ │ +343 finest_ = coarsest_; │ │ │ │ │ +344 }else{ │ │ │ │ │ +345 auto old_coarsest = coarsest_; │ │ │ │ │ +346 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ │ +347 coarsest_->finer_ = old_coarsest; │ │ │ │ │ +348 coarsest_->element_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ +349 old_coarsest->coarser_ = coarsest_; │ │ │ │ │ +350 } │ │ │ │ │ +351 ++levels_; │ │ │ │ │ +352 } │ │ │ │ │ +353 │ │ │ │ │ +354 │ │ │ │ │ +355 template │ │ │ │ │ +_3_5_6 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_F_i_n_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ +357 { │ │ │ │ │ +358 //TODO: wouldn't it be better to do this in the constructor?' │ │ │ │ │ +359 if(!finest_) { │ │ │ │ │ +360 // we have no levels at all... │ │ │ │ │ +361 assert(!coarsest_); │ │ │ │ │ +362 // allocate into the shared_ptr │ │ │ │ │ +363 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ +364 finest_ = std::allocate_shared(allocator_); │ │ │ │ │ +365 finest_->element = originalFinest_; │ │ │ │ │ +366 coarsest_ = finest_; │ │ │ │ │ +367 }else{ │ │ │ │ │ +368 finest_->finer_ = std::allocate_shared(allocator_); │ │ │ │ │ +369 finest_->finer_->coarser_ = finest_; │ │ │ │ │ +370 finest_ = finest_->finer_; │ │ │ │ │ +371 finest_->element = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ +372 } │ │ │ │ │ +373 ++levels_; │ │ │ │ │ +374 } │ │ │ │ │ +375 │ │ │ │ │ +376 template │ │ │ │ │ +_3_7_7 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() │ │ │ │ │ +378 { │ │ │ │ │ +379 return _I_t_e_r_a_t_o_r(finest_); │ │ │ │ │ +380 } │ │ │ │ │ +381 │ │ │ │ │ +382 template │ │ │ │ │ +_3_8_3 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() │ │ │ │ │ +384 { │ │ │ │ │ +385 return _I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ │ +386 } │ │ │ │ │ +387 │ │ │ │ │ +388 template │ │ │ │ │ +_3_8_9 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() const │ │ │ │ │ +390 { │ │ │ │ │ +391 return _C_o_n_s_t_I_t_e_r_a_t_o_r(finest_); │ │ │ │ │ +392 } │ │ │ │ │ +393 │ │ │ │ │ +394 template │ │ │ │ │ +_3_9_5 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() const │ │ │ │ │ +396 { │ │ │ │ │ +397 return _C_o_n_s_t_I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ │ +398 } │ │ │ │ │ +400 } // namespace Amg │ │ │ │ │ +401} // namespace Dune │ │ │ │ │ +402 │ │ │ │ │ +403#endif │ │ │ │ │ +_c_o_n_s_t_r_u_c_t_i_o_n_._h_h │ │ │ │ │ +Helper classes for the construction of classes without empty constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ +Hierarchy(const Hierarchy &other) │ │ │ │ │ +Copy constructor (deep copy!). │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t │ │ │ │ │ +void addRedistributedOnCoarsest(Arguments &args) │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ │ +std::size_t levels() const │ │ │ │ │ +Get the number of levels in the hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ │ +ConstIterator coarsest() const │ │ │ │ │ +Get an iterator positioned at the coarsest level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:395 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ │ +void addCoarser(Arguments &args) │ │ │ │ │ +Add an element on a coarser level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_F_i_n_e_r │ │ │ │ │ +void addFiner(Arguments &args) │ │ │ │ │ +Add an element on a finer level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:356 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ +Hierarchy(const std::shared_ptr< MemberType > &first) │ │ │ │ │ +Construct a new hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:270 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ +const void * Arguments │ │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ │ +Iterator coarsest() │ │ │ │ │ +Get an iterator positioned at the coarsest level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:383 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ │ +ConstIterator finest() const │ │ │ │ │ +Get an iterator positioned at the finest level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:389 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ │ +Iterator finest() │ │ │ │ │ +Get an iterator positioned at the finest level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ -Tag idnetifying the visited property of a vertex. │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ -A property map that extracts one property out of a bundle using operator[]() │ │ │ │ │ -DDeeffiinniittiioonn properties.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ +A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ +T MemberType │ │ │ │ │ +The type of the container we store. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator< Hierarchy< T, A >, T > Iterator │ │ │ │ │ +Type of the mutable iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator< const Hierarchy< T, A >, const T > ConstIterator │ │ │ │ │ +Type of the const iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ +ConstructionTraits< T >::Arguments Arguments │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ +Hierarchy() │ │ │ │ │ +Construct an empty hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator │ │ │ │ │ +The allocator to use for the list elements. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator over the levels in the hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ │ +typename std::remove_const< T1 >::type > &other) │ │ │ │ │ +Copy constructor. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:136 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ +void addRedistributed(std::shared_ptr< T1 > t) │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:201 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +T1 & dereference() const │ │ │ │ │ +Dereference the iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ │ +typename std::remove_const< T1 >::type > &other) const │ │ │ │ │ +Equality check. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:150 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_s_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ +bool isRedistributed() const │ │ │ │ │ +Check whether there was a redistribution at the current level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:187 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ │ +const typename std::remove_const< T1 >::type > &other) const │ │ │ │ │ +Equality check. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:159 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +Move to the next coarser level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:172 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ │ +const typename std::remove_const< T1 >::type > &other) │ │ │ │ │ +Copy constructor. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:142 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ +void deleteRedistributed() │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ +void decrement() │ │ │ │ │ +Move to the next fine level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:178 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator(std::shared_ptr< Element > element) │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ +T1 & getRedistributed() const │ │ │ │ │ +Get the redistributed container. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:196 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00137.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamg.hh File Reference │ │ │ │ +dune-istl: fastamgsmoother.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,75 +71,36 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Macros
│ │ │ │ -
fastamg.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
fastamgsmoother.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. │ │ │ │ -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 <cstddef>
│ │ │ │
│ │ │ │

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...
struct  Dune::Amg::GaussSeidelPresmoothDefect< level >
 
struct  Dune::Amg::GaussSeidelPostsmoothDefect< level >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Macros

#define DIRECTSOLVER   SuperLU
 
│ │ │ │ -

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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,51 +1,23 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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" │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +fastamgsmoother.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -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_._._. │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _D_I_R_E_C_T_S_O_L_V_E_R   SuperLU │ │ │ │ │ -  │ │ │ │ │ -********** 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. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? DDIIRREECCTTSSOOLLVVEERR ********** │ │ │ │ │ -#define DIRECTSOLVER   SuperLU │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00137_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamg.hh Source File │ │ │ │ +dune-istl: fastamgsmoother.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,662 +74,127 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
fastamg.hh
│ │ │ │ +
fastamgsmoother.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ +
5#ifndef DUNE_ISTL_FASTAMGSMOOTHER_HH
│ │ │ │ +
6#define DUNE_ISTL_FASTAMGSMOOTHER_HH
│ │ │ │
7
│ │ │ │ -
8#include <memory>
│ │ │ │ -
9#include <dune/common/exceptions.hh>
│ │ │ │ -
10#include <dune/common/typetraits.hh>
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
14#include <dune/istl/solvers.hh>
│ │ │ │ - │ │ │ │ -
16#include <dune/istl/superlu.hh>
│ │ │ │ -
17#include <dune/istl/umfpack.hh>
│ │ │ │ - │ │ │ │ -
19#include <dune/istl/io.hh>
│ │ │ │ - │ │ │ │ -
21
│ │ │ │ -
22#include "fastamgsmoother.hh"
│ │ │ │ -
23
│ │ │ │ -
32namespace Dune
│ │ │ │ -
33{
│ │ │ │ -
34 namespace Amg
│ │ │ │ -
35 {
│ │ │ │ -
58 template<class M, class X, class PI=SequentialInformation, class A=std::allocator<X> >
│ │ │ │ -
│ │ │ │ -
59 class FastAMG : public Preconditioner<X,X>
│ │ │ │ -
60 {
│ │ │ │ -
61 public:
│ │ │ │ -
63 typedef M Operator;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
75
│ │ │ │ -
77 typedef X Domain;
│ │ │ │ -
79 typedef X Range;
│ │ │ │ - │ │ │ │ -
82
│ │ │ │ -
90 FastAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ │ -
91 const Parameters& parms,
│ │ │ │ -
92 bool symmetric=true);
│ │ │ │ -
93
│ │ │ │ -
105 template<class C>
│ │ │ │ -
106 FastAMG(const Operator& fineOperator, const C& criterion,
│ │ │ │ -
107 const Parameters& parms=Parameters(),
│ │ │ │ -
108 bool symmetric=true,
│ │ │ │ - │ │ │ │ -
110
│ │ │ │ -
114 FastAMG(const FastAMG& amg);
│ │ │ │ -
115
│ │ │ │ -
117 void pre(Domain& x, Range& b);
│ │ │ │ -
118
│ │ │ │ -
120 void apply(Domain& v, const Range& d);
│ │ │ │ -
121
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
124 {
│ │ │ │ - │ │ │ │ -
126 }
│ │ │ │ -
│ │ │ │ -
127
│ │ │ │ -
129 void post(Domain& x);
│ │ │ │ -
130
│ │ │ │ -
135 template<class A1>
│ │ │ │ -
136 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ │ -
137
│ │ │ │ -
138 std::size_t levels();
│ │ │ │ -
139
│ │ │ │ -
140 std::size_t maxlevels();
│ │ │ │ -
141
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
151 {
│ │ │ │ -
152 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ │ -
153 }
│ │ │ │ -
│ │ │ │ -
154
│ │ │ │ -
159 bool usesDirectCoarseLevelSolver() const;
│ │ │ │ -
160
│ │ │ │ -
161 private:
│ │ │ │ -
168 template<class C>
│ │ │ │ -
169 void createHierarchies(C& criterion,
│ │ │ │ -
170 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ -
171 const PI& pinfo);
│ │ │ │ -
172
│ │ │ │ -
179 struct LevelContext
│ │ │ │ -
180 {
│ │ │ │ -
184 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ │ - │ │ │ │ -
192 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ │ -
196 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
212 std::size_t level;
│ │ │ │ -
213 };
│ │ │ │ -
214
│ │ │ │ -
216 void mgc(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ │ -
217
│ │ │ │ -
224 void presmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ │ -
225
│ │ │ │ -
232 void postsmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ │ -
233
│ │ │ │ -
240 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel,
│ │ │ │ -
241 Domain& fineX);
│ │ │ │ -
242
│ │ │ │ -
247 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ │ -
248
│ │ │ │ -
253 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ │ -
254
│ │ │ │ -
256 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ │ -
258 std::shared_ptr<CoarseSolver> solver_;
│ │ │ │ -
260 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ │ -
262 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ │ -
264 std::shared_ptr<Hierarchy<Domain,A>> residual_;
│ │ │ │ -
265
│ │ │ │ - │ │ │ │ -
269 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ │ -
271 std::size_t gamma_;
│ │ │ │ -
273 std::size_t preSteps_;
│ │ │ │ -
275 std::size_t postSteps_;
│ │ │ │ -
276 std::size_t level;
│ │ │ │ -
277 bool buildHierarchy_;
│ │ │ │ -
278 bool symmetric;
│ │ │ │ -
279 bool coarsesolverconverged;
│ │ │ │ - │ │ │ │ -
281 typedef std::shared_ptr<Smoother> SmootherPointer;
│ │ │ │ -
282 SmootherPointer coarseSmoother_;
│ │ │ │ -
284 std::size_t verbosity_;
│ │ │ │ -
285 };
│ │ │ │ -
│ │ │ │ -
286
│ │ │ │ -
287 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
289 : matrices_(amg.matrices_), solver_(amg.solver_),
│ │ │ │ -
290 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_),
│ │ │ │ -
291 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ │ -
292 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ │ -
293 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_)
│ │ │ │ -
294 {}
│ │ │ │ -
│ │ │ │ -
295
│ │ │ │ -
296 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
298 const Parameters& parms, bool symmetric_)
│ │ │ │ -
299 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver),
│ │ │ │ -
300 rhs_(), lhs_(), residual_(), scalarProduct_(),
│ │ │ │ -
301 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ │ -
302 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ │ -
303 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ │ -
304 coarseSmoother_(), verbosity_(parms.debugLevel())
│ │ │ │ -
305 {
│ │ │ │ -
306 if(preSteps_>1||postSteps_>1)
│ │ │ │ -
307 {
│ │ │ │ -
308 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ │ -
309 preSteps_=postSteps_=0;
│ │ │ │ -
310 }
│ │ │ │ -
311 assert(matrices_->isBuilt());
│ │ │ │ -
312 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ │ -
313 "Currently only sequential runs are supported");
│ │ │ │ -
314 }
│ │ │ │ -
│ │ │ │ -
315 template<class M, class X, class PI, class A>
│ │ │ │ -
316 template<class C>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
318 const C& criterion,
│ │ │ │ -
319 const Parameters& parms,
│ │ │ │ -
320 bool symmetric_,
│ │ │ │ -
321 const PI& pinfo)
│ │ │ │ -
322 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_(parms.getGamma()),
│ │ │ │ -
323 preSteps_(parms.getNoPreSmoothSteps()), postSteps_(parms.getNoPostSmoothSteps()),
│ │ │ │ -
324 buildHierarchy_(true),
│ │ │ │ -
325 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ │ -
326 coarseSmoother_(), verbosity_(criterion.debugLevel())
│ │ │ │ -
327 {
│ │ │ │ -
328 if(preSteps_>1||postSteps_>1)
│ │ │ │ -
329 {
│ │ │ │ -
330 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ │ -
331 preSteps_=postSteps_=1;
│ │ │ │ -
332 }
│ │ │ │ -
333 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ │ -
334 "Currently only sequential runs are supported");
│ │ │ │ -
335 // TODO: reestablish compile time checks.
│ │ │ │ -
336 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ │ -
337 // "Matrix and Solver must match in terms of category!");
│ │ │ │ -
338 auto matrixptr = stackobject_to_shared_ptr(matrix);
│ │ │ │ -
339 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ │ -
340 }
│ │ │ │ -
│ │ │ │ -
341
│ │ │ │ -
342 template<class M, class X, class PI, class A>
│ │ │ │ -
343 template<class C>
│ │ │ │ -
344 void FastAMG<M,X,PI,A>::createHierarchies(C& criterion,
│ │ │ │ -
345 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ -
346 const PI& pinfo)
│ │ │ │ -
347 {
│ │ │ │ -
348 Timer watch;
│ │ │ │ -
349 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ │ -
350 std::const_pointer_cast<Operator>(matrixptr),
│ │ │ │ -
351 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ │ -
352
│ │ │ │ -
353 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ │ -
354
│ │ │ │ -
355 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ │ -
356 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
357
│ │ │ │ -
358 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()) {
│ │ │ │ -
359 // We have the carsest level. Create the coarse Solver
│ │ │ │ -
360 typedef typename SmootherTraits<Smoother>::Arguments SmootherArgs;
│ │ │ │ -
361 SmootherArgs sargs;
│ │ │ │ -
362 sargs.iterations = 1;
│ │ │ │ -
363
│ │ │ │ - │ │ │ │ -
365 cargs.setArgs(sargs);
│ │ │ │ -
366 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ │ -
367 // Solve on the redistributed partitioning
│ │ │ │ -
368 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ │ -
369 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ │ -
370 }else{
│ │ │ │ -
371 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ │ -
372 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ │ -
373 }
│ │ │ │ -
374
│ │ │ │ -
375 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ │ -
376 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ │ -
377
│ │ │ │ -
378#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
379#if HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
380#define DIRECTSOLVER UMFPack
│ │ │ │ -
381#else
│ │ │ │ -
382#define DIRECTSOLVER SuperLU
│ │ │ │ -
383#endif
│ │ │ │ -
384 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ │ -
385 if(std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ │ -
386 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ │ -
387 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ │ -
388 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ │ -
389 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0)) { // redistribute and 1 proc
│ │ │ │ -
390 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ │ -
391 std::cout<<"Using superlu"<<std::endl;
│ │ │ │ -
392 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ -
393 {
│ │ │ │ -
394 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ -
395 // We are still participating on this level
│ │ │ │ -
396 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ │ -
397 else
│ │ │ │ -
398 solver_.reset();
│ │ │ │ -
399 }else
│ │ │ │ -
400 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ │ -
401 }else
│ │ │ │ -
402#undef DIRECTSOLVER
│ │ │ │ -
403#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
404 {
│ │ │ │ -
405 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ -
406 {
│ │ │ │ -
407 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ -
408 // We are still participating on this level
│ │ │ │ -
409 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ │ -
410 *scalarProduct_,
│ │ │ │ -
411 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ -
412 else
│ │ │ │ -
413 solver_.reset();
│ │ │ │ -
414 }else
│ │ │ │ -
415 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ │ -
416 *scalarProduct_,
│ │ │ │ -
417 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ -
418 }
│ │ │ │ -
419 }
│ │ │ │ -
420
│ │ │ │ -
421 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ │ -
422 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ -
423 }
│ │ │ │ -
424
│ │ │ │ -
425
│ │ │ │ -
426 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
428 {
│ │ │ │ -
429 Timer watch, watch1;
│ │ │ │ -
430 // Detect Matrix rows where all offdiagonal entries are
│ │ │ │ -
431 // zero and set x such that A_dd*x_d=b_d
│ │ │ │ -
432 // Thus users can be more careless when setting up their linear
│ │ │ │ -
433 // systems.
│ │ │ │ -
434 typedef typename M::matrix_type Matrix;
│ │ │ │ -
435 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ │ -
436 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ │ -
437 typedef typename Matrix::block_type Block;
│ │ │ │ -
438 Block zero;
│ │ │ │ -
439 zero=typename Matrix::field_type();
│ │ │ │ -
440
│ │ │ │ -
441 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ │ -
442 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ │ -
443 bool isDirichlet = true;
│ │ │ │ -
444 bool hasDiagonal = false;
│ │ │ │ -
445 ColIter diag;
│ │ │ │ -
446 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ │ -
447 if(row.index()==col.index()) {
│ │ │ │ -
448 diag = col;
│ │ │ │ -
449 hasDiagonal = (*col != zero);
│ │ │ │ -
450 }else{
│ │ │ │ -
451 if(*col!=zero)
│ │ │ │ -
452 isDirichlet = false;
│ │ │ │ -
453 }
│ │ │ │ -
454 }
│ │ │ │ -
455 if(isDirichlet && hasDiagonal)
│ │ │ │ -
456 diag->solve(x[row.index()], b[row.index()]);
│ │ │ │ -
457 }
│ │ │ │ -
458 if (verbosity_>0)
│ │ │ │ -
459 std::cout<<" Preprocessing Dirichlet took "<<watch1.elapsed()<<std::endl;
│ │ │ │ -
460 watch1.reset();
│ │ │ │ -
461 // No smoother to make x consistent! Do it by hand
│ │ │ │ -
462 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ │ -
463 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ │ -
464 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ -
465 residual_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ -
466 matrices_->coarsenVector(*rhs_);
│ │ │ │ -
467 matrices_->coarsenVector(*lhs_);
│ │ │ │ -
468 matrices_->coarsenVector(*residual_);
│ │ │ │ -
469
│ │ │ │ -
470 // The preconditioner might change x and b. So we have to
│ │ │ │ -
471 // copy the changes to the original vectors.
│ │ │ │ -
472 x = *lhs_->finest();
│ │ │ │ -
473 b = *rhs_->finest();
│ │ │ │ -
474 }
│ │ │ │ -
│ │ │ │ -
475 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
477 {
│ │ │ │ -
478 return matrices_->levels();
│ │ │ │ -
479 }
│ │ │ │ -
│ │ │ │ -
480 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
482 {
│ │ │ │ -
483 return matrices_->maxlevels();
│ │ │ │ -
484 }
│ │ │ │ -
│ │ │ │ -
485
│ │ │ │ -
487 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
489 {
│ │ │ │ -
490 LevelContext levelContext;
│ │ │ │ -
491 // Init all iterators for the current level
│ │ │ │ -
492 initIteratorsWithFineLevel(levelContext);
│ │ │ │ -
493
│ │ │ │ -
494 assert(v.two_norm()==0);
│ │ │ │ -
495
│ │ │ │ -
496 level=0;
│ │ │ │ -
497 if(matrices_->maxlevels()==1){
│ │ │ │ -
498 // The coarse solver might modify the d!
│ │ │ │ -
499 Range b(d);
│ │ │ │ -
500 mgc(levelContext, v, b);
│ │ │ │ -
501 }else
│ │ │ │ -
502 mgc(levelContext, v, d);
│ │ │ │ -
503 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ │ -
504 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ │ -
505 }
│ │ │ │ -
│ │ │ │ -
506
│ │ │ │ -
507 template<class M, class X, class PI, class A>
│ │ │ │ -
508 void FastAMG<M,X,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ │ -
509 {
│ │ │ │ -
510 levelContext.matrix = matrices_->matrices().finest();
│ │ │ │ -
511 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ │ -
512 levelContext.redist =
│ │ │ │ -
513 matrices_->redistributeInformation().begin();
│ │ │ │ -
514 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ │ -
515 levelContext.lhs = lhs_->finest();
│ │ │ │ -
516 levelContext.residual = residual_->finest();
│ │ │ │ -
517 levelContext.rhs = rhs_->finest();
│ │ │ │ -
518 levelContext.level=0;
│ │ │ │ -
519 }
│ │ │ │ -
520
│ │ │ │ -
521 template<class M, class X, class PI, class A>
│ │ │ │ -
522 bool FastAMG<M,X,PI,A>
│ │ │ │ -
523 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ │ -
524 {
│ │ │ │ -
525 bool processNextLevel=true;
│ │ │ │ -
526
│ │ │ │ -
527 if(levelContext.redist->isSetup()) {
│ │ │ │ -
528 throw "bla";
│ │ │ │ -
529 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.residual),
│ │ │ │ -
530 levelContext.residual.getRedistributed());
│ │ │ │ -
531 processNextLevel = levelContext.residual.getRedistributed().size()>0;
│ │ │ │ -
532 if(processNextLevel) {
│ │ │ │ -
533 //restrict defect to coarse level right hand side.
│ │ │ │ -
534 ++levelContext.pinfo;
│ │ │ │ -
535 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
536 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ │ -
537 static_cast<const Range&>(levelContext.residual.getRedistributed()),
│ │ │ │ -
538 *levelContext.pinfo);
│ │ │ │ -
539 }
│ │ │ │ -
540 }else{
│ │ │ │ -
541 //restrict defect to coarse level right hand side.
│ │ │ │ -
542 ++levelContext.rhs;
│ │ │ │ -
543 ++levelContext.pinfo;
│ │ │ │ -
544 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
545 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ │ -
546 static_cast<const Range&>(*levelContext.residual), *levelContext.pinfo);
│ │ │ │ -
547 }
│ │ │ │ -
548
│ │ │ │ -
549 if(processNextLevel) {
│ │ │ │ -
550 // prepare coarse system
│ │ │ │ -
551 ++levelContext.residual;
│ │ │ │ -
552 ++levelContext.lhs;
│ │ │ │ -
553 ++levelContext.matrix;
│ │ │ │ -
554 ++levelContext.level;
│ │ │ │ -
555 ++levelContext.redist;
│ │ │ │ -
556
│ │ │ │ -
557 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ -
558 // next level is not the globally coarsest one
│ │ │ │ -
559 ++levelContext.aggregates;
│ │ │ │ -
560 }
│ │ │ │ -
561 // prepare the lhs on the next level
│ │ │ │ -
562 *levelContext.lhs=0;
│ │ │ │ -
563 *levelContext.residual=0;
│ │ │ │ -
564 }
│ │ │ │ -
565 return processNextLevel;
│ │ │ │ -
566 }
│ │ │ │ -
567
│ │ │ │ -
568 template<class M, class X, class PI, class A>
│ │ │ │ -
569 void FastAMG<M,X,PI,A>
│ │ │ │ -
570 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, Domain& x)
│ │ │ │ -
571 {
│ │ │ │ -
572 if(processNextLevel) {
│ │ │ │ -
573 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ -
574 // previous level is not the globally coarsest one
│ │ │ │ -
575 --levelContext.aggregates;
│ │ │ │ -
576 }
│ │ │ │ -
577 --levelContext.redist;
│ │ │ │ -
578 --levelContext.level;
│ │ │ │ -
579 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ │ -
580 --levelContext.matrix;
│ │ │ │ -
581 --levelContext.residual;
│ │ │ │ -
582
│ │ │ │ -
583 }
│ │ │ │ -
584
│ │ │ │ -
585 typename Hierarchy<Domain,A>::Iterator coarseLhs = levelContext.lhs--;
│ │ │ │ -
586 if(levelContext.redist->isSetup()) {
│ │ │ │ -
587
│ │ │ │ -
588 // Need to redistribute during prolongate
│ │ │ │ -
589 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
590 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ │ -
591 levelContext.lhs.getRedistributed(),
│ │ │ │ -
592 matrices_->getProlongationDampingFactor(),
│ │ │ │ -
593 *levelContext.pinfo, *levelContext.redist);
│ │ │ │ -
594 }else{
│ │ │ │ -
595 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ -
596 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ │ -
597 matrices_->getProlongationDampingFactor(), *levelContext.pinfo);
│ │ │ │ -
598
│ │ │ │ -
599 // printvector(std::cout, *lhs, "prolongated coarse grid correction", "lhs", 10, 10, 10);
│ │ │ │ -
600 }
│ │ │ │ -
601
│ │ │ │ -
602
│ │ │ │ -
603 if(processNextLevel) {
│ │ │ │ -
604 --levelContext.rhs;
│ │ │ │ -
605 }
│ │ │ │ -
606
│ │ │ │ -
607 }
│ │ │ │ -
608
│ │ │ │ -
609
│ │ │ │ -
610 template<class M, class X, class PI, class A>
│ │ │ │ -
611 void FastAMG<M,X,PI,A>
│ │ │ │ -
612 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ │ -
613 {
│ │ │ │ -
614 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ │ -
615 GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(),
│ │ │ │ -
616 x,
│ │ │ │ -
617 *levelContext.residual,
│ │ │ │ -
618 b);
│ │ │ │ -
619 }
│ │ │ │ -
620
│ │ │ │ -
621 template<class M, class X, class PI, class A>
│ │ │ │ -
622 void FastAMG<M,X,PI,A>
│ │ │ │ -
623 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ │ -
624 {
│ │ │ │ -
625 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ │ -
626 GaussSeidelPostsmoothDefect<bl>
│ │ │ │ -
627 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b);
│ │ │ │ -
628 }
│ │ │ │ -
629
│ │ │ │ -
630
│ │ │ │ -
631 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
633 {
│ │ │ │ - │ │ │ │ -
635 }
│ │ │ │ -
│ │ │ │ -
636
│ │ │ │ -
637 template<class M, class X, class PI, class A>
│ │ │ │ -
638 void FastAMG<M,X,PI,A>::mgc(LevelContext& levelContext, Domain& v, const Range& b){
│ │ │ │ -
639
│ │ │ │ -
640 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ │ -
641 // Solve directly
│ │ │ │ - │ │ │ │ -
643 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ │ -
644 if(levelContext.redist->isSetup()) {
│ │ │ │ -
645 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed());
│ │ │ │ -
646 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ │ -
647 // We are still participating in the computation
│ │ │ │ -
648 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ │ -
649 levelContext.rhs.getRedistributed());
│ │ │ │ -
650 solver_->apply(levelContext.lhs.getRedistributed(), levelContext.rhs.getRedistributed(), res);
│ │ │ │ -
651 }
│ │ │ │ -
652 levelContext.redist->redistributeBackward(v, levelContext.lhs.getRedistributed());
│ │ │ │ -
653 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ │ -
654 }else{
│ │ │ │ -
655 levelContext.pinfo->copyOwnerToAll(b, b);
│ │ │ │ -
656 solver_->apply(v, const_cast<Range&>(b), res);
│ │ │ │ -
657 }
│ │ │ │ -
658
│ │ │ │ -
659 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10);
│ │ │ │ -
660 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10);
│ │ │ │ -
661 if (!res.converged)
│ │ │ │ -
662 coarsesolverconverged = false;
│ │ │ │ -
663 }else{
│ │ │ │ -
664 // presmoothing
│ │ │ │ -
665 presmooth(levelContext, v, b);
│ │ │ │ -
666 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10);
│ │ │ │ -
667 // printvector(std::cout, *residual, "post presmooth residual", "r", 10);
│ │ │ │ -
668#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ │ -
669 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ │ -
670
│ │ │ │ -
671 if(processNextLevel) {
│ │ │ │ -
672 // next level
│ │ │ │ -
673 for(std::size_t i=0; i<gamma_; i++)
│ │ │ │ -
674 mgc(levelContext, *levelContext.lhs, *levelContext.rhs);
│ │ │ │ -
675 }
│ │ │ │ -
676
│ │ │ │ -
677 moveToFineLevel(levelContext, processNextLevel, v);
│ │ │ │ -
678#else
│ │ │ │ -
679 *lhs=0;
│ │ │ │ -
680#endif
│ │ │ │ -
681
│ │ │ │ -
682 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ │ -
683 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ │ -
684 if(!coarsesolverconverged)
│ │ │ │ -
685 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ │ -
686 }
│ │ │ │ -
687
│ │ │ │ -
688 postsmooth(levelContext, v, b);
│ │ │ │ -
689 }
│ │ │ │ -
690 }
│ │ │ │ -
691
│ │ │ │ -
692
│ │ │ │ -
694 template<class M, class X, class PI, class A>
│ │ │ │ -
│ │ │ │ -
695 void FastAMG<M,X,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ │ -
696 {
│ │ │ │ -
697 lhs_=nullptr;
│ │ │ │ -
698 rhs_=nullptr;
│ │ │ │ -
699 residual_=nullptr;
│ │ │ │ -
700 }
│ │ │ │ -
│ │ │ │ -
701
│ │ │ │ -
702 template<class M, class X, class PI, class A>
│ │ │ │ -
703 template<class A1>
│ │ │ │ -
│ │ │ │ -
704 void FastAMG<M,X,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ │ -
705 {
│ │ │ │ -
706 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ │ -
707 }
│ │ │ │ -
│ │ │ │ -
708
│ │ │ │ -
709 } // end namespace Amg
│ │ │ │ -
710} // end namespace Dune
│ │ │ │ -
711
│ │ │ │ -
712#endif
│ │ │ │ -
Define base class for scalar product and norm.
│ │ │ │ -
Templates characterizing the type of a solver.
│ │ │ │ - │ │ │ │ -
Classes for the generic construction and application of the smoothers.
│ │ │ │ -
Prolongation and restriction for amg.
│ │ │ │ -
Provides a classes representing the hierarchies in AMG.
│ │ │ │ -
Implementations of the inverse operator interface.
│ │ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ -
Classes for using UMFPack with ISTL matrices.
│ │ │ │ -
Define general preconditioner interface.
│ │ │ │ -
Classes for using SuperLU with ISTL matrices.
│ │ │ │ +
8#include <cstddef>
│ │ │ │ +
9
│ │ │ │ +
10namespace Dune
│ │ │ │ +
11{
│ │ │ │ +
12 namespace Amg
│ │ │ │ +
13 {
│ │ │ │ +
14
│ │ │ │ +
15 template<std::size_t level>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
17
│ │ │ │ +
18 template<typename M, typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
19 static void apply(const M& A, X& x, Y& d,
│ │ │ │ +
20 const Y& b)
│ │ │ │ +
21 {
│ │ │ │ +
22 typedef typename M::ConstRowIterator RowIterator;
│ │ │ │ +
23 typedef typename M::ConstColIterator ColIterator;
│ │ │ │ +
24
│ │ │ │ +
25 typename Y::iterator dIter=d.begin();
│ │ │ │ +
26 typename Y::const_iterator bIter=b.begin();
│ │ │ │ +
27 typename X::iterator xIter=x.begin();
│ │ │ │ +
28
│ │ │ │ +
29 for(RowIterator row=A.begin(), end=A.end(); row != end;
│ │ │ │ +
30 ++row, ++dIter, ++xIter, ++bIter)
│ │ │ │ +
31 {
│ │ │ │ +
32 ColIterator col=(*row).begin();
│ │ │ │ +
33 *dIter = *bIter;
│ │ │ │ +
34
│ │ │ │ +
35 for (; col.index()<row.index(); ++col)
│ │ │ │ +
36 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ │ +
37 assert(row.index()==col.index());
│ │ │ │ +
38 ColIterator diag=col; // upper diagonal matrix not needed as x was 0 before.
│ │ │ │ +
39
│ │ │ │ +
40 // Not recursive yet. Just solve with the diagonal
│ │ │ │ +
41 diag->solve(*xIter,*dIter);
│ │ │ │ +
42 *dIter=0; //as r=v
│ │ │ │ +
43
│ │ │ │ +
44 // Update residual for the symmetric case
│ │ │ │ +
45 for(col=(*row).begin(); col.index()<row.index(); ++col)
│ │ │ │ +
46 col->mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ │ +
47 }
│ │ │ │ +
48 }
│ │ │ │ +
│ │ │ │ +
49 };
│ │ │ │ +
│ │ │ │ +
50
│ │ │ │ +
51 template<std::size_t level>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
53
│ │ │ │ +
54 template<typename M, typename X, typename Y>
│ │ │ │ +
│ │ │ │ +
55 static void apply(const M& A, X& x, Y& d,
│ │ │ │ +
56 const Y& b)
│ │ │ │ +
57 {
│ │ │ │ +
58 typedef typename M::ConstRowIterator RowIterator;
│ │ │ │ +
59 typedef typename M::ConstColIterator ColIterator;
│ │ │ │ +
60 typedef typename Y::block_type YBlock;
│ │ │ │ +
61
│ │ │ │ +
62 typename Y::iterator dIter=d.beforeEnd();
│ │ │ │ +
63 typename X::iterator xIter=x.beforeEnd();
│ │ │ │ +
64 typename Y::const_iterator bIter=b.beforeEnd();
│ │ │ │ +
65
│ │ │ │ +
66 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end;
│ │ │ │ +
67 --row, --dIter, --xIter, --bIter)
│ │ │ │ +
68 {
│ │ │ │ +
69 ColIterator endCol=(*row).beforeBegin();
│ │ │ │ +
70 ColIterator col=(*row).beforeEnd();
│ │ │ │ +
71 *dIter = *bIter;
│ │ │ │ +
72
│ │ │ │ +
73 for (; col.index()>row.index(); --col)
│ │ │ │ +
74 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{i>j} a_ij * xnew_j
│ │ │ │ +
75 assert(row.index()==col.index());
│ │ │ │ +
76 ColIterator diag=col;
│ │ │ │ +
77 YBlock v=*dIter;
│ │ │ │ +
78 // upper diagonal matrix
│ │ │ │ +
79 for (--col; col!=endCol; --col)
│ │ │ │ +
80 (*col).mmv(x[col.index()],v); // v -= sum_{j<i} a_ij * xold_j
│ │ │ │ +
81
│ │ │ │ +
82 // Not recursive yet. Just solve with the diagonal
│ │ │ │ +
83 diag->solve(*xIter,v);
│ │ │ │ +
84
│ │ │ │ +
85 *dIter-=v;
│ │ │ │ +
86
│ │ │ │ +
87 // Update residual for the symmetric case
│ │ │ │ +
88 // Skip residual computation as it is not needed.
│ │ │ │ +
89 //for(col=(*row).begin();col.index()<row.index(); ++col)
│ │ │ │ +
90 //col.mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ │ +
91 }
│ │ │ │ +
92 }
│ │ │ │ +
│ │ │ │ +
93 };
│ │ │ │ +
│ │ │ │ +
94 } // end namespace Amg
│ │ │ │ +
95} // end namespace Dune
│ │ │ │ +
96#endif
│ │ │ │
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ -
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ │ -
int iterations
The numbe of iterations to perform.
Definition smoother.hh:47
│ │ │ │ -
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition fastamg.hh:184
│ │ │ │ -
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition fastamg.hh:704
│ │ │ │ -
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition fastamg.hh:188
│ │ │ │ -
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition fastamg.hh:150
│ │ │ │ -
void post(Domain &x)
Clean up.
Definition fastamg.hh:695
│ │ │ │ -
std::size_t maxlevels()
Definition fastamg.hh:481
│ │ │ │ -
X Domain
The domain type.
Definition fastamg.hh:77
│ │ │ │ -
Hierarchy< Domain, A >::Iterator residual
The iterator over the residuals.
Definition fastamg.hh:204
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition fastamg.hh:123
│ │ │ │ -
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:192
│ │ │ │ -
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:476
│ │ │ │ -
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:632
│ │ │ │ -
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition fastamg.hh:200
│ │ │ │ -
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition fastamg.hh:208
│ │ │ │ -
std::size_t level
The level index.
Definition fastamg.hh:212
│ │ │ │ -
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition fastamg.hh:488
│ │ │ │ -
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:427
│ │ │ │ -
FastAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const Parameters &parms, bool symmetric=true)
Construct a new amg with a specific coarse solver.
Definition fastamg.hh:297
│ │ │ │ -
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition fastamg.hh:196
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ │ -
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ │ -
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ -
A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth.
Definition fastamg.hh:60
│ │ │ │ +
Definition fastamgsmoother.hh:16
│ │ │ │
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:19
│ │ │ │ - │ │ │ │ -
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ -
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ │ -
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │ -
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
Sequential SSOR preconditioner.
Definition preconditioners.hh:141
│ │ │ │ -
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
│ │ │ │ -
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ -
Definition solvertype.hh:16
│ │ │ │ +
Definition fastamgsmoother.hh:52
│ │ │ │ +
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:55
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,825 +1,123 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -fastamg.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 (C) 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 │ │ │ │ │ +5#ifndef DUNE_ISTL_FASTAMGSMOOTHER_HH │ │ │ │ │ +6#define DUNE_ISTL_FASTAMGSMOOTHER_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ │ -12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ -15#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ │ -16#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ │ -17#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ │ -21 │ │ │ │ │ -22#include "_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h" │ │ │ │ │ -23 │ │ │ │ │ -32namespace _D_u_n_e │ │ │ │ │ -33{ │ │ │ │ │ -34 namespace Amg │ │ │ │ │ -35 { │ │ │ │ │ -58 template > │ │ │ │ │ -_5_9 class _F_a_s_t_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -60 { │ │ │ │ │ -61 public: │ │ │ │ │ -_6_3 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ │ -_7_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ -_7_2 typedef _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_> _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ │ -_7_4 typedef typename _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ │ -75 │ │ │ │ │ -_7_7 typedef X _D_o_m_a_i_n; │ │ │ │ │ -_7_9 typedef X _R_a_n_g_e; │ │ │ │ │ -_8_1 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_X_> _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ │ -82 │ │ │ │ │ -90 _F_a_s_t_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ │ -91 const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ │ -92 bool symmetric=true); │ │ │ │ │ -93 │ │ │ │ │ -105 template │ │ │ │ │ -106 _F_a_s_t_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ -107 const _P_a_r_a_m_e_t_e_r_s& parms=_P_a_r_a_m_e_t_e_r_s(), │ │ │ │ │ -108 bool symmetric=true, │ │ │ │ │ -109 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()); │ │ │ │ │ -110 │ │ │ │ │ -114 _F_a_s_t_A_M_G(const _F_a_s_t_A_M_G& amg); │ │ │ │ │ -115 │ │ │ │ │ -117 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ │ -118 │ │ │ │ │ -120 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ │ -121 │ │ │ │ │ -_1_2_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -124 { │ │ │ │ │ -125 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; │ │ │ │ │ -126 } │ │ │ │ │ -127 │ │ │ │ │ -129 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ │ -130 │ │ │ │ │ -135 template │ │ │ │ │ -136 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); │ │ │ │ │ -137 │ │ │ │ │ -138 std::size_t _l_e_v_e_l_s(); │ │ │ │ │ -139 │ │ │ │ │ -140 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ │ -141 │ │ │ │ │ -_1_5_0 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ │ -151 { │ │ │ │ │ -152 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ │ -153 } │ │ │ │ │ -154 │ │ │ │ │ -159 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; │ │ │ │ │ -160 │ │ │ │ │ -161 private: │ │ │ │ │ -168 template │ │ │ │ │ -169 void createHierarchies(C& criterion, │ │ │ │ │ -170 const std::shared_ptr& matrixptr, │ │ │ │ │ -171 const PI& pinfo); │ │ │ │ │ -172 │ │ │ │ │ -179 struct LevelContext │ │ │ │ │ -180 { │ │ │ │ │ -_1_8_4 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ │ -_1_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; │ │ │ │ │ -_1_9_2 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ │ -_1_9_6 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ │ -_2_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; │ │ │ │ │ -_2_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 _r_e_s_i_d_u_a_l; │ │ │ │ │ -_2_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; │ │ │ │ │ -_2_1_2 std::size_t _l_e_v_e_l; │ │ │ │ │ -213 }; │ │ │ │ │ -214 │ │ │ │ │ -216 void mgc(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ │ -217 │ │ │ │ │ -224 void presmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ │ -225 │ │ │ │ │ -232 void postsmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ │ -233 │ │ │ │ │ -240 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel, │ │ │ │ │ -241 _D_o_m_a_i_n& fineX); │ │ │ │ │ -242 │ │ │ │ │ -247 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ │ -248 │ │ │ │ │ -253 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ │ -254 │ │ │ │ │ -256 std::shared_ptr matrices_; │ │ │ │ │ -258 std::shared_ptr solver_; │ │ │ │ │ -260 std::shared_ptr> rhs_; │ │ │ │ │ -262 std::shared_ptr> lhs_; │ │ │ │ │ -264 std::shared_ptr> residual_; │ │ │ │ │ -265 │ │ │ │ │ -267 using _S_c_a_l_a_r_P_r_o_d_u_c_t = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ │ -269 std::shared_ptr scalarProduct_; │ │ │ │ │ -271 std::size_t gamma_; │ │ │ │ │ -273 std::size_t preSteps_; │ │ │ │ │ -275 std::size_t postSteps_; │ │ │ │ │ -276 std::size_t level; │ │ │ │ │ -277 bool buildHierarchy_; │ │ │ │ │ -278 bool symmetric; │ │ │ │ │ -279 bool coarsesolverconverged; │ │ │ │ │ -280 typedef _S_e_q_S_S_O_R_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_X_,_X_> _S_m_o_o_t_h_e_r; │ │ │ │ │ -281 typedef std::shared_ptr SmootherPointer; │ │ │ │ │ -282 SmootherPointer coarseSmoother_; │ │ │ │ │ -284 std::size_t verbosity_; │ │ │ │ │ -285 }; │ │ │ │ │ -286 │ │ │ │ │ -287 template │ │ │ │ │ -_2_8_8 _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) │ │ │ │ │ -289 : matrices_(amg.matrices_), solver_(amg.solver_), │ │ │ │ │ -290 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_), │ │ │ │ │ -291 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ │ -292 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ │ -293 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_) │ │ │ │ │ -294 {} │ │ │ │ │ -295 │ │ │ │ │ -296 template │ │ │ │ │ -_2_9_7 _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, │ │ │ │ │ -298 const _P_a_r_a_m_e_t_e_r_s& parms, bool symmetric_) │ │ │ │ │ -299 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver), │ │ │ │ │ -300 rhs_(), lhs_(), residual_(), scalarProduct_(), │ │ │ │ │ -301 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ │ -302 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ │ -303 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ │ -304 coarseSmoother_(), verbosity_(parms.debugLevel()) │ │ │ │ │ -305 { │ │ │ │ │ -306 if(preSteps_>1||postSteps_>1) │ │ │ │ │ -307 { │ │ │ │ │ -308 std::cerr<<"WARNING only one step of smoothing is supported!"<isBuilt()); │ │ │ │ │ -312 static_assert(std::is_same::value, │ │ │ │ │ -313 "Currently only sequential runs are supported"); │ │ │ │ │ -314 } │ │ │ │ │ -315 template │ │ │ │ │ -316 template │ │ │ │ │ -_3_1_7 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(const _O_p_e_r_a_t_o_r& matrix, │ │ │ │ │ -318 const C& criterion, │ │ │ │ │ -319 const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ │ -320 bool symmetric_, │ │ │ │ │ -321 const PI& pinfo) │ │ │ │ │ -322 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_ │ │ │ │ │ -(parms.getGamma()), │ │ │ │ │ -323 preSteps_(parms.getNoPreSmoothSteps()), postSteps_ │ │ │ │ │ -(parms.getNoPostSmoothSteps()), │ │ │ │ │ -324 buildHierarchy_(true), │ │ │ │ │ -325 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ │ -326 coarseSmoother_(), verbosity_(criterion.debugLevel()) │ │ │ │ │ -327 { │ │ │ │ │ -328 if(preSteps_>1||postSteps_>1) │ │ │ │ │ -329 { │ │ │ │ │ -330 std::cerr<<"WARNING only one step of smoothing is supported!"<::value, │ │ │ │ │ -334 "Currently only sequential runs are supported"); │ │ │ │ │ -335 // TODO: reestablish compile time checks. │ │ │ │ │ -336 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ │ -category), │ │ │ │ │ -337 // "Matrix and Solver must match in terms of category!"); │ │ │ │ │ -338 auto matrixptr = stackobject_to_shared_ptr(matrix); │ │ │ │ │ -339 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ │ -340 } │ │ │ │ │ -341 │ │ │ │ │ -342 template │ │ │ │ │ -343 template │ │ │ │ │ -344 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_c_r_e_a_t_e_H_i_e_r_a_r_c_h_i_e_s(C& criterion, │ │ │ │ │ -345 const std::shared_ptr& matrixptr, │ │ │ │ │ -346 const PI& pinfo) │ │ │ │ │ -347 { │ │ │ │ │ -348 Timer watch; │ │ │ │ │ -349 matrices_ = std::make_shared( │ │ │ │ │ -350 std::const_pointer_cast(matrixptr), │ │ │ │ │ -351 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ │ -352 │ │ │ │ │ -353 matrices_->template build >(criterion); │ │ │ │ │ -354 │ │ │ │ │ -355 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ │ -().rank()==0) │ │ │ │ │ -356 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ │ -"<levels()==matrices_->maxlevels()) { │ │ │ │ │ -359 // We have the carsest level. Create the coarse Solver │ │ │ │ │ -360 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; │ │ │ │ │ -361 SmootherArgs sargs; │ │ │ │ │ -362 sargs._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ │ -363 │ │ │ │ │ -364 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; │ │ │ │ │ -365 cargs.setArgs(sargs); │ │ │ │ │ -366 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ │ -367 // Solve on the redistributed partitioning │ │ │ │ │ -368 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ │ -()); │ │ │ │ │ -369 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ -()); │ │ │ │ │ -370 }else{ │ │ │ │ │ -371 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ │ -372 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ │ -373 } │ │ │ │ │ -374 │ │ │ │ │ -375 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); │ │ │ │ │ -376 scalarProduct_ = createScalarProduct(cargs.getComm(),category()); │ │ │ │ │ -377 │ │ │ │ │ -378#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -379#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -380#define DIRECTSOLVER UMFPack │ │ │ │ │ -381#else │ │ │ │ │ -382#define DIRECTSOLVER SuperLU │ │ │ │ │ -383#endif │ │ │ │ │ -384 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ │ -the coarsest level. │ │ │ │ │ -385 if(std::is_same::value / │ │ │ │ │ -/ sequential mode │ │ │ │ │ -386 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ │ -parallel mode and only one processor │ │ │ │ │ -387 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ │ -388 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ -().communicator().size()==1 │ │ │ │ │ -389 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ -().communicator().size()>0)) { // redistribute and 1 proc │ │ │ │ │ -390 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ │ ->communicator().rank()==0) │ │ │ │ │ -391 std::cout<<"Using superlu"<parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ -393 { │ │ │ │ │ -394 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ -395 // We are still participating on this level │ │ │ │ │ -396 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ │ -().coarsest().getRedistributed().getmat(), false, false)); │ │ │ │ │ -397 else │ │ │ │ │ -398 solver_.reset(); │ │ │ │ │ -399 }else │ │ │ │ │ -400 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ │ -().coarsest()->getmat(), false, false)); │ │ │ │ │ -401 }else │ │ │ │ │ -402#undef DIRECTSOLVER │ │ │ │ │ -403#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -404 { │ │ │ │ │ -405 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ -406 { │ │ │ │ │ -407 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ -408 // We are still participating on this level │ │ │ │ │ -409 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ │ -().coarsest().getRedistributed()), │ │ │ │ │ -410 *scalarProduct_, │ │ │ │ │ -411 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ -412 else │ │ │ │ │ -413 solver_.reset(); │ │ │ │ │ -414 }else │ │ │ │ │ -415 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ │ -().coarsest()), │ │ │ │ │ -416 *scalarProduct_, │ │ │ │ │ -417 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ -418 } │ │ │ │ │ -419 } │ │ │ │ │ -420 │ │ │ │ │ -421 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ │ -().rank()==0) │ │ │ │ │ -422 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ │ -"< │ │ │ │ │ -_4_2_7 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) │ │ │ │ │ -428 { │ │ │ │ │ -429 Timer watch, watch1; │ │ │ │ │ -430 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ │ -431 // zero and set x such that A_dd*x_d=b_d │ │ │ │ │ -432 // Thus users can be more careless when setting up their linear │ │ │ │ │ -433 // systems. │ │ │ │ │ -434 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ │ -435 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; │ │ │ │ │ -436 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; │ │ │ │ │ -437 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ │ -438 Block zero; │ │ │ │ │ -439 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ │ -440 │ │ │ │ │ -441 const _M_a_t_r_i_x& _m_a_t=matrices_->matrices().finest()->getmat(); │ │ │ │ │ -442 for(RowIter row=_m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ │ -443 bool isDirichlet = true; │ │ │ │ │ -444 bool hasDiagonal = false; │ │ │ │ │ -445 ColIter diag; │ │ │ │ │ -446 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ │ -447 if(row.index()==_c_o_l.index()) { │ │ │ │ │ -448 diag = _c_o_l; │ │ │ │ │ -449 hasDiagonal = (*_c_o_l != zero); │ │ │ │ │ -450 }else{ │ │ │ │ │ -451 if(*_c_o_l!=zero) │ │ │ │ │ -452 isDirichlet = false; │ │ │ │ │ -453 } │ │ │ │ │ -454 } │ │ │ │ │ -455 if(isDirichlet && hasDiagonal) │ │ │ │ │ -456 diag->solve(x[row.index()], b[row.index()]); │ │ │ │ │ -457 } │ │ │ │ │ -458 if (verbosity_>0) │ │ │ │ │ -459 std::cout<<" Preprocessing Dirichlet took "<parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ │ -463 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ │ -464 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ │ -465 residual_ = std::make_shared>(std::make_shared │ │ │ │ │ -(x)); │ │ │ │ │ -466 matrices_->coarsenVector(*rhs_); │ │ │ │ │ -467 matrices_->coarsenVector(*lhs_); │ │ │ │ │ -468 matrices_->coarsenVector(*residual_); │ │ │ │ │ -469 │ │ │ │ │ -470 // The preconditioner might change x and b. So we have to │ │ │ │ │ -471 // copy the changes to the original vectors. │ │ │ │ │ -472 x = *lhs_->finest(); │ │ │ │ │ -473 b = *rhs_->finest(); │ │ │ │ │ -474 } │ │ │ │ │ -475 template │ │ │ │ │ -_4_7_6 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ │ -477 { │ │ │ │ │ -478 return matrices_->levels(); │ │ │ │ │ -479 } │ │ │ │ │ -480 template │ │ │ │ │ -_4_8_1 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ │ -482 { │ │ │ │ │ -483 return matrices_->maxlevels(); │ │ │ │ │ -484 } │ │ │ │ │ -485 │ │ │ │ │ -487 template │ │ │ │ │ -_4_8_8 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) │ │ │ │ │ -489 { │ │ │ │ │ -490 LevelContext levelContext; │ │ │ │ │ -491 // Init all iterators for the current level │ │ │ │ │ -492 initIteratorsWithFineLevel(levelContext); │ │ │ │ │ -493 │ │ │ │ │ -494 assert(v.two_norm()==0); │ │ │ │ │ -495 │ │ │ │ │ -496 level=0; │ │ │ │ │ -497 if(matrices_->maxlevels()==1){ │ │ │ │ │ -498 // The coarse solver might modify the d! │ │ │ │ │ -499 _R_a_n_g_e b(d); │ │ │ │ │ -500 mgc(levelContext, v, b); │ │ │ │ │ -501 }else │ │ │ │ │ -502 mgc(levelContext, v, d); │ │ │ │ │ -503 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ │ -504 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ │ -505 } │ │ │ │ │ -506 │ │ │ │ │ -507 template │ │ │ │ │ -508 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_i_n_i_t_I_t_e_r_a_t_o_r_s_W_i_t_h_F_i_n_e_L_e_v_e_l(LevelContext& │ │ │ │ │ -levelContext) │ │ │ │ │ -509 { │ │ │ │ │ -510 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ │ -511 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ │ -512 levelContext.redist = │ │ │ │ │ -513 matrices_->redistributeInformation().begin(); │ │ │ │ │ -514 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ │ -515 levelContext.lhs = lhs_->finest(); │ │ │ │ │ -516 levelContext.residual = residual_->finest(); │ │ │ │ │ -517 levelContext.rhs = rhs_->finest(); │ │ │ │ │ -518 levelContext.level=0; │ │ │ │ │ -519 } │ │ │ │ │ -520 │ │ │ │ │ -521 template │ │ │ │ │ -522 bool FastAMG │ │ │ │ │ -523 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ │ -524 { │ │ │ │ │ -525 bool processNextLevel=true; │ │ │ │ │ -526 │ │ │ │ │ -527 if(levelContext.redist->isSetup()) { │ │ │ │ │ -528 throw "bla"; │ │ │ │ │ -529 levelContext.redist->redistribute(static_cast │ │ │ │ │ -(*levelContext.residual), │ │ │ │ │ -530 levelContext.residual.getRedistributed()); │ │ │ │ │ -531 processNextLevel = levelContext.residual.getRedistributed().size()>0; │ │ │ │ │ -532 if(processNextLevel) { │ │ │ │ │ -533 //restrict defect to coarse level right hand side. │ │ │ │ │ -534 ++levelContext.pinfo; │ │ │ │ │ -535 Transfer │ │ │ │ │ -536 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ │ -537 static_cast(levelContext.residual.getRedistributed()), │ │ │ │ │ -538 *levelContext.pinfo); │ │ │ │ │ -539 } │ │ │ │ │ -540 }else{ │ │ │ │ │ -541 //restrict defect to coarse level right hand side. │ │ │ │ │ -542 ++levelContext.rhs; │ │ │ │ │ -543 ++levelContext.pinfo; │ │ │ │ │ -544 Transfer │ │ │ │ │ -545 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ │ -546 static_cast(*levelContext.residual), *levelContext.pinfo); │ │ │ │ │ -547 } │ │ │ │ │ -548 │ │ │ │ │ -549 if(processNextLevel) { │ │ │ │ │ -550 // prepare coarse system │ │ │ │ │ -551 ++levelContext.residual; │ │ │ │ │ -552 ++levelContext.lhs; │ │ │ │ │ -553 ++levelContext.matrix; │ │ │ │ │ -554 ++levelContext.level; │ │ │ │ │ -555 ++levelContext.redist; │ │ │ │ │ -556 │ │ │ │ │ -557 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ ->levels()maxlevels()) { │ │ │ │ │ -558 // next level is not the globally coarsest one │ │ │ │ │ -559 ++levelContext.aggregates; │ │ │ │ │ -560 } │ │ │ │ │ -561 // prepare the lhs on the next level │ │ │ │ │ -562 *levelContext.lhs=0; │ │ │ │ │ -563 *levelContext.residual=0; │ │ │ │ │ -564 } │ │ │ │ │ -565 return processNextLevel; │ │ │ │ │ -566 } │ │ │ │ │ -567 │ │ │ │ │ -568 template │ │ │ │ │ -569 void FastAMG │ │ │ │ │ -570 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, │ │ │ │ │ -Domain& x) │ │ │ │ │ -571 { │ │ │ │ │ -572 if(processNextLevel) { │ │ │ │ │ -573 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ ->levels()maxlevels()) { │ │ │ │ │ -574 // previous level is not the globally coarsest one │ │ │ │ │ -575 --levelContext.aggregates; │ │ │ │ │ -576 } │ │ │ │ │ -577 --levelContext.redist; │ │ │ │ │ -578 --levelContext.level; │ │ │ │ │ -579 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ │ -580 --levelContext.matrix; │ │ │ │ │ -581 --levelContext.residual; │ │ │ │ │ -582 │ │ │ │ │ -583 } │ │ │ │ │ -584 │ │ │ │ │ -585 typename Hierarchy::Iterator coarseLhs = levelContext.lhs--; │ │ │ │ │ -586 if(levelContext.redist->isSetup()) { │ │ │ │ │ -587 │ │ │ │ │ -588 // Need to redistribute during prolongate │ │ │ │ │ -589 Transfer │ │ │ │ │ -590 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ │ -591 levelContext.lhs.getRedistributed(), │ │ │ │ │ -592 matrices_->getProlongationDampingFactor(), │ │ │ │ │ -593 *levelContext.pinfo, *levelContext.redist); │ │ │ │ │ -594 }else{ │ │ │ │ │ -595 Transfer │ │ │ │ │ -596 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ │ -597 matrices_->getProlongationDampingFactor(), *levelContext.pinfo); │ │ │ │ │ -598 │ │ │ │ │ -599 // printvector(std::cout, *lhs, "prolongated coarse grid correction", │ │ │ │ │ -"lhs", 10, 10, 10); │ │ │ │ │ -600 } │ │ │ │ │ -601 │ │ │ │ │ -602 │ │ │ │ │ -603 if(processNextLevel) { │ │ │ │ │ -604 --levelContext.rhs; │ │ │ │ │ -605 } │ │ │ │ │ -606 │ │ │ │ │ -607 } │ │ │ │ │ -608 │ │ │ │ │ -609 │ │ │ │ │ -610 template │ │ │ │ │ -611 void FastAMG │ │ │ │ │ -612 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ │ -613 { │ │ │ │ │ -614 constexpr auto bl = blockLevel(); │ │ │ │ │ -615 _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(), │ │ │ │ │ -616 x, │ │ │ │ │ -617 *levelContext.residual, │ │ │ │ │ -618 b); │ │ │ │ │ -619 } │ │ │ │ │ -620 │ │ │ │ │ -621 template │ │ │ │ │ -622 void FastAMG │ │ │ │ │ -623 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ │ -624 { │ │ │ │ │ -625 constexpr auto bl = blockLevel(); │ │ │ │ │ -626 GaussSeidelPostsmoothDefect │ │ │ │ │ -627 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b); │ │ │ │ │ -628 } │ │ │ │ │ -629 │ │ │ │ │ -630 │ │ │ │ │ -631 template │ │ │ │ │ -_6_3_2 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 │ │ │ │ │ -633 { │ │ │ │ │ -634 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; │ │ │ │ │ -635 } │ │ │ │ │ -636 │ │ │ │ │ -637 template │ │ │ │ │ -638 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_g_c(LevelContext& levelContext, Domain& v, const │ │ │ │ │ -Range& b){ │ │ │ │ │ -639 │ │ │ │ │ -640 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ │ -()==maxlevels()) { │ │ │ │ │ -641 // Solve directly │ │ │ │ │ -642 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ -643 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ │ -644 if(levelContext.redist->isSetup()) { │ │ │ │ │ -645 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed()); │ │ │ │ │ -646 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ │ -647 // We are still participating in the computation │ │ │ │ │ -648 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ │ -(levelContext.rhs.getRedistributed(), │ │ │ │ │ -649 levelContext.rhs.getRedistributed()); │ │ │ │ │ -650 solver_->apply(levelContext.lhs.getRedistributed(), │ │ │ │ │ -levelContext.rhs.getRedistributed(), res); │ │ │ │ │ -651 } │ │ │ │ │ -652 levelContext.redist->redistributeBackward(v, │ │ │ │ │ -levelContext.lhs.getRedistributed()); │ │ │ │ │ -653 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ │ -654 }else{ │ │ │ │ │ -655 levelContext.pinfo->copyOwnerToAll(b, b); │ │ │ │ │ -656 solver_->apply(v, const_cast(b), res); │ │ │ │ │ -657 } │ │ │ │ │ -658 │ │ │ │ │ -659 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10); │ │ │ │ │ -660 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10); │ │ │ │ │ -661 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ │ -662 coarsesolverconverged = false; │ │ │ │ │ -663 }else{ │ │ │ │ │ -664 // presmoothing │ │ │ │ │ -665 _p_r_e_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ │ -666 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10); │ │ │ │ │ -667 // printvector(std::cout, *residual, "post presmooth residual", "r", 10); │ │ │ │ │ -668#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ │ -669 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ │ -670 │ │ │ │ │ -671 if(processNextLevel) { │ │ │ │ │ -672 // next level │ │ │ │ │ -673 for(std::size_t i=0; imatrices().finest()) { │ │ │ │ │ -683 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ │ ->communicator().prod(coarsesolverconverged); │ │ │ │ │ -684 if(!coarsesolverconverged) │ │ │ │ │ -685 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ │ -686 } │ │ │ │ │ -687 │ │ │ │ │ -688 _p_o_s_t_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ │ -689 } │ │ │ │ │ -690 } │ │ │ │ │ -691 │ │ │ │ │ -692 │ │ │ │ │ -694 template │ │ │ │ │ -_6_9_5 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) │ │ │ │ │ -696 { │ │ │ │ │ -697 lhs_=nullptr; │ │ │ │ │ -698 rhs_=nullptr; │ │ │ │ │ -699 residual_=nullptr; │ │ │ │ │ -700 } │ │ │ │ │ -701 │ │ │ │ │ -702 template │ │ │ │ │ -703 template │ │ │ │ │ -_7_0_4 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) │ │ │ │ │ -705 { │ │ │ │ │ -706 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ │ -707 } │ │ │ │ │ -708 │ │ │ │ │ -709 } // end namespace Amg │ │ │ │ │ -710} // end namespace Dune │ │ │ │ │ -711 │ │ │ │ │ -712#endif │ │ │ │ │ -_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ │ -_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h │ │ │ │ │ -_s_m_o_o_t_h_e_r_._h_h │ │ │ │ │ -Classes for the generic construction and application of the smoothers. │ │ │ │ │ -_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_o_l_v_e_r_s_._h_h │ │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ │ -_i_o_._h_h │ │ │ │ │ -Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ -_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. │ │ │ │ │ -_s_u_p_e_r_l_u_._h_h │ │ │ │ │ -Classes for using SuperLU with ISTL matrices. │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e │ │ │ │ │ +11{ │ │ │ │ │ +12 namespace Amg │ │ │ │ │ +13 { │ │ │ │ │ +14 │ │ │ │ │ +15 template │ │ │ │ │ +_1_6 struct _G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t { │ │ │ │ │ +17 │ │ │ │ │ +18 template │ │ │ │ │ +_1_9 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ │ +20 const Y& b) │ │ │ │ │ +21 { │ │ │ │ │ +22 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ │ +23 typedef typename M::ConstColIterator ColIterator; │ │ │ │ │ +24 │ │ │ │ │ +25 typename Y::iterator dIter=d.begin(); │ │ │ │ │ +26 typename Y::const_iterator bIter=b.begin(); │ │ │ │ │ +27 typename X::iterator xIter=x.begin(); │ │ │ │ │ +28 │ │ │ │ │ +29 for(RowIterator row=A.begin(), end=A.end(); row != end; │ │ │ │ │ +30 ++row, ++dIter, ++xIter, ++bIter) │ │ │ │ │ +31 { │ │ │ │ │ +32 ColIterator _c_o_l=(*row).begin(); │ │ │ │ │ +33 *dIter = *bIter; │ │ │ │ │ +34 │ │ │ │ │ +35 for (; _c_o_l.index()solve(*xIter,*dIter); │ │ │ │ │ +42 *dIter=0; //as r=v │ │ │ │ │ +43 │ │ │ │ │ +44 // Update residual for the symmetric case │ │ │ │ │ +45 for(_c_o_l=(*row).begin(); _c_o_l.index()mmv(*xIter, d[_c_o_l.index()]); //d_j-=A_ij x_i │ │ │ │ │ +47 } │ │ │ │ │ +48 } │ │ │ │ │ +49 }; │ │ │ │ │ +50 │ │ │ │ │ +51 template │ │ │ │ │ +_5_2 struct _G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t { │ │ │ │ │ +53 │ │ │ │ │ +54 template │ │ │ │ │ +_5_5 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ │ +56 const Y& b) │ │ │ │ │ +57 { │ │ │ │ │ +58 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ │ +59 typedef typename M::ConstColIterator ColIterator; │ │ │ │ │ +60 typedef typename Y::block_type YBlock; │ │ │ │ │ +61 │ │ │ │ │ +62 typename Y::iterator dIter=d.beforeEnd(); │ │ │ │ │ +63 typename X::iterator xIter=x.beforeEnd(); │ │ │ │ │ +64 typename Y::const_iterator bIter=b.beforeEnd(); │ │ │ │ │ +65 │ │ │ │ │ +66 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end; │ │ │ │ │ +67 --row, --dIter, --xIter, --bIter) │ │ │ │ │ +68 { │ │ │ │ │ +69 ColIterator endCol=(*row).beforeBegin(); │ │ │ │ │ +70 ColIterator _c_o_l=(*row).beforeEnd(); │ │ │ │ │ +71 *dIter = *bIter; │ │ │ │ │ +72 │ │ │ │ │ +73 for (; _c_o_l.index()>row.index(); --_c_o_l) │ │ │ │ │ +74 (*col).mmv(x[_c_o_l.index()],*dIter); // rhs -= sum_{i>j} a_ij * xnew_j │ │ │ │ │ +75 assert(row.index()==_c_o_l.index()); │ │ │ │ │ +76 ColIterator diag=_c_o_l; │ │ │ │ │ +77 YBlock v=*dIter; │ │ │ │ │ +78 // upper diagonal matrix │ │ │ │ │ +79 for (--_c_o_l; _c_o_l!=endCol; --_c_o_l) │ │ │ │ │ +80 (*col).mmv(x[_c_o_l.index()],v); // v -= sum_{jsolve(*xIter,v); │ │ │ │ │ +84 │ │ │ │ │ +85 *dIter-=v; │ │ │ │ │ +86 │ │ │ │ │ +87 // Update residual for the symmetric case │ │ │ │ │ +88 // Skip residual computation as it is not needed. │ │ │ │ │ +89 //for(col=(*row).begin();col.index() construct(Arguments &args) │ │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ │ -void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ -Apply post smoothing on the current level. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ │ -int iterations │ │ │ │ │ -The numbe of iterations to perform. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_m_a_t_r_i_x │ │ │ │ │ -OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix │ │ │ │ │ -The iterator over the matrices. │ │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:184 │ │ │ │ │ -_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:704 │ │ │ │ │ -_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:188 │ │ │ │ │ -_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:150 │ │ │ │ │ -_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:695 │ │ │ │ │ -_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:481 │ │ │ │ │ -_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:204 │ │ │ │ │ -_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:123 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ │ -MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy │ │ │ │ │ -The operator hierarchy type. │ │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_d_i_s_t │ │ │ │ │ -OperatorHierarchy::RedistributeInfoList::const_iterator redist │ │ │ │ │ -The iterator over the redistribution information. │ │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:192 │ │ │ │ │ -_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:476 │ │ │ │ │ -_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:632 │ │ │ │ │ -_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:200 │ │ │ │ │ -_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:208 │ │ │ │ │ -_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:212 │ │ │ │ │ -_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:488 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ -OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ │ -The parallal data distribution hierarchy type. │ │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_p_r_e │ │ │ │ │ -void pre(Domain &x, Range &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:427 │ │ │ │ │ -_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:297 │ │ │ │ │ -_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:196 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ │ -Export the type representing the underlying field. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -row_type::const_iterator ConstColIterator │ │ │ │ │ -Const iterator for the entries of each row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -T block_type │ │ │ │ │ -Export the type representing the components. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:568 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G │ │ │ │ │ -A fast (sequential) algebraic multigrid based on agglomeration that saves │ │ │ │ │ -memory bandwidth. │ │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t │ │ │ │ │ +DDeeffiinniittiioonn fastamgsmoother.hh:16 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ │ static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ │ DDeeffiinniittiioonn fastamgsmoother.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ │ -> Iterator │ │ │ │ │ -Type of the mutable iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator over the levels in the hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ -The hierarchies build by the coarsening process. │ │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -All parameters for AMG. │ │ │ │ │ -DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ -The default class for the smoother arguments. │ │ │ │ │ -DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R │ │ │ │ │ -Sequential SSOR preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:141 │ │ │ │ │ -_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:48 │ │ │ │ │ -_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:73 │ │ │ │ │ -_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:99 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ -Category │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ │ -@ sequential │ │ │ │ │ -Category for sequential solvers. │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t │ │ │ │ │ +DDeeffiinniittiioonn fastamgsmoother.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ │ +static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ │ +DDeeffiinniittiioonn fastamgsmoother.hh:55 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00140.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
#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>
│ │ │ │ +#include <dune/istl/solvercategory.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00140_source.html │ │ │ │ @@ -97,15 +97,15 @@ │ │ │ │
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
│ │ │ │
│ │ │ │ │ │ │ │ @@ -207,15 +207,15 @@ │ │ │ │
99 };
│ │ │ │
│ │ │ │
100
│ │ │ │
101
│ │ │ │
102 } // namespace Amg
│ │ │ │
103} //namespace Dune
│ │ │ │
104#endif
│ │ │ │ - │ │ │ │ + │ │ │ │
Definition allocator.hh:11
│ │ │ │
Definition pinfo.hh:28
│ │ │ │
SequentialInformation()
Definition pinfo.hh:91
│ │ │ │
T globalSum(const T &t) const
Definition pinfo.hh:49
│ │ │ │
void dot(const T1 &, const T1 &, T2 &) const
Definition pinfo.hh:74
│ │ │ │
EmptySet< int > CopyFlags
Definition pinfo.hh:31
│ │ │ │
AllSet< int > OwnerSet
Definition pinfo.hh:32
│ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00143.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: graphcreator.hh File Reference │ │ │ │ +dune-istl: twolevelmethod.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,40 +72,52 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
graphcreator.hh File Reference
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ + │ │ │ │ +

Algebraic twolevel methods. │ │ │ │ +More...

│ │ │ │
#include <tuple>
│ │ │ │ -#include "graph.hh"
│ │ │ │ -#include "dependency.hh"
│ │ │ │ -#include "pinfo.hh"
│ │ │ │ -#include <dune/istl/operators.hh>
│ │ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ +#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

class  Dune::Amg::SequentialInformation
 
│ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  Dune::Amg::PropertiesGraphCreator< M, PI >
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...
 
struct  Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >
class  Dune::Amg::TwoLevelMethod< FO, CSP, S >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ +

Algebraic twolevel methods.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,27 +2,43 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -graphcreator.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 │ │ │ │ │ +Algebraic twolevel methods. _M_o_r_e_._._. │ │ │ │ │ #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 "_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_:_:_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_ _> │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_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 ********** │ │ │ │ │ +Algebraic twolevel methods. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00143_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: graphcreator.hh Source File │ │ │ │ +dune-istl: twolevelmethod.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,152 +74,478 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
graphcreator.hh
│ │ │ │ +
twolevelmethod.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_TWOLEVELMETHOD_HH
│ │ │ │ +
6#define DUNE_ISTL_TWOLEVELMETHOD_HH
│ │ │ │
7
│ │ │ │
8#include <tuple>
│ │ │ │
9
│ │ │ │ -
10#include "graph.hh"
│ │ │ │ -
11#include "dependency.hh"
│ │ │ │ -
12#include "pinfo.hh"
│ │ │ │ - │ │ │ │ - │ │ │ │ -
15
│ │ │ │ -
16namespace Dune
│ │ │ │ -
17{
│ │ │ │ -
18 namespace Amg
│ │ │ │ -
19 {
│ │ │ │ -
20 template<class M, class PI>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
22 {
│ │ │ │ -
23 typedef typename M::matrix_type Matrix;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
26 std::vector<bool> > SubGraph;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
30 IdentityMap,
│ │ │ │ - │ │ │ │ - │ │ │ │ -
33
│ │ │ │ -
34 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
│ │ │ │ -
35
│ │ │ │ -
36 template<class OF, class T>
│ │ │ │ -
│ │ │ │ -
37 static GraphTuple create(const M& matrix, T& excluded,
│ │ │ │ -
38 PI& pinfo, const OF& of)
│ │ │ │ -
39 {
│ │ │ │ -
40 MatrixGraph* mg = new MatrixGraph(matrix.getmat());
│ │ │ │ -
41 typedef typename PI::ParallelIndexSet ParallelIndexSet;
│ │ │ │ -
42 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ │ -
43 IndexIterator iend = pinfo.indexSet().end();
│ │ │ │ -
44
│ │ │ │ -
45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
│ │ │ │ -
46 excluded[index->local()] = of.contains(index->local().attribute());
│ │ │ │ -
47
│ │ │ │ -
48 SubGraph* sg= new SubGraph(*mg, excluded);
│ │ │ │ -
49 PropertiesGraph* pg = new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
│ │ │ │ -
50 return GraphTuple(mg,pg,sg);
│ │ │ │ -
51 }
│ │ │ │ -
│ │ │ │ -
52
│ │ │ │ -
│ │ │ │ -
53 static void free(GraphTuple& graphs)
│ │ │ │ -
54 {
│ │ │ │ -
55 delete std::get<2>(graphs);
│ │ │ │ -
56 delete std::get<1>(graphs);
│ │ │ │ -
57 }
│ │ │ │ -
│ │ │ │ -
58 };
│ │ │ │ -
│ │ │ │ -
59
│ │ │ │ -
60 template<class M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
62 {
│ │ │ │ -
63 typedef typename M::matrix_type Matrix;
│ │ │ │ -
64
│ │ │ │ - │ │ │ │ -
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.
│ │ │ │ + │ │ │ │ +
11#include"amg.hh"
│ │ │ │ +
12#include"galerkin.hh"
│ │ │ │ +
13#include<dune/istl/solver.hh>
│ │ │ │ +
14
│ │ │ │ +
22namespace Dune
│ │ │ │ +
23{
│ │ │ │ +
24namespace Amg
│ │ │ │ +
25{
│ │ │ │ +
26
│ │ │ │ +
36template<class FO, class CO>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
38{
│ │ │ │ +
39public:
│ │ │ │ +
44 typedef FO FineOperatorType;
│ │ │ │ +
48 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ │ +
52 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ │ + │ │ │ │ +
61 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ │ +
65 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ │ +
│ │ │ │ +
70 std::shared_ptr<CoarseOperatorType>& getCoarseLevelOperator()
│ │ │ │ +
71 {
│ │ │ │ +
72 return operator_;
│ │ │ │ +
73 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
79 {
│ │ │ │ +
80 return rhs_;
│ │ │ │ +
81 }
│ │ │ │ +
│ │ │ │ +
82
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
88 {
│ │ │ │ +
89 return lhs_;
│ │ │ │ +
90 }
│ │ │ │ +
│ │ │ │ +
100 virtual void moveToCoarseLevel(const FineRangeType& fineRhs)=0;
│ │ │ │ +
110 virtual void moveToFineLevel(FineDomainType& fineLhs)=0;
│ │ │ │ +
118 virtual void createCoarseLevelSystem(const FineOperatorType& fineOperator)=0;
│ │ │ │ +
119
│ │ │ │ +
121 virtual LevelTransferPolicy* clone() const =0;
│ │ │ │ +
122
│ │ │ │ + │ │ │ │ +
125
│ │ │ │ +
126 protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
132 std::shared_ptr<CoarseOperatorType> operator_;
│ │ │ │ +
133};
│ │ │ │ +
│ │ │ │ +
134
│ │ │ │ +
140template<class O, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
142 : public LevelTransferPolicy<O,O>
│ │ │ │ +
143{
│ │ │ │ + │ │ │ │ +
145public:
│ │ │ │ + │ │ │ │ +
147 typedef C Criterion;
│ │ │ │ + │ │ │ │ +
149
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
151 : criterion_(crit)
│ │ │ │ +
152 {}
│ │ │ │ +
│ │ │ │ +
153
│ │ │ │ +
│ │ │ │ +
154 void createCoarseLevelSystem(const O& fineOperator)
│ │ │ │ +
155 {
│ │ │ │ +
156 prolongDamp_ = criterion_.getProlongationDampingFactor();
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
160 Dune::Amg::EdgeProperties,Dune::IdentityMap,Dune::IdentityMap> PropertiesGraph;
│ │ │ │ +
161 MatrixGraph mg(fineOperator.getmat());
│ │ │ │ +
162 PropertiesGraph pg(mg,Dune::IdentityMap(),Dune::IdentityMap());
│ │ │ │ +
163 typedef NegateSet<typename ParallelInformation::OwnerSet> OverlapFlags;
│ │ │ │ +
164
│ │ │ │ +
165 aggregatesMap_ = std::make_shared<AggregatesMap>(pg.maxVertex()+1);
│ │ │ │ +
166
│ │ │ │ +
167 int noAggregates, isoAggregates, oneAggregates, skippedAggregates;
│ │ │ │ +
168
│ │ │ │ +
169 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) =
│ │ │ │ +
170 aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, true);
│ │ │ │ +
171 std::cout<<"no aggregates="<<noAggregates<<" iso="<<isoAggregates<<" one="<<oneAggregates<<" skipped="<<skippedAggregates<<std::endl;
│ │ │ │ +
172 // misuse coarsener to renumber aggregates
│ │ │ │ + │ │ │ │ +
174 typedef std::vector<bool>::iterator Iterator;
│ │ │ │ +
175 typedef Dune::IteratorPropertyMap<Iterator, Dune::IdentityMap> VisitedMap;
│ │ │ │ +
176 std::vector<bool> excluded(fineOperator.getmat().N(), false);
│ │ │ │ +
177 VisitedMap vm(excluded.begin(), Dune::IdentityMap());
│ │ │ │ + │ │ │ │ +
179 std::size_t aggregates = renumberer.coarsen(pinfo, pg, vm,
│ │ │ │ +
180 *aggregatesMap_, pinfo,
│ │ │ │ +
181 noAggregates);
│ │ │ │ +
182 std::vector<bool>& visited=excluded;
│ │ │ │ +
183
│ │ │ │ +
184 typedef std::vector<bool>::iterator Iterator;
│ │ │ │ +
185
│ │ │ │ +
186 for(Iterator iter= visited.begin(), end=visited.end();
│ │ │ │ +
187 iter != end; ++iter)
│ │ │ │ +
188 *iter=false;
│ │ │ │ +
189 matrix_.reset(productBuilder.build(mg, vm,
│ │ │ │ + │ │ │ │ +
191 *aggregatesMap_,
│ │ │ │ +
192 aggregates,
│ │ │ │ +
193 OverlapFlags()));
│ │ │ │ +
194 productBuilder.calculate(fineOperator.getmat(), *aggregatesMap_, *matrix_, pinfo, OverlapFlags());
│ │ │ │ +
195 this->lhs_.resize(this->matrix_->M());
│ │ │ │ +
196 this->rhs_.resize(this->matrix_->N());
│ │ │ │ +
197 this->operator_ = std::make_shared<O>(*matrix_);
│ │ │ │ +
198 }
│ │ │ │ +
│ │ │ │ +
199
│ │ │ │ +
│ │ │ │ +
200 void moveToCoarseLevel(const typename FatherType::FineRangeType& fineRhs)
│ │ │ │ +
201 {
│ │ │ │ + │ │ │ │ +
203 ::restrictVector(*aggregatesMap_, this->rhs_, fineRhs, ParallelInformation());
│ │ │ │ +
204 this->lhs_=0;
│ │ │ │ +
205 }
│ │ │ │ +
│ │ │ │ +
206
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
208 {
│ │ │ │ + │ │ │ │ +
210 ::prolongateVector(*aggregatesMap_, this->lhs_, fineLhs,
│ │ │ │ +
211 prolongDamp_, ParallelInformation());
│ │ │ │ +
212 }
│ │ │ │ +
│ │ │ │ +
213
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
215 {
│ │ │ │ +
216 return new AggregationLevelTransferPolicy(*this);
│ │ │ │ +
217 }
│ │ │ │ +
│ │ │ │ +
218
│ │ │ │ +
219private:
│ │ │ │ +
220 typename O::matrix_type::field_type prolongDamp_;
│ │ │ │ +
221 std::shared_ptr<AggregatesMap> aggregatesMap_;
│ │ │ │ +
222 Criterion criterion_;
│ │ │ │ +
223 std::shared_ptr<typename O::matrix_type> matrix_;
│ │ │ │ +
224};
│ │ │ │ +
│ │ │ │ +
225
│ │ │ │ +
232template<class O, class S, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
234{
│ │ │ │ +
235public:
│ │ │ │ +
237 typedef O Operator;
│ │ │ │ +
239 typedef typename O::range_type X;
│ │ │ │ +
241 typedef C Criterion;
│ │ │ │ +
243 typedef S Smoother;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
254 : smootherArgs_(args), criterion_(c)
│ │ │ │ +
255 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
258 : coarseOperator_(other.coarseOperator_), smootherArgs_(other.smootherArgs_),
│ │ │ │ +
259 criterion_(other.criterion_)
│ │ │ │ +
260 {}
│ │ │ │ +
│ │ │ │ +
261private:
│ │ │ │ +
268 struct AMGInverseOperator : public InverseOperator<X,X>
│ │ │ │ +
269 {
│ │ │ │ +
270 AMGInverseOperator(const typename AMGType::Operator& op,
│ │ │ │ +
271 const Criterion& crit,
│ │ │ │ +
272 const typename AMGType::SmootherArgs& args)
│ │ │ │ +
273 : amg_(op, crit,args), first_(true)
│ │ │ │ +
274 {}
│ │ │ │ +
275
│ │ │ │ +
276 void apply(X& x, X& b, [[maybe_unused]] double reduction, [[maybe_unused]] InverseOperatorResult& res)
│ │ │ │ +
277 {
│ │ │ │ +
278 if(first_)
│ │ │ │ +
279 {
│ │ │ │ +
280 amg_.pre(x,b);
│ │ │ │ +
281 first_=false;
│ │ │ │ +
282 x_=x;
│ │ │ │ +
283 }
│ │ │ │ +
284 amg_.apply(x,b);
│ │ │ │ +
285 }
│ │ │ │ +
286
│ │ │ │ +
287 void apply(X& x, X& b, InverseOperatorResult& res)
│ │ │ │ +
288 {
│ │ │ │ +
289 return apply(x,b,1e-8,res);
│ │ │ │ +
290 }
│ │ │ │ +
291
│ │ │ │ +
293 virtual SolverCategory::Category category() const
│ │ │ │ +
294 {
│ │ │ │ +
295 return amg_.category();
│ │ │ │ +
296 }
│ │ │ │ +
297
│ │ │ │ +
298 ~AMGInverseOperator()
│ │ │ │ +
299 {
│ │ │ │ +
300 if(!first_)
│ │ │ │ +
301 amg_.post(x_);
│ │ │ │ +
302 }
│ │ │ │ +
303 AMGInverseOperator(const AMGInverseOperator& other)
│ │ │ │ +
304 : x_(other.x_), amg_(other.amg_), first_(other.first_)
│ │ │ │ +
305 {
│ │ │ │ +
306 }
│ │ │ │ +
307 private:
│ │ │ │ +
308 X x_;
│ │ │ │ +
309 AMGType amg_;
│ │ │ │ +
310 bool first_;
│ │ │ │ +
311 };
│ │ │ │ +
312
│ │ │ │ +
313public:
│ │ │ │ +
315 typedef AMGInverseOperator CoarseLevelSolver;
│ │ │ │ +
316
│ │ │ │ +
324 template<class P>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
326 {
│ │ │ │ +
327 coarseOperator_=transferPolicy.getCoarseLevelOperator();
│ │ │ │ +
328 AMGInverseOperator* inv = new AMGInverseOperator(*coarseOperator_,
│ │ │ │ +
329 criterion_,
│ │ │ │ +
330 smootherArgs_);
│ │ │ │ +
331
│ │ │ │ +
332 return inv; //std::shared_ptr<InverseOperator<X,X> >(inv);
│ │ │ │ +
333
│ │ │ │ +
334 }
│ │ │ │ +
│ │ │ │ +
335
│ │ │ │ +
336private:
│ │ │ │ +
338 std::shared_ptr<Operator> coarseOperator_;
│ │ │ │ +
340 SmootherArgs smootherArgs_;
│ │ │ │ +
342 Criterion criterion_;
│ │ │ │ +
343};
│ │ │ │ +
│ │ │ │ +
344
│ │ │ │ +
350template<class FO, class CSP, class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
352 public Preconditioner<typename FO::domain_type, typename FO::range_type>
│ │ │ │ +
353{
│ │ │ │ +
354public:
│ │ │ │ + │ │ │ │ +
358 typedef typename CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver;
│ │ │ │ + │ │ │ │ +
367 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ │ +
371 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ │ +
376 typedef typename CSP::Operator CoarseOperatorType;
│ │ │ │ +
380 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ │ +
384 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ │ +
388 typedef S SmootherType;
│ │ │ │ +
389
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
405 std::shared_ptr<SmootherType> smoother,
│ │ │ │ + │ │ │ │ +
407 CoarseOperatorType>& policy,
│ │ │ │ +
408 CoarseLevelSolverPolicy& coarsePolicy,
│ │ │ │ +
409 std::size_t preSteps=1, std::size_t postSteps=1)
│ │ │ │ +
410 : operator_(&op), smoother_(smoother),
│ │ │ │ +
411 preSteps_(preSteps), postSteps_(postSteps)
│ │ │ │ +
412 {
│ │ │ │ +
413 policy_ = policy.clone();
│ │ │ │ +
414 policy_->createCoarseLevelSystem(*operator_);
│ │ │ │ +
415 coarseSolver_=coarsePolicy.createCoarseLevelSolver(*policy_);
│ │ │ │ +
416 }
│ │ │ │ +
│ │ │ │ +
417
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
419 : operator_(other.operator_), coarseSolver_(new CoarseLevelSolver(*other.coarseSolver_)),
│ │ │ │ +
420 smoother_(other.smoother_), policy_(other.policy_->clone()),
│ │ │ │ +
421 preSteps_(other.preSteps_), postSteps_(other.postSteps_)
│ │ │ │ +
422 {}
│ │ │ │ +
│ │ │ │ +
423
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
425 {
│ │ │ │ +
426 // Each instance has its own policy.
│ │ │ │ +
427 delete policy_;
│ │ │ │ +
428 delete coarseSolver_;
│ │ │ │ +
429 }
│ │ │ │ +
│ │ │ │ +
430
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
432 {
│ │ │ │ +
433 smoother_->pre(x,b);
│ │ │ │ +
434 }
│ │ │ │ +
│ │ │ │ +
435
│ │ │ │ +
│ │ │ │ +
436 void post([[maybe_unused]] FineDomainType& x)
│ │ │ │ +
437 {}
│ │ │ │ +
│ │ │ │ +
438
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
440 {
│ │ │ │ +
441 FineDomainType u(v);
│ │ │ │ +
442 FineRangeType rhs(d);
│ │ │ │ +
443 LevelContext context;
│ │ │ │ + │ │ │ │ +
445 context.pinfo=&info;
│ │ │ │ +
446 context.lhs=&u;
│ │ │ │ +
447 context.update=&v;
│ │ │ │ +
448 context.smoother=smoother_;
│ │ │ │ +
449 context.rhs=&rhs;
│ │ │ │ +
450 context.matrix=operator_;
│ │ │ │ +
451 // Presmoothing
│ │ │ │ +
452 presmooth(context, preSteps_);
│ │ │ │ +
453 //Coarse grid correction
│ │ │ │ +
454 policy_->moveToCoarseLevel(*context.rhs);
│ │ │ │ + │ │ │ │ +
456 coarseSolver_->apply(policy_->getCoarseLevelLhs(), policy_->getCoarseLevelRhs(), res);
│ │ │ │ +
457 *context.lhs=0;
│ │ │ │ +
458 policy_->moveToFineLevel(*context.lhs);
│ │ │ │ +
459 *context.update += *context.lhs;
│ │ │ │ +
460 // Postsmoothing
│ │ │ │ +
461 postsmooth(context, postSteps_);
│ │ │ │ +
462
│ │ │ │ +
463 }
│ │ │ │ +
│ │ │ │ +
464
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
467 {
│ │ │ │ + │ │ │ │ +
469 }
│ │ │ │ +
│ │ │ │ +
470
│ │ │ │ +
471private:
│ │ │ │ +
475 struct LevelContext
│ │ │ │ +
476 {
│ │ │ │ +
478 typedef S SmootherType;
│ │ │ │ +
480 std::shared_ptr<SmootherType> smoother;
│ │ │ │ +
482 FineDomainType* lhs;
│ │ │ │ +
483 /*
│ │ │ │ +
484 * @brief The right hand side holding the current residual.
│ │ │ │ +
485 *
│ │ │ │ +
486 * This is passed to the smoother as the right hand side.
│ │ │ │ +
487 */
│ │ │ │ +
488 FineRangeType* rhs;
│ │ │ │ +
494 FineDomainType* update;
│ │ │ │ + │ │ │ │ +
502 const FineOperatorType* matrix;
│ │ │ │ +
503 };
│ │ │ │ +
504 const FineOperatorType* operator_;
│ │ │ │ +
506 CoarseLevelSolver* coarseSolver_;
│ │ │ │ +
508 std::shared_ptr<S> smoother_;
│ │ │ │ +
510 LevelTransferPolicy<FO,typename CSP::Operator>* policy_;
│ │ │ │ +
512 std::size_t preSteps_;
│ │ │ │ +
514 std::size_t postSteps_;
│ │ │ │ +
515};
│ │ │ │ +
│ │ │ │ +
516}// end namespace Amg
│ │ │ │ +
517}// end namespace Dune
│ │ │ │ +
518
│ │ │ │ +
520#endif
│ │ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ +
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ │ +
The AMG preconditioner.
│ │ │ │ +
Define general, extensible interface for inverse operators.
│ │ │ │ +
G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation &pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::Matrix::size_type &size, const Set &copy)
Calculates the coarse matrix via a Galerkin product.
Definition galerkin.hh:563
│ │ │ │ +
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ │ +
Operator Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ │ +
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ │ +
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ │ +
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ +
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ │
Class representing the properties of an ede 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
│ │ │ │ -
A subgraph of a graph.
Definition graph.hh:443
│ │ │ │ -
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
│ │ │ │ -
An index map for mapping the edges to indices.
Definition graph.hh:470
│ │ │ │
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ │ -
Definition graphcreator.hh:22
│ │ │ │ -
Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph
Definition graphcreator.hh:26
│ │ │ │ -
Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph
Definition graphcreator.hh:32
│ │ │ │ -
M::matrix_type Matrix
Definition graphcreator.hh:23
│ │ │ │ -
static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of)
Definition graphcreator.hh:37
│ │ │ │ -
static void free(GraphTuple &graphs)
Definition graphcreator.hh:53
│ │ │ │ -
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:24
│ │ │ │ -
std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple
Definition graphcreator.hh:34
│ │ │ │ -
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:65
│ │ │ │ -
M::matrix_type Matrix
Definition graphcreator.hh:63
│ │ │ │ -
Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, IdentityMap, IdentityMap > PropertiesGraph
Definition graphcreator.hh:71
│ │ │ │ -
std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple
Definition graphcreator.hh:73
│ │ │ │ -
static GraphTuple create(const M &matrix, T &excluded, const SequentialInformation &pinfo, const OF &)
Definition graphcreator.hh:76
│ │ │ │ -
static void free(GraphTuple &graphs)
Definition graphcreator.hh:86
│ │ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ │ +
Definition indicescoarsener.hh:36
│ │ │ │
Definition pinfo.hh:28
│ │ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ +
Definition transfer.hh:32
│ │ │ │ +
Abstract base class for transfer between levels and creation of the coarse level system.
Definition twolevelmethod.hh:38
│ │ │ │ +
CO CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:57
│ │ │ │ +
virtual void moveToCoarseLevel(const FineRangeType &fineRhs)=0
Transfers the data to the coarse level.
│ │ │ │ +
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:48
│ │ │ │ +
virtual void createCoarseLevelSystem(const FineOperatorType &fineOperator)=0
Algebraically creates the coarse level system.
│ │ │ │ +
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:61
│ │ │ │ +
virtual ~LevelTransferPolicy()
Destructor.
Definition twolevelmethod.hh:124
│ │ │ │ +
CoarseDomainType lhs_
The coarse level lhs.
Definition twolevelmethod.hh:130
│ │ │ │ +
virtual LevelTransferPolicy * clone() const =0
Clone the current object.
│ │ │ │ +
CoarseDomainType & getCoarseLevelLhs()
Get the coarse level left hand side.
Definition twolevelmethod.hh:87
│ │ │ │ +
std::shared_ptr< CoarseOperatorType > operator_
the coarse level linear operator.
Definition twolevelmethod.hh:132
│ │ │ │ +
CoarseRangeType rhs_
The coarse level rhs.
Definition twolevelmethod.hh:128
│ │ │ │ +
virtual void moveToFineLevel(FineDomainType &fineLhs)=0
Updates the fine level linear system after the correction of the coarse levels system.
│ │ │ │ +
std::shared_ptr< CoarseOperatorType > & getCoarseLevelOperator()
Get the coarse level operator.
Definition twolevelmethod.hh:70
│ │ │ │ +
CoarseRangeType & getCoarseLevelRhs()
Get the coarse level right hand side.
Definition twolevelmethod.hh:78
│ │ │ │ +
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:44
│ │ │ │ +
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:65
│ │ │ │ +
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:52
│ │ │ │ +
A LeveTransferPolicy that used aggregation to construct the coarse level system.
Definition twolevelmethod.hh:143
│ │ │ │ +
C Criterion
Definition twolevelmethod.hh:147
│ │ │ │ +
AggregationLevelTransferPolicy(const Criterion &crit)
Definition twolevelmethod.hh:150
│ │ │ │ +
AggregationLevelTransferPolicy * clone() const
Clone the current object.
Definition twolevelmethod.hh:214
│ │ │ │ +
void moveToFineLevel(typename FatherType::FineDomainType &fineLhs)
Updates the fine level linear system after the correction of the coarse levels system.
Definition twolevelmethod.hh:207
│ │ │ │ +
void moveToCoarseLevel(const typename FatherType::FineRangeType &fineRhs)
Definition twolevelmethod.hh:200
│ │ │ │ +
SequentialInformation ParallelInformation
Definition twolevelmethod.hh:148
│ │ │ │ +
LevelTransferPolicy< O, O > FatherType
Definition twolevelmethod.hh:146
│ │ │ │ +
void createCoarseLevelSystem(const O &fineOperator)
Algebraically creates the coarse level system.
Definition twolevelmethod.hh:154
│ │ │ │ +
A policy class for solving the coarse level system using one step of AMG.
Definition twolevelmethod.hh:234
│ │ │ │ +
OneStepAMGCoarseSolverPolicy(const SmootherArgs &args, const Criterion &c)
Constructs the coarse solver policy.
Definition twolevelmethod.hh:253
│ │ │ │ +
AMGInverseOperator CoarseLevelSolver
The type of solver constructed for the coarse level.
Definition twolevelmethod.hh:315
│ │ │ │ +
OneStepAMGCoarseSolverPolicy(const OneStepAMGCoarseSolverPolicy &other)
Copy constructor.
Definition twolevelmethod.hh:257
│ │ │ │ +
O::range_type X
The type of the range and domain of the operator.
Definition twolevelmethod.hh:239
│ │ │ │ +
C Criterion
The type of the crition used for the aggregation within AMG.
Definition twolevelmethod.hh:241
│ │ │ │ +
Dune::Amg::SmootherTraits< S >::Arguments SmootherArgs
The type of the arguments used for constructing the smoother.
Definition twolevelmethod.hh:245
│ │ │ │ +
O Operator
The type of the linear operator used.
Definition twolevelmethod.hh:237
│ │ │ │ +
AMG< Operator, X, Smoother > AMGType
The type of the AMG construct on the coarse level.
Definition twolevelmethod.hh:247
│ │ │ │ +
CoarseLevelSolver * createCoarseLevelSolver(P &transferPolicy)
Constructs a coarse level solver.
Definition twolevelmethod.hh:325
│ │ │ │ +
S Smoother
The type of the smoother used in AMG.
Definition twolevelmethod.hh:243
│ │ │ │ +
Definition twolevelmethod.hh:353
│ │ │ │ +
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:380
│ │ │ │ +
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:371
│ │ │ │ +
TwoLevelMethod(const TwoLevelMethod &other)
Definition twolevelmethod.hh:418
│ │ │ │ +
void pre(FineDomainType &x, FineRangeType &b)
Definition twolevelmethod.hh:431
│ │ │ │ +
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:363
│ │ │ │ +
CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver
The type of the coarse level solver.
Definition twolevelmethod.hh:358
│ │ │ │ +
void apply(FineDomainType &v, const FineRangeType &d)
Definition twolevelmethod.hh:439
│ │ │ │ +
CSP CoarseLevelSolverPolicy
The type of the policy for constructing the coarse level solver.
Definition twolevelmethod.hh:356
│ │ │ │ +
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:384
│ │ │ │ +
TwoLevelMethod(const FineOperatorType &op, std::shared_ptr< SmootherType > smoother, const LevelTransferPolicy< FineOperatorType, CoarseOperatorType > &policy, CoarseLevelSolverPolicy &coarsePolicy, std::size_t preSteps=1, std::size_t postSteps=1)
Constructs a two level method.
Definition twolevelmethod.hh:404
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition twolevelmethod.hh:466
│ │ │ │ +
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:367
│ │ │ │ +
~TwoLevelMethod()
Definition twolevelmethod.hh:424
│ │ │ │ +
CSP::Operator CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:376
│ │ │ │ +
void post(FineDomainType &x)
Definition twolevelmethod.hh:436
│ │ │ │ +
S SmootherType
The type of the fine level smoother.
Definition twolevelmethod.hh:388
│ │ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ +
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ +
virtual void apply(X &x, X &b, InverseOperatorResult &res)=0
Apply inverse operator,.
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,188 +1,663 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -graphcreator.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 (C) 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_TWOLEVELMETHOD_HH │ │ │ │ │ +6#define DUNE_ISTL_TWOLEVELMETHOD_HH │ │ │ │ │ 7 │ │ │ │ │ 8#include │ │ │ │ │ 9 │ │ │ │ │ -10#include "_g_r_a_p_h_._h_h" │ │ │ │ │ -11#include "_d_e_p_e_n_d_e_n_c_y_._h_h" │ │ │ │ │ -12#include "_p_i_n_f_o_._h_h" │ │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ -15 │ │ │ │ │ -16namespace _D_u_n_e │ │ │ │ │ -17{ │ │ │ │ │ -18 namespace Amg │ │ │ │ │ -19 { │ │ │ │ │ -20 template │ │ │ │ │ -_2_1 struct _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ │ -22 { │ │ │ │ │ -_2_3 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ │ -_2_4 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_a_t_r_i_x_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ │ -25 typedef _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h, │ │ │ │ │ -_2_6 std::vector > _S_u_b_G_r_a_p_h; │ │ │ │ │ -27 typedef _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_S_u_b_G_r_a_p_h, │ │ │ │ │ -28 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ │ -29 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ │ -30 IdentityMap, │ │ │ │ │ -31 typename _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p> │ │ │ │ │ -_3_2 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ │ -33 │ │ │ │ │ -_3_4 typedef std::tuple _G_r_a_p_h_T_u_p_l_e; │ │ │ │ │ -35 │ │ │ │ │ -36 template │ │ │ │ │ -_3_7 static _G_r_a_p_h_T_u_p_l_e _c_r_e_a_t_e(const M& matrix, T& excluded, │ │ │ │ │ -38 PI& pinfo, const OF& of) │ │ │ │ │ -39 { │ │ │ │ │ -40 _M_a_t_r_i_x_G_r_a_p_h* mg = new _M_a_t_r_i_x_G_r_a_p_h(matrix.getmat()); │ │ │ │ │ -41 typedef typename PI::ParallelIndexSet ParallelIndexSet; │ │ │ │ │ -42 typedef typename ParallelIndexSet::const_iterator IndexIterator; │ │ │ │ │ -43 IndexIterator iend = pinfo.indexSet().end(); │ │ │ │ │ -44 │ │ │ │ │ -45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index) │ │ │ │ │ -46 excluded[index->local()] = of.contains(index->local().attribute()); │ │ │ │ │ -47 │ │ │ │ │ -48 _S_u_b_G_r_a_p_h* sg= new _S_u_b_G_r_a_p_h(*mg, excluded); │ │ │ │ │ -49 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h* pg = new _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(*sg, IdentityMap(), sg- │ │ │ │ │ ->_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p()); │ │ │ │ │ -50 return _G_r_a_p_h_T_u_p_l_e(mg,pg,sg); │ │ │ │ │ -51 } │ │ │ │ │ -52 │ │ │ │ │ -_5_3 static void _f_r_e_e(_G_r_a_p_h_T_u_p_l_e& graphs) │ │ │ │ │ -54 { │ │ │ │ │ -55 delete std::get<2>(graphs); │ │ │ │ │ -56 delete std::get<1>(graphs); │ │ │ │ │ -57 } │ │ │ │ │ -58 }; │ │ │ │ │ -59 │ │ │ │ │ -60 template │ │ │ │ │ -_6_1 struct _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ │ -62 { │ │ │ │ │ -_6_3 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ │ -64 │ │ │ │ │ -_6_5 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_a_t_r_i_x_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ │ -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 │ │ │ │ │ +10#include<_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ │ +11#include"_a_m_g_._h_h" │ │ │ │ │ +12#include"_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ │ +13#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ +14 │ │ │ │ │ +22namespace _D_u_n_e │ │ │ │ │ +23{ │ │ │ │ │ +24namespace Amg │ │ │ │ │ +25{ │ │ │ │ │ +26 │ │ │ │ │ +36template │ │ │ │ │ +_3_7class _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ │ +38{ │ │ │ │ │ +39public: │ │ │ │ │ +_4_4 typedef FO _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ │ +_4_8 typedef typename FineOperatorType::range_type _F_i_n_e_R_a_n_g_e_T_y_p_e; │ │ │ │ │ +_5_2 typedef typename FineOperatorType::domain_type _F_i_n_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ +_5_7 typedef CO _C_o_a_r_s_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ │ +_6_1 typedef typename CoarseOperatorType::range_type _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e; │ │ │ │ │ +_6_5 typedef typename CoarseOperatorType::domain_type _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ +_7_0 std::shared_ptr& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_O_p_e_r_a_t_o_r() │ │ │ │ │ +71 { │ │ │ │ │ +72 return _o_p_e_r_a_t_o_r__; │ │ │ │ │ +73 } │ │ │ │ │ +_7_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_R_h_s() │ │ │ │ │ +79 { │ │ │ │ │ +80 return _r_h_s__; │ │ │ │ │ +81 } │ │ │ │ │ +82 │ │ │ │ │ +_8_7 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_L_h_s() │ │ │ │ │ +88 { │ │ │ │ │ +89 return _l_h_s__; │ │ │ │ │ +90 } │ │ │ │ │ +_1_0_0 virtual void _m_o_v_e_T_o_C_o_a_r_s_e_L_e_v_e_l(const _F_i_n_e_R_a_n_g_e_T_y_p_e& fineRhs)=0; │ │ │ │ │ +_1_1_0 virtual void _m_o_v_e_T_o_F_i_n_e_L_e_v_e_l(_F_i_n_e_D_o_m_a_i_n_T_y_p_e& fineLhs)=0; │ │ │ │ │ +_1_1_8 virtual void _c_r_e_a_t_e_C_o_a_r_s_e_L_e_v_e_l_S_y_s_t_e_m(const _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e& │ │ │ │ │ +fineOperator)=0; │ │ │ │ │ +119 │ │ │ │ │ +_1_2_1 virtual _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y* _c_l_o_n_e() const =0; │ │ │ │ │ +122 │ │ │ │ │ +_1_2_4 virtual _~_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y(){} │ │ │ │ │ +125 │ │ │ │ │ +126 protected: │ │ │ │ │ +_1_2_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e _r_h_s__; │ │ │ │ │ +_1_3_0 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e _l_h_s__; │ │ │ │ │ +_1_3_2 std::shared_ptr _o_p_e_r_a_t_o_r__; │ │ │ │ │ +133}; │ │ │ │ │ +134 │ │ │ │ │ +140template │ │ │ │ │ +_1_4_1class _A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ │ +142 : public _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ │ +143{ │ │ │ │ │ +144 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _O_:_:_m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e_> │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ │ +145public: │ │ │ │ │ +_1_4_6 typedef _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_O_,_O_> _F_a_t_h_e_r_T_y_p_e; │ │ │ │ │ +_1_4_7 typedef C _C_r_i_t_e_r_i_o_n; │ │ │ │ │ +_1_4_8 typedef _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ +149 │ │ │ │ │ +_1_5_0 _A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y(const _C_r_i_t_e_r_i_o_n& crit) │ │ │ │ │ +151 : criterion_(crit) │ │ │ │ │ +152 {} │ │ │ │ │ +153 │ │ │ │ │ +_1_5_4 void _c_r_e_a_t_e_C_o_a_r_s_e_L_e_v_e_l_S_y_s_t_e_m(const O& fineOperator) │ │ │ │ │ +155 { │ │ │ │ │ +156 prolongDamp_ = criterion_.getProlongationDampingFactor(); │ │ │ │ │ +157 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> productBuilder; │ │ │ │ │ +158 typedef typename _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _t_y_p_e_n_a_m_e_ _O_:_:_m_a_t_r_i_x___t_y_p_e_> │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ │ +159 typedef typename _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h,_D_u_n_e_:_:_A_m_g_:_: │ │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ │ +160 _D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s,Dune::IdentityMap,Dune::IdentityMap> │ │ │ │ │ +_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ │ +161 _M_a_t_r_i_x_G_r_a_p_h mg(fineOperator.getmat()); │ │ │ │ │ +162 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h pg(mg,Dune::IdentityMap(),Dune::IdentityMap()); │ │ │ │ │ +163 typedef NegateSet OverlapFlags; │ │ │ │ │ +164 │ │ │ │ │ +165 aggregatesMap_ = std::make_shared(pg._m_a_x_V_e_r_t_e_x()+1); │ │ │ │ │ +166 │ │ │ │ │ +167 int noAggregates, isoAggregates, oneAggregates, skippedAggregates; │ │ │ │ │ +168 │ │ │ │ │ +169 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) = │ │ │ │ │ +170 aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, │ │ │ │ │ +true); │ │ │ │ │ +171 std::cout<<"no aggregates="< │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: galerkin.hh File Reference │ │ │ │ +dune-istl: aggregates.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,67 +71,110 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include "aggregates.hh"
│ │ │ │ -#include "pinfo.hh"
│ │ │ │ +
#include "parameters.hh"
│ │ │ │ +#include "graph.hh"
│ │ │ │ +#include "properties.hh"
│ │ │ │ +#include "combinedfunctor.hh"
│ │ │ │ +#include <dune/common/timer.hh>
│ │ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ │ #include <dune/common/poolallocator.hh>
│ │ │ │ -#include <dune/common/enumset.hh>
│ │ │ │ +#include <dune/common/sllist.hh>
│ │ │ │ +#include <dune/common/ftraits.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include <utility>
│ │ │ │ #include <set>
│ │ │ │ -#include <limits>
│ │ │ │ #include <algorithm>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <ostream>
│ │ │ │ +#include <tuple>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::Amg::OverlapVertex< T >
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::SparsityBuilder< M >
 Functor for building the sparsity pattern of the matrix using examineConnectivity. More...
class  Dune::Amg::SymmetricDependency< M, N >
 Dependency policy for symmetric matrices. More...
 
class  Dune::Amg::BaseGalerkinProduct
class  Dune::Amg::Diagonal< N >
 Norm that uses only the [N][N] entry of the block to determine couplings. More...
 
class  Dune::Amg::GalerkinProduct< T >
class  Dune::Amg::FirstDiagonal
 Norm that uses only the [0][0] entry of the block to determine couplings. More...
 
class  Dune::Amg::GalerkinProduct< SequentialInformation >
struct  Dune::Amg::RowSum
 Functor using the row sum (infinity) norm to determine strong couplings. More...
 
struct  Dune::Amg::BaseConnectivityConstructor
struct  Dune::Amg::FrobeniusNorm
 
class  Dune::Amg::BaseConnectivityConstructor::ConnectedBuilder< G, S, V >
 Visitor for identifying connected aggregates during a breadthFirstSearch. More...
struct  Dune::Amg::AlwaysOneNorm
 
struct  Dune::Amg::ConnectivityConstructor< G, T >
class  Dune::Amg::SymmetricCriterion< M, Norm >
 Criterion taking advantage of symmetric matrices. More...
 
struct  Dune::Amg::ConnectivityConstructor< G, SequentialInformation >
class  Dune::Amg::UnSymmetricCriterion< M, Norm >
 Criterion suitable for unsymmetric matrices. More...
 
struct  Dune::Amg::DirichletBoundarySetter< T >
class  Dune::Amg::AggregatesMap< V >
 Class providing information about the mapping of the vertices onto aggregates. More...
 
struct  Dune::Amg::DirichletBoundarySetter< SequentialInformation >
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::Amg
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Functions

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

│ │ │ │ -

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

│ │ │ │ +

Provides classes for the Coloring process of AMG.

│ │ │ │
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,60 +1,104 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ +_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 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" │ │ │ │ │ +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 │ │ │ │ │ #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_:_:_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_:_:_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_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_:_:_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_:_:_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_:_:_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_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_ _T_ _> │ │ │ │ │ + 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_._._. │ │ │ │ │   │ │ │ │ │ - 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_:_:_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_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ │   │ │ │ │ │ - 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_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ │   │ │ │ │ │ -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_ _> │ │ │ │ │ + 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_._._. │ │ │ │ │   │ │ │ │ │ -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_ _> │ │ │ │ │ + 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_._._. │ │ │ │ │   │ │ │ │ │ -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_ _> │ │ │ │ │ + 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_._._. │ │ │ │ │   │ │ │ │ │ -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_:_:_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_:_:_A_m_g │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +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 ********** │ │ │ │ │ -Provides a class for building the galerkin product based on a aggregation │ │ │ │ │ -scheme. │ │ │ │ │ +Provides classes for the Coloring process of AMG. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00146_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: galerkin.hh Source File │ │ │ │ +dune-istl: aggregates.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,738 +74,2255 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
galerkin.hh
│ │ │ │ +
aggregates.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AMG_AGGREGATES_HH
│ │ │ │ +
6#define DUNE_AMG_AGGREGATES_HH
│ │ │ │
7
│ │ │ │ -
8#include "aggregates.hh"
│ │ │ │ -
9#include "pinfo.hh"
│ │ │ │ -
10#include <dune/common/poolallocator.hh>
│ │ │ │ -
11#include <dune/common/enumset.hh>
│ │ │ │ -
12#include <set>
│ │ │ │ -
13#include <limits>
│ │ │ │ -
14#include <algorithm>
│ │ │ │ -
15
│ │ │ │ -
16namespace Dune
│ │ │ │ -
17{
│ │ │ │ -
18 namespace Amg
│ │ │ │ -
19 {
│ │ │ │ -
31 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
33 {
│ │ │ │ -
37 typedef T Aggregate;
│ │ │ │ -
38
│ │ │ │ -
42 typedef T Vertex;
│ │ │ │ -
43
│ │ │ │ - │ │ │ │ -
48
│ │ │ │ - │ │ │ │ -
53 };
│ │ │ │ -
│ │ │ │ -
54
│ │ │ │ -
55
│ │ │ │ +
8
│ │ │ │ +
9#include "parameters.hh"
│ │ │ │ +
10#include "graph.hh"
│ │ │ │ +
11#include "properties.hh"
│ │ │ │ +
12#include "combinedfunctor.hh"
│ │ │ │ +
13
│ │ │ │ +
14#include <dune/common/timer.hh>
│ │ │ │ +
15#include <dune/common/stdstreams.hh>
│ │ │ │ +
16#include <dune/common/poolallocator.hh>
│ │ │ │ +
17#include <dune/common/sllist.hh>
│ │ │ │ +
18#include <dune/common/ftraits.hh>
│ │ │ │ +
19#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +
20
│ │ │ │ +
21#include <utility>
│ │ │ │ +
22#include <set>
│ │ │ │ +
23#include <algorithm>
│ │ │ │ +
24#include <complex>
│ │ │ │ +
25#include <limits>
│ │ │ │ +
26#include <ostream>
│ │ │ │ +
27#include <tuple>
│ │ │ │ +
28
│ │ │ │ +
29namespace Dune
│ │ │ │ +
30{
│ │ │ │ +
31 namespace Amg
│ │ │ │ +
32 {
│ │ │ │ +
33
│ │ │ │ +
47 template<class T>
│ │ │ │ +
│ │ │ │ +
48 class AggregationCriterion : public T
│ │ │ │ +
49 {
│ │ │ │ +
50
│ │ │ │ +
51 public:
│ │ │ │ + │ │ │ │
56
│ │ │ │ -
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 };
│ │ │ │ -
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
67 : T()
│ │ │ │ +
68 {}
│ │ │ │ +
│ │ │ │ +
69
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
71 : T(parms)
│ │ │ │ +
72 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
82 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
│ │ │ │ +
83 {
│ │ │ │ +
84 this->setMaxDistance(diameter-1);
│ │ │ │ +
85 std::size_t csize=1;
│ │ │ │ +
86
│ │ │ │ +
87 for(; dim>0; dim--) {
│ │ │ │ +
88 csize*=diameter;
│ │ │ │ +
89 this->setMaxDistance(this->maxDistance()+diameter-1);
│ │ │ │ +
90 }
│ │ │ │ +
91 this->setMinAggregateSize(csize);
│ │ │ │ +
92 this->setMaxAggregateSize(static_cast<std::size_t>(csize*1.5));
│ │ │ │ +
93 }
│ │ │ │ +
│ │ │ │ +
94
│ │ │ │ +
│ │ │ │ +
105 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
│ │ │ │ +
106 {
│ │ │ │ +
107 setDefaultValuesIsotropic(dim, diameter);
│ │ │ │ +
108 this->setMaxDistance(this->maxDistance()+dim-1);
│ │ │ │ +
109 }
│ │ │ │ +
│ │ │ │ +
110 };
│ │ │ │ +
│ │ │ │ +
111
│ │ │ │ +
112 template<class T>
│ │ │ │ +
│ │ │ │ +
113 std::ostream& operator<<(std::ostream& os, const AggregationCriterion<T>& criterion)
│ │ │ │ +
114 {
│ │ │ │ +
115 os<<"{ maxdistance="<<criterion.maxDistance()<<" minAggregateSize="
│ │ │ │ +
116 <<criterion.minAggregateSize()<< " maxAggregateSize="<<criterion.maxAggregateSize()
│ │ │ │ +
117 <<" connectivity="<<criterion.maxConnectivity()<<" debugLevel="<<criterion.debugLevel()<<"}";
│ │ │ │ +
118 return os;
│ │ │ │ +
119 }
│ │ │ │ +
│ │ │ │ +
120
│ │ │ │ +
132 template<class M, class N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
134 {
│ │ │ │ +
135 public:
│ │ │ │ +
139 typedef M Matrix;
│ │ │ │ +
140
│ │ │ │ +
144 typedef N Norm;
│ │ │ │ +
145
│ │ │ │ +
149 typedef typename Matrix::row_type Row;
│ │ │ │ +
150
│ │ │ │ + │ │ │ │ +
155
│ │ │ │ +
156 void init(const Matrix* matrix);
│ │ │ │ +
157
│ │ │ │ +
158 void initRow(const Row& row, int index);
│ │ │ │ +
159
│ │ │ │ +
160 void examine(const ColIter& col);
│ │ │ │
161
│ │ │ │ -
162 template<>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
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);
│ │ │ │ +
162 template<class G>
│ │ │ │ +
163 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ │ +
164
│ │ │ │ +
165 bool isIsolated();
│ │ │ │ +
166
│ │ │ │ +
167
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
169 : Parameters(parms)
│ │ │ │ +
170 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
172 : Parameters()
│ │ │ │ +
173 {}
│ │ │ │ +
│ │ │ │ +
174
│ │ │ │ +
175 protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
180 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
185 int row_;
│ │ │ │ + │ │ │ │ +
188 std::vector<real_type> vals_;
│ │ │ │ +
189 typename std::vector<real_type>::iterator valIter_;
│ │ │ │ +
190
│ │ │ │ +
191 };
│ │ │ │ +
│ │ │ │ +
192
│ │ │ │ +
193
│ │ │ │ +
194 template<class M, class N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
196 {
│ │ │ │ +
197 matrix_ = matrix;
│ │ │ │ +
198 }
│ │ │ │ +
│ │ │ │
199
│ │ │ │ -
200
│ │ │ │ -
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);
│ │ │ │ +
200 template<class M, class N>
│ │ │ │ +
│ │ │ │ +
201 inline void SymmetricMatrixDependency<M,N>::initRow(const Row& row, int index)
│ │ │ │ +
202 {
│ │ │ │ +
203 using std::min;
│ │ │ │ +
204 vals_.assign(row.size(), 0.0);
│ │ │ │ +
205 assert(vals_.size()==row.size());
│ │ │ │ +
206 valIter_=vals_.begin();
│ │ │ │ +
207
│ │ │ │ +
208 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ │ +
209 diagonal_=norm_(row[index]);
│ │ │ │ +
210 row_ = index;
│ │ │ │ +
211 }
│ │ │ │ +
│ │ │ │ +
212
│ │ │ │ +
213 template<class M, class N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
215 {
│ │ │ │ +
216 using std::max;
│ │ │ │ +
217 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ │ +
218 real_type eij = norm_(*col);
│ │ │ │ +
219 if(!N::is_sign_preserving || eij<0) // || eji<0)
│ │ │ │ +
220 {
│ │ │ │ +
221 *valIter_ = eij/diagonal_*eij/norm_(matrix_->operator[](col.index())[col.index()]);
│ │ │ │ +
222 maxValue_ = max(maxValue_, *valIter_);
│ │ │ │ +
223 }else
│ │ │ │ +
224 *valIter_ =0;
│ │ │ │ +
225 ++valIter_;
│ │ │ │ +
226 }
│ │ │ │ +
│ │ │ │ +
227
│ │ │ │ +
228 template<class M, class N>
│ │ │ │ +
229 template<class G>
│ │ │ │ +
│ │ │ │ +
230 inline void SymmetricMatrixDependency<M,N>::examine(G&, const typename G::EdgeIterator& edge, const ColIter&)
│ │ │ │ +
231 {
│ │ │ │ +
232 if(*valIter_ > alpha() * maxValue_) {
│ │ │ │ +
233 edge.properties().setDepends();
│ │ │ │ +
234 edge.properties().setInfluences();
│ │ │ │ +
235 }
│ │ │ │ +
236 ++valIter_;
│ │ │ │ +
237 }
│ │ │ │ +
│ │ │ │ +
238
│ │ │ │ +
239 template<class M, class N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
241 {
│ │ │ │ +
242 if(diagonal_==0)
│ │ │ │ +
243 DUNE_THROW(Dune::ISTLError, "No diagonal entry for row "<<row_<<".");
│ │ │ │ +
244 valIter_=vals_.begin();
│ │ │ │ +
245 return maxValue_ < beta();
│ │ │ │ +
246 }
│ │ │ │ +
│ │ │ │
247
│ │ │ │ -
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;
│ │ │ │ +
251 template<class M, class N>
│ │ │ │ +
│ │ │ │ +
252 class Dependency : public Parameters
│ │ │ │ +
253 {
│ │ │ │ +
254 public:
│ │ │ │ +
258 typedef M Matrix;
│ │ │ │ +
259
│ │ │ │ +
263 typedef N Norm;
│ │ │ │ +
264
│ │ │ │ +
268 typedef typename Matrix::row_type Row;
│ │ │ │ +
269
│ │ │ │ + │ │ │ │ +
274
│ │ │ │ +
275 void init(const Matrix* matrix);
│ │ │ │ +
276
│ │ │ │ +
277 void initRow(const Row& row, int index);
│ │ │ │ +
278
│ │ │ │ +
279 void examine(const ColIter& col);
│ │ │ │ +
280
│ │ │ │ +
281 template<class G>
│ │ │ │ +
282 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ │ +
283
│ │ │ │ + │ │ │ │ +
285
│ │ │ │ +
│ │ │ │ +
286 Dependency(const Parameters& parms)
│ │ │ │ +
287 : Parameters(parms)
│ │ │ │ +
288 {}
│ │ │ │ +
│ │ │ │
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();
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
291 : Parameters()
│ │ │ │ +
292 {}
│ │ │ │ +
│ │ │ │ +
293
│ │ │ │ +
294 protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
299 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
304 int row_;
│ │ │ │ + │ │ │ │ +
307 };
│ │ │ │ +
│ │ │ │ +
308
│ │ │ │ +
312 template<class M, class N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
314 {
│ │ │ │ +
315 public:
│ │ │ │ +
319 typedef M Matrix;
│ │ │ │ +
320
│ │ │ │ +
324 typedef N Norm;
│ │ │ │ +
325
│ │ │ │ +
329 typedef typename Matrix::row_type Row;
│ │ │ │ +
330
│ │ │ │ + │ │ │ │ +
335
│ │ │ │ +
336 void init(const Matrix* matrix);
│ │ │ │ +
337
│ │ │ │ +
338 void initRow(const Row& row, int index);
│ │ │ │ +
339
│ │ │ │ +
340 void examine(const ColIter& col);
│ │ │ │ +
341
│ │ │ │ +
342 template<class G>
│ │ │ │ +
343 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ │ +
344
│ │ │ │ + │ │ │ │ +
346
│ │ │ │ +
347
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
349 : Parameters(parms)
│ │ │ │ +
350 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
352 : Parameters()
│ │ │ │ +
353 {}
│ │ │ │ +
│ │ │ │ +
354
│ │ │ │ +
355 protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
360 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
365 int row_;
│ │ │ │ + │ │ │ │ +
368 private:
│ │ │ │ +
369 void initRow(const Row& row, int index, const std::true_type&);
│ │ │ │ +
370 void initRow(const Row& row, int index, const std::false_type&);
│ │ │ │ +
371 };
│ │ │ │ +
│ │ │ │ +
372
│ │ │ │ +
377 template<int N>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
379 {
│ │ │ │ +
380 public:
│ │ │ │ +
381 enum { /* @brief We preserve the sign.*/
│ │ │ │ +
382 is_sign_preserving = true
│ │ │ │ +
383 };
│ │ │ │
384
│ │ │ │ -
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 }
│ │ │ │ +
389 template<class M>
│ │ │ │ +
│ │ │ │ +
390 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m,
│ │ │ │ +
391 [[maybe_unused]] typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr) const
│ │ │ │ +
392 {
│ │ │ │ +
393 typedef typename M::field_type field_type;
│ │ │ │ +
394 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ +
395 static_assert( std::is_convertible<field_type, real_type >::value,
│ │ │ │ +
396 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ │ +
397 return m[N][N];
│ │ │ │ +
398 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ │ +
399 }
│ │ │ │ +
│ │ │ │ +
400
│ │ │ │ +
405 template<class M>
│ │ │ │ +
│ │ │ │ +
406 auto operator()(const M& m,
│ │ │ │ +
407 typename std::enable_if_t<Dune::IsNumber<M>::value>* sfinae = nullptr) const
│ │ │ │ +
408 {
│ │ │ │ +
409 typedef typename FieldTraits<M>::real_type real_type;
│ │ │ │ +
410 static_assert( std::is_convertible<M, real_type >::value,
│ │ │ │ +
411 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ │ +
412 return m;
│ │ │ │ +
413 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ │ +
414 }
│ │ │ │ +
│ │ │ │ +
415
│ │ │ │ +
416 private:
│ │ │ │
417
│ │ │ │ -
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;
│ │ │ │ +
419 template<typename T>
│ │ │ │ +
420 static T signed_abs(const T & v)
│ │ │ │ +
421 {
│ │ │ │ +
422 return v;
│ │ │ │ +
423 }
│ │ │ │ +
424
│ │ │ │ +
426 template<typename T>
│ │ │ │ +
427 static T signed_abs(const std::complex<T> & v)
│ │ │ │ +
428 {
│ │ │ │ +
429 // return sign * abs_value
│ │ │ │ +
430 // in case of complex numbers this extends to using the csgn function to determine the sign
│ │ │ │ +
431 return csgn(v) * std::abs(v);
│ │ │ │ +
432 }
│ │ │ │
433
│ │ │ │ -
434 VertexIterator vend=graph.end();
│ │ │ │ -
435
│ │ │ │ -
436#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
437 std::set<Vertex> examined;
│ │ │ │ -
438#endif
│ │ │ │ -
439
│ │ │ │ -
440 // The aggregates owned by the process have lower local indices
│ │ │ │ -
441 // then those not owned. We process them in the first pass.
│ │ │ │ -
442 // They represent the rows 0, 1, ..., n of the coarse matrix
│ │ │ │ -
443 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex)
│ │ │ │ -
444 if(!get(visitedMap, *vertex)) {
│ │ │ │ -
445 // In the first pass we only process owner nodes
│ │ │ │ -
446 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ │ -
447 const IndexPair* pair = lookup.pair(*vertex);
│ │ │ │ -
448 if(pair==0 || !overlap.contains(pair->local().attribute())) {
│ │ │ │ -
449#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
450 assert(examined.find(aggregates[*vertex])==examined.end());
│ │ │ │ -
451 examined.insert(aggregates[*vertex]);
│ │ │ │ -
452#endif
│ │ │ │ -
453 constructNonOverlapConnectivity(row, graph, visitedMap, aggregates, *vertex);
│ │ │ │ -
454
│ │ │ │ -
455 // only needed for ALU
│ │ │ │ -
456 // (ghosts with same global id as owners on the same process)
│ │ │ │ -
457 if (SolverCategory::category(pinfo) == static_cast<int>(SolverCategory::nonoverlapping)) {
│ │ │ │ -
458 if(overlapVertices != overlapEnd) {
│ │ │ │ -
459 if(*overlapVertices->aggregate!=AggregatesMap<Vertex>::ISOLATED) {
│ │ │ │ -
460 constructOverlapConnectivity(row, graph, visitedMap, aggregates, overlapVertices, overlapEnd);
│ │ │ │ -
461 }
│ │ │ │ -
462 else{
│ │ │ │ -
463 ++overlapVertices;
│ │ │ │ -
464 }
│ │ │ │ -
465 }
│ │ │ │ -
466 }
│ │ │ │ -
467 ++row;
│ │ │ │ -
468 }
│ │ │ │ -
469 }
│ │ │ │ -
470
│ │ │ │ -
471 dvverb<<"constructed "<<row.index()<<" non-overlapping rows"<<std::endl;
│ │ │ │ -
472
│ │ │ │ -
473 // Now come the aggregates not owned by use.
│ │ │ │ -
474 // They represent the rows n+1, ..., N
│ │ │ │ -
475 while(overlapVertices != overlapEnd)
│ │ │ │ -
476 if(*overlapVertices->aggregate!=AggregatesMap<Vertex>::ISOLATED) {
│ │ │ │ -
477
│ │ │ │ -
478#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
479 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ │ -
480 const IndexPair* pair = lookup.pair(overlapVertices->vertex);
│ │ │ │ -
481 assert(pair!=0 && overlap.contains(pair->local().attribute()));
│ │ │ │ -
482 assert(examined.find(aggregates[overlapVertices->vertex])==examined.end());
│ │ │ │ -
483 examined.insert(aggregates[overlapVertices->vertex]);
│ │ │ │ -
484#endif
│ │ │ │ -
485 constructOverlapConnectivity(row, graph, visitedMap, aggregates, overlapVertices, overlapEnd);
│ │ │ │ -
486 ++row;
│ │ │ │ -
487 }else{
│ │ │ │ -
488 ++overlapVertices;
│ │ │ │ -
489 }
│ │ │ │ -
490 }
│ │ │ │ -
│ │ │ │ -
491
│ │ │ │ -
492 template<class G>
│ │ │ │ -
493 template<class V, class R>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
495 V& visitedMap,
│ │ │ │ -
496 [[maybe_unused]] const SequentialInformation& pinfo,
│ │ │ │ -
497 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ -
498 R& row)
│ │ │ │ -
499 {
│ │ │ │ -
500 typedef typename G::VertexIterator VertexIterator;
│ │ │ │ -
501
│ │ │ │ -
502 VertexIterator vend=graph.end();
│ │ │ │ -
503 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ │ -
504 if(!get(visitedMap, *vertex)) {
│ │ │ │ -
505 constructNonOverlapConnectivity(row, graph, visitedMap, aggregates, *vertex);
│ │ │ │ -
506 ++row;
│ │ │ │ -
507 }
│ │ │ │ -
508 }
│ │ │ │ -
509
│ │ │ │ -
510 }
│ │ │ │ -
│ │ │ │ -
511
│ │ │ │ -
512 template<class M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
514 : row_(matrix.createbegin()),
│ │ │ │ -
515 minRowSize_(std::numeric_limits<std::size_t>::max()),
│ │ │ │ -
516 maxRowSize_(0), sumRowSize_(0)
│ │ │ │ -
517 {
│ │ │ │ -
518#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
519 diagonalInserted = false;
│ │ │ │ -
520#endif
│ │ │ │ -
521 }
│ │ │ │ -
│ │ │ │ -
522 template<class M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
524 {
│ │ │ │ -
525 return maxRowSize_;
│ │ │ │ -
526 }
│ │ │ │ -
│ │ │ │ -
527 template<class M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
529 {
│ │ │ │ -
530 return minRowSize_;
│ │ │ │ -
531 }
│ │ │ │ -
│ │ │ │ -
532
│ │ │ │ -
533 template<class M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
535 {
│ │ │ │ -
536 return sumRowSize_;
│ │ │ │ -
537 }
│ │ │ │ -
│ │ │ │ -
538 template<class M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
540 {
│ │ │ │ -
541 sumRowSize_ += row_.size();
│ │ │ │ -
542 minRowSize_=std::min(minRowSize_, row_.size());
│ │ │ │ -
543 maxRowSize_=std::max(maxRowSize_, row_.size());
│ │ │ │ -
544 ++row_;
│ │ │ │ -
545#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
546 assert(diagonalInserted);
│ │ │ │ -
547 diagonalInserted = false;
│ │ │ │ -
548#endif
│ │ │ │ -
549 }
│ │ │ │ -
│ │ │ │ +
435 template<typename T>
│ │ │ │ +
436 static T csgn(const T & v)
│ │ │ │ +
437 {
│ │ │ │ +
438 return (T(0) < v) - (v < T(0));
│ │ │ │ +
439 }
│ │ │ │ +
440
│ │ │ │ +
442 template<typename T>
│ │ │ │ +
443 static T csgn(std::complex<T> a)
│ │ │ │ +
444 {
│ │ │ │ +
445 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag());
│ │ │ │ +
446 }
│ │ │ │ +
447
│ │ │ │ +
448 };
│ │ │ │ +
│ │ │ │ +
449
│ │ │ │ +
│ │ │ │ +
454 class FirstDiagonal : public Diagonal<0>
│ │ │ │ +
455 {};
│ │ │ │ +
│ │ │ │ +
456
│ │ │ │ +
│ │ │ │ +
462 struct RowSum
│ │ │ │ +
463 {
│ │ │ │ +
464
│ │ │ │ +
465 enum { /* @brief We preserve the sign.*/
│ │ │ │ +
466 is_sign_preserving = false
│ │ │ │ +
467 };
│ │ │ │ +
472 template<class M>
│ │ │ │ +
│ │ │ │ +
473 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ │ +
474 {
│ │ │ │ +
475 return m.infinity_norm();
│ │ │ │ +
476 }
│ │ │ │ +
│ │ │ │ +
477 };
│ │ │ │ +
│ │ │ │ +
478
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
480 {
│ │ │ │ +
481
│ │ │ │ +
482 enum { /* @brief We preserve the sign.*/
│ │ │ │ +
483 is_sign_preserving = false
│ │ │ │ +
484 };
│ │ │ │ +
489 template<class M>
│ │ │ │ +
│ │ │ │ +
490 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ │ +
491 {
│ │ │ │ +
492 return m.frobenius_norm();
│ │ │ │ +
493 }
│ │ │ │ +
│ │ │ │ +
494 };
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
496 {
│ │ │ │ +
497
│ │ │ │ +
498 enum { /* @brief We preserve the sign.*/
│ │ │ │ +
499 is_sign_preserving = false
│ │ │ │ +
500 };
│ │ │ │ +
505 template<class M>
│ │ │ │ +
│ │ │ │ +
506 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ │ +
507 {
│ │ │ │ +
508 return 1;
│ │ │ │ +
509 }
│ │ │ │ +
│ │ │ │ +
510 };
│ │ │ │ +
│ │ │ │ +
517 template<class M, class Norm>
│ │ │ │ +
│ │ │ │ +
518 class SymmetricCriterion : public AggregationCriterion<SymmetricDependency<M,Norm> >
│ │ │ │ +
519 {
│ │ │ │ +
520 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
523 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
525 {}
│ │ │ │ +
│ │ │ │ +
526 };
│ │ │ │ +
│ │ │ │ +
527
│ │ │ │ +
528
│ │ │ │ +
537 template<class M, class Norm>
│ │ │ │ +
│ │ │ │ +
538 class UnSymmetricCriterion : public AggregationCriterion<Dependency<M,Norm> >
│ │ │ │ +
539 {
│ │ │ │ +
540 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
543 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
545 {}
│ │ │ │ +
│ │ │ │ +
546 };
│ │ │ │ +
│ │ │ │ +
547 // forward declaration
│ │ │ │ +
548 template<class G> class Aggregator;
│ │ │ │ +
549
│ │ │ │
550
│ │ │ │ -
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);
│ │ │ │ +
558 template<class V>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
560 {
│ │ │ │ +
561 public:
│ │ │ │ +
562
│ │ │ │ +
566 static const V UNAGGREGATED;
│ │ │ │ +
567
│ │ │ │ +
571 static const V ISOLATED;
│ │ │ │ + │ │ │ │ +
576
│ │ │ │ + │ │ │ │ +
581
│ │ │ │ +
586 typedef PoolAllocator<VertexDescriptor,100> Allocator;
│ │ │ │ +
587
│ │ │ │ +
592 typedef SLList<VertexDescriptor,Allocator> VertexList;
│ │ │ │
593
│ │ │ │ -
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;
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
598 {
│ │ │ │ +
599 public:
│ │ │ │ +
600 template<class EdgeIterator>
│ │ │ │ +
│ │ │ │ +
601 void operator()([[maybe_unused]] const EdgeIterator& edge) const
│ │ │ │ +
602 {}
│ │ │ │ +
│ │ │ │ +
603 };
│ │ │ │ +
│ │ │ │
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();
│ │ │ │ +
605
│ │ │ │ + │ │ │ │ +
610
│ │ │ │ + │ │ │ │ +
617
│ │ │ │ + │ │ │ │ +
622
│ │ │ │ +
634 template<class M, class G, class C>
│ │ │ │ +
635 std::tuple<int,int,int,int> buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ │ +
636 bool finestLevel);
│ │ │ │ +
637
│ │ │ │ +
655 template<bool reset, class G, class F, class VM>
│ │ │ │ +
656 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ │ +
657 const AggregateDescriptor& aggregate,
│ │ │ │ +
658 const G& graph,
│ │ │ │ +
659 F& aggregateVisitor,
│ │ │ │ +
660 VM& visitedMap) const;
│ │ │ │ +
661
│ │ │ │ +
685 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ │ +
686 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ │ +
687 const AggregateDescriptor& aggregate,
│ │ │ │ +
688 const G& graph, L& visited, F1& aggregateVisitor,
│ │ │ │ +
689 F2& nonAggregateVisitor,
│ │ │ │ +
690 VM& visitedMap) const;
│ │ │ │ +
691
│ │ │ │ +
697 void allocate(std::size_t noVertices);
│ │ │ │ +
698
│ │ │ │ +
702 std::size_t noVertices() const;
│ │ │ │
703
│ │ │ │ -
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.
│ │ │ │ - │ │ │ │ +
707 void free();
│ │ │ │ +
708
│ │ │ │ + │ │ │ │ +
715
│ │ │ │ + │ │ │ │ +
722
│ │ │ │ + │ │ │ │ +
724
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
726 {
│ │ │ │ +
727 return aggregates_;
│ │ │ │ +
728 }
│ │ │ │ +
│ │ │ │ +
729
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
731 {
│ │ │ │ +
732 return aggregates_+noVertices();
│ │ │ │ +
733 }
│ │ │ │ +
│ │ │ │ +
734
│ │ │ │ + │ │ │ │ +
736
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
738 {
│ │ │ │ +
739 return aggregates_;
│ │ │ │ +
740 }
│ │ │ │ +
│ │ │ │ +
741
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
743 {
│ │ │ │ +
744 return aggregates_+noVertices();
│ │ │ │ +
745 }
│ │ │ │ +
│ │ │ │ +
746 private:
│ │ │ │ +
748 AggregatesMap(const AggregatesMap<V>&) = delete;
│ │ │ │ +
750 AggregatesMap<V>& operator=(const AggregatesMap<V>&) = delete;
│ │ │ │ +
751
│ │ │ │ +
755 AggregateDescriptor* aggregates_;
│ │ │ │ +
756
│ │ │ │ +
760 std::size_t noVertices_;
│ │ │ │ +
761 };
│ │ │ │ +
│ │ │ │ +
762
│ │ │ │ +
766 template<class G, class C>
│ │ │ │ +
767 void buildDependency(G& graph,
│ │ │ │ +
768 const typename C::Matrix& matrix,
│ │ │ │ +
769 C criterion,
│ │ │ │ +
770 bool finestLevel);
│ │ │ │ +
771
│ │ │ │ +
776 template<class G, class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
778 {
│ │ │ │ +
779
│ │ │ │ +
780 public:
│ │ │ │ +
781
│ │ │ │ +
782 /***
│ │ │ │ +
783 * @brief The type of the matrix graph we work with.
│ │ │ │ +
784 */
│ │ │ │ +
785 typedef G MatrixGraph;
│ │ │ │ + │ │ │ │ +
790
│ │ │ │ +
795 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ │ +
796
│ │ │ │ +
801 typedef S VertexSet;
│ │ │ │ +
802
│ │ │ │ +
804 typedef typename VertexSet::const_iterator const_iterator;
│ │ │ │ +
805
│ │ │ │ +
809 typedef std::size_t* SphereMap;
│ │ │ │ +
810
│ │ │ │ + │ │ │ │ +
820 VertexSet& connectivity, std::vector<Vertex>& front_);
│ │ │ │ +
821
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
823 {
│ │ │ │ +
824 --id_;
│ │ │ │ +
825 }
│ │ │ │ +
│ │ │ │ +
826
│ │ │ │ +
833 void reconstruct(const Vertex& vertex);
│ │ │ │ +
834
│ │ │ │ +
838 void seed(const Vertex& vertex);
│ │ │ │ +
839
│ │ │ │ +
843 void add(const Vertex& vertex);
│ │ │ │ +
844
│ │ │ │ +
845 void add(std::vector<Vertex>& vertex);
│ │ │ │ +
849 void clear();
│ │ │ │ +
850
│ │ │ │ +
854 typename VertexSet::size_type size();
│ │ │ │ +
858 typename VertexSet::size_type connectSize();
│ │ │ │ +
859
│ │ │ │ +
863 int id();
│ │ │ │ +
864
│ │ │ │ + │ │ │ │ +
867
│ │ │ │ + │ │ │ │ +
870
│ │ │ │ +
871 private:
│ │ │ │ +
875 VertexSet vertices_;
│ │ │ │ +
876
│ │ │ │ +
881 int id_;
│ │ │ │ +
882
│ │ │ │ +
886 MatrixGraph& graph_;
│ │ │ │ +
887
│ │ │ │ +
891 AggregatesMap<Vertex>& aggregates_;
│ │ │ │ +
892
│ │ │ │ +
896 VertexSet& connected_;
│ │ │ │ +
897
│ │ │ │ +
901 std::vector<Vertex>& front_;
│ │ │ │ +
902 };
│ │ │ │ +
│ │ │ │ +
903
│ │ │ │ +
907 template<class G>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
909 {
│ │ │ │ +
910 public:
│ │ │ │ +
911
│ │ │ │ +
915 typedef G MatrixGraph;
│ │ │ │ +
916
│ │ │ │ + │ │ │ │ +
921
│ │ │ │ + │ │ │ │ +
924
│ │ │ │ + │ │ │ │ +
929
│ │ │ │ + │ │ │ │ +
934
│ │ │ │ +
951 template<class M, class C>
│ │ │ │ +
952 std::tuple<int,int,int,int> build(const M& m, G& graph,
│ │ │ │ +
953 AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ │ +
954 bool finestLevel);
│ │ │ │ +
955 private:
│ │ │ │ +
960 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ │ +
961
│ │ │ │ +
965 typedef SLList<Vertex,Allocator> VertexList;
│ │ │ │ +
966
│ │ │ │ +
970 typedef std::set<Vertex,std::less<Vertex>,Allocator> VertexSet;
│ │ │ │ +
971
│ │ │ │ +
975 typedef std::size_t* SphereMap;
│ │ │ │ +
976
│ │ │ │ +
980 MatrixGraph* graph_;
│ │ │ │ +
981
│ │ │ │ + │ │ │ │ +
986
│ │ │ │ +
990 std::vector<Vertex> front_;
│ │ │ │ +
991
│ │ │ │ +
995 VertexSet connected_;
│ │ │ │ +
996
│ │ │ │ +
1000 int size_;
│ │ │ │ +
1001
│ │ │ │ +
1005 class Stack
│ │ │ │ +
1006 {
│ │ │ │ +
1007 public:
│ │ │ │ +
1008 static const Vertex NullEntry;
│ │ │ │ +
1009
│ │ │ │ +
1010 Stack(const MatrixGraph& graph,
│ │ │ │ +
1011 const Aggregator<G>& aggregatesBuilder,
│ │ │ │ +
1012 const AggregatesMap<Vertex>& aggregates);
│ │ │ │ + │ │ │ │ + │ │ │ │ +
1015 private:
│ │ │ │ +
1016 enum { N = 1300000 };
│ │ │ │ +
1017
│ │ │ │ +
1019 const MatrixGraph& graph_;
│ │ │ │ +
1021 const Aggregator<G>& aggregatesBuilder_;
│ │ │ │ +
1023 const AggregatesMap<Vertex>& aggregates_;
│ │ │ │ +
1025 int size_;
│ │ │ │ +
1026 Vertex maxSize_;
│ │ │ │ +
1028 typename MatrixGraph::ConstVertexIterator begin_;
│ │ │ │ + │ │ │ │ +
1030
│ │ │ │ +
1032 Vertex* vals_;
│ │ │ │ +
1033
│ │ │ │ +
1034 };
│ │ │ │ +
1035
│ │ │ │ +
1036 friend class Stack;
│ │ │ │ +
1037
│ │ │ │ +
1048 template<class V>
│ │ │ │ +
1049 void visitAggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ +
1050 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
1051 V& visitor) const;
│ │ │ │ +
1052
│ │ │ │ +
1057 template<class V>
│ │ │ │ +
1058 class AggregateVisitor
│ │ │ │ +
1059 {
│ │ │ │ +
1060 public:
│ │ │ │ +
1064 typedef V Visitor;
│ │ │ │ + │ │ │ │ +
1073 Visitor& visitor);
│ │ │ │ +
1074
│ │ │ │ +
1081 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ +
1082
│ │ │ │ +
1083 private:
│ │ │ │ +
1085 const AggregatesMap<Vertex>& aggregates_;
│ │ │ │ +
1087 AggregateDescriptor aggregate_;
│ │ │ │ +
1089 Visitor* visitor_;
│ │ │ │ +
1090 };
│ │ │ │ +
1091
│ │ │ │ +
1095 class Counter
│ │ │ │ +
1096 {
│ │ │ │ +
1097 public:
│ │ │ │ + │ │ │ │ +
1101 int value();
│ │ │ │ +
1102
│ │ │ │ +
1103 protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
1108
│ │ │ │ +
1109 private:
│ │ │ │ +
1110 int count_;
│ │ │ │ +
1111 };
│ │ │ │ +
1112
│ │ │ │ +
1113
│ │ │ │ +
1118 class FrontNeighbourCounter : public Counter
│ │ │ │ +
1119 {
│ │ │ │ +
1120 public:
│ │ │ │ + │ │ │ │ +
1126
│ │ │ │ +
1127 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ +
1128
│ │ │ │ +
1129 private:
│ │ │ │ +
1130 const MatrixGraph& graph_;
│ │ │ │ +
1131 };
│ │ │ │ +
1132
│ │ │ │ +
1137 int noFrontNeighbours(const Vertex& vertex) const;
│ │ │ │ +
1138
│ │ │ │ +
1142 class TwoWayCounter : public Counter
│ │ │ │ +
1143 {
│ │ │ │ +
1144 public:
│ │ │ │ +
1145 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ +
1146 };
│ │ │ │ +
1147
│ │ │ │ +
1159 int twoWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ │ +
1160 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1161
│ │ │ │ +
1165 class OneWayCounter : public Counter
│ │ │ │ +
1166 {
│ │ │ │ +
1167 public:
│ │ │ │ +
1168 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ +
1169 };
│ │ │ │ +
1170
│ │ │ │ +
1182 int oneWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ │ +
1183 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1184
│ │ │ │ +
1191 class ConnectivityCounter : public Counter
│ │ │ │ +
1192 {
│ │ │ │ +
1193 public:
│ │ │ │ +
1200 ConnectivityCounter(const VertexSet& connected, const AggregatesMap<Vertex>& aggregates);
│ │ │ │ +
1201
│ │ │ │ +
1202 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ +
1203
│ │ │ │ +
1204 private:
│ │ │ │ +
1206 const VertexSet& connected_;
│ │ │ │ +
1208 const AggregatesMap<Vertex>& aggregates_;
│ │ │ │ +
1209
│ │ │ │ +
1210 };
│ │ │ │ +
1211
│ │ │ │ +
1223 double connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1231 bool connected(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ +
1232 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1233
│ │ │ │ +
1241 bool connected(const Vertex& vertex, const SLList<AggregateDescriptor>& aggregateList,
│ │ │ │ +
1242 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1243
│ │ │ │ +
1251 class DependencyCounter : public Counter
│ │ │ │ +
1252 {
│ │ │ │ +
1253 public:
│ │ │ │ + │ │ │ │ +
1258
│ │ │ │ +
1259 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ +
1260 };
│ │ │ │ +
1261
│ │ │ │ +
1268 class FrontMarker
│ │ │ │ +
1269 {
│ │ │ │ +
1270 public:
│ │ │ │ +
1277 FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph);
│ │ │ │ +
1278
│ │ │ │ +
1279 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ │ +
1280
│ │ │ │ +
1281 private:
│ │ │ │ +
1283 std::vector<Vertex>& front_;
│ │ │ │ +
1285 MatrixGraph& graph_;
│ │ │ │ +
1286 };
│ │ │ │ +
1287
│ │ │ │ +
1291 void unmarkFront();
│ │ │ │ +
1292
│ │ │ │ +
1307 int unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1308
│ │ │ │ +
1322 std::pair<int,int> neighbours(const Vertex& vertex,
│ │ │ │ +
1323 const AggregateDescriptor& aggregate,
│ │ │ │ +
1324 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1341 int aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1342
│ │ │ │ +
1350 bool admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1351
│ │ │ │ +
1359 std::size_t distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates);
│ │ │ │ +
1360
│ │ │ │ +
1369 Vertex mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ │ +
1370
│ │ │ │ +
1379 void nonisoNeighbourAggregate(const Vertex& vertex,
│ │ │ │ +
1380 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
1381 SLList<Vertex>& neighbours) const;
│ │ │ │ +
1382
│ │ │ │ +
1390 template<class C>
│ │ │ │ +
1391 void growAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ │ +
1392 template<class C>
│ │ │ │ +
1393 void growIsolatedAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ │ +
1394 };
│ │ │ │ +
│ │ │ │ +
1395
│ │ │ │ +
1396#ifndef DOXYGEN
│ │ │ │ +
1397
│ │ │ │ +
1398 template<class M, class N>
│ │ │ │ +
1399 inline void SymmetricDependency<M,N>::init(const Matrix* matrix)
│ │ │ │ +
1400 {
│ │ │ │ +
1401 matrix_ = matrix;
│ │ │ │ +
1402 }
│ │ │ │ +
1403
│ │ │ │ +
1404 template<class M, class N>
│ │ │ │ +
1405 inline void SymmetricDependency<M,N>::initRow(const Row& row, int index)
│ │ │ │ +
1406 {
│ │ │ │ +
1407 initRow(row, index, std::is_convertible<field_type, real_type>());
│ │ │ │ +
1408 }
│ │ │ │ +
1409
│ │ │ │ +
1410 template<class M, class N>
│ │ │ │ +
1411 inline void SymmetricDependency<M,N>::initRow(const Row& row, int index, const std::false_type&)
│ │ │ │ +
1412 {
│ │ │ │ +
1413 DUNE_THROW(InvalidStateException, "field_type needs to convertible to real_type");
│ │ │ │ +
1414 }
│ │ │ │ +
1415
│ │ │ │ +
1416 template<class M, class N>
│ │ │ │ +
1417 inline void SymmetricDependency<M,N>::initRow([[maybe_unused]] const Row& row, int index, const std::true_type&)
│ │ │ │ +
1418 {
│ │ │ │ +
1419 using std::min;
│ │ │ │ +
1420 maxValue_ = min(- std::numeric_limits<typename Matrix::field_type>::max(), std::numeric_limits<typename Matrix::field_type>::min());
│ │ │ │ +
1421 row_ = index;
│ │ │ │ +
1422 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ │ +
1423 }
│ │ │ │ +
1424
│ │ │ │ +
1425 template<class M, class N>
│ │ │ │ +
1426 inline void SymmetricDependency<M,N>::examine(const ColIter& col)
│ │ │ │ +
1427 {
│ │ │ │ +
1428 using std::max;
│ │ │ │ +
1429 real_type eij = norm_(*col);
│ │ │ │ +
1430 typename Matrix::ConstColIterator opposite_entry =
│ │ │ │ +
1431 matrix_->operator[](col.index()).find(row_);
│ │ │ │ +
1432 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ │ +
1433 {
│ │ │ │ +
1434 // Consider this a weak connection we disregard.
│ │ │ │ +
1435 return;
│ │ │ │ +
1436 }
│ │ │ │ +
1437 real_type eji = norm_(*opposite_entry);
│ │ │ │ +
1438
│ │ │ │ +
1439 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ │ +
1440 if(!N::is_sign_preserving || eij<0 || eji<0)
│ │ │ │ +
1441 maxValue_ = max(maxValue_,
│ │ │ │ +
1442 eij /diagonal_ * eji/
│ │ │ │ +
1443 norm_(matrix_->operator[](col.index())[col.index()]));
│ │ │ │ +
1444 }
│ │ │ │ +
1445
│ │ │ │ +
1446 template<class M, class N>
│ │ │ │ +
1447 template<class G>
│ │ │ │ +
1448 inline void SymmetricDependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ │ +
1449 {
│ │ │ │ +
1450 real_type eij = norm_(*col);
│ │ │ │ +
1451 typename Matrix::ConstColIterator opposite_entry =
│ │ │ │ +
1452 matrix_->operator[](col.index()).find(row_);
│ │ │ │ +
1453
│ │ │ │ +
1454 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ │ +
1455 {
│ │ │ │ +
1456 // Consider this as a weak connection we disregard.
│ │ │ │ +
1457 return;
│ │ │ │ +
1458 }
│ │ │ │ +
1459 real_type eji = norm_(*opposite_entry);
│ │ │ │ +
1460 // skip positve offdiagonals if norm preserves sign of them.
│ │ │ │ +
1461 if(!N::is_sign_preserving || (eij<0 || eji<0))
│ │ │ │ +
1462 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) *
│ │ │ │ +
1463 eij/ diagonal_ > alpha() * maxValue_) {
│ │ │ │ +
1464 edge.properties().setDepends();
│ │ │ │ +
1465 edge.properties().setInfluences();
│ │ │ │ +
1466 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), edge.source());
│ │ │ │ +
1467 other.setInfluences();
│ │ │ │ +
1468 other.setDepends();
│ │ │ │ +
1469 }
│ │ │ │ +
1470 }
│ │ │ │ +
1471
│ │ │ │ +
1472 template<class M, class N>
│ │ │ │ + │ │ │ │ +
1474 {
│ │ │ │ +
1475 return maxValue_ < beta();
│ │ │ │ +
1476 }
│ │ │ │ +
1477
│ │ │ │ +
1478
│ │ │ │ +
1479 template<class M, class N>
│ │ │ │ +
1480 inline void Dependency<M,N>::init(const Matrix* matrix)
│ │ │ │ +
1481 {
│ │ │ │ +
1482 matrix_ = matrix;
│ │ │ │ +
1483 }
│ │ │ │ +
1484
│ │ │ │ +
1485 template<class M, class N>
│ │ │ │ +
1486 inline void Dependency<M,N>::initRow([[maybe_unused]] const Row& row, int index)
│ │ │ │ +
1487 {
│ │ │ │ +
1488 using std::min;
│ │ │ │ +
1489 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ │ +
1490 row_ = index;
│ │ │ │ +
1491 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ │ +
1492 }
│ │ │ │ +
1493
│ │ │ │ +
1494 template<class M, class N>
│ │ │ │ +
1495 inline void Dependency<M,N>::examine(const ColIter& col)
│ │ │ │ +
1496 {
│ │ │ │ +
1497 using std::max;
│ │ │ │ +
1498 maxValue_ = max(maxValue_, -norm_(*col));
│ │ │ │ +
1499 }
│ │ │ │ +
1500
│ │ │ │ +
1501 template<class M, class N>
│ │ │ │ +
1502 template<class G>
│ │ │ │ +
1503 inline void Dependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ │ +
1504 {
│ │ │ │ +
1505 if(-norm_(*col) >= maxValue_ * alpha()) {
│ │ │ │ +
1506 edge.properties().setDepends();
│ │ │ │ +
1507 typedef typename G::EdgeDescriptor ED;
│ │ │ │ +
1508 ED e= graph.findEdge(edge.target(), edge.source());
│ │ │ │ +
1509 if(e!=std::numeric_limits<ED>::max())
│ │ │ │ +
1510 {
│ │ │ │ +
1511 typename G::EdgeProperties& other = graph.getEdgeProperties(e);
│ │ │ │ +
1512 other.setInfluences();
│ │ │ │ +
1513 }
│ │ │ │ +
1514 }
│ │ │ │ +
1515 }
│ │ │ │ +
1516
│ │ │ │ +
1517 template<class M, class N>
│ │ │ │ +
1518 inline bool Dependency<M,N>::isIsolated()
│ │ │ │ +
1519 {
│ │ │ │ +
1520 return maxValue_ < beta() * diagonal_;
│ │ │ │ +
1521 }
│ │ │ │ +
1522
│ │ │ │ +
1523 template<class G,class S>
│ │ │ │ +
1524 Aggregate<G,S>::Aggregate(MatrixGraph& graph, AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
1525 VertexSet& connected, std::vector<Vertex>& front)
│ │ │ │ +
1526 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates),
│ │ │ │ +
1527 connected_(connected), front_(front)
│ │ │ │ +
1528 {}
│ │ │ │ +
1529
│ │ │ │ +
1530 template<class G,class S>
│ │ │ │ +
1531 void Aggregate<G,S>::reconstruct(const Vertex& vertex)
│ │ │ │ +
1532 {
│ │ │ │ +
1533 /*
│ │ │ │ +
1534 vertices_.push_back(vertex);
│ │ │ │ +
1535 typedef typename VertexList::const_iterator iterator;
│ │ │ │ +
1536 iterator begin = vertices_.begin();
│ │ │ │ +
1537 iterator end = vertices_.end();*/
│ │ │ │ +
1538 throw "Not yet implemented";
│ │ │ │ +
1539
│ │ │ │ +
1540 // while(begin!=end){
│ │ │ │ +
1541 //for();
│ │ │ │ +
1542 // }
│ │ │ │ +
1543
│ │ │ │ +
1544 }
│ │ │ │ +
1545
│ │ │ │ +
1546 template<class G,class S>
│ │ │ │ +
1547 inline void Aggregate<G,S>::seed(const Vertex& vertex)
│ │ │ │ +
1548 {
│ │ │ │ +
1549 dvverb<<"Connected cleared"<<std::endl;
│ │ │ │ +
1550 connected_.clear();
│ │ │ │ +
1551 vertices_.clear();
│ │ │ │ +
1552 connected_.insert(vertex);
│ │ │ │ +
1553 dvverb << " Inserting "<<vertex<<" size="<<connected_.size();
│ │ │ │ +
1554 ++id_ ;
│ │ │ │ +
1555 add(vertex);
│ │ │ │ +
1556 }
│ │ │ │ +
1557
│ │ │ │ +
1558
│ │ │ │ +
1559 template<class G,class S>
│ │ │ │ +
1560 inline void Aggregate<G,S>::add(const Vertex& vertex)
│ │ │ │ +
1561 {
│ │ │ │ +
1562 vertices_.insert(vertex);
│ │ │ │ +
1563 aggregates_[vertex]=id_;
│ │ │ │ +
1564 if(front_.size())
│ │ │ │ +
1565 front_.erase(std::lower_bound(front_.begin(), front_.end(), vertex));
│ │ │ │ +
1566
│ │ │ │ +
1567
│ │ │ │ +
1568 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ │ +
1569 const iterator end = graph_.endEdges(vertex);
│ │ │ │ +
1570 for(iterator edge = graph_.beginEdges(vertex); edge != end; ++edge) {
│ │ │ │ +
1571 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ │ +
1572 connected_.insert(aggregates_[edge.target()]);
│ │ │ │ +
1573 dvverb <<" size="<<connected_.size();
│ │ │ │ +
1574 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ │ +
1575 !graph_.getVertexProperties(edge.target()).front())
│ │ │ │ +
1576 {
│ │ │ │ +
1577 front_.push_back(edge.target());
│ │ │ │ +
1578 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ │ +
1579 }
│ │ │ │ +
1580 }
│ │ │ │ +
1581 dvverb <<std::endl;
│ │ │ │ +
1582 std::sort(front_.begin(), front_.end());
│ │ │ │ +
1583 }
│ │ │ │ +
1584
│ │ │ │ +
1585 template<class G,class S>
│ │ │ │ +
1586 inline void Aggregate<G,S>::add(std::vector<Vertex>& vertices)
│ │ │ │ +
1587 {
│ │ │ │ +
1588#ifndef NDEBUG
│ │ │ │ +
1589 std::size_t oldsize = vertices_.size();
│ │ │ │ +
1590#endif
│ │ │ │ +
1591 typedef typename std::vector<Vertex>::iterator Iterator;
│ │ │ │ +
1592
│ │ │ │ +
1593 typedef typename VertexSet::iterator SIterator;
│ │ │ │ +
1594
│ │ │ │ +
1595 SIterator pos=vertices_.begin();
│ │ │ │ +
1596 std::vector<Vertex> newFront;
│ │ │ │ +
1597 newFront.reserve(front_.capacity());
│ │ │ │ +
1598
│ │ │ │ +
1599 std::set_difference(front_.begin(), front_.end(), vertices.begin(), vertices.end(),
│ │ │ │ +
1600 std::back_inserter(newFront));
│ │ │ │ +
1601 front_=newFront;
│ │ │ │ +
1602
│ │ │ │ +
1603 for(Iterator vertex=vertices.begin(); vertex != vertices.end(); ++vertex)
│ │ │ │ +
1604 {
│ │ │ │ +
1605 pos=vertices_.insert(pos,*vertex);
│ │ │ │ +
1606 vertices_.insert(*vertex);
│ │ │ │ +
1607 graph_.getVertexProperties(*vertex).resetFront(); // Not a front node any more.
│ │ │ │ +
1608 aggregates_[*vertex]=id_;
│ │ │ │ +
1609
│ │ │ │ +
1610 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ │ +
1611 const iterator end = graph_.endEdges(*vertex);
│ │ │ │ +
1612 for(iterator edge = graph_.beginEdges(*vertex); edge != end; ++edge) {
│ │ │ │ +
1613 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ │ +
1614 connected_.insert(aggregates_[edge.target()]);
│ │ │ │ +
1615 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ │ +
1616 !graph_.getVertexProperties(edge.target()).front())
│ │ │ │ +
1617 {
│ │ │ │ +
1618 front_.push_back(edge.target());
│ │ │ │ +
1619 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ │ +
1620 }
│ │ │ │ +
1621 dvverb <<" size="<<connected_.size();
│ │ │ │ +
1622 }
│ │ │ │ +
1623 dvverb <<std::endl;
│ │ │ │ +
1624 }
│ │ │ │ +
1625 std::sort(front_.begin(), front_.end());
│ │ │ │ +
1626 assert(oldsize+vertices.size()==vertices_.size());
│ │ │ │ +
1627 }
│ │ │ │ +
1628 template<class G,class S>
│ │ │ │ +
1629 inline void Aggregate<G,S>::clear()
│ │ │ │ +
1630 {
│ │ │ │ +
1631 vertices_.clear();
│ │ │ │ +
1632 connected_.clear();
│ │ │ │ +
1633 id_=-1;
│ │ │ │ +
1634 }
│ │ │ │ +
1635
│ │ │ │ +
1636 template<class G,class S>
│ │ │ │ +
1637 inline typename Aggregate<G,S>::VertexSet::size_type
│ │ │ │ + │ │ │ │ +
1639 {
│ │ │ │ +
1640 return vertices_.size();
│ │ │ │ +
1641 }
│ │ │ │ +
1642
│ │ │ │ +
1643 template<class G,class S>
│ │ │ │ +
1644 inline typename Aggregate<G,S>::VertexSet::size_type
│ │ │ │ + │ │ │ │ +
1646 {
│ │ │ │ +
1647 return connected_.size();
│ │ │ │ +
1648 }
│ │ │ │ +
1649
│ │ │ │ +
1650 template<class G,class S>
│ │ │ │ +
1651 inline int Aggregate<G,S>::id()
│ │ │ │ +
1652 {
│ │ │ │ +
1653 return id_;
│ │ │ │ +
1654 }
│ │ │ │ +
1655
│ │ │ │ +
1656 template<class G,class S>
│ │ │ │ + │ │ │ │ +
1658 {
│ │ │ │ +
1659 return vertices_.begin();
│ │ │ │ +
1660 }
│ │ │ │ +
1661
│ │ │ │ +
1662 template<class G,class S>
│ │ │ │ + │ │ │ │ +
1664 {
│ │ │ │ +
1665 return vertices_.end();
│ │ │ │ +
1666 }
│ │ │ │ +
1667
│ │ │ │ +
1668 template<class V>
│ │ │ │ +
1669 const V AggregatesMap<V>::UNAGGREGATED = std::numeric_limits<V>::max();
│ │ │ │ +
1670
│ │ │ │ +
1671 template<class V>
│ │ │ │ +
1672 const V AggregatesMap<V>::ISOLATED = std::numeric_limits<V>::max()-1;
│ │ │ │ +
1673
│ │ │ │ +
1674 template<class V>
│ │ │ │ + │ │ │ │ +
1676 : aggregates_(0)
│ │ │ │ +
1677 {}
│ │ │ │ +
1678
│ │ │ │ +
1679 template<class V>
│ │ │ │ + │ │ │ │ +
1681 {
│ │ │ │ +
1682 if(aggregates_!=0)
│ │ │ │ +
1683 delete[] aggregates_;
│ │ │ │ +
1684 }
│ │ │ │ +
1685
│ │ │ │ +
1686
│ │ │ │ +
1687 template<class V>
│ │ │ │ +
1688 inline AggregatesMap<V>::AggregatesMap(std::size_t noVertices)
│ │ │ │ +
1689 {
│ │ │ │ +
1690 allocate(noVertices);
│ │ │ │ +
1691 }
│ │ │ │ +
1692
│ │ │ │ +
1693 template<class V>
│ │ │ │ +
1694 inline std::size_t AggregatesMap<V>::noVertices() const
│ │ │ │ +
1695 {
│ │ │ │ +
1696 return noVertices_;
│ │ │ │ +
1697 }
│ │ │ │ +
1698
│ │ │ │ +
1699 template<class V>
│ │ │ │ +
1700 inline void AggregatesMap<V>::allocate(std::size_t noVertices)
│ │ │ │ +
1701 {
│ │ │ │ +
1702 aggregates_ = new AggregateDescriptor[noVertices];
│ │ │ │ +
1703 noVertices_ = noVertices;
│ │ │ │ +
1704
│ │ │ │ +
1705 for(std::size_t i=0; i < noVertices; i++)
│ │ │ │ +
1706 aggregates_[i]=UNAGGREGATED;
│ │ │ │ +
1707 }
│ │ │ │ +
1708
│ │ │ │ +
1709 template<class V>
│ │ │ │ +
1710 inline void AggregatesMap<V>::free()
│ │ │ │ +
1711 {
│ │ │ │ +
1712 assert(aggregates_ != 0);
│ │ │ │ +
1713 delete[] aggregates_;
│ │ │ │ +
1714 aggregates_=0;
│ │ │ │ +
1715 }
│ │ │ │ +
1716
│ │ │ │ +
1717 template<class V>
│ │ │ │ + │ │ │ │ +
1719 AggregatesMap<V>::operator[](const VertexDescriptor& v)
│ │ │ │ +
1720 {
│ │ │ │ +
1721 return aggregates_[v];
│ │ │ │ +
1722 }
│ │ │ │ +
1723
│ │ │ │ +
1724 template<class V>
│ │ │ │ +
1725 inline const typename AggregatesMap<V>::AggregateDescriptor&
│ │ │ │ +
1726 AggregatesMap<V>::operator[](const VertexDescriptor& v) const
│ │ │ │ +
1727 {
│ │ │ │ +
1728 return aggregates_[v];
│ │ │ │ +
1729 }
│ │ │ │ +
1730
│ │ │ │ +
1731 template<class V>
│ │ │ │ +
1732 template<bool reset, class G, class F,class VM>
│ │ │ │ +
1733 inline std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ │ +
1734 const AggregateDescriptor& aggregate,
│ │ │ │ +
1735 const G& graph, F& aggregateVisitor,
│ │ │ │ +
1736 VM& visitedMap) const
│ │ │ │ +
1737 {
│ │ │ │ +
1738 VertexList vlist;
│ │ │ │ +
1739
│ │ │ │ +
1740 DummyEdgeVisitor dummy;
│ │ │ │ +
1741 return breadthFirstSearch<true,reset>(start, aggregate, graph, vlist, aggregateVisitor, dummy, visitedMap);
│ │ │ │ +
1742 }
│ │ │ │ +
1743
│ │ │ │ +
1744 template<class V>
│ │ │ │ +
1745 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ │ +
1746 std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ │ +
1747 const AggregateDescriptor& aggregate,
│ │ │ │ +
1748 const G& graph,
│ │ │ │ +
1749 L& visited,
│ │ │ │ +
1750 F1& aggregateVisitor,
│ │ │ │ +
1751 F2& nonAggregateVisitor,
│ │ │ │ +
1752 VM& visitedMap) const
│ │ │ │ +
1753 {
│ │ │ │ +
1754 typedef typename L::const_iterator ListIterator;
│ │ │ │ +
1755 int visitedSpheres = 0;
│ │ │ │ +
1756
│ │ │ │ +
1757 visited.push_back(start);
│ │ │ │ +
1758 put(visitedMap, start, true);
│ │ │ │ +
1759
│ │ │ │ +
1760 ListIterator current = visited.begin();
│ │ │ │ +
1761 ListIterator end = visited.end();
│ │ │ │ +
1762 std::size_t i=0, size=visited.size();
│ │ │ │ +
1763
│ │ │ │ +
1764 // visit the neighbours of all vertices of the
│ │ │ │ +
1765 // current sphere.
│ │ │ │ +
1766 while(current != end) {
│ │ │ │ +
1767
│ │ │ │ +
1768 for(; i<size; ++current, ++i) {
│ │ │ │ +
1769 typedef typename G::ConstEdgeIterator EdgeIterator;
│ │ │ │ +
1770 const EdgeIterator endEdge = graph.endEdges(*current);
│ │ │ │ +
1771
│ │ │ │ +
1772 for(EdgeIterator edge = graph.beginEdges(*current);
│ │ │ │ +
1773 edge != endEdge; ++edge) {
│ │ │ │ +
1774
│ │ │ │ +
1775 if(aggregates_[edge.target()]==aggregate) {
│ │ │ │ +
1776 if(!get(visitedMap, edge.target())) {
│ │ │ │ +
1777 put(visitedMap, edge.target(), true);
│ │ │ │ +
1778 visited.push_back(edge.target());
│ │ │ │ +
1779 aggregateVisitor(edge);
│ │ │ │ +
1780 }
│ │ │ │ +
1781 }else
│ │ │ │ +
1782 nonAggregateVisitor(edge);
│ │ │ │ +
1783 }
│ │ │ │ +
1784 }
│ │ │ │ +
1785 end = visited.end();
│ │ │ │ +
1786 size = visited.size();
│ │ │ │ +
1787 if(current != end)
│ │ │ │ +
1788 visitedSpheres++;
│ │ │ │ +
1789 }
│ │ │ │ +
1790
│ │ │ │ +
1791 if(reset)
│ │ │ │ +
1792 for(current = visited.begin(); current != end; ++current)
│ │ │ │ +
1793 put(visitedMap, *current, false);
│ │ │ │ +
1794
│ │ │ │ +
1795
│ │ │ │ +
1796 if(remove)
│ │ │ │ +
1797 visited.clear();
│ │ │ │ +
1798
│ │ │ │ +
1799 return visitedSpheres;
│ │ │ │ +
1800 }
│ │ │ │ +
1801
│ │ │ │ +
1802 template<class G>
│ │ │ │ + │ │ │ │ +
1804 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1)
│ │ │ │ +
1805 {}
│ │ │ │ +
1806
│ │ │ │ +
1807 template<class G>
│ │ │ │ + │ │ │ │ +
1809 {
│ │ │ │ +
1810 size_=-1;
│ │ │ │ +
1811 }
│ │ │ │ +
1812
│ │ │ │ +
1813 template<class G, class C>
│ │ │ │ +
1814 void buildDependency(G& graph,
│ │ │ │ +
1815 const typename C::Matrix& matrix,
│ │ │ │ +
1816 C criterion, bool firstlevel)
│ │ │ │ +
1817 {
│ │ │ │ +
1818 // assert(graph.isBuilt());
│ │ │ │ +
1819 typedef typename C::Matrix Matrix;
│ │ │ │ +
1820 typedef typename G::VertexIterator VertexIterator;
│ │ │ │ +
1821
│ │ │ │ +
1822 criterion.init(&matrix);
│ │ │ │ +
1823
│ │ │ │ +
1824 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); ++vertex) {
│ │ │ │ +
1825 typedef typename Matrix::row_type Row;
│ │ │ │ +
1826
│ │ │ │ +
1827 const Row& row = matrix[*vertex];
│ │ │ │ +
1828
│ │ │ │ +
1829 // Tell the criterion what row we will examine now
│ │ │ │ +
1830 // This might for example be used for calculating the
│ │ │ │ +
1831 // maximum offdiagonal value
│ │ │ │ +
1832 criterion.initRow(row, *vertex);
│ │ │ │ +
1833
│ │ │ │ +
1834 // On a first path all columns are examined. After this
│ │ │ │ +
1835 // the calculator should know whether the vertex is isolated.
│ │ │ │ +
1836 typedef typename Matrix::ConstColIterator ColIterator;
│ │ │ │ +
1837 ColIterator end = row.end();
│ │ │ │ +
1838 typename FieldTraits<typename Matrix::field_type>::real_type absoffdiag=0.;
│ │ │ │ +
1839
│ │ │ │ +
1840 using std::max;
│ │ │ │ +
1841 if(firstlevel) {
│ │ │ │ +
1842 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ │ +
1843 if(col.index()!=*vertex) {
│ │ │ │ +
1844 criterion.examine(col);
│ │ │ │ +
1845 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm());
│ │ │ │ +
1846 }
│ │ │ │ +
1847
│ │ │ │ +
1848 if(absoffdiag==0)
│ │ │ │ +
1849 vertex.properties().setExcludedBorder();
│ │ │ │ +
1850 }
│ │ │ │ +
1851 else
│ │ │ │ +
1852 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ │ +
1853 if(col.index()!=*vertex)
│ │ │ │ +
1854 criterion.examine(col);
│ │ │ │ +
1855
│ │ │ │ +
1856 // reset the vertex properties
│ │ │ │ +
1857 //vertex.properties().reset();
│ │ │ │ +
1858
│ │ │ │ +
1859 // Check whether the vertex is isolated.
│ │ │ │ +
1860 if(criterion.isIsolated()) {
│ │ │ │ +
1861 //std::cout<<"ISOLATED: "<<*vertex<<std::endl;
│ │ │ │ +
1862 vertex.properties().setIsolated();
│ │ │ │ +
1863 }else{
│ │ │ │ +
1864 // Examine all the edges beginning at this vertex.
│ │ │ │ +
1865 auto eEnd = vertex.end();
│ │ │ │ +
1866 auto col = matrix[*vertex].begin();
│ │ │ │ +
1867
│ │ │ │ +
1868 for(auto edge = vertex.begin(); edge!= eEnd; ++edge, ++col) {
│ │ │ │ +
1869 // Move to the right column.
│ │ │ │ +
1870 while(col.index()!=edge.target())
│ │ │ │ +
1871 ++col;
│ │ │ │ +
1872 criterion.examine(graph, edge, col);
│ │ │ │ +
1873 }
│ │ │ │ +
1874 }
│ │ │ │ +
1875
│ │ │ │ +
1876 }
│ │ │ │ +
1877 }
│ │ │ │ +
1878
│ │ │ │ +
1879
│ │ │ │ +
1880 template<class G>
│ │ │ │ +
1881 template<class V>
│ │ │ │ +
1882 inline Aggregator<G>::AggregateVisitor<V>::AggregateVisitor(const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
1883 const AggregateDescriptor& aggregate, V& visitor)
│ │ │ │ +
1884 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor)
│ │ │ │ +
1885 {}
│ │ │ │ +
1886
│ │ │ │ +
1887 template<class G>
│ │ │ │ +
1888 template<class V>
│ │ │ │ + │ │ │ │ +
1890 {
│ │ │ │ +
1891 if(aggregates_[edge.target()]==aggregate_)
│ │ │ │ +
1892 visitor_->operator()(edge);
│ │ │ │ +
1893 }
│ │ │ │ +
1894
│ │ │ │ +
1895 template<class G>
│ │ │ │ +
1896 template<class V>
│ │ │ │ +
1897 inline void Aggregator<G>::visitAggregateNeighbours(const Vertex& vertex,
│ │ │ │ +
1898 const AggregateDescriptor& aggregate,
│ │ │ │ +
1899 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
1900 V& visitor) const
│ │ │ │ +
1901 {
│ │ │ │ +
1902 // Only evaluates for edge pointing to the aggregate
│ │ │ │ +
1903 AggregateVisitor<V> v(aggregates, aggregate, visitor);
│ │ │ │ +
1904 visitNeighbours(*graph_, vertex, v);
│ │ │ │ +
1905 }
│ │ │ │ +
1906
│ │ │ │ +
1907
│ │ │ │ +
1908 template<class G>
│ │ │ │ + │ │ │ │ +
1910 : count_(0)
│ │ │ │ +
1911 {}
│ │ │ │ +
1912
│ │ │ │ +
1913 template<class G>
│ │ │ │ + │ │ │ │ +
1915 {
│ │ │ │ +
1916 ++count_;
│ │ │ │ +
1917 }
│ │ │ │ +
1918
│ │ │ │ +
1919 template<class G>
│ │ │ │ + │ │ │ │ +
1921 {
│ │ │ │ +
1922 --count_;
│ │ │ │ +
1923 }
│ │ │ │ +
1924 template<class G>
│ │ │ │ + │ │ │ │ +
1926 {
│ │ │ │ +
1927 return count_;
│ │ │ │ +
1928 }
│ │ │ │ +
1929
│ │ │ │ +
1930 template<class G>
│ │ │ │ + │ │ │ │ +
1932 {
│ │ │ │ +
1933 if(edge.properties().isTwoWay())
│ │ │ │ + │ │ │ │ +
1935 }
│ │ │ │ +
1936
│ │ │ │ +
1937 template<class G>
│ │ │ │ +
1938 int Aggregator<G>::twoWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ +
1939 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
1940 {
│ │ │ │ +
1941 TwoWayCounter counter;
│ │ │ │ +
1942 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ │ +
1943 return counter.value();
│ │ │ │ +
1944 }
│ │ │ │ +
1945
│ │ │ │ +
1946 template<class G>
│ │ │ │ +
1947 int Aggregator<G>::oneWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ │ +
1948 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
1949 {
│ │ │ │ +
1950 OneWayCounter counter;
│ │ │ │ +
1951 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ │ +
1952 return counter.value();
│ │ │ │ +
1953 }
│ │ │ │ +
1954
│ │ │ │ +
1955 template<class G>
│ │ │ │ + │ │ │ │ +
1957 {
│ │ │ │ +
1958 if(edge.properties().isOneWay())
│ │ │ │ + │ │ │ │ +
1960 }
│ │ │ │ +
1961
│ │ │ │ +
1962 template<class G>
│ │ │ │ +
1963 inline Aggregator<G>::ConnectivityCounter::ConnectivityCounter(const VertexSet& connected,
│ │ │ │ +
1964 const AggregatesMap<Vertex>& aggregates)
│ │ │ │ +
1965 : Counter(), connected_(connected), aggregates_(aggregates)
│ │ │ │ +
1966 {}
│ │ │ │ +
1967
│ │ │ │ +
1968
│ │ │ │ +
1969 template<class G>
│ │ │ │ + │ │ │ │ +
1971 {
│ │ │ │ +
1972 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED)
│ │ │ │ +
1973 // Would be a new connection
│ │ │ │ + │ │ │ │ +
1975 else{
│ │ │ │ + │ │ │ │ + │ │ │ │ +
1978 }
│ │ │ │ +
1979 }
│ │ │ │ +
1980
│ │ │ │ +
1981 template<class G>
│ │ │ │ +
1982 inline double Aggregator<G>::connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
1983 {
│ │ │ │ +
1984 ConnectivityCounter counter(connected_, aggregates);
│ │ │ │ +
1985 double noNeighbours=visitNeighbours(*graph_, vertex, counter);
│ │ │ │ +
1986 return (double)counter.value()/noNeighbours;
│ │ │ │ +
1987 }
│ │ │ │ +
1988
│ │ │ │ +
1989 template<class G>
│ │ │ │ + │ │ │ │ +
1991 : Counter()
│ │ │ │ +
1992 {}
│ │ │ │ +
1993
│ │ │ │ +
1994 template<class G>
│ │ │ │ + │ │ │ │ +
1996 {
│ │ │ │ +
1997 if(edge.properties().depends())
│ │ │ │ + │ │ │ │ +
1999 if(edge.properties().influences())
│ │ │ │ + │ │ │ │ +
2001 }
│ │ │ │ +
2002
│ │ │ │ +
2003 template<class G>
│ │ │ │ +
2004 int Aggregator<G>::unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
2005 {
│ │ │ │ +
2006 return aggregateNeighbours(vertex, AggregatesMap<Vertex>::UNAGGREGATED, aggregates);
│ │ │ │ +
2007 }
│ │ │ │ +
2008
│ │ │ │ +
2009 template<class G>
│ │ │ │ +
2010 std::pair<int,int> Aggregator<G>::neighbours(const Vertex& vertex,
│ │ │ │ +
2011 const AggregateDescriptor& aggregate,
│ │ │ │ +
2012 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
2013 {
│ │ │ │ +
2014 DependencyCounter unused, aggregated;
│ │ │ │ +
2015 typedef AggregateVisitor<DependencyCounter> CounterT;
│ │ │ │ +
2016 typedef std::tuple<CounterT,CounterT> CounterTuple;
│ │ │ │ +
2017 CombinedFunctor<CounterTuple> visitors(CounterTuple(CounterT(aggregates, AggregatesMap<Vertex>::UNAGGREGATED, unused), CounterT(aggregates, aggregate, aggregated)));
│ │ │ │ +
2018 visitNeighbours(*graph_, vertex, visitors);
│ │ │ │ +
2019 return std::make_pair(unused.value(), aggregated.value());
│ │ │ │ +
2020 }
│ │ │ │ +
2021
│ │ │ │ +
2022
│ │ │ │ +
2023 template<class G>
│ │ │ │ +
2024 int Aggregator<G>::aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
2025 {
│ │ │ │ +
2026 DependencyCounter counter;
│ │ │ │ +
2027 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ │ +
2028 return counter.value();
│ │ │ │ +
2029 }
│ │ │ │ +
2030
│ │ │ │ +
2031 template<class G>
│ │ │ │ +
2032 std::size_t Aggregator<G>::distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates)
│ │ │ │ +
2033 {
│ │ │ │ +
2034 return 0;
│ │ │ │ +
2035 typename PropertyMapTypeSelector<VertexVisitedTag,G>::Type visitedMap = get(VertexVisitedTag(), *graph_);
│ │ │ │ +
2036 VertexList vlist;
│ │ │ │ +
2037 typename AggregatesMap<Vertex>::DummyEdgeVisitor dummy;
│ │ │ │ +
2038 return aggregates.template breadthFirstSearch<true,true>(vertex,
│ │ │ │ +
2039 aggregate_->id(), *graph_,
│ │ │ │ +
2040 vlist, dummy, dummy, visitedMap);
│ │ │ │ +
2041 }
│ │ │ │ +
2042
│ │ │ │ +
2043 template<class G>
│ │ │ │ +
2044 inline Aggregator<G>::FrontMarker::FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph)
│ │ │ │ +
2045 : front_(front), graph_(graph)
│ │ │ │ +
2046 {}
│ │ │ │ +
2047
│ │ │ │ +
2048 template<class G>
│ │ │ │ + │ │ │ │ +
2050 {
│ │ │ │ +
2051 Vertex target = edge.target();
│ │ │ │ +
2052
│ │ │ │ +
2053 if(!graph_.getVertexProperties(target).front()) {
│ │ │ │ +
2054 front_.push_back(target);
│ │ │ │ +
2055 graph_.getVertexProperties(target).setFront();
│ │ │ │ +
2056 }
│ │ │ │ +
2057 }
│ │ │ │ +
2058
│ │ │ │ +
2059 template<class G>
│ │ │ │ +
2060 inline bool Aggregator<G>::admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
2061 {
│ │ │ │ +
2062 // Todo
│ │ │ │ +
2063 Dune::dvverb<<" Admissible not yet implemented!"<<std::endl;
│ │ │ │ +
2064 return true;
│ │ │ │ +
2065 //Situation 1: front node depends on two nodes. Then these
│ │ │ │ +
2066 // have to be strongly connected to each other
│ │ │ │ +
2067
│ │ │ │ +
2068 // Iterate over all all neighbours of front node
│ │ │ │ +
2069 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ │ +
2070 Iterator vend = graph_->endEdges(vertex);
│ │ │ │ +
2071 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ │ +
2072 // if(edge.properties().depends() && !edge.properties().influences()
│ │ │ │ +
2073 if(edge.properties().isStrong()
│ │ │ │ +
2074 && aggregates[edge.target()]==aggregate)
│ │ │ │ +
2075 {
│ │ │ │ +
2076 // Search for another link to the aggregate
│ │ │ │ +
2077 Iterator edge1 = edge;
│ │ │ │ +
2078 for(++edge1; edge1 != vend; ++edge1) {
│ │ │ │ +
2079 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ │ +
2080 if(edge1.properties().isStrong()
│ │ │ │ +
2081 && aggregates[edge.target()]==aggregate)
│ │ │ │ +
2082 {
│ │ │ │ +
2083 //Search for an edge connecting the two vertices that is
│ │ │ │ +
2084 //strong
│ │ │ │ +
2085 bool found=false;
│ │ │ │ +
2086 Iterator v2end = graph_->endEdges(edge.target());
│ │ │ │ +
2087 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; ++edge2) {
│ │ │ │ +
2088 if(edge2.target()==edge1.target() &&
│ │ │ │ +
2089 edge2.properties().isStrong()) {
│ │ │ │ +
2090 found =true;
│ │ │ │ +
2091 break;
│ │ │ │ +
2092 }
│ │ │ │ +
2093 }
│ │ │ │ +
2094 if(found)
│ │ │ │ +
2095 {
│ │ │ │ +
2096 return true;
│ │ │ │ +
2097 }
│ │ │ │ +
2098 }
│ │ │ │ +
2099 }
│ │ │ │ +
2100 }
│ │ │ │ +
2101 }
│ │ │ │ +
2102
│ │ │ │ +
2103 // Situation 2: cluster node depends on front node and other cluster node
│ │ │ │ +
2105 vend = graph_->endEdges(vertex);
│ │ │ │ +
2106 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ │ +
2107 //if(!edge.properties().depends() && edge.properties().influences()
│ │ │ │ +
2108 if(edge.properties().isStrong()
│ │ │ │ +
2109 && aggregates[edge.target()]==aggregate)
│ │ │ │ +
2110 {
│ │ │ │ +
2111 // Search for a link from target that stays within the aggregate
│ │ │ │ +
2112 Iterator v1end = graph_->endEdges(edge.target());
│ │ │ │ +
2113
│ │ │ │ +
2114 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; ++edge1) {
│ │ │ │ +
2115 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ │ +
2116 if(edge1.properties().isStrong()
│ │ │ │ +
2117 && aggregates[edge1.target()]==aggregate)
│ │ │ │ +
2118 {
│ │ │ │ +
2119 bool found=false;
│ │ │ │ +
2120 // Check if front node is also connected to this one
│ │ │ │ +
2121 Iterator v2end = graph_->endEdges(vertex);
│ │ │ │ +
2122 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) {
│ │ │ │ +
2123 if(edge2.target()==edge1.target()) {
│ │ │ │ +
2124 if(edge2.properties().isStrong())
│ │ │ │ +
2125 found=true;
│ │ │ │ +
2126 break;
│ │ │ │ +
2127 }
│ │ │ │ +
2128 }
│ │ │ │ +
2129 if(found)
│ │ │ │ +
2130 {
│ │ │ │ +
2131 return true;
│ │ │ │ +
2132 }
│ │ │ │ +
2133 }
│ │ │ │ +
2134 }
│ │ │ │ +
2135 }
│ │ │ │ +
2136 }
│ │ │ │ +
2137 return false;
│ │ │ │ +
2138 }
│ │ │ │ +
2139
│ │ │ │ +
2140 template<class G>
│ │ │ │ +
2141 void Aggregator<G>::unmarkFront()
│ │ │ │ +
2142 {
│ │ │ │ +
2143 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ +
2144
│ │ │ │ +
2145 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex)
│ │ │ │ +
2146 graph_->getVertexProperties(*vertex).resetFront();
│ │ │ │ +
2147
│ │ │ │ +
2148 front_.clear();
│ │ │ │ +
2149 }
│ │ │ │ +
2150
│ │ │ │ +
2151 template<class G>
│ │ │ │ +
2152 inline void
│ │ │ │ +
2153 Aggregator<G>::nonisoNeighbourAggregate(const Vertex& vertex,
│ │ │ │ +
2154 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
2155 SLList<Vertex>& neighbours) const
│ │ │ │ +
2156 {
│ │ │ │ +
2157 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ │ +
2158 Iterator end=graph_->beginEdges(vertex);
│ │ │ │ +
2159 neighbours.clear();
│ │ │ │ +
2160
│ │ │ │ +
2161 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge)
│ │ │ │ +
2162 {
│ │ │ │ +
2163 if(aggregates[edge.target()]!=AggregatesMap<Vertex>::UNAGGREGATED && graph_->getVertexProperties(edge.target()).isolated())
│ │ │ │ +
2164 neighbours.push_back(aggregates[edge.target()]);
│ │ │ │ +
2165 }
│ │ │ │ +
2166 }
│ │ │ │ +
2167
│ │ │ │ +
2168 template<class G>
│ │ │ │ +
2169 inline typename G::VertexDescriptor Aggregator<G>::mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
2170 {
│ │ │ │ +
2171 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ │ +
2172
│ │ │ │ +
2173 Iterator end = graph_->endEdges(vertex);
│ │ │ │ +
2174 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) {
│ │ │ │ +
2175 if(aggregates[edge.target()] != AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ │ +
2176 graph_->getVertexProperties(edge.target()).isolated() == graph_->getVertexProperties(edge.source()).isolated()) {
│ │ │ │ +
2177 if( graph_->getVertexProperties(vertex).isolated() ||
│ │ │ │ +
2178 ((edge.properties().depends() || edge.properties().influences())
│ │ │ │ +
2179 && admissible(vertex, aggregates[edge.target()], aggregates)))
│ │ │ │ +
2180 return edge.target();
│ │ │ │ +
2181 }
│ │ │ │ +
2182 }
│ │ │ │ +
2183 return AggregatesMap<Vertex>::UNAGGREGATED;
│ │ │ │ +
2184 }
│ │ │ │ +
2185
│ │ │ │ +
2186 template<class G>
│ │ │ │ + │ │ │ │ +
2188 : Counter(), graph_(graph)
│ │ │ │ +
2189 {}
│ │ │ │ +
2190
│ │ │ │ +
2191 template<class G>
│ │ │ │ + │ │ │ │ +
2193 {
│ │ │ │ +
2194 if(graph_.getVertexProperties(edge.target()).front())
│ │ │ │ + │ │ │ │ +
2196 }
│ │ │ │ +
2197
│ │ │ │ +
2198 template<class G>
│ │ │ │ +
2199 int Aggregator<G>::noFrontNeighbours(const Vertex& vertex) const
│ │ │ │ +
2200 {
│ │ │ │ +
2201 FrontNeighbourCounter counter(*graph_);
│ │ │ │ +
2202 visitNeighbours(*graph_, vertex, counter);
│ │ │ │ +
2203 return counter.value();
│ │ │ │ +
2204 }
│ │ │ │ +
2205 template<class G>
│ │ │ │ +
2206 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ │ +
2207 const AggregateDescriptor& aggregate,
│ │ │ │ +
2208 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
2209 {
│ │ │ │ +
2210 typedef typename G::ConstEdgeIterator iterator;
│ │ │ │ +
2211 const iterator end = graph_->endEdges(vertex);
│ │ │ │ +
2212 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge)
│ │ │ │ +
2213 if(aggregates[edge.target()]==aggregate)
│ │ │ │ +
2214 return true;
│ │ │ │ +
2215 return false;
│ │ │ │ +
2216 }
│ │ │ │ +
2217 template<class G>
│ │ │ │ +
2218 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ │ +
2219 const SLList<AggregateDescriptor>& aggregateList,
│ │ │ │ +
2220 const AggregatesMap<Vertex>& aggregates) const
│ │ │ │ +
2221 {
│ │ │ │ +
2222 typedef typename SLList<AggregateDescriptor>::const_iterator Iter;
│ │ │ │ +
2223 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i)
│ │ │ │ +
2224 if(connected(vertex, *i, aggregates))
│ │ │ │ +
2225 return true;
│ │ │ │ +
2226 return false;
│ │ │ │ +
2227 }
│ │ │ │ +
2228
│ │ │ │ +
2229 template<class G>
│ │ │ │ +
2230 template<class C>
│ │ │ │ +
2231 void Aggregator<G>::growIsolatedAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ │ +
2232 {
│ │ │ │ +
2233 SLList<Vertex> connectedAggregates;
│ │ │ │ +
2234 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates);
│ │ │ │ +
2235
│ │ │ │ +
2236 while(aggregate_->size()< c.minAggregateSize() && aggregate_->connectSize() < c.maxConnectivity()) {
│ │ │ │ +
2237 double maxCon=-1;
│ │ │ │ +
2238 std::size_t maxFrontNeighbours=0;
│ │ │ │ +
2239
│ │ │ │ +
2240 Vertex candidate=AggregatesMap<Vertex>::UNAGGREGATED;
│ │ │ │ +
2241
│ │ │ │ +
2242 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ +
2243
│ │ │ │ +
2244 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ │ +
2245 if(distance(*vertex, aggregates)>c.maxDistance())
│ │ │ │ +
2246 continue; // distance of proposes aggregate too big
│ │ │ │ +
2247
│ │ │ │ +
2248 if(connectedAggregates.size()>0) {
│ │ │ │ +
2249 // there is already a neighbour cluster
│ │ │ │ +
2250 // front node must be connected to same neighbour cluster
│ │ │ │ +
2251
│ │ │ │ +
2252 if(!connected(*vertex, connectedAggregates, aggregates))
│ │ │ │ +
2253 continue;
│ │ │ │ +
2254 }
│ │ │ │ +
2255
│ │ │ │ +
2256 double con = connectivity(*vertex, aggregates);
│ │ │ │ +
2257
│ │ │ │ +
2258 if(con == maxCon) {
│ │ │ │ +
2259 std::size_t frontNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2260
│ │ │ │ +
2261 if(frontNeighbours >= maxFrontNeighbours) {
│ │ │ │ +
2262 maxFrontNeighbours = frontNeighbours;
│ │ │ │ +
2263 candidate = *vertex;
│ │ │ │ +
2264 }
│ │ │ │ +
2265 }else if(con > maxCon) {
│ │ │ │ +
2266 maxCon = con;
│ │ │ │ +
2267 maxFrontNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2268 candidate = *vertex;
│ │ │ │ +
2269 }
│ │ │ │ +
2270 }
│ │ │ │ +
2271
│ │ │ │ +
2272 if(candidate==AggregatesMap<Vertex>::UNAGGREGATED)
│ │ │ │ +
2273 break;
│ │ │ │ +
2274
│ │ │ │ +
2275 aggregate_->add(candidate);
│ │ │ │ +
2276 }
│ │ │ │ +
2277 }
│ │ │ │ +
2278
│ │ │ │ +
2279 template<class G>
│ │ │ │ +
2280 template<class C>
│ │ │ │ +
2281 void Aggregator<G>::growAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ │ +
2282 {
│ │ │ │ +
2283 using std::min;
│ │ │ │ +
2284
│ │ │ │ +
2285 std::size_t distance_ =0;
│ │ │ │ +
2286 while(aggregate_->size() < c.minAggregateSize()&& distance_<c.maxDistance()) {
│ │ │ │ +
2287 int maxTwoCons=0, maxOneCons=0, maxNeighbours=-1;
│ │ │ │ +
2288 double maxCon=-1;
│ │ │ │ +
2289
│ │ │ │ +
2290 std::vector<Vertex> candidates;
│ │ │ │ +
2291 candidates.reserve(30);
│ │ │ │ +
2292
│ │ │ │ +
2293 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ +
2294
│ │ │ │ +
2295 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ │ +
2296 // Only nonisolated nodes are considered
│ │ │ │ +
2297 if(graph_->getVertexProperties(*vertex).isolated())
│ │ │ │ +
2298 continue;
│ │ │ │ +
2299
│ │ │ │ +
2300 int twoWayCons = twoWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ │ +
2301
│ │ │ │ +
2302 /* The case of two way connections. */
│ │ │ │ +
2303 if( maxTwoCons == twoWayCons && twoWayCons > 0) {
│ │ │ │ +
2304 double con = connectivity(*vertex, aggregates);
│ │ │ │ +
2305
│ │ │ │ +
2306 if(con == maxCon) {
│ │ │ │ +
2307 int neighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2308
│ │ │ │ +
2309 if(neighbours > maxNeighbours) {
│ │ │ │ +
2310 maxNeighbours = neighbours;
│ │ │ │ +
2311 candidates.clear();
│ │ │ │ +
2312 candidates.push_back(*vertex);
│ │ │ │ +
2313 }else{
│ │ │ │ +
2314 candidates.push_back(*vertex);
│ │ │ │ +
2315 }
│ │ │ │ +
2316 }else if( con > maxCon) {
│ │ │ │ +
2317 maxCon = con;
│ │ │ │ +
2318 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2319 candidates.clear();
│ │ │ │ +
2320 candidates.push_back(*vertex);
│ │ │ │ +
2321 }
│ │ │ │ +
2322 }else if(twoWayCons > maxTwoCons) {
│ │ │ │ +
2323 maxTwoCons = twoWayCons;
│ │ │ │ +
2324 maxCon = connectivity(*vertex, aggregates);
│ │ │ │ +
2325 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2326 candidates.clear();
│ │ │ │ +
2327 candidates.push_back(*vertex);
│ │ │ │ +
2328
│ │ │ │ +
2329 // two way connections precede
│ │ │ │ +
2330 maxOneCons = std::numeric_limits<int>::max();
│ │ │ │ +
2331 }
│ │ │ │ +
2332
│ │ │ │ +
2333 if(twoWayCons > 0)
│ │ │ │ +
2334 {
│ │ │ │ +
2335 continue; // THis is a two-way node, skip tests for one way nodes
│ │ │ │ +
2336 }
│ │ │ │ +
2337
│ │ │ │ +
2338 /* The one way case */
│ │ │ │ +
2339 int oneWayCons = oneWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ │ +
2340
│ │ │ │ +
2341 if(oneWayCons==0)
│ │ │ │ +
2342 continue; // No strong connections, skip the tests.
│ │ │ │ +
2343
│ │ │ │ +
2344 if(!admissible(*vertex, aggregate_->id(), aggregates))
│ │ │ │ +
2345 continue;
│ │ │ │ +
2346
│ │ │ │ +
2347 if( maxOneCons == oneWayCons && oneWayCons > 0) {
│ │ │ │ +
2348 double con = connectivity(*vertex, aggregates);
│ │ │ │ +
2349
│ │ │ │ +
2350 if(con == maxCon) {
│ │ │ │ +
2351 int neighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2352
│ │ │ │ +
2353 if(neighbours > maxNeighbours) {
│ │ │ │ +
2354 maxNeighbours = neighbours;
│ │ │ │ +
2355 candidates.clear();
│ │ │ │ +
2356 candidates.push_back(*vertex);
│ │ │ │ +
2357 }else{
│ │ │ │ +
2358 if(neighbours==maxNeighbours)
│ │ │ │ +
2359 {
│ │ │ │ +
2360 candidates.push_back(*vertex);
│ │ │ │ +
2361 }
│ │ │ │ +
2362 }
│ │ │ │ +
2363 }else if( con > maxCon) {
│ │ │ │ +
2364 maxCon = con;
│ │ │ │ +
2365 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2366 candidates.clear();
│ │ │ │ +
2367 candidates.push_back(*vertex);
│ │ │ │ +
2368 }
│ │ │ │ +
2369 }else if(oneWayCons > maxOneCons) {
│ │ │ │ +
2370 maxOneCons = oneWayCons;
│ │ │ │ +
2371 maxCon = connectivity(*vertex, aggregates);
│ │ │ │ +
2372 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ │ +
2373 candidates.clear();
│ │ │ │ +
2374 candidates.push_back(*vertex);
│ │ │ │ +
2375 }
│ │ │ │ +
2376 }
│ │ │ │ +
2377
│ │ │ │ +
2378
│ │ │ │ +
2379 if(!candidates.size())
│ │ │ │ +
2380 break; // No more candidates found
│ │ │ │ +
2381 distance_=distance(seed, aggregates);
│ │ │ │ +
2382 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ │ +
2383 aggregate_->size()));
│ │ │ │ +
2384 aggregate_->add(candidates);
│ │ │ │ +
2385 }
│ │ │ │ +
2386 }
│ │ │ │ +
2387
│ │ │ │ +
2388 template<typename V>
│ │ │ │ +
2389 template<typename M, typename G, typename C>
│ │ │ │ +
2390 std::tuple<int,int,int,int> AggregatesMap<V>::buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ │ +
2391 bool finestLevel)
│ │ │ │ +
2392 {
│ │ │ │ +
2393 Aggregator<G> aggregator;
│ │ │ │ +
2394 return aggregator.build(matrix, graph, *this, criterion, finestLevel);
│ │ │ │ +
2395 }
│ │ │ │ +
2396
│ │ │ │ +
2397 template<class G>
│ │ │ │ +
2398 template<class M, class C>
│ │ │ │ +
2399 std::tuple<int,int,int,int> Aggregator<G>::build(const M& m, G& graph, AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ │ +
2400 bool finestLevel)
│ │ │ │ +
2401 {
│ │ │ │ +
2402 using std::max;
│ │ │ │ +
2403 using std::min;
│ │ │ │ +
2404 // Stack for fast vertex access
│ │ │ │ +
2405 Stack stack_(graph, *this, aggregates);
│ │ │ │ +
2406
│ │ │ │ +
2407 graph_ = &graph;
│ │ │ │ +
2408
│ │ │ │ +
2409 aggregate_ = new Aggregate<G,VertexSet>(graph, aggregates, connected_, front_);
│ │ │ │ +
2410
│ │ │ │ +
2411 Timer watch;
│ │ │ │ +
2412 watch.reset();
│ │ │ │ +
2413
│ │ │ │ +
2414 buildDependency(graph, m, c, finestLevel);
│ │ │ │ +
2415
│ │ │ │ +
2416 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
2417 int noAggregates, conAggregates, isoAggregates, oneAggregates;
│ │ │ │ +
2418 std::size_t maxA=0, minA=1000000, avg=0;
│ │ │ │ +
2419 int skippedAggregates;
│ │ │ │ +
2420 noAggregates = conAggregates = isoAggregates = oneAggregates =
│ │ │ │ +
2421 skippedAggregates = 0;
│ │ │ │ +
2422
│ │ │ │ +
2423 while(true) {
│ │ │ │ +
2424 Vertex seed = stack_.pop();
│ │ │ │ +
2425
│ │ │ │ +
2426 if(seed == Stack::NullEntry)
│ │ │ │ +
2427 // No more unaggregated vertices. We are finished!
│ │ │ │ +
2428 break;
│ │ │ │ +
2429
│ │ │ │ +
2430 // Debugging output
│ │ │ │ +
2431 if((noAggregates+1)%10000 == 0)
│ │ │ │ +
2432 Dune::dverb<<"c";
│ │ │ │ +
2433 unmarkFront();
│ │ │ │ +
2434
│ │ │ │ +
2435 if(graph.getVertexProperties(seed).excludedBorder()) {
│ │ │ │ +
2436 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ │ +
2437 ++skippedAggregates;
│ │ │ │ +
2438 continue;
│ │ │ │ +
2439 }
│ │ │ │ +
2440
│ │ │ │ +
2441 if(graph.getVertexProperties(seed).isolated()) {
│ │ │ │ +
2442 if(c.skipIsolated()) {
│ │ │ │ +
2443 // isolated vertices are not aggregated but skipped on the coarser levels.
│ │ │ │ +
2444 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ │ +
2445 ++skippedAggregates;
│ │ │ │ +
2446 // skip rest as no agglomeration is done.
│ │ │ │ +
2447 continue;
│ │ │ │ +
2448 }else{
│ │ │ │ +
2449 aggregate_->seed(seed);
│ │ │ │ +
2450 growIsolatedAggregate(seed, aggregates, c);
│ │ │ │ +
2451 }
│ │ │ │ +
2452 }else{
│ │ │ │ +
2453 aggregate_->seed(seed);
│ │ │ │ +
2454 growAggregate(seed, aggregates, c);
│ │ │ │ +
2455 }
│ │ │ │ +
2456
│ │ │ │ +
2457 /* The rounding step. */
│ │ │ │ +
2458 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->size() < c.maxAggregateSize()) {
│ │ │ │ +
2459
│ │ │ │ +
2460 std::vector<Vertex> candidates;
│ │ │ │ +
2461 candidates.reserve(30);
│ │ │ │ +
2462
│ │ │ │ +
2463 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ │ +
2464
│ │ │ │ +
2465 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ │ +
2466
│ │ │ │ +
2467 if(graph.getVertexProperties(*vertex).isolated())
│ │ │ │ +
2468 continue; // No isolated nodes here
│ │ │ │ +
2469
│ │ │ │ +
2470 if(twoWayConnections( *vertex, aggregate_->id(), aggregates) == 0 &&
│ │ │ │ +
2471 (oneWayConnections( *vertex, aggregate_->id(), aggregates) == 0 ||
│ │ │ │ +
2472 !admissible( *vertex, aggregate_->id(), aggregates) ))
│ │ │ │ +
2473 continue;
│ │ │ │ +
2474
│ │ │ │ +
2475 std::pair<int,int> neighbourPair=neighbours(*vertex, aggregate_->id(),
│ │ │ │ +
2476 aggregates);
│ │ │ │ +
2477
│ │ │ │ +
2478 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= unusedNeighbours(*vertex, aggregates))
│ │ │ │ +
2479 // continue;
│ │ │ │ +
2480
│ │ │ │ +
2481 if(neighbourPair.first >= neighbourPair.second)
│ │ │ │ +
2482 continue;
│ │ │ │ +
2483
│ │ │ │ +
2484 if(distance(*vertex, aggregates) > c.maxDistance())
│ │ │ │ +
2485 continue; // Distance too far
│ │ │ │ +
2486 candidates.push_back(*vertex);
│ │ │ │ +
2487 break;
│ │ │ │ +
2488 }
│ │ │ │ +
2489
│ │ │ │ +
2490 if(!candidates.size()) break; // no more candidates found.
│ │ │ │ +
2491
│ │ │ │ +
2492 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ │ +
2493 aggregate_->size()));
│ │ │ │ +
2494 aggregate_->add(candidates);
│ │ │ │ +
2495
│ │ │ │ +
2496 }
│ │ │ │ +
2497
│ │ │ │ +
2498 // try to merge aggregates consisting of only one nonisolated vertex with other aggregates
│ │ │ │ +
2499 if(aggregate_->size()==1 && c.maxAggregateSize()>1) {
│ │ │ │ +
2500 if(!graph.getVertexProperties(seed).isolated()) {
│ │ │ │ +
2501 Vertex mergedNeighbour = mergeNeighbour(seed, aggregates);
│ │ │ │ +
2502
│ │ │ │ +
2503 if(mergedNeighbour != AggregatesMap<Vertex>::UNAGGREGATED) {
│ │ │ │ +
2504 // assign vertex to the neighbouring cluster
│ │ │ │ +
2505 aggregates[seed] = aggregates[mergedNeighbour];
│ │ │ │ +
2506 aggregate_->invalidate();
│ │ │ │ +
2507 }else{
│ │ │ │ +
2508 ++avg;
│ │ │ │ +
2509 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ │ +
2510 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ │ +
2511 ++oneAggregates;
│ │ │ │ +
2512 ++conAggregates;
│ │ │ │ +
2513 }
│ │ │ │ +
2514 }else{
│ │ │ │ +
2515 ++avg;
│ │ │ │ +
2516 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ │ +
2517 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ │ +
2518 ++oneAggregates;
│ │ │ │ +
2519 ++isoAggregates;
│ │ │ │ +
2520 }
│ │ │ │ +
2521 ++avg;
│ │ │ │ +
2522 }else{
│ │ │ │ +
2523 avg+=aggregate_->size();
│ │ │ │ +
2524 minA=min(minA,aggregate_->size());
│ │ │ │ +
2525 maxA=max(maxA,aggregate_->size());
│ │ │ │ +
2526 if(graph.getVertexProperties(seed).isolated())
│ │ │ │ +
2527 ++isoAggregates;
│ │ │ │ +
2528 else
│ │ │ │ +
2529 ++conAggregates;
│ │ │ │ +
2530 }
│ │ │ │ +
2531
│ │ │ │ +
2532 }
│ │ │ │ +
2533
│ │ │ │ +
2534 Dune::dinfo<<"connected aggregates: "<<conAggregates;
│ │ │ │ +
2535 Dune::dinfo<<" isolated aggregates: "<<isoAggregates;
│ │ │ │ +
2536 if(conAggregates+isoAggregates>0)
│ │ │ │ +
2537 Dune::dinfo<<" one node aggregates: "<<oneAggregates<<" min size="
│ │ │ │ +
2538 <<minA<<" max size="<<maxA
│ │ │ │ +
2539 <<" avg="<<avg/(conAggregates+isoAggregates)<<std::endl;
│ │ │ │ +
2540
│ │ │ │ +
2541 delete aggregate_;
│ │ │ │ +
2542 return std::make_tuple(conAggregates+isoAggregates,isoAggregates,
│ │ │ │ +
2543 oneAggregates,skippedAggregates);
│ │ │ │ +
2544 }
│ │ │ │ +
2545
│ │ │ │ +
2546
│ │ │ │ +
2547 template<class G>
│ │ │ │ +
2548 Aggregator<G>::Stack::Stack(const MatrixGraph& graph, const Aggregator<G>& aggregatesBuilder,
│ │ │ │ +
2549 const AggregatesMap<Vertex>& aggregates)
│ │ │ │ +
2550 : graph_(graph), aggregatesBuilder_(aggregatesBuilder), aggregates_(aggregates), begin_(graph.begin()), end_(graph.end())
│ │ │ │ +
2551 {
│ │ │ │ +
2552 //vals_ = new Vertex[N];
│ │ │ │ +
2553 }
│ │ │ │ +
2554
│ │ │ │ +
2555 template<class G>
│ │ │ │ + │ │ │ │ +
2557 {
│ │ │ │ +
2558 //Dune::dverb << "Max stack size was "<<maxSize_<<" filled="<<filled_<<std::endl;
│ │ │ │ +
2559 //delete[] vals_;
│ │ │ │ +
2560 }
│ │ │ │ +
2561
│ │ │ │ +
2562 template<class G>
│ │ │ │ + │ │ │ │ +
2564 = std::numeric_limits<typename G::VertexDescriptor>::max();
│ │ │ │ +
2565
│ │ │ │ +
2566 template<class G>
│ │ │ │ +
2567 inline typename G::VertexDescriptor Aggregator<G>::Stack::pop()
│ │ │ │ +
2568 {
│ │ │ │ +
2569 for(; begin_!=end_ && aggregates_[*begin_] != AggregatesMap<Vertex>::UNAGGREGATED; ++begin_) ;
│ │ │ │ +
2570
│ │ │ │ +
2571 if(begin_!=end_)
│ │ │ │ +
2572 {
│ │ │ │ +
2573 typename G::VertexDescriptor current=*begin_;
│ │ │ │ +
2574 ++begin_;
│ │ │ │ +
2575 return current;
│ │ │ │ +
2576 }else
│ │ │ │ +
2577 return NullEntry;
│ │ │ │ +
2578 }
│ │ │ │ +
2579
│ │ │ │ +
2580#endif // DOXYGEN
│ │ │ │ +
2581
│ │ │ │ +
2582 template<class V>
│ │ │ │ +
│ │ │ │ +
2583 void printAggregates2d(const AggregatesMap<V>& aggregates, int n, int m, std::ostream& os)
│ │ │ │ +
2584 {
│ │ │ │ +
2585 using std::max;
│ │ │ │ +
2586
│ │ │ │ +
2587 std::ios_base::fmtflags oldOpts=os.flags();
│ │ │ │ +
2588
│ │ │ │ +
2589 os.setf(std::ios_base::right, std::ios_base::adjustfield);
│ │ │ │ +
2590
│ │ │ │ +
2591 V maxVal=0;
│ │ │ │ +
2592 int width=1;
│ │ │ │ +
2593
│ │ │ │ +
2594 for(int i=0; i< n*m; i++)
│ │ │ │ +
2595 maxVal=max(maxVal, aggregates[i]);
│ │ │ │ +
2596
│ │ │ │ +
2597 for(int i=10; i < 1000000; i*=10)
│ │ │ │ +
2598 if(maxVal/i>0)
│ │ │ │ +
2599 width++;
│ │ │ │ +
2600 else
│ │ │ │ +
2601 break;
│ │ │ │ +
2602
│ │ │ │ +
2603 for(int j=0, entry=0; j < m; j++) {
│ │ │ │ +
2604 for(int i=0; i<n; i++, entry++) {
│ │ │ │ +
2605 os.width(width);
│ │ │ │ +
2606 os<<aggregates[entry]<<" ";
│ │ │ │ +
2607 }
│ │ │ │ +
2608
│ │ │ │ +
2609 os<<std::endl;
│ │ │ │ +
2610 }
│ │ │ │ +
2611 os<<std::endl;
│ │ │ │ +
2612 os.flags(oldOpts);
│ │ │ │ +
2613 }
│ │ │ │ +
│ │ │ │ +
2614
│ │ │ │ +
2615
│ │ │ │ +
2616 } // namespace Amg
│ │ │ │ +
2617
│ │ │ │ +
2618} // namespace Dune
│ │ │ │ +
2619
│ │ │ │ +
2620
│ │ │ │ +
2621#endif
│ │ │ │ + │ │ │ │ +
Parameter classes for customizing AMG.
│ │ │ │ +
Provides classes for building the matrix graph.
│ │ │ │ +
Provides classes for handling internal properties in a graph.
│ │ │ │
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
bool operator()(const OverlapVertex< A > &o1, const OverlapVertex< A > &o2)
Definition galerkin.hh:155
│ │ │ │ -
static void constructNonOverlapConnectivity(R &row, G &graph, V &visitedMap, const AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::VertexDescriptor &seed)
Construct the connectivity of an aggregate in the overlap.
Definition galerkin.hh:313
│ │ │ │ -
G Graph
The type of the graph.
Definition galerkin.hh:211
│ │ │ │ -
void operator++()
Definition galerkin.hh:539
│ │ │ │ -
void operator()(const ConstEdgeIterator &edge)
Process an edge pointing to another aggregate.
Definition galerkin.hh:359
│ │ │ │ -
void insert(const typename M::size_type &index)
Definition galerkin.hh:552
│ │ │ │ -
static void constructOverlapConnectivity(R &row, G &graph, V &visitedMap, const AggregatesMap< typename G::VertexDescriptor > &aggregates, const OverlapVertex< typename G::VertexDescriptor > *&seed, const OverlapVertex< typename G::VertexDescriptor > *overlapEnd)
Definition galerkin.hh:331
│ │ │ │ -
G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation &pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::Matrix::size_type &size, const Set &copy)
Calculates the coarse matrix via a Galerkin product.
Definition galerkin.hh:563
│ │ │ │ -
std::size_t index()
Definition galerkin.hh:81
│ │ │ │ -
T ParallelInformation
Definition galerkin.hh:120
│ │ │ │ -
G::VertexDescriptor Vertex
Definition galerkin.hh:272
│ │ │ │ -
T Aggregate
The aggregate descriptor.
Definition galerkin.hh:37
│ │ │ │ -
SparsityBuilder(M &matrix)
Constructor.
Definition galerkin.hh:513
│ │ │ │ -
ConnectedBuilder(const AggregatesMap< Vertex > &aggregates, Graph &graph, VisitedMap &visitedMap, Set &connected)
Constructor.
Definition galerkin.hh:352
│ │ │ │ -
Graph::ConstEdgeIterator ConstEdgeIterator
The constant edge iterator.
Definition galerkin.hh:215
│ │ │ │ -
T Vertex
The vertex descriptor.
Definition galerkin.hh:42
│ │ │ │ -
G::VertexDescriptor Vertex
Definition galerkin.hh:288
│ │ │ │ -
static void examine(G &graph, V &visitedMap, const T &pinfo, const AggregatesMap< Vertex > &aggregates, const O &overlap, const OverlapVertex< Vertex > *overlapVertices, const OverlapVertex< Vertex > *overlapEnd, R &row)
Definition galerkin.hh:420
│ │ │ │ -
V VisitedMap
The type of the map for marking vertices as visited.
Definition galerkin.hh:225
│ │ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:273
│ │ │ │ +
std::vector< real_type >::iterator valIter_
Definition aggregates.hh:189
│ │ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:154
│ │ │ │ +
std::size_t breadthFirstSearch(const VertexDescriptor &start, const AggregateDescriptor &aggregate, const G &graph, L &visited, F1 &aggregateVisitor, F2 &nonAggregateVisitor, VM &visitedMap) const
Breadth first search within an aggregate.
│ │ │ │ +
PoolAllocator< VertexDescriptor, 100 > Allocator
The allocator we use for our lists and the set.
Definition aggregates.hh:586
│ │ │ │ +
iterator begin()
Definition aggregates.hh:737
│ │ │ │ +
int id()
Get the id identifying the aggregate.
│ │ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:302
│ │ │ │ +
MatrixGraph::VertexDescriptor Vertex
The vertex identifier.
Definition aggregates.hh:920
│ │ │ │ +
AggregationCriterion()
Constructor.
Definition aggregates.hh:66
│ │ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:357
│ │ │ │ +
auto operator()(const M &m, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr) const
Compute the norm of a scalar.
Definition aggregates.hh:406
│ │ │ │ +
void initRow(const Row &row, int index)
│ │ │ │ +
SymmetricMatrixDependency(const Parameters &parms)
Definition aggregates.hh:168
│ │ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:258
│ │ │ │ + │ │ │ │ +
G MatrixGraph
The matrix graph type used.
Definition aggregates.hh:915
│ │ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:363
│ │ │ │ +
void operator()(const EdgeIterator &edge) const
Definition aggregates.hh:601
│ │ │ │ +
SymmetricCriterion()
Definition aggregates.hh:524
│ │ │ │ +
Dependency()
Definition aggregates.hh:290
│ │ │ │ +
void examine(const ColIter &col)
│ │ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:319
│ │ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:187
│ │ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:263
│ │ │ │ +
iterator end()
Definition aggregates.hh:742
│ │ │ │ +
UnSymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:541
│ │ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ +
void initRow(const Row &row, int index)
Definition aggregates.hh:201
│ │ │ │ + │ │ │ │ +
static const Vertex NullEntry
Definition aggregates.hh:1008
│ │ │ │ +
void examine(const ColIter &col)
Definition aggregates.hh:214
│ │ │ │ +
Dependency(const Parameters &parms)
Definition aggregates.hh:286
│ │ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:185
│ │ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ +
std::tuple< int, int, int, int > build(const M &m, G &graph, AggregatesMap< Vertex > &aggregates, const C &c, bool finestLevel)
Build the aggregates.
│ │ │ │ +
FrontNeighbourCounter(const MatrixGraph &front)
Constructor.
│ │ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:329
│ │ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:296
│ │ │ │ +
const AggregateDescriptor & operator[](const VertexDescriptor &v) const
Get the aggregate a vertex belongs to.
│ │ │ │ +
void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter &col)
│ │ │ │ +
AggregateVisitor(const AggregatesMap< Vertex > &aggregates, const AggregateDescriptor &aggregate, Visitor &visitor)
Constructor.
│ │ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:334
│ │ │ │ +
~AggregatesMap()
Destructor.
│ │ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:179
│ │ │ │ +
void decrement()
Decrement counter.
│ │ │ │ +
Aggregate(MatrixGraph &graph, AggregatesMap< Vertex > &aggregates, VertexSet &connectivity, std::vector< Vertex > &front_)
Constructor.
│ │ │ │ +
V Visitor
The type of the adapted visitor.
Definition aggregates.hh:1064
│ │ │ │ +
std::size_t * SphereMap
Type of the mapping of aggregate members onto distance spheres.
Definition aggregates.hh:809
│ │ │ │ +
AggregationCriterion(const Parameters &parms)
Definition aggregates.hh:70
│ │ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:268
│ │ │ │ +
VertexSet::size_type connectSize()
Get tne number of connections to other aggregates.
│ │ │ │ +
std::vector< real_type > vals_
Definition aggregates.hh:188
│ │ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:324
│ │ │ │ +
void printAggregates2d(const AggregatesMap< V > &aggregates, int n, int m, std::ostream &os)
Definition aggregates.hh:2583
│ │ │ │ +
void invalidate()
Definition aggregates.hh:822
│ │ │ │ +
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ │ +
real_type maxValue_
Definition aggregates.hh:181
│ │ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:183
│ │ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ +
VertexSet::const_iterator const_iterator
Const iterator over a vertex list.
Definition aggregates.hh:804
│ │ │ │ +
SymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:521
│ │ │ │ +
MatrixGraph::VertexDescriptor AggregateDescriptor
The type of the aggregate descriptor.
Definition aggregates.hh:923
│ │ │ │ +
real_type maxValue_
Definition aggregates.hh:361
│ │ │ │ +
void init(const Matrix *matrix)
Definition aggregates.hh:195
│ │ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:367
│ │ │ │ +
AggregateDescriptor * iterator
Definition aggregates.hh:735
│ │ │ │ +
SymmetricDependency(const Parameters &parms)
Definition aggregates.hh:348
│ │ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:360
│ │ │ │ +
~Aggregator()
Destructor.
│ │ │ │ +
void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter &col)
│ │ │ │ +
void add(const Vertex &vertex)
Add a vertex to the aggregate.
│ │ │ │ +
T DependencyPolicy
The policy for calculating the dependency graph.
Definition aggregates.hh:55
│ │ │ │ +
void add(std::vector< Vertex > &vertex)
│ │ │ │ +
void examine(const ColIter &col)
│ │ │ │ +
Aggregator()
Constructor.
│ │ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
Examine an edge.
│ │ │ │ +
FrontMarker(std::vector< Vertex > &front, MatrixGraph &graph)
Constructor.
│ │ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:506
│ │ │ │ +
void init(const Matrix *matrix)
│ │ │ │
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ │ -
S Set
The type of the connected set.
Definition galerkin.hh:220
│ │ │ │ -
Aggregate * aggregate
The aggregate the vertex belongs to.
Definition galerkin.hh:47
│ │ │ │ -
std::size_t sumRowSize()
Definition galerkin.hh:534
│ │ │ │ -
Vertex vertex
The vertex descriptor.
Definition galerkin.hh:52
│ │ │ │ -
std::size_t minRowSize()
Definition galerkin.hh:528
│ │ │ │ -
static void set(M &coarse, const T &pinfo, const O &copy)
Definition galerkin.hh:682
│ │ │ │ -
Graph::VertexDescriptor Vertex
The vertex descriptor of the graph.
Definition galerkin.hh:230
│ │ │ │ -
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ │ -
std::size_t maxRowSize()
Definition galerkin.hh:523
│ │ │ │ -
STL namespace.
│ │ │ │ +
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition aggregates.hh:82
│ │ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │ +
V AggregateDescriptor
The aggregate descriptor type.
Definition aggregates.hh:580
│ │ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:365
│ │ │ │ +
SymmetricMatrixDependency()
Definition aggregates.hh:171
│ │ │ │ + │ │ │ │ + │ │ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:306
│ │ │ │ +
std::size_t noVertices() const
Get the number of vertices.
│ │ │ │ +
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an aisotropic problem.
Definition aggregates.hh:105
│ │ │ │ +
AggregatesMap(std::size_t noVertices)
Constructs with allocating memory.
│ │ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:359
│ │ │ │ +
AggregateDescriptor & operator[](const VertexDescriptor &v)
Get the aggregate a vertex belongs to.
│ │ │ │ +
AggregatesMap()
Constructs without allocating memory.
│ │ │ │ +
int value()
Access the current count.
│ │ │ │ +
SLList< VertexDescriptor, Allocator > VertexList
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:592
│ │ │ │ + │ │ │ │ +
ConnectivityCounter(const VertexSet &connected, const AggregatesMap< Vertex > &aggregates)
Constructor.
│ │ │ │ +
VertexSet::size_type size()
Get the size of the aggregate.
│ │ │ │ +
const_iterator end() const
get an iterator over the vertices of the aggregate.
│ │ │ │ +
void init(const Matrix *matrix)
│ │ │ │ +
UnSymmetricCriterion()
Definition aggregates.hh:544
│ │ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ +
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:304
│ │ │ │ +
Stack(const MatrixGraph &graph, const Aggregator< G > &aggregatesBuilder, const AggregatesMap< Vertex > &aggregates)
│ │ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:180
│ │ │ │ +
void initRow(const Row &row, int index)
│ │ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:139
│ │ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:299
│ │ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:177
│ │ │ │ +
S VertexSet
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:801
│ │ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:490
│ │ │ │ +
static const V UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition aggregates.hh:566
│ │ │ │ +
std::size_t breadthFirstSearch(const VertexDescriptor &start, const AggregateDescriptor &aggregate, const G &graph, F &aggregateVisitor, VM &visitedMap) const
Breadth first search within an aggregate.
│ │ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:298
│ │ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ +
std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > &criterion)
Definition aggregates.hh:113
│ │ │ │ +
bool isIsolated()
Definition aggregates.hh:240
│ │ │ │ +
void allocate(std::size_t noVertices)
Allocate memory for holding the information.
│ │ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:144
│ │ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:473
│ │ │ │ +
void reconstruct(const Vertex &vertex)
Reconstruct the aggregat from an seed node.
│ │ │ │ +
const_iterator begin() const
get an iterator over the vertices of the aggregate.
│ │ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr) const
compute the norm of a matrix.
Definition aggregates.hh:390
│ │ │ │ +
MatrixGraph::VertexDescriptor Vertex
The vertex descriptor type.
Definition aggregates.hh:789
│ │ │ │ +
void seed(const Vertex &vertex)
Initialize the aggregate with one vertex.
│ │ │ │ + │ │ │ │ +
SymmetricDependency()
Definition aggregates.hh:351
│ │ │ │ +
void clear()
Clear the aggregate.
│ │ │ │ +
void free()
Free the allocated memory.
│ │ │ │ +
void increment()
Increment counter.
│ │ │ │ +
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
│ │ │ │ +
V VertexDescriptor
The vertex descriptor type.
Definition aggregates.hh:575
│ │ │ │ +
real_type maxValue_
Definition aggregates.hh:300
│ │ │ │ +
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
│ │ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:149
│ │ │ │ +
PoolAllocator< Vertex, 100 > Allocator
The allocator we use for our lists and the set.
Definition aggregates.hh:795
│ │ │ │ +
G MatrixGraph
Definition aggregates.hh:785
│ │ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ │ +
@ is_sign_preserving
Definition aggregates.hh:483
│ │ │ │ +
@ is_sign_preserving
Definition aggregates.hh:382
│ │ │ │ +
@ is_sign_preserving
Definition aggregates.hh:499
│ │ │ │ +
@ is_sign_preserving
Definition aggregates.hh:466
│ │ │ │
Definition allocator.hh:11
│ │ │ │
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ │ +
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ │ +
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ │ +
Base class of all aggregation criterions.
Definition aggregates.hh:49
│ │ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:134
│ │ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:253
│ │ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:314
│ │ │ │ +
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:379
│ │ │ │ +
Norm that uses only the [0][0] entry of the block to determine couplings.
Definition aggregates.hh:455
│ │ │ │ +
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:463
│ │ │ │ +
Definition aggregates.hh:480
│ │ │ │ +
Definition aggregates.hh:496
│ │ │ │ +
Criterion taking advantage of symmetric matrices.
Definition aggregates.hh:519
│ │ │ │ +
Criterion suitable for unsymmetric matrices.
Definition aggregates.hh:539
│ │ │ │ +
Class for building the aggregates.
Definition aggregates.hh:909
│ │ │ │
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:598
│ │ │ │ -
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
│ │ │ │ +
A class for temporarily storing the vertices of an aggregate in.
Definition aggregates.hh:778
│ │ │ │ +
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ │ +
EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:298
│ │ │ │ +
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ │ +
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │ │ +
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,816 +1,2654 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -galerkin.hh │ │ │ │ │ +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 (C) 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_AMG_AGGREGATES_HH │ │ │ │ │ +6#define DUNE_AMG_AGGREGATES_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ │ -9#include "_p_i_n_f_o_._h_h" │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16namespace _D_u_n_e │ │ │ │ │ -17{ │ │ │ │ │ -18 namespace Amg │ │ │ │ │ -19 { │ │ │ │ │ -31 template │ │ │ │ │ -_3_2 struct _O_v_e_r_l_a_p_V_e_r_t_e_x │ │ │ │ │ -33 { │ │ │ │ │ -_3_7 typedef T _A_g_g_r_e_g_a_t_e; │ │ │ │ │ -38 │ │ │ │ │ -_4_2 typedef T _V_e_r_t_e_x; │ │ │ │ │ -43 │ │ │ │ │ -_4_7 _A_g_g_r_e_g_a_t_e* _a_g_g_r_e_g_a_t_e; │ │ │ │ │ -48 │ │ │ │ │ -_5_2 _V_e_r_t_e_x _v_e_r_t_e_x; │ │ │ │ │ -53 }; │ │ │ │ │ -54 │ │ │ │ │ -55 │ │ │ │ │ +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 │ │ │ │ │ +21#include │ │ │ │ │ +22#include │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26#include │ │ │ │ │ +27#include │ │ │ │ │ +28 │ │ │ │ │ +29namespace _D_u_n_e │ │ │ │ │ +30{ │ │ │ │ │ +31 namespace Amg │ │ │ │ │ +32 { │ │ │ │ │ +33 │ │ │ │ │ +47 template │ │ │ │ │ +_4_8 class _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n : public T │ │ │ │ │ +49 { │ │ │ │ │ +50 │ │ │ │ │ +51 public: │ │ │ │ │ +_5_5 typedef T _D_e_p_e_n_d_e_n_c_y_P_o_l_i_c_y; │ │ │ │ │ 56 │ │ │ │ │ -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 }; │ │ │ │ │ +_6_6 _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n() │ │ │ │ │ +67 : T() │ │ │ │ │ +68 {} │ │ │ │ │ +69 │ │ │ │ │ +_7_0 _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ +71 : T(parms) │ │ │ │ │ +72 {} │ │ │ │ │ +_8_2 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(std::size_t dim, std::size_t diameter=2) │ │ │ │ │ +83 { │ │ │ │ │ +84 this->setMaxDistance(diameter-1); │ │ │ │ │ +85 std::size_t csize=1; │ │ │ │ │ +86 │ │ │ │ │ +87 for(; dim>0; dim--) { │ │ │ │ │ +88 csize*=diameter; │ │ │ │ │ +89 this->setMaxDistance(this->maxDistance()+diameter-1); │ │ │ │ │ +90 } │ │ │ │ │ +91 this->setMinAggregateSize(csize); │ │ │ │ │ +92 this->setMaxAggregateSize(static_cast(csize*1.5)); │ │ │ │ │ +93 } │ │ │ │ │ +94 │ │ │ │ │ +_1_0_5 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c(std::size_t dim,std::size_t diameter=2) │ │ │ │ │ +106 { │ │ │ │ │ +107 _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(dim, diameter); │ │ │ │ │ +108 this->setMaxDistance(this->maxDistance()+dim-1); │ │ │ │ │ +109 } │ │ │ │ │ +110 }; │ │ │ │ │ +111 │ │ │ │ │ +112 template │ │ │ │ │ +_1_1_3 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_<_T_>& │ │ │ │ │ +criterion) │ │ │ │ │ +114 { │ │ │ │ │ +115 os<<"{ maxdistance="< │ │ │ │ │ +_1_3_3 class _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y : public _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +134 { │ │ │ │ │ +135 public: │ │ │ │ │ +_1_3_9 typedef M _M_a_t_r_i_x; │ │ │ │ │ +140 │ │ │ │ │ +_1_4_4 typedef N _N_o_r_m; │ │ │ │ │ +145 │ │ │ │ │ +_1_4_9 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ │ +150 │ │ │ │ │ +_1_5_4 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ │ +155 │ │ │ │ │ +156 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ │ +157 │ │ │ │ │ +158 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ │ +159 │ │ │ │ │ +160 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ │ 161 │ │ │ │ │ -162 template<> │ │ │ │ │ -_1_6_3 class _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ │ -164 : public _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ │ -165 { │ │ │ │ │ -166 public: │ │ │ │ │ -176 template │ │ │ │ │ -177 typename G::MutableMatrix* _b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ │ -178 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ │ -179 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ │ -180 const typename G::Matrix::size_type& size, │ │ │ │ │ -181 const Set& copy); │ │ │ │ │ -182 }; │ │ │ │ │ -183 │ │ │ │ │ -_1_8_4 struct _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ │ -185 { │ │ │ │ │ -186 template │ │ │ │ │ -187 static void _c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& graph, V& visitedMap, │ │ │ │ │ -188 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ │ -189 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>*& seed, │ │ │ │ │ -190 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* overlapEnd); │ │ │ │ │ -191 │ │ │ │ │ -195 template │ │ │ │ │ -196 static void _c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& graph, V& │ │ │ │ │ -visitedMap, │ │ │ │ │ -197 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ │ -198 const typename G::VertexDescriptor& seed); │ │ │ │ │ +162 template │ │ │ │ │ +163 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ │ +_c_o_l); │ │ │ │ │ +164 │ │ │ │ │ +165 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ │ +166 │ │ │ │ │ +167 │ │ │ │ │ +_1_6_8 _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ +169 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ │ +170 {} │ │ │ │ │ +_1_7_1 _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y() │ │ │ │ │ +172 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ +173 {} │ │ │ │ │ +174 │ │ │ │ │ +175 protected: │ │ │ │ │ +_1_7_7 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ │ +_1_7_9 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_8_0 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ +_1_8_1 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ │ +_1_8_3 _N_o_r_m _n_o_r_m__; │ │ │ │ │ +_1_8_5 int _r_o_w__; │ │ │ │ │ +_1_8_7 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ │ +_1_8_8 std::vector _v_a_l_s__; │ │ │ │ │ +_1_8_9 typename std::vector::iterator _v_a_l_I_t_e_r__; │ │ │ │ │ +190 │ │ │ │ │ +191 }; │ │ │ │ │ +192 │ │ │ │ │ +193 │ │ │ │ │ +194 template │ │ │ │ │ +_1_9_5 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const _M_a_t_r_i_x* matrix) │ │ │ │ │ +196 { │ │ │ │ │ +197 matrix_ = matrix; │ │ │ │ │ +198 } │ │ │ │ │ 199 │ │ │ │ │ -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); │ │ │ │ │ +200 template │ │ │ │ │ +_2_0_1 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w(const _R_o_w& row, int │ │ │ │ │ +index) │ │ │ │ │ +202 { │ │ │ │ │ +203 using std::min; │ │ │ │ │ +204 vals_.assign(row.size(), 0.0); │ │ │ │ │ +205 assert(vals_.size()==row.size()); │ │ │ │ │ +206 valIter_=vals_.begin(); │ │ │ │ │ +207 │ │ │ │ │ +208 maxValue_ = min(- std::numeric_limits::max(), std:: │ │ │ │ │ +numeric_limits::min()); │ │ │ │ │ +209 diagonal_=norm_(row[index]); │ │ │ │ │ +210 row_ = index; │ │ │ │ │ +211 } │ │ │ │ │ +212 │ │ │ │ │ +213 template │ │ │ │ │ +_2_1_4 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l) │ │ │ │ │ +215 { │ │ │ │ │ +216 using std::max; │ │ │ │ │ +217 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ │ +218 _r_e_a_l___t_y_p_e eij = norm_(*_c_o_l); │ │ │ │ │ +219 if(!N::is_sign_preserving || eij<0) // || eji<0) │ │ │ │ │ +220 { │ │ │ │ │ +221 *valIter_ = eij/diagonal_*eij/norm_(matrix_->operator[](_c_o_l.index()) │ │ │ │ │ +[_c_o_l.index()]); │ │ │ │ │ +222 maxValue_ = max(maxValue_, *valIter_); │ │ │ │ │ +223 }else │ │ │ │ │ +224 *valIter_ =0; │ │ │ │ │ +225 ++valIter_; │ │ │ │ │ +226 } │ │ │ │ │ +227 │ │ │ │ │ +228 template │ │ │ │ │ +229 template │ │ │ │ │ +_2_3_0 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G&, const typename G:: │ │ │ │ │ +EdgeIterator& edge, const _C_o_l_I_t_e_r&) │ │ │ │ │ +231 { │ │ │ │ │ +232 if(*valIter_ > alpha() * maxValue_) { │ │ │ │ │ +233 edge.properties().setDepends(); │ │ │ │ │ +234 edge.properties().setInfluences(); │ │ │ │ │ +235 } │ │ │ │ │ +236 ++valIter_; │ │ │ │ │ +237 } │ │ │ │ │ +238 │ │ │ │ │ +239 template │ │ │ │ │ +_2_4_0 inline bool _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ │ +241 { │ │ │ │ │ +242 if(diagonal_==0) │ │ │ │ │ +243 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r, "No diagonal entry for row "<& 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; │ │ │ │ │ +251 template │ │ │ │ │ +_2_5_2 class _D_e_p_e_n_d_e_n_c_y : public _P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +253 { │ │ │ │ │ +254 public: │ │ │ │ │ +_2_5_8 typedef M _M_a_t_r_i_x; │ │ │ │ │ +259 │ │ │ │ │ +_2_6_3 typedef N _N_o_r_m; │ │ │ │ │ +264 │ │ │ │ │ +_2_6_8 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ │ +269 │ │ │ │ │ +_2_7_3 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ │ +274 │ │ │ │ │ +_2_7_5 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ │ +276 │ │ │ │ │ +_2_7_7 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ │ +278 │ │ │ │ │ +_2_7_9 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ │ +280 │ │ │ │ │ +281 template │ │ │ │ │ +_2_8_2 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ │ +_c_o_l); │ │ │ │ │ +283 │ │ │ │ │ +_2_8_4 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ │ +285 │ │ │ │ │ +_2_8_6 _D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ +287 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ │ +288 {} │ │ │ │ │ 289 │ │ │ │ │ -290 template │ │ │ │ │ -291 static void _e_x_a_m_i_n_e(G& graph, │ │ │ │ │ -292 V& visitedMap, │ │ │ │ │ -293 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ │ -294 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -295 R& row); │ │ │ │ │ -296 }; │ │ │ │ │ -297 │ │ │ │ │ -298 template │ │ │ │ │ -_2_9_9 struct _D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r │ │ │ │ │ -300 { │ │ │ │ │ -301 template │ │ │ │ │ -302 static void _s_e_t(M& coarse, const T& pinfo, const O& copy); │ │ │ │ │ -303 }; │ │ │ │ │ -304 │ │ │ │ │ -305 template<> │ │ │ │ │ -_3_0_6 struct _D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ │ -307 { │ │ │ │ │ -308 template │ │ │ │ │ -309 static void _s_e_t(M& coarse, const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, const O& │ │ │ │ │ -copy); │ │ │ │ │ -310 }; │ │ │ │ │ -311 │ │ │ │ │ -312 template │ │ │ │ │ -_3_1_3 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, │ │ │ │ │ -G& graph, V& visitedMap, │ │ │ │ │ -314 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ │ -315 const typename G::VertexDescriptor& seed) │ │ │ │ │ -316 { │ │ │ │ │ -317 assert(row.index()==aggregates[seed]); │ │ │ │ │ -318 row.insert(aggregates[seed]); │ │ │ │ │ -319 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_R_,_V_> conBuilder(aggregates, graph, visitedMap, row); │ │ │ │ │ -320 typedef typename G::VertexDescriptor Vertex; │ │ │ │ │ -321 typedef std::allocator Allocator; │ │ │ │ │ -322 typedef SLList VertexList; │ │ │ │ │ -323 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r DummyVisitor; │ │ │ │ │ -324 VertexList vlist; │ │ │ │ │ -325 DummyVisitor dummy; │ │ │ │ │ -326 aggregates.template breadthFirstSearch(seed,aggregates[seed], │ │ │ │ │ -graph, vlist, dummy, │ │ │ │ │ -327 conBuilder, visitedMap); │ │ │ │ │ -328 } │ │ │ │ │ -329 │ │ │ │ │ -330 template │ │ │ │ │ -_3_3_1 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& │ │ │ │ │ -graph, V& visitedMap, │ │ │ │ │ -332 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ │ -333 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>*& seed, │ │ │ │ │ -334 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* overlapEnd) │ │ │ │ │ -335 { │ │ │ │ │ -336 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_R_,_V_> conBuilder(aggregates, graph, visitedMap, row); │ │ │ │ │ -337 const typename G::VertexDescriptor aggregate=*seed->_a_g_g_r_e_g_a_t_e; │ │ │ │ │ -338 │ │ │ │ │ -339 if (row.index()==*seed->_a_g_g_r_e_g_a_t_e) { │ │ │ │ │ -340 while(seed != overlapEnd && aggregate == *seed->_a_g_g_r_e_g_a_t_e) { │ │ │ │ │ -341 row.insert(*seed->_a_g_g_r_e_g_a_t_e); │ │ │ │ │ -342 // Walk over all neighbours and add them to the connected array. │ │ │ │ │ -343 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(graph, seed->_v_e_r_t_e_x, conBuilder); │ │ │ │ │ -344 // Mark vertex as visited │ │ │ │ │ -345 put(visitedMap, seed->_v_e_r_t_e_x, true); │ │ │ │ │ -346 ++seed; │ │ │ │ │ -347 } │ │ │ │ │ -348 } │ │ │ │ │ -349 } │ │ │ │ │ -350 │ │ │ │ │ -351 template │ │ │ │ │ -_3_5_2 _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_S_,_V_>_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ │ -(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ -353 _G_r_a_p_h& graph, _V_i_s_i_t_e_d_M_a_p& visitedMap, │ │ │ │ │ -354 _S_e_t& connected) │ │ │ │ │ -355 : aggregates_(aggregates), graph_(graph), visitedMap_(visitedMap), │ │ │ │ │ -connected_(connected) │ │ │ │ │ -356 {} │ │ │ │ │ -357 │ │ │ │ │ -358 template │ │ │ │ │ -_3_5_9 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_S_,_V_>_:_:_o_p_e_r_a_t_o_r_(_)(const │ │ │ │ │ -_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ -360 { │ │ │ │ │ -361 const _V_e_r_t_e_x& vertex = aggregates_[edge.target()]; │ │ │ │ │ -362 assert(vertex!= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ │ -363 if(vertex!= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ │ -364 connected_.insert(vertex); │ │ │ │ │ -365 } │ │ │ │ │ -366 │ │ │ │ │ -367 template │ │ │ │ │ -368 template │ │ │ │ │ -369 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* │ │ │ │ │ -370 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_T_>_:_:_b_u_i_l_d_O_v_e_r_l_a_p_V_e_r_t_i_c_e_s(const G& graph, const I& pinfo, │ │ │ │ │ -371 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ │ -372 const Set& overlap, │ │ │ │ │ -373 std::size_t& overlapCount) │ │ │ │ │ -374 { │ │ │ │ │ -375 // count the overlap vertices. │ │ │ │ │ -376 typedef typename G::ConstVertexIterator ConstIterator; │ │ │ │ │ -377 typedef typename I::GlobalLookupIndexSet GlobalLookup; │ │ │ │ │ -378 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ │ -379 │ │ │ │ │ -380 const ConstIterator end = graph.end(); │ │ │ │ │ -381 overlapCount = 0; │ │ │ │ │ -382 │ │ │ │ │ -383 const GlobalLookup& lookup=pinfo.globalLookup(); │ │ │ │ │ +_2_9_0 _D_e_p_e_n_d_e_n_c_y() │ │ │ │ │ +291 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ +292 {} │ │ │ │ │ +293 │ │ │ │ │ +294 protected: │ │ │ │ │ +_2_9_6 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ │ +_2_9_8 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_2_9_9 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ +_3_0_0 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ │ +_3_0_2 _N_o_r_m _n_o_r_m__; │ │ │ │ │ +_3_0_4 int _r_o_w__; │ │ │ │ │ +_3_0_6 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ │ +307 }; │ │ │ │ │ +308 │ │ │ │ │ +312 template │ │ │ │ │ +_3_1_3 class _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y : public _P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +314 { │ │ │ │ │ +315 public: │ │ │ │ │ +_3_1_9 typedef M _M_a_t_r_i_x; │ │ │ │ │ +320 │ │ │ │ │ +_3_2_4 typedef N _N_o_r_m; │ │ │ │ │ +325 │ │ │ │ │ +_3_2_9 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ │ +330 │ │ │ │ │ +_3_3_4 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ │ +335 │ │ │ │ │ +_3_3_6 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ │ +337 │ │ │ │ │ +_3_3_8 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ │ +339 │ │ │ │ │ +_3_4_0 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ │ +341 │ │ │ │ │ +342 template │ │ │ │ │ +_3_4_3 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ │ +_c_o_l); │ │ │ │ │ +344 │ │ │ │ │ +_3_4_5 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ │ +346 │ │ │ │ │ +347 │ │ │ │ │ +_3_4_8 _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ +349 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ │ +350 {} │ │ │ │ │ +_3_5_1 _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y() │ │ │ │ │ +352 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ +353 {} │ │ │ │ │ +354 │ │ │ │ │ +355 protected: │ │ │ │ │ +_3_5_7 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ │ +_3_5_9 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_3_6_0 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ +_3_6_1 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ │ +_3_6_3 _N_o_r_m _n_o_r_m__; │ │ │ │ │ +_3_6_5 int _r_o_w__; │ │ │ │ │ +_3_6_7 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ │ +368 private: │ │ │ │ │ +369 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::true_type&); │ │ │ │ │ +370 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::false_type&); │ │ │ │ │ +371 }; │ │ │ │ │ +372 │ │ │ │ │ +377 template │ │ │ │ │ +_3_7_8 class _D_i_a_g_o_n_a_l │ │ │ │ │ +379 { │ │ │ │ │ +380 public: │ │ │ │ │ +381 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ +382 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = true │ │ │ │ │ +_3_8_3 }; │ │ │ │ │ 384 │ │ │ │ │ -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 } │ │ │ │ │ +389 template │ │ │ │ │ +_3_9_0 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ +m, │ │ │ │ │ +391 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ +sfinae = nullptr) const │ │ │ │ │ +392 { │ │ │ │ │ +393 typedef typename M::field_type field_type; │ │ │ │ │ +394 typedef typename FieldTraits::real_type real_type; │ │ │ │ │ +395 static_assert( std::is_convertible::value, │ │ │ │ │ +396 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ │ +397 return m[N][N]; │ │ │ │ │ +398 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ │ +399 } │ │ │ │ │ +400 │ │ │ │ │ +405 template │ │ │ │ │ +_4_0_6 auto _o_p_e_r_a_t_o_r_(_)(const M& m, │ │ │ │ │ +407 typename std::enable_if_t::value>* sfinae = nullptr) │ │ │ │ │ +const │ │ │ │ │ +408 { │ │ │ │ │ +409 typedef typename FieldTraits::real_type real_type; │ │ │ │ │ +410 static_assert( std::is_convertible::value, │ │ │ │ │ +411 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ │ +412 return m; │ │ │ │ │ +413 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ │ +414 } │ │ │ │ │ +415 │ │ │ │ │ +416 private: │ │ │ │ │ 417 │ │ │ │ │ -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) │ │ │ │ │ +419 template │ │ │ │ │ +420 static T signed_abs(const T & v) │ │ │ │ │ +421 { │ │ │ │ │ +422 return v; │ │ │ │ │ +423 } │ │ │ │ │ +424 │ │ │ │ │ +426 template │ │ │ │ │ +427 static T signed_abs(const std::complex & v) │ │ │ │ │ 428 { │ │ │ │ │ -429 typedef typename T::GlobalLookupIndexSet GlobalLookup; │ │ │ │ │ -430 const GlobalLookup& lookup = pinfo.globalLookup(); │ │ │ │ │ -431 │ │ │ │ │ -432 typedef typename G::VertexIterator VertexIterator; │ │ │ │ │ +429 // return sign * abs_value │ │ │ │ │ +430 // in case of complex numbers this extends to using the csgn function to │ │ │ │ │ +determine the sign │ │ │ │ │ +431 return csgn(v) * std::abs(v); │ │ │ │ │ +432 } │ │ │ │ │ 433 │ │ │ │ │ -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 } │ │ │ │ │ +435 template │ │ │ │ │ +436 static T csgn(const T & v) │ │ │ │ │ +437 { │ │ │ │ │ +438 return (T(0) < v) - (v < T(0)); │ │ │ │ │ +439 } │ │ │ │ │ +440 │ │ │ │ │ +442 template │ │ │ │ │ +443 static T csgn(std::complex a) │ │ │ │ │ +444 { │ │ │ │ │ +445 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag()); │ │ │ │ │ +446 } │ │ │ │ │ +447 │ │ │ │ │ +448 }; │ │ │ │ │ +449 │ │ │ │ │ +_4_5_4 class _F_i_r_s_t_D_i_a_g_o_n_a_l : public _D_i_a_g_o_n_a_l<0> │ │ │ │ │ +455 {}; │ │ │ │ │ +456 │ │ │ │ │ +_4_6_2 struct _R_o_w_S_u_m │ │ │ │ │ +463 { │ │ │ │ │ +464 │ │ │ │ │ +465 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ +466 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ │ +_4_6_7 }; │ │ │ │ │ +472 template │ │ │ │ │ +_4_7_3 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ +m) const │ │ │ │ │ +474 { │ │ │ │ │ +475 return m.infinity_norm(); │ │ │ │ │ +476 } │ │ │ │ │ +477 }; │ │ │ │ │ +478 │ │ │ │ │ +_4_7_9 struct _F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ │ +480 { │ │ │ │ │ +481 │ │ │ │ │ +482 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ +483 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ │ +_4_8_4 }; │ │ │ │ │ +489 template │ │ │ │ │ +_4_9_0 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ +m) const │ │ │ │ │ +491 { │ │ │ │ │ +492 return m.frobenius_norm(); │ │ │ │ │ +493 } │ │ │ │ │ +494 }; │ │ │ │ │ +_4_9_5 struct _A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ │ +496 { │ │ │ │ │ +497 │ │ │ │ │ +498 enum { /* @brief We preserve the sign.*/ │ │ │ │ │ +499 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ │ +_5_0_0 }; │ │ │ │ │ +505 template │ │ │ │ │ +_5_0_6 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ │ +m) const │ │ │ │ │ +507 { │ │ │ │ │ +508 return 1; │ │ │ │ │ +509 } │ │ │ │ │ +510 }; │ │ │ │ │ +517 template │ │ │ │ │ +_5_1_8 class _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n : public │ │ │ │ │ +_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n > │ │ │ │ │ +519 { │ │ │ │ │ +520 public: │ │ │ │ │ +_5_2_1 _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ +522 : _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n<_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y >(parms) │ │ │ │ │ +523 {} │ │ │ │ │ +_5_2_4 _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ │ +525 {} │ │ │ │ │ +526 }; │ │ │ │ │ +527 │ │ │ │ │ +528 │ │ │ │ │ +537 template │ │ │ │ │ +_5_3_8 class _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n : public _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ +> │ │ │ │ │ +539 { │ │ │ │ │ +540 public: │ │ │ │ │ +_5_4_1 _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ +542 : _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n<_D_e_p_e_n_d_e_n_c_y >(parms) │ │ │ │ │ +543 {} │ │ │ │ │ +_5_4_4 _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ │ +545 {} │ │ │ │ │ +546 }; │ │ │ │ │ +547 // forward declaration │ │ │ │ │ +548 template class Aggregator; │ │ │ │ │ +549 │ │ │ │ │ 550 │ │ │ │ │ -551 template │ │ │ │ │ -_5_5_2 void _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_i_n_s_e_r_t(const typename M::size_type& index) │ │ │ │ │ -553 { │ │ │ │ │ -554 row_.insert(index); │ │ │ │ │ -555#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -556 diagonalInserted = diagonalInserted || row_.index()==index; │ │ │ │ │ -557#endif │ │ │ │ │ -558 } │ │ │ │ │ -559 │ │ │ │ │ -560 template │ │ │ │ │ -561 template │ │ │ │ │ -562 typename G::MutableMatrix* │ │ │ │ │ -_5_6_3 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_T_>_:_:_b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ │ -564 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ │ -565 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ │ -566 const typename G::Matrix::size_type& size, │ │ │ │ │ -567 const Set& overlap) │ │ │ │ │ -568 { │ │ │ │ │ -569 typedef _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_> _O_v_e_r_l_a_p_V_e_r_t_e_x; │ │ │ │ │ -570 │ │ │ │ │ -571 std::size_t count; │ │ │ │ │ -572 │ │ │ │ │ -573 const _O_v_e_r_l_a_p_V_e_r_t_e_x* overlapVertices = buildOverlapVertices(fineGraph, │ │ │ │ │ -574 pinfo, │ │ │ │ │ -575 aggregates, │ │ │ │ │ -576 overlap, │ │ │ │ │ -577 count); │ │ │ │ │ -578 typedef typename G::MutableMatrix M; │ │ │ │ │ -579 M* coarseMatrix = new M(size, size, M::row_wise); │ │ │ │ │ -580 │ │ │ │ │ -581 // Reset the visited flags of all vertices. │ │ │ │ │ -582 // As the isolated nodes will be skipped we simply mark them as visited │ │ │ │ │ -583 │ │ │ │ │ -584 typedef typename G::VertexIterator Vertex; │ │ │ │ │ -585 Vertex vend = fineGraph.end(); │ │ │ │ │ -586 for(Vertex vertex = fineGraph.begin(); vertex != vend; ++vertex) { │ │ │ │ │ -587 assert(aggregates[*vertex] != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_: │ │ │ │ │ -_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ │ -588 put(visitedMap, *vertex, aggregates[*vertex]==_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_: │ │ │ │ │ -_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_:_I_S_O_L_A_T_E_D); │ │ │ │ │ -589 } │ │ │ │ │ -590 │ │ │ │ │ -591 typedef typename G::MutableMatrix M; │ │ │ │ │ -592 _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_> sparsityBuilder(*coarseMatrix); │ │ │ │ │ +558 template │ │ │ │ │ +_5_5_9 class _A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +560 { │ │ │ │ │ +561 public: │ │ │ │ │ +562 │ │ │ │ │ +_5_6_6 static const V _U_N_A_G_G_R_E_G_A_T_E_D; │ │ │ │ │ +567 │ │ │ │ │ +_5_7_1 static const V _I_S_O_L_A_T_E_D; │ │ │ │ │ +_5_7_5 typedef V _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +576 │ │ │ │ │ +_5_8_0 typedef V _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +581 │ │ │ │ │ +_5_8_6 typedef PoolAllocator _A_l_l_o_c_a_t_o_r; │ │ │ │ │ +587 │ │ │ │ │ +_5_9_2 typedef SLList _V_e_r_t_e_x_L_i_s_t; │ │ │ │ │ 593 │ │ │ │ │ -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="< │ │ │ │ │ +1417 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w([[maybe_unused]] const Row& │ │ │ │ │ +row, int index, const std::true_type&) │ │ │ │ │ +1418 { │ │ │ │ │ +1419 using std::min; │ │ │ │ │ +1420 maxValue_ = min(- std::numeric_limits::max(), │ │ │ │ │ +std::numeric_limits::min()); │ │ │ │ │ +1421 row_ = index; │ │ │ │ │ +1422 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ │ +1423 } │ │ │ │ │ +1424 │ │ │ │ │ +1425 template │ │ │ │ │ +1426 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const ColIter& _c_o_l) │ │ │ │ │ +1427 { │ │ │ │ │ +1428 using std::max; │ │ │ │ │ +1429 real_type eij = norm_(*_c_o_l); │ │ │ │ │ +1430 typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r opposite_entry = │ │ │ │ │ +1431 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ │ +1432 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ │ +1433 { │ │ │ │ │ +1434 // Consider this a weak connection we disregard. │ │ │ │ │ +1435 return; │ │ │ │ │ +1436 } │ │ │ │ │ +1437 real_type eji = norm_(*opposite_entry); │ │ │ │ │ +1438 │ │ │ │ │ +1439 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ │ +1440 if(!N::is_sign_preserving || eij<0 || eji<0) │ │ │ │ │ +1441 maxValue_ = max(maxValue_, │ │ │ │ │ +1442 eij /diagonal_ * eji/ │ │ │ │ │ +1443 norm_(matrix_->operator[](_c_o_l.index())[_c_o_l.index()])); │ │ │ │ │ +1444 } │ │ │ │ │ +1445 │ │ │ │ │ +1446 template │ │ │ │ │ +1447 template │ │ │ │ │ +1448 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G& graph, const typename G:: │ │ │ │ │ +EdgeIterator& edge, const ColIter& _c_o_l) │ │ │ │ │ +1449 { │ │ │ │ │ +1450 real_type eij = norm_(*_c_o_l); │ │ │ │ │ +1451 typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r opposite_entry = │ │ │ │ │ +1452 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ │ +1453 │ │ │ │ │ +1454 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ │ +1455 { │ │ │ │ │ +1456 // Consider this as a weak connection we disregard. │ │ │ │ │ +1457 return; │ │ │ │ │ +1458 } │ │ │ │ │ +1459 real_type eji = norm_(*opposite_entry); │ │ │ │ │ +1460 // skip positve offdiagonals if norm preserves sign of them. │ │ │ │ │ +1461 if(!N::is_sign_preserving || (eij<0 || eji<0)) │ │ │ │ │ +1462 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) * │ │ │ │ │ +1463 eij/ diagonal_ > alpha() * maxValue_) { │ │ │ │ │ +1464 edge.properties().setDepends(); │ │ │ │ │ +1465 edge.properties().setInfluences(); │ │ │ │ │ +1466 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), │ │ │ │ │ +edge.source()); │ │ │ │ │ +1467 other.setInfluences(); │ │ │ │ │ +1468 other.setDepends(); │ │ │ │ │ +1469 } │ │ │ │ │ +1470 } │ │ │ │ │ +1471 │ │ │ │ │ +1472 template │ │ │ │ │ +1473 inline bool _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ │ +1474 { │ │ │ │ │ +1475 return maxValue_ < beta(); │ │ │ │ │ +1476 } │ │ │ │ │ +1477 │ │ │ │ │ +1478 │ │ │ │ │ +1479 template │ │ │ │ │ +1480 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const Matrix* matrix) │ │ │ │ │ +1481 { │ │ │ │ │ +1482 matrix_ = matrix; │ │ │ │ │ +1483 } │ │ │ │ │ +1484 │ │ │ │ │ +1485 template │ │ │ │ │ +1486 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w([[maybe_unused]] const Row& row, int │ │ │ │ │ +index) │ │ │ │ │ +1487 { │ │ │ │ │ +1488 using std::min; │ │ │ │ │ +1489 maxValue_ = min(- std::numeric_limits::max(), std:: │ │ │ │ │ +numeric_limits::min()); │ │ │ │ │ +1490 row_ = index; │ │ │ │ │ +1491 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ │ +1492 } │ │ │ │ │ +1493 │ │ │ │ │ +1494 template │ │ │ │ │ +1495 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const ColIter& _c_o_l) │ │ │ │ │ +1496 { │ │ │ │ │ +1497 using std::max; │ │ │ │ │ +1498 maxValue_ = max(maxValue_, -norm_(*_c_o_l)); │ │ │ │ │ +1499 } │ │ │ │ │ +1500 │ │ │ │ │ +1501 template │ │ │ │ │ +1502 template │ │ │ │ │ +1503 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G& graph, const typename G:: │ │ │ │ │ +EdgeIterator& edge, const ColIter& _c_o_l) │ │ │ │ │ +1504 { │ │ │ │ │ +1505 if(-norm_(*_c_o_l) >= maxValue_ * alpha()) { │ │ │ │ │ +1506 edge.properties().setDepends(); │ │ │ │ │ +1507 typedef typename G::EdgeDescriptor ED; │ │ │ │ │ +1508 ED e= graph.findEdge(edge.target(), edge.source()); │ │ │ │ │ +1509 if(e!=std::numeric_limits::max()) │ │ │ │ │ +1510 { │ │ │ │ │ +1511 typename G::EdgeProperties& other = graph.getEdgeProperties(e); │ │ │ │ │ +1512 other.setInfluences(); │ │ │ │ │ +1513 } │ │ │ │ │ +1514 } │ │ │ │ │ +1515 } │ │ │ │ │ +1516 │ │ │ │ │ +1517 template │ │ │ │ │ +1518 inline bool _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ │ +1519 { │ │ │ │ │ +1520 return maxValue_ < beta() * diagonal_; │ │ │ │ │ +1521 } │ │ │ │ │ +1522 │ │ │ │ │ +1523 template │ │ │ │ │ +1524 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_A_g_g_r_e_g_a_t_e(MatrixGraph& graph, AggregatesMap& │ │ │ │ │ +aggregates, │ │ │ │ │ +1525 VertexSet& connected, std::vector& front) │ │ │ │ │ +1526 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates), │ │ │ │ │ +1527 connected_(connected), front_(front) │ │ │ │ │ +1528 {} │ │ │ │ │ +1529 │ │ │ │ │ +1530 template │ │ │ │ │ +1531 void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_r_e_c_o_n_s_t_r_u_c_t(const _V_e_r_t_e_x& vertex) │ │ │ │ │ +1532 { │ │ │ │ │ +1533 /* │ │ │ │ │ +1534 vertices_.push_back(vertex); │ │ │ │ │ +1535 typedef typename VertexList::const_iterator iterator; │ │ │ │ │ +1536 iterator begin = vertices_.begin(); │ │ │ │ │ +1537 iterator end = vertices_.end();*/ │ │ │ │ │ +1538 throw "Not yet implemented"; │ │ │ │ │ +1539 │ │ │ │ │ +1540 // while(begin!=end){ │ │ │ │ │ +1541 //for(); │ │ │ │ │ +1542 // } │ │ │ │ │ +1543 │ │ │ │ │ +1544 } │ │ │ │ │ +1545 │ │ │ │ │ +1546 template │ │ │ │ │ +1547 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_e_e_d(const _V_e_r_t_e_x& vertex) │ │ │ │ │ +1548 { │ │ │ │ │ +1549 dvverb<<"Connected cleared"<::UNAGGREGATED && │ │ │ │ │ +1616 !graph_.getVertexProperties(edge.target()).front()) │ │ │ │ │ +1617 { │ │ │ │ │ +1618 front_.push_back(edge.target()); │ │ │ │ │ +1619 graph_.getVertexProperties(edge.target()).setFront(); │ │ │ │ │ +1620 } │ │ │ │ │ +1621 dvverb <<" size="< │ │ │ │ │ +1629 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_l_e_a_r() │ │ │ │ │ +1630 { │ │ │ │ │ +1631 vertices_.clear(); │ │ │ │ │ +1632 connected_.clear(); │ │ │ │ │ +1633 id_=-1; │ │ │ │ │ +1634 } │ │ │ │ │ +1635 │ │ │ │ │ +1636 template │ │ │ │ │ +1637 inline typename Aggregate::VertexSet::size_type │ │ │ │ │ +1638 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_i_z_e() │ │ │ │ │ +1639 { │ │ │ │ │ +1640 return vertices_.size(); │ │ │ │ │ +1641 } │ │ │ │ │ +1642 │ │ │ │ │ +1643 template │ │ │ │ │ +1644 inline typename Aggregate::VertexSet::size_type │ │ │ │ │ +1645 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_n_e_c_t_S_i_z_e() │ │ │ │ │ +1646 { │ │ │ │ │ +1647 return connected_.size(); │ │ │ │ │ +1648 } │ │ │ │ │ +1649 │ │ │ │ │ +1650 template │ │ │ │ │ +1651 inline int _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_i_d() │ │ │ │ │ +1652 { │ │ │ │ │ +1653 return id_; │ │ │ │ │ +1654 } │ │ │ │ │ +1655 │ │ │ │ │ +1656 template │ │ │ │ │ +1657 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_b_e_g_i_n() │ │ │ │ │ +const │ │ │ │ │ +1658 { │ │ │ │ │ +1659 return vertices_.begin(); │ │ │ │ │ +1660 } │ │ │ │ │ +1661 │ │ │ │ │ +1662 template │ │ │ │ │ +1663 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_e_n_d() const │ │ │ │ │ +1664 { │ │ │ │ │ +1665 return vertices_.end(); │ │ │ │ │ +1666 } │ │ │ │ │ +1667 │ │ │ │ │ +1668 template │ │ │ │ │ +1669 const V _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D = std::numeric_limits::max(); │ │ │ │ │ +1670 │ │ │ │ │ +1671 template │ │ │ │ │ +1672 const V _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_I_S_O_L_A_T_E_D = std::numeric_limits::max()-1; │ │ │ │ │ +1673 │ │ │ │ │ +1674 template │ │ │ │ │ +1675 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p() │ │ │ │ │ +1676 : aggregates_(0) │ │ │ │ │ +1677 {} │ │ │ │ │ +1678 │ │ │ │ │ +1679 template │ │ │ │ │ +1680 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_~_A_g_g_r_e_g_a_t_e_s_M_a_p() │ │ │ │ │ +1681 { │ │ │ │ │ +1682 if(aggregates_!=0) │ │ │ │ │ +1683 delete[] aggregates_; │ │ │ │ │ +1684 } │ │ │ │ │ +1685 │ │ │ │ │ +1686 │ │ │ │ │ +1687 template │ │ │ │ │ +1688 inline _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p(std::size_t noVertices) │ │ │ │ │ +1689 { │ │ │ │ │ +1690 allocate(noVertices); │ │ │ │ │ +1691 } │ │ │ │ │ +1692 │ │ │ │ │ +1693 template │ │ │ │ │ +1694 inline std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_n_o_V_e_r_t_i_c_e_s() const │ │ │ │ │ +1695 { │ │ │ │ │ +1696 return noVertices_; │ │ │ │ │ +1697 } │ │ │ │ │ +1698 │ │ │ │ │ +1699 template │ │ │ │ │ +1700 inline void _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_a_l_l_o_c_a_t_e(std::size_t noVertices) │ │ │ │ │ +1701 { │ │ │ │ │ +1702 aggregates_ = new _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r[noVertices]; │ │ │ │ │ +1703 noVertices_ = noVertices; │ │ │ │ │ +1704 │ │ │ │ │ +1705 for(std::size_t i=0; i < noVertices; i++) │ │ │ │ │ +1706 aggregates_[i]=UNAGGREGATED; │ │ │ │ │ +1707 } │ │ │ │ │ +1708 │ │ │ │ │ +1709 template │ │ │ │ │ +1710 inline void _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_f_r_e_e() │ │ │ │ │ +1711 { │ │ │ │ │ +1712 assert(aggregates_ != 0); │ │ │ │ │ +1713 delete[] aggregates_; │ │ │ │ │ +1714 aggregates_=0; │ │ │ │ │ +1715 } │ │ │ │ │ +1716 │ │ │ │ │ +1717 template │ │ │ │ │ +1718 inline typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ │ +1719 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_o_p_e_r_a_t_o_r_[_](const VertexDescriptor& v) │ │ │ │ │ +1720 { │ │ │ │ │ +1721 return aggregates_[v]; │ │ │ │ │ +1722 } │ │ │ │ │ +1723 │ │ │ │ │ +1724 template │ │ │ │ │ +1725 inline const typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ │ +1726 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_o_p_e_r_a_t_o_r_[_](const VertexDescriptor& v) const │ │ │ │ │ +1727 { │ │ │ │ │ +1728 return aggregates_[v]; │ │ │ │ │ +1729 } │ │ │ │ │ +1730 │ │ │ │ │ +1731 template │ │ │ │ │ +1732 template │ │ │ │ │ +1733 inline std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const V& start, │ │ │ │ │ +1734 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ +1735 const G& graph, F& aggregateVisitor, │ │ │ │ │ +1736 VM& visitedMap) const │ │ │ │ │ +1737 { │ │ │ │ │ +1738 VertexList vlist; │ │ │ │ │ +1739 │ │ │ │ │ +1740 DummyEdgeVisitor dummy; │ │ │ │ │ +1741 return breadthFirstSearch(start, aggregate, graph, vlist, │ │ │ │ │ +aggregateVisitor, dummy, visitedMap); │ │ │ │ │ +1742 } │ │ │ │ │ +1743 │ │ │ │ │ +1744 template │ │ │ │ │ +1745 template │ │ │ │ │ +1746 std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const V& start, │ │ │ │ │ +1747 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ +1748 const G& graph, │ │ │ │ │ +1749 L& visited, │ │ │ │ │ +1750 F1& aggregateVisitor, │ │ │ │ │ +1751 F2& nonAggregateVisitor, │ │ │ │ │ +1752 VM& visitedMap) const │ │ │ │ │ +1753 { │ │ │ │ │ +1754 typedef typename L::const_iterator ListIterator; │ │ │ │ │ +1755 int visitedSpheres = 0; │ │ │ │ │ +1756 │ │ │ │ │ +1757 visited.push_back(start); │ │ │ │ │ +1758 put(visitedMap, start, true); │ │ │ │ │ +1759 │ │ │ │ │ +1760 ListIterator current = visited.begin(); │ │ │ │ │ +1761 ListIterator end = visited.end(); │ │ │ │ │ +1762 std::size_t i=0, size=visited.size(); │ │ │ │ │ +1763 │ │ │ │ │ +1764 // visit the neighbours of all vertices of the │ │ │ │ │ +1765 // current sphere. │ │ │ │ │ +1766 while(current != end) { │ │ │ │ │ +1767 │ │ │ │ │ +1768 for(; i │ │ │ │ │ +1803 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_o_r() │ │ │ │ │ +1804 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1) │ │ │ │ │ +1805 {} │ │ │ │ │ +1806 │ │ │ │ │ +1807 template │ │ │ │ │ +1808 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_~_A_g_g_r_e_g_a_t_o_r() │ │ │ │ │ +1809 { │ │ │ │ │ +1810 size_=-1; │ │ │ │ │ +1811 } │ │ │ │ │ +1812 │ │ │ │ │ +1813 template │ │ │ │ │ +1814 void _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(G& graph, │ │ │ │ │ +1815 const typename C::Matrix& matrix, │ │ │ │ │ +1816 C criterion, bool firstlevel) │ │ │ │ │ +1817 { │ │ │ │ │ +1818 // assert(graph.isBuilt()); │ │ │ │ │ +1819 typedef typename C::Matrix Matrix; │ │ │ │ │ +1820 typedef typename G::VertexIterator VertexIterator; │ │ │ │ │ +1821 │ │ │ │ │ +1822 criterion.init(&matrix); │ │ │ │ │ +1823 │ │ │ │ │ +1824 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); │ │ │ │ │ +++vertex) { │ │ │ │ │ +1825 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e Row; │ │ │ │ │ +1826 │ │ │ │ │ +1827 const Row& row = matrix[*vertex]; │ │ │ │ │ +1828 │ │ │ │ │ +1829 // Tell the criterion what row we will examine now │ │ │ │ │ +1830 // This might for example be used for calculating the │ │ │ │ │ +1831 // maximum offdiagonal value │ │ │ │ │ +1832 criterion.initRow(row, *vertex); │ │ │ │ │ +1833 │ │ │ │ │ +1834 // On a first path all columns are examined. After this │ │ │ │ │ +1835 // the calculator should know whether the vertex is isolated. │ │ │ │ │ +1836 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIterator; │ │ │ │ │ +1837 ColIterator end = row.end(); │ │ │ │ │ +1838 typename FieldTraits::real_type │ │ │ │ │ +absoffdiag=0.; │ │ │ │ │ +1839 │ │ │ │ │ +1840 using std::max; │ │ │ │ │ +1841 if(firstlevel) { │ │ │ │ │ +1842 for(ColIterator _c_o_l = row.begin(); _c_o_l != end; ++_c_o_l) │ │ │ │ │ +1843 if(_c_o_l.index()!=*vertex) { │ │ │ │ │ +1844 criterion.examine(_c_o_l); │ │ │ │ │ +1845 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm()); │ │ │ │ │ +1846 } │ │ │ │ │ +1847 │ │ │ │ │ +1848 if(absoffdiag==0) │ │ │ │ │ +1849 vertex.properties().setExcludedBorder(); │ │ │ │ │ +1850 } │ │ │ │ │ +1851 else │ │ │ │ │ +1852 for(ColIterator _c_o_l = row.begin(); _c_o_l != end; ++_c_o_l) │ │ │ │ │ +1853 if(_c_o_l.index()!=*vertex) │ │ │ │ │ +1854 criterion.examine(_c_o_l); │ │ │ │ │ +1855 │ │ │ │ │ +1856 // reset the vertex properties │ │ │ │ │ +1857 //vertex.properties().reset(); │ │ │ │ │ +1858 │ │ │ │ │ +1859 // Check whether the vertex is isolated. │ │ │ │ │ +1860 if(criterion.isIsolated()) { │ │ │ │ │ +1861 //std::cout<<"ISOLATED: "<<*vertex< │ │ │ │ │ +1881 template │ │ │ │ │ +1882 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_<_V_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r(const │ │ │ │ │ +AggregatesMap& aggregates, │ │ │ │ │ +1883 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, V& visitor) │ │ │ │ │ +1884 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor) │ │ │ │ │ +1885 {} │ │ │ │ │ +1886 │ │ │ │ │ +1887 template │ │ │ │ │ +1888 template │ │ │ │ │ +1889 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_<_V_>_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ +1890 { │ │ │ │ │ +1891 if(aggregates_[edge.target()]==aggregate_) │ │ │ │ │ +1892 visitor_->operator()(edge); │ │ │ │ │ +1893 } │ │ │ │ │ +1894 │ │ │ │ │ +1895 template │ │ │ │ │ +1896 template │ │ │ │ │ +1897 inline void Aggregator::visitAggregateNeighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ │ +1898 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ +1899 const AggregatesMap& aggregates, │ │ │ │ │ +1900 V& visitor) const │ │ │ │ │ +1901 { │ │ │ │ │ +1902 // Only evaluates for edge pointing to the aggregate │ │ │ │ │ +1903 AggregateVisitor v(aggregates, aggregate, visitor); │ │ │ │ │ +1904 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, v); │ │ │ │ │ +1905 } │ │ │ │ │ +1906 │ │ │ │ │ +1907 │ │ │ │ │ +1908 template │ │ │ │ │ +1909 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_C_o_u_n_t_e_r() │ │ │ │ │ +1910 : count_(0) │ │ │ │ │ +1911 {} │ │ │ │ │ +1912 │ │ │ │ │ +1913 template │ │ │ │ │ +1914 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t() │ │ │ │ │ +1915 { │ │ │ │ │ +1916 ++count_; │ │ │ │ │ +1917 } │ │ │ │ │ +1918 │ │ │ │ │ +1919 template │ │ │ │ │ +1920 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_d_e_c_r_e_m_e_n_t() │ │ │ │ │ +1921 { │ │ │ │ │ +1922 --count_; │ │ │ │ │ +1923 } │ │ │ │ │ +1924 template │ │ │ │ │ +1925 inline int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_v_a_l_u_e() │ │ │ │ │ +1926 { │ │ │ │ │ +1927 return count_; │ │ │ │ │ +1928 } │ │ │ │ │ +1929 │ │ │ │ │ +1930 template │ │ │ │ │ +1931 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_T_w_o_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ +1932 { │ │ │ │ │ +1933 if(edge.properties().isTwoWay()) │ │ │ │ │ +1934 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +1935 } │ │ │ │ │ +1936 │ │ │ │ │ +1937 template │ │ │ │ │ +1938 int Aggregator::twoWayConnections(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ +1939 const AggregatesMap& aggregates) const │ │ │ │ │ +1940 { │ │ │ │ │ +1941 TwoWayCounter counter; │ │ │ │ │ +1942 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ │ +1943 return counter.value(); │ │ │ │ │ +1944 } │ │ │ │ │ +1945 │ │ │ │ │ +1946 template │ │ │ │ │ +1947 int Aggregator::oneWayConnections(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ +1948 const AggregatesMap& aggregates) const │ │ │ │ │ +1949 { │ │ │ │ │ +1950 OneWayCounter counter; │ │ │ │ │ +1951 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ │ +1952 return counter.value(); │ │ │ │ │ +1953 } │ │ │ │ │ +1954 │ │ │ │ │ +1955 template │ │ │ │ │ +1956 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_O_n_e_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ +1957 { │ │ │ │ │ +1958 if(edge.properties().isOneWay()) │ │ │ │ │ +1959 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +1960 } │ │ │ │ │ +1961 │ │ │ │ │ +1962 template │ │ │ │ │ +1963 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r(const │ │ │ │ │ +VertexSet& connected, │ │ │ │ │ +1964 const AggregatesMap& aggregates) │ │ │ │ │ +1965 : Counter(), connected_(connected), aggregates_(aggregates) │ │ │ │ │ +1966 {} │ │ │ │ │ +1967 │ │ │ │ │ +1968 │ │ │ │ │ +1969 template │ │ │ │ │ +1970 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ +1971 { │ │ │ │ │ +1972 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || │ │ │ │ │ +aggregates_[edge.target()]==AggregatesMap::UNAGGREGATED) │ │ │ │ │ +1973 // Would be a new connection │ │ │ │ │ +1974 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +1975 else{ │ │ │ │ │ +1976 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +1977 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +1978 } │ │ │ │ │ +1979 } │ │ │ │ │ +1980 │ │ │ │ │ +1981 template │ │ │ │ │ +1982 inline double Aggregator::connectivity(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ +AggregatesMap& aggregates) const │ │ │ │ │ +1983 { │ │ │ │ │ +1984 ConnectivityCounter counter(connected_, aggregates); │ │ │ │ │ +1985 double noNeighbours=_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ │ +1986 return (double)counter.value()/noNeighbours; │ │ │ │ │ +1987 } │ │ │ │ │ +1988 │ │ │ │ │ +1989 template │ │ │ │ │ +1990 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r() │ │ │ │ │ +1991 : Counter() │ │ │ │ │ +1992 {} │ │ │ │ │ +1993 │ │ │ │ │ +1994 template │ │ │ │ │ +1995 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ +1996 { │ │ │ │ │ +1997 if(edge.properties().depends()) │ │ │ │ │ +1998 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +1999 if(edge.properties().influences()) │ │ │ │ │ +2000 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +2001 } │ │ │ │ │ +2002 │ │ │ │ │ +2003 template │ │ │ │ │ +2004 int Aggregator::unusedNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ +AggregatesMap& aggregates) const │ │ │ │ │ +2005 { │ │ │ │ │ +2006 return aggregateNeighbours(vertex, AggregatesMap::UNAGGREGATED, │ │ │ │ │ +aggregates); │ │ │ │ │ +2007 } │ │ │ │ │ +2008 │ │ │ │ │ +2009 template │ │ │ │ │ +2010 std::pair Aggregator::neighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ │ +2011 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ +2012 const AggregatesMap& aggregates) const │ │ │ │ │ +2013 { │ │ │ │ │ +2014 DependencyCounter unused, aggregated; │ │ │ │ │ +2015 typedef AggregateVisitor CounterT; │ │ │ │ │ +2016 typedef std::tuple CounterTuple; │ │ │ │ │ +2017 CombinedFunctor visitors(CounterTuple(CounterT(aggregates, │ │ │ │ │ +AggregatesMap::UNAGGREGATED, unused), CounterT(aggregates, aggregate, │ │ │ │ │ +aggregated))); │ │ │ │ │ +2018 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, visitors); │ │ │ │ │ +2019 return std::make_pair(unused.value(), aggregated.value()); │ │ │ │ │ +2020 } │ │ │ │ │ +2021 │ │ │ │ │ +2022 │ │ │ │ │ +2023 template │ │ │ │ │ +2024 int Aggregator::aggregateNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, const AggregatesMap& aggregates) const │ │ │ │ │ +2025 { │ │ │ │ │ +2026 DependencyCounter counter; │ │ │ │ │ +2027 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ │ +2028 return counter.value(); │ │ │ │ │ +2029 } │ │ │ │ │ +2030 │ │ │ │ │ +2031 template │ │ │ │ │ +2032 std::size_t Aggregator::distance(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ +AggregatesMap& aggregates) │ │ │ │ │ +2033 { │ │ │ │ │ +2034 return 0; │ │ │ │ │ +2035 typename PropertyMapTypeSelector::Type visitedMap = │ │ │ │ │ +_g_e_t(VertexVisitedTag(), *graph_); │ │ │ │ │ +2036 VertexList vlist; │ │ │ │ │ +2037 typename AggregatesMap::DummyEdgeVisitor dummy; │ │ │ │ │ +2038 return aggregates.template breadthFirstSearch(vertex, │ │ │ │ │ +2039 aggregate_->_i_d(), *graph_, │ │ │ │ │ +2040 vlist, dummy, dummy, visitedMap); │ │ │ │ │ +2041 } │ │ │ │ │ +2042 │ │ │ │ │ +2043 template │ │ │ │ │ +2044 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_F_r_o_n_t_M_a_r_k_e_r(std::vector& front, │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h& graph) │ │ │ │ │ +2045 : front_(front), graph_(graph) │ │ │ │ │ +2046 {} │ │ │ │ │ +2047 │ │ │ │ │ +2048 template │ │ │ │ │ +2049 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ +2050 { │ │ │ │ │ +2051 _V_e_r_t_e_x target = edge.target(); │ │ │ │ │ +2052 │ │ │ │ │ +2053 if(!graph_.getVertexProperties(target).front()) { │ │ │ │ │ +2054 front_.push_back(target); │ │ │ │ │ +2055 graph_.getVertexProperties(target).setFront(); │ │ │ │ │ +2056 } │ │ │ │ │ +2057 } │ │ │ │ │ +2058 │ │ │ │ │ +2059 template │ │ │ │ │ +2060 inline bool Aggregator::admissible(const _V_e_r_t_e_x& vertex, const │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, const AggregatesMap& aggregates) const │ │ │ │ │ +2061 { │ │ │ │ │ +2062 // Todo │ │ │ │ │ +2063 Dune::dvverb<<" Admissible not yet implemented!"<endEdges(vertex); │ │ │ │ │ +2071 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ │ +2072 // if(edge.properties().depends() && !edge.properties().influences() │ │ │ │ │ +2073 if(edge.properties().isStrong() │ │ │ │ │ +2074 && aggregates[edge.target()]==aggregate) │ │ │ │ │ +2075 { │ │ │ │ │ +2076 // Search for another link to the aggregate │ │ │ │ │ +2077 Iterator edge1 = edge; │ │ │ │ │ +2078 for(++edge1; edge1 != vend; ++edge1) { │ │ │ │ │ +2079 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ │ +2080 if(edge1.properties().isStrong() │ │ │ │ │ +2081 && aggregates[edge.target()]==aggregate) │ │ │ │ │ +2082 { │ │ │ │ │ +2083 //Search for an edge connecting the two vertices that is │ │ │ │ │ +2084 //strong │ │ │ │ │ +2085 bool found=false; │ │ │ │ │ +2086 Iterator v2end = graph_->endEdges(edge.target()); │ │ │ │ │ +2087 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; │ │ │ │ │ +++edge2) { │ │ │ │ │ +2088 if(edge2.target()==edge1.target() && │ │ │ │ │ +2089 edge2.properties().isStrong()) { │ │ │ │ │ +2090 found =true; │ │ │ │ │ +2091 break; │ │ │ │ │ +2092 } │ │ │ │ │ +2093 } │ │ │ │ │ +2094 if(found) │ │ │ │ │ +2095 { │ │ │ │ │ +2096 return true; │ │ │ │ │ +2097 } │ │ │ │ │ +2098 } │ │ │ │ │ +2099 } │ │ │ │ │ +2100 } │ │ │ │ │ +2101 } │ │ │ │ │ +2102 │ │ │ │ │ +2103 // Situation 2: cluster node depends on front node and other cluster node │ │ │ │ │ +2105 vend = graph_->endEdges(vertex); │ │ │ │ │ +2106 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ │ +2107 //if(!edge.properties().depends() && edge.properties().influences() │ │ │ │ │ +2108 if(edge.properties().isStrong() │ │ │ │ │ +2109 && aggregates[edge.target()]==aggregate) │ │ │ │ │ +2110 { │ │ │ │ │ +2111 // Search for a link from target that stays within the aggregate │ │ │ │ │ +2112 Iterator v1end = graph_->endEdges(edge.target()); │ │ │ │ │ +2113 │ │ │ │ │ +2114 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; │ │ │ │ │ +++edge1) { │ │ │ │ │ +2115 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ │ +2116 if(edge1.properties().isStrong() │ │ │ │ │ +2117 && aggregates[edge1.target()]==aggregate) │ │ │ │ │ +2118 { │ │ │ │ │ +2119 bool found=false; │ │ │ │ │ +2120 // Check if front node is also connected to this one │ │ │ │ │ +2121 Iterator v2end = graph_->endEdges(vertex); │ │ │ │ │ +2122 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) │ │ │ │ │ +{ │ │ │ │ │ +2123 if(edge2.target()==edge1.target()) { │ │ │ │ │ +2124 if(edge2.properties().isStrong()) │ │ │ │ │ +2125 found=true; │ │ │ │ │ +2126 break; │ │ │ │ │ +2127 } │ │ │ │ │ +2128 } │ │ │ │ │ +2129 if(found) │ │ │ │ │ +2130 { │ │ │ │ │ +2131 return true; │ │ │ │ │ +2132 } │ │ │ │ │ +2133 } │ │ │ │ │ +2134 } │ │ │ │ │ +2135 } │ │ │ │ │ +2136 } │ │ │ │ │ +2137 return false; │ │ │ │ │ +2138 } │ │ │ │ │ +2139 │ │ │ │ │ +2140 template │ │ │ │ │ +2141 void Aggregator::unmarkFront() │ │ │ │ │ +2142 { │ │ │ │ │ +2143 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ +2144 │ │ │ │ │ +2145 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex) │ │ │ │ │ +2146 graph_->getVertexProperties(*vertex).resetFront(); │ │ │ │ │ +2147 │ │ │ │ │ +2148 front_.clear(); │ │ │ │ │ +2149 } │ │ │ │ │ +2150 │ │ │ │ │ +2151 template │ │ │ │ │ +2152 inline void │ │ │ │ │ +2153 Aggregator::nonisoNeighbourAggregate(const _V_e_r_t_e_x& vertex, │ │ │ │ │ +2154 const AggregatesMap& aggregates, │ │ │ │ │ +2155 SLList& neighbours) const │ │ │ │ │ +2156 { │ │ │ │ │ +2157 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ +2158 Iterator end=graph_->beginEdges(vertex); │ │ │ │ │ +2159 neighbours.clear(); │ │ │ │ │ +2160 │ │ │ │ │ +2161 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge) │ │ │ │ │ +2162 { │ │ │ │ │ +2163 if(aggregates[edge.target()]!=AggregatesMap::UNAGGREGATED && │ │ │ │ │ +graph_->getVertexProperties(edge.target()).isolated()) │ │ │ │ │ +2164 neighbours.push_back(aggregates[edge.target()]); │ │ │ │ │ +2165 } │ │ │ │ │ +2166 } │ │ │ │ │ +2167 │ │ │ │ │ +2168 template │ │ │ │ │ +2169 inline typename G::VertexDescriptor Aggregator::mergeNeighbour(const │ │ │ │ │ +_V_e_r_t_e_x& vertex, const AggregatesMap& aggregates) const │ │ │ │ │ +2170 { │ │ │ │ │ +2171 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ +2172 │ │ │ │ │ +2173 Iterator end = graph_->endEdges(vertex); │ │ │ │ │ +2174 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) { │ │ │ │ │ +2175 if(aggregates[edge.target()] != AggregatesMap::UNAGGREGATED && │ │ │ │ │ +2176 graph_->getVertexProperties(edge.target()).isolated() == graph_- │ │ │ │ │ +>getVertexProperties(edge.source()).isolated()) { │ │ │ │ │ +2177 if( graph_->getVertexProperties(vertex).isolated() || │ │ │ │ │ +2178 ((edge.properties().depends() || edge.properties().influences()) │ │ │ │ │ +2179 && admissible(vertex, aggregates[edge.target()], aggregates))) │ │ │ │ │ +2180 return edge.target(); │ │ │ │ │ +2181 } │ │ │ │ │ +2182 } │ │ │ │ │ +2183 return AggregatesMap::UNAGGREGATED; │ │ │ │ │ +2184 } │ │ │ │ │ +2185 │ │ │ │ │ +2186 template │ │ │ │ │ +2187 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r(const │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h& graph) │ │ │ │ │ +2188 : Counter(), graph_(graph) │ │ │ │ │ +2189 {} │ │ │ │ │ +2190 │ │ │ │ │ +2191 template │ │ │ │ │ +2192 void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ │ +2193 { │ │ │ │ │ +2194 if(graph_.getVertexProperties(edge.target()).front()) │ │ │ │ │ +2195 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ │ +2196 } │ │ │ │ │ +2197 │ │ │ │ │ +2198 template │ │ │ │ │ +2199 int Aggregator::noFrontNeighbours(const _V_e_r_t_e_x& vertex) const │ │ │ │ │ +2200 { │ │ │ │ │ +2201 FrontNeighbourCounter counter(*graph_); │ │ │ │ │ +2202 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ │ +2203 return counter.value(); │ │ │ │ │ +2204 } │ │ │ │ │ +2205 template │ │ │ │ │ +2206 inline bool Aggregator::connected(const _V_e_r_t_e_x& vertex, │ │ │ │ │ +2207 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ │ +2208 const AggregatesMap& aggregates) const │ │ │ │ │ +2209 { │ │ │ │ │ +2210 typedef typename G::ConstEdgeIterator iterator; │ │ │ │ │ +2211 const iterator end = graph_->endEdges(vertex); │ │ │ │ │ +2212 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) │ │ │ │ │ +2213 if(aggregates[edge.target()]==aggregate) │ │ │ │ │ +2214 return true; │ │ │ │ │ +2215 return false; │ │ │ │ │ +2216 } │ │ │ │ │ +2217 template │ │ │ │ │ +2218 inline bool Aggregator::connected(const _V_e_r_t_e_x& vertex, │ │ │ │ │ +2219 const SLList& aggregateList, │ │ │ │ │ +2220 const AggregatesMap& aggregates) const │ │ │ │ │ +2221 { │ │ │ │ │ +2222 typedef typename SLList::const_iterator Iter; │ │ │ │ │ +2223 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i) │ │ │ │ │ +2224 if(connected(vertex, *i, aggregates)) │ │ │ │ │ +2225 return true; │ │ │ │ │ +2226 return false; │ │ │ │ │ +2227 } │ │ │ │ │ +2228 │ │ │ │ │ +2229 template │ │ │ │ │ +2230 template │ │ │ │ │ +2231 void Aggregator::growIsolatedAggregate(const _V_e_r_t_e_x& seed, const │ │ │ │ │ +AggregatesMap& aggregates, const C& c) │ │ │ │ │ +2232 { │ │ │ │ │ +2233 SLList connectedAggregates; │ │ │ │ │ +2234 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates); │ │ │ │ │ +2235 │ │ │ │ │ +2236 while(aggregate_->_s_i_z_e()< c.minAggregateSize() && aggregate_->_c_o_n_n_e_c_t_S_i_z_e │ │ │ │ │ +() < c.maxConnectivity()) { │ │ │ │ │ +2237 double maxCon=-1; │ │ │ │ │ +2238 std::size_t maxFrontNeighbours=0; │ │ │ │ │ +2239 │ │ │ │ │ +2240 _V_e_r_t_e_x candidate=AggregatesMap::UNAGGREGATED; │ │ │ │ │ +2241 │ │ │ │ │ +2242 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ +2243 │ │ │ │ │ +2244 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ │ +2245 if(distance(*vertex, aggregates)>c.maxDistance()) │ │ │ │ │ +2246 continue; // distance of proposes aggregate too big │ │ │ │ │ +2247 │ │ │ │ │ +2248 if(connectedAggregates.size()>0) { │ │ │ │ │ +2249 // there is already a neighbour cluster │ │ │ │ │ +2250 // front node must be connected to same neighbour cluster │ │ │ │ │ +2251 │ │ │ │ │ +2252 if(!connected(*vertex, connectedAggregates, aggregates)) │ │ │ │ │ +2253 continue; │ │ │ │ │ +2254 } │ │ │ │ │ +2255 │ │ │ │ │ +2256 double con = connectivity(*vertex, aggregates); │ │ │ │ │ +2257 │ │ │ │ │ +2258 if(con == maxCon) { │ │ │ │ │ +2259 std::size_t frontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2260 │ │ │ │ │ +2261 if(frontNeighbours >= maxFrontNeighbours) { │ │ │ │ │ +2262 maxFrontNeighbours = frontNeighbours; │ │ │ │ │ +2263 candidate = *vertex; │ │ │ │ │ +2264 } │ │ │ │ │ +2265 }else if(con > maxCon) { │ │ │ │ │ +2266 maxCon = con; │ │ │ │ │ +2267 maxFrontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2268 candidate = *vertex; │ │ │ │ │ +2269 } │ │ │ │ │ +2270 } │ │ │ │ │ +2271 │ │ │ │ │ +2272 if(candidate==AggregatesMap::UNAGGREGATED) │ │ │ │ │ +2273 break; │ │ │ │ │ +2274 │ │ │ │ │ +2275 aggregate_->_a_d_d(candidate); │ │ │ │ │ +2276 } │ │ │ │ │ +2277 } │ │ │ │ │ +2278 │ │ │ │ │ +2279 template │ │ │ │ │ +2280 template │ │ │ │ │ +2281 void Aggregator::growAggregate(const _V_e_r_t_e_x& seed, const │ │ │ │ │ +AggregatesMap& aggregates, const C& c) │ │ │ │ │ +2282 { │ │ │ │ │ +2283 using std::min; │ │ │ │ │ +2284 │ │ │ │ │ +2285 std::size_t distance_ =0; │ │ │ │ │ +2286 while(aggregate_->_s_i_z_e() < c.minAggregateSize()&& distance_ candidates; │ │ │ │ │ +2291 candidates.reserve(30); │ │ │ │ │ +2292 │ │ │ │ │ +2293 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ +2294 │ │ │ │ │ +2295 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ │ +2296 // Only nonisolated nodes are considered │ │ │ │ │ +2297 if(graph_->getVertexProperties(*vertex).isolated()) │ │ │ │ │ +2298 continue; │ │ │ │ │ +2299 │ │ │ │ │ +2300 int twoWayCons = twoWayConnections(*vertex, aggregate_->_i_d(), aggregates); │ │ │ │ │ +2301 │ │ │ │ │ +2302 /* The case of two way connections. */ │ │ │ │ │ +2303 if( maxTwoCons == twoWayCons && twoWayCons > 0) { │ │ │ │ │ +2304 double con = connectivity(*vertex, aggregates); │ │ │ │ │ +2305 │ │ │ │ │ +2306 if(con == maxCon) { │ │ │ │ │ +2307 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2308 │ │ │ │ │ +2309 if(neighbours > maxNeighbours) { │ │ │ │ │ +2310 maxNeighbours = neighbours; │ │ │ │ │ +2311 candidates.clear(); │ │ │ │ │ +2312 candidates.push_back(*vertex); │ │ │ │ │ +2313 }else{ │ │ │ │ │ +2314 candidates.push_back(*vertex); │ │ │ │ │ +2315 } │ │ │ │ │ +2316 }else if( con > maxCon) { │ │ │ │ │ +2317 maxCon = con; │ │ │ │ │ +2318 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2319 candidates.clear(); │ │ │ │ │ +2320 candidates.push_back(*vertex); │ │ │ │ │ +2321 } │ │ │ │ │ +2322 }else if(twoWayCons > maxTwoCons) { │ │ │ │ │ +2323 maxTwoCons = twoWayCons; │ │ │ │ │ +2324 maxCon = connectivity(*vertex, aggregates); │ │ │ │ │ +2325 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2326 candidates.clear(); │ │ │ │ │ +2327 candidates.push_back(*vertex); │ │ │ │ │ +2328 │ │ │ │ │ +2329 // two way connections precede │ │ │ │ │ +2330 maxOneCons = std::numeric_limits::max(); │ │ │ │ │ +2331 } │ │ │ │ │ +2332 │ │ │ │ │ +2333 if(twoWayCons > 0) │ │ │ │ │ +2334 { │ │ │ │ │ +2335 continue; // THis is a two-way node, skip tests for one way nodes │ │ │ │ │ +2336 } │ │ │ │ │ +2337 │ │ │ │ │ +2338 /* The one way case */ │ │ │ │ │ +2339 int oneWayCons = oneWayConnections(*vertex, aggregate_->_i_d(), aggregates); │ │ │ │ │ +2340 │ │ │ │ │ +2341 if(oneWayCons==0) │ │ │ │ │ +2342 continue; // No strong connections, skip the tests. │ │ │ │ │ +2343 │ │ │ │ │ +2344 if(!admissible(*vertex, aggregate_->_i_d(), aggregates)) │ │ │ │ │ +2345 continue; │ │ │ │ │ +2346 │ │ │ │ │ +2347 if( maxOneCons == oneWayCons && oneWayCons > 0) { │ │ │ │ │ +2348 double con = connectivity(*vertex, aggregates); │ │ │ │ │ +2349 │ │ │ │ │ +2350 if(con == maxCon) { │ │ │ │ │ +2351 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2352 │ │ │ │ │ +2353 if(neighbours > maxNeighbours) { │ │ │ │ │ +2354 maxNeighbours = neighbours; │ │ │ │ │ +2355 candidates.clear(); │ │ │ │ │ +2356 candidates.push_back(*vertex); │ │ │ │ │ +2357 }else{ │ │ │ │ │ +2358 if(neighbours==maxNeighbours) │ │ │ │ │ +2359 { │ │ │ │ │ +2360 candidates.push_back(*vertex); │ │ │ │ │ +2361 } │ │ │ │ │ +2362 } │ │ │ │ │ +2363 }else if( con > maxCon) { │ │ │ │ │ +2364 maxCon = con; │ │ │ │ │ +2365 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2366 candidates.clear(); │ │ │ │ │ +2367 candidates.push_back(*vertex); │ │ │ │ │ +2368 } │ │ │ │ │ +2369 }else if(oneWayCons > maxOneCons) { │ │ │ │ │ +2370 maxOneCons = oneWayCons; │ │ │ │ │ +2371 maxCon = connectivity(*vertex, aggregates); │ │ │ │ │ +2372 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ │ +2373 candidates.clear(); │ │ │ │ │ +2374 candidates.push_back(*vertex); │ │ │ │ │ +2375 } │ │ │ │ │ +2376 } │ │ │ │ │ +2377 │ │ │ │ │ +2378 │ │ │ │ │ +2379 if(!candidates.size()) │ │ │ │ │ +2380 break; // No more candidates found │ │ │ │ │ +2381 distance_=distance(seed, aggregates); │ │ │ │ │ +2382 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ │ +2383 aggregate_->_s_i_z_e())); │ │ │ │ │ +2384 aggregate_->_a_d_d(candidates); │ │ │ │ │ +2385 } │ │ │ │ │ +2386 } │ │ │ │ │ +2387 │ │ │ │ │ +2388 template │ │ │ │ │ +2389 template │ │ │ │ │ +2390 std::tuple _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(const M& │ │ │ │ │ +matrix, G& graph, const C& criterion, │ │ │ │ │ +2391 bool finestLevel) │ │ │ │ │ +2392 { │ │ │ │ │ +2393 Aggregator aggregator; │ │ │ │ │ +2394 return aggregator.build(matrix, graph, *this, criterion, finestLevel); │ │ │ │ │ +2395 } │ │ │ │ │ +2396 │ │ │ │ │ +2397 template │ │ │ │ │ +2398 template │ │ │ │ │ +2399 std::tuple _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_b_u_i_l_d(const M& m, G& graph, │ │ │ │ │ +AggregatesMap& aggregates, const C& c, │ │ │ │ │ +2400 bool finestLevel) │ │ │ │ │ +2401 { │ │ │ │ │ +2402 using std::max; │ │ │ │ │ +2403 using std::min; │ │ │ │ │ +2404 // Stack for fast vertex access │ │ │ │ │ +2405 Stack stack_(graph, *this, aggregates); │ │ │ │ │ +2406 │ │ │ │ │ +2407 graph_ = &graph; │ │ │ │ │ +2408 │ │ │ │ │ +2409 aggregate_ = new Aggregate(graph, aggregates, connected_, │ │ │ │ │ +front_); │ │ │ │ │ +2410 │ │ │ │ │ +2411 Timer watch; │ │ │ │ │ +2412 watch.reset(); │ │ │ │ │ +2413 │ │ │ │ │ +2414 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(graph, m, c, finestLevel); │ │ │ │ │ +2415 │ │ │ │ │ +2416 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<::ISOLATED; │ │ │ │ │ +2437 ++skippedAggregates; │ │ │ │ │ +2438 continue; │ │ │ │ │ +2439 } │ │ │ │ │ +2440 │ │ │ │ │ +2441 if(graph.getVertexProperties(seed).isolated()) { │ │ │ │ │ +2442 if(c.skipIsolated()) { │ │ │ │ │ +2443 // isolated vertices are not aggregated but skipped on the coarser levels. │ │ │ │ │ +2444 aggregates[seed]=AggregatesMap::ISOLATED; │ │ │ │ │ +2445 ++skippedAggregates; │ │ │ │ │ +2446 // skip rest as no agglomeration is done. │ │ │ │ │ +2447 continue; │ │ │ │ │ +2448 }else{ │ │ │ │ │ +2449 aggregate_->_s_e_e_d(seed); │ │ │ │ │ +2450 growIsolatedAggregate(seed, aggregates, c); │ │ │ │ │ +2451 } │ │ │ │ │ +2452 }else{ │ │ │ │ │ +2453 aggregate_->_s_e_e_d(seed); │ │ │ │ │ +2454 growAggregate(seed, aggregates, c); │ │ │ │ │ +2455 } │ │ │ │ │ +2456 │ │ │ │ │ +2457 /* The rounding step. */ │ │ │ │ │ +2458 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->_s_i_z_e() │ │ │ │ │ +< c.maxAggregateSize()) { │ │ │ │ │ +2459 │ │ │ │ │ +2460 std::vector candidates; │ │ │ │ │ +2461 candidates.reserve(30); │ │ │ │ │ +2462 │ │ │ │ │ +2463 typedef typename std::vector::const_iterator Iterator; │ │ │ │ │ +2464 │ │ │ │ │ +2465 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ │ +2466 │ │ │ │ │ +2467 if(graph.getVertexProperties(*vertex).isolated()) │ │ │ │ │ +2468 continue; // No isolated nodes here │ │ │ │ │ +2469 │ │ │ │ │ +2470 if(twoWayConnections( *vertex, aggregate_->_i_d(), aggregates) == 0 && │ │ │ │ │ +2471 (oneWayConnections( *vertex, aggregate_->_i_d(), aggregates) == 0 || │ │ │ │ │ +2472 !admissible( *vertex, aggregate_->_i_d(), aggregates) )) │ │ │ │ │ +2473 continue; │ │ │ │ │ +2474 │ │ │ │ │ +2475 std::pair neighbourPair=neighbours(*vertex, aggregate_->_i_d(), │ │ │ │ │ +2476 aggregates); │ │ │ │ │ +2477 │ │ │ │ │ +2478 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= │ │ │ │ │ +unusedNeighbours(*vertex, aggregates)) │ │ │ │ │ +2479 // continue; │ │ │ │ │ +2480 │ │ │ │ │ +2481 if(neighbourPair.first >= neighbourPair.second) │ │ │ │ │ +2482 continue; │ │ │ │ │ +2483 │ │ │ │ │ +2484 if(distance(*vertex, aggregates) > c.maxDistance()) │ │ │ │ │ +2485 continue; // Distance too far │ │ │ │ │ +2486 candidates.push_back(*vertex); │ │ │ │ │ +2487 break; │ │ │ │ │ +2488 } │ │ │ │ │ +2489 │ │ │ │ │ +2490 if(!candidates.size()) break; // no more candidates found. │ │ │ │ │ +2491 │ │ │ │ │ +2492 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ │ +2493 aggregate_->_s_i_z_e())); │ │ │ │ │ +2494 aggregate_->_a_d_d(candidates); │ │ │ │ │ +2495 │ │ │ │ │ +2496 } │ │ │ │ │ +2497 │ │ │ │ │ +2498 // try to merge aggregates consisting of only one nonisolated vertex with │ │ │ │ │ +other aggregates │ │ │ │ │ +2499 if(aggregate_->_s_i_z_e()==1 && c.maxAggregateSize()>1) { │ │ │ │ │ +2500 if(!graph.getVertexProperties(seed).isolated()) { │ │ │ │ │ +2501 _V_e_r_t_e_x mergedNeighbour = mergeNeighbour(seed, aggregates); │ │ │ │ │ +2502 │ │ │ │ │ +2503 if(mergedNeighbour != AggregatesMap::UNAGGREGATED) { │ │ │ │ │ +2504 // assign vertex to the neighbouring cluster │ │ │ │ │ +2505 aggregates[seed] = aggregates[mergedNeighbour]; │ │ │ │ │ +2506 aggregate_->_i_n_v_a_l_i_d_a_t_e(); │ │ │ │ │ +2507 }else{ │ │ │ │ │ +2508 ++avg; │ │ │ │ │ +2509 minA=min(minA,static_cast(1)); │ │ │ │ │ +2510 maxA=max(maxA,static_cast(1)); │ │ │ │ │ +2511 ++oneAggregates; │ │ │ │ │ +2512 ++conAggregates; │ │ │ │ │ +2513 } │ │ │ │ │ +2514 }else{ │ │ │ │ │ +2515 ++avg; │ │ │ │ │ +2516 minA=min(minA,static_cast(1)); │ │ │ │ │ +2517 maxA=max(maxA,static_cast(1)); │ │ │ │ │ +2518 ++oneAggregates; │ │ │ │ │ +2519 ++isoAggregates; │ │ │ │ │ +2520 } │ │ │ │ │ +2521 ++avg; │ │ │ │ │ +2522 }else{ │ │ │ │ │ +2523 avg+=aggregate_->_s_i_z_e(); │ │ │ │ │ +2524 minA=min(minA,aggregate_->_s_i_z_e()); │ │ │ │ │ +2525 maxA=max(maxA,aggregate_->_s_i_z_e()); │ │ │ │ │ +2526 if(graph.getVertexProperties(seed).isolated()) │ │ │ │ │ +2527 ++isoAggregates; │ │ │ │ │ +2528 else │ │ │ │ │ +2529 ++conAggregates; │ │ │ │ │ +2530 } │ │ │ │ │ +2531 │ │ │ │ │ +2532 } │ │ │ │ │ +2533 │ │ │ │ │ +2534 Dune::dinfo<<"connected aggregates: "<0) │ │ │ │ │ +2537 Dune::dinfo<<" one node aggregates: "< &o1, const OverlapVertex< A > &o2) │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:155 │ │ │ │ │ -_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_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 │ │ │ │ │ -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. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:313 │ │ │ │ │ -_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_r_a_p_h │ │ │ │ │ -G Graph │ │ │ │ │ -The type of the graph. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:211 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -void operator++() │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:539 │ │ │ │ │ -_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_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const ConstEdgeIterator &edge) │ │ │ │ │ -Process an edge pointing to another aggregate. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:359 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_:_:_i_n_s_e_r_t │ │ │ │ │ -void insert(const typename M::size_type &index) │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:552 │ │ │ │ │ -_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_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 │ │ │ │ │ -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) │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:331 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_:_:_b_u_i_l_d │ │ │ │ │ -G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation │ │ │ │ │ -&pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const │ │ │ │ │ -typename G::Matrix::size_type &size, const Set ©) │ │ │ │ │ -Calculates the coarse matrix via a Galerkin product. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:563 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_:_:_i_n_d_e_x │ │ │ │ │ -std::size_t index() │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_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 │ │ │ │ │ -T ParallelInformation │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:120 │ │ │ │ │ -_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_:_:_V_e_r_t_e_x │ │ │ │ │ -G::VertexDescriptor Vertex │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x_:_:_A_g_g_r_e_g_a_t_e │ │ │ │ │ -T Aggregate │ │ │ │ │ -The aggregate descriptor. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r │ │ │ │ │ -SparsityBuilder(M &matrix) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_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:273 │ │ │ │ │ +_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_I_t_e_r__ │ │ │ │ │ +std::vector< real_type >::iterator valIter_ │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_C_o_l_I_t_e_r │ │ │ │ │ +Matrix::ConstColIterator ColIter │ │ │ │ │ +Constant column iterator of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:154 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h │ │ │ │ │ +std::size_t breadthFirstSearch(const VertexDescriptor &start, const │ │ │ │ │ +AggregateDescriptor &aggregate, const G &graph, L &visited, F1 │ │ │ │ │ +&aggregateVisitor, F2 &nonAggregateVisitor, VM &visitedMap) const │ │ │ │ │ +Breadth first search within an aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +PoolAllocator< VertexDescriptor, 100 > Allocator │ │ │ │ │ +The allocator we use for our lists and the set. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:586 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ +iterator begin() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:737 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_i_d │ │ │ │ │ +int id() │ │ │ │ │ +Get the id identifying the aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ │ +Norm norm_ │ │ │ │ │ +The functor for calculating the norm. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:302 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ │ +MatrixGraph::VertexDescriptor Vertex │ │ │ │ │ +The vertex identifier. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:920 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ +AggregationCriterion() │ │ │ │ │ Constructor. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:513 │ │ │ │ │ -_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_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ │ -ConnectedBuilder(const AggregatesMap< Vertex > &aggregates, Graph &graph, │ │ │ │ │ -VisitedMap &visitedMap, Set &connected) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ │ +const Matrix * matrix_ │ │ │ │ │ +The matrix we work on. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:357 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +auto operator()(const M &m, typename std::enable_if_t< Dune::IsNumber< M >:: │ │ │ │ │ +value > *sfinae=nullptr) const │ │ │ │ │ +Compute the norm of a scalar. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:406 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ │ +void initRow(const Row &row, int index) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +SymmetricMatrixDependency(const Parameters &parms) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:168 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ │ +M Matrix │ │ │ │ │ +The matrix type we build the dependency of. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:258 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_C_o_u_n_t_e_r │ │ │ │ │ +Counter() │ │ │ │ │ Constructor. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:352 │ │ │ │ │ -_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_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ -Graph::ConstEdgeIterator ConstEdgeIterator │ │ │ │ │ -The constant edge iterator. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:215 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x_:_:_V_e_r_t_e_x │ │ │ │ │ -T Vertex │ │ │ │ │ -The vertex descriptor. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:42 │ │ │ │ │ -_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_ _>_:_:_V_e_r_t_e_x │ │ │ │ │ -G::VertexDescriptor Vertex │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:288 │ │ │ │ │ -_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_:_:_e_x_a_m_i_n_e │ │ │ │ │ -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) │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:420 │ │ │ │ │ -_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_:_:_V_i_s_i_t_e_d_M_a_p │ │ │ │ │ -V VisitedMap │ │ │ │ │ -The type of the map for marking vertices as visited. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:225 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +G MatrixGraph │ │ │ │ │ +The matrix graph type used. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:915 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ │ +Norm norm_ │ │ │ │ │ +The functor for calculating the norm. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:363 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const EdgeIterator &edge) const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:601 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +SymmetricCriterion() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:524 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +Dependency() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:290 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ +void examine(const ColIter &col) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ │ +M Matrix │ │ │ │ │ +The matrix type we build the dependency of. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:319 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ │ +real_type diagonal_ │ │ │ │ │ +The norm of the current diagonal. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:187 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ │ +N Norm │ │ │ │ │ +The norm to use for examining the matrix entries. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ +iterator end() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:742 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +UnSymmetricCriterion(const Parameters &parms) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:541 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_T_w_o_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ │ +void initRow(const Row &row, int index) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:201 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ │ +bool isIsolated() │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_N_u_l_l_E_n_t_r_y │ │ │ │ │ +static const Vertex NullEntry │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:1008 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ +void examine(const ColIter &col) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:214 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +Dependency(const Parameters &parms) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:286 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ │ +int row_ │ │ │ │ │ +index of the currently evaluated row. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:185 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_b_u_i_l_d │ │ │ │ │ +std::tuple< int, int, int, int > build(const M &m, G &graph, AggregatesMap< │ │ │ │ │ +Vertex > &aggregates, const C &c, bool finestLevel) │ │ │ │ │ +Build the aggregates. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r │ │ │ │ │ +FrontNeighbourCounter(const MatrixGraph &front) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ │ +Matrix::row_type Row │ │ │ │ │ +Constant Row iterator of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:329 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ │ +const Matrix * matrix_ │ │ │ │ │ +The matrix we work on. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:296 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +const AggregateDescriptor & operator[](const VertexDescriptor &v) const │ │ │ │ │ +Get the aggregate a vertex belongs to. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ +void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter │ │ │ │ │ +&col) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r │ │ │ │ │ +AggregateVisitor(const AggregatesMap< Vertex > &aggregates, const │ │ │ │ │ +AggregateDescriptor &aggregate, Visitor &visitor) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_C_o_l_I_t_e_r │ │ │ │ │ +Matrix::ConstColIterator ColIter │ │ │ │ │ +Constant column iterator of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:334 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_~_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +~AggregatesMap() │ │ │ │ │ +Destructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +Matrix::field_type field_type │ │ │ │ │ +The current max value. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:179 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ +void decrement() │ │ │ │ │ +Decrement counter. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_A_g_g_r_e_g_a_t_e │ │ │ │ │ +Aggregate(MatrixGraph &graph, AggregatesMap< Vertex > &aggregates, VertexSet │ │ │ │ │ +&connectivity, std::vector< Vertex > &front_) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_V_i_s_i_t_o_r │ │ │ │ │ +V Visitor │ │ │ │ │ +The type of the adapted visitor. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:1064 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_S_p_h_e_r_e_M_a_p │ │ │ │ │ +std::size_t * SphereMap │ │ │ │ │ +Type of the mapping of aggregate members onto distance spheres. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:809 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ +AggregationCriterion(const Parameters &parms) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ │ +Matrix::row_type Row │ │ │ │ │ +Constant Row iterator of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:268 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_o_n_n_e_c_t_S_i_z_e │ │ │ │ │ +VertexSet::size_type connectSize() │ │ │ │ │ +Get tne number of connections to other aggregates. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_v_a_l_s__ │ │ │ │ │ +std::vector< real_type > vals_ │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ │ +N Norm │ │ │ │ │ +The norm to use for examining the matrix entries. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:324 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_r_i_n_t_A_g_g_r_e_g_a_t_e_s_2_d │ │ │ │ │ +void printAggregates2d(const AggregatesMap< V > &aggregates, int n, int m, │ │ │ │ │ +std::ostream &os) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:2583 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_i_n_v_a_l_i_d_a_t_e │ │ │ │ │ +void invalidate() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:822 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ │ +real_type maxValue_ │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:181 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ │ +Norm norm_ │ │ │ │ │ +The functor for calculating the norm. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:183 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +VertexSet::const_iterator const_iterator │ │ │ │ │ +Const iterator over a vertex list. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:804 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +SymmetricCriterion(const Parameters &parms) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:521 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +MatrixGraph::VertexDescriptor AggregateDescriptor │ │ │ │ │ +The type of the aggregate descriptor. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:923 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ │ +real_type maxValue_ │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:361 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ │ +void init(const Matrix *matrix) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ │ +real_type diagonal_ │ │ │ │ │ +The norm of the current diagonal. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:367 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ +AggregateDescriptor * iterator │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:735 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +SymmetricDependency(const Parameters &parms) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:348 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:360 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_~_A_g_g_r_e_g_a_t_o_r │ │ │ │ │ +~Aggregator() │ │ │ │ │ +Destructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ +void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter │ │ │ │ │ +&col) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_a_d_d │ │ │ │ │ +void add(const Vertex &vertex) │ │ │ │ │ +Add a vertex to the aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_D_e_p_e_n_d_e_n_c_y_P_o_l_i_c_y │ │ │ │ │ +T DependencyPolicy │ │ │ │ │ +The policy for calculating the dependency graph. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_a_d_d │ │ │ │ │ +void add(std::vector< Vertex > &vertex) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ │ +void examine(const ColIter &col) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_o_r │ │ │ │ │ +Aggregator() │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ +Examine an edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_F_r_o_n_t_M_a_r_k_e_r │ │ │ │ │ +FrontMarker(std::vector< Vertex > &front, MatrixGraph &graph) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ │ +compute the norm of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:506 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ │ +void init(const Matrix *matrix) │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s │ │ │ │ │ int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, │ │ │ │ │ V &visitor) │ │ │ │ │ Visit all neighbour vertices of a vertex in a graph. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_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_:_:_S_e_t │ │ │ │ │ -S Set │ │ │ │ │ -The type of the connected set. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:220 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x_:_:_a_g_g_r_e_g_a_t_e │ │ │ │ │ -Aggregate * aggregate │ │ │ │ │ -The aggregate the vertex belongs to. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_:_:_s_u_m_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t sumRowSize() │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:534 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x_:_:_v_e_r_t_e_x │ │ │ │ │ -Vertex vertex │ │ │ │ │ -The vertex descriptor. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_:_:_m_i_n_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t minRowSize() │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:528 │ │ │ │ │ -_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_t │ │ │ │ │ -static void set(M &coarse, const T &pinfo, const O ©) │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:682 │ │ │ │ │ -_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_:_:_V_e_r_t_e_x │ │ │ │ │ -Graph::VertexDescriptor Vertex │ │ │ │ │ -The vertex descriptor of the graph. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:230 │ │ │ │ │ -_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_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_:_:_m_a_x_R_o_w_S_i_z_e │ │ │ │ │ -std::size_t maxRowSize() │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:523 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c │ │ │ │ │ +void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ │ +Sets reasonable default values for an isotropic problem. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +V AggregateDescriptor │ │ │ │ │ +The aggregate descriptor type. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:580 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ │ +static const V ISOLATED │ │ │ │ │ +Identifier of isolated vertices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ │ +int row_ │ │ │ │ │ +index of the currently evaluated row. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:365 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +SymmetricMatrixDependency() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:171 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r │ │ │ │ │ +DependencyCounter() │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_p_o_p │ │ │ │ │ +Vertex pop() │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ │ +real_type diagonal_ │ │ │ │ │ +The norm of the current diagonal. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:306 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ +std::size_t noVertices() const │ │ │ │ │ +Get the number of vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c │ │ │ │ │ +void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ │ +Sets reasonable default values for an aisotropic problem. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +AggregatesMap(std::size_t noVertices) │ │ │ │ │ +Constructs with allocating memory. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +Matrix::field_type field_type │ │ │ │ │ +The current max value. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:359 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +AggregateDescriptor & operator[](const VertexDescriptor &v) │ │ │ │ │ +Get the aggregate a vertex belongs to. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +AggregatesMap() │ │ │ │ │ +Constructs without allocating memory. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_v_a_l_u_e │ │ │ │ │ +int value() │ │ │ │ │ +Access the current count. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_L_i_s_t │ │ │ │ │ +SLList< VertexDescriptor, Allocator > VertexList │ │ │ │ │ +The type of a single linked list of vertex descriptors. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:592 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_~_S_t_a_c_k │ │ │ │ │ +~Stack() │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r │ │ │ │ │ +ConnectivityCounter(const VertexSet &connected, const AggregatesMap< Vertex > │ │ │ │ │ +&aggregates) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_i_z_e │ │ │ │ │ +VertexSet::size_type size() │ │ │ │ │ +Get the size of the aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +get an iterator over the vertices of the aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ │ +void init(const Matrix *matrix) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +UnSymmetricCriterion() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:544 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +const AggregateDescriptor * const_iterator │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ │ +int row_ │ │ │ │ │ +index of the currently evaluated row. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:304 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_S_t_a_c_k │ │ │ │ │ +Stack(const MatrixGraph &graph, const Aggregator< G > &aggregatesBuilder, const │ │ │ │ │ +AggregatesMap< Vertex > &aggregates) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ │ +void initRow(const Row &row, int index) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ │ +M Matrix │ │ │ │ │ +The matrix type we build the dependency of. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:139 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:299 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ │ +const Matrix * matrix_ │ │ │ │ │ +The matrix we work on. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:177 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_V_e_r_t_e_x_S_e_t │ │ │ │ │ +S VertexSet │ │ │ │ │ +The type of a single linked list of vertex descriptors. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:801 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ │ +compute the norm of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:490 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_U_N_A_G_G_R_E_G_A_T_E_D │ │ │ │ │ +static const V UNAGGREGATED │ │ │ │ │ +Identifier of not yet aggregated vertices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:566 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h │ │ │ │ │ +std::size_t breadthFirstSearch(const VertexDescriptor &start, const │ │ │ │ │ +AggregateDescriptor &aggregate, const G &graph, F &aggregateVisitor, VM │ │ │ │ │ +&visitedMap) const │ │ │ │ │ +Breadth first search within an aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +Matrix::field_type field_type │ │ │ │ │ +The current max value. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:298 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_O_n_e_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > │ │ │ │ │ +&criterion) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:113 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ │ +bool isIsolated() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:240 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ +void allocate(std::size_t noVertices) │ │ │ │ │ +Allocate memory for holding the information. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ │ +N Norm │ │ │ │ │ +The norm to use for examining the matrix entries. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:144 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ │ +compute the norm of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:473 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_r_e_c_o_n_s_t_r_u_c_t │ │ │ │ │ +void reconstruct(const Vertex &vertex) │ │ │ │ │ +Reconstruct the aggregat from an seed node. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +get an iterator over the vertices of the aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m, typename │ │ │ │ │ +std::enable_if_t::value > *sfinae=nullptr) const │ │ │ │ │ +compute the norm of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:390 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_V_e_r_t_e_x │ │ │ │ │ +MatrixGraph::VertexDescriptor Vertex │ │ │ │ │ +The vertex descriptor type. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:789 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_e_e_d │ │ │ │ │ +void seed(const Vertex &vertex) │ │ │ │ │ +Initialize the aggregate with one vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ │ +bool isIsolated() │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +SymmetricDependency() │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:351 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +Clear the aggregate. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_f_r_e_e │ │ │ │ │ +void free() │ │ │ │ │ +Free the allocated memory. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +Increment counter. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, │ │ │ │ │ +bool finestLevel) │ │ │ │ │ +Build the dependency of the matrix graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +V VertexDescriptor │ │ │ │ │ +The vertex descriptor type. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:575 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ │ +real_type maxValue_ │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:300 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s │ │ │ │ │ +std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, │ │ │ │ │ +const C &criterion, bool finestLevel) │ │ │ │ │ +Build the aggregates. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ │ +Matrix::row_type Row │ │ │ │ │ +Constant Row iterator of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +PoolAllocator< Vertex, 100 > Allocator │ │ │ │ │ +The allocator we use for our lists and the set. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:795 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +G MatrixGraph │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:785 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ +@ is_sign_preserving │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:483 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ +@ is_sign_preserving │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:382 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ +@ is_sign_preserving │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:499 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ │ +@ is_sign_preserving │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:466 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ _D_u_n_e_:_:_g_e_t │ │ │ │ │ PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ +derive error class from the base class in common │ │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ │ +Export the type representing the underlying field. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::const_iterator ConstColIterator │ │ │ │ │ +Const iterator for the entries of each row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ +MatrixImp::DenseMatrixBase< T, A >::window_type row_type │ │ │ │ │ +The type implementing a matrix row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:574 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ +Base class of all aggregation criterions. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +Dependency policy for symmetric matrices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:134 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +Dependency policy for symmetric matrices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:253 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +Dependency policy for symmetric matrices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:314 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l │ │ │ │ │ +Norm that uses only the [N][N] entry of the block to determine couplings. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:379 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_i_r_s_t_D_i_a_g_o_n_a_l │ │ │ │ │ +Norm that uses only the [0][0] entry of the block to determine couplings. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:455 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m │ │ │ │ │ +Functor using the row sum (infinity) norm to determine strong couplings. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:463 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:480 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:496 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +Criterion taking advantage of symmetric matrices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:519 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +Criterion suitable for unsymmetric matrices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:539 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r │ │ │ │ │ +Class for building the aggregates. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:909 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ │ A Dummy visitor that does nothing for each visited edge. │ │ │ │ │ DDeeffiinniittiioonn aggregates.hh:598 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r │ │ │ │ │ -Functor for building the sparsity pattern of the matrix using │ │ │ │ │ -examineConnectivity. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:99 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:185 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ │ -Visitor for identifying connected aggregates during a breadthFirstSearch. │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:206 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r │ │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_n_o_n_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ │ -@ nonoverlapping │ │ │ │ │ -Category for non-overlapping solvers. │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ │ -Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ │ -newly introduced virtu... │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e │ │ │ │ │ +A class for temporarily storing the vertices of an aggregate in. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:778 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +M::size_type VertexDescriptor │ │ │ │ │ +The vertex descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator │ │ │ │ │ +The constant edge iterator type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:298 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +Iterator over all edges starting from a vertex. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +The vertex iterator type of the graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +All parameters for AMG. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00149.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: graph.hh File Reference │ │ │ │ +dune-istl: renumberer.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,92 +73,39 @@ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ - │ │ │ │ +
renumberer.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#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>
│ │ │ │ +
#include "aggregates.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::Amg::AggregateRenumberer< G >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

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

│ │ │ │ -

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

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

Parameter classes for customizing AMG. │ │ │ │ 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 <cstddef>
│ │ │ │
│ │ │ │

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::DependencyParameters
 Parameters needed to check whether a node depends on another. More...
 
class  Dune::Amg::Hierarchy< T, A >::LevelIterator< C, T1 >
 Iterator over the levels in the hierarchy. 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

│ │ │ │ -

Provides a classes representing the hierarchies in AMG.

│ │ │ │ +

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,38 +1,45 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ +_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 │ │ │ │ │ -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> │ │ │ │ │ +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_:_:_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_:_:_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_:_:_H_i_e_r_a_r_c_h_y_<_ _T_,_ _A_ _>_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_<_ _C_,_ _T_1_ _> │ │ │ │ │ -  Iterator over the levels in the hierarchy. _M_o_r_e_._._. │ │ │ │ │ +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 ********** │ │ │ │ │ -Provides a classes representing the hierarchies in AMG. │ │ │ │ │ +Parameter classes for customizing AMG. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ +All parameters of the AMG can be set by using the class Parameter, which can be │ │ │ │ │ +provided to CoarsenCriterion via its constructor. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00152_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: hierarchy.hh Source File │ │ │ │ +dune-istl: parameters.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,419 +74,391 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
hierarchy.hh
│ │ │ │ +
parameters.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AMG_PARAMETERS_HH
│ │ │ │ +
6#define DUNE_AMG_PARAMETERS_HH
│ │ │ │
7
│ │ │ │ -
8#include <list>
│ │ │ │ -
9#include <memory>
│ │ │ │ -
10#include <limits>
│ │ │ │ -
11#include <dune/common/stdstreams.hh>
│ │ │ │ -
12#include <dune/common/timer.hh>
│ │ │ │ -
13#include <dune/common/bigunsignedint.hh>
│ │ │ │ - │ │ │ │ -
15
│ │ │ │ -
16namespace Dune
│ │ │ │ -
17{
│ │ │ │ -
18 namespace Amg
│ │ │ │ -
19 {
│ │ │ │ -
38 template<typename T, typename A=std::allocator<T> >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
40 {
│ │ │ │ -
41 public:
│ │ │ │ -
45 typedef T MemberType;
│ │ │ │ -
46
│ │ │ │ -
47 template<typename T1, typename T2>
│ │ │ │ -
48 class LevelIterator;
│ │ │ │ -
49
│ │ │ │ -
50 private:
│ │ │ │ -
54 struct Element
│ │ │ │ -
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>;
│ │ │ │ -
77
│ │ │ │ - │ │ │ │ -
79
│ │ │ │ -
│ │ │ │ -
84 Hierarchy(const std::shared_ptr<MemberType> & first);
│ │ │ │ -
85
│ │ │ │ -
│ │ │ │ -
89 Hierarchy() : levels_(0)
│ │ │ │ -
90 {}
│ │ │ │ +
8#include <cstddef>
│ │ │ │ +
9
│ │ │ │ +
10namespace Dune
│ │ │ │ +
11{
│ │ │ │ +
12 namespace Amg
│ │ │ │ +
13 {
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
31 {
│ │ │ │ +
32 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
35 : alpha_(1.0/3.0), beta_(1.0E-5)
│ │ │ │ +
36 {}
│ │ │ │ +
│ │ │ │ +
37
│ │ │ │ +
│ │ │ │ +
42 void setBeta(double b)
│ │ │ │ +
43 {
│ │ │ │ +
44 beta_ = b;
│ │ │ │ +
45 }
│ │ │ │
│ │ │ │ -
91
│ │ │ │ +
46
│ │ │ │ +
│ │ │ │ +
52 double beta() const
│ │ │ │ +
53 {
│ │ │ │ +
54 return beta_;
│ │ │ │ +
55 }
│ │ │ │ +
│ │ │ │ +
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:
│ │ │ │
│ │ │ │ -
95 Hierarchy(const Hierarchy& other);
│ │ │ │ -
96
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
102
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
104
│ │ │ │ -
│ │ │ │ -
109 void addFiner(Arguments& args);
│ │ │ │ -
110
│ │ │ │ -
117 template<class C, class T1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
119 : public BidirectionalIteratorFacade<LevelIterator<C,T1>,T1,T1&>
│ │ │ │ -
120 {
│ │ │ │ -
121 friend class LevelIterator<typename std::remove_const<C>::type,
│ │ │ │ -
122 typename std::remove_const<T1>::type >;
│ │ │ │ -
123 friend class LevelIterator<const typename std::remove_const<C>::type,
│ │ │ │ -
124 const typename std::remove_const<T1>::type >;
│ │ │ │ -
125
│ │ │ │ -
126 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
129 {}
│ │ │ │ -
│ │ │ │ -
130
│ │ │ │ -
│ │ │ │ -
131 LevelIterator(std::shared_ptr<Element> element)
│ │ │ │ -
132 : element_(element)
│ │ │ │ -
133 {}
│ │ │ │ -
│ │ │ │ -
134
│ │ │ │ -
│ │ │ │ -
136 LevelIterator(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ │ -
137 typename std::remove_const<T1>::type>& other)
│ │ │ │ -
138 : element_(other.element_)
│ │ │ │ -
139 {}
│ │ │ │ -
│ │ │ │ -
140
│ │ │ │ -
│ │ │ │ -
142 LevelIterator(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ │ -
143 const typename std::remove_const<T1>::type>& other)
│ │ │ │ -
144 : element_(other.element_)
│ │ │ │ -
145 {}
│ │ │ │ -
│ │ │ │ -
146
│ │ │ │ -
│ │ │ │ -
150 bool equals(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ │ -
151 typename std::remove_const<T1>::type>& other) const
│ │ │ │ -
152 {
│ │ │ │ -
153 return element_ == other.element_;
│ │ │ │ -
154 }
│ │ │ │ + │ │ │ │ +
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 }
│ │ │ │ +
│ │ │ │ +
144 std::size_t maxDistance() const { return maxDistance_;}
│ │ │ │ +
145
│ │ │ │ +
154 void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
│ │ │ │
155
│ │ │ │ -
│ │ │ │ -
159 bool equals(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ │ -
160 const typename std::remove_const<T1>::type>& other) const
│ │ │ │ -
161 {
│ │ │ │ -
162 return element_ == other.element_;
│ │ │ │ -
163 }
│ │ │ │ -
│ │ │ │ -
164
│ │ │ │ -
│ │ │ │ -
166 T1& dereference() const
│ │ │ │ -
167 {
│ │ │ │ -
168 return *(element_->element_);
│ │ │ │ -
169 }
│ │ │ │ -
│ │ │ │ -
170
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
173 {
│ │ │ │ -
174 element_ = element_->coarser_.lock();
│ │ │ │ -
175 }
│ │ │ │ -
│ │ │ │ -
176
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
179 {
│ │ │ │ -
180 element_ = element_->finer_;
│ │ │ │ -
181 }
│ │ │ │ -
│ │ │ │ -
182
│ │ │ │ -
│ │ │ │ -
187 bool isRedistributed() const
│ │ │ │ -
188 {
│ │ │ │ -
189 return (bool)element_->redistributed_;
│ │ │ │ -
190 }
│ │ │ │ -
│ │ │ │ -
191
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
197 {
│ │ │ │ -
198 assert(element_->redistributed_);
│ │ │ │ -
199 return *element_->redistributed_;
│ │ │ │ -
200 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
201 void addRedistributed(std::shared_ptr<T1> t)
│ │ │ │ -
202 {
│ │ │ │ -
203 element_->redistributed_ = t;
│ │ │ │ -
204 }
│ │ │ │ -
│ │ │ │ -
205
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
207 {
│ │ │ │ -
208 element_->redistributed_ = nullptr;
│ │ │ │ -
209 }
│ │ │ │ -
│ │ │ │ -
210
│ │ │ │ -
211 private:
│ │ │ │ -
212 std::shared_ptr<Element> element_;
│ │ │ │ -
213 };
│ │ │ │ -
│ │ │ │ -
214
│ │ │ │ - │ │ │ │ -
217
│ │ │ │ - │ │ │ │ -
220
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
226
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
232
│ │ │ │ -
233
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
239
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
245
│ │ │ │ -
│ │ │ │ -
250 std::size_t levels() const;
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ +
188 void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
│ │ │ │ +
189
│ │ │ │ +
194 std::size_t maxAggregateSize() const { return maxAggregateSize_;}
│ │ │ │ +
195
│ │ │ │ +
202 void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
│ │ │ │ +
203
│ │ │ │ +
211 std::size_t maxConnectivity() const { return connectivity_;}
│ │ │ │ +
212
│ │ │ │ +
220 void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
│ │ │ │ +
221
│ │ │ │ +
222 private:
│ │ │ │ +
223 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
│ │ │ │ +
224 bool skipiso_;
│ │ │ │ +
225
│ │ │ │ +
226 };
│ │ │ │ +
│ │ │ │ +
227
│ │ │ │ +
228
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
249 };
│ │ │ │ +
│ │ │ │ +
250
│ │ │ │
251
│ │ │ │ -
252 private:
│ │ │ │ -
258 std::shared_ptr<MemberType> originalFinest_;
│ │ │ │ -
260 std::shared_ptr<Element> finest_;
│ │ │ │ -
262 std::shared_ptr<Element> coarsest_;
│ │ │ │ -
264 Allocator allocator_;
│ │ │ │ -
266 int levels_;
│ │ │ │ -
267 };
│ │ │ │ -
268
│ │ │ │ -
269 template<class T, class A>
│ │ │ │ +
252
│ │ │ │ +
253
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
258 {
│ │ │ │ +
259 public:
│ │ │ │ +
│ │ │ │ +
263 void setMaxLevel(int l)
│ │ │ │ +
264 {
│ │ │ │ +
265 maxLevel_ = l;
│ │ │ │ +
266 }
│ │ │ │ +
│ │ │ │
│ │ │ │ -
270 Hierarchy<T,A>::Hierarchy(const std::shared_ptr<MemberType> & first)
│ │ │ │ -
271 : originalFinest_(first)
│ │ │ │ -
272 {
│ │ │ │ -
273 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ -
274 finest_->element_ = originalFinest_;
│ │ │ │ -
275 coarsest_ = finest_;
│ │ │ │ -
276 levels_ = 1;
│ │ │ │ -
277 }
│ │ │ │ -
│ │ │ │ -
278
│ │ │ │ -
280 //TODO: do we actually want to support this? This might be very expensive?!
│ │ │ │ -
281 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
283 : allocator_(other.allocator_),
│ │ │ │ -
284 levels_(other.levels_)
│ │ │ │ -
285 {
│ │ │ │ -
286 if(!other.finest_)
│ │ │ │ -
287 {
│ │ │ │ -
288 finest_=coarsest_=nullptr;
│ │ │ │ -
289 return;
│ │ │ │ -
290 }
│ │ │ │ -
291 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ -
292 std::shared_ptr<Element> finer_;
│ │ │ │ -
293 std::shared_ptr<Element> current_ = finest_;
│ │ │ │ -
294 std::weak_ptr<Element> otherWeak_ = other.finest_;
│ │ │ │ -
295
│ │ │ │ -
296 while(! otherWeak_.expired())
│ │ │ │ +
270 int maxLevel() const
│ │ │ │ +
271 {
│ │ │ │ +
272 return maxLevel_;
│ │ │ │ +
273 }
│ │ │ │ +
│ │ │ │ +
274
│ │ │ │ +
│ │ │ │ +
278 void setCoarsenTarget(int nodes)
│ │ │ │ +
279 {
│ │ │ │ +
280 coarsenTarget_ = nodes;
│ │ │ │ +
281 }
│ │ │ │ +
│ │ │ │ +
282
│ │ │ │ +
│ │ │ │ +
286 int coarsenTarget() const
│ │ │ │ +
287 {
│ │ │ │ +
288 return coarsenTarget_;
│ │ │ │ +
289 }
│ │ │ │ +
│ │ │ │ +
290
│ │ │ │ +
│ │ │ │ +
296 void setMinCoarsenRate(double rate)
│ │ │ │
297 {
│ │ │ │ -
298 // create shared_ptr from weak_ptr, we just checked that this is safe
│ │ │ │ -
299 std::shared_ptr<Element> otherCurrent_ = std::shared_ptr<Element>(otherWeak_);
│ │ │ │ -
300 // clone current level
│ │ │ │ -
301 //TODO: should we use the allocator?
│ │ │ │ -
302 current_->element_ =
│ │ │ │ -
303 std::make_shared<MemberType>(*(otherCurrent_->element_));
│ │ │ │ -
304 current_->finer_=finer_;
│ │ │ │ -
305 if(otherCurrent_->redistributed_)
│ │ │ │ -
306 current_->redistributed_ =
│ │ │ │ -
307 std::make_shared<MemberType>(*(otherCurrent_->redistributed_));
│ │ │ │ -
308 finer_=current_;
│ │ │ │ -
309 if(not otherCurrent_->coarser_.expired())
│ │ │ │ -
310 {
│ │ │ │ -
311 auto c = std::allocate_shared<Element>(allocator_);
│ │ │ │ -
312 current_->coarser_ = c;
│ │ │ │ -
313 current_ = c;
│ │ │ │ -
314 }
│ │ │ │ -
315 // go to coarser level
│ │ │ │ -
316 otherWeak_ = otherCurrent_->coarser_;
│ │ │ │ -
317 }
│ │ │ │ -
318 coarsest_=current_;
│ │ │ │ -
319 }
│ │ │ │ -
│ │ │ │ -
320
│ │ │ │ -
321 template<class T, class A>
│ │ │ │ -
│ │ │ │ -
322 std::size_t Hierarchy<T,A>::levels() const
│ │ │ │ -
323 {
│ │ │ │ -
324 return levels_;
│ │ │ │ -
325 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
326
│ │ │ │ -
327 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
329 {
│ │ │ │ -
330 coarsest_->redistributed_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ -
331 }
│ │ │ │ -
│ │ │ │ -
332
│ │ │ │ -
333 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
335 {
│ │ │ │ -
336 if(!coarsest_) {
│ │ │ │ -
337 // we have no levels at all...
│ │ │ │ -
338 assert(!finest_);
│ │ │ │ -
339 // allocate into the shared_ptr
│ │ │ │ -
340 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ -
341 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ -
342 coarsest_->element_ = originalFinest_;
│ │ │ │ -
343 finest_ = coarsest_;
│ │ │ │ -
344 }else{
│ │ │ │ -
345 auto old_coarsest = coarsest_;
│ │ │ │ -
346 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ -
347 coarsest_->finer_ = old_coarsest;
│ │ │ │ -
348 coarsest_->element_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ -
349 old_coarsest->coarser_ = coarsest_;
│ │ │ │ -
350 }
│ │ │ │ -
351 ++levels_;
│ │ │ │ -
352 }
│ │ │ │ -
│ │ │ │ -
353
│ │ │ │ -
354
│ │ │ │ -
355 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
357 {
│ │ │ │ -
358 //TODO: wouldn't it be better to do this in the constructor?'
│ │ │ │ -
359 if(!finest_) {
│ │ │ │ -
360 // we have no levels at all...
│ │ │ │ -
361 assert(!coarsest_);
│ │ │ │ -
362 // allocate into the shared_ptr
│ │ │ │ -
363 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ │ -
364 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ -
365 finest_->element = originalFinest_;
│ │ │ │ -
366 coarsest_ = finest_;
│ │ │ │ -
367 }else{
│ │ │ │ -
368 finest_->finer_ = std::allocate_shared<Element>(allocator_);
│ │ │ │ -
369 finest_->finer_->coarser_ = finest_;
│ │ │ │ -
370 finest_ = finest_->finer_;
│ │ │ │ -
371 finest_->element = ConstructionTraits<T>::construct(args);
│ │ │ │ -
372 }
│ │ │ │ -
373 ++levels_;
│ │ │ │ -
374 }
│ │ │ │ -
│ │ │ │ -
375
│ │ │ │ -
376 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
378 {
│ │ │ │ -
379 return Iterator(finest_);
│ │ │ │ -
380 }
│ │ │ │ -
│ │ │ │ -
381
│ │ │ │ -
382 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
384 {
│ │ │ │ -
385 return Iterator(coarsest_);
│ │ │ │ -
386 }
│ │ │ │ -
│ │ │ │ -
387
│ │ │ │ -
388 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
390 {
│ │ │ │ -
391 return ConstIterator(finest_);
│ │ │ │ -
392 }
│ │ │ │ -
│ │ │ │ -
393
│ │ │ │ -
394 template<class T, class A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
396 {
│ │ │ │ -
397 return ConstIterator(coarsest_);
│ │ │ │ -
398 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
400 } // namespace Amg
│ │ │ │ -
401} // namespace Dune
│ │ │ │ -
402
│ │ │ │ -
403#endif
│ │ │ │ -
│ │ │ │ +
298 minCoarsenRate_ = rate;
│ │ │ │ +
299 }
│ │ │ │
│ │ │ │ +
300
│ │ │ │ +
│ │ │ │ +
304 double minCoarsenRate() const
│ │ │ │ +
305 {
│ │ │ │ +
306 return minCoarsenRate_;
│ │ │ │ +
307 }
│ │ │ │ +
│ │ │ │ +
308
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
313 {
│ │ │ │ +
314 return accumulate_;
│ │ │ │ +
315 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
320 {
│ │ │ │ +
321 accumulate_=accu;
│ │ │ │ +
322 }
│ │ │ │ +
│ │ │ │ +
323
│ │ │ │ +
│ │ │ │ +
324 void setAccumulate(bool accu){
│ │ │ │ +
325 accumulate_=accu ? successiveAccu : noAccu;
│ │ │ │ +
326 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
333 {
│ │ │ │ +
334 dampingFactor_ = d;
│ │ │ │ +
335 }
│ │ │ │ +
│ │ │ │ +
336
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
343 {
│ │ │ │ +
344 return dampingFactor_;
│ │ │ │ +
345 }
│ │ │ │
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
Helper classes for the construction of classes without empty constructor.
│ │ │ │ -
Hierarchy(const Hierarchy &other)
Copy constructor (deep copy!).
Definition hierarchy.hh:282
│ │ │ │ -
void addRedistributedOnCoarsest(Arguments &args)
Definition hierarchy.hh:328
│ │ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ │ -
ConstIterator coarsest() const
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:395
│ │ │ │ -
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ │ -
void addFiner(Arguments &args)
Add an element on a finer level.
Definition hierarchy.hh:356
│ │ │ │ -
Hierarchy(const std::shared_ptr< MemberType > &first)
Construct a new hierarchy.
Definition hierarchy.hh:270
│ │ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ -
Iterator coarsest()
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:383
│ │ │ │ -
ConstIterator finest() const
Get an iterator positioned at the finest level.
Definition hierarchy.hh:389
│ │ │ │ -
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ │ -
STL namespace.
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
357 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
│ │ │ │ +
358 : maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
│ │ │ │ +
359 dampingFactor_(prolongDamp), accumulate_( accumulate)
│ │ │ │ +
360 {}
│ │ │ │ +
│ │ │ │ +
361
│ │ │ │ +
362 private:
│ │ │ │ +
366 int maxLevel_;
│ │ │ │ +
370 int coarsenTarget_;
│ │ │ │ +
374 double minCoarsenRate_;
│ │ │ │ +
378 double dampingFactor_;
│ │ │ │ +
383 AccumulationMode accumulate_;
│ │ │ │ +
384 };
│ │ │ │ +
│ │ │ │ +
385
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
393 {
│ │ │ │ +
394 public:
│ │ │ │ +
│ │ │ │ +
401 void setDebugLevel(int level)
│ │ │ │ +
402 {
│ │ │ │ +
403 debugLevel_ = level;
│ │ │ │ +
404 }
│ │ │ │ +
│ │ │ │ +
405
│ │ │ │ +
│ │ │ │ +
411 int debugLevel() const
│ │ │ │ +
412 {
│ │ │ │ +
413 return debugLevel_;
│ │ │ │ +
414 }
│ │ │ │ +
│ │ │ │ +
415
│ │ │ │ +
│ │ │ │ +
420 void setNoPreSmoothSteps(std::size_t steps)
│ │ │ │ +
421 {
│ │ │ │ +
422 preSmoothSteps_=steps;
│ │ │ │ +
423 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
428 std::size_t getNoPreSmoothSteps() const
│ │ │ │ +
429 {
│ │ │ │ +
430 return preSmoothSteps_;
│ │ │ │ +
431 }
│ │ │ │ +
│ │ │ │ +
432
│ │ │ │ +
│ │ │ │ +
437 void setNoPostSmoothSteps(std::size_t steps)
│ │ │ │ +
438 {
│ │ │ │ +
439 postSmoothSteps_=steps;
│ │ │ │ +
440 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
445 std::size_t getNoPostSmoothSteps() const
│ │ │ │ +
446 {
│ │ │ │ +
447 return postSmoothSteps_;
│ │ │ │ +
448 }
│ │ │ │ +
│ │ │ │ +
449
│ │ │ │ +
│ │ │ │ +
453 void setGamma(std::size_t gamma)
│ │ │ │ +
454 {
│ │ │ │ +
455 gamma_=gamma;
│ │ │ │ +
456 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
460 std::size_t getGamma() const
│ │ │ │ +
461 {
│ │ │ │ +
462 return gamma_;
│ │ │ │ +
463 }
│ │ │ │ +
│ │ │ │ +
464
│ │ │ │ +
│ │ │ │ +
469 void setAdditive(bool additive)
│ │ │ │ +
470 {
│ │ │ │ +
471 additive_=additive;
│ │ │ │ +
472 }
│ │ │ │ +
│ │ │ │ +
473
│ │ │ │ +
│ │ │ │ +
478 bool getAdditive() const
│ │ │ │ +
479 {
│ │ │ │ +
480 return additive_;
│ │ │ │ +
481 }
│ │ │ │ +
│ │ │ │ +
482
│ │ │ │ +
│ │ │ │ +
493 Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ │ +
494 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
│ │ │ │ + │ │ │ │ +
496 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
│ │ │ │ +
497 additive_(false)
│ │ │ │ +
498 {}
│ │ │ │ +
│ │ │ │ +
499 private:
│ │ │ │ +
500 int debugLevel_;
│ │ │ │ +
501 std::size_t preSmoothSteps_;
│ │ │ │ +
502 std::size_t postSmoothSteps_;
│ │ │ │ +
503 std::size_t gamma_;
│ │ │ │ +
504 bool additive_;
│ │ │ │ +
505 };
│ │ │ │ +
│ │ │ │ +
506
│ │ │ │ +
507 } //namespace AMG
│ │ │ │ +
508
│ │ │ │ +
509} //namespace Dune
│ │ │ │ +
510#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:469
│ │ │ │ +
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:332
│ │ │ │ +
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:202
│ │ │ │ +
void setMinCoarsenRate(double rate)
Set the minimum coarsening rate to be achieved in each coarsening.
Definition parameters.hh:296
│ │ │ │ +
double minCoarsenRate() const
Get the minimum coarsening rate to be achieved.
Definition parameters.hh:304
│ │ │ │ +
std::size_t maxAggregateSize() const
Get the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:194
│ │ │ │ +
void setAlpha(double a)
Set the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:61
│ │ │ │ +
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:211
│ │ │ │ +
int coarsenTarget() const
Get the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:286
│ │ │ │ +
void setAccumulate(AccumulationMode accu)
Set whether he data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:319
│ │ │ │ +
double getProlongationDampingFactor() const
Get the damping factor for the prolongation.
Definition parameters.hh:342
│ │ │ │ +
AccumulationMode accumulate() const
Whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:312
│ │ │ │ +
void setMaxConnectivity(std::size_t connectivity)
Set the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:220
│ │ │ │ +
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:478
│ │ │ │ +
void setMaxLevel(int l)
Set the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:263
│ │ │ │ +
void setDebugLevel(int level)
Set the debugging level.
Definition parameters.hh:401
│ │ │ │ +
std::size_t getGamma() const
Get the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:460
│ │ │ │ +
void setNoPostSmoothSteps(std::size_t steps)
Set the number of postsmoothing steps to apply.
Definition parameters.hh:437
│ │ │ │ +
std::size_t getNoPreSmoothSteps() const
Get the number of presmoothing steps to apply.
Definition parameters.hh:428
│ │ │ │ +
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:188
│ │ │ │ +
int maxLevel() const
Get the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:270
│ │ │ │ +
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
│ │ │ │ +
Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
Constructor.
Definition parameters.hh:493
│ │ │ │ +
void setCoarsenTarget(int nodes)
Set the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:278
│ │ │ │ +
void setNoPreSmoothSteps(std::size_t steps)
Set the number of presmoothing steps to apply.
Definition parameters.hh:420
│ │ │ │ +
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:232
│ │ │ │ +
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
│ │ │ │ +
CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
Constructor.
Definition parameters.hh:356
│ │ │ │ +
void setGamma(std::size_t gamma)
Set the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:453
│ │ │ │ +
void setAccumulate(bool accu)
Definition parameters.hh:324
│ │ │ │ +
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:411
│ │ │ │ +
std::size_t getNoPostSmoothSteps() const
Get the number of postsmoothing steps to apply.
Definition parameters.hh:445
│ │ │ │ +
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:244
│ │ │ │ +
@ noAccu
No data accumulution.
Definition parameters.hh:238
│ │ │ │ +
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:248
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ │ -
T MemberType
The type of the container we store.
Definition hierarchy.hh:45
│ │ │ │ -
LevelIterator< Hierarchy< T, A >, T > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ -
LevelIterator< const Hierarchy< T, A >, const T > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ │ -
ConstructionTraits< T >::Arguments Arguments
Definition hierarchy.hh:78
│ │ │ │ -
Hierarchy()
Construct an empty hierarchy.
Definition hierarchy.hh:89
│ │ │ │ -
typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator
The allocator to use for the list elements.
Definition hierarchy.hh:76
│ │ │ │ -
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ │ -
LevelIterator(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:136
│ │ │ │ -
void addRedistributed(std::shared_ptr< T1 > t)
Definition hierarchy.hh:201
│ │ │ │ -
T1 & dereference() const
Dereference the iterator.
Definition hierarchy.hh:166
│ │ │ │ -
bool equals(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:150
│ │ │ │ -
bool isRedistributed() const
Check whether there was a redistribution at the current level.
Definition hierarchy.hh:187
│ │ │ │ -
bool equals(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:159
│ │ │ │ -
void increment()
Move to the next coarser level.
Definition hierarchy.hh:172
│ │ │ │ -
LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:142
│ │ │ │ -
void deleteRedistributed()
Definition hierarchy.hh:206
│ │ │ │ -
void decrement()
Move to the next fine level.
Definition hierarchy.hh:178
│ │ │ │ -
LevelIterator(std::shared_ptr< Element > element)
Definition hierarchy.hh:131
│ │ │ │ -
T1 & getRedistributed() const
Get the redistributed container.
Definition hierarchy.hh:196
│ │ │ │ +
Parameters needed to check whether a node depends on another.
Definition parameters.hh:31
│ │ │ │ +
Parameters needed for the aggregation process.
Definition parameters.hh:84
│ │ │ │ +
Parameters for the complete coarsening process.
Definition parameters.hh:258
│ │ │ │ +
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,442 +1,462 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -hierarchy.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 (C) 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_AMG_PARAMETERS_HH │ │ │ │ │ +6#define DUNE_AMG_PARAMETERS_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ │ -15 │ │ │ │ │ -16namespace _D_u_n_e │ │ │ │ │ -17{ │ │ │ │ │ -18 namespace Amg │ │ │ │ │ -19 { │ │ │ │ │ -38 template > │ │ │ │ │ -_3_9 class _H_i_e_r_a_r_c_h_y │ │ │ │ │ -40 { │ │ │ │ │ -41 public: │ │ │ │ │ -_4_5 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e │ │ │ │ │ +11{ │ │ │ │ │ +12 namespace Amg │ │ │ │ │ +13 { │ │ │ │ │ +_3_0 class _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +31 { │ │ │ │ │ +32 public: │ │ │ │ │ +_3_4 _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s() │ │ │ │ │ +35 : alpha_(1.0/3.0), beta_(1.0E-5) │ │ │ │ │ +36 {} │ │ │ │ │ +37 │ │ │ │ │ +_4_2 void _s_e_t_B_e_t_a(double b) │ │ │ │ │ +43 { │ │ │ │ │ +44 beta_ = b; │ │ │ │ │ +45 } │ │ │ │ │ 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; │ │ │ │ │ -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&> │ │ │ │ │ -120 { │ │ │ │ │ -121 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -122 typename std::remove_const::type >; │ │ │ │ │ -123 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -124 const typename std::remove_const::type >; │ │ │ │ │ -125 │ │ │ │ │ -126 public: │ │ │ │ │ -_1_2_8 _L_e_v_e_l_I_t_e_r_a_t_o_r() │ │ │ │ │ -129 {} │ │ │ │ │ -130 │ │ │ │ │ -_1_3_1 _L_e_v_e_l_I_t_e_r_a_t_o_r(std::shared_ptr element) │ │ │ │ │ -132 : element_(element) │ │ │ │ │ -133 {} │ │ │ │ │ -134 │ │ │ │ │ -_1_3_6 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -137 typename std::remove_const::type>& other) │ │ │ │ │ -138 : element_(other.element_) │ │ │ │ │ -139 {} │ │ │ │ │ -140 │ │ │ │ │ -_1_4_2 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r:: │ │ │ │ │ -type, │ │ │ │ │ -143 const typename std::remove_const::type>& other) │ │ │ │ │ -144 : element_(other.element_) │ │ │ │ │ -145 {} │ │ │ │ │ -146 │ │ │ │ │ -_1_5_0 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -151 typename std::remove_const::type>& other) const │ │ │ │ │ -152 { │ │ │ │ │ -153 return element_ == other.element_; │ │ │ │ │ -154 } │ │ │ │ │ +_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 │ │ │ │ │ +_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; │ │ │ │ │ +113 │ │ │ │ │ +114 for(; dim>0; dim--) { │ │ │ │ │ +115 csize*=diameter; │ │ │ │ │ +116 maxDistance_+=diameter-1; │ │ │ │ │ +117 } │ │ │ │ │ +118 minAggregateSize_=csize; │ │ │ │ │ +119 maxAggregateSize_=static_cast(csize*1.5); │ │ │ │ │ +120 } │ │ │ │ │ +121 │ │ │ │ │ +_1_3_2 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c(std::size_t dim,std::size_t diameter=2) │ │ │ │ │ +133 { │ │ │ │ │ +134 _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(dim, diameter); │ │ │ │ │ +135 maxDistance_+=dim-1; │ │ │ │ │ +136 } │ │ │ │ │ +_1_4_4 std::size_t _m_a_x_D_i_s_t_a_n_c_e() const { return maxDistance_;} │ │ │ │ │ +145 │ │ │ │ │ +_1_5_4 void _s_e_t_M_a_x_D_i_s_t_a_n_c_e(std::size_t distance) { maxDistance_ = distance;} │ │ │ │ │ 155 │ │ │ │ │ -_1_5_9 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ │ -160 const typename std::remove_const::type>& other) const │ │ │ │ │ -161 { │ │ │ │ │ -162 return element_ == other.element_; │ │ │ │ │ -163 } │ │ │ │ │ -164 │ │ │ │ │ -_1_6_6 T1& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ -167 { │ │ │ │ │ -168 return *(element_->element_); │ │ │ │ │ -169 } │ │ │ │ │ -170 │ │ │ │ │ -_1_7_2 void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ -173 { │ │ │ │ │ -174 element_ = element_->coarser_.lock(); │ │ │ │ │ -175 } │ │ │ │ │ -176 │ │ │ │ │ -_1_7_8 void _d_e_c_r_e_m_e_n_t() │ │ │ │ │ -179 { │ │ │ │ │ -180 element_ = element_->finer_; │ │ │ │ │ -181 } │ │ │ │ │ -182 │ │ │ │ │ -_1_8_7 bool _i_s_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ │ -188 { │ │ │ │ │ -189 return (bool)element_->redistributed_; │ │ │ │ │ -190 } │ │ │ │ │ -191 │ │ │ │ │ -_1_9_6 T1& _g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ │ -197 { │ │ │ │ │ -198 assert(element_->redistributed_); │ │ │ │ │ -199 return *element_->redistributed_; │ │ │ │ │ -200 } │ │ │ │ │ -_2_0_1 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d(std::shared_ptr t) │ │ │ │ │ -202 { │ │ │ │ │ -203 element_->redistributed_ = t; │ │ │ │ │ -204 } │ │ │ │ │ -205 │ │ │ │ │ -_2_0_6 void _d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d() │ │ │ │ │ -207 { │ │ │ │ │ -208 element_->redistributed_ = nullptr; │ │ │ │ │ -209 } │ │ │ │ │ -210 │ │ │ │ │ -211 private: │ │ │ │ │ -212 std::shared_ptr element_; │ │ │ │ │ -213 }; │ │ │ │ │ -214 │ │ │ │ │ -_2_1_6 typedef _L_e_v_e_l_I_t_e_r_a_t_o_r_<_H_i_e_r_a_r_c_h_y_<_T_,_A_>,T> _I_t_e_r_a_t_o_r; │ │ │ │ │ -217 │ │ │ │ │ -_2_1_9 typedef _L_e_v_e_l_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _H_i_e_r_a_r_c_h_y_<_T_,_A_>, const T> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -220 │ │ │ │ │ -_2_2_5 _I_t_e_r_a_t_o_r _f_i_n_e_s_t(); │ │ │ │ │ -226 │ │ │ │ │ -_2_3_1 _I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t(); │ │ │ │ │ -232 │ │ │ │ │ -233 │ │ │ │ │ -_2_3_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _f_i_n_e_s_t() const; │ │ │ │ │ -239 │ │ │ │ │ -_2_4_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t() const; │ │ │ │ │ -245 │ │ │ │ │ -_2_5_0 std::size_t _l_e_v_e_l_s() const; │ │ │ │ │ +_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_8 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;} │ │ │ │ │ +189 │ │ │ │ │ +_1_9_4 std::size_t _m_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e() const { return maxAggregateSize_;} │ │ │ │ │ +195 │ │ │ │ │ +_2_0_2 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;} │ │ │ │ │ +203 │ │ │ │ │ +_2_1_1 std::size_t _m_a_x_C_o_n_n_e_c_t_i_v_i_t_y() const { return connectivity_;} │ │ │ │ │ +212 │ │ │ │ │ +_2_2_0 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;} │ │ │ │ │ +221 │ │ │ │ │ +222 private: │ │ │ │ │ +223 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, │ │ │ │ │ +connectivity_; │ │ │ │ │ +224 bool skipiso_; │ │ │ │ │ +225 │ │ │ │ │ +226 }; │ │ │ │ │ +227 │ │ │ │ │ +228 │ │ │ │ │ +_2_3_2 enum _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e { │ │ │ │ │ +_2_3_8 _n_o_A_c_c_u = 0, │ │ │ │ │ +_2_4_4 _a_t_O_n_c_e_A_c_c_u=1, │ │ │ │ │ +248 _s_u_c_c_e_s_s_i_v_e_A_c_c_u=2 │ │ │ │ │ +_2_4_9 }; │ │ │ │ │ +250 │ │ │ │ │ 251 │ │ │ │ │ -252 private: │ │ │ │ │ -258 std::shared_ptr originalFinest_; │ │ │ │ │ -260 std::shared_ptr finest_; │ │ │ │ │ -262 std::shared_ptr coarsest_; │ │ │ │ │ -264 _A_l_l_o_c_a_t_o_r allocator_; │ │ │ │ │ -266 int levels_; │ │ │ │ │ -267 }; │ │ │ │ │ -268 │ │ │ │ │ -269 template │ │ │ │ │ -_2_7_0 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const std::shared_ptr & first) │ │ │ │ │ -271 : originalFinest_(first) │ │ │ │ │ -272 { │ │ │ │ │ -273 finest_ = std::allocate_shared(allocator_); │ │ │ │ │ -274 finest_->element_ = originalFinest_; │ │ │ │ │ -275 coarsest_ = finest_; │ │ │ │ │ -276 levels_ = 1; │ │ │ │ │ -277 } │ │ │ │ │ -278 │ │ │ │ │ -280 //TODO: do we actually want to support this? This might be very expensive?! │ │ │ │ │ -281 template │ │ │ │ │ -_2_8_2 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const _H_i_e_r_a_r_c_h_y& other) │ │ │ │ │ -283 : allocator_(other.allocator_), │ │ │ │ │ -284 levels_(other.levels_) │ │ │ │ │ -285 { │ │ │ │ │ -286 if(!other.finest_) │ │ │ │ │ +252 │ │ │ │ │ +253 │ │ │ │ │ +_2_5_7 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 │ │ │ │ │ +258 { │ │ │ │ │ +259 public: │ │ │ │ │ +_2_6_3 void _s_e_t_M_a_x_L_e_v_e_l(int l) │ │ │ │ │ +264 { │ │ │ │ │ +265 maxLevel_ = l; │ │ │ │ │ +266 } │ │ │ │ │ +_2_7_0 int _m_a_x_L_e_v_e_l() const │ │ │ │ │ +271 { │ │ │ │ │ +272 return maxLevel_; │ │ │ │ │ +273 } │ │ │ │ │ +274 │ │ │ │ │ +_2_7_8 void _s_e_t_C_o_a_r_s_e_n_T_a_r_g_e_t(int nodes) │ │ │ │ │ +279 { │ │ │ │ │ +280 coarsenTarget_ = nodes; │ │ │ │ │ +281 } │ │ │ │ │ +282 │ │ │ │ │ +_2_8_6 int _c_o_a_r_s_e_n_T_a_r_g_e_t() const │ │ │ │ │ 287 { │ │ │ │ │ -288 finest_=coarsest_=nullptr; │ │ │ │ │ -289 return; │ │ │ │ │ -290 } │ │ │ │ │ -291 finest_ = std::allocate_shared(allocator_); │ │ │ │ │ -292 std::shared_ptr finer_; │ │ │ │ │ -293 std::shared_ptr current_ = finest_; │ │ │ │ │ -294 std::weak_ptr otherWeak_ = other.finest_; │ │ │ │ │ -295 │ │ │ │ │ -296 while(! otherWeak_.expired()) │ │ │ │ │ +288 return coarsenTarget_; │ │ │ │ │ +289 } │ │ │ │ │ +290 │ │ │ │ │ +_2_9_6 void _s_e_t_M_i_n_C_o_a_r_s_e_n_R_a_t_e(double rate) │ │ │ │ │ 297 { │ │ │ │ │ -298 // create shared_ptr from weak_ptr, we just checked that this is safe │ │ │ │ │ -299 std::shared_ptr otherCurrent_ = std::shared_ptr │ │ │ │ │ -(otherWeak_); │ │ │ │ │ -300 // clone current level │ │ │ │ │ -301 //TODO: should we use the allocator? │ │ │ │ │ -302 current_->element_ = │ │ │ │ │ -303 std::make_shared(*(otherCurrent_->element_)); │ │ │ │ │ -304 current_->finer_=finer_; │ │ │ │ │ -305 if(otherCurrent_->redistributed_) │ │ │ │ │ -306 current_->redistributed_ = │ │ │ │ │ -307 std::make_shared(*(otherCurrent_->redistributed_)); │ │ │ │ │ -308 finer_=current_; │ │ │ │ │ -309 if(not otherCurrent_->coarser_.expired()) │ │ │ │ │ -310 { │ │ │ │ │ -311 auto c = std::allocate_shared(allocator_); │ │ │ │ │ -312 current_->coarser_ = c; │ │ │ │ │ -313 current_ = c; │ │ │ │ │ -314 } │ │ │ │ │ -315 // go to coarser level │ │ │ │ │ -316 otherWeak_ = otherCurrent_->coarser_; │ │ │ │ │ -317 } │ │ │ │ │ -318 coarsest_=current_; │ │ │ │ │ -319 } │ │ │ │ │ -320 │ │ │ │ │ -321 template │ │ │ │ │ -_3_2_2 std::size_t _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ │ -323 { │ │ │ │ │ -324 return levels_; │ │ │ │ │ -325 } │ │ │ │ │ -326 │ │ │ │ │ -327 template │ │ │ │ │ -_3_2_8 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ -329 { │ │ │ │ │ -330 coarsest_->redistributed_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -(args); │ │ │ │ │ -331 } │ │ │ │ │ -332 │ │ │ │ │ -333 template │ │ │ │ │ -_3_3_4 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_C_o_a_r_s_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ -335 { │ │ │ │ │ -336 if(!coarsest_) { │ │ │ │ │ -337 // we have no levels at all... │ │ │ │ │ -338 assert(!finest_); │ │ │ │ │ -339 // allocate into the shared_ptr │ │ │ │ │ -340 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ -341 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ │ -342 coarsest_->element_ = originalFinest_; │ │ │ │ │ -343 finest_ = coarsest_; │ │ │ │ │ -344 }else{ │ │ │ │ │ -345 auto old_coarsest = coarsest_; │ │ │ │ │ -346 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ │ -347 coarsest_->finer_ = old_coarsest; │ │ │ │ │ -348 coarsest_->element_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ -349 old_coarsest->coarser_ = coarsest_; │ │ │ │ │ -350 } │ │ │ │ │ -351 ++levels_; │ │ │ │ │ -352 } │ │ │ │ │ -353 │ │ │ │ │ -354 │ │ │ │ │ -355 template │ │ │ │ │ -_3_5_6 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_F_i_n_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ -357 { │ │ │ │ │ -358 //TODO: wouldn't it be better to do this in the constructor?' │ │ │ │ │ -359 if(!finest_) { │ │ │ │ │ -360 // we have no levels at all... │ │ │ │ │ -361 assert(!coarsest_); │ │ │ │ │ -362 // allocate into the shared_ptr │ │ │ │ │ -363 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ -364 finest_ = std::allocate_shared(allocator_); │ │ │ │ │ -365 finest_->element = originalFinest_; │ │ │ │ │ -366 coarsest_ = finest_; │ │ │ │ │ -367 }else{ │ │ │ │ │ -368 finest_->finer_ = std::allocate_shared(allocator_); │ │ │ │ │ -369 finest_->finer_->coarser_ = finest_; │ │ │ │ │ -370 finest_ = finest_->finer_; │ │ │ │ │ -371 finest_->element = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ │ -372 } │ │ │ │ │ -373 ++levels_; │ │ │ │ │ -374 } │ │ │ │ │ -375 │ │ │ │ │ -376 template │ │ │ │ │ -_3_7_7 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() │ │ │ │ │ -378 { │ │ │ │ │ -379 return _I_t_e_r_a_t_o_r(finest_); │ │ │ │ │ -380 } │ │ │ │ │ -381 │ │ │ │ │ -382 template │ │ │ │ │ -_3_8_3 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() │ │ │ │ │ -384 { │ │ │ │ │ -385 return _I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ │ -386 } │ │ │ │ │ -387 │ │ │ │ │ -388 template │ │ │ │ │ -_3_8_9 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() const │ │ │ │ │ -390 { │ │ │ │ │ -391 return _C_o_n_s_t_I_t_e_r_a_t_o_r(finest_); │ │ │ │ │ -392 } │ │ │ │ │ -393 │ │ │ │ │ -394 template │ │ │ │ │ -_3_9_5 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() const │ │ │ │ │ -396 { │ │ │ │ │ -397 return _C_o_n_s_t_I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ │ -398 } │ │ │ │ │ -400 } // namespace Amg │ │ │ │ │ -401} // namespace Dune │ │ │ │ │ -402 │ │ │ │ │ -403#endif │ │ │ │ │ -_c_o_n_s_t_r_u_c_t_i_o_n_._h_h │ │ │ │ │ -Helper classes for the construction of classes without empty constructor. │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ -Hierarchy(const Hierarchy &other) │ │ │ │ │ -Copy constructor (deep copy!). │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t │ │ │ │ │ -void addRedistributedOnCoarsest(Arguments &args) │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:328 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ │ -std::size_t levels() const │ │ │ │ │ -Get the number of levels in the hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ │ -ConstIterator coarsest() const │ │ │ │ │ -Get an iterator positioned at the coarsest level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:395 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ │ -void addCoarser(Arguments &args) │ │ │ │ │ -Add an element on a coarser level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_F_i_n_e_r │ │ │ │ │ -void addFiner(Arguments &args) │ │ │ │ │ -Add an element on a finer level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:356 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ -Hierarchy(const std::shared_ptr< MemberType > &first) │ │ │ │ │ -Construct a new hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:270 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ -const void * Arguments │ │ │ │ │ -A type holding all the arguments needed to call the constructor. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ -static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ │ -Iterator coarsest() │ │ │ │ │ -Get an iterator positioned at the coarsest level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:383 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ │ -ConstIterator finest() const │ │ │ │ │ -Get an iterator positioned at the finest level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:389 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ │ -Iterator finest() │ │ │ │ │ -Get an iterator positioned at the finest level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +298 minCoarsenRate_ = rate; │ │ │ │ │ +299 } │ │ │ │ │ +300 │ │ │ │ │ +_3_0_4 double _m_i_n_C_o_a_r_s_e_n_R_a_t_e() const │ │ │ │ │ +305 { │ │ │ │ │ +306 return minCoarsenRate_; │ │ │ │ │ +307 } │ │ │ │ │ +308 │ │ │ │ │ +_3_1_2 _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 │ │ │ │ │ +313 { │ │ │ │ │ +314 return accumulate_; │ │ │ │ │ +315 } │ │ │ │ │ +_3_1_9 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) │ │ │ │ │ +320 { │ │ │ │ │ +321 accumulate_=accu; │ │ │ │ │ +322 } │ │ │ │ │ +323 │ │ │ │ │ +_3_2_4 void _s_e_t_A_c_c_u_m_u_l_a_t_e(bool accu){ │ │ │ │ │ +325 accumulate_=accu ? _s_u_c_c_e_s_s_i_v_e_A_c_c_u : _n_o_A_c_c_u; │ │ │ │ │ +326 } │ │ │ │ │ +_3_3_2 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) │ │ │ │ │ +333 { │ │ │ │ │ +334 dampingFactor_ = d; │ │ │ │ │ +335 } │ │ │ │ │ +336 │ │ │ │ │ +_3_4_2 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 │ │ │ │ │ +343 { │ │ │ │ │ +344 return dampingFactor_; │ │ │ │ │ +345 } │ │ │ │ │ +_3_5_6 _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, │ │ │ │ │ +357 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) │ │ │ │ │ +358 : 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), │ │ │ │ │ +359 dampingFactor_(prolongDamp), accumulate_( _a_c_c_u_m_u_l_a_t_e) │ │ │ │ │ +360 {} │ │ │ │ │ +361 │ │ │ │ │ +362 private: │ │ │ │ │ +366 int maxLevel_; │ │ │ │ │ +370 int coarsenTarget_; │ │ │ │ │ +374 double minCoarsenRate_; │ │ │ │ │ +378 double dampingFactor_; │ │ │ │ │ +383 _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e accumulate_; │ │ │ │ │ +384 }; │ │ │ │ │ +385 │ │ │ │ │ +_3_9_2 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 │ │ │ │ │ +393 { │ │ │ │ │ +394 public: │ │ │ │ │ +_4_0_1 void _s_e_t_D_e_b_u_g_L_e_v_e_l(int level) │ │ │ │ │ +402 { │ │ │ │ │ +403 debugLevel_ = level; │ │ │ │ │ +404 } │ │ │ │ │ +405 │ │ │ │ │ +_4_1_1 int _d_e_b_u_g_L_e_v_e_l() const │ │ │ │ │ +412 { │ │ │ │ │ +413 return debugLevel_; │ │ │ │ │ +414 } │ │ │ │ │ +415 │ │ │ │ │ +_4_2_0 void _s_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s(std::size_t steps) │ │ │ │ │ +421 { │ │ │ │ │ +422 preSmoothSteps_=steps; │ │ │ │ │ +423 } │ │ │ │ │ +_4_2_8 std::size_t _g_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ │ +429 { │ │ │ │ │ +430 return preSmoothSteps_; │ │ │ │ │ +431 } │ │ │ │ │ +432 │ │ │ │ │ +_4_3_7 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) │ │ │ │ │ +438 { │ │ │ │ │ +439 postSmoothSteps_=steps; │ │ │ │ │ +440 } │ │ │ │ │ +_4_4_5 std::size_t _g_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ │ +446 { │ │ │ │ │ +447 return postSmoothSteps_; │ │ │ │ │ +448 } │ │ │ │ │ +449 │ │ │ │ │ +_4_5_3 void _s_e_t_G_a_m_m_a(std::size_t gamma) │ │ │ │ │ +454 { │ │ │ │ │ +455 gamma_=gamma; │ │ │ │ │ +456 } │ │ │ │ │ +_4_6_0 std::size_t _g_e_t_G_a_m_m_a() const │ │ │ │ │ +461 { │ │ │ │ │ +462 return gamma_; │ │ │ │ │ +463 } │ │ │ │ │ +464 │ │ │ │ │ +_4_6_9 void _s_e_t_A_d_d_i_t_i_v_e(bool additive) │ │ │ │ │ +470 { │ │ │ │ │ +471 additive_=additive; │ │ │ │ │ +472 } │ │ │ │ │ +473 │ │ │ │ │ +_4_7_8 bool _g_e_t_A_d_d_i_t_i_v_e() const │ │ │ │ │ +479 { │ │ │ │ │ +480 return additive_; │ │ │ │ │ +481 } │ │ │ │ │ +482 │ │ │ │ │ +_4_9_3 _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, │ │ │ │ │ +494 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) │ │ │ │ │ +495 : _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) │ │ │ │ │ +496 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1), │ │ │ │ │ +497 additive_(false) │ │ │ │ │ +498 {} │ │ │ │ │ +499 private: │ │ │ │ │ +500 int debugLevel_; │ │ │ │ │ +501 std::size_t preSmoothSteps_; │ │ │ │ │ +502 std::size_t postSmoothSteps_; │ │ │ │ │ +503 std::size_t gamma_; │ │ │ │ │ +504 bool additive_; │ │ │ │ │ +505 }; │ │ │ │ │ +506 │ │ │ │ │ +507 } //namespace AMG │ │ │ │ │ +508 │ │ │ │ │ +509} //namespace Dune │ │ │ │ │ +510#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:469 │ │ │ │ │ +_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:332 │ │ │ │ │ +_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:202 │ │ │ │ │ +_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:296 │ │ │ │ │ +_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:304 │ │ │ │ │ +_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:194 │ │ │ │ │ +_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_:_:_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:211 │ │ │ │ │ +_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:286 │ │ │ │ │ +_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 he data should be accumulated on fewer processes on coarser levels. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:319 │ │ │ │ │ +_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:342 │ │ │ │ │ +_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:312 │ │ │ │ │ +_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:220 │ │ │ │ │ +_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:478 │ │ │ │ │ +_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:263 │ │ │ │ │ +_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:401 │ │ │ │ │ +_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:460 │ │ │ │ │ +_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:437 │ │ │ │ │ +_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:428 │ │ │ │ │ +_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:188 │ │ │ │ │ +_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:270 │ │ │ │ │ +_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_:_:_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) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:493 │ │ │ │ │ +_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:278 │ │ │ │ │ +_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:420 │ │ │ │ │ +_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:232 │ │ │ │ │ +_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_:_:_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) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:356 │ │ │ │ │ +_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:453 │ │ │ │ │ +_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:324 │ │ │ │ │ +_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:411 │ │ │ │ │ +_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:445 │ │ │ │ │ +_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:244 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u │ │ │ │ │ +@ noAccu │ │ │ │ │ +No data accumulution. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:238 │ │ │ │ │ +_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:248 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ -A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ │ -T MemberType │ │ │ │ │ -The type of the container we store. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator< Hierarchy< T, A >, T > Iterator │ │ │ │ │ -Type of the mutable iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator< const Hierarchy< T, A >, const T > ConstIterator │ │ │ │ │ -Type of the const iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ -ConstructionTraits< T >::Arguments Arguments │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ -Hierarchy() │ │ │ │ │ -Construct an empty hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ -typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator │ │ │ │ │ -The allocator to use for the list elements. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:76 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator over the levels in the hierarchy. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ │ -typename std::remove_const< T1 >::type > &other) │ │ │ │ │ -Copy constructor. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:136 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ -void addRedistributed(std::shared_ptr< T1 > t) │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:201 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ -T1 & dereference() const │ │ │ │ │ -Dereference the iterator. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:166 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ │ -typename std::remove_const< T1 >::type > &other) const │ │ │ │ │ -Equality check. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_s_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ -bool isRedistributed() const │ │ │ │ │ -Check whether there was a redistribution at the current level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:187 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ │ -const typename std::remove_const< T1 >::type > &other) const │ │ │ │ │ -Equality check. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:159 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -Move to the next coarser level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:172 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ │ -const typename std::remove_const< T1 >::type > &other) │ │ │ │ │ -Copy constructor. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ -void deleteRedistributed() │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:206 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ -void decrement() │ │ │ │ │ -Move to the next fine level. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:178 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ -LevelIterator(std::shared_ptr< Element > element) │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:131 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ │ -T1 & getRedistributed() const │ │ │ │ │ -Get the redistributed container. │ │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:196 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +Parameters needed to check whether a node depends on another. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +Parameters needed for the aggregation process. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +Parameters for the complete coarsening process. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:258 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +All parameters for AMG. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00155.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: indicescoarsener.hh File Reference │ │ │ │ +dune-istl: matrixhierarchy.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,51 +71,79 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +Namespaces | │ │ │ │ +Enumerations | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <dune/common/parallel/indicessyncer.hh>
│ │ │ │ -#include <vector>
│ │ │ │ -#include "renumberer.hh"
│ │ │ │ -#include <dune/istl/owneroverlapcopy.hh>
│ │ │ │ -#include "pinfo.hh"
│ │ │ │ +
#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::Amg::IndicesCoarsener< T, E >
class  Dune::Amg::MatrixHierarchy< M, PI, A >
 The hierarchies build by the coarsening process. More...
 
class  Dune::Amg::ParallelIndicesCoarsener< T, E >
struct  Dune::Amg::MatrixHierarchy< M, PI, A >::MatrixStats< Matrix, true >::calc
 
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...
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 class for building the index set and remote indices on the coarse level.

│ │ │ │ +

Provides a classes representing the hierarchies in AMG.

│ │ │ │
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,42 +1,68 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 | _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 class for building the index set and remote indices on the coarse │ │ │ │ │ -level. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +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 <_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" │ │ │ │ │ +#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_:_:_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_:_:_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_._._. │ │ │ │ │   │ │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _T_,_ _E_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_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_:_:_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_._._. │ │ │ │ │ + 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 class for building the index set and remote indices on the coarse │ │ │ │ │ -level. │ │ │ │ │ +Provides a classes representing the hierarchies in AMG. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00155_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: indicescoarsener.hh Source File │ │ │ │ +dune-istl: matrixhierarchy.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,436 +74,1004 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
indicescoarsener.hh
│ │ │ │ +
matrixhierarchy.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_AMG_MATRIXHIERARCHY_HH
│ │ │ │ +
6#define DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ │
7
│ │ │ │ -
8#include <dune/common/parallel/indicessyncer.hh>
│ │ │ │ -
9#include <vector>
│ │ │ │ -
10#include "renumberer.hh"
│ │ │ │ -
11
│ │ │ │ -
12#if HAVE_MPI
│ │ │ │ - │ │ │ │ -
14#endif
│ │ │ │ -
15
│ │ │ │ -
16#include "pinfo.hh"
│ │ │ │ -
17
│ │ │ │ -
18namespace Dune
│ │ │ │ -
19{
│ │ │ │ -
20 namespace Amg
│ │ │ │ -
21 {
│ │ │ │ -
22
│ │ │ │ -
34 template<typename T, typename E>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
36 {};
│ │ │ │ -
│ │ │ │ -
37
│ │ │ │ -
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;
│ │ │ │ +
8#include <algorithm>
│ │ │ │ +
9#include <tuple>
│ │ │ │ +
10#include "aggregates.hh"
│ │ │ │ +
11#include "graph.hh"
│ │ │ │ +
12#include "galerkin.hh"
│ │ │ │ +
13#include "renumberer.hh"
│ │ │ │ +
14#include "graphcreator.hh"
│ │ │ │ +
15#include "hierarchy.hh"
│ │ │ │ +
16#include <dune/istl/bvector.hh>
│ │ │ │ +
17#include <dune/common/parallel/indexset.hh>
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
27
│ │ │ │ +
28namespace Dune
│ │ │ │ +
29{
│ │ │ │ +
30 namespace Amg
│ │ │ │ +
31 {
│ │ │ │ +
42 enum {
│ │ │ │ +
50 MAX_PROCESSES = 72000
│ │ │ │ +
51 };
│ │ │ │ +
52
│ │ │ │ +
59 template<class M, class PI, class A=std::allocator<M> >
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
61 {
│ │ │ │ +
62 public:
│ │ │ │ +
64 typedef M MatrixOperator;
│ │ │ │ +
65
│ │ │ │ +
67 typedef typename MatrixOperator::matrix_type Matrix;
│ │ │ │ +
68
│ │ │ │ + │ │ │ │
71
│ │ │ │ -
75 typedef Dune::RemoteIndices<ParallelIndexSet> RemoteIndices;
│ │ │ │ -
76
│ │ │ │ -
88 template<typename Graph, typename VM>
│ │ │ │ -
89 static typename Graph::VertexDescriptor
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
91 Graph& fineGraph,
│ │ │ │ -
92 VM& visitedMap,
│ │ │ │ - │ │ │ │ -
94 ParallelInformation& coarseInfo,
│ │ │ │ -
95 typename Graph::VertexDescriptor noAggregates);
│ │ │ │ -
96
│ │ │ │ -
97 private:
│ │ │ │ -
98 template<typename G, typename I>
│ │ │ │ -
99 class ParallelAggregateRenumberer : public AggregateRenumberer<G>
│ │ │ │ -
100 {
│ │ │ │ -
101 typedef typename G::VertexDescriptor Vertex;
│ │ │ │ -
102
│ │ │ │ -
103 typedef I GlobalLookupIndexSet;
│ │ │ │ -
104
│ │ │ │ -
105 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ │ +
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
│ │ │ │ -
107 typedef typename IndexPair::GlobalIndex GlobalIndex;
│ │ │ │ + │ │ │ │
108
│ │ │ │ -
109 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
111 : AggregateRenumberer<G>(aggregates), isPublic_(false), lookup_(lookup),
│ │ │ │ -
112 globalIndex_(std::numeric_limits<GlobalIndex>::max())
│ │ │ │ -
113 {}
│ │ │ │ -
│ │ │ │ -
114
│ │ │ │ -
115
│ │ │ │ -
│ │ │ │ -
116 void operator()(const typename G::ConstEdgeIterator& edge)
│ │ │ │ -
117 {
│ │ │ │ - │ │ │ │ -
119 const IndexPair* pair= lookup_.pair(edge.target());
│ │ │ │ -
120 if(pair!=0) {
│ │ │ │ -
121 globalIndex(pair->global());
│ │ │ │ -
122 attribute(pair->local().attribute());
│ │ │ │ -
123 isPublic(pair->local().isPublic());
│ │ │ │ -
124 }
│ │ │ │ -
125 }
│ │ │ │ -
│ │ │ │ +
114 template<typename O, typename T>
│ │ │ │ +
115 void build(const T& criterion);
│ │ │ │ +
116
│ │ │ │ +
124 template<class F>
│ │ │ │ +
125 void recalculateGalerkin(const F& copyFlags);
│ │ │ │
126
│ │ │ │ -
│ │ │ │ -
127 Vertex operator()([[maybe_unused]] const GlobalIndex& global)
│ │ │ │ -
128 {
│ │ │ │ -
129 Vertex current = this->number_;
│ │ │ │ -
130 this->operator++();
│ │ │ │ -
131 return current;
│ │ │ │ -
132 }
│ │ │ │ -
│ │ │ │ +
131 template<class V, class BA, class TA>
│ │ │ │ +
132 void coarsenVector(Hierarchy<BlockVector<V,BA>, TA>& hierarchy) const;
│ │ │ │
133
│ │ │ │ -
│ │ │ │ -
134 bool isPublic()
│ │ │ │ -
135 {
│ │ │ │ -
136 return isPublic_;
│ │ │ │ -
137 }
│ │ │ │ -
│ │ │ │ -
138
│ │ │ │ -
│ │ │ │ -
139 void isPublic(bool b)
│ │ │ │ -
140 {
│ │ │ │ -
141 isPublic_ = isPublic_ || b;
│ │ │ │ -
142 }
│ │ │ │ -
│ │ │ │ -
143
│ │ │ │ -
│ │ │ │ -
144 void reset()
│ │ │ │ -
145 {
│ │ │ │ -
146 globalIndex_ = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ -
147 isPublic_=false;
│ │ │ │ -
148 }
│ │ │ │ -
│ │ │ │ -
149
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
151 {
│ │ │ │ -
152 attribute_=attribute;
│ │ │ │ -
153 }
│ │ │ │ -
│ │ │ │ +
139 template<class S, class TA>
│ │ │ │ +
140 void coarsenSmoother(Hierarchy<S,TA>& smoothers,
│ │ │ │ +
141 const typename SmootherTraits<S>::Arguments& args) const;
│ │ │ │ +
142
│ │ │ │ +
147 std::size_t levels() const;
│ │ │ │ +
148
│ │ │ │ +
153 std::size_t maxlevels() const;
│ │ │ │
154
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
156 {
│ │ │ │ -
157 return attribute_;
│ │ │ │ -
158 }
│ │ │ │ -
│ │ │ │ -
159
│ │ │ │ -
│ │ │ │ -
160 const GlobalIndex& globalIndex() const
│ │ │ │ -
161 {
│ │ │ │ -
162 return globalIndex_;
│ │ │ │ -
163 }
│ │ │ │ -
│ │ │ │ -
164
│ │ │ │ -
│ │ │ │ -
165 void globalIndex(const GlobalIndex& global)
│ │ │ │ -
166 {
│ │ │ │ -
167 globalIndex_ = global;
│ │ │ │ -
168 }
│ │ │ │ -
│ │ │ │ -
169
│ │ │ │ -
170 private:
│ │ │ │ -
171 bool isPublic_;
│ │ │ │ -
172 Attribute attribute_;
│ │ │ │ -
173 const GlobalLookupIndexSet& lookup_;
│ │ │ │ -
174 GlobalIndex globalIndex_;
│ │ │ │ -
175 };
│ │ │ │ -
176
│ │ │ │ -
177 template<typename Graph, typename VM, typename I>
│ │ │ │ -
178 static void buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ │ -
179 Graph& fineGraph,
│ │ │ │ -
180 VM& visitedMap,
│ │ │ │ - │ │ │ │ -
182 ParallelIndexSet& coarseIndices,
│ │ │ │ -
183 ParallelAggregateRenumberer<Graph,I>& renumberer);
│ │ │ │ -
184
│ │ │ │ -
185 template<typename Graph,typename I>
│ │ │ │ -
186 static void buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ │ - │ │ │ │ -
188 ParallelIndexSet& coarseIndices,
│ │ │ │ -
189 RemoteIndices& coarseRemote,
│ │ │ │ -
190 ParallelAggregateRenumberer<Graph,I>& renumberer);
│ │ │ │ -
191
│ │ │ │ -
192 };
│ │ │ │ -
193
│ │ │ │ -
197 template<typename G, typename L, typename E>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
199 : public ParallelIndicesCoarsener<OwnerOverlapCopyCommunication<G,L>,E>
│ │ │ │ -
200 {};
│ │ │ │ -
│ │ │ │ -
201
│ │ │ │ -
202
│ │ │ │ -
203#endif
│ │ │ │ -
204
│ │ │ │ -
211 template<typename E>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
213 {
│ │ │ │ -
214 public:
│ │ │ │ -
215 template<typename Graph, typename VM>
│ │ │ │ -
216 static typename Graph::VertexDescriptor
│ │ │ │ -
217 coarsen(const SequentialInformation & fineInfo,
│ │ │ │ -
218 Graph& fineGraph,
│ │ │ │ -
219 VM& visitedMap,
│ │ │ │ - │ │ │ │ -
221 SequentialInformation& coarseInfo,
│ │ │ │ -
222 typename Graph::VertexDescriptor noAggregates);
│ │ │ │ -
223 };
│ │ │ │ +
155 bool hasCoarsest() const;
│ │ │ │ +
156
│ │ │ │ +
161 bool isBuilt() const;
│ │ │ │ +
162
│ │ │ │ +
167 const ParallelMatrixHierarchy& matrices() const;
│ │ │ │ +
168
│ │ │ │ + │ │ │ │ +
174
│ │ │ │ +
179 const AggregatesMapList& aggregatesMaps() const;
│ │ │ │ +
180
│ │ │ │ + │ │ │ │ +
187
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
189 {
│ │ │ │ +
190 return prolongDamp_;
│ │ │ │ +
191 }
│ │ │ │
│ │ │ │ +
192
│ │ │ │ +
203 void getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const;
│ │ │ │ +
204
│ │ │ │ +
205 private:
│ │ │ │ +
206 typedef typename ConstructionTraits<MatrixOperator>::Arguments MatrixArgs;
│ │ │ │ +
207 typedef typename ConstructionTraits<ParallelInformation>::Arguments CommunicationArgs;
│ │ │ │ +
209 AggregatesMapList aggregatesMaps_;
│ │ │ │ +
211 RedistributeInfoList redistributes_;
│ │ │ │ +
213 ParallelMatrixHierarchy matrices_;
│ │ │ │ +
215 ParallelInformationHierarchy parallelInformation_;
│ │ │ │ +
216
│ │ │ │ +
218 bool built_;
│ │ │ │ +
219
│ │ │ │ +
221 int maxlevels_;
│ │ │ │ +
222
│ │ │ │ +
223 double prolongDamp_;
│ │ │ │
224
│ │ │ │ -
225#if HAVE_MPI
│ │ │ │ -
226 template<typename T, typename E>
│ │ │ │ -
227 template<typename Graph, typename VM>
│ │ │ │ -
228 inline typename Graph::VertexDescriptor
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
230 Graph& fineGraph,
│ │ │ │ -
231 VM& visitedMap,
│ │ │ │ - │ │ │ │ -
233 ParallelInformation& coarseInfo,
│ │ │ │ -
234 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates)
│ │ │ │ -
235 {
│ │ │ │ -
236 ParallelAggregateRenumberer<Graph,typename ParallelInformation::GlobalLookupIndexSet> renumberer(aggregates, fineInfo.globalLookup());
│ │ │ │ -
237 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates,
│ │ │ │ -
238 coarseInfo.indexSet(), renumberer);
│ │ │ │ -
239 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, coarseInfo.indexSet(),
│ │ │ │ -
240 coarseInfo.remoteIndices(), renumberer);
│ │ │ │ -
241
│ │ │ │ -
242 return renumberer;
│ │ │ │ -
243 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
244
│ │ │ │ -
245 template<typename T, typename E>
│ │ │ │ -
246 template<typename Graph, typename VM, typename I>
│ │ │ │ -
247 void ParallelIndicesCoarsener<T,E>::buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ │ -
248 Graph& fineGraph,
│ │ │ │ -
249 VM& visitedMap,
│ │ │ │ - │ │ │ │ -
251 ParallelIndexSet& coarseIndices,
│ │ │ │ -
252 ParallelAggregateRenumberer<Graph,I>& renumberer)
│ │ │ │ -
253 {
│ │ │ │ -
254 // fineGraph is the local subgraph corresponding to the vertices the process owns.
│ │ │ │ -
255 // i.e. no overlap/copy vertices can be visited traversing the graph
│ │ │ │ -
256 typedef typename Graph::ConstVertexIterator Iterator;
│ │ │ │ -
257 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
│ │ │ │ -
258
│ │ │ │ -
259 Iterator end = fineGraph.end();
│ │ │ │ -
260 const GlobalLookupIndexSet& lookup = pinfo.globalLookup();
│ │ │ │ -
261
│ │ │ │ -
262 coarseIndices.beginResize();
│ │ │ │ -
263
│ │ │ │ -
264 // Setup the coarse index set and renumber the aggregate consecutively
│ │ │ │ -
265 // ascending from zero according to the minimum global index belonging
│ │ │ │ -
266 // to the aggregate
│ │ │ │ -
267 for(Iterator index = fineGraph.begin(); index != end; ++index) {
│ │ │ │ - │ │ │ │ -
269 // Isolated vertices will not be represented on the next level.
│ │ │ │ -
270 // These should only be there if skipIsolated is activiated in
│ │ │ │ -
271 // the coarsening criterion as otherwise they will be aggregated
│ │ │ │ -
272 // and should have real aggregate number in the map right now.
│ │ │ │ -
273 if(!get(visitedMap, *index)) {
│ │ │ │ -
274 // This vertex was not visited by breadthFirstSearch yet.
│ │ │ │ -
275 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ │ -
276 const IndexPair* pair= lookup.pair(*index);
│ │ │ │ +
228 template<class Matrix, bool print>
│ │ │ │ +
229 struct MatrixStats
│ │ │ │ +
230 {
│ │ │ │ +
231
│ │ │ │ +
235 static void stats([[maybe_unused]] const Matrix& matrix)
│ │ │ │ +
236 {}
│ │ │ │ +
237 };
│ │ │ │ +
238
│ │ │ │ +
239 template<class Matrix>
│ │ │ │ +
240 struct MatrixStats<Matrix,true>
│ │ │ │ +
241 {
│ │ │ │ +
│ │ │ │ +
242 struct calc
│ │ │ │ +
243 {
│ │ │ │ +
244 typedef typename Matrix::size_type size_type;
│ │ │ │ +
245 typedef typename Matrix::row_type matrix_row;
│ │ │ │ +
246
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
248 {
│ │ │ │ +
249 min=std::numeric_limits<size_type>::max();
│ │ │ │ +
250 max=0;
│ │ │ │ +
251 sum=0;
│ │ │ │ +
252 }
│ │ │ │ +
│ │ │ │ +
253
│ │ │ │ +
│ │ │ │ +
254 void operator()(const matrix_row& row)
│ │ │ │ +
255 {
│ │ │ │ +
256 min=std::min(min, row.size());
│ │ │ │ +
257 max=std::max(max, row.size());
│ │ │ │ +
258 sum += row.size();
│ │ │ │ +
259 }
│ │ │ │ +
│ │ │ │ +
260
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
264 };
│ │ │ │ +
│ │ │ │ +
268 static void stats(const Matrix& matrix)
│ │ │ │ +
269 {
│ │ │ │ +
270 calc c= for_each(matrix.begin(), matrix.end(), calc());
│ │ │ │ +
271 dinfo<<"Matrix row: min="<<c.min<<" max="<<c.max
│ │ │ │ +
272 <<" average="<<static_cast<double>(c.sum)/matrix.N()
│ │ │ │ +
273 <<std::endl;
│ │ │ │ +
274 }
│ │ │ │ +
275 };
│ │ │ │ +
276 };
│ │ │ │ +
│ │ │ │
277
│ │ │ │ -
278 renumberer.reset(); // reset attribute and global index.
│ │ │ │ -
279 if(pair!=0) {
│ │ │ │ -
280 // vertex is in the index set. Note that not all vertices have
│ │ │ │ -
281 // to be in the index set, just the ones where communication
│ │ │ │ -
282 // will happen.
│ │ │ │ -
283 assert(!ExcludedAttributes::contains(pair->local().attribute()));
│ │ │ │ -
284 renumberer.attribute(pair->local().attribute());
│ │ │ │ -
285 renumberer.isPublic(pair->local().isPublic());
│ │ │ │ -
286 renumberer.globalIndex(pair->global());
│ │ │ │ -
287 }
│ │ │ │ -
288
│ │ │ │ -
289 // Reconstruct aggregate and mark vertices as visited
│ │ │ │ -
290 aggregates.template breadthFirstSearch<false>(*index, aggregates[*index],
│ │ │ │ -
291 fineGraph, renumberer, visitedMap);
│ │ │ │ -
292
│ │ │ │ -
293 if(renumberer.globalIndex()!=std::numeric_limits<GlobalIndex>::max()) {
│ │ │ │ -
294 // vertex is in the index set.
│ │ │ │ -
295 //std::cout <<" Adding global="<< renumberer.globalIndex()<<" local="<<static_cast<std::size_t>(renumberer)<<std::endl;
│ │ │ │ -
296 coarseIndices.add(renumberer.globalIndex(),
│ │ │ │ -
297 LocalIndex(renumberer, renumberer.attribute(),
│ │ │ │ -
298 renumberer.isPublic()));
│ │ │ │ -
299 }
│ │ │ │ -
300
│ │ │ │ -
301 aggregates[*index] = renumberer;
│ │ │ │ -
302 ++renumberer;
│ │ │ │ -
303 }
│ │ │ │ -
304 }
│ │ │ │ +
281 template<class T>
│ │ │ │ +
│ │ │ │ +
282 class CoarsenCriterion : public T
│ │ │ │ +
283 {
│ │ │ │ +
284 public:
│ │ │ │ + │ │ │ │ +
290
│ │ │ │ +
│ │ │ │ +
301 CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ │ +
302 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu)
│ │ │ │ +
303 : AggregationCriterion(Dune::Amg::Parameters(maxLevel, coarsenTarget, minCoarsenRate, prolongDamp, accumulate))
│ │ │ │ +
304 {}
│ │ │ │ +
│ │ │ │
305
│ │ │ │ -
306 coarseIndices.endResize();
│ │ │ │ -
307
│ │ │ │ -
308 assert(static_cast<std::size_t>(renumberer) >= coarseIndices.size());
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
307 : AggregationCriterion(parms)
│ │ │ │ +
308 {}
│ │ │ │ +
│ │ │ │
309
│ │ │ │ -
310 // Reset the visited flags
│ │ │ │ -
311 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex)
│ │ │ │ -
312 put(visitedMap, *vertex, false);
│ │ │ │ -
313 }
│ │ │ │ -
314
│ │ │ │ -
315 template<typename T, typename E>
│ │ │ │ -
316 template<typename Graph, typename I>
│ │ │ │ -
317 void ParallelIndicesCoarsener<T,E>::buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ │ -
318 const AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ │ -
319 ParallelIndexSet& coarseIndices,
│ │ │ │ -
320 RemoteIndices& coarseRemote,
│ │ │ │ -
321 ParallelAggregateRenumberer<Graph,I>& renumberer)
│ │ │ │ -
322 {
│ │ │ │ -
323 std::vector<char> attributes(static_cast<std::size_t>(renumberer));
│ │ │ │ +
310 };
│ │ │ │ +
│ │ │ │ +
311
│ │ │ │ +
312 template<typename M, typename C1>
│ │ │ │ +
│ │ │ │ +
313 bool repartitionAndDistributeMatrix([[maybe_unused]] const M& origMatrix,
│ │ │ │ +
314 [[maybe_unused]] std::shared_ptr<M> newMatrix,
│ │ │ │ +
315 [[maybe_unused]] SequentialInformation& origComm,
│ │ │ │ +
316 [[maybe_unused]] std::shared_ptr<SequentialInformation>& newComm,
│ │ │ │ + │ │ │ │ +
318 [[maybe_unused]] int nparts,
│ │ │ │ +
319 [[maybe_unused]] C1& criterion)
│ │ │ │ +
320 {
│ │ │ │ +
321 DUNE_THROW(NotImplemented, "Redistribution does not make sense in sequential code!");
│ │ │ │ +
322 }
│ │ │ │ +
│ │ │ │ +
323
│ │ │ │
324
│ │ │ │ -
325 GlobalLookupIndexSet<ParallelIndexSet> coarseLookup(coarseIndices, static_cast<std::size_t>(renumberer));
│ │ │ │ -
326
│ │ │ │ -
327 typedef typename RemoteIndices::const_iterator Iterator;
│ │ │ │ -
328 Iterator end = fineRemote.end();
│ │ │ │ -
329
│ │ │ │ -
330 for(Iterator neighbour = fineRemote.begin();
│ │ │ │ -
331 neighbour != end; ++neighbour) {
│ │ │ │ -
332 int process = neighbour->first;
│ │ │ │ -
333
│ │ │ │ -
334 assert(neighbour->second.first==neighbour->second.second);
│ │ │ │ -
335
│ │ │ │ -
336 // Mark all as not known
│ │ │ │ -
337 typedef typename std::vector<char>::iterator CIterator;
│ │ │ │ -
338
│ │ │ │ -
339 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter)
│ │ │ │ -
340 *iter = std::numeric_limits<char>::max();
│ │ │ │ -
341
│ │ │ │ -
342 auto riEnd = neighbour->second.second->end();
│ │ │ │ -
343
│ │ │ │ -
344 for(auto index = neighbour->second.second->begin();
│ │ │ │ -
345 index != riEnd; ++index) {
│ │ │ │ -
346 if(!E::contains(index->localIndexPair().local().attribute()) &&
│ │ │ │ -
347 aggregates[index->localIndexPair().local()] !=
│ │ │ │ - │ │ │ │ -
349 {
│ │ │ │ -
350 assert(aggregates[index->localIndexPair().local()]<attributes.size());
│ │ │ │ -
351 if (attributes[aggregates[index->localIndexPair().local()]] != 3)
│ │ │ │ -
352 attributes[aggregates[index->localIndexPair().local()]] = index->attribute();
│ │ │ │ -
353 }
│ │ │ │ -
354 }
│ │ │ │ -
355
│ │ │ │ -
356 // Build remote index list
│ │ │ │ -
357 typedef RemoteIndexListModifier<ParallelIndexSet,typename RemoteIndices::Allocator,false> Modifier;
│ │ │ │ -
358 typedef typename RemoteIndices::RemoteIndex RemoteIndex;
│ │ │ │ -
359 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ │ -
360
│ │ │ │ -
361 Modifier coarseList = coarseRemote.template getModifier<false,true>(process);
│ │ │ │ -
362
│ │ │ │ -
363 IndexIterator iend = coarseIndices.end();
│ │ │ │ -
364 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index)
│ │ │ │ -
365 if(attributes[index->local()] != std::numeric_limits<char>::max()) {
│ │ │ │ -
366 // remote index is present
│ │ │ │ -
367 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), &(*index)));
│ │ │ │ -
368 }
│ │ │ │ -
369 //std::cout<<coarseRemote<<std::endl;
│ │ │ │ -
370 }
│ │ │ │ -
371
│ │ │ │ -
372 // The number of neighbours should not change!
│ │ │ │ -
373 assert(coarseRemote.neighbours()==fineRemote.neighbours());
│ │ │ │ -
374
│ │ │ │ -
375 // snyc the index set and the remote indices to recompute missing
│ │ │ │ -
376 // indices
│ │ │ │ -
377 IndicesSyncer<ParallelIndexSet> syncer(coarseIndices, coarseRemote);
│ │ │ │ -
378 syncer.sync(renumberer);
│ │ │ │ -
379
│ │ │ │ -
380 }
│ │ │ │ +
325 template<typename M, typename C, typename C1>
│ │ │ │ +
│ │ │ │ +
326 bool repartitionAndDistributeMatrix(const M& origMatrix,
│ │ │ │ +
327 std::shared_ptr<M> newMatrix,
│ │ │ │ +
328 C& origComm,
│ │ │ │ +
329 std::shared_ptr<C>& newComm,
│ │ │ │ + │ │ │ │ +
331 int nparts, C1& criterion)
│ │ │ │ +
332 {
│ │ │ │ +
333 Timer time;
│ │ │ │ +
334#ifdef AMG_REPART_ON_COMM_GRAPH
│ │ │ │ +
335 // Done not repartition the matrix graph, but a graph of the communication scheme.
│ │ │ │ +
336 bool existentOnRedist=Dune::commGraphRepartition(origMatrix, origComm, nparts, newComm,
│ │ │ │ +
337 ri.getInterface(),
│ │ │ │ +
338 criterion.debugLevel()>1);
│ │ │ │ +
339
│ │ │ │ +
340#else
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
345 IdentityMap,
│ │ │ │ +
346 IdentityMap> PropertiesGraph;
│ │ │ │ +
347 MatrixGraph graph(origMatrix);
│ │ │ │ +
348 PropertiesGraph pgraph(graph);
│ │ │ │ +
349 buildDependency(pgraph, origMatrix, criterion, false);
│ │ │ │ +
350
│ │ │ │ +
351#ifdef DEBUG_REPART
│ │ │ │ +
352 if(origComm.communicator().rank()==0)
│ │ │ │ +
353 std::cout<<"Original matrix"<<std::endl;
│ │ │ │ +
354 origComm.communicator().barrier();
│ │ │ │ +
355 printGlobalSparseMatrix(origMatrix, origComm, std::cout);
│ │ │ │ +
356#endif
│ │ │ │ +
357 bool existentOnRedist=Dune::graphRepartition(pgraph, origComm, nparts,
│ │ │ │ +
358 newComm, ri.getInterface(),
│ │ │ │ +
359 criterion.debugLevel()>1);
│ │ │ │ +
360#endif // if else AMG_REPART
│ │ │ │ +
361
│ │ │ │ +
362 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ │ +
363 std::cout<<"Repartitioning took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
364
│ │ │ │ +
365 ri.setSetup();
│ │ │ │ +
366
│ │ │ │ +
367#ifdef DEBUG_REPART
│ │ │ │ +
368 ri.checkInterface(origComm.indexSet(), newComm->indexSet(), origComm.communicator());
│ │ │ │ +
369#endif
│ │ │ │ +
370
│ │ │ │ +
371 redistributeMatrix(const_cast<M&>(origMatrix), *newMatrix, origComm, *newComm, ri);
│ │ │ │ +
372
│ │ │ │ +
373#ifdef DEBUG_REPART
│ │ │ │ +
374 if(origComm.communicator().rank()==0)
│ │ │ │ +
375 std::cout<<"Original matrix"<<std::endl;
│ │ │ │ +
376 origComm.communicator().barrier();
│ │ │ │ +
377 if(newComm->communicator().size()>0)
│ │ │ │ +
378 printGlobalSparseMatrix(*newMatrix, *newComm, std::cout);
│ │ │ │ +
379 origComm.communicator().barrier();
│ │ │ │ +
380#endif
│ │ │ │
381
│ │ │ │ -
382#endif
│ │ │ │ -
383
│ │ │ │ -
384 template<typename E>
│ │ │ │ -
385 template<typename Graph, typename VM>
│ │ │ │ -
386 typename Graph::VertexDescriptor
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
388 [[maybe_unused]] const SequentialInformation& fineInfo,
│ │ │ │ -
389 [[maybe_unused]] Graph& fineGraph,
│ │ │ │ -
390 [[maybe_unused]] VM& visitedMap,
│ │ │ │ -
391 [[maybe_unused]] AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ │ -
392 [[maybe_unused]] SequentialInformation& coarseInfo,
│ │ │ │ -
393 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates)
│ │ │ │ -
394 {
│ │ │ │ -
395 return noAggregates;
│ │ │ │ +
382 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ │ +
383 std::cout<<"Redistributing matrix took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
384 return existentOnRedist;
│ │ │ │ +
385
│ │ │ │ +
386 }
│ │ │ │ +
│ │ │ │ +
387
│ │ │ │ +
388 template<class M, class IS, class A>
│ │ │ │ +
│ │ │ │ +
389 MatrixHierarchy<M,IS,A>::MatrixHierarchy(std::shared_ptr<MatrixOperator> fineMatrix,
│ │ │ │ +
390 std::shared_ptr<ParallelInformation> pinfo)
│ │ │ │ +
391 : matrices_(fineMatrix),
│ │ │ │ +
392 parallelInformation_(pinfo)
│ │ │ │ +
393 {
│ │ │ │ +
394 if (SolverCategory::category(*fineMatrix) != SolverCategory::category(*pinfo))
│ │ │ │ +
395 DUNE_THROW(ISTLError, "MatrixOperator and ParallelInformation must belong to the same category!");
│ │ │ │
396 }
│ │ │ │
│ │ │ │
397
│ │ │ │ -
398 } //namespace Amg
│ │ │ │ -
399} // namespace Dune
│ │ │ │ -
400#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:116
│ │ │ │ -
void isPublic(bool b)
Definition indicescoarsener.hh:139
│ │ │ │ -
ParallelInformation::ParallelIndexSet ParallelIndexSet
Definition indicescoarsener.hh:55
│ │ │ │ - │ │ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition indicescoarsener.hh:65
│ │ │ │ -
T ParallelInformation
The type of the parallel information.
Definition indicescoarsener.hh:53
│ │ │ │ -
Attribute attribute()
Definition indicescoarsener.hh:155
│ │ │ │ -
Vertex operator()(const GlobalIndex &global)
Definition indicescoarsener.hh:127
│ │ │ │ -
static Graph::VertexDescriptor coarsen(ParallelInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates)
Build the coarse index set after the aggregatio.
Definition indicescoarsener.hh:229
│ │ │ │ +
398 template<class M, class IS, class A>
│ │ │ │ +
399 template<typename O, typename T>
│ │ │ │ +
│ │ │ │ +
400 void MatrixHierarchy<M,IS,A>::build(const T& criterion)
│ │ │ │ +
401 {
│ │ │ │ +
402 prolongDamp_ = criterion.getProlongationDampingFactor();
│ │ │ │ +
403 typedef O OverlapFlags;
│ │ │ │ +
404 typedef typename ParallelMatrixHierarchy::Iterator MatIterator;
│ │ │ │ +
405 typedef typename ParallelInformationHierarchy::Iterator PInfoIterator;
│ │ │ │ +
406
│ │ │ │ +
407 static const int noints=(Dune::Amg::MAX_PROCESSES/4096>0) ? (Dune::Amg::MAX_PROCESSES/4096) : 1;
│ │ │ │ +
408
│ │ │ │ +
409 typedef bigunsignedint<sizeof(int)*8*noints> BIGINT;
│ │ │ │ + │ │ │ │ +
411 MatIterator mlevel = matrices_.finest();
│ │ │ │ +
412 MatrixStats<typename M::matrix_type,MINIMAL_DEBUG_LEVEL<=INFO_DEBUG_LEVEL>::stats(mlevel->getmat());
│ │ │ │ +
413
│ │ │ │ +
414 PInfoIterator infoLevel = parallelInformation_.finest();
│ │ │ │ +
415 BIGINT finenonzeros=countNonZeros(mlevel->getmat());
│ │ │ │ +
416 finenonzeros = infoLevel->communicator().sum(finenonzeros);
│ │ │ │ +
417 BIGINT allnonzeros = finenonzeros;
│ │ │ │ +
418
│ │ │ │ +
419
│ │ │ │ +
420 int level = 0;
│ │ │ │ +
421 int rank = 0;
│ │ │ │ +
422
│ │ │ │ +
423 BIGINT unknowns = mlevel->getmat().N();
│ │ │ │ +
424
│ │ │ │ +
425 unknowns = infoLevel->communicator().sum(unknowns);
│ │ │ │ +
426 double dunknowns=unknowns.todouble();
│ │ │ │ +
427 infoLevel->buildGlobalLookup(mlevel->getmat().N());
│ │ │ │ +
428 redistributes_.push_back(RedistributeInfoType());
│ │ │ │ +
429
│ │ │ │ +
430 for(; level < criterion.maxLevel(); ++level, ++mlevel) {
│ │ │ │ +
431 assert(matrices_.levels()==redistributes_.size());
│ │ │ │ +
432 rank = infoLevel->communicator().rank();
│ │ │ │ +
433 if(rank==0 && criterion.debugLevel()>1)
│ │ │ │ +
434 std::cout<<"Level "<<level<<" has "<<dunknowns<<" unknowns, "<<dunknowns/infoLevel->communicator().size()
│ │ │ │ +
435 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ │ +
436
│ │ │ │ +
437 MatrixOperator* matrix=&(*mlevel);
│ │ │ │ +
438 ParallelInformation* info =&(*infoLevel);
│ │ │ │ +
439
│ │ │ │ +
440 if((
│ │ │ │ +
441#if HAVE_PARMETIS
│ │ │ │ +
442 criterion.accumulate()==successiveAccu
│ │ │ │ +
443#else
│ │ │ │ +
444 false
│ │ │ │ +
445#endif
│ │ │ │ +
446 || (criterion.accumulate()==atOnceAccu
│ │ │ │ +
447 && dunknowns < 30*infoLevel->communicator().size()))
│ │ │ │ +
448 && infoLevel->communicator().size()>1 &&
│ │ │ │ +
449 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget())
│ │ │ │ +
450 {
│ │ │ │ +
451 // accumulate to fewer processors
│ │ │ │ +
452 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ │ +
453 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ │ +
454 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/(criterion.minAggregateSize()
│ │ │ │ +
455 *criterion.coarsenTarget()));
│ │ │ │ +
456 if( nodomains<=criterion.minAggregateSize()/2 ||
│ │ │ │ +
457 dunknowns <= criterion.coarsenTarget() )
│ │ │ │ +
458 nodomains=1;
│ │ │ │ +
459
│ │ │ │ +
460 bool existentOnNextLevel =
│ │ │ │ +
461 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ │ +
462 redistComm, redistributes_.back(), nodomains,
│ │ │ │ +
463 criterion);
│ │ │ │ +
464 BIGINT unknownsRedist = redistMat->N();
│ │ │ │ +
465 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ │ +
466 dunknowns= unknownsRedist.todouble();
│ │ │ │ +
467 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ │ +
468 std::cout<<"Level "<<level<<" (redistributed) has "<<dunknowns<<" unknowns, "<<dunknowns/redistComm->communicator().size()
│ │ │ │ +
469 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ │ +
470 MatrixArgs args(redistMat, *redistComm);
│ │ │ │ +
471 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ │ +
472 assert(mlevel.isRedistributed());
│ │ │ │ +
473 infoLevel.addRedistributed(redistComm);
│ │ │ │ +
474 infoLevel->freeGlobalLookup();
│ │ │ │ +
475
│ │ │ │ +
476 if(!existentOnNextLevel)
│ │ │ │ +
477 // We do not hold any data on the redistributed partitioning
│ │ │ │ +
478 break;
│ │ │ │ +
479
│ │ │ │ +
480 // Work on the redistributed Matrix from now on
│ │ │ │ +
481 matrix = &(mlevel.getRedistributed());
│ │ │ │ +
482 info = &(infoLevel.getRedistributed());
│ │ │ │ +
483 info->buildGlobalLookup(matrix->getmat().N());
│ │ │ │ +
484 }
│ │ │ │ +
485
│ │ │ │ +
486 rank = info->communicator().rank();
│ │ │ │ +
487 if(dunknowns <= criterion.coarsenTarget())
│ │ │ │ +
488 // No further coarsening needed
│ │ │ │ +
489 break;
│ │ │ │ +
490
│ │ │ │ + │ │ │ │ +
492 typedef typename GraphCreator::PropertiesGraph PropertiesGraph;
│ │ │ │ +
493 typedef typename GraphCreator::GraphTuple GraphTuple;
│ │ │ │ +
494
│ │ │ │ +
495 typedef typename PropertiesGraph::VertexDescriptor Vertex;
│ │ │ │ +
496
│ │ │ │ +
497 std::vector<bool> excluded(matrix->getmat().N(), false);
│ │ │ │ +
498
│ │ │ │ +
499 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, OverlapFlags());
│ │ │ │ +
500
│ │ │ │ +
501 AggregatesMap* aggregatesMap=new AggregatesMap(std::get<1>(graphs)->maxVertex()+1);
│ │ │ │ +
502
│ │ │ │ +
503 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ │ +
504
│ │ │ │ +
505 Timer watch;
│ │ │ │ +
506 watch.reset();
│ │ │ │ +
507 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] =
│ │ │ │ +
508 aggregatesMap->buildAggregates(matrix->getmat(), *(std::get<1>(graphs)), criterion, level==0);
│ │ │ │ +
509
│ │ │ │ +
510 if(rank==0 && criterion.debugLevel()>2)
│ │ │ │ +
511 std::cout<<" Have built "<<noAggregates<<" aggregates totally ("<<isoAggregates<<" isolated aggregates, "<<
│ │ │ │ +
512 oneAggregates<<" aggregates of one vertex, and skipped "<<
│ │ │ │ +
513 skippedAggregates<<" aggregates)."<<std::endl;
│ │ │ │ +
514#ifdef TEST_AGGLO
│ │ │ │ +
515 {
│ │ │ │ +
516 // calculate size of local matrix in the distributed direction
│ │ │ │ +
517 int start, end, overlapStart, overlapEnd;
│ │ │ │ +
518 int procs=info->communicator().rank();
│ │ │ │ +
519 int n = UNKNOWNS/procs; // number of unknowns per process
│ │ │ │ +
520 int bigger = UNKNOWNS%procs; // number of process with n+1 unknows
│ │ │ │ +
521
│ │ │ │ +
522 // Compute owner region
│ │ │ │ +
523 if(rank<bigger) {
│ │ │ │ +
524 start = rank*(n+1);
│ │ │ │ +
525 end = (rank+1)*(n+1);
│ │ │ │ +
526 }else{
│ │ │ │ +
527 start = bigger + rank * n;
│ │ │ │ +
528 end = bigger + (rank + 1) * n;
│ │ │ │ +
529 }
│ │ │ │ +
530
│ │ │ │ +
531 // Compute overlap region
│ │ │ │ +
532 if(start>0)
│ │ │ │ +
533 overlapStart = start - 1;
│ │ │ │ +
534 else
│ │ │ │ +
535 overlapStart = start;
│ │ │ │ +
536
│ │ │ │ +
537 if(end<UNKNOWNS)
│ │ │ │ +
538 overlapEnd = end + 1;
│ │ │ │ +
539 else
│ │ │ │ +
540 overlapEnd = end;
│ │ │ │ +
541
│ │ │ │ +
542 assert((UNKNOWNS)*(overlapEnd-overlapStart)==aggregatesMap->noVertices());
│ │ │ │ +
543 for(int j=0; j< UNKNOWNS; ++j)
│ │ │ │ +
544 for(int i=0; i < UNKNOWNS; ++i)
│ │ │ │ +
545 {
│ │ │ │ +
546 if(i>=overlapStart && i<overlapEnd)
│ │ │ │ +
547 {
│ │ │ │ +
548 int no = (j/2)*((UNKNOWNS)/2)+i/2;
│ │ │ │ +
549 (*aggregatesMap)[j*(overlapEnd-overlapStart)+i-overlapStart]=no;
│ │ │ │ +
550 }
│ │ │ │ +
551 }
│ │ │ │ +
552 }
│ │ │ │ +
553#endif
│ │ │ │ +
554 if(criterion.debugLevel()>1 && info->communicator().rank()==0)
│ │ │ │ +
555 std::cout<<"aggregating finished."<<std::endl;
│ │ │ │ +
556
│ │ │ │ +
557 BIGINT gnoAggregates=noAggregates;
│ │ │ │ +
558 gnoAggregates = info->communicator().sum(gnoAggregates);
│ │ │ │ +
559 double dgnoAggregates = gnoAggregates.todouble();
│ │ │ │ +
560#ifdef TEST_AGGLO
│ │ │ │ +
561 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2);
│ │ │ │ +
562#endif
│ │ │ │ +
563
│ │ │ │ +
564 if(criterion.debugLevel()>2 && rank==0)
│ │ │ │ +
565 std::cout << "Building "<<dgnoAggregates<<" aggregates took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
566
│ │ │ │ +
567 if(dgnoAggregates==0 || dunknowns/dgnoAggregates<criterion.minCoarsenRate())
│ │ │ │ +
568 {
│ │ │ │ +
569 if(rank==0)
│ │ │ │ +
570 {
│ │ │ │ +
571 if(dgnoAggregates>0)
│ │ │ │ +
572 std::cerr << "Stopped coarsening because of rate breakdown "<<dunknowns<<"/"<<dgnoAggregates
│ │ │ │ +
573 <<"="<<dunknowns/dgnoAggregates<<"<"
│ │ │ │ +
574 <<criterion.minCoarsenRate()<<std::endl;
│ │ │ │ +
575 else
│ │ │ │ +
576 std::cerr<< "Could not build any aggregates. Probably no connected nodes."<<std::endl;
│ │ │ │ +
577 }
│ │ │ │ +
578 aggregatesMap->free();
│ │ │ │ +
579 delete aggregatesMap;
│ │ │ │ +
580 aggregatesMaps_.pop_back();
│ │ │ │ +
581
│ │ │ │ +
582 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator().size()>1) {
│ │ │ │ +
583 // coarse level matrix was already redistributed, but to more than 1 process
│ │ │ │ +
584 // Therefore need to delete the redistribution. Further down it will
│ │ │ │ +
585 // then be redistributed to 1 process
│ │ │ │ +
586 delete &(mlevel.getRedistributed().getmat());
│ │ │ │ +
587 mlevel.deleteRedistributed();
│ │ │ │ +
588 delete &(infoLevel.getRedistributed());
│ │ │ │ +
589 infoLevel.deleteRedistributed();
│ │ │ │ +
590 redistributes_.back().resetSetup();
│ │ │ │ +
591 }
│ │ │ │ +
592
│ │ │ │ +
593 break;
│ │ │ │ +
594 }
│ │ │ │ +
595 unknowns = noAggregates;
│ │ │ │ +
596 dunknowns = dgnoAggregates;
│ │ │ │ +
597
│ │ │ │ +
598 CommunicationArgs commargs(info->communicator(),info->category());
│ │ │ │ +
599 parallelInformation_.addCoarser(commargs);
│ │ │ │ +
600
│ │ │ │ +
601 ++infoLevel; // parallel information on coarse level
│ │ │ │ +
602
│ │ │ │ +
603 typename PropertyMapTypeSelector<VertexVisitedTag,PropertiesGraph>::Type visitedMap =
│ │ │ │ +
604 get(VertexVisitedTag(), *(std::get<1>(graphs)));
│ │ │ │ +
605
│ │ │ │ +
606 watch.reset();
│ │ │ │ + │ │ │ │ +
608 ::coarsen(*info,
│ │ │ │ +
609 *(std::get<1>(graphs)),
│ │ │ │ +
610 visitedMap,
│ │ │ │ +
611 *aggregatesMap,
│ │ │ │ +
612 *infoLevel,
│ │ │ │ +
613 noAggregates);
│ │ │ │ +
614 GraphCreator::free(graphs);
│ │ │ │ +
615
│ │ │ │ +
616 if(criterion.debugLevel()>2) {
│ │ │ │ +
617 if(rank==0)
│ │ │ │ +
618 std::cout<<"Coarsening of index sets took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
619 }
│ │ │ │ +
620
│ │ │ │ +
621 watch.reset();
│ │ │ │ +
622
│ │ │ │ +
623 infoLevel->buildGlobalLookup(aggregates);
│ │ │ │ + │ │ │ │ +
625 *info,
│ │ │ │ +
626 infoLevel->globalLookup());
│ │ │ │ +
627
│ │ │ │ +
628
│ │ │ │ +
629 if(criterion.debugLevel()>2) {
│ │ │ │ +
630 if(rank==0)
│ │ │ │ +
631 std::cout<<"Communicating global aggregate numbers took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
632 }
│ │ │ │ +
633
│ │ │ │ +
634 watch.reset();
│ │ │ │ +
635 std::vector<bool>& visited=excluded;
│ │ │ │ +
636
│ │ │ │ +
637 typedef std::vector<bool>::iterator Iterator;
│ │ │ │ +
638 typedef IteratorPropertyMap<Iterator, IdentityMap> VisitedMap2;
│ │ │ │ +
639 Iterator end = visited.end();
│ │ │ │ +
640 for(Iterator iter= visited.begin(); iter != end; ++iter)
│ │ │ │ +
641 *iter=false;
│ │ │ │ +
642
│ │ │ │ +
643 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap());
│ │ │ │ +
644
│ │ │ │ +
645 std::shared_ptr<typename MatrixOperator::matrix_type>
│ │ │ │ +
646 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2,
│ │ │ │ +
647 *info,
│ │ │ │ +
648 *aggregatesMap,
│ │ │ │ +
649 aggregates,
│ │ │ │ +
650 OverlapFlags()));
│ │ │ │ +
651 dverb<<"Building of sparsity pattern took "<<watch.elapsed()<<std::endl;
│ │ │ │ +
652 watch.reset();
│ │ │ │ +
653 info->freeGlobalLookup();
│ │ │ │ +
654
│ │ │ │ +
655 delete std::get<0>(graphs);
│ │ │ │ +
656 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, *infoLevel, OverlapFlags());
│ │ │ │ +
657
│ │ │ │ +
658 if(criterion.debugLevel()>2) {
│ │ │ │ +
659 if(rank==0)
│ │ │ │ +
660 std::cout<<"Calculation entries of Galerkin product took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
661 }
│ │ │ │ +
662
│ │ │ │ +
663 BIGINT nonzeros = countNonZeros(*coarseMatrix);
│ │ │ │ +
664 allnonzeros = allnonzeros + infoLevel->communicator().sum(nonzeros);
│ │ │ │ +
665 MatrixArgs args(coarseMatrix, *infoLevel);
│ │ │ │ +
666
│ │ │ │ +
667 matrices_.addCoarser(args);
│ │ │ │ +
668 redistributes_.push_back(RedistributeInfoType());
│ │ │ │ +
669 } // end level loop
│ │ │ │ +
670
│ │ │ │ +
671
│ │ │ │ +
672 infoLevel->freeGlobalLookup();
│ │ │ │ +
673
│ │ │ │ +
674 built_=true;
│ │ │ │ +
675 AggregatesMap* aggregatesMap=new AggregatesMap(0);
│ │ │ │ +
676 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ │ +
677
│ │ │ │ +
678 if(criterion.debugLevel()>0) {
│ │ │ │ +
679 if(level==criterion.maxLevel()) {
│ │ │ │ +
680 BIGINT unknownsLevel = mlevel->getmat().N();
│ │ │ │ +
681 unknownsLevel = infoLevel->communicator().sum(unknownsLevel);
│ │ │ │ +
682 double dunknownsLevel = unknownsLevel.todouble();
│ │ │ │ +
683 if(rank==0 && criterion.debugLevel()>1) {
│ │ │ │ +
684 std::cout<<"Level "<<level<<" has "<<dunknownsLevel<<" unknowns, "<<dunknownsLevel/infoLevel->communicator().size()
│ │ │ │ +
685 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ │ +
686 }
│ │ │ │ +
687 }
│ │ │ │ +
688 }
│ │ │ │ +
689
│ │ │ │ +
690 if(criterion.accumulate() && !redistributes_.back().isSetup() &&
│ │ │ │ +
691 infoLevel->communicator().size()>1) {
│ │ │ │ +
692#if HAVE_MPI && !HAVE_PARMETIS
│ │ │ │ +
693 if(criterion.accumulate()==successiveAccu &&
│ │ │ │ +
694 infoLevel->communicator().rank()==0)
│ │ │ │ +
695 std::cerr<<"Successive accumulation of data on coarse levels only works with ParMETIS installed."
│ │ │ │ +
696 <<" Fell back to accumulation to one domain on coarsest level"<<std::endl;
│ │ │ │ +
697#endif
│ │ │ │ +
698
│ │ │ │ +
699 // accumulate to fewer processors
│ │ │ │ +
700 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ │ +
701 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ │ +
702 int nodomains = 1;
│ │ │ │ +
703
│ │ │ │ +
704 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ │ +
705 redistComm, redistributes_.back(), nodomains,criterion);
│ │ │ │ +
706 MatrixArgs args(redistMat, *redistComm);
│ │ │ │ +
707 BIGINT unknownsRedist = redistMat->N();
│ │ │ │ +
708 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ │ +
709
│ │ │ │ +
710 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) {
│ │ │ │ +
711 double dunknownsRedist = unknownsRedist.todouble();
│ │ │ │ +
712 std::cout<<"Level "<<level<<" redistributed has "<<dunknownsRedist<<" unknowns, "<<dunknownsRedist/redistComm->communicator().size()
│ │ │ │ +
713 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ │ +
714 }
│ │ │ │ +
715 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ │ +
716 infoLevel.addRedistributed(redistComm);
│ │ │ │ +
717 infoLevel->freeGlobalLookup();
│ │ │ │ +
718 }
│ │ │ │ +
719
│ │ │ │ +
720 int levels = matrices_.levels();
│ │ │ │ +
721 maxlevels_ = parallelInformation_.finest()->communicator().max(levels);
│ │ │ │ +
722 assert(matrices_.levels()==redistributes_.size());
│ │ │ │ +
723 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1)
│ │ │ │ +
724 std::cout<<"operator complexity: "<<allnonzeros.todouble()/finenonzeros.todouble()<<std::endl;
│ │ │ │ +
725
│ │ │ │ +
726 }
│ │ │ │ +
│ │ │ │ +
727
│ │ │ │ +
728 template<class M, class IS, class A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
731 {
│ │ │ │ +
732 return matrices_;
│ │ │ │ +
733 }
│ │ │ │ +
│ │ │ │ +
734
│ │ │ │ +
735 template<class M, class IS, class A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
738 {
│ │ │ │ +
739 return parallelInformation_;
│ │ │ │ +
740 }
│ │ │ │ +
│ │ │ │ +
741
│ │ │ │ +
742 template<class M, class IS, class A>
│ │ │ │ +
│ │ │ │ +
743 void MatrixHierarchy<M,IS,A>::getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const
│ │ │ │ +
744 {
│ │ │ │ +
745 int levels=aggregatesMaps().size();
│ │ │ │ +
746 int maxlevels=parallelInformation_.finest()->communicator().max(levels);
│ │ │ │ +
747 std::size_t size=(*(aggregatesMaps().begin()))->noVertices();
│ │ │ │ +
748 // We need an auxiliary vector for the consecutive prolongation.
│ │ │ │ +
749 std::vector<std::size_t> tmp;
│ │ │ │ +
750 std::vector<std::size_t> *coarse, *fine;
│ │ │ │ +
751
│ │ │ │ +
752 // make sure the allocated space suffices.
│ │ │ │ +
753 tmp.reserve(size);
│ │ │ │ +
754 data.reserve(size);
│ │ │ │ +
755
│ │ │ │ +
756 // Correctly assign coarse and fine for the first prolongation such that
│ │ │ │ +
757 // we end up in data in the end.
│ │ │ │ +
758 if(levels%2==0) {
│ │ │ │ +
759 coarse=&tmp;
│ │ │ │ +
760 fine=&data;
│ │ │ │ +
761 }else{
│ │ │ │ +
762 coarse=&data;
│ │ │ │ +
763 fine=&tmp;
│ │ │ │ +
764 }
│ │ │ │ +
765
│ │ │ │ +
766 // Number the unknowns on the coarsest level consecutively for each process.
│ │ │ │ +
767 if(levels==maxlevels) {
│ │ │ │ +
768 const AggregatesMap& map = *(*(++aggregatesMaps().rbegin()));
│ │ │ │ +
769 std::size_t m=0;
│ │ │ │ +
770
│ │ │ │ +
771 for(typename AggregatesMap::const_iterator iter = map.begin(); iter != map.end(); ++iter)
│ │ │ │ +
772 if(*iter< AggregatesMap::ISOLATED)
│ │ │ │ +
773 m=std::max(*iter,m);
│ │ │ │ +
774
│ │ │ │ +
775 coarse->resize(m+1);
│ │ │ │ +
776 std::size_t i=0;
│ │ │ │ +
777 srand((unsigned)std::clock());
│ │ │ │ +
778 std::set<size_t> used;
│ │ │ │ +
779 for(typename std::vector<std::size_t>::iterator iter=coarse->begin(); iter != coarse->end();
│ │ │ │ +
780 ++iter, ++i)
│ │ │ │ +
781 {
│ │ │ │ +
782 std::pair<std::set<std::size_t>::iterator,bool> ibpair
│ │ │ │ +
783 = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0)))*coarse->size());
│ │ │ │ +
784
│ │ │ │ +
785 while(!ibpair.second)
│ │ │ │ +
786 ibpair = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0))*coarse->size()));
│ │ │ │ +
787 *iter=*(ibpair.first);
│ │ │ │ +
788 }
│ │ │ │ +
789 }
│ │ │ │ +
790
│ │ │ │ +
791 typename ParallelInformationHierarchy::Iterator pinfo = parallelInformation().coarsest();
│ │ │ │ +
792 --pinfo;
│ │ │ │ +
793
│ │ │ │ +
794 // Now consecutively project the numbers to the finest level.
│ │ │ │ +
795 for(typename AggregatesMapList::const_reverse_iterator aggregates=++aggregatesMaps().rbegin();
│ │ │ │ +
796 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) {
│ │ │ │ +
797
│ │ │ │ +
798 fine->resize((*aggregates)->noVertices());
│ │ │ │ +
799 fine->assign(fine->size(), 0);
│ │ │ │ + │ │ │ │ +
801 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast<std::size_t>(1), *pinfo);
│ │ │ │ +
802 --pinfo;
│ │ │ │ +
803 std::swap(coarse, fine);
│ │ │ │ +
804 }
│ │ │ │ +
805
│ │ │ │ +
806 // Assertion to check that we really projected to data on the last step.
│ │ │ │ +
807 assert(coarse==&data);
│ │ │ │ +
808 }
│ │ │ │ +
│ │ │ │ +
809
│ │ │ │ +
810 template<class M, class IS, class A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
813 {
│ │ │ │ +
814 return aggregatesMaps_;
│ │ │ │ +
815 }
│ │ │ │ +
│ │ │ │ +
816 template<class M, class IS, class A>
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
819 {
│ │ │ │ +
820 return redistributes_;
│ │ │ │ +
821 }
│ │ │ │ +
│ │ │ │ +
822
│ │ │ │ +
823 template<class M, class IS, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
825 {
│ │ │ │ +
826 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator;
│ │ │ │ +
827 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ │ +
828 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ │ +
829
│ │ │ │ +
830 AggregatesMapIterator amap = aggregatesMaps_.rbegin();
│ │ │ │ +
831 InfoIterator info = parallelInformation_.coarsest();
│ │ │ │ +
832 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level != finest; --level, --info, ++amap) {
│ │ │ │ +
833 (*amap)->free();
│ │ │ │ +
834 delete *amap;
│ │ │ │ +
835 }
│ │ │ │ +
836 delete *amap;
│ │ │ │ +
837 }
│ │ │ │ +
│ │ │ │ +
838
│ │ │ │ +
839 template<class M, class IS, class A>
│ │ │ │ +
840 template<class V, class BA, class TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
842 {
│ │ │ │ +
843 assert(hierarchy.levels()==1);
│ │ │ │ +
844 typedef typename ParallelMatrixHierarchy::ConstIterator Iterator;
│ │ │ │ +
845 typedef typename RedistributeInfoList::const_iterator RIter;
│ │ │ │ +
846 RIter redist = redistributes_.begin();
│ │ │ │ +
847
│ │ │ │ +
848 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ │ +
849 int level=0;
│ │ │ │ +
850 if(redist->isSetup())
│ │ │ │ +
851 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ │ +
852 Dune::dvverb<<"Level "<<level<<" has "<<matrices_.finest()->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ │ +
853
│ │ │ │ +
854 while(matrix != coarsest) {
│ │ │ │ +
855 ++matrix; ++level; ++redist;
│ │ │ │ +
856 Dune::dvverb<<"Level "<<level<<" has "<<matrix->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ │ +
857
│ │ │ │ +
858 hierarchy.addCoarser(matrix->getmat().N());
│ │ │ │ +
859 if(redist->isSetup())
│ │ │ │ +
860 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ │ +
861
│ │ │ │ +
862 }
│ │ │ │ +
863
│ │ │ │ +
864 }
│ │ │ │ +
│ │ │ │ +
865
│ │ │ │ +
866 template<class M, class IS, class A>
│ │ │ │ +
867 template<class S, class TA>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
869 const typename SmootherTraits<S>::Arguments& sargs) const
│ │ │ │ +
870 {
│ │ │ │ +
871 assert(smoothers.levels()==0);
│ │ │ │ +
872 typedef typename ParallelMatrixHierarchy::ConstIterator MatrixIterator;
│ │ │ │ +
873 typedef typename ParallelInformationHierarchy::ConstIterator PinfoIterator;
│ │ │ │ +
874 typedef typename AggregatesMapList::const_iterator AggregatesIterator;
│ │ │ │ +
875
│ │ │ │ + │ │ │ │ +
877 cargs.setArgs(sargs);
│ │ │ │ +
878 PinfoIterator pinfo = parallelInformation_.finest();
│ │ │ │ +
879 AggregatesIterator aggregates = aggregatesMaps_.begin();
│ │ │ │ +
880 int level=0;
│ │ │ │ +
881 for(MatrixIterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ │ +
882 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) {
│ │ │ │ +
883 cargs.setMatrix(matrix->getmat(), **aggregates);
│ │ │ │ +
884 cargs.setComm(*pinfo);
│ │ │ │ +
885 smoothers.addCoarser(cargs);
│ │ │ │ +
886 }
│ │ │ │ +
887 if(maxlevels()>levels()) {
│ │ │ │ +
888 // This is not the globally coarsest level and therefore smoothing is needed
│ │ │ │ +
889 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates);
│ │ │ │ +
890 cargs.setComm(*pinfo);
│ │ │ │ +
891 smoothers.addCoarser(cargs);
│ │ │ │ +
892 ++level;
│ │ │ │ +
893 }
│ │ │ │ +
894 }
│ │ │ │ +
│ │ │ │ +
895
│ │ │ │ +
896 template<class M, class IS, class A>
│ │ │ │ +
897 template<class F>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
899 {
│ │ │ │ +
900 typedef typename AggregatesMapList::iterator AggregatesMapIterator;
│ │ │ │ +
901 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ │ +
902 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ │ +
903
│ │ │ │ +
904 AggregatesMapIterator amap = aggregatesMaps_.begin();
│ │ │ │ +
905 BaseGalerkinProduct productBuilder;
│ │ │ │ +
906 InfoIterator info = parallelInformation_.finest();
│ │ │ │ +
907 typename RedistributeInfoList::iterator riIter = redistributes_.begin();
│ │ │ │ +
908 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest();
│ │ │ │ +
909 if(level.isRedistributed()) {
│ │ │ │ +
910 info->buildGlobalLookup(level->getmat().N());
│ │ │ │ +
911 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ │ +
912 const_cast<Matrix&>(level.getRedistributed().getmat()),
│ │ │ │ +
913 *info,info.getRedistributed(), *riIter);
│ │ │ │ +
914 info->freeGlobalLookup();
│ │ │ │ +
915 }
│ │ │ │ +
916
│ │ │ │ +
917 for(; level!=coarsest; ++amap) {
│ │ │ │ +
918 const Matrix& fine = (level.isRedistributed() ? level.getRedistributed() : *level).getmat();
│ │ │ │ +
919 ++level;
│ │ │ │ +
920 ++info;
│ │ │ │ +
921 ++riIter;
│ │ │ │ +
922 productBuilder.calculate(fine, *(*amap), const_cast<Matrix&>(level->getmat()), *info, copyFlags);
│ │ │ │ +
923 if(level.isRedistributed()) {
│ │ │ │ +
924 info->buildGlobalLookup(level->getmat().N());
│ │ │ │ +
925 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ │ +
926 const_cast<Matrix&>(level.getRedistributed().getmat()), *info,
│ │ │ │ +
927 info.getRedistributed(), *riIter);
│ │ │ │ +
928 info->freeGlobalLookup();
│ │ │ │ +
929 }
│ │ │ │ +
930 }
│ │ │ │ +
931 }
│ │ │ │ +
│ │ │ │ +
932
│ │ │ │ +
933 template<class M, class IS, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
935 {
│ │ │ │ +
936 return matrices_.levels();
│ │ │ │ +
937 }
│ │ │ │ +
│ │ │ │ +
938
│ │ │ │ +
939 template<class M, class IS, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
941 {
│ │ │ │ +
942 return maxlevels_;
│ │ │ │ +
943 }
│ │ │ │ +
│ │ │ │ +
944
│ │ │ │ +
945 template<class M, class IS, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
947 {
│ │ │ │ +
948 return levels()==maxlevels() &&
│ │ │ │ +
949 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N()>0);
│ │ │ │ +
950 }
│ │ │ │ +
│ │ │ │ +
951
│ │ │ │ +
952 template<class M, class IS, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
954 {
│ │ │ │ +
955 return built_;
│ │ │ │ +
956 }
│ │ │ │ +
│ │ │ │ +
957
│ │ │ │ +
959 } // namespace Amg
│ │ │ │ +
960} // namespace Dune
│ │ │ │ +
961
│ │ │ │ +
962#endif // end DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ │ +
Functionality for redistributing a sparse matrix.
│ │ │ │ +
Some handy generic functions for ISTL matrices.
│ │ │ │ +
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ │ +
Provdes class for identifying aggregates globally.
│ │ │ │ +
Provides a classes representing the hierarchies in AMG.
│ │ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │ │ + │ │ │ │ +
Provides a class for building the index set and remote indices on the coarse level.
│ │ │ │ +
Helper classes for the construction of classes without empty constructor.
│ │ │ │ +
Provides classes for building the matrix graph.
│ │ │ │ +
Classes for the generic construction and application of the smoothers.
│ │ │ │ + │ │ │ │ +
Prolongation and restriction for amg.
│ │ │ │ +
Provides classes for initializing the link attributes of a matrix graph.
│ │ │ │ +
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:812
│ │ │ │ +
bool isBuilt() const
Whether the hierarchy was built.
Definition matrixhierarchy.hh:953
│ │ │ │ +
bool hasCoarsest() const
Definition matrixhierarchy.hh:946
│ │ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition matrixhierarchy.hh:934
│ │ │ │ +
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ │ +
const RedistributeInfoList & redistributeInformation() const
Get the hierarchy of the information about redistributions,.
Definition matrixhierarchy.hh:818
│ │ │ │ +
const ParallelInformationHierarchy & parallelInformation() const
Get the hierarchy of the parallel data distribution information.
Definition matrixhierarchy.hh:737
│ │ │ │ +
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:313
│ │ │ │ +
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ │ +
const ParallelMatrixHierarchy & matrices() const
Get the matrix hierarchy.
Definition matrixhierarchy.hh:730
│ │ │ │ +
std::size_t maxlevels() const
Get the max number of levels in the hierarchy of processors.
Definition matrixhierarchy.hh:940
│ │ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition indicescoarsener.hh:60
│ │ │ │ -
void attribute(const Attribute &attribute)
Definition indicescoarsener.hh:150
│ │ │ │ -
E ExcludedAttributes
The set of excluded attributes.
Definition indicescoarsener.hh:48
│ │ │ │ -
void globalIndex(const GlobalIndex &global)
Definition indicescoarsener.hh:165
│ │ │ │ -
Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
The type of the remote indices.
Definition indicescoarsener.hh:75
│ │ │ │ -
ParallelAggregateRenumberer(AggregatesMap< Vertex > &aggregates, const I &lookup)
Definition indicescoarsener.hh:110
│ │ │ │ -
const GlobalIndex & globalIndex() const
Definition indicescoarsener.hh:160
│ │ │ │ -
STL namespace.
│ │ │ │ +
void recalculateGalerkin(const F &copyFlags)
Recalculate the galerkin products.
Definition matrixhierarchy.hh:898
│ │ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ +
std::size_t noVertices() const
Get the number of vertices.
│ │ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ +
void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const
Coarsen the vector hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:841
│ │ │ │ +
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ │ +
MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< ParallelInformation > pinfo=std::make_shared< ParallelInformation >())
Constructor.
Definition matrixhierarchy.hh:389
│ │ │ │ +
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:232
│ │ │ │ +
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ │ +
void build(const T &criterion)
Build the matrix hierarchy using aggregation.
Definition matrixhierarchy.hh:400
│ │ │ │ +
void free()
Free the allocated memory.
│ │ │ │ +
void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename SmootherTraits< S >::Arguments &args) const
Coarsen the smoother hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:868
│ │ │ │ +
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
│ │ │ │ +
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
│ │ │ │ +
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ │ +
void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const
Get the mapping of fine level unknowns to coarse level aggregates.
Definition matrixhierarchy.hh:743
│ │ │ │ +
~MatrixHierarchy()
Definition matrixhierarchy.hh:824
│ │ │ │ +
@ MAX_PROCESSES
Hard limit for the number of processes allowed.
Definition matrixhierarchy.hh:50
│ │ │ │ +
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:244
│ │ │ │ +
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:248
│ │ │ │
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
│ │ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ +
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:829
│ │ │ │ +
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:1235
│ │ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ │ +
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ │ +
Definition matrixredistribute.hh:22
│ │ │ │
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ +
Class representing the properties of an ede in the matrix graph.
Definition dependency.hh:39
│ │ │ │ +
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ │ +
Definition galerkin.hh:99
│ │ │ │ +
Definition galerkin.hh:118
│ │ │ │ +
Definition globalaggregates.hh:131
│ │ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:988
│ │ │ │ +
Definition graphcreator.hh:22
│ │ │ │ +
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ │ +
LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ +
LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const MatrixOperator > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ │
Definition indicescoarsener.hh:36
│ │ │ │ -
Definition indicescoarsener.hh:43
│ │ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │ +
typename std::allocator_traits< Allocator >::template rebind_alloc< AggregatesMap * > AAllocator
Allocator for pointers.
Definition matrixhierarchy.hh:85
│ │ │ │ +
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
The type of the parallel informarion hierarchy.
Definition matrixhierarchy.hh:82
│ │ │ │ +
std::list< AggregatesMap *, AAllocator > AggregatesMapList
The type of the aggregates maps list.
Definition matrixhierarchy.hh:88
│ │ │ │ +
PI ParallelInformation
The type of the index set.
Definition matrixhierarchy.hh:70
│ │ │ │ +
Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy
The type of the parallel matrix hierarchy.
Definition matrixhierarchy.hh:79
│ │ │ │ +
A Allocator
The allocator to use.
Definition matrixhierarchy.hh:73
│ │ │ │ +
RedistributeInformation< ParallelInformation > RedistributeInfoType
The type of the redistribute information.
Definition matrixhierarchy.hh:91
│ │ │ │ +
double getProlongationDampingFactor() const
Definition matrixhierarchy.hh:188
│ │ │ │ +
typename std::allocator_traits< Allocator >::template rebind_alloc< RedistributeInfoType > RILAllocator
Allocator for RedistributeInfoType.
Definition matrixhierarchy.hh:94
│ │ │ │ +
std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList
The type of the list of redistribute information.
Definition matrixhierarchy.hh:97
│ │ │ │ +
Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > AggregatesMap
The type of the aggregates map we use.
Definition matrixhierarchy.hh:76
│ │ │ │ +
MatrixOperator::matrix_type Matrix
The type of the matrix.
Definition matrixhierarchy.hh:67
│ │ │ │ +
M MatrixOperator
The type of the matrix operator.
Definition matrixhierarchy.hh:64
│ │ │ │ +
void operator()(const matrix_row &row)
Definition matrixhierarchy.hh:254
│ │ │ │ +
Matrix::row_type matrix_row
Definition matrixhierarchy.hh:245
│ │ │ │ +
size_type min
Definition matrixhierarchy.hh:261
│ │ │ │ + │ │ │ │ +
size_type max
Definition matrixhierarchy.hh:262
│ │ │ │ +
size_type sum
Definition matrixhierarchy.hh:263
│ │ │ │ +
Matrix::size_type size_type
Definition matrixhierarchy.hh:244
│ │ │ │ +
The criterion describing the stop criteria for the coarsening process.
Definition matrixhierarchy.hh:283
│ │ │ │ +
CoarsenCriterion(const Dune::Amg::Parameters &parms)
Definition matrixhierarchy.hh:306
│ │ │ │ +
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)
Constructor.
Definition matrixhierarchy.hh:301
│ │ │ │ +
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │
Definition pinfo.hh:28
│ │ │ │ -
Definition renumberer.hh:16
│ │ │ │ -
void operator++()
Definition renumberer.hh:57
│ │ │ │ -
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:51
│ │ │ │ -
Vertex number_
Definition renumberer.hh:35
│ │ │ │ +
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ +
Definition transfer.hh:32
│ │ │ │ +
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,485 +1,1288 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -indicescoarsener.hh │ │ │ │ │ +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 (C) 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_AMG_MATRIXHIERARCHY_HH │ │ │ │ │ +6#define DUNE_AMG_MATRIXHIERARCHY_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 │ │ │ │ │ -15 │ │ │ │ │ -16#include "_p_i_n_f_o_._h_h" │ │ │ │ │ -17 │ │ │ │ │ -18namespace _D_u_n_e │ │ │ │ │ -19{ │ │ │ │ │ -20 namespace Amg │ │ │ │ │ -21 { │ │ │ │ │ -22 │ │ │ │ │ -34 template │ │ │ │ │ -_3_5 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ │ -36 {}; │ │ │ │ │ -37 │ │ │ │ │ -38 │ │ │ │ │ -39#if HAVE_MPI │ │ │ │ │ -40 │ │ │ │ │ -41 template │ │ │ │ │ -_4_2 class _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ │ -43 { │ │ │ │ │ -44 public: │ │ │ │ │ -_4_8 typedef E _E_x_c_l_u_d_e_d_A_t_t_r_i_b_u_t_e_s; │ │ │ │ │ -49 │ │ │ │ │ -_5_3 typedef T _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ -54 │ │ │ │ │ -_5_5 typedef typename ParallelInformation::ParallelIndexSet _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ │ -56 │ │ │ │ │ -_6_0 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ -61 │ │ │ │ │ -_6_5 typedef typename ParallelIndexSet::LocalIndex _L_o_c_a_l_I_n_d_e_x; │ │ │ │ │ -66 │ │ │ │ │ -_7_0 typedef typename LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ │ +11#include "_g_r_a_p_h_._h_h" │ │ │ │ │ +12#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ │ +13#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ │ +14#include "_g_r_a_p_h_c_r_e_a_t_o_r_._h_h" │ │ │ │ │ +15#include "_h_i_e_r_a_r_c_h_y_._h_h" │ │ │ │ │ +16#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ +17#include │ │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> │ │ │ │ │ +19#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ │ +20#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_d_e_p_e_n_d_e_n_c_y_._h_h> │ │ │ │ │ +21#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h> │ │ │ │ │ +23#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ │ +24#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ │ +25#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ │ +26#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ │ +27 │ │ │ │ │ +28namespace _D_u_n_e │ │ │ │ │ +29{ │ │ │ │ │ +30 namespace Amg │ │ │ │ │ +31 { │ │ │ │ │ +42 enum { │ │ │ │ │ +50 _M_A_X___P_R_O_C_E_S_S_E_S = 72000 │ │ │ │ │ +_5_1 }; │ │ │ │ │ +52 │ │ │ │ │ +59 template > │ │ │ │ │ +_6_0 class _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ +61 { │ │ │ │ │ +62 public: │ │ │ │ │ +_6_4 typedef M _M_a_t_r_i_x_O_p_e_r_a_t_o_r; │ │ │ │ │ +65 │ │ │ │ │ +_6_7 typedef typename MatrixOperator::matrix_type _M_a_t_r_i_x; │ │ │ │ │ +68 │ │ │ │ │ +_7_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ 71 │ │ │ │ │ -_7_5 typedef Dune::RemoteIndices _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ │ -76 │ │ │ │ │ -88 template │ │ │ │ │ -89 static typename Graph::VertexDescriptor │ │ │ │ │ -_9_0 _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, │ │ │ │ │ -91 Graph& fineGraph, │ │ │ │ │ -92 VM& visitedMap, │ │ │ │ │ -93 _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, │ │ │ │ │ -94 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ │ -95 typename Graph::VertexDescriptor noAggregates); │ │ │ │ │ -96 │ │ │ │ │ -97 private: │ │ │ │ │ -98 template │ │ │ │ │ -99 class ParallelAggregateRenumberer : public _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ │ -100 { │ │ │ │ │ -101 typedef typename G::VertexDescriptor Vertex; │ │ │ │ │ -102 │ │ │ │ │ -103 typedef I GlobalLookupIndexSet; │ │ │ │ │ -104 │ │ │ │ │ -105 typedef typename GlobalLookupIndexSet::IndexPair IndexPair; │ │ │ │ │ +_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; │ │ │ │ │ +95 │ │ │ │ │ +_9_7 typedef std::list _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t; │ │ │ │ │ +98 │ │ │ │ │ +104 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(std::shared_ptr fineMatrix, │ │ │ │ │ +105 std::shared_ptr pinfo = std:: │ │ │ │ │ +make_shared()); │ │ │ │ │ 106 │ │ │ │ │ -107 typedef typename IndexPair::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +107 _~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(); │ │ │ │ │ 108 │ │ │ │ │ -109 public: │ │ │ │ │ -_1_1_0 _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) │ │ │ │ │ -111 : _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(aggregates), isPublic_(false), lookup_(lookup), │ │ │ │ │ -112 globalIndex_(_s_t_d::numeric_limits::max()) │ │ │ │ │ -113 {} │ │ │ │ │ -114 │ │ │ │ │ -115 │ │ │ │ │ -_1_1_6 void _o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& edge) │ │ │ │ │ -117 { │ │ │ │ │ -118 _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); │ │ │ │ │ -119 const IndexPair* pair= lookup_.pair(edge.target()); │ │ │ │ │ -120 if(pair!=0) { │ │ │ │ │ -121 _g_l_o_b_a_l_I_n_d_e_x(pair->global()); │ │ │ │ │ -122 _a_t_t_r_i_b_u_t_e(pair->local().attribute()); │ │ │ │ │ -123 _i_s_P_u_b_l_i_c(pair->local().isPublic()); │ │ │ │ │ -124 } │ │ │ │ │ -125 } │ │ │ │ │ +114 template │ │ │ │ │ +115 void _b_u_i_l_d(const T& criterion); │ │ │ │ │ +116 │ │ │ │ │ +124 template │ │ │ │ │ +125 void _r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n(const F& copyFlags); │ │ │ │ │ 126 │ │ │ │ │ -_1_2_7 Vertex _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const GlobalIndex& global) │ │ │ │ │ -128 { │ │ │ │ │ -129 Vertex current = this->_n_u_m_b_e_r__; │ │ │ │ │ -130 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ -131 return current; │ │ │ │ │ -132 } │ │ │ │ │ +131 template │ │ │ │ │ +132 void _c_o_a_r_s_e_n_V_e_c_t_o_r(_H_i_e_r_a_r_c_h_y<_B_l_o_c_k_V_e_c_t_o_r_<_V_,_B_A_>, TA>& hierarchy) const; │ │ │ │ │ 133 │ │ │ │ │ -_1_3_4 bool _i_s_P_u_b_l_i_c() │ │ │ │ │ -135 { │ │ │ │ │ -136 return isPublic_; │ │ │ │ │ -137 } │ │ │ │ │ -138 │ │ │ │ │ -_1_3_9 void _i_s_P_u_b_l_i_c(bool b) │ │ │ │ │ -140 { │ │ │ │ │ -141 isPublic_ = isPublic_ || b; │ │ │ │ │ -142 } │ │ │ │ │ -143 │ │ │ │ │ -_1_4_4 void _r_e_s_e_t() │ │ │ │ │ -145 { │ │ │ │ │ -146 globalIndex_ = std::numeric_limits::max(); │ │ │ │ │ -147 isPublic_=false; │ │ │ │ │ -148 } │ │ │ │ │ -149 │ │ │ │ │ -_1_5_0 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) │ │ │ │ │ -151 { │ │ │ │ │ -152 attribute_=_a_t_t_r_i_b_u_t_e; │ │ │ │ │ -153 } │ │ │ │ │ +139 template │ │ │ │ │ +140 void _c_o_a_r_s_e_n_S_m_o_o_t_h_e_r(_H_i_e_r_a_r_c_h_y_<_S_,_T_A_>& smoothers, │ │ │ │ │ +141 const typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s& args) const; │ │ │ │ │ +142 │ │ │ │ │ +147 std::size_t _l_e_v_e_l_s() const; │ │ │ │ │ +148 │ │ │ │ │ +153 std::size_t _m_a_x_l_e_v_e_l_s() const; │ │ │ │ │ 154 │ │ │ │ │ -_1_5_5 _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() │ │ │ │ │ -156 { │ │ │ │ │ -157 return attribute_; │ │ │ │ │ -158 } │ │ │ │ │ -159 │ │ │ │ │ -_1_6_0 const GlobalIndex& _g_l_o_b_a_l_I_n_d_e_x() const │ │ │ │ │ -161 { │ │ │ │ │ -162 return globalIndex_; │ │ │ │ │ -163 } │ │ │ │ │ -164 │ │ │ │ │ -_1_6_5 void _g_l_o_b_a_l_I_n_d_e_x(const GlobalIndex& global) │ │ │ │ │ -166 { │ │ │ │ │ -167 globalIndex_ = global; │ │ │ │ │ -168 } │ │ │ │ │ -169 │ │ │ │ │ -170 private: │ │ │ │ │ -171 bool isPublic_; │ │ │ │ │ -172 _A_t_t_r_i_b_u_t_e attribute_; │ │ │ │ │ -173 const GlobalLookupIndexSet& lookup_; │ │ │ │ │ -174 _G_l_o_b_a_l_I_n_d_e_x globalIndex_; │ │ │ │ │ -175 }; │ │ │ │ │ -176 │ │ │ │ │ -177 template │ │ │ │ │ -178 static void buildCoarseIndexSet(const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ │ -179 Graph& fineGraph, │ │ │ │ │ -180 VM& visitedMap, │ │ │ │ │ -181 _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, │ │ │ │ │ -182 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& coarseIndices, │ │ │ │ │ -183 ParallelAggregateRenumberer& renumberer); │ │ │ │ │ -184 │ │ │ │ │ -185 template │ │ │ │ │ -186 static void buildCoarseRemoteIndices(const _R_e_m_o_t_e_I_n_d_i_c_e_s& fineRemote, │ │ │ │ │ -187 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, │ │ │ │ │ -188 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& coarseIndices, │ │ │ │ │ -189 _R_e_m_o_t_e_I_n_d_i_c_e_s& coarseRemote, │ │ │ │ │ -190 ParallelAggregateRenumberer& renumberer); │ │ │ │ │ -191 │ │ │ │ │ -192 }; │ │ │ │ │ -193 │ │ │ │ │ -197 template │ │ │ │ │ -_1_9_8 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> │ │ │ │ │ -199 : 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> │ │ │ │ │ -200 {}; │ │ │ │ │ -201 │ │ │ │ │ -202 │ │ │ │ │ -203#endif │ │ │ │ │ +155 bool _h_a_s_C_o_a_r_s_e_s_t() const; │ │ │ │ │ +156 │ │ │ │ │ +161 bool _i_s_B_u_i_l_t() const; │ │ │ │ │ +162 │ │ │ │ │ +167 const _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y& _m_a_t_r_i_c_e_s() const; │ │ │ │ │ +168 │ │ │ │ │ +173 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y& _p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ │ +174 │ │ │ │ │ +179 const _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t& _a_g_g_r_e_g_a_t_e_s_M_a_p_s() const; │ │ │ │ │ +180 │ │ │ │ │ +186 const _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t& _r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ │ +187 │ │ │ │ │ +_1_8_8 double _g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r() const │ │ │ │ │ +189 { │ │ │ │ │ +190 return prolongDamp_; │ │ │ │ │ +191 } │ │ │ │ │ +192 │ │ │ │ │ +203 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t(std::vector& data) const; │ │ │ │ │ 204 │ │ │ │ │ -211 template │ │ │ │ │ -_2_1_2 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> │ │ │ │ │ -213 { │ │ │ │ │ -214 public: │ │ │ │ │ -215 template │ │ │ │ │ -216 static typename Graph::VertexDescriptor │ │ │ │ │ -217 coarsen(const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n & fineInfo, │ │ │ │ │ -218 Graph& fineGraph, │ │ │ │ │ -219 VM& visitedMap, │ │ │ │ │ -220 _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, │ │ │ │ │ -221 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ │ -222 typename Graph::VertexDescriptor noAggregates); │ │ │ │ │ -223 }; │ │ │ │ │ +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 │ │ │ │ │ -225#if HAVE_MPI │ │ │ │ │ -226 template │ │ │ │ │ -227 template │ │ │ │ │ -228 inline typename Graph::VertexDescriptor │ │ │ │ │ -_2_2_9 _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, │ │ │ │ │ -230 Graph& fineGraph, │ │ │ │ │ -231 VM& visitedMap, │ │ │ │ │ -232 _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, │ │ │ │ │ -233 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ │ -234 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates) │ │ │ │ │ -235 { │ │ │ │ │ -236 ParallelAggregateRenumberer renumberer(aggregates, fineInfo.globalLookup()); │ │ │ │ │ -237 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates, │ │ │ │ │ -238 coarseInfo.indexSet(), renumberer); │ │ │ │ │ -239 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, │ │ │ │ │ -coarseInfo.indexSet(), │ │ │ │ │ -240 coarseInfo.remoteIndices(), renumberer); │ │ │ │ │ -241 │ │ │ │ │ -242 return renumberer; │ │ │ │ │ -243 } │ │ │ │ │ -244 │ │ │ │ │ -245 template │ │ │ │ │ -246 template │ │ │ │ │ -247 void _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_T_,_E_>_:_:_b_u_i_l_d_C_o_a_r_s_e_I_n_d_e_x_S_e_t(const │ │ │ │ │ -ParallelInformation& pinfo, │ │ │ │ │ -248 Graph& fineGraph, │ │ │ │ │ -249 VM& visitedMap, │ │ │ │ │ -250 _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, │ │ │ │ │ -251 ParallelIndexSet& coarseIndices, │ │ │ │ │ -252 ParallelAggregateRenumberer& renumberer) │ │ │ │ │ -253 { │ │ │ │ │ -254 // fineGraph is the local subgraph corresponding to the vertices the │ │ │ │ │ -process owns. │ │ │ │ │ -255 // i.e. no overlap/copy vertices can be visited traversing the graph │ │ │ │ │ -256 typedef typename Graph::ConstVertexIterator Iterator; │ │ │ │ │ -257 typedef typename ParallelInformation::GlobalLookupIndexSet │ │ │ │ │ -GlobalLookupIndexSet; │ │ │ │ │ -258 │ │ │ │ │ -259 Iterator end = fineGraph.end(); │ │ │ │ │ -260 const GlobalLookupIndexSet& lookup = pinfo.globalLookup(); │ │ │ │ │ -261 │ │ │ │ │ -262 coarseIndices.beginResize(); │ │ │ │ │ -263 │ │ │ │ │ -264 // Setup the coarse index set and renumber the aggregate consecutively │ │ │ │ │ -265 // ascending from zero according to the minimum global index belonging │ │ │ │ │ -266 // to the aggregate │ │ │ │ │ -267 for(Iterator index = fineGraph.begin(); index != end; ++index) { │ │ │ │ │ -268 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) │ │ │ │ │ -269 // Isolated vertices will not be represented on the next level. │ │ │ │ │ -270 // These should only be there if skipIsolated is activiated in │ │ │ │ │ -271 // the coarsening criterion as otherwise they will be aggregated │ │ │ │ │ -272 // and should have real aggregate number in the map right now. │ │ │ │ │ -273 if(!_g_e_t(visitedMap, *index)) { │ │ │ │ │ -274 // This vertex was not visited by breadthFirstSearch yet. │ │ │ │ │ -275 typedef typename GlobalLookupIndexSet::IndexPair IndexPair; │ │ │ │ │ -276 const IndexPair* pair= lookup.pair(*index); │ │ │ │ │ +228 template │ │ │ │ │ +229 struct MatrixStats │ │ │ │ │ +230 { │ │ │ │ │ +231 │ │ │ │ │ +235 static void stats([[maybe_unused]] const _M_a_t_r_i_x& matrix) │ │ │ │ │ +236 {} │ │ │ │ │ +237 }; │ │ │ │ │ +238 │ │ │ │ │ +239 template │ │ │ │ │ +240 struct MatrixStats<_M_a_t_r_i_x,true> │ │ │ │ │ +241 { │ │ │ │ │ +_2_4_2 struct calc │ │ │ │ │ +243 { │ │ │ │ │ +_2_4_4 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ +_2_4_5 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _m_a_t_r_i_x___r_o_w; │ │ │ │ │ +246 │ │ │ │ │ +_2_4_7 _c_a_l_c() │ │ │ │ │ +248 { │ │ │ │ │ +249 min=std::numeric_limits::max(); │ │ │ │ │ +250 max=0; │ │ │ │ │ +251 sum=0; │ │ │ │ │ +252 } │ │ │ │ │ +253 │ │ │ │ │ +_2_5_4 void _o_p_e_r_a_t_o_r_(_)(const _m_a_t_r_i_x___r_o_w& row) │ │ │ │ │ +255 { │ │ │ │ │ +256 min=std::min(min, row.size()); │ │ │ │ │ +257 max=std::max(max, row.size()); │ │ │ │ │ +258 sum += row.size(); │ │ │ │ │ +259 } │ │ │ │ │ +260 │ │ │ │ │ +_2_6_1 _s_i_z_e___t_y_p_e _m_i_n; │ │ │ │ │ +_2_6_2 _s_i_z_e___t_y_p_e _m_a_x; │ │ │ │ │ +_2_6_3 _s_i_z_e___t_y_p_e _s_u_m; │ │ │ │ │ +264 }; │ │ │ │ │ +268 static void stats(const _M_a_t_r_i_x& matrix) │ │ │ │ │ +269 { │ │ │ │ │ +270 calc c= for_each(matrix.begin(), matrix.end(), calc()); │ │ │ │ │ +271 dinfo<<"Matrix row: min="< coarseLookup(coarseIndices, │ │ │ │ │ -static_cast(renumberer)); │ │ │ │ │ -326 │ │ │ │ │ -327 typedef typename RemoteIndices::const_iterator Iterator; │ │ │ │ │ -328 Iterator end = fineRemote.end(); │ │ │ │ │ -329 │ │ │ │ │ -330 for(Iterator neighbour = fineRemote.begin(); │ │ │ │ │ -331 neighbour != end; ++neighbour) { │ │ │ │ │ -332 int process = neighbour->first; │ │ │ │ │ -333 │ │ │ │ │ -334 assert(neighbour->second.first==neighbour->second.second); │ │ │ │ │ -335 │ │ │ │ │ -336 // Mark all as not known │ │ │ │ │ -337 typedef typename std::vector::iterator CIterator; │ │ │ │ │ -338 │ │ │ │ │ -339 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter) │ │ │ │ │ -340 *iter = std::numeric_limits::max(); │ │ │ │ │ -341 │ │ │ │ │ -342 auto riEnd = neighbour->second.second->end(); │ │ │ │ │ -343 │ │ │ │ │ -344 for(auto index = neighbour->second.second->begin(); │ │ │ │ │ -345 index != riEnd; ++index) { │ │ │ │ │ -346 if(!E::contains(index->localIndexPair().local().attribute()) && │ │ │ │ │ -347 aggregates[index->localIndexPair().local()] != │ │ │ │ │ -348 _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) │ │ │ │ │ -349 { │ │ │ │ │ -350 assert(aggregates[index->localIndexPair().local()]localIndexPair().local()]] != 3) │ │ │ │ │ -352 attributes[aggregates[index->localIndexPair().local()]] = index->attribute │ │ │ │ │ -(); │ │ │ │ │ -353 } │ │ │ │ │ -354 } │ │ │ │ │ -355 │ │ │ │ │ -356 // Build remote index list │ │ │ │ │ -357 typedef RemoteIndexListModifier Modifier; │ │ │ │ │ -358 typedef typename RemoteIndices::RemoteIndex RemoteIndex; │ │ │ │ │ -359 typedef typename ParallelIndexSet::const_iterator IndexIterator; │ │ │ │ │ -360 │ │ │ │ │ -361 Modifier coarseList = coarseRemote.template getModifier │ │ │ │ │ -(process); │ │ │ │ │ -362 │ │ │ │ │ -363 IndexIterator iend = coarseIndices.end(); │ │ │ │ │ -364 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index) │ │ │ │ │ -365 if(attributes[index->local()] != std::numeric_limits::max()) { │ │ │ │ │ -366 // remote index is present │ │ │ │ │ -367 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), & │ │ │ │ │ -(*index))); │ │ │ │ │ -368 } │ │ │ │ │ -369 //std::cout< syncer(coarseIndices, coarseRemote); │ │ │ │ │ -378 syncer.sync(renumberer); │ │ │ │ │ -379 │ │ │ │ │ -380 } │ │ │ │ │ +325 template │ │ │ │ │ +_3_2_6 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, │ │ │ │ │ +327 std::shared_ptr newMatrix, │ │ │ │ │ +328 C& origComm, │ │ │ │ │ +329 std::shared_ptr& newComm, │ │ │ │ │ +330 _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, │ │ │ │ │ +331 int nparts, C1& criterion) │ │ │ │ │ +332 { │ │ │ │ │ +333 Timer time; │ │ │ │ │ +334#ifdef AMG_REPART_ON_COMM_GRAPH │ │ │ │ │ +335 // Done not repartition the matrix graph, but a graph of the communication │ │ │ │ │ +scheme. │ │ │ │ │ +336 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, │ │ │ │ │ +337 ri.getInterface(), │ │ │ │ │ +338 criterion.debugLevel()>1); │ │ │ │ │ +339 │ │ │ │ │ +340#else │ │ │ │ │ +341 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; │ │ │ │ │ +342 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, │ │ │ │ │ +343 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ │ +344 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ │ +345 IdentityMap, │ │ │ │ │ +346 IdentityMap> _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ │ +347 _M_a_t_r_i_x_G_r_a_p_h graph(origMatrix); │ │ │ │ │ +348 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h pgraph(graph); │ │ │ │ │ +349 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(pgraph, origMatrix, criterion, false); │ │ │ │ │ +350 │ │ │ │ │ +351#ifdef DEBUG_REPART │ │ │ │ │ +352 if(origComm.communicator().rank()==0) │ │ │ │ │ +353 std::cout<<"Original matrix"<1); │ │ │ │ │ +360#endif // if else AMG_REPART │ │ │ │ │ +361 │ │ │ │ │ +362 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ │ +363 std::cout<<"Repartitioning took "<indexSet(), │ │ │ │ │ +origComm.communicator()); │ │ │ │ │ +369#endif │ │ │ │ │ +370 │ │ │ │ │ +371 _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); │ │ │ │ │ +372 │ │ │ │ │ +373#ifdef DEBUG_REPART │ │ │ │ │ +374 if(origComm.communicator().rank()==0) │ │ │ │ │ +375 std::cout<<"Original matrix"<communicator().size()>0) │ │ │ │ │ +378 _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); │ │ │ │ │ +379 origComm.communicator().barrier(); │ │ │ │ │ +380#endif │ │ │ │ │ 381 │ │ │ │ │ -382#endif │ │ │ │ │ -383 │ │ │ │ │ -384 template │ │ │ │ │ -385 template │ │ │ │ │ -386 typename Graph::VertexDescriptor │ │ │ │ │ -_3_8_7 _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( │ │ │ │ │ -388 [[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, │ │ │ │ │ -389 [[maybe_unused]] Graph& fineGraph, │ │ │ │ │ -390 [[maybe_unused]] VM& visitedMap, │ │ │ │ │ -391 [[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, │ │ │ │ │ -392 [[maybe_unused]] _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ │ -393 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates) │ │ │ │ │ -394 { │ │ │ │ │ -395 return noAggregates; │ │ │ │ │ +382 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ │ +383 std::cout<<"Redistributing matrix took "< │ │ │ │ │ +_3_8_9 _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, │ │ │ │ │ +390 std::shared_ptr pinfo) │ │ │ │ │ +391 : matrices_(fineMatrix), │ │ │ │ │ +392 parallelInformation_(pinfo) │ │ │ │ │ +393 { │ │ │ │ │ +394 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)) │ │ │ │ │ +395 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "MatrixOperator and ParallelInformation must belong │ │ │ │ │ +to the same category!"); │ │ │ │ │ 396 } │ │ │ │ │ 397 │ │ │ │ │ -398 } //namespace Amg │ │ │ │ │ -399} // namespace Dune │ │ │ │ │ -400#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. │ │ │ │ │ +398 template │ │ │ │ │ +399 template │ │ │ │ │ +_4_0_0 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) │ │ │ │ │ +401 { │ │ │ │ │ +402 prolongDamp_ = criterion.getProlongationDampingFactor(); │ │ │ │ │ +403 typedef O OverlapFlags; │ │ │ │ │ +404 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; │ │ │ │ │ +405 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; │ │ │ │ │ +406 │ │ │ │ │ +407 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; │ │ │ │ │ +408 │ │ │ │ │ +409 typedef bigunsignedint BIGINT; │ │ │ │ │ +410 _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; │ │ │ │ │ +411 MatIterator mlevel = matrices_.finest(); │ │ │ │ │ +412 MatrixStats::stats(mlevel->getmat()); │ │ │ │ │ +413 │ │ │ │ │ +414 PInfoIterator infoLevel = parallelInformation_.finest(); │ │ │ │ │ +415 BIGINT finenonzeros=_c_o_u_n_t_N_o_n_Z_e_r_o_s(mlevel->getmat()); │ │ │ │ │ +416 finenonzeros = infoLevel->communicator().sum(finenonzeros); │ │ │ │ │ +417 BIGINT allnonzeros = finenonzeros; │ │ │ │ │ +418 │ │ │ │ │ +419 │ │ │ │ │ +420 int level = 0; │ │ │ │ │ +421 int rank = 0; │ │ │ │ │ +422 │ │ │ │ │ +423 BIGINT unknowns = mlevel->getmat().N(); │ │ │ │ │ +424 │ │ │ │ │ +425 unknowns = infoLevel->communicator().sum(unknowns); │ │ │ │ │ +426 double dunknowns=unknowns.todouble(); │ │ │ │ │ +427 infoLevel->buildGlobalLookup(mlevel->getmat().N()); │ │ │ │ │ +428 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ │ +429 │ │ │ │ │ +430 for(; level < criterion.maxLevel(); ++level, ++mlevel) { │ │ │ │ │ +431 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ │ +432 rank = infoLevel->communicator().rank(); │ │ │ │ │ +433 if(rank==0 && criterion.debugLevel()>1) │ │ │ │ │ +434 std::cout<<"Level "<communicator().size() │ │ │ │ │ +435 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ +()<<")"<communicator().size())) │ │ │ │ │ +448 && infoLevel->communicator().size()>1 && │ │ │ │ │ +449 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget()) │ │ │ │ │ +450 { │ │ │ │ │ +451 // accumulate to fewer processors │ │ │ │ │ +452 std::shared_ptr redistMat = std::make_shared(); │ │ │ │ │ +453 std::shared_ptr redistComm; │ │ │ │ │ +454 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/ │ │ │ │ │ +(criterion.minAggregateSize() │ │ │ │ │ +455 *criterion.coarsenTarget())); │ │ │ │ │ +456 if( nodomains<=criterion.minAggregateSize()/2 || │ │ │ │ │ +457 dunknowns <= criterion.coarsenTarget() ) │ │ │ │ │ +458 nodomains=1; │ │ │ │ │ +459 │ │ │ │ │ +460 bool existentOnNextLevel = │ │ │ │ │ +461 _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, │ │ │ │ │ +462 redistComm, redistributes_.back(), nodomains, │ │ │ │ │ +463 criterion); │ │ │ │ │ +464 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ │ +465 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ │ +466 dunknowns= unknownsRedist.todouble(); │ │ │ │ │ +467 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ │ +468 std::cout<<"Level "<communicator().size() │ │ │ │ │ +469 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ +()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +(args)); │ │ │ │ │ +472 assert(mlevel.isRedistributed()); │ │ │ │ │ +473 infoLevel.addRedistributed(redistComm); │ │ │ │ │ +474 infoLevel->freeGlobalLookup(); │ │ │ │ │ +475 │ │ │ │ │ +476 if(!existentOnNextLevel) │ │ │ │ │ +477 // We do not hold any data on the redistributed partitioning │ │ │ │ │ +478 break; │ │ │ │ │ +479 │ │ │ │ │ +480 // Work on the redistributed Matrix from now on │ │ │ │ │ +481 matrix = &(mlevel.getRedistributed()); │ │ │ │ │ +482 info = &(infoLevel.getRedistributed()); │ │ │ │ │ +483 info->buildGlobalLookup(matrix->getmat().N()); │ │ │ │ │ +484 } │ │ │ │ │ +485 │ │ │ │ │ +486 rank = info->communicator().rank(); │ │ │ │ │ +487 if(dunknowns <= criterion.coarsenTarget()) │ │ │ │ │ +488 // No further coarsening needed │ │ │ │ │ +489 break; │ │ │ │ │ +490 │ │ │ │ │ +491 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; │ │ │ │ │ +492 typedef typename GraphCreator::PropertiesGraph _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ │ +493 typedef typename GraphCreator::GraphTuple GraphTuple; │ │ │ │ │ +494 │ │ │ │ │ +495 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; │ │ │ │ │ +496 │ │ │ │ │ +497 std::vector excluded(matrix->getmat().N(), false); │ │ │ │ │ +498 │ │ │ │ │ +499 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, │ │ │ │ │ +OverlapFlags()); │ │ │ │ │ +500 │ │ │ │ │ +501 _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); │ │ │ │ │ +502 │ │ │ │ │ +503 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ │ +504 │ │ │ │ │ +505 Timer watch; │ │ │ │ │ +506 watch.reset(); │ │ │ │ │ +507 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] = │ │ │ │ │ +508 aggregatesMap->_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(matrix->getmat(), *(std::get<1>(graphs)), │ │ │ │ │ +criterion, level==0); │ │ │ │ │ +509 │ │ │ │ │ +510 if(rank==0 && criterion.debugLevel()>2) │ │ │ │ │ +511 std::cout<<" Have built "<communicator().rank(); │ │ │ │ │ +519 int n = UNKNOWNS/procs; // number of unknowns per process │ │ │ │ │ +520 int bigger = UNKNOWNS%procs; // number of process with n+1 unknows │ │ │ │ │ +521 │ │ │ │ │ +522 // Compute owner region │ │ │ │ │ +523 if(rank0) │ │ │ │ │ +533 overlapStart = start - 1; │ │ │ │ │ +534 else │ │ │ │ │ +535 overlapStart = start; │ │ │ │ │ +536 │ │ │ │ │ +537 if(end_n_o_V_e_r_t_i_c_e_s()); │ │ │ │ │ +543 for(int j=0; j< UNKNOWNS; ++j) │ │ │ │ │ +544 for(int i=0; i < UNKNOWNS; ++i) │ │ │ │ │ +545 { │ │ │ │ │ +546 if(i>=overlapStart && i1 && info->communicator().rank()==0) │ │ │ │ │ +555 std::cout<<"aggregating finished."<communicator().sum(gnoAggregates); │ │ │ │ │ +559 double dgnoAggregates = gnoAggregates.todouble(); │ │ │ │ │ +560#ifdef TEST_AGGLO │ │ │ │ │ +561 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2); │ │ │ │ │ +562#endif │ │ │ │ │ +563 │ │ │ │ │ +564 if(criterion.debugLevel()>2 && rank==0) │ │ │ │ │ +565 std::cout << "Building "<0) │ │ │ │ │ +572 std::cerr << "Stopped coarsening because of rate breakdown "<_f_r_e_e(); │ │ │ │ │ +579 delete aggregatesMap; │ │ │ │ │ +580 aggregatesMaps_.pop_back(); │ │ │ │ │ +581 │ │ │ │ │ +582 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator │ │ │ │ │ +().size()>1) { │ │ │ │ │ +583 // coarse level matrix was already redistributed, but to more than 1 │ │ │ │ │ +process │ │ │ │ │ +584 // Therefore need to delete the redistribution. Further down it will │ │ │ │ │ +585 // then be redistributed to 1 process │ │ │ │ │ +586 delete &(mlevel.getRedistributed().getmat()); │ │ │ │ │ +587 mlevel.deleteRedistributed(); │ │ │ │ │ +588 delete &(infoLevel.getRedistributed()); │ │ │ │ │ +589 infoLevel.deleteRedistributed(); │ │ │ │ │ +590 redistributes_.back().resetSetup(); │ │ │ │ │ +591 } │ │ │ │ │ +592 │ │ │ │ │ +593 break; │ │ │ │ │ +594 } │ │ │ │ │ +595 unknowns = noAggregates; │ │ │ │ │ +596 dunknowns = dgnoAggregates; │ │ │ │ │ +597 │ │ │ │ │ +598 CommunicationArgs commargs(info->communicator(),info->category()); │ │ │ │ │ +599 parallelInformation_.addCoarser(commargs); │ │ │ │ │ +600 │ │ │ │ │ +601 ++infoLevel; // parallel information on coarse level │ │ │ │ │ +602 │ │ │ │ │ +603 typename PropertyMapTypeSelector::Type │ │ │ │ │ +visitedMap = │ │ │ │ │ +604 _g_e_t(_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g(), *(std::get<1>(graphs))); │ │ │ │ │ +605 │ │ │ │ │ +606 watch.reset(); │ │ │ │ │ +607 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_> │ │ │ │ │ +608_ _:_:_c_o_a_r_s_e_n(*info, │ │ │ │ │ +609 *(std::get<1>(graphs)), │ │ │ │ │ +610 visitedMap, │ │ │ │ │ +611 *aggregatesMap, │ │ │ │ │ +612 *infoLevel, │ │ │ │ │ +613 noAggregates); │ │ │ │ │ +614 GraphCreator::free(graphs); │ │ │ │ │ +615 │ │ │ │ │ +616 if(criterion.debugLevel()>2) { │ │ │ │ │ +617 if(rank==0) │ │ │ │ │ +618 std::cout<<"Coarsening of index sets took "<buildGlobalLookup(aggregates); │ │ │ │ │ +624 _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, │ │ │ │ │ +625 *info, │ │ │ │ │ +626 infoLevel->globalLookup()); │ │ │ │ │ +627 │ │ │ │ │ +628 │ │ │ │ │ +629 if(criterion.debugLevel()>2) { │ │ │ │ │ +630 if(rank==0) │ │ │ │ │ +631 std::cout<<"Communicating global aggregate numbers took "<& visited=excluded; │ │ │ │ │ +636 │ │ │ │ │ +637 typedef std::vector::iterator Iterator; │ │ │ │ │ +638 typedef IteratorPropertyMap VisitedMap2; │ │ │ │ │ +639 Iterator end = visited.end(); │ │ │ │ │ +640 for(Iterator iter= visited.begin(); iter != end; ++iter) │ │ │ │ │ +641 *iter=false; │ │ │ │ │ +642 │ │ │ │ │ +643 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap()); │ │ │ │ │ +644 │ │ │ │ │ +645 std::shared_ptr │ │ │ │ │ +646 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2, │ │ │ │ │ +647 *info, │ │ │ │ │ +648 *aggregatesMap, │ │ │ │ │ +649 aggregates, │ │ │ │ │ +650 OverlapFlags())); │ │ │ │ │ +651 dverb<<"Building of sparsity pattern took "<freeGlobalLookup(); │ │ │ │ │ +654 │ │ │ │ │ +655 delete std::get<0>(graphs); │ │ │ │ │ +656 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, │ │ │ │ │ +*infoLevel, OverlapFlags()); │ │ │ │ │ +657 │ │ │ │ │ +658 if(criterion.debugLevel()>2) { │ │ │ │ │ +659 if(rank==0) │ │ │ │ │ +660 std::cout<<"Calculation entries of Galerkin product took "<communicator().sum(nonzeros); │ │ │ │ │ +665 MatrixArgs args(coarseMatrix, *infoLevel); │ │ │ │ │ +666 │ │ │ │ │ +667 matrices_.addCoarser(args); │ │ │ │ │ +668 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ │ +669 } // end level loop │ │ │ │ │ +670 │ │ │ │ │ +671 │ │ │ │ │ +672 infoLevel->freeGlobalLookup(); │ │ │ │ │ +673 │ │ │ │ │ +674 built_=true; │ │ │ │ │ +675 _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); │ │ │ │ │ +676 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ │ +677 │ │ │ │ │ +678 if(criterion.debugLevel()>0) { │ │ │ │ │ +679 if(level==criterion.maxLevel()) { │ │ │ │ │ +680 BIGINT unknownsLevel = mlevel->getmat().N(); │ │ │ │ │ +681 unknownsLevel = infoLevel->communicator().sum(unknownsLevel); │ │ │ │ │ +682 double dunknownsLevel = unknownsLevel.todouble(); │ │ │ │ │ +683 if(rank==0 && criterion.debugLevel()>1) { │ │ │ │ │ +684 std::cout<<"Level "<communicator().size() │ │ │ │ │ +685 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ +()<<")"<communicator().size()>1) { │ │ │ │ │ +692#if HAVE_MPI && !HAVE_PARMETIS │ │ │ │ │ +693 if(criterion.accumulate()==_s_u_c_c_e_s_s_i_v_e_A_c_c_u && │ │ │ │ │ +694 infoLevel->communicator().rank()==0) │ │ │ │ │ +695 std::cerr<<"Successive accumulation of data on coarse levels only works │ │ │ │ │ +with ParMETIS installed." │ │ │ │ │ +696 <<" Fell back to accumulation to one domain on coarsest level"< redistMat = std::make_shared(); │ │ │ │ │ +701 std::shared_ptr redistComm; │ │ │ │ │ +702 int nodomains = 1; │ │ │ │ │ +703 │ │ │ │ │ +704 _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, │ │ │ │ │ +705 redistComm, redistributes_.back(), nodomains,criterion); │ │ │ │ │ +706 MatrixArgs args(redistMat, *redistComm); │ │ │ │ │ +707 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ │ +708 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ │ +709 │ │ │ │ │ +710 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) { │ │ │ │ │ +711 double dunknownsRedist = unknownsRedist.todouble(); │ │ │ │ │ +712 std::cout<<"Level "<communicator().size() │ │ │ │ │ +713 <<" unknowns per proc (procs="<communicator().size │ │ │ │ │ +()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +(args)); │ │ │ │ │ +716 infoLevel.addRedistributed(redistComm); │ │ │ │ │ +717 infoLevel->freeGlobalLookup(); │ │ │ │ │ +718 } │ │ │ │ │ +719 │ │ │ │ │ +720 int levels = matrices_.levels(); │ │ │ │ │ +721 maxlevels_ = parallelInformation_.finest()->communicator().max(levels); │ │ │ │ │ +722 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ │ +723 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1) │ │ │ │ │ +724 std::cout<<"operator complexity: "< │ │ │ │ │ +729 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_0 _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 │ │ │ │ │ +731 { │ │ │ │ │ +732 return matrices_; │ │ │ │ │ +733 } │ │ │ │ │ +734 │ │ │ │ │ +735 template │ │ │ │ │ +736 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_3_7 _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 │ │ │ │ │ +738 { │ │ │ │ │ +739 return parallelInformation_; │ │ │ │ │ +740 } │ │ │ │ │ +741 │ │ │ │ │ +742 template │ │ │ │ │ +_7_4_3 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 │ │ │ │ │ +744 { │ │ │ │ │ +745 int levels=aggregatesMaps().size(); │ │ │ │ │ +746 int maxlevels=parallelInformation_._f_i_n_e_s_t()->communicator().max(levels); │ │ │ │ │ +747 std::size_t size=(*(aggregatesMaps().begin()))->noVertices(); │ │ │ │ │ +748 // We need an auxiliary vector for the consecutive prolongation. │ │ │ │ │ +749 std::vector tmp; │ │ │ │ │ +750 std::vector *coarse, *fine; │ │ │ │ │ +751 │ │ │ │ │ +752 // make sure the allocated space suffices. │ │ │ │ │ +753 tmp.reserve(size); │ │ │ │ │ +754 data.reserve(size); │ │ │ │ │ +755 │ │ │ │ │ +756 // Correctly assign coarse and fine for the first prolongation such that │ │ │ │ │ +757 // we end up in data in the end. │ │ │ │ │ +758 if(levels%2==0) { │ │ │ │ │ +759 coarse=&tmp; │ │ │ │ │ +760 fine=&data; │ │ │ │ │ +761 }else{ │ │ │ │ │ +762 coarse=&data; │ │ │ │ │ +763 fine=&tmp; │ │ │ │ │ +764 } │ │ │ │ │ +765 │ │ │ │ │ +766 // Number the unknowns on the coarsest level consecutively for each │ │ │ │ │ +process. │ │ │ │ │ +767 if(levels==maxlevels) { │ │ │ │ │ +768 const _A_g_g_r_e_g_a_t_e_s_M_a_p& map = *(*(++aggregatesMaps().rbegin())); │ │ │ │ │ +769 std::size_t m=0; │ │ │ │ │ +770 │ │ │ │ │ +771 for(typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r iter = map._b_e_g_i_n(); iter != │ │ │ │ │ +map._e_n_d(); ++iter) │ │ │ │ │ +772 if(*iter< _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) │ │ │ │ │ +773 m=std::max(*iter,m); │ │ │ │ │ +774 │ │ │ │ │ +775 coarse->resize(m+1); │ │ │ │ │ +776 std::size_t i=0; │ │ │ │ │ +777 srand((unsigned)std::clock()); │ │ │ │ │ +778 std::set used; │ │ │ │ │ +779 for(typename std::vector::iterator iter=coarse->begin(); iter │ │ │ │ │ +!= coarse->end(); │ │ │ │ │ +780 ++iter, ++i) │ │ │ │ │ +781 { │ │ │ │ │ +782 std::pair::iterator,bool> ibpair │ │ │ │ │ +783 = used.insert(static_cast((((double)rand())/ │ │ │ │ │ +(RAND_MAX+1.0)))*coarse->size()); │ │ │ │ │ +784 │ │ │ │ │ +785 while(!ibpair.second) │ │ │ │ │ +786 ibpair = used.insert(static_cast((((double)rand())/ │ │ │ │ │ +(RAND_MAX+1.0))*coarse->size())); │ │ │ │ │ +787 *iter=*(ibpair.first); │ │ │ │ │ +788 } │ │ │ │ │ +789 } │ │ │ │ │ +790 │ │ │ │ │ +791 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r pinfo = parallelInformation │ │ │ │ │ +().coarsest(); │ │ │ │ │ +792 --pinfo; │ │ │ │ │ +793 │ │ │ │ │ +794 // Now consecutively project the numbers to the finest level. │ │ │ │ │ +795 for(typename AggregatesMapList::const_reverse_iterator │ │ │ │ │ +aggregates=++aggregatesMaps().rbegin(); │ │ │ │ │ +796 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) { │ │ │ │ │ +797 │ │ │ │ │ +798 fine->resize((*aggregates)->noVertices()); │ │ │ │ │ +799 fine->assign(fine->size(), 0); │ │ │ │ │ +800 _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> │ │ │ │ │ +801 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast │ │ │ │ │ +(1), *pinfo); │ │ │ │ │ +802 --pinfo; │ │ │ │ │ +803 std::swap(coarse, fine); │ │ │ │ │ +804 } │ │ │ │ │ +805 │ │ │ │ │ +806 // Assertion to check that we really projected to data on the last step. │ │ │ │ │ +807 assert(coarse==&data); │ │ │ │ │ +808 } │ │ │ │ │ +809 │ │ │ │ │ +810 template │ │ │ │ │ +811 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_2 _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 │ │ │ │ │ +813 { │ │ │ │ │ +814 return aggregatesMaps_; │ │ │ │ │ +815 } │ │ │ │ │ +816 template │ │ │ │ │ +817 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_1_8 _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 │ │ │ │ │ +819 { │ │ │ │ │ +820 return redistributes_; │ │ │ │ │ +821 } │ │ │ │ │ +822 │ │ │ │ │ +823 template │ │ │ │ │ +_8_2_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_x_H_i_e_r_a_r_c_h_y() │ │ │ │ │ +825 { │ │ │ │ │ +826 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator; │ │ │ │ │ +827 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; │ │ │ │ │ +828 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; │ │ │ │ │ +829 │ │ │ │ │ +830 AggregatesMapIterator amap = aggregatesMaps_.rbegin(); │ │ │ │ │ +831 InfoIterator info = parallelInformation_.coarsest(); │ │ │ │ │ +832 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level │ │ │ │ │ +!= finest; --level, --info, ++amap) { │ │ │ │ │ +833 (*amap)->free(); │ │ │ │ │ +834 delete *amap; │ │ │ │ │ +835 } │ │ │ │ │ +836 delete *amap; │ │ │ │ │ +837 } │ │ │ │ │ +838 │ │ │ │ │ +839 template │ │ │ │ │ +840 template │ │ │ │ │ +_8_4_1 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 │ │ │ │ │ +842 { │ │ │ │ │ +843 assert(hierarchy.levels()==1); │ │ │ │ │ +844 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; │ │ │ │ │ +845 typedef typename RedistributeInfoList::const_iterator RIter; │ │ │ │ │ +846 RIter redist = redistributes_.begin(); │ │ │ │ │ +847 │ │ │ │ │ +848 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest(); │ │ │ │ │ +849 int level=0; │ │ │ │ │ +850 if(redist->isSetup()) │ │ │ │ │ +851 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ │ +()); │ │ │ │ │ +852 Dune::dvverb<<"Level "<getmat().N()<<" │ │ │ │ │ +unknowns!"<getmat().N()<<" │ │ │ │ │ +unknowns!"<getmat().N()); │ │ │ │ │ +859 if(redist->isSetup()) │ │ │ │ │ +860 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ │ +()); │ │ │ │ │ +861 │ │ │ │ │ +862 } │ │ │ │ │ +863 │ │ │ │ │ +864 } │ │ │ │ │ +865 │ │ │ │ │ +866 template │ │ │ │ │ +867 template │ │ │ │ │ +_8_6_8 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, │ │ │ │ │ +869 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 │ │ │ │ │ +870 { │ │ │ │ │ +871 assert(smoothers._l_e_v_e_l_s()==0); │ │ │ │ │ +872 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; │ │ │ │ │ +873 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; │ │ │ │ │ +874 typedef typename AggregatesMapList::const_iterator AggregatesIterator; │ │ │ │ │ +875 │ │ │ │ │ +876 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; │ │ │ │ │ +877 cargs.setArgs(sargs); │ │ │ │ │ +878 PinfoIterator pinfo = parallelInformation_.finest(); │ │ │ │ │ +879 AggregatesIterator aggregates = aggregatesMaps_.begin(); │ │ │ │ │ +880 int level=0; │ │ │ │ │ +881 for(MatrixIterator matrix = matrices_.finest(), coarsest = │ │ │ │ │ +matrices_.coarsest(); │ │ │ │ │ +882 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) { │ │ │ │ │ +883 cargs.setMatrix(matrix->getmat(), **aggregates); │ │ │ │ │ +884 cargs.setComm(*pinfo); │ │ │ │ │ +885 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ │ +886 } │ │ │ │ │ +887 if(maxlevels()>levels()) { │ │ │ │ │ +888 // This is not the globally coarsest level and therefore smoothing is │ │ │ │ │ +needed │ │ │ │ │ +889 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates); │ │ │ │ │ +890 cargs.setComm(*pinfo); │ │ │ │ │ +891 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ │ +892 ++level; │ │ │ │ │ +893 } │ │ │ │ │ +894 } │ │ │ │ │ +895 │ │ │ │ │ +896 template │ │ │ │ │ +897 template │ │ │ │ │ +_8_9_8 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) │ │ │ │ │ +899 { │ │ │ │ │ +900 typedef typename AggregatesMapList::iterator AggregatesMapIterator; │ │ │ │ │ +901 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; │ │ │ │ │ +902 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; │ │ │ │ │ +903 │ │ │ │ │ +904 AggregatesMapIterator amap = aggregatesMaps_.begin(); │ │ │ │ │ +905 _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t productBuilder; │ │ │ │ │ +906 InfoIterator info = parallelInformation_.finest(); │ │ │ │ │ +907 typename RedistributeInfoList::iterator riIter = redistributes_.begin(); │ │ │ │ │ +908 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest(); │ │ │ │ │ +909 if(level.isRedistributed()) { │ │ │ │ │ +910 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ │ +911 _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()), │ │ │ │ │ +912 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), │ │ │ │ │ +913 *info,info.getRedistributed(), *riIter); │ │ │ │ │ +914 info->freeGlobalLookup(); │ │ │ │ │ +915 } │ │ │ │ │ +916 │ │ │ │ │ +917 for(; level!=coarsest; ++amap) { │ │ │ │ │ +918 const _M_a_t_r_i_x& fine = (level.isRedistributed() ? level.getRedistributed() : │ │ │ │ │ +*level).getmat(); │ │ │ │ │ +919 ++level; │ │ │ │ │ +920 ++info; │ │ │ │ │ +921 ++riIter; │ │ │ │ │ +922 productBuilder._c_a_l_c_u_l_a_t_e(fine, *(*amap), const_cast<_M_a_t_r_i_x&>(level->getmat │ │ │ │ │ +()), *info, copyFlags); │ │ │ │ │ +923 if(level.isRedistributed()) { │ │ │ │ │ +924 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ │ +925 _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()), │ │ │ │ │ +926 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), *info, │ │ │ │ │ +927 info.getRedistributed(), *riIter); │ │ │ │ │ +928 info->freeGlobalLookup(); │ │ │ │ │ +929 } │ │ │ │ │ +930 } │ │ │ │ │ +931 } │ │ │ │ │ +932 │ │ │ │ │ +933 template │ │ │ │ │ +_9_3_4 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 │ │ │ │ │ +935 { │ │ │ │ │ +936 return matrices_.levels(); │ │ │ │ │ +937 } │ │ │ │ │ +938 │ │ │ │ │ +939 template │ │ │ │ │ +_9_4_0 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 │ │ │ │ │ +941 { │ │ │ │ │ +942 return maxlevels_; │ │ │ │ │ +943 } │ │ │ │ │ +944 │ │ │ │ │ +945 template │ │ │ │ │ +_9_4_6 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 │ │ │ │ │ +947 { │ │ │ │ │ +948 return levels()==maxlevels() && │ │ │ │ │ +949 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N │ │ │ │ │ +()>0); │ │ │ │ │ +950 } │ │ │ │ │ +951 │ │ │ │ │ +952 template │ │ │ │ │ +_9_5_3 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 │ │ │ │ │ +954 { │ │ │ │ │ +955 return built_; │ │ │ │ │ +956 } │ │ │ │ │ +957 │ │ │ │ │ +959 } // namespace Amg │ │ │ │ │ +960} // namespace Dune │ │ │ │ │ +961 │ │ │ │ │ +962#endif // end DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ │ +_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. │ │ │ │ │ +_m_a_t_r_i_x_u_t_i_l_s_._h_h │ │ │ │ │ +Some handy generic functions for ISTL matrices. │ │ │ │ │ +_g_a_l_e_r_k_i_n_._h_h │ │ │ │ │ +Provides a class for building the galerkin product based on a aggregation │ │ │ │ │ +scheme. │ │ │ │ │ +_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ │ +Provdes class for identifying aggregates globally. │ │ │ │ │ +_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 │ │ │ │ │ -_p_i_n_f_o_._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: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_:_:_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:116 │ │ │ │ │ -_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: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_:_:_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:134 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ │ -ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ │ -The type of the local index. │ │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ -T ParallelInformation │ │ │ │ │ -The type of the parallel information. │ │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ │ -Attribute attribute() │ │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh: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_:_:_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:127 │ │ │ │ │ -_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) │ │ │ │ │ -Build the coarse index set after the aggregatio. │ │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:229 │ │ │ │ │ +_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. │ │ │ │ │ +_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_r_a_p_h_._h_h │ │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ │ +_s_m_o_o_t_h_e_r_._h_h │ │ │ │ │ +Classes for the generic construction and application of the smoothers. │ │ │ │ │ +_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. │ │ │ │ │ +_d_e_p_e_n_d_e_n_c_y_._h_h │ │ │ │ │ +Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ │ +_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:812 │ │ │ │ │ +_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:953 │ │ │ │ │ +_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:946 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ │ +std::size_t levels() const │ │ │ │ │ +Get the number of levels in the hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ │ +std::size_t levels() const │ │ │ │ │ +Get the number of levels in the hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:934 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ │ +void addCoarser(Arguments &args) │ │ │ │ │ +Add an element on a coarser level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +const RedistributeInfoList & redistributeInformation() const │ │ │ │ │ +Get the hierarchy of the information about redistributions,. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:818 │ │ │ │ │ +_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:737 │ │ │ │ │ +_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:313 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ │ +const_iterator begin() const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_m_a_t_r_i_c_e_s │ │ │ │ │ +const ParallelMatrixHierarchy & matrices() const │ │ │ │ │ +Get the matrix hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:730 │ │ │ │ │ +_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:940 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ │ static const V ISOLATED │ │ │ │ │ Identifier of isolated vertices. │ │ │ │ │ DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_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:150 │ │ │ │ │ -_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:165 │ │ │ │ │ -_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_:_:_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:110 │ │ │ │ │ -_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:160 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +_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:898 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ +const void * Arguments │ │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ +std::size_t noVertices() const │ │ │ │ │ +Get the number of vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_V_e_c_t_o_r │ │ │ │ │ +void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const │ │ │ │ │ +Coarsen the vector hierarchy according to the matrix hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:841 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ +const AggregateDescriptor * const_iterator │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ +MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< │ │ │ │ │ +ParallelInformation > pinfo=std::make_shared< ParallelInformation >()) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:389 │ │ │ │ │ +_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:232 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ │ +Iterator finest() │ │ │ │ │ +Get an iterator positioned at the finest level. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_b_u_i_l_d │ │ │ │ │ +void build(const T &criterion) │ │ │ │ │ +Build the matrix hierarchy using aggregation. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:400 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_f_r_e_e │ │ │ │ │ +void free() │ │ │ │ │ +Free the allocated memory. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_S_m_o_o_t_h_e_r │ │ │ │ │ +void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename │ │ │ │ │ +SmootherTraits< S >::Arguments &args) const │ │ │ │ │ +Coarsen the smoother hierarchy according to the matrix hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:868 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y │ │ │ │ │ +void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, │ │ │ │ │ +bool finestLevel) │ │ │ │ │ +Build the dependency of the matrix graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s │ │ │ │ │ +std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, │ │ │ │ │ +const C &criterion, bool finestLevel) │ │ │ │ │ +Build the aggregates. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_:_:_c_a_l_c_u_l_a_t_e │ │ │ │ │ +void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, │ │ │ │ │ +const I &pinfo, const O ©) │ │ │ │ │ +Calculate the galerkin product. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t │ │ │ │ │ +void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const │ │ │ │ │ +Get the mapping of fine level unknowns to coarse level aggregates. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:743 │ │ │ │ │ +_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:824 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S │ │ │ │ │ +@ MAX_PROCESSES │ │ │ │ │ +Hard limit for the number of processes allowed. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ │ +@ atOnceAccu │ │ │ │ │ +Accumulate data to one process at once. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:244 │ │ │ │ │ +_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:248 │ │ │ │ │ _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_:_:_O_w_n_e_r_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_:_:_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:829 │ │ │ │ │ +_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:1235 │ │ │ │ │ +_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:395 │ │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ +derive error class from the base class in common │ │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +Type for indices and sizes. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:577 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ +MatrixImp::DenseMatrixBase< T, A >::window_type row_type │ │ │ │ │ +The type implementing a matrix row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:574 │ │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +Class representing the properties of an ede in the matrix graph. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +Class representing a node in the matrix graph. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ │ +DDeeffiinniittiioonn galerkin.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ │ +DDeeffiinniittiioonn galerkin.hh:118 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +The (undirected) graph of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ │ +The vertex descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:988 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:22 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ │ +A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > │ │ │ │ │ +Iterator │ │ │ │ │ +Type of the mutable iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const │ │ │ │ │ +MatrixOperator > ConstIterator │ │ │ │ │ +Type of the const iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ │ DDeeffiinniittiioonn indicescoarsener.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_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_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ +The hierarchies build by the coarsening process. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_A_l_l_o_c_a_t_o_r │ │ │ │ │ +typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ │ +AggregatesMap * > AAllocator │ │ │ │ │ +Allocator for pointers. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ +Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ │ +ParallelInformationHierarchy │ │ │ │ │ +The type of the parallel informarion hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t │ │ │ │ │ +std::list< AggregatesMap *, AAllocator > AggregatesMapList │ │ │ │ │ +The type of the aggregates maps list. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:88 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +PI ParallelInformation │ │ │ │ │ +The type of the index set. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ +Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy │ │ │ │ │ +The type of the parallel matrix hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:79 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ │ +A Allocator │ │ │ │ │ +The allocator to use. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e │ │ │ │ │ +RedistributeInformation< ParallelInformation > RedistributeInfoType │ │ │ │ │ +The type of the redistribute information. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:91 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ │ +double getProlongationDampingFactor() const │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:188 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_I_L_A_l_l_o_c_a_t_o_r │ │ │ │ │ +typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ │ +RedistributeInfoType > RILAllocator │ │ │ │ │ +Allocator for RedistributeInfoType. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t │ │ │ │ │ +std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList │ │ │ │ │ +The type of the list of redistribute information. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:97 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > │ │ │ │ │ +AggregatesMap │ │ │ │ │ +The type of the aggregates map we use. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x │ │ │ │ │ +MatrixOperator::matrix_type Matrix │ │ │ │ │ +The type of the matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ │ +M MatrixOperator │ │ │ │ │ +The type of the matrix operator. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +void operator()(const matrix_row &row) │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:254 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_t_r_i_x___r_o_w │ │ │ │ │ +Matrix::row_type matrix_row │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:245 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_i_n │ │ │ │ │ +size_type min │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:261 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_c_a_l_c │ │ │ │ │ +calc() │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:247 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_x │ │ │ │ │ +size_type max │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:262 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_u_m │ │ │ │ │ +size_type sum │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:244 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ +The criterion describing the stop criteria for the coarsening process. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:283 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ +CoarsenCriterion(const Dune::Amg::Parameters &parms) │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:306 │ │ │ │ │ +_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) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:301 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +All parameters for AMG. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:16 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -void operator++() │ │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -void operator()(const typename G::ConstEdgeIterator &edge) │ │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_n_u_m_b_e_r__ │ │ │ │ │ -Vertex number_ │ │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ +Tag idnetifying the visited property of a vertex. │ │ │ │ │ +DDeeffiinniittiioonn properties.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ +The default class for the smoother arguments. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ │ +Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ │ +newly introduced virtu... │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00158.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: twolevelmethod.hh File Reference │ │ │ │ +dune-istl: indicescoarsener.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,51 +72,50 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ - │ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Algebraic twolevel methods. │ │ │ │ +

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

│ │ │ │ -
#include <tuple>
│ │ │ │ -#include <dune/istl/operators.hh>
│ │ │ │ -#include "amg.hh"
│ │ │ │ -#include "galerkin.hh"
│ │ │ │ -#include <dune/istl/solver.hh>
│ │ │ │ +
#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::LevelTransferPolicy< FO, CO >
 Abstract base class for transfer between levels and creation of the coarse level system. More...
class  Dune::Amg::IndicesCoarsener< T, E >
 
class  Dune::Amg::AggregationLevelTransferPolicy< O, C >
 A LeveTransferPolicy that used aggregation to construct the coarse level system. More...
class  Dune::Amg::ParallelIndicesCoarsener< T, E >
 
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::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E >
 Coarsen Indices in the parallel case. More...
 
class  Dune::Amg::TwoLevelMethod< FO, CSP, S >
class  Dune::Amg::IndicesCoarsener< SequentialInformation, E >
 Coarsen Indices in the sequential case. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ │

Detailed Description

│ │ │ │ -

Algebraic twolevel methods.

│ │ │ │ +

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

│ │ │ │
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,43 +2,41 @@ │ │ │ │ │ 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 │ │ │ │ │ +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 │ │ │ │ │ -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> │ │ │ │ │ +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_:_:_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_:_:_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_:_:_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_:_:_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 │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Algebraic twolevel methods. │ │ │ │ │ +Provides a class for building the index set and remote indices on the coarse │ │ │ │ │ +level. │ │ │ │ │ Author │ │ │ │ │ Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00158_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: twolevelmethod.hh Source File │ │ │ │ +dune-istl: indicescoarsener.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,478 +74,436 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
twolevelmethod.hh
│ │ │ │ +
indicescoarsener.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_INDICESCOARSENER_HH
│ │ │ │ +
6#define DUNE_AMG_INDICESCOARSENER_HH
│ │ │ │
7
│ │ │ │ -
8#include <tuple>
│ │ │ │ -
9
│ │ │ │ - │ │ │ │ -
11#include"amg.hh"
│ │ │ │ -
12#include"galerkin.hh"
│ │ │ │ -
13#include<dune/istl/solver.hh>
│ │ │ │ -
14
│ │ │ │ -
22namespace Dune
│ │ │ │ -
23{
│ │ │ │ -
24namespace Amg
│ │ │ │ -
25{
│ │ │ │ -
26
│ │ │ │ -
36template<class FO, class CO>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
38{
│ │ │ │ -
39public:
│ │ │ │ -
44 typedef FO FineOperatorType;
│ │ │ │ -
48 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ │ -
52 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ │ - │ │ │ │ -
61 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ │ -
65 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ │ -
│ │ │ │ -
70 std::shared_ptr<CoarseOperatorType>& getCoarseLevelOperator()
│ │ │ │ -
71 {
│ │ │ │ -
72 return operator_;
│ │ │ │ -
73 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
79 {
│ │ │ │ -
80 return rhs_;
│ │ │ │ -
81 }
│ │ │ │ -
│ │ │ │ -
82
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
88 {
│ │ │ │ -
89 return lhs_;
│ │ │ │ -
90 }
│ │ │ │ -
│ │ │ │ -
100 virtual void moveToCoarseLevel(const FineRangeType& fineRhs)=0;
│ │ │ │ -
110 virtual void moveToFineLevel(FineDomainType& fineLhs)=0;
│ │ │ │ -
118 virtual void createCoarseLevelSystem(const FineOperatorType& fineOperator)=0;
│ │ │ │ -
119
│ │ │ │ -
121 virtual LevelTransferPolicy* clone() const =0;
│ │ │ │ -
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;
│ │ │ │ - │ │ │ │ +
8#include <dune/common/parallel/indicessyncer.hh>
│ │ │ │ +
9#include <vector>
│ │ │ │ +
10#include "renumberer.hh"
│ │ │ │ +
11
│ │ │ │ +
12#if HAVE_MPI
│ │ │ │ + │ │ │ │ +
14#endif
│ │ │ │ +
15
│ │ │ │ +
16#include "pinfo.hh"
│ │ │ │ +
17
│ │ │ │ +
18namespace Dune
│ │ │ │ +
19{
│ │ │ │ +
20 namespace Amg
│ │ │ │ +
21 {
│ │ │ │ +
22
│ │ │ │ +
34 template<typename T, typename E>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
36 {};
│ │ │ │ +
│ │ │ │ +
37
│ │ │ │ +
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
│ │ │ │ +
88 template<typename Graph, typename VM>
│ │ │ │ +
89 static typename Graph::VertexDescriptor
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
91 Graph& fineGraph,
│ │ │ │ +
92 VM& visitedMap,
│ │ │ │ + │ │ │ │ +
94 ParallelInformation& coarseInfo,
│ │ │ │ +
95 typename Graph::VertexDescriptor noAggregates);
│ │ │ │ +
96
│ │ │ │ +
97 private:
│ │ │ │ +
98 template<typename G, typename I>
│ │ │ │ +
99 class ParallelAggregateRenumberer : public AggregateRenumberer<G>
│ │ │ │ +
100 {
│ │ │ │ +
101 typedef typename G::VertexDescriptor Vertex;
│ │ │ │ +
102
│ │ │ │ +
103 typedef I GlobalLookupIndexSet;
│ │ │ │ +
104
│ │ │ │ +
105 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ │ +
106
│ │ │ │ +
107 typedef typename IndexPair::GlobalIndex GlobalIndex;
│ │ │ │ +
108
│ │ │ │ +
109 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
111 : AggregateRenumberer<G>(aggregates), isPublic_(false), lookup_(lookup),
│ │ │ │ +
112 globalIndex_(std::numeric_limits<GlobalIndex>::max())
│ │ │ │ +
113 {}
│ │ │ │ +
│ │ │ │ +
114
│ │ │ │ +
115
│ │ │ │ +
│ │ │ │ +
116 void operator()(const typename G::ConstEdgeIterator& edge)
│ │ │ │ +
117 {
│ │ │ │ + │ │ │ │ +
119 const IndexPair* pair= lookup_.pair(edge.target());
│ │ │ │ +
120 if(pair!=0) {
│ │ │ │ +
121 globalIndex(pair->global());
│ │ │ │ +
122 attribute(pair->local().attribute());
│ │ │ │ +
123 isPublic(pair->local().isPublic());
│ │ │ │ +
124 }
│ │ │ │ +
125 }
│ │ │ │ +
│ │ │ │ +
126
│ │ │ │ +
│ │ │ │ +
127 Vertex operator()([[maybe_unused]] const GlobalIndex& global)
│ │ │ │ +
128 {
│ │ │ │ +
129 Vertex current = this->number_;
│ │ │ │ +
130 this->operator++();
│ │ │ │ +
131 return current;
│ │ │ │ +
132 }
│ │ │ │ +
│ │ │ │ +
133
│ │ │ │ +
│ │ │ │ +
134 bool isPublic()
│ │ │ │ +
135 {
│ │ │ │ +
136 return isPublic_;
│ │ │ │ +
137 }
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
│ │ │ │ +
139 void isPublic(bool b)
│ │ │ │ +
140 {
│ │ │ │ +
141 isPublic_ = isPublic_ || b;
│ │ │ │ +
142 }
│ │ │ │ +
│ │ │ │ +
143
│ │ │ │ +
│ │ │ │ +
144 void reset()
│ │ │ │ +
145 {
│ │ │ │ +
146 globalIndex_ = std::numeric_limits<GlobalIndex>::max();
│ │ │ │ +
147 isPublic_=false;
│ │ │ │ +
148 }
│ │ │ │ +
│ │ │ │
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;
│ │ │ │ + │ │ │ │ +
151 {
│ │ │ │ +
152 attribute_=attribute;
│ │ │ │ +
153 }
│ │ │ │ +
│ │ │ │ +
154
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
156 {
│ │ │ │ +
157 return attribute_;
│ │ │ │ +
158 }
│ │ │ │ +
│ │ │ │ +
159
│ │ │ │ +
│ │ │ │ +
160 const GlobalIndex& globalIndex() const
│ │ │ │ +
161 {
│ │ │ │ +
162 return globalIndex_;
│ │ │ │ +
163 }
│ │ │ │ +
│ │ │ │
164
│ │ │ │ -
165 aggregatesMap_ = std::make_shared<AggregatesMap>(pg.maxVertex()+1);
│ │ │ │ -
166
│ │ │ │ -
167 int noAggregates, isoAggregates, oneAggregates, skippedAggregates;
│ │ │ │ -
168
│ │ │ │ -
169 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) =
│ │ │ │ -
170 aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, true);
│ │ │ │ -
171 std::cout<<"no aggregates="<<noAggregates<<" iso="<<isoAggregates<<" one="<<oneAggregates<<" skipped="<<skippedAggregates<<std::endl;
│ │ │ │ -
172 // misuse coarsener to renumber aggregates
│ │ │ │ - │ │ │ │ -
174 typedef std::vector<bool>::iterator Iterator;
│ │ │ │ -
175 typedef Dune::IteratorPropertyMap<Iterator, Dune::IdentityMap> VisitedMap;
│ │ │ │ -
176 std::vector<bool> excluded(fineOperator.getmat().N(), false);
│ │ │ │ -
177 VisitedMap vm(excluded.begin(), Dune::IdentityMap());
│ │ │ │ - │ │ │ │ -
179 std::size_t aggregates = renumberer.coarsen(pinfo, pg, vm,
│ │ │ │ -
180 *aggregatesMap_, pinfo,
│ │ │ │ -
181 noAggregates);
│ │ │ │ -
182 std::vector<bool>& visited=excluded;
│ │ │ │ -
183
│ │ │ │ -
184 typedef std::vector<bool>::iterator Iterator;
│ │ │ │ -
185
│ │ │ │ -
186 for(Iterator iter= visited.begin(), end=visited.end();
│ │ │ │ -
187 iter != end; ++iter)
│ │ │ │ -
188 *iter=false;
│ │ │ │ -
189 matrix_.reset(productBuilder.build(mg, vm,
│ │ │ │ - │ │ │ │ -
191 *aggregatesMap_,
│ │ │ │ -
192 aggregates,
│ │ │ │ -
193 OverlapFlags()));
│ │ │ │ -
194 productBuilder.calculate(fineOperator.getmat(), *aggregatesMap_, *matrix_, pinfo, OverlapFlags());
│ │ │ │ -
195 this->lhs_.resize(this->matrix_->M());
│ │ │ │ -
196 this->rhs_.resize(this->matrix_->N());
│ │ │ │ -
197 this->operator_ = std::make_shared<O>(*matrix_);
│ │ │ │ -
198 }
│ │ │ │ -
│ │ │ │ -
199
│ │ │ │ -
│ │ │ │ -
200 void moveToCoarseLevel(const typename FatherType::FineRangeType& fineRhs)
│ │ │ │ -
201 {
│ │ │ │ - │ │ │ │ -
203 ::restrictVector(*aggregatesMap_, this->rhs_, fineRhs, ParallelInformation());
│ │ │ │ -
204 this->lhs_=0;
│ │ │ │ -
205 }
│ │ │ │ -
│ │ │ │ -
206
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
208 {
│ │ │ │ - │ │ │ │ -
210 ::prolongateVector(*aggregatesMap_, this->lhs_, fineLhs,
│ │ │ │ -
211 prolongDamp_, ParallelInformation());
│ │ │ │ -
212 }
│ │ │ │ -
│ │ │ │ -
213
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
215 {
│ │ │ │ -
216 return new AggregationLevelTransferPolicy(*this);
│ │ │ │ -
217 }
│ │ │ │ -
│ │ │ │ -
218
│ │ │ │ -
219private:
│ │ │ │ -
220 typename O::matrix_type::field_type prolongDamp_;
│ │ │ │ -
221 std::shared_ptr<AggregatesMap> aggregatesMap_;
│ │ │ │ -
222 Criterion criterion_;
│ │ │ │ -
223 std::shared_ptr<typename O::matrix_type> matrix_;
│ │ │ │ -
224};
│ │ │ │ -
│ │ │ │ -
225
│ │ │ │ -
232template<class O, class S, class C>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
234{
│ │ │ │ -
235public:
│ │ │ │ -
237 typedef O Operator;
│ │ │ │ -
239 typedef typename O::range_type X;
│ │ │ │ -
241 typedef C Criterion;
│ │ │ │ -
243 typedef S Smoother;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
│ │ │ │ - │ │ │ │ -
254 : smootherArgs_(args), criterion_(c)
│ │ │ │ -
255 {}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
258 : coarseOperator_(other.coarseOperator_), smootherArgs_(other.smootherArgs_),
│ │ │ │ -
259 criterion_(other.criterion_)
│ │ │ │ -
260 {}
│ │ │ │ -
│ │ │ │ -
261private:
│ │ │ │ -
268 struct AMGInverseOperator : public InverseOperator<X,X>
│ │ │ │ -
269 {
│ │ │ │ -
270 AMGInverseOperator(const typename AMGType::Operator& op,
│ │ │ │ -
271 const Criterion& crit,
│ │ │ │ -
272 const typename AMGType::SmootherArgs& args)
│ │ │ │ -
273 : amg_(op, crit,args), first_(true)
│ │ │ │ -
274 {}
│ │ │ │ -
275
│ │ │ │ -
276 void apply(X& x, X& b, [[maybe_unused]] double reduction, [[maybe_unused]] InverseOperatorResult& res)
│ │ │ │ -
277 {
│ │ │ │ -
278 if(first_)
│ │ │ │ -
279 {
│ │ │ │ -
280 amg_.pre(x,b);
│ │ │ │ -
281 first_=false;
│ │ │ │ -
282 x_=x;
│ │ │ │ -
283 }
│ │ │ │ -
284 amg_.apply(x,b);
│ │ │ │ -
285 }
│ │ │ │ -
286
│ │ │ │ -
287 void apply(X& x, X& b, InverseOperatorResult& res)
│ │ │ │ -
288 {
│ │ │ │ -
289 return apply(x,b,1e-8,res);
│ │ │ │ -
290 }
│ │ │ │ -
291
│ │ │ │ -
293 virtual SolverCategory::Category category() const
│ │ │ │ -
294 {
│ │ │ │ -
295 return amg_.category();
│ │ │ │ -
296 }
│ │ │ │ -
297
│ │ │ │ -
298 ~AMGInverseOperator()
│ │ │ │ -
299 {
│ │ │ │ -
300 if(!first_)
│ │ │ │ -
301 amg_.post(x_);
│ │ │ │ -
302 }
│ │ │ │ -
303 AMGInverseOperator(const AMGInverseOperator& other)
│ │ │ │ -
304 : x_(other.x_), amg_(other.amg_), first_(other.first_)
│ │ │ │ -
305 {
│ │ │ │ -
306 }
│ │ │ │ -
307 private:
│ │ │ │ -
308 X x_;
│ │ │ │ -
309 AMGType amg_;
│ │ │ │ -
310 bool first_;
│ │ │ │ -
311 };
│ │ │ │ -
312
│ │ │ │ -
313public:
│ │ │ │ -
315 typedef AMGInverseOperator CoarseLevelSolver;
│ │ │ │ -
316
│ │ │ │ -
324 template<class P>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
326 {
│ │ │ │ -
327 coarseOperator_=transferPolicy.getCoarseLevelOperator();
│ │ │ │ -
328 AMGInverseOperator* inv = new AMGInverseOperator(*coarseOperator_,
│ │ │ │ -
329 criterion_,
│ │ │ │ -
330 smootherArgs_);
│ │ │ │ -
331
│ │ │ │ -
332 return inv; //std::shared_ptr<InverseOperator<X,X> >(inv);
│ │ │ │ +
│ │ │ │ +
165 void globalIndex(const GlobalIndex& global)
│ │ │ │ +
166 {
│ │ │ │ +
167 globalIndex_ = global;
│ │ │ │ +
168 }
│ │ │ │ +
│ │ │ │ +
169
│ │ │ │ +
170 private:
│ │ │ │ +
171 bool isPublic_;
│ │ │ │ +
172 Attribute attribute_;
│ │ │ │ +
173 const GlobalLookupIndexSet& lookup_;
│ │ │ │ +
174 GlobalIndex globalIndex_;
│ │ │ │ +
175 };
│ │ │ │ +
176
│ │ │ │ +
177 template<typename Graph, typename VM, typename I>
│ │ │ │ +
178 static void buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ │ +
179 Graph& fineGraph,
│ │ │ │ +
180 VM& visitedMap,
│ │ │ │ + │ │ │ │ +
182 ParallelIndexSet& coarseIndices,
│ │ │ │ +
183 ParallelAggregateRenumberer<Graph,I>& renumberer);
│ │ │ │ +
184
│ │ │ │ +
185 template<typename Graph,typename I>
│ │ │ │ +
186 static void buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ │ + │ │ │ │ +
188 ParallelIndexSet& coarseIndices,
│ │ │ │ +
189 RemoteIndices& coarseRemote,
│ │ │ │ +
190 ParallelAggregateRenumberer<Graph,I>& renumberer);
│ │ │ │ +
191
│ │ │ │ +
192 };
│ │ │ │ +
193
│ │ │ │ +
197 template<typename G, typename L, typename E>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
199 : public ParallelIndicesCoarsener<OwnerOverlapCopyCommunication<G,L>,E>
│ │ │ │ +
200 {};
│ │ │ │ +
│ │ │ │ +
201
│ │ │ │ +
202
│ │ │ │ +
203#endif
│ │ │ │ +
204
│ │ │ │ +
211 template<typename E>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
213 {
│ │ │ │ +
214 public:
│ │ │ │ +
215 template<typename Graph, typename VM>
│ │ │ │ +
216 static typename Graph::VertexDescriptor
│ │ │ │ +
217 coarsen(const SequentialInformation & fineInfo,
│ │ │ │ +
218 Graph& fineGraph,
│ │ │ │ +
219 VM& visitedMap,
│ │ │ │ + │ │ │ │ +
221 SequentialInformation& coarseInfo,
│ │ │ │ +
222 typename Graph::VertexDescriptor noAggregates);
│ │ │ │ +
223 };
│ │ │ │ +
│ │ │ │ +
224
│ │ │ │ +
225#if HAVE_MPI
│ │ │ │ +
226 template<typename T, typename E>
│ │ │ │ +
227 template<typename Graph, typename VM>
│ │ │ │ +
228 inline typename Graph::VertexDescriptor
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
230 Graph& fineGraph,
│ │ │ │ +
231 VM& visitedMap,
│ │ │ │ + │ │ │ │ +
233 ParallelInformation& coarseInfo,
│ │ │ │ +
234 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates)
│ │ │ │ +
235 {
│ │ │ │ +
236 ParallelAggregateRenumberer<Graph,typename ParallelInformation::GlobalLookupIndexSet> renumberer(aggregates, fineInfo.globalLookup());
│ │ │ │ +
237 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates,
│ │ │ │ +
238 coarseInfo.indexSet(), renumberer);
│ │ │ │ +
239 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, coarseInfo.indexSet(),
│ │ │ │ +
240 coarseInfo.remoteIndices(), renumberer);
│ │ │ │ +
241
│ │ │ │ +
242 return renumberer;
│ │ │ │ +
243 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
244
│ │ │ │ +
245 template<typename T, typename E>
│ │ │ │ +
246 template<typename Graph, typename VM, typename I>
│ │ │ │ +
247 void ParallelIndicesCoarsener<T,E>::buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ │ +
248 Graph& fineGraph,
│ │ │ │ +
249 VM& visitedMap,
│ │ │ │ + │ │ │ │ +
251 ParallelIndexSet& coarseIndices,
│ │ │ │ +
252 ParallelAggregateRenumberer<Graph,I>& renumberer)
│ │ │ │ +
253 {
│ │ │ │ +
254 // fineGraph is the local subgraph corresponding to the vertices the process owns.
│ │ │ │ +
255 // i.e. no overlap/copy vertices can be visited traversing the graph
│ │ │ │ +
256 typedef typename Graph::ConstVertexIterator Iterator;
│ │ │ │ +
257 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
│ │ │ │ +
258
│ │ │ │ +
259 Iterator end = fineGraph.end();
│ │ │ │ +
260 const GlobalLookupIndexSet& lookup = pinfo.globalLookup();
│ │ │ │ +
261
│ │ │ │ +
262 coarseIndices.beginResize();
│ │ │ │ +
263
│ │ │ │ +
264 // Setup the coarse index set and renumber the aggregate consecutively
│ │ │ │ +
265 // ascending from zero according to the minimum global index belonging
│ │ │ │ +
266 // to the aggregate
│ │ │ │ +
267 for(Iterator index = fineGraph.begin(); index != end; ++index) {
│ │ │ │ + │ │ │ │ +
269 // Isolated vertices will not be represented on the next level.
│ │ │ │ +
270 // These should only be there if skipIsolated is activiated in
│ │ │ │ +
271 // the coarsening criterion as otherwise they will be aggregated
│ │ │ │ +
272 // and should have real aggregate number in the map right now.
│ │ │ │ +
273 if(!get(visitedMap, *index)) {
│ │ │ │ +
274 // This vertex was not visited by breadthFirstSearch yet.
│ │ │ │ +
275 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ │ +
276 const IndexPair* pair= lookup.pair(*index);
│ │ │ │ +
277
│ │ │ │ +
278 renumberer.reset(); // reset attribute and global index.
│ │ │ │ +
279 if(pair!=0) {
│ │ │ │ +
280 // vertex is in the index set. Note that not all vertices have
│ │ │ │ +
281 // to be in the index set, just the ones where communication
│ │ │ │ +
282 // will happen.
│ │ │ │ +
283 assert(!ExcludedAttributes::contains(pair->local().attribute()));
│ │ │ │ +
284 renumberer.attribute(pair->local().attribute());
│ │ │ │ +
285 renumberer.isPublic(pair->local().isPublic());
│ │ │ │ +
286 renumberer.globalIndex(pair->global());
│ │ │ │ +
287 }
│ │ │ │ +
288
│ │ │ │ +
289 // Reconstruct aggregate and mark vertices as visited
│ │ │ │ +
290 aggregates.template breadthFirstSearch<false>(*index, aggregates[*index],
│ │ │ │ +
291 fineGraph, renumberer, visitedMap);
│ │ │ │ +
292
│ │ │ │ +
293 if(renumberer.globalIndex()!=std::numeric_limits<GlobalIndex>::max()) {
│ │ │ │ +
294 // vertex is in the index set.
│ │ │ │ +
295 //std::cout <<" Adding global="<< renumberer.globalIndex()<<" local="<<static_cast<std::size_t>(renumberer)<<std::endl;
│ │ │ │ +
296 coarseIndices.add(renumberer.globalIndex(),
│ │ │ │ +
297 LocalIndex(renumberer, renumberer.attribute(),
│ │ │ │ +
298 renumberer.isPublic()));
│ │ │ │ +
299 }
│ │ │ │ +
300
│ │ │ │ +
301 aggregates[*index] = renumberer;
│ │ │ │ +
302 ++renumberer;
│ │ │ │ +
303 }
│ │ │ │ +
304 }
│ │ │ │ +
305
│ │ │ │ +
306 coarseIndices.endResize();
│ │ │ │ +
307
│ │ │ │ +
308 assert(static_cast<std::size_t>(renumberer) >= coarseIndices.size());
│ │ │ │ +
309
│ │ │ │ +
310 // Reset the visited flags
│ │ │ │ +
311 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex)
│ │ │ │ +
312 put(visitedMap, *vertex, false);
│ │ │ │ +
313 }
│ │ │ │ +
314
│ │ │ │ +
315 template<typename T, typename E>
│ │ │ │ +
316 template<typename Graph, typename I>
│ │ │ │ +
317 void ParallelIndicesCoarsener<T,E>::buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ │ +
318 const AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ │ +
319 ParallelIndexSet& coarseIndices,
│ │ │ │ +
320 RemoteIndices& coarseRemote,
│ │ │ │ +
321 ParallelAggregateRenumberer<Graph,I>& renumberer)
│ │ │ │ +
322 {
│ │ │ │ +
323 std::vector<char> attributes(static_cast<std::size_t>(renumberer));
│ │ │ │ +
324
│ │ │ │ +
325 GlobalLookupIndexSet<ParallelIndexSet> coarseLookup(coarseIndices, static_cast<std::size_t>(renumberer));
│ │ │ │ +
326
│ │ │ │ +
327 typedef typename RemoteIndices::const_iterator Iterator;
│ │ │ │ +
328 Iterator end = fineRemote.end();
│ │ │ │ +
329
│ │ │ │ +
330 for(Iterator neighbour = fineRemote.begin();
│ │ │ │ +
331 neighbour != end; ++neighbour) {
│ │ │ │ +
332 int process = neighbour->first;
│ │ │ │
333
│ │ │ │ -
334 }
│ │ │ │ -
│ │ │ │ +
334 assert(neighbour->second.first==neighbour->second.second);
│ │ │ │
335
│ │ │ │ -
336private:
│ │ │ │ -
338 std::shared_ptr<Operator> coarseOperator_;
│ │ │ │ -
340 SmootherArgs smootherArgs_;
│ │ │ │ -
342 Criterion criterion_;
│ │ │ │ -
343};
│ │ │ │ -
│ │ │ │ -
344
│ │ │ │ -
350template<class FO, class CSP, class S>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
352 public Preconditioner<typename FO::domain_type, typename FO::range_type>
│ │ │ │ -
353{
│ │ │ │ -
354public:
│ │ │ │ - │ │ │ │ -
358 typedef typename CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver;
│ │ │ │ - │ │ │ │ -
367 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ │ -
371 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ │ -
376 typedef typename CSP::Operator CoarseOperatorType;
│ │ │ │ -
380 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ │ -
384 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ │ -
388 typedef S SmootherType;
│ │ │ │ -
389
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
405 std::shared_ptr<SmootherType> smoother,
│ │ │ │ - │ │ │ │ -
407 CoarseOperatorType>& policy,
│ │ │ │ -
408 CoarseLevelSolverPolicy& coarsePolicy,
│ │ │ │ -
409 std::size_t preSteps=1, std::size_t postSteps=1)
│ │ │ │ -
410 : operator_(&op), smoother_(smoother),
│ │ │ │ -
411 preSteps_(preSteps), postSteps_(postSteps)
│ │ │ │ -
412 {
│ │ │ │ -
413 policy_ = policy.clone();
│ │ │ │ -
414 policy_->createCoarseLevelSystem(*operator_);
│ │ │ │ -
415 coarseSolver_=coarsePolicy.createCoarseLevelSolver(*policy_);
│ │ │ │ -
416 }
│ │ │ │ -
│ │ │ │ -
417
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
419 : operator_(other.operator_), coarseSolver_(new CoarseLevelSolver(*other.coarseSolver_)),
│ │ │ │ -
420 smoother_(other.smoother_), policy_(other.policy_->clone()),
│ │ │ │ -
421 preSteps_(other.preSteps_), postSteps_(other.postSteps_)
│ │ │ │ -
422 {}
│ │ │ │ -
│ │ │ │ -
423
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
425 {
│ │ │ │ -
426 // Each instance has its own policy.
│ │ │ │ -
427 delete policy_;
│ │ │ │ -
428 delete coarseSolver_;
│ │ │ │ -
429 }
│ │ │ │ -
│ │ │ │ -
430
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
432 {
│ │ │ │ -
433 smoother_->pre(x,b);
│ │ │ │ -
434 }
│ │ │ │ -
│ │ │ │ -
435
│ │ │ │ -
│ │ │ │ -
436 void post([[maybe_unused]] FineDomainType& x)
│ │ │ │ -
437 {}
│ │ │ │ -
│ │ │ │ -
438
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
440 {
│ │ │ │ -
441 FineDomainType u(v);
│ │ │ │ -
442 FineRangeType rhs(d);
│ │ │ │ -
443 LevelContext context;
│ │ │ │ - │ │ │ │ -
445 context.pinfo=&info;
│ │ │ │ -
446 context.lhs=&u;
│ │ │ │ -
447 context.update=&v;
│ │ │ │ -
448 context.smoother=smoother_;
│ │ │ │ -
449 context.rhs=&rhs;
│ │ │ │ -
450 context.matrix=operator_;
│ │ │ │ -
451 // Presmoothing
│ │ │ │ -
452 presmooth(context, preSteps_);
│ │ │ │ -
453 //Coarse grid correction
│ │ │ │ -
454 policy_->moveToCoarseLevel(*context.rhs);
│ │ │ │ - │ │ │ │ -
456 coarseSolver_->apply(policy_->getCoarseLevelLhs(), policy_->getCoarseLevelRhs(), res);
│ │ │ │ -
457 *context.lhs=0;
│ │ │ │ -
458 policy_->moveToFineLevel(*context.lhs);
│ │ │ │ -
459 *context.update += *context.lhs;
│ │ │ │ -
460 // Postsmoothing
│ │ │ │ -
461 postsmooth(context, postSteps_);
│ │ │ │ -
462
│ │ │ │ -
463 }
│ │ │ │ -
│ │ │ │ -
464
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
467 {
│ │ │ │ - │ │ │ │ -
469 }
│ │ │ │ -
│ │ │ │ -
470
│ │ │ │ -
471private:
│ │ │ │ -
475 struct LevelContext
│ │ │ │ -
476 {
│ │ │ │ -
478 typedef S SmootherType;
│ │ │ │ -
480 std::shared_ptr<SmootherType> smoother;
│ │ │ │ -
482 FineDomainType* lhs;
│ │ │ │ -
483 /*
│ │ │ │ -
484 * @brief The right hand side holding the current residual.
│ │ │ │ -
485 *
│ │ │ │ -
486 * This is passed to the smoother as the right hand side.
│ │ │ │ -
487 */
│ │ │ │ -
488 FineRangeType* rhs;
│ │ │ │ -
494 FineDomainType* update;
│ │ │ │ - │ │ │ │ -
502 const FineOperatorType* matrix;
│ │ │ │ -
503 };
│ │ │ │ -
504 const FineOperatorType* operator_;
│ │ │ │ -
506 CoarseLevelSolver* coarseSolver_;
│ │ │ │ -
508 std::shared_ptr<S> smoother_;
│ │ │ │ -
510 LevelTransferPolicy<FO,typename CSP::Operator>* policy_;
│ │ │ │ -
512 std::size_t preSteps_;
│ │ │ │ -
514 std::size_t postSteps_;
│ │ │ │ -
515};
│ │ │ │ -
│ │ │ │ -
516}// end namespace Amg
│ │ │ │ -
517}// end namespace Dune
│ │ │ │ -
518
│ │ │ │ -
520#endif
│ │ │ │ -
The AMG preconditioner.
│ │ │ │ -
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ -
G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation &pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::Matrix::size_type &size, const Set &copy)
Calculates the coarse matrix via a Galerkin product.
Definition galerkin.hh:563
│ │ │ │ -
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ │ -
Operator Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ │ -
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ │ -
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ │ -
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ │ +
336 // Mark all as not known
│ │ │ │ +
337 typedef typename std::vector<char>::iterator CIterator;
│ │ │ │ +
338
│ │ │ │ +
339 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter)
│ │ │ │ +
340 *iter = std::numeric_limits<char>::max();
│ │ │ │ +
341
│ │ │ │ +
342 auto riEnd = neighbour->second.second->end();
│ │ │ │ +
343
│ │ │ │ +
344 for(auto index = neighbour->second.second->begin();
│ │ │ │ +
345 index != riEnd; ++index) {
│ │ │ │ +
346 if(!E::contains(index->localIndexPair().local().attribute()) &&
│ │ │ │ +
347 aggregates[index->localIndexPair().local()] !=
│ │ │ │ + │ │ │ │ +
349 {
│ │ │ │ +
350 assert(aggregates[index->localIndexPair().local()]<attributes.size());
│ │ │ │ +
351 if (attributes[aggregates[index->localIndexPair().local()]] != 3)
│ │ │ │ +
352 attributes[aggregates[index->localIndexPair().local()]] = index->attribute();
│ │ │ │ +
353 }
│ │ │ │ +
354 }
│ │ │ │ +
355
│ │ │ │ +
356 // Build remote index list
│ │ │ │ +
357 typedef RemoteIndexListModifier<ParallelIndexSet,typename RemoteIndices::Allocator,false> Modifier;
│ │ │ │ +
358 typedef typename RemoteIndices::RemoteIndex RemoteIndex;
│ │ │ │ +
359 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ │ +
360
│ │ │ │ +
361 Modifier coarseList = coarseRemote.template getModifier<false,true>(process);
│ │ │ │ +
362
│ │ │ │ +
363 IndexIterator iend = coarseIndices.end();
│ │ │ │ +
364 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index)
│ │ │ │ +
365 if(attributes[index->local()] != std::numeric_limits<char>::max()) {
│ │ │ │ +
366 // remote index is present
│ │ │ │ +
367 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), &(*index)));
│ │ │ │ +
368 }
│ │ │ │ +
369 //std::cout<<coarseRemote<<std::endl;
│ │ │ │ +
370 }
│ │ │ │ +
371
│ │ │ │ +
372 // The number of neighbours should not change!
│ │ │ │ +
373 assert(coarseRemote.neighbours()==fineRemote.neighbours());
│ │ │ │ +
374
│ │ │ │ +
375 // snyc the index set and the remote indices to recompute missing
│ │ │ │ +
376 // indices
│ │ │ │ +
377 IndicesSyncer<ParallelIndexSet> syncer(coarseIndices, coarseRemote);
│ │ │ │ +
378 syncer.sync(renumberer);
│ │ │ │ +
379
│ │ │ │ +
380 }
│ │ │ │ +
381
│ │ │ │ +
382#endif
│ │ │ │ +
383
│ │ │ │ +
384 template<typename E>
│ │ │ │ +
385 template<typename Graph, typename VM>
│ │ │ │ +
386 typename Graph::VertexDescriptor
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
388 [[maybe_unused]] const SequentialInformation& fineInfo,
│ │ │ │ +
389 [[maybe_unused]] Graph& fineGraph,
│ │ │ │ +
390 [[maybe_unused]] VM& visitedMap,
│ │ │ │ +
391 [[maybe_unused]] AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ │ +
392 [[maybe_unused]] SequentialInformation& coarseInfo,
│ │ │ │ +
393 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates)
│ │ │ │ +
394 {
│ │ │ │ +
395 return noAggregates;
│ │ │ │ +
396 }
│ │ │ │ +
│ │ │ │ +
397
│ │ │ │ +
398 } //namespace Amg
│ │ │ │ +
399} // namespace Dune
│ │ │ │ +
400#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:116
│ │ │ │ +
void isPublic(bool b)
Definition indicescoarsener.hh:139
│ │ │ │ +
ParallelInformation::ParallelIndexSet ParallelIndexSet
Definition indicescoarsener.hh:55
│ │ │ │ + │ │ │ │ +
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition indicescoarsener.hh:65
│ │ │ │ +
T ParallelInformation
The type of the parallel information.
Definition indicescoarsener.hh:53
│ │ │ │ +
Attribute attribute()
Definition indicescoarsener.hh:155
│ │ │ │ +
Vertex operator()(const GlobalIndex &global)
Definition indicescoarsener.hh:127
│ │ │ │ +
static Graph::VertexDescriptor coarsen(ParallelInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates)
Build the coarse index set after the aggregatio.
Definition indicescoarsener.hh:229
│ │ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition indicescoarsener.hh:60
│ │ │ │ +
void attribute(const Attribute &attribute)
Definition indicescoarsener.hh:150
│ │ │ │ +
E ExcludedAttributes
The set of excluded attributes.
Definition indicescoarsener.hh:48
│ │ │ │ +
void globalIndex(const GlobalIndex &global)
Definition indicescoarsener.hh:165
│ │ │ │ +
Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
The type of the remote indices.
Definition indicescoarsener.hh:75
│ │ │ │ +
ParallelAggregateRenumberer(AggregatesMap< Vertex > &aggregates, const I &lookup)
Definition indicescoarsener.hh:110
│ │ │ │ +
const GlobalIndex & globalIndex() const
Definition indicescoarsener.hh:160
│ │ │ │ +
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
│ │ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ -
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ │ -
Class representing the properties of an ede 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 indicescoarsener.hh:43
│ │ │ │
Definition pinfo.hh:28
│ │ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ -
Definition transfer.hh:32
│ │ │ │ -
Abstract base class for transfer between levels and creation of the coarse level system.
Definition twolevelmethod.hh:38
│ │ │ │ -
CO CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:57
│ │ │ │ -
virtual void moveToCoarseLevel(const FineRangeType &fineRhs)=0
Transfers the data to the coarse level.
│ │ │ │ -
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:48
│ │ │ │ -
virtual void createCoarseLevelSystem(const FineOperatorType &fineOperator)=0
Algebraically creates the coarse level system.
│ │ │ │ -
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:61
│ │ │ │ -
virtual ~LevelTransferPolicy()
Destructor.
Definition twolevelmethod.hh:124
│ │ │ │ -
CoarseDomainType lhs_
The coarse level lhs.
Definition twolevelmethod.hh:130
│ │ │ │ -
virtual LevelTransferPolicy * clone() const =0
Clone the current object.
│ │ │ │ -
CoarseDomainType & getCoarseLevelLhs()
Get the coarse level left hand side.
Definition twolevelmethod.hh:87
│ │ │ │ -
std::shared_ptr< CoarseOperatorType > operator_
the coarse level linear operator.
Definition twolevelmethod.hh:132
│ │ │ │ -
CoarseRangeType rhs_
The coarse level rhs.
Definition twolevelmethod.hh:128
│ │ │ │ -
virtual void moveToFineLevel(FineDomainType &fineLhs)=0
Updates the fine level linear system after the correction of the coarse levels system.
│ │ │ │ -
std::shared_ptr< CoarseOperatorType > & getCoarseLevelOperator()
Get the coarse level operator.
Definition twolevelmethod.hh:70
│ │ │ │ -
CoarseRangeType & getCoarseLevelRhs()
Get the coarse level right hand side.
Definition twolevelmethod.hh:78
│ │ │ │ -
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:44
│ │ │ │ -
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:65
│ │ │ │ -
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:52
│ │ │ │ -
A LeveTransferPolicy that used aggregation to construct the coarse level system.
Definition twolevelmethod.hh:143
│ │ │ │ -
C Criterion
Definition twolevelmethod.hh:147
│ │ │ │ -
AggregationLevelTransferPolicy(const Criterion &crit)
Definition twolevelmethod.hh:150
│ │ │ │ -
AggregationLevelTransferPolicy * clone() const
Clone the current object.
Definition twolevelmethod.hh:214
│ │ │ │ -
void moveToFineLevel(typename FatherType::FineDomainType &fineLhs)
Updates the fine level linear system after the correction of the coarse levels system.
Definition twolevelmethod.hh:207
│ │ │ │ -
void moveToCoarseLevel(const typename FatherType::FineRangeType &fineRhs)
Definition twolevelmethod.hh:200
│ │ │ │ -
SequentialInformation ParallelInformation
Definition twolevelmethod.hh:148
│ │ │ │ -
LevelTransferPolicy< O, O > FatherType
Definition twolevelmethod.hh:146
│ │ │ │ -
void createCoarseLevelSystem(const O &fineOperator)
Algebraically creates the coarse level system.
Definition twolevelmethod.hh:154
│ │ │ │ -
A policy class for solving the coarse level system using one step of AMG.
Definition twolevelmethod.hh:234
│ │ │ │ -
OneStepAMGCoarseSolverPolicy(const SmootherArgs &args, const Criterion &c)
Constructs the coarse solver policy.
Definition twolevelmethod.hh:253
│ │ │ │ -
AMGInverseOperator CoarseLevelSolver
The type of solver constructed for the coarse level.
Definition twolevelmethod.hh:315
│ │ │ │ -
OneStepAMGCoarseSolverPolicy(const OneStepAMGCoarseSolverPolicy &other)
Copy constructor.
Definition twolevelmethod.hh:257
│ │ │ │ -
O::range_type X
The type of the range and domain of the operator.
Definition twolevelmethod.hh:239
│ │ │ │ -
C Criterion
The type of the crition used for the aggregation within AMG.
Definition twolevelmethod.hh:241
│ │ │ │ -
Dune::Amg::SmootherTraits< S >::Arguments SmootherArgs
The type of the arguments used for constructing the smoother.
Definition twolevelmethod.hh:245
│ │ │ │ -
O Operator
The type of the linear operator used.
Definition twolevelmethod.hh:237
│ │ │ │ -
AMG< Operator, X, Smoother > AMGType
The type of the AMG construct on the coarse level.
Definition twolevelmethod.hh:247
│ │ │ │ -
CoarseLevelSolver * createCoarseLevelSolver(P &transferPolicy)
Constructs a coarse level solver.
Definition twolevelmethod.hh:325
│ │ │ │ -
S Smoother
The type of the smoother used in AMG.
Definition twolevelmethod.hh:243
│ │ │ │ -
Definition twolevelmethod.hh:353
│ │ │ │ -
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:380
│ │ │ │ -
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:371
│ │ │ │ -
TwoLevelMethod(const TwoLevelMethod &other)
Definition twolevelmethod.hh:418
│ │ │ │ -
void pre(FineDomainType &x, FineRangeType &b)
Definition twolevelmethod.hh:431
│ │ │ │ -
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:363
│ │ │ │ -
CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver
The type of the coarse level solver.
Definition twolevelmethod.hh:358
│ │ │ │ -
void apply(FineDomainType &v, const FineRangeType &d)
Definition twolevelmethod.hh:439
│ │ │ │ -
CSP CoarseLevelSolverPolicy
The type of the policy for constructing the coarse level solver.
Definition twolevelmethod.hh:356
│ │ │ │ -
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:384
│ │ │ │ -
TwoLevelMethod(const FineOperatorType &op, std::shared_ptr< SmootherType > smoother, const LevelTransferPolicy< FineOperatorType, CoarseOperatorType > &policy, CoarseLevelSolverPolicy &coarsePolicy, std::size_t preSteps=1, std::size_t postSteps=1)
Constructs a two level method.
Definition twolevelmethod.hh:404
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition twolevelmethod.hh:466
│ │ │ │ -
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:367
│ │ │ │ -
~TwoLevelMethod()
Definition twolevelmethod.hh:424
│ │ │ │ -
CSP::Operator CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:376
│ │ │ │ -
void post(FineDomainType &x)
Definition twolevelmethod.hh:436
│ │ │ │ -
S SmootherType
The type of the fine level smoother.
Definition twolevelmethod.hh:388
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ -
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)=0
Apply inverse operator,.
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ +
Definition renumberer.hh:16
│ │ │ │ +
void operator++()
Definition renumberer.hh:57
│ │ │ │ +
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:51
│ │ │ │ +
Vertex number_
Definition renumberer.hh:35
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,663 +1,485 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ * _p_a_a_m_g │ │ │ │ │ -twolevelmethod.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 (C) 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_INDICESCOARSENER_HH │ │ │ │ │ +6#define DUNE_AMG_INDICESCOARSENER_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9 │ │ │ │ │ -10#include<_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ │ -11#include"_a_m_g_._h_h" │ │ │ │ │ -12#include"_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ │ -13#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ -14 │ │ │ │ │ -22namespace _D_u_n_e │ │ │ │ │ -23{ │ │ │ │ │ -24namespace Amg │ │ │ │ │ -25{ │ │ │ │ │ -26 │ │ │ │ │ -36template │ │ │ │ │ -_3_7class _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ │ -38{ │ │ │ │ │ -39public: │ │ │ │ │ -_4_4 typedef FO _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ │ -_4_8 typedef typename FineOperatorType::range_type _F_i_n_e_R_a_n_g_e_T_y_p_e; │ │ │ │ │ -_5_2 typedef typename FineOperatorType::domain_type _F_i_n_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ -_5_7 typedef CO _C_o_a_r_s_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ │ -_6_1 typedef typename CoarseOperatorType::range_type _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e; │ │ │ │ │ -_6_5 typedef typename CoarseOperatorType::domain_type _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ │ -_7_0 std::shared_ptr& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_O_p_e_r_a_t_o_r() │ │ │ │ │ -71 { │ │ │ │ │ -72 return _o_p_e_r_a_t_o_r__; │ │ │ │ │ -73 } │ │ │ │ │ -_7_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_R_h_s() │ │ │ │ │ -79 { │ │ │ │ │ -80 return _r_h_s__; │ │ │ │ │ -81 } │ │ │ │ │ -82 │ │ │ │ │ -_8_7 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_L_h_s() │ │ │ │ │ -88 { │ │ │ │ │ -89 return _l_h_s__; │ │ │ │ │ -90 } │ │ │ │ │ -_1_0_0 virtual void _m_o_v_e_T_o_C_o_a_r_s_e_L_e_v_e_l(const _F_i_n_e_R_a_n_g_e_T_y_p_e& fineRhs)=0; │ │ │ │ │ -_1_1_0 virtual void _m_o_v_e_T_o_F_i_n_e_L_e_v_e_l(_F_i_n_e_D_o_m_a_i_n_T_y_p_e& fineLhs)=0; │ │ │ │ │ -_1_1_8 virtual void _c_r_e_a_t_e_C_o_a_r_s_e_L_e_v_e_l_S_y_s_t_e_m(const _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e& │ │ │ │ │ -fineOperator)=0; │ │ │ │ │ -119 │ │ │ │ │ -_1_2_1 virtual _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y* _c_l_o_n_e() const =0; │ │ │ │ │ -122 │ │ │ │ │ -_1_2_4 virtual _~_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y(){} │ │ │ │ │ -125 │ │ │ │ │ -126 protected: │ │ │ │ │ -_1_2_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e _r_h_s__; │ │ │ │ │ -_1_3_0 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e _l_h_s__; │ │ │ │ │ -_1_3_2 std::shared_ptr _o_p_e_r_a_t_o_r__; │ │ │ │ │ -133}; │ │ │ │ │ -134 │ │ │ │ │ -140template │ │ │ │ │ -_1_4_1class _A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ │ -142 : public _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ │ -143{ │ │ │ │ │ -144 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _O_:_:_m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e_> │ │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ │ -145public: │ │ │ │ │ -_1_4_6 typedef _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_O_,_O_> _F_a_t_h_e_r_T_y_p_e; │ │ │ │ │ -_1_4_7 typedef C _C_r_i_t_e_r_i_o_n; │ │ │ │ │ -_1_4_8 typedef _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ │ +11 │ │ │ │ │ +12#if HAVE_MPI │ │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ │ +14#endif │ │ │ │ │ +15 │ │ │ │ │ +16#include "_p_i_n_f_o_._h_h" │ │ │ │ │ +17 │ │ │ │ │ +18namespace _D_u_n_e │ │ │ │ │ +19{ │ │ │ │ │ +20 namespace Amg │ │ │ │ │ +21 { │ │ │ │ │ +22 │ │ │ │ │ +34 template │ │ │ │ │ +_3_5 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ │ +36 {}; │ │ │ │ │ +37 │ │ │ │ │ +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 │ │ │ │ │ +88 template │ │ │ │ │ +89 static typename Graph::VertexDescriptor │ │ │ │ │ +_9_0 _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, │ │ │ │ │ +91 Graph& fineGraph, │ │ │ │ │ +92 VM& visitedMap, │ │ │ │ │ +93 _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, │ │ │ │ │ +94 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ │ +95 typename Graph::VertexDescriptor noAggregates); │ │ │ │ │ +96 │ │ │ │ │ +97 private: │ │ │ │ │ +98 template │ │ │ │ │ +99 class ParallelAggregateRenumberer : public _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ │ +100 { │ │ │ │ │ +101 typedef typename G::VertexDescriptor Vertex; │ │ │ │ │ +102 │ │ │ │ │ +103 typedef I GlobalLookupIndexSet; │ │ │ │ │ +104 │ │ │ │ │ +105 typedef typename GlobalLookupIndexSet::IndexPair IndexPair; │ │ │ │ │ +106 │ │ │ │ │ +107 typedef typename IndexPair::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ │ +108 │ │ │ │ │ +109 public: │ │ │ │ │ +_1_1_0 _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) │ │ │ │ │ +111 : _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(aggregates), isPublic_(false), lookup_(lookup), │ │ │ │ │ +112 globalIndex_(_s_t_d::numeric_limits::max()) │ │ │ │ │ +113 {} │ │ │ │ │ +114 │ │ │ │ │ +115 │ │ │ │ │ +_1_1_6 void _o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& edge) │ │ │ │ │ +117 { │ │ │ │ │ +118 _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); │ │ │ │ │ +119 const IndexPair* pair= lookup_.pair(edge.target()); │ │ │ │ │ +120 if(pair!=0) { │ │ │ │ │ +121 _g_l_o_b_a_l_I_n_d_e_x(pair->global()); │ │ │ │ │ +122 _a_t_t_r_i_b_u_t_e(pair->local().attribute()); │ │ │ │ │ +123 _i_s_P_u_b_l_i_c(pair->local().isPublic()); │ │ │ │ │ +124 } │ │ │ │ │ +125 } │ │ │ │ │ +126 │ │ │ │ │ +_1_2_7 Vertex _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const GlobalIndex& global) │ │ │ │ │ +128 { │ │ │ │ │ +129 Vertex current = this->_n_u_m_b_e_r__; │ │ │ │ │ +130 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +131 return current; │ │ │ │ │ +132 } │ │ │ │ │ +133 │ │ │ │ │ +_1_3_4 bool _i_s_P_u_b_l_i_c() │ │ │ │ │ +135 { │ │ │ │ │ +136 return isPublic_; │ │ │ │ │ +137 } │ │ │ │ │ +138 │ │ │ │ │ +_1_3_9 void _i_s_P_u_b_l_i_c(bool b) │ │ │ │ │ +140 { │ │ │ │ │ +141 isPublic_ = isPublic_ || b; │ │ │ │ │ +142 } │ │ │ │ │ +143 │ │ │ │ │ +_1_4_4 void _r_e_s_e_t() │ │ │ │ │ +145 { │ │ │ │ │ +146 globalIndex_ = std::numeric_limits::max(); │ │ │ │ │ +147 isPublic_=false; │ │ │ │ │ +148 } │ │ │ │ │ 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; │ │ │ │ │ +_1_5_0 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) │ │ │ │ │ +151 { │ │ │ │ │ +152 attribute_=_a_t_t_r_i_b_u_t_e; │ │ │ │ │ +153 } │ │ │ │ │ +154 │ │ │ │ │ +_1_5_5 _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() │ │ │ │ │ +156 { │ │ │ │ │ +157 return attribute_; │ │ │ │ │ +158 } │ │ │ │ │ +159 │ │ │ │ │ +_1_6_0 const GlobalIndex& _g_l_o_b_a_l_I_n_d_e_x() const │ │ │ │ │ +161 { │ │ │ │ │ +162 return globalIndex_; │ │ │ │ │ +163 } │ │ │ │ │ 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: matrixindexset.hh File Reference │ │ │ │ +dune-istl: construction.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,40 +65,68 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
matrixindexset.hh File Reference
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ -
#include <vector>
│ │ │ │ -#include <set>
│ │ │ │ + │ │ │ │ +

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

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

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::MatrixIndexSet
 Stores the nonzero entries in a sparse matrix. 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
 
namespace  Dune::Amg
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Helper classes for the construction of classes without empty constructor.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,20 +1,54 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -matrixindexset.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +construction.hh File Reference │ │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ │ +Helper classes for the construction of classes without empty constructor. │ │ │ │ │ +_M_o_r_e_._._. │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ │ +#include "_p_i_n_f_o_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ │ -  Stores the nonzero entries in a sparse matrix. _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 │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Helper classes for the construction of classes without empty constructor. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00161_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixindexset.hh Source File │ │ │ │ +dune-istl: construction.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,152 +70,260 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
matrixindexset.hh
│ │ │ │ +
construction.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_MATRIXINDEXSET_HH
│ │ │ │ -
6#define DUNE_ISTL_MATRIXINDEXSET_HH
│ │ │ │ +
5#ifndef DUNE_AMGCONSTRUCTION_HH
│ │ │ │ +
6#define DUNE_AMGCONSTRUCTION_HH
│ │ │ │
7
│ │ │ │ -
8#include <vector>
│ │ │ │ -
9#include <set>
│ │ │ │ -
10
│ │ │ │ -
11namespace Dune {
│ │ │ │ -
12
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
12#include "pinfo.hh"
│ │ │ │
13
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
16 {
│ │ │ │ -
17
│ │ │ │ -
18 public:
│ │ │ │ -
19 typedef std::size_t size_type;
│ │ │ │ -
20
│ │ │ │ -
│ │ │ │ -
22 MatrixIndexSet() : rows_(0), cols_(0)
│ │ │ │ -
23 {}
│ │ │ │ -
│ │ │ │ -
24
│ │ │ │ -
│ │ │ │ -
26 MatrixIndexSet(size_type rows, size_type cols) : rows_(rows), cols_(cols) {
│ │ │ │ -
27 indices_.resize(rows_);
│ │ │ │ -
28 }
│ │ │ │ -
│ │ │ │ -
29
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
32 rows_ = rows;
│ │ │ │ -
33 cols_ = cols;
│ │ │ │ -
34 indices_.resize(rows_);
│ │ │ │ -
35 }
│ │ │ │ -
│ │ │ │ -
36
│ │ │ │ -
│ │ │ │ -
38 void add(size_type i, size_type j) {
│ │ │ │ -
39 indices_[i].insert(j);
│ │ │ │ -
40 }
│ │ │ │ -
│ │ │ │ -
41
│ │ │ │ -
│ │ │ │ -
43 size_type size() const {
│ │ │ │ -
44 size_type entries = 0;
│ │ │ │ -
45 for (size_type i=0; i<rows_; i++)
│ │ │ │ -
46 entries += indices_[i].size();
│ │ │ │ -
47
│ │ │ │ -
48 return entries;
│ │ │ │ -
49 }
│ │ │ │ -
│ │ │ │ -
50
│ │ │ │ -
52 size_type rows() const {return rows_;}
│ │ │ │ -
53
│ │ │ │ -
54
│ │ │ │ -
56 size_type rowsize(size_type row) const {return indices_[row].size();}
│ │ │ │ +
14namespace Dune
│ │ │ │ +
15{
│ │ │ │ +
16 namespace Amg
│ │ │ │ +
17 {
│ │ │ │ +
18
│ │ │ │ +
37 template<typename T>
│ │ │ │ +
38 struct ConstructionTraits
│ │ │ │ +
39 {
│ │ │ │ +
44 typedef const void* Arguments;
│ │ │ │ +
45
│ │ │ │ +
│ │ │ │ +
52 static inline std::shared_ptr<T> construct(Arguments& args)
│ │ │ │ +
53 {
│ │ │ │ +
54 return std::make_shared<T>();
│ │ │ │ +
55 }
│ │ │ │ +
│ │ │ │ +
56 };
│ │ │ │
57
│ │ │ │ -
64 template <class MatrixType>
│ │ │ │ -
│ │ │ │ -
65 void import(const MatrixType& m, size_type rowOffset=0, size_type colOffset=0) {
│ │ │ │ -
66
│ │ │ │ -
67 typedef typename MatrixType::row_type RowType;
│ │ │ │ -
68 typedef typename RowType::ConstIterator ColumnIterator;
│ │ │ │ -
69
│ │ │ │ -
70 for (size_type rowIdx=0; rowIdx<m.N(); rowIdx++) {
│ │ │ │ -
71
│ │ │ │ -
72 const RowType& row = m[rowIdx];
│ │ │ │ -
73
│ │ │ │ -
74 ColumnIterator cIt = row.begin();
│ │ │ │ -
75 ColumnIterator cEndIt = row.end();
│ │ │ │ -
76
│ │ │ │ -
77 for(; cIt!=cEndIt; ++cIt)
│ │ │ │ -
78 add(rowIdx+rowOffset, cIt.index()+colOffset);
│ │ │ │ -
79
│ │ │ │ -
80 }
│ │ │ │ -
81
│ │ │ │ -
82 }
│ │ │ │ -
│ │ │ │ -
83
│ │ │ │ -
89 template <class MatrixType>
│ │ │ │ -
│ │ │ │ -
90 void exportIdx(MatrixType& matrix) const {
│ │ │ │ -
91
│ │ │ │ -
92 matrix.setSize(rows_, cols_);
│ │ │ │ -
93 matrix.setBuildMode(MatrixType::random);
│ │ │ │ -
94
│ │ │ │ -
95 for (size_type i=0; i<rows_; i++)
│ │ │ │ -
96 matrix.setrowsize(i, indices_[i].size());
│ │ │ │ -
97
│ │ │ │ -
98 matrix.endrowsizes();
│ │ │ │ +
58 template<class T, class A>
│ │ │ │ +
│ │ │ │ +
59 struct ConstructionTraits<BlockVector<T,A> >
│ │ │ │ +
60 {
│ │ │ │ +
61 typedef const int Arguments;
│ │ │ │ +
│ │ │ │ +
62 static inline std::shared_ptr<BlockVector<T,A>> construct(Arguments& n)
│ │ │ │ +
63 {
│ │ │ │ +
64 return std::make_shared<BlockVector<T,A>>(n);
│ │ │ │ +
65 }
│ │ │ │ +
│ │ │ │ +
66 };
│ │ │ │ +
│ │ │ │ +
67
│ │ │ │ +
68 template<class M, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
70 {
│ │ │ │ +
│ │ │ │ +
71 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 for (size_type i=0; i<rows_; i++) {
│ │ │ │ +
100 } // end Amg namspace
│ │ │ │
101
│ │ │ │ -
102 typename std::set<size_type>::iterator it = indices_[i].begin();
│ │ │ │ -
103 for (; it!=indices_[i].end(); ++it)
│ │ │ │ -
104 matrix.addindex(i, *it);
│ │ │ │ +
102 // forward declaration
│ │ │ │ +
103 template<class M, class X, class Y, class C>
│ │ │ │ + │ │ │ │
105
│ │ │ │ -
106 }
│ │ │ │ -
107
│ │ │ │ -
108 matrix.endindices();
│ │ │ │ -
109
│ │ │ │ -
110 }
│ │ │ │ -
│ │ │ │ -
111
│ │ │ │ -
112 private:
│ │ │ │ -
113
│ │ │ │ -
114 std::vector<std::set<size_type> > indices_;
│ │ │ │ +
106 template<class M, class X, class Y, class C>
│ │ │ │ + │ │ │ │ +
108
│ │ │ │ +
109 namespace Amg
│ │ │ │ +
110 {
│ │ │ │ +
111 template<class M, class X, class Y, class C>
│ │ │ │ +
│ │ │ │ +
112 struct ConstructionTraits<OverlappingSchwarzOperator<M,X,Y,C> >
│ │ │ │ +
113 {
│ │ │ │ + │ │ │ │
115
│ │ │ │ -
116 size_type rows_, cols_;
│ │ │ │ -
117
│ │ │ │ -
118 };
│ │ │ │ -
│ │ │ │ -
119
│ │ │ │ -
120
│ │ │ │ -
121} // end namespace Dune
│ │ │ │ +
│ │ │ │ +
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#endif
│ │ │ │ +
123 template<class M, class X, class Y, class C>
│ │ │ │ +
│ │ │ │ +
124 struct ConstructionTraits<NonoverlappingSchwarzOperator<M,X,Y,C> >
│ │ │ │ +
125 {
│ │ │ │ + │ │ │ │ +
127
│ │ │ │ +
│ │ │ │ +
128 static inline std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
│ │ │ │ +
129 {
│ │ │ │ +
130 return std::make_shared<NonoverlappingSchwarzOperator<M,X,Y,C>>
│ │ │ │ +
131 (args.matrix_, args.comm_);
│ │ │ │ +
132 }
│ │ │ │ +
│ │ │ │ +
133 };
│ │ │ │ +
│ │ │ │ +
134
│ │ │ │ +
135 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
137 {
│ │ │ │ +
│ │ │ │ +
138 MatrixAdapterArgs(std::shared_ptr<M> matrix, const SequentialInformation)
│ │ │ │ +
139 : matrix_(matrix)
│ │ │ │ +
140 {}
│ │ │ │ +
│ │ │ │ +
141
│ │ │ │ +
142 std::shared_ptr<M> matrix_;
│ │ │ │ +
143 };
│ │ │ │ +
│ │ │ │ +
144
│ │ │ │ +
145 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ +
146 struct ConstructionTraits<MatrixAdapter<M,X,Y> >
│ │ │ │ +
147 {
│ │ │ │ + │ │ │ │ +
149
│ │ │ │ +
│ │ │ │ +
150 static inline std::shared_ptr<MatrixAdapter<M,X,Y>> construct(Arguments& args)
│ │ │ │ +
151 {
│ │ │ │ +
152 return std::make_shared<MatrixAdapter<M,X,Y>>(args.matrix_);
│ │ │ │ +
153 }
│ │ │ │ +
│ │ │ │ +
154 };
│ │ │ │ +
│ │ │ │ +
155
│ │ │ │ +
156 template<>
│ │ │ │ +
│ │ │ │ +
157 struct ConstructionTraits<SequentialInformation>
│ │ │ │ +
158 {
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
160 static inline std::shared_ptr<SequentialInformation> construct(Arguments& args)
│ │ │ │ +
161 {
│ │ │ │ +
162 return std::make_shared<SequentialInformation>(args.comm_);
│ │ │ │ +
163 }
│ │ │ │ +
│ │ │ │ +
164 };
│ │ │ │ +
│ │ │ │ +
165
│ │ │ │ +
166
│ │ │ │ +
167#if HAVE_MPI
│ │ │ │ +
168
│ │ │ │ +
169 template<class T1, class T2>
│ │ │ │ +
│ │ │ │ +
170 struct ConstructionTraits<OwnerOverlapCopyCommunication<T1,T2> >
│ │ │ │ +
171 {
│ │ │ │ + │ │ │ │ +
173
│ │ │ │ +
│ │ │ │ +
174 static inline std::shared_ptr<OwnerOverlapCopyCommunication<T1,T2>> construct(Arguments& args)
│ │ │ │ +
175 {
│ │ │ │ +
176 return std::make_shared<OwnerOverlapCopyCommunication<T1,T2>>(args.comm_, args.cat_);
│ │ │ │ +
177 }
│ │ │ │ +
│ │ │ │ +
178 };
│ │ │ │ +
│ │ │ │ +
179
│ │ │ │ +
180#endif
│ │ │ │ +
181
│ │ │ │ +
183 } // namespace Amg
│ │ │ │ +
184} // namespace Dune
│ │ │ │ +
185#endif
│ │ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ + │ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ + │ │ │ │ +
const int Arguments
Definition construction.hh:61
│ │ │ │ +
SequentialCommunicationArgs(Communication< void * > comm, int cat)
Definition construction.hh:93
│ │ │ │ +
OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat)
Definition construction.hh:82
│ │ │ │ +
MPI_Comm comm_
Definition construction.hh:86
│ │ │ │ +
SolverCategory::Category cat_
Definition construction.hh:87
│ │ │ │ +
const C & comm_
Definition construction.hh:76
│ │ │ │ +
ParallelOperatorArgs(std::shared_ptr< M > matrix, const C &comm)
Definition construction.hh:71
│ │ │ │ +
std::shared_ptr< M > matrix_
Definition construction.hh:75
│ │ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ +
Communication< void * > comm_
Definition construction.hh:97
│ │ │ │ +
static std::shared_ptr< BlockVector< T, A > > construct(Arguments &n)
Definition construction.hh:62
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Stores the nonzero entries in a sparse matrix.
Definition matrixindexset.hh:16
│ │ │ │ -
void resize(size_type rows, size_type cols)
Reset the size of an index set.
Definition matrixindexset.hh:31
│ │ │ │ -
MatrixIndexSet()
Default constructor.
Definition matrixindexset.hh:22
│ │ │ │ -
void add(size_type i, size_type j)
Add an index to the index set.
Definition matrixindexset.hh:38
│ │ │ │ -
size_type rows() const
Return the number of rows.
Definition matrixindexset.hh:52
│ │ │ │ -
std::size_t size_type
Definition matrixindexset.hh:19
│ │ │ │ -
void exportIdx(MatrixType &matrix) const
Initializes a BCRSMatrix with the indices contained in this MatrixIndexSet.
Definition matrixindexset.hh:90
│ │ │ │ -
MatrixIndexSet(size_type rows, size_type cols)
Constructor setting the matrix size.
Definition matrixindexset.hh:26
│ │ │ │ -
size_type rowsize(size_type row) const
Return the number of entries in a given row.
Definition matrixindexset.hh:56
│ │ │ │ -
size_type size() const
Return the number of entries.
Definition matrixindexset.hh:43
│ │ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ +
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │ +
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ +
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,156 +1,300 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -matrixindexset.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 (C) 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_MATRIXINDEXSET_HH │ │ │ │ │ -6#define DUNE_ISTL_MATRIXINDEXSET_HH │ │ │ │ │ +5#ifndef DUNE_AMGCONSTRUCTION_HH │ │ │ │ │ +6#define DUNE_AMGCONSTRUCTION_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e { │ │ │ │ │ -12 │ │ │ │ │ +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 │ │ │ │ │ -_1_5 class _M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ │ -16 { │ │ │ │ │ -17 │ │ │ │ │ -18 public: │ │ │ │ │ -_1_9 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -20 │ │ │ │ │ -_2_2 _M_a_t_r_i_x_I_n_d_e_x_S_e_t() : rows_(0), cols_(0) │ │ │ │ │ -23 {} │ │ │ │ │ -24 │ │ │ │ │ -_2_6 _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 cols) : rows_(_r_o_w_s), cols_(cols) { │ │ │ │ │ -27 indices_.resize(rows_); │ │ │ │ │ -28 } │ │ │ │ │ -29 │ │ │ │ │ -_3_1 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 cols) { │ │ │ │ │ -32 rows_ = _r_o_w_s; │ │ │ │ │ -33 cols_ = cols; │ │ │ │ │ -34 indices_.resize(rows_); │ │ │ │ │ -35 } │ │ │ │ │ -36 │ │ │ │ │ -_3_8 void _a_d_d(_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e j) { │ │ │ │ │ -39 indices_[i].insert(j); │ │ │ │ │ -40 } │ │ │ │ │ -41 │ │ │ │ │ -_4_3 _s_i_z_e___t_y_p_e _s_i_z_e() const { │ │ │ │ │ -44 _s_i_z_e___t_y_p_e entries = 0; │ │ │ │ │ -45 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +38 struct ConstructionTraits │ │ │ │ │ +39 { │ │ │ │ │ +_4_4 typedef const void* _A_r_g_u_m_e_n_t_s; │ │ │ │ │ +45 │ │ │ │ │ +_5_2 static inline std::shared_ptr _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ +53 { │ │ │ │ │ +54 return std::make_shared(); │ │ │ │ │ +55 } │ │ │ │ │ +56 }; │ │ │ │ │ 57 │ │ │ │ │ -64 template │ │ │ │ │ -_6_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) { │ │ │ │ │ -66 │ │ │ │ │ -67 typedef typename MatrixType::row_type RowType; │ │ │ │ │ -68 typedef typename RowType::ConstIterator ColumnIterator; │ │ │ │ │ -69 │ │ │ │ │ -70 for (_s_i_z_e___t_y_p_e rowIdx=0; rowIdx │ │ │ │ │ -_9_0 void _e_x_p_o_r_t_I_d_x(MatrixType& matrix) const { │ │ │ │ │ -91 │ │ │ │ │ -92 matrix.setSize(rows_, cols_); │ │ │ │ │ -93 matrix.setBuildMode(MatrixType::random); │ │ │ │ │ -94 │ │ │ │ │ -95 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_5_9 struct ConstructionTraits<_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ │ +60 { │ │ │ │ │ +_6_1 typedef const int _A_r_g_u_m_e_n_t_s; │ │ │ │ │ +_6_2 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& n) │ │ │ │ │ +63 { │ │ │ │ │ +64 return std::make_shared>(n); │ │ │ │ │ +65 } │ │ │ │ │ +66 }; │ │ │ │ │ +67 │ │ │ │ │ +68 template │ │ │ │ │ +_6_9 struct _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s │ │ │ │ │ +70 { │ │ │ │ │ +_7_1 _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s(std::shared_ptr matrix, const C& comm) │ │ │ │ │ +72 : _m_a_t_r_i_x__(matrix), _c_o_m_m__(comm) │ │ │ │ │ +73 {} │ │ │ │ │ +74 │ │ │ │ │ +_7_5 std::shared_ptr _m_a_t_r_i_x__; │ │ │ │ │ +_7_6 const C& _c_o_m_m__; │ │ │ │ │ +77 }; │ │ │ │ │ +78 │ │ │ │ │ +79#if HAVE_MPI │ │ │ │ │ +_8_0 struct _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ │ +81 { │ │ │ │ │ +_8_2 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s(MPI_Comm comm, _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ +cat) │ │ │ │ │ +83 : _c_o_m_m__(comm), _c_a_t__(cat) │ │ │ │ │ +84 {} │ │ │ │ │ +85 │ │ │ │ │ +_8_6 MPI_Comm _c_o_m_m__; │ │ │ │ │ +_8_7 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t__; │ │ │ │ │ +88 }; │ │ │ │ │ +89#endif │ │ │ │ │ +90 │ │ │ │ │ +_9_1 struct _S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ │ +92 { │ │ │ │ │ +_9_3 _S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s(Communication comm, [[maybe_unused]] int │ │ │ │ │ +cat) │ │ │ │ │ +94 : _c_o_m_m__(comm) │ │ │ │ │ +95 {} │ │ │ │ │ +96 │ │ │ │ │ +_9_7 Communication _c_o_m_m__; │ │ │ │ │ +98 }; │ │ │ │ │ 99 │ │ │ │ │ -100 for (_s_i_z_e___t_y_p_e i=0; i::iterator it = indices_[i].begin(); │ │ │ │ │ -103 for (; it!=indices_[i].end(); ++it) │ │ │ │ │ -104 matrix.addindex(i, *it); │ │ │ │ │ +102 // forward declaration │ │ │ │ │ +103 template │ │ │ │ │ +104 class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r; │ │ │ │ │ 105 │ │ │ │ │ -106 } │ │ │ │ │ -107 │ │ │ │ │ -108 matrix.endindices(); │ │ │ │ │ -109 │ │ │ │ │ -110 } │ │ │ │ │ -111 │ │ │ │ │ -112 private: │ │ │ │ │ -113 │ │ │ │ │ -114 std::vector > indices_; │ │ │ │ │ +106 template │ │ │ │ │ +107 class _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r; │ │ │ │ │ +108 │ │ │ │ │ +109 namespace Amg │ │ │ │ │ +110 { │ │ │ │ │ +111 template │ │ │ │ │ +_1_1_2 struct ConstructionTraits<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r > │ │ │ │ │ +113 { │ │ │ │ │ +_1_1_4 typedef _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ │ 115 │ │ │ │ │ -116 _s_i_z_e___t_y_p_e rows_, cols_; │ │ │ │ │ -117 │ │ │ │ │ -118 }; │ │ │ │ │ -119 │ │ │ │ │ -120 │ │ │ │ │ -121} // end namespace Dune │ │ │ │ │ +_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#endif │ │ │ │ │ +123 template │ │ │ │ │ +_1_2_4 struct ConstructionTraits<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r > │ │ │ │ │ +125 { │ │ │ │ │ +_1_2_6 typedef _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ │ +127 │ │ │ │ │ +_1_2_8 static inline std::shared_ptr> │ │ │ │ │ +_c_o_n_s_t_r_u_c_t(const _A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ +129 { │ │ │ │ │ +130 return std::make_shared> │ │ │ │ │ +131 (args._m_a_t_r_i_x__, args._c_o_m_m__); │ │ │ │ │ +132 } │ │ │ │ │ +133 }; │ │ │ │ │ +134 │ │ │ │ │ +135 template │ │ │ │ │ +_1_3_6 struct _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s │ │ │ │ │ +137 { │ │ │ │ │ +_1_3_8 _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s(std::shared_ptr matrix, const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n) │ │ │ │ │ +139 : _m_a_t_r_i_x__(matrix) │ │ │ │ │ +140 {} │ │ │ │ │ +141 │ │ │ │ │ +_1_4_2 std::shared_ptr _m_a_t_r_i_x__; │ │ │ │ │ +143 }; │ │ │ │ │ +144 │ │ │ │ │ +145 template │ │ │ │ │ +_1_4_6 struct ConstructionTraits<_M_a_t_r_i_x_A_d_a_p_t_e_r > │ │ │ │ │ +147 { │ │ │ │ │ +_1_4_8 typedef const _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s_<_M_,_X_,_Y_> _A_r_g_u_m_e_n_t_s; │ │ │ │ │ +149 │ │ │ │ │ +_1_5_0 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& │ │ │ │ │ +args) │ │ │ │ │ +151 { │ │ │ │ │ +152 return std::make_shared>(args._m_a_t_r_i_x__); │ │ │ │ │ +153 } │ │ │ │ │ +154 }; │ │ │ │ │ +155 │ │ │ │ │ +156 template<> │ │ │ │ │ +_1_5_7 struct ConstructionTraits<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ │ +158 { │ │ │ │ │ +_1_5_9 typedef const _S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s _A_r_g_u_m_e_n_t_s; │ │ │ │ │ +_1_6_0 static inline std::shared_ptr _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& │ │ │ │ │ +args) │ │ │ │ │ +161 { │ │ │ │ │ +162 return std::make_shared(args._c_o_m_m__); │ │ │ │ │ +163 } │ │ │ │ │ +164 }; │ │ │ │ │ +165 │ │ │ │ │ +166 │ │ │ │ │ +167#if HAVE_MPI │ │ │ │ │ +168 │ │ │ │ │ +169 template │ │ │ │ │ +_1_7_0 struct ConstructionTraits<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n > │ │ │ │ │ +171 { │ │ │ │ │ +_1_7_2 typedef const _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s _A_r_g_u_m_e_n_t_s; │ │ │ │ │ +173 │ │ │ │ │ +_1_7_4 static inline std::shared_ptr> │ │ │ │ │ +_c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ │ +175 { │ │ │ │ │ +176 return std::make_shared>(args._c_o_m_m__, │ │ │ │ │ +args._c_a_t__); │ │ │ │ │ +177 } │ │ │ │ │ +178 }; │ │ │ │ │ +179 │ │ │ │ │ +180#endif │ │ │ │ │ +181 │ │ │ │ │ +183 } // namespace Amg │ │ │ │ │ +184} // namespace Dune │ │ │ │ │ +185#endif │ │ │ │ │ +_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ │ +_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ │ +Define general, extensible interface for operators. The available │ │ │ │ │ +implementation wraps a matrix. │ │ │ │ │ +_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 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ +const int Arguments │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ │ +SequentialCommunicationArgs(Communication< void * > comm, int cat) │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ │ +OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat) │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ │ +MPI_Comm comm_ │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_a_t__ │ │ │ │ │ +SolverCategory::Category cat_ │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ │ +const C & comm_ │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s │ │ │ │ │ +ParallelOperatorArgs(std::shared_ptr< M > matrix, const C &comm) │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_m_a_t_r_i_x__ │ │ │ │ │ +std::shared_ptr< M > matrix_ │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ +const void * Arguments │ │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ │ +Communication< void * > comm_ │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:97 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +static std::shared_ptr< BlockVector< T, A > > construct(Arguments &n) │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:62 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ │ -Stores the nonzero entries in a sparse matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrixindexset.hh:16 │ │ │ │ │ -_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:31 │ │ │ │ │ -_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() │ │ │ │ │ -Default constructor. │ │ │ │ │ -DDeeffiinniittiioonn matrixindexset.hh:22 │ │ │ │ │ -_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 i, size_type j) │ │ │ │ │ -Add an index to the index set. │ │ │ │ │ -DDeeffiinniittiioonn matrixindexset.hh:38 │ │ │ │ │ -_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:52 │ │ │ │ │ -_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 │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixindexset.hh:19 │ │ │ │ │ -_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:90 │ │ │ │ │ -_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) │ │ │ │ │ -Constructor setting the matrix size. │ │ │ │ │ -DDeeffiinniittiioonn matrixindexset.hh:26 │ │ │ │ │ -_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:56 │ │ │ │ │ -_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:43 │ │ │ │ │ +_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:395 │ │ │ │ │ +_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:137 │ │ │ │ │ +_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.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00164.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: arpackpp.hh File Reference │ │ │ │ +dune-istl: graph.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,48 +65,100 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
arpackpp.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#include <cmath>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ -#include <dune/istl/bvector.hh>
│ │ │ │ -#include <dune/istl/istlexception.hh>
│ │ │ │ -#include <dune/istl/io.hh>
│ │ │ │ -#include "arssym.h"
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#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::ArPackPlusPlus_Algorithms< BCRSMatrix, BlockVector >
 Wrapper to use a range of ARPACK++ eigenvalue solvers. More...
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

│ │ │ │ +

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,29 +1,85 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -arpackpp.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_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 | _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 │ │ │ │ │ +#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 <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ │ -#include "arssym.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_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s_<_ _B_C_R_S_M_a_t_r_i_x_,_ _B_l_o_c_k_V_e_c_t_o_r_ _> │ │ │ │ │ -  Wrapper to use a range of ARPACK++ eigenvalue solvers. _M_o_r_e_._._. │ │ │ │ │ +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 ********** │ │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ +During the coarsening process in AMG the matrix graph together with the │ │ │ │ │ +dependencies, what connections in the graph are considered strong or weak, what │ │ │ │ │ +vertices are isolated, etc., have to build. This information will be contained │ │ │ │ │ +in the MatrixGraph class. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00164_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: arpackpp.hh Source File │ │ │ │ +dune-istl: graph.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,881 +70,1825 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
arpackpp.hh
│ │ │ │ +
graph.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_EIGENVALUE_ARPACKPP_HH
│ │ │ │ -
6#define DUNE_ISTL_EIGENVALUE_ARPACKPP_HH
│ │ │ │ +
5#ifndef DUNE_AMG_GRAPH_HH
│ │ │ │ +
6#define DUNE_AMG_GRAPH_HH
│ │ │ │
7
│ │ │ │ -
8#if HAVE_ARPACKPP || defined DOXYGEN
│ │ │ │ -
9
│ │ │ │ -
10#include <cmath> // provides std::abs, std::pow, std::sqrt
│ │ │ │ -
11
│ │ │ │ -
12#include <iostream> // provides std::cout, std::endl
│ │ │ │ -
13#include <string> // provides std::string
│ │ │ │ -
14
│ │ │ │ -
15#include <dune/common/fvector.hh> // provides Dune::FieldVector
│ │ │ │ -
16#include <dune/common/exceptions.hh> // provides DUNE_THROW(...)
│ │ │ │ +
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
│ │ │ │ -
18#include <dune/istl/blocklevel.hh> // provides Dune::blockLevel
│ │ │ │ -
19#include <dune/istl/bvector.hh> // provides Dune::BlockVector
│ │ │ │ -
20#include <dune/istl/istlexception.hh> // provides Dune::ISTLError
│ │ │ │ -
21#include <dune/istl/io.hh> // provides Dune::printvector(...)
│ │ │ │ -
22
│ │ │ │ -
23#ifdef Status
│ │ │ │ -
24#undef Status // prevent preprocessor from damaging the ARPACK++
│ │ │ │ -
25 // code when "X11/Xlib.h" is included (the latter
│ │ │ │ -
26 // defines Status as "#define Status int" and
│ │ │ │ -
27 // ARPACK++ provides a class with a method called
│ │ │ │ -
28 // Status)
│ │ │ │ -
29#endif
│ │ │ │ -
30#include "arssym.h" // provides ARSymStdEig
│ │ │ │ -
31
│ │ │ │ -
32namespace Dune
│ │ │ │ -
33{
│ │ │ │ -
34
│ │ │ │ -
39 namespace Impl {
│ │ │ │ -
55 template <class BCRSMatrix>
│ │ │ │ -
56 class ArPackPlusPlus_BCRSMatrixWrapper
│ │ │ │ -
57 {
│ │ │ │ -
58 public:
│ │ │ │ -
60 typedef typename BCRSMatrix::field_type Real;
│ │ │ │ -
61
│ │ │ │ -
62 public:
│ │ │ │ -
64 ArPackPlusPlus_BCRSMatrixWrapper (const BCRSMatrix& A)
│ │ │ │ -
65 : A_(A),
│ │ │ │ -
66 m_(A_.M() * mBlock), n_(A_.N() * nBlock)
│ │ │ │ -
67 {
│ │ │ │ -
68 // assert that BCRSMatrix type has blocklevel 2
│ │ │ │ -
69 static_assert
│ │ │ │ -
70 (blockLevel<BCRSMatrix>() == 2,
│ │ │ │ -
71 "Only BCRSMatrices with blocklevel 2 are supported.");
│ │ │ │ -
72
│ │ │ │ -
73 // allocate memory for auxiliary block vector objects
│ │ │ │ -
74 // which are compatible to matrix rows / columns
│ │ │ │ -
75 domainBlockVector.resize(A_.N());
│ │ │ │ -
76 rangeBlockVector.resize(A_.M());
│ │ │ │ -
77 }
│ │ │ │ -
78
│ │ │ │ -
80 inline void multMv (Real* v, Real* w)
│ │ │ │ -
81 {
│ │ │ │ -
82 // get vector v as an object of appropriate type
│ │ │ │ -
83 arrayToDomainBlockVector(v,domainBlockVector);
│ │ │ │ -
84
│ │ │ │ -
85 // perform matrix-vector product
│ │ │ │ -
86 A_.mv(domainBlockVector,rangeBlockVector);
│ │ │ │ -
87
│ │ │ │ -
88 // get vector w from object of appropriate type
│ │ │ │ -
89 rangeBlockVectorToArray(rangeBlockVector,w);
│ │ │ │ -
90 };
│ │ │ │ -
91
│ │ │ │ -
93 inline void multMtMv (Real* v, Real* w)
│ │ │ │ -
94 {
│ │ │ │ -
95 // get vector v as an object of appropriate type
│ │ │ │ -
96 arrayToDomainBlockVector(v,domainBlockVector);
│ │ │ │ -
97
│ │ │ │ -
98 // perform matrix-vector product
│ │ │ │ -
99 A_.mv(domainBlockVector,rangeBlockVector);
│ │ │ │ -
100 A_.mtv(rangeBlockVector,domainBlockVector);
│ │ │ │ -
101
│ │ │ │ -
102 // get vector w from object of appropriate type
│ │ │ │ -
103 domainBlockVectorToArray(domainBlockVector,w);
│ │ │ │ -
104 };
│ │ │ │ -
105
│ │ │ │ -
107 inline void multMMtv (Real* v, Real* w)
│ │ │ │ -
108 {
│ │ │ │ -
109 // get vector v as an object of appropriate type
│ │ │ │ -
110 arrayToRangeBlockVector(v,rangeBlockVector);
│ │ │ │ -
111
│ │ │ │ -
112 // perform matrix-vector product
│ │ │ │ -
113 A_.mtv(rangeBlockVector,domainBlockVector);
│ │ │ │ -
114 A_.mv(domainBlockVector,rangeBlockVector);
│ │ │ │ -
115
│ │ │ │ -
116 // get vector w from object of appropriate type
│ │ │ │ -
117 rangeBlockVectorToArray(rangeBlockVector,w);
│ │ │ │ -
118 };
│ │ │ │ -
119
│ │ │ │ -
121 inline int nrows () const { return m_; }
│ │ │ │ -
122
│ │ │ │ -
124 inline int ncols () const { return n_; }
│ │ │ │ -
125
│ │ │ │ -
126 protected:
│ │ │ │ -
127 // Number of rows and columns in each block of the matrix
│ │ │ │ -
128 constexpr static int mBlock = BCRSMatrix::block_type::rows;
│ │ │ │ -
129 constexpr static int nBlock = BCRSMatrix::block_type::cols;
│ │ │ │ -
130
│ │ │ │ -
131 // Type of vectors in the domain of the linear map associated with
│ │ │ │ -
132 // the matrix, i.e. block vectors compatible to matrix rows
│ │ │ │ -
133 constexpr static int dbvBlockSize = nBlock;
│ │ │ │ -
134 typedef Dune::FieldVector<Real,dbvBlockSize> DomainBlockVectorBlock;
│ │ │ │ -
135 typedef Dune::BlockVector<DomainBlockVectorBlock> DomainBlockVector;
│ │ │ │ -
136
│ │ │ │ -
137 // Type of vectors in the range of the linear map associated with
│ │ │ │ -
138 // the matrix, i.e. block vectors compatible to matrix columns
│ │ │ │ -
139 constexpr static int rbvBlockSize = mBlock;
│ │ │ │ -
140 typedef Dune::FieldVector<Real,rbvBlockSize> RangeBlockVectorBlock;
│ │ │ │ -
141 typedef Dune::BlockVector<RangeBlockVectorBlock> RangeBlockVector;
│ │ │ │ -
142
│ │ │ │ -
143 // Types for vector index access
│ │ │ │ -
144 typedef typename DomainBlockVector::size_type dbv_size_type;
│ │ │ │ -
145 typedef typename RangeBlockVector::size_type rbv_size_type;
│ │ │ │ -
146 typedef typename DomainBlockVectorBlock::size_type dbvb_size_type;
│ │ │ │ -
147 typedef typename RangeBlockVectorBlock::size_type rbvb_size_type;
│ │ │ │ -
148
│ │ │ │ -
149 // Get vector v from a block vector object which is compatible to
│ │ │ │ -
150 // matrix rows
│ │ │ │ -
151 static inline void
│ │ │ │ -
152 domainBlockVectorToArray (const DomainBlockVector& dbv, Real* v)
│ │ │ │ -
153 {
│ │ │ │ -
154 for (dbv_size_type block = 0; block < dbv.N(); ++block)
│ │ │ │ -
155 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock)
│ │ │ │ -
156 v[block*dbvBlockSize + iBlock] = dbv[block][iBlock];
│ │ │ │ -
157 }
│ │ │ │ -
158
│ │ │ │ -
159 // Get vector v from a block vector object which is compatible to
│ │ │ │ -
160 // matrix columns
│ │ │ │ -
161 static inline void
│ │ │ │ -
162 rangeBlockVectorToArray (const RangeBlockVector& rbv, Real* v)
│ │ │ │ -
163 {
│ │ │ │ -
164 for (rbv_size_type block = 0; block < rbv.N(); ++block)
│ │ │ │ -
165 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock)
│ │ │ │ -
166 v[block*rbvBlockSize + iBlock] = rbv[block][iBlock];
│ │ │ │ -
167 }
│ │ │ │ +
18namespace Dune
│ │ │ │ +
19{
│ │ │ │ +
20 namespace Amg
│ │ │ │ +
21 {
│ │ │ │ +
49 template<class M>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
51 {
│ │ │ │ +
52 public:
│ │ │ │ +
56 typedef M Matrix;
│ │ │ │ +
57
│ │ │ │ +
61 typedef typename std::remove_const<M>::type MutableMatrix;
│ │ │ │ +
62
│ │ │ │ +
66 typedef typename M::block_type Weight;
│ │ │ │ +
67
│ │ │ │ +
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
│ │ │ │ -
169 public:
│ │ │ │ -
172 static inline void arrayToDomainBlockVector (const Real* v,
│ │ │ │ -
173 DomainBlockVector& dbv)
│ │ │ │ -
174 {
│ │ │ │ -
175 for (dbv_size_type block = 0; block < dbv.N(); ++block)
│ │ │ │ -
176 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock)
│ │ │ │ -
177 dbv[block][iBlock] = v[block*dbvBlockSize + iBlock];
│ │ │ │ -
178 }
│ │ │ │ -
179
│ │ │ │ -
182 static inline void arrayToRangeBlockVector (const Real* v,
│ │ │ │ -
183 RangeBlockVector& rbv)
│ │ │ │ -
184 {
│ │ │ │ -
185 for (rbv_size_type block = 0; block < rbv.N(); ++block)
│ │ │ │ -
186 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock)
│ │ │ │ -
187 rbv[block][iBlock] = v[block*rbvBlockSize + iBlock];
│ │ │ │ -
188 }
│ │ │ │ +
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 protected:
│ │ │ │ -
191 // The DUNE-ISTL BCRSMatrix
│ │ │ │ -
192 const BCRSMatrix& A_;
│ │ │ │ -
193
│ │ │ │ -
194 // Number of rows and columns in the matrix
│ │ │ │ -
195 const int m_, n_;
│ │ │ │ -
196
│ │ │ │ -
197 // Auxiliary block vector objects which are
│ │ │ │ -
198 // compatible to matrix rows / columns
│ │ │ │ -
199 mutable DomainBlockVector domainBlockVector;
│ │ │ │ -
200 mutable RangeBlockVector rangeBlockVector;
│ │ │ │ -
201 };
│ │ │ │ -
202 } // end namespace Impl
│ │ │ │ +
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
│ │ │ │ -
243 template <typename BCRSMatrix, typename BlockVector>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
245 {
│ │ │ │ -
246 public:
│ │ │ │ - │ │ │ │ -
248
│ │ │ │ -
249 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
269 const unsigned int nIterationsMax = 100000,
│ │ │ │ -
270 const unsigned int verbosity_level = 0)
│ │ │ │ -
271 : m_(m), nIterationsMax_(nIterationsMax),
│ │ │ │ -
272 verbosity_level_(verbosity_level),
│ │ │ │ -
273 nIterations_(0),
│ │ │ │ -
274 title_(" ArPackPlusPlus_Algorithms: "),
│ │ │ │ -
275 blank_(title_.length(),' ')
│ │ │ │ -
276 {}
│ │ │ │ -
│ │ │ │ -
277
│ │ │ │ -
│ │ │ │ -
289 inline void computeSymMaxMagnitude (const Real& epsilon,
│ │ │ │ -
290 BlockVector& x, Real& lambda) const
│ │ │ │ -
291 {
│ │ │ │ -
292 // print verbosity information
│ │ │ │ -
293 if (verbosity_level_ > 0)
│ │ │ │ -
294 std::cout << title_ << "Computing an approximation of "
│ │ │ │ -
295 << "the dominant eigenvalue of a matrix which "
│ │ │ │ -
296 << "is assumed to be symmetric." << std::endl;
│ │ │ │ -
297
│ │ │ │ -
298 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ -
299 // and to perform the product A*v (LU decomposition is not used)
│ │ │ │ -
300 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ -
301 WrappedMatrix A(m_);
│ │ │ │ -
302
│ │ │ │ -
303 // get number of rows and columns in A
│ │ │ │ -
304 const int nrows = A.nrows();
│ │ │ │ -
305 const int ncols = A.ncols();
│ │ │ │ -
306
│ │ │ │ -
307 // assert that A is square
│ │ │ │ -
308 if (nrows != ncols)
│ │ │ │ -
309 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ -
310 << nrows << "x" << ncols << ").");
│ │ │ │ -
311
│ │ │ │ -
312 // allocate memory for variables, set parameters
│ │ │ │ -
313 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ -
314 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ -
315 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ -
316 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ -
317 Real* ev = new Real[nev]; // Computed eigenvalues of A
│ │ │ │ -
318 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ -
319 int nconv; // Number of converged eigenvalues
│ │ │ │ +
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
│ │ │ │ -
321 // define what we need: eigenvalues with largest magnitude
│ │ │ │ -
322 char which[] = "LM";
│ │ │ │ -
323 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ -
324 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit);
│ │ │ │ + │ │ │ │
325
│ │ │ │ -
326 // set ARPACK verbosity mode if requested
│ │ │ │ -
327 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ -
328
│ │ │ │ -
329 // find eigenvalues and eigenvectors of A, obtain the eigenvalues
│ │ │ │ -
330 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ + │ │ │ │
331
│ │ │ │ -
332 // obtain approximated dominant eigenvalue of A
│ │ │ │ -
333 lambda = ev[nev-1];
│ │ │ │ -
334
│ │ │ │ -
335 // obtain associated approximated eigenvector of A
│ │ │ │ -
336 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ -
337 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │ -
338
│ │ │ │ -
339 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ -
340 nIterations_ = dprob.GetIter();
│ │ │ │ -
341
│ │ │ │ -
342 // compute residual norm
│ │ │ │ -
343 BlockVector r(x);
│ │ │ │ -
344 Real* Ax_raw = new Real[nrows];
│ │ │ │ -
345 A.multMv(x_raw,Ax_raw);
│ │ │ │ -
346 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r);
│ │ │ │ -
347 r.axpy(-lambda,x);
│ │ │ │ -
348 const Real r_norm = r.two_norm();
│ │ │ │ + │ │ │ │ +
337
│ │ │ │ + │ │ │ │ +
343
│ │ │ │ + │ │ │ │
349
│ │ │ │ -
350 // print verbosity information
│ │ │ │ -
351 if (verbosity_level_ > 0)
│ │ │ │ -
352 {
│ │ │ │ -
353 if (verbosity_level_ > 1)
│ │ │ │ -
354 {
│ │ │ │ -
355 // print some information about the problem
│ │ │ │ -
356 std::cout << blank_ << "Obtained eigenvalues of A by solving "
│ │ │ │ -
357 << "A*x = λ*x using the ARPACK++ class ARSym"
│ │ │ │ -
358 << "StdEig:" << std::endl;
│ │ │ │ -
359 std::cout << blank_ << " converged eigenvalues of A: "
│ │ │ │ -
360 << nconv << " / " << nev << std::endl;
│ │ │ │ -
361 std::cout << blank_ << " dominant eigenvalue of A: "
│ │ │ │ -
362 << lambda << std::endl;
│ │ │ │ -
363 }
│ │ │ │ -
364 std::cout << blank_ << "Result ("
│ │ │ │ -
365 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
366 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
367 << "λ = " << lambda << std::endl;
│ │ │ │ -
368 if (verbosity_level_ > 2)
│ │ │ │ -
369 {
│ │ │ │ -
370 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ -
371 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
372 }
│ │ │ │ -
373 }
│ │ │ │ + │ │ │ │ +
357
│ │ │ │ + │ │ │ │ +
365
│ │ │ │ +
366
│ │ │ │ + │ │ │ │
374
│ │ │ │ -
375 // free dynamically allocated memory
│ │ │ │ -
376 delete[] Ax_raw;
│ │ │ │ -
377 delete[] ev;
│ │ │ │ -
378 }
│ │ │ │ -
│ │ │ │ -
379
│ │ │ │ -
│ │ │ │ -
391 inline void computeSymMinMagnitude (const Real& epsilon,
│ │ │ │ -
392 BlockVector& x, Real& lambda) const
│ │ │ │ -
393 {
│ │ │ │ -
394 // print verbosity information
│ │ │ │ -
395 if (verbosity_level_ > 0)
│ │ │ │ -
396 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ -
397 << "least dominant eigenvalue of a matrix which "
│ │ │ │ -
398 << "is assumed to be symmetric." << std::endl;
│ │ │ │ + │ │ │ │ +
382
│ │ │ │ + │ │ │ │ +
388
│ │ │ │ +
393 const Matrix& matrix() const;
│ │ │ │ +
394
│ │ │ │ +
398 std::size_t noVertices() const;
│ │ │ │
399
│ │ │ │ -
400 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ -
401 // and to perform the product A*v (LU decomposition is not used)
│ │ │ │ -
402 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ -
403 WrappedMatrix A(m_);
│ │ │ │ -
404
│ │ │ │ -
405 // get number of rows and columns in A
│ │ │ │ -
406 const int nrows = A.nrows();
│ │ │ │ -
407 const int ncols = A.ncols();
│ │ │ │ -
408
│ │ │ │ -
409 // assert that A is square
│ │ │ │ -
410 if (nrows != ncols)
│ │ │ │ -
411 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ -
412 << nrows << "x" << ncols << ").");
│ │ │ │ -
413
│ │ │ │ -
414 // allocate memory for variables, set parameters
│ │ │ │ -
415 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ -
416 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ -
417 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ -
418 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ -
419 Real* ev = new Real[nev]; // Computed eigenvalues of A
│ │ │ │ -
420 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ -
421 int nconv; // Number of converged eigenvalues
│ │ │ │ -
422
│ │ │ │ -
423 // define what we need: eigenvalues with smallest magnitude
│ │ │ │ -
424 char which[] = "SM";
│ │ │ │ -
425 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ -
426 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit);
│ │ │ │ -
427
│ │ │ │ -
428 // set ARPACK verbosity mode if requested
│ │ │ │ -
429 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ -
430
│ │ │ │ -
431 // find eigenvalues and eigenvectors of A, obtain the eigenvalues
│ │ │ │ -
432 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ -
433
│ │ │ │ -
434 // obtain approximated least dominant eigenvalue of A
│ │ │ │ -
435 lambda = ev[nev-1];
│ │ │ │ -
436
│ │ │ │ -
437 // obtain associated approximated eigenvector of A
│ │ │ │ -
438 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ -
439 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │ -
440
│ │ │ │ -
441 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ -
442 nIterations_ = dprob.GetIter();
│ │ │ │ -
443
│ │ │ │ -
444 // compute residual norm
│ │ │ │ -
445 BlockVector r(x);
│ │ │ │ -
446 Real* Ax_raw = new Real[nrows];
│ │ │ │ -
447 A.multMv(x_raw,Ax_raw);
│ │ │ │ -
448 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r);
│ │ │ │ -
449 r.axpy(-lambda,x);
│ │ │ │ -
450 const Real r_norm = r.two_norm();
│ │ │ │ -
451
│ │ │ │ -
452 // print verbosity information
│ │ │ │ -
453 if (verbosity_level_ > 0)
│ │ │ │ -
454 {
│ │ │ │ -
455 if (verbosity_level_ > 1)
│ │ │ │ -
456 {
│ │ │ │ -
457 // print some information about the problem
│ │ │ │ -
458 std::cout << blank_ << "Obtained eigenvalues of A by solving "
│ │ │ │ -
459 << "A*x = λ*x using the ARPACK++ class ARSym"
│ │ │ │ -
460 << "StdEig:" << std::endl;
│ │ │ │ -
461 std::cout << blank_ << " converged eigenvalues of A: "
│ │ │ │ -
462 << nconv << " / " << nev << std::endl;
│ │ │ │ -
463 std::cout << blank_ << " least dominant eigenvalue of A: "
│ │ │ │ -
464 << lambda << std::endl;
│ │ │ │ -
465 }
│ │ │ │ -
466 std::cout << blank_ << "Result ("
│ │ │ │ -
467 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
468 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
469 << "λ = " << lambda << std::endl;
│ │ │ │ -
470 if (verbosity_level_ > 2)
│ │ │ │ -
471 {
│ │ │ │ -
472 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ -
473 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
474 }
│ │ │ │ -
475 }
│ │ │ │ -
476
│ │ │ │ -
477 // free dynamically allocated memory
│ │ │ │ -
478 delete[] Ax_raw;
│ │ │ │ -
479 delete[] ev;
│ │ │ │ -
480 }
│ │ │ │ -
│ │ │ │ -
481
│ │ │ │ -
│ │ │ │ -
493 inline void computeSymCond2 (const Real& epsilon, Real& cond_2) const
│ │ │ │ -
494 {
│ │ │ │ -
495 // print verbosity information
│ │ │ │ -
496 if (verbosity_level_ > 0)
│ │ │ │ -
497 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ -
498 << "spectral condition number of a matrix which "
│ │ │ │ -
499 << "is assumed to be symmetric." << std::endl;
│ │ │ │ + │ │ │ │ +
407
│ │ │ │ +
411 std::size_t noEdges() const;
│ │ │ │ +
412
│ │ │ │ + │ │ │ │ +
420 const VertexDescriptor& target) const;
│ │ │ │ +
421
│ │ │ │ +
422 private:
│ │ │ │ +
424 Matrix& matrix_;
│ │ │ │ +
426 EdgeDescriptor* start_;
│ │ │ │ +
428 MatrixGraph(const MatrixGraph&);
│ │ │ │ +
429
│ │ │ │ +
430 };
│ │ │ │ +
│ │ │ │ +
431
│ │ │ │ +
441 template<class G, class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
443 {
│ │ │ │ +
444 public:
│ │ │ │ +
448 typedef G Graph;
│ │ │ │ +
449
│ │ │ │ +
454 typedef T Excluded;
│ │ │ │ +
455
│ │ │ │ +
459 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ │ +
460
│ │ │ │ + │ │ │ │ +
462
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
470 {
│ │ │ │ +
471 public:
│ │ │ │ +
472 typedef ReadablePropertyMapTag Category;
│ │ │ │ +
473
│ │ │ │ +
│ │ │ │ +
474 EdgeIndexMap(const EdgeDescriptor& firstEdge)
│ │ │ │ +
475 : firstEdge_(firstEdge)
│ │ │ │ +
476 {}
│ │ │ │ +
│ │ │ │ +
477
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
480 : firstEdge_(emap.firstEdge_)
│ │ │ │ +
481 {}
│ │ │ │ +
│ │ │ │ +
482
│ │ │ │ +
│ │ │ │ +
483 std::size_t operator[](const EdgeDescriptor& edge) const
│ │ │ │ +
484 {
│ │ │ │ +
485 return edge-firstEdge_;
│ │ │ │ +
486 }
│ │ │ │ +
│ │ │ │ +
487 private:
│ │ │ │ +
489 EdgeDescriptor firstEdge_;
│ │ │ │ + │ │ │ │ +
492 {}
│ │ │ │ +
493 };
│ │ │ │ +
│ │ │ │ +
494
│ │ │ │ + │ │ │ │
500
│ │ │ │ -
501 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ -
502 // and to perform the product A*v (LU decomposition is not used)
│ │ │ │ -
503 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ -
504 WrappedMatrix A(m_);
│ │ │ │ -
505
│ │ │ │ -
506 // get number of rows and columns in A
│ │ │ │ -
507 const int nrows = A.nrows();
│ │ │ │ -
508 const int ncols = A.ncols();
│ │ │ │ -
509
│ │ │ │ -
510 // assert that A is square
│ │ │ │ -
511 if (nrows != ncols)
│ │ │ │ -
512 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ -
513 << nrows << "x" << ncols << ").");
│ │ │ │ -
514
│ │ │ │ -
515 // allocate memory for variables, set parameters
│ │ │ │ -
516 const int nev = 2; // Number of eigenvalues to compute
│ │ │ │ -
517 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ -
518 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ -
519 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ -
520 Real* ev = new Real[nev]; // Computed eigenvalues of A
│ │ │ │ -
521 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ -
522 int nconv; // Number of converged eigenvalues
│ │ │ │ -
523
│ │ │ │ -
524 // define what we need: eigenvalues from both ends of the spectrum
│ │ │ │ -
525 char which[] = "BE";
│ │ │ │ -
526 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ -
527 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit);
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ -
529 // set ARPACK verbosity mode if requested
│ │ │ │ -
530 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ + │ │ │ │
531
│ │ │ │ -
532 // find eigenvalues and eigenvectors of A, obtain the eigenvalues
│ │ │ │ -
533 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ -
534
│ │ │ │ -
535 // obtain approximated dominant and least dominant eigenvalue of A
│ │ │ │ -
536 const Real& lambda_max = ev[nev-1];
│ │ │ │ -
537 const Real& lambda_min = ev[0];
│ │ │ │ -
538
│ │ │ │ -
539 // obtain associated approximated eigenvectors of A
│ │ │ │ -
540 Real* x_max_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ -
541 Real* x_min_raw = dprob.RawEigenvector(0);
│ │ │ │ +
532 EdgeIterator& advance(std::ptrdiff_t n);
│ │ │ │ +
533
│ │ │ │ + │ │ │ │ +
536
│ │ │ │ +
538 const VertexDescriptor& target() const;
│ │ │ │ +
539
│ │ │ │ +
541 const VertexDescriptor& source() const;
│ │ │ │
542
│ │ │ │ -
543 // obtain approximated spectral condition number of A
│ │ │ │ -
544 cond_2 = std::abs(lambda_max / lambda_min);
│ │ │ │ -
545
│ │ │ │ -
546 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ -
547 nIterations_ = dprob.GetIter();
│ │ │ │ -
548
│ │ │ │ -
549 // compute each residual norm
│ │ │ │ -
550 Real* Ax_max_raw = new Real[nrows];
│ │ │ │ -
551 Real* Ax_min_raw = new Real[nrows];
│ │ │ │ -
552 A.multMv(x_max_raw,Ax_max_raw);
│ │ │ │ -
553 A.multMv(x_min_raw,Ax_min_raw);
│ │ │ │ -
554 Real r_max_norm = 0.0;
│ │ │ │ -
555 Real r_min_norm = 0.0;
│ │ │ │ -
556 for (int i = 0; i < nrows; ++i)
│ │ │ │ -
557 {
│ │ │ │ -
558 r_max_norm += std::pow(Ax_max_raw[i] - lambda_max * x_max_raw[i],2);
│ │ │ │ -
559 r_min_norm += std::pow(Ax_min_raw[i] - lambda_min * x_min_raw[i],2);
│ │ │ │ -
560 }
│ │ │ │ -
561 r_max_norm = std::sqrt(r_max_norm);
│ │ │ │ -
562 r_min_norm = std::sqrt(r_min_norm);
│ │ │ │ -
563
│ │ │ │ -
564 // print verbosity information
│ │ │ │ -
565 if (verbosity_level_ > 0)
│ │ │ │ -
566 {
│ │ │ │ -
567 if (verbosity_level_ > 1)
│ │ │ │ -
568 {
│ │ │ │ -
569 // print some information about the problem
│ │ │ │ -
570 std::cout << blank_ << "Obtained eigenvalues of A by solving "
│ │ │ │ -
571 << "A*x = λ*x using the ARPACK++ class ARSym"
│ │ │ │ -
572 << "StdEig:" << std::endl;
│ │ │ │ -
573 std::cout << blank_ << " converged eigenvalues of A: "
│ │ │ │ -
574 << nconv << " / " << nev << std::endl;
│ │ │ │ -
575 std::cout << blank_ << " dominant eigenvalue of A: "
│ │ │ │ -
576 << lambda_max << std::endl;
│ │ │ │ -
577 std::cout << blank_ << " least dominant eigenvalue of A: "
│ │ │ │ -
578 << lambda_min << std::endl;
│ │ │ │ -
579 std::cout << blank_ << " spectral condition number of A: "
│ │ │ │ -
580 << cond_2 << std::endl;
│ │ │ │ -
581 }
│ │ │ │ -
582 std::cout << blank_ << "Result ("
│ │ │ │ -
583 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
584 << "║residual║_2 = {" << r_max_norm << ","
│ │ │ │ -
585 << r_min_norm << "}, " << "λ = {"
│ │ │ │ -
586 << lambda_max << "," << lambda_min
│ │ │ │ -
587 << "}): cond_2 = " << cond_2 << std::endl;
│ │ │ │ -
588 }
│ │ │ │ -
589
│ │ │ │ -
590 // free dynamically allocated memory
│ │ │ │ -
591 delete[] Ax_min_raw;
│ │ │ │ -
592 delete[] Ax_max_raw;
│ │ │ │ -
593 delete[] ev;
│ │ │ │ -
594 }
│ │ │ │ -
│ │ │ │ -
595
│ │ │ │ -
│ │ │ │ -
609 inline void computeNonSymMax (const Real& epsilon,
│ │ │ │ -
610 BlockVector& x, Real& sigma) const
│ │ │ │ -
611 {
│ │ │ │ -
612 // print verbosity information
│ │ │ │ -
613 if (verbosity_level_ > 0)
│ │ │ │ -
614 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ -
615 << "largest singular value of a matrix which "
│ │ │ │ -
616 << "is assumed to be nonsymmetric." << std::endl;
│ │ │ │ -
617
│ │ │ │ -
618 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ -
619 // and to perform the product A^T*A*v (LU decomposition is not used)
│ │ │ │ -
620 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ -
621 WrappedMatrix A(m_);
│ │ │ │ -
622
│ │ │ │ -
623 // get number of rows and columns in A
│ │ │ │ -
624 const int nrows = A.nrows();
│ │ │ │ -
625 const int ncols = A.ncols();
│ │ │ │ -
626
│ │ │ │ -
627 // assert that A has more rows than columns (extend code later to the opposite case!)
│ │ │ │ -
628 if (nrows < ncols)
│ │ │ │ -
629 DUNE_THROW(Dune::ISTLError,"Matrix has less rows than "
│ │ │ │ -
630 << "columns (" << nrows << "x" << ncols << ")."
│ │ │ │ -
631 << " This case is not implemented, yet.");
│ │ │ │ -
632
│ │ │ │ -
633 // allocate memory for variables, set parameters
│ │ │ │ -
634 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ -
635 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ -
636 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ -
637 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ -
638 Real* ev = new Real[nev]; // Computed eigenvalues of A^T*A
│ │ │ │ -
639 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ -
640 int nconv; // Number of converged eigenvalues
│ │ │ │ -
641
│ │ │ │ -
642 // define what we need: eigenvalues with largest algebraic value
│ │ │ │ -
643 char which[] = "LA";
│ │ │ │ -
644 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ -
645 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit);
│ │ │ │ -
646
│ │ │ │ -
647 // set ARPACK verbosity mode if requested
│ │ │ │ -
648 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ -
649
│ │ │ │ -
650 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues
│ │ │ │ -
651 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ +
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
│ │ │ │ -
653 // obtain approximated largest eigenvalue of A^T*A
│ │ │ │ -
654 const Real& lambda = ev[nev-1];
│ │ │ │ -
655
│ │ │ │ -
656 // obtain associated approximated eigenvector of A^T*A
│ │ │ │ -
657 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ -
658 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │ -
659
│ │ │ │ -
660 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ -
661 nIterations_ = dprob.GetIter();
│ │ │ │ -
662
│ │ │ │ -
663 // compute residual norm
│ │ │ │ -
664 BlockVector r(x);
│ │ │ │ -
665 Real* AtAx_raw = new Real[ncols];
│ │ │ │ -
666 A.multMtMv(x_raw,AtAx_raw);
│ │ │ │ -
667 WrappedMatrix::arrayToDomainBlockVector(AtAx_raw,r);
│ │ │ │ -
668 r.axpy(-lambda,x);
│ │ │ │ -
669 const Real r_norm = r.two_norm();
│ │ │ │ -
670
│ │ │ │ -
671 // calculate largest singular value of A (note that
│ │ │ │ -
672 // x is right-singular / left-singular vector of A)
│ │ │ │ -
673 sigma = std::sqrt(lambda);
│ │ │ │ -
674
│ │ │ │ -
675 // print verbosity information
│ │ │ │ -
676 if (verbosity_level_ > 0)
│ │ │ │ -
677 {
│ │ │ │ -
678 if (verbosity_level_ > 1)
│ │ │ │ -
679 {
│ │ │ │ -
680 // print some information about the problem
│ │ │ │ -
681 std::cout << blank_ << "Obtained singular values of A by sol"
│ │ │ │ -
682 << "ving (A^T*A)*x = σ²*x using the ARPACK++ "
│ │ │ │ -
683 << "class ARSymStdEig:" << std::endl;
│ │ │ │ -
684 std::cout << blank_ << " converged eigenvalues of A^T*A: "
│ │ │ │ -
685 << nconv << " / " << nev << std::endl;
│ │ │ │ -
686 std::cout << blank_ << " largest eigenvalue of A^T*A: "
│ │ │ │ -
687 << lambda << std::endl;
│ │ │ │ -
688 std::cout << blank_ << " => largest singular value of A: "
│ │ │ │ -
689 << sigma << std::endl;
│ │ │ │ -
690 }
│ │ │ │ -
691 std::cout << blank_ << "Result ("
│ │ │ │ -
692 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
693 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
694 << "σ = " << sigma << std::endl;
│ │ │ │ -
695 if (verbosity_level_ > 2)
│ │ │ │ -
696 {
│ │ │ │ -
697 // print approximated right-singular / left-singular vector
│ │ │ │ -
698 // via DUNE-ISTL I/O methods
│ │ │ │ -
699 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
700 }
│ │ │ │ -
701 }
│ │ │ │ -
702
│ │ │ │ -
703 // free dynamically allocated memory
│ │ │ │ -
704 delete[] AtAx_raw;
│ │ │ │ -
705 delete[] ev;
│ │ │ │ -
706 }
│ │ │ │ -
│ │ │ │ -
707
│ │ │ │ -
│ │ │ │ -
721 inline void computeNonSymMin (const Real& epsilon,
│ │ │ │ -
722 BlockVector& x, Real& sigma) const
│ │ │ │ -
723 {
│ │ │ │ -
724 // print verbosity information
│ │ │ │ -
725 if (verbosity_level_ > 0)
│ │ │ │ -
726 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ -
727 << "smallest singular value of a matrix which "
│ │ │ │ -
728 << "is assumed to be nonsymmetric." << std::endl;
│ │ │ │ +
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
│ │ │ │ -
730 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ -
731 // and to perform the product A^T*A*v (LU decomposition is not used)
│ │ │ │ -
732 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ -
733 WrappedMatrix A(m_);
│ │ │ │ +
733 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ │
734
│ │ │ │ -
735 // get number of rows and columns in A
│ │ │ │ -
736 const int nrows = A.nrows();
│ │ │ │ -
737 const int ncols = A.ncols();
│ │ │ │ -
738
│ │ │ │ -
739 // assert that A has more rows than columns (extend code later to the opposite case!)
│ │ │ │ -
740 if (nrows < ncols)
│ │ │ │ -
741 DUNE_THROW(Dune::ISTLError,"Matrix has less rows than "
│ │ │ │ -
742 << "columns (" << nrows << "x" << ncols << ")."
│ │ │ │ -
743 << " This case is not implemented, yet.");
│ │ │ │ +
738 typedef typename Graph::EdgeDescriptor EdgeDescriptor;
│ │ │ │ +
739
│ │ │ │ + │ │ │ │
744
│ │ │ │ -
745 // allocate memory for variables, set parameters
│ │ │ │ -
746 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ -
747 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ -
748 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ -
749 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ -
750 Real* ev = new Real[nev]; // Computed eigenvalues of A^T*A
│ │ │ │ -
751 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ -
752 int nconv; // Number of converged eigenvalues
│ │ │ │ -
753
│ │ │ │ -
754 // define what we need: eigenvalues with smallest algebraic value
│ │ │ │ -
755 char which[] = "SA";
│ │ │ │ -
756 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ -
757 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit);
│ │ │ │ -
758
│ │ │ │ -
759 // set ARPACK verbosity mode if requested
│ │ │ │ -
760 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ -
761
│ │ │ │ -
762 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues
│ │ │ │ -
763 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ -
764
│ │ │ │ -
765 // obtain approximated smallest eigenvalue of A^T*A
│ │ │ │ -
766 const Real& lambda = ev[nev-1];
│ │ │ │ +
756 typedef VM VertexMap;
│ │ │ │ +
757
│ │ │ │ +
761 typedef typename Graph::EdgeIterator EdgeIterator;
│ │ │ │ +
762
│ │ │ │ +
766 typedef typename Graph::ConstEdgeIterator ConstEdgeIterator;
│ │ │ │
767
│ │ │ │ -
768 // obtain associated approximated eigenvector of A^T*A
│ │ │ │ -
769 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ -
770 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │ -
771
│ │ │ │ -
772 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ -
773 nIterations_ = dprob.GetIter();
│ │ │ │ + │ │ │ │
774
│ │ │ │ -
775 // compute residual norm
│ │ │ │ -
776 BlockVector r(x);
│ │ │ │ -
777 Real* AtAx_raw = new Real[ncols];
│ │ │ │ -
778 A.multMtMv(x_raw,AtAx_raw);
│ │ │ │ -
779 WrappedMatrix::arrayToDomainBlockVector(AtAx_raw,r);
│ │ │ │ -
780 r.axpy(-lambda,x);
│ │ │ │ -
781 const Real r_norm = r.two_norm();
│ │ │ │ -
782
│ │ │ │ -
783 // calculate smallest singular value of A (note that
│ │ │ │ -
784 // x is right-singular / left-singular vector of A)
│ │ │ │ -
785 sigma = std::sqrt(lambda);
│ │ │ │ -
786
│ │ │ │ -
787 // print verbosity information
│ │ │ │ -
788 if (verbosity_level_ > 0)
│ │ │ │ -
789 {
│ │ │ │ -
790 if (verbosity_level_ > 1)
│ │ │ │ -
791 {
│ │ │ │ -
792 // print some information about the problem
│ │ │ │ -
793 std::cout << blank_ << "Obtained singular values of A by sol"
│ │ │ │ -
794 << "ving (A^T*A)*x = σ²*x using the ARPACK++ "
│ │ │ │ -
795 << "class ARSymStdEig:" << std::endl;
│ │ │ │ -
796 std::cout << blank_ << " converged eigenvalues of A^T*A: "
│ │ │ │ -
797 << nconv << " / " << nev << std::endl;
│ │ │ │ -
798 std::cout << blank_ << " smallest eigenvalue of A^T*A: "
│ │ │ │ -
799 << lambda << std::endl;
│ │ │ │ -
800 std::cout << blank_ << " => smallest singular value of A: "
│ │ │ │ -
801 << sigma << std::endl;
│ │ │ │ -
802 }
│ │ │ │ -
803 std::cout << blank_ << "Result ("
│ │ │ │ -
804 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
805 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
806 << "σ = " << sigma << std::endl;
│ │ │ │ -
807 if (verbosity_level_ > 2)
│ │ │ │ -
808 {
│ │ │ │ -
809 // print approximated right-singular / left-singular vector
│ │ │ │ -
810 // via DUNE-ISTL I/O methods
│ │ │ │ -
811 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
812 }
│ │ │ │ -
813 }
│ │ │ │ -
814
│ │ │ │ -
815 // free dynamically allocated memory
│ │ │ │ -
816 delete[] AtAx_raw;
│ │ │ │ -
817 delete[] ev;
│ │ │ │ -
818 }
│ │ │ │ -
│ │ │ │ -
819
│ │ │ │ -
│ │ │ │ -
830 inline void computeNonSymCond2 (const Real& epsilon, Real& cond_2) const
│ │ │ │ -
831 {
│ │ │ │ -
832 // print verbosity information
│ │ │ │ -
833 if (verbosity_level_ > 0)
│ │ │ │ -
834 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ -
835 << "spectral condition number of a matrix which "
│ │ │ │ -
836 << "is assumed to be nonsymmetric." << std::endl;
│ │ │ │ -
837
│ │ │ │ -
838 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ -
839 // and to perform the product A^T*A*v (LU decomposition is not used)
│ │ │ │ -
840 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ -
841 WrappedMatrix A(m_);
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ -
843 // get number of rows and columns in A
│ │ │ │ -
844 const int nrows = A.nrows();
│ │ │ │ -
845 const int ncols = A.ncols();
│ │ │ │ -
846
│ │ │ │ -
847 // assert that A has more rows than columns (extend code later to the opposite case!)
│ │ │ │ -
848 if (nrows < ncols)
│ │ │ │ -
849 DUNE_THROW(Dune::ISTLError,"Matrix has less rows than "
│ │ │ │ -
850 << "columns (" << nrows << "x" << ncols << ")."
│ │ │ │ -
851 << " This case is not implemented, yet.");
│ │ │ │ -
852
│ │ │ │ -
853 // allocate memory for variables, set parameters
│ │ │ │ -
854 const int nev = 2; // Number of eigenvalues to compute
│ │ │ │ -
855 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ -
856 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ -
857 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ -
858 Real* ev = new Real[nev]; // Computed eigenvalues of A^T*A
│ │ │ │ -
859 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ -
860 int nconv; // Number of converged eigenvalues
│ │ │ │ -
861
│ │ │ │ -
862 // define what we need: eigenvalues from both ends of the spectrum
│ │ │ │ -
863 char which[] = "BE";
│ │ │ │ -
864 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ -
865 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit);
│ │ │ │ -
866
│ │ │ │ -
867 // set ARPACK verbosity mode if requested
│ │ │ │ -
868 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ -
869
│ │ │ │ -
870 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues
│ │ │ │ -
871 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ -
872
│ │ │ │ -
873 // obtain approximated largest and smallest eigenvalue of A^T*A
│ │ │ │ -
874 const Real& lambda_max = ev[nev-1];
│ │ │ │ -
875 const Real& lambda_min = ev[0];
│ │ │ │ -
876
│ │ │ │ -
877 // obtain associated approximated eigenvectors of A^T*A
│ │ │ │ -
878 Real* x_max_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ -
879 Real* x_min_raw = dprob.RawEigenvector(0);
│ │ │ │ -
880
│ │ │ │ -
881 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ -
882 nIterations_ = dprob.GetIter();
│ │ │ │ -
883
│ │ │ │ -
884 // compute each residual norm
│ │ │ │ -
885 Real* AtAx_max_raw = new Real[ncols];
│ │ │ │ -
886 Real* AtAx_min_raw = new Real[ncols];
│ │ │ │ -
887 A.multMtMv(x_max_raw,AtAx_max_raw);
│ │ │ │ -
888 A.multMtMv(x_min_raw,AtAx_min_raw);
│ │ │ │ -
889 Real r_max_norm = 0.0;
│ │ │ │ -
890 Real r_min_norm = 0.0;
│ │ │ │ -
891 for (int i = 0; i < ncols; ++i)
│ │ │ │ -
892 {
│ │ │ │ -
893 r_max_norm += std::pow(AtAx_max_raw[i] - lambda_max * x_max_raw[i],2);
│ │ │ │ -
894 r_min_norm += std::pow(AtAx_min_raw[i] - lambda_min * x_min_raw[i],2);
│ │ │ │ -
895 }
│ │ │ │ -
896 r_max_norm = std::sqrt(r_max_norm);
│ │ │ │ -
897 r_min_norm = std::sqrt(r_min_norm);
│ │ │ │ -
898
│ │ │ │ -
899 // calculate largest and smallest singular value of A
│ │ │ │ -
900 const Real sigma_max = std::sqrt(lambda_max);
│ │ │ │ -
901 const Real sigma_min = std::sqrt(lambda_min);
│ │ │ │ -
902
│ │ │ │ -
903 // obtain approximated spectral condition number of A
│ │ │ │ -
904 cond_2 = sigma_max / sigma_min;
│ │ │ │ -
905
│ │ │ │ -
906 // print verbosity information
│ │ │ │ -
907 if (verbosity_level_ > 0)
│ │ │ │ -
908 {
│ │ │ │ -
909 if (verbosity_level_ > 1)
│ │ │ │ -
910 {
│ │ │ │ -
911 // print some information about the problem
│ │ │ │ -
912 std::cout << blank_ << "Obtained singular values of A by sol"
│ │ │ │ -
913 << "ving (A^T*A)*x = σ²*x using the ARPACK++ "
│ │ │ │ -
914 << "class ARSymStdEig:" << std::endl;
│ │ │ │ -
915 std::cout << blank_ << " converged eigenvalues of A^T*A: "
│ │ │ │ -
916 << nconv << " / " << nev << std::endl;
│ │ │ │ -
917 std::cout << blank_ << " largest eigenvalue of A^T*A: "
│ │ │ │ -
918 << lambda_max << std::endl;
│ │ │ │ -
919 std::cout << blank_ << " smallest eigenvalue of A^T*A: "
│ │ │ │ -
920 << lambda_min << std::endl;
│ │ │ │ -
921 std::cout << blank_ << " => largest singular value of A: "
│ │ │ │ -
922 << sigma_max << std::endl;
│ │ │ │ -
923 std::cout << blank_ << " => smallest singular value of A: "
│ │ │ │ -
924 << sigma_min << std::endl;
│ │ │ │ -
925 }
│ │ │ │ -
926 std::cout << blank_ << "Result ("
│ │ │ │ -
927 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
928 << "║residual║_2 = {" << r_max_norm << ","
│ │ │ │ -
929 << r_min_norm << "}, " << "σ = {"
│ │ │ │ -
930 << sigma_max << "," << sigma_min
│ │ │ │ -
931 << "}): cond_2 = " << cond_2 << std::endl;
│ │ │ │ -
932 }
│ │ │ │ -
933
│ │ │ │ -
934 // free dynamically allocated memory
│ │ │ │ -
935 delete[] AtAx_min_raw;
│ │ │ │ -
936 delete[] AtAx_max_raw;
│ │ │ │ -
937 delete[] ev;
│ │ │ │ -
938 }
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ -
944 inline unsigned int getIterationCount () const
│ │ │ │ -
945 {
│ │ │ │ -
946 if (nIterations_ == 0)
│ │ │ │ -
947 DUNE_THROW(Dune::ISTLError,"No algorithm applied, yet.");
│ │ │ │ -
948
│ │ │ │ -
949 return nIterations_;
│ │ │ │ -
950 }
│ │ │ │ -
│ │ │ │ -
951
│ │ │ │ -
952 protected:
│ │ │ │ -
953 // parameters related to iterative eigenvalue algorithms
│ │ │ │ - │ │ │ │ -
955 const unsigned int nIterationsMax_;
│ │ │ │ -
956
│ │ │ │ -
957 // verbosity setting
│ │ │ │ -
958 const unsigned int verbosity_level_;
│ │ │ │ +
943 std::size_t noEdges() const;
│ │ │ │ +
944
│ │ │ │ + │ │ │ │ +
952
│ │ │ │ +
958 VertexPropertiesGraph(Graph& graph, const VertexMap vmap=VertexMap());
│ │ │ │
959
│ │ │ │ -
960 // memory for storing temporary variables (mutable as they shall
│ │ │ │ -
961 // just be effectless auxiliary variables of the const apply*(...)
│ │ │ │ -
962 // methods)
│ │ │ │ -
963 mutable unsigned int nIterations_;
│ │ │ │ -
964
│ │ │ │ -
965 // constants for printing verbosity information
│ │ │ │ -
966 const std::string title_;
│ │ │ │ -
967 const std::string blank_;
│ │ │ │ -
968 };
│ │ │ │ -
│ │ │ │ -
969
│ │ │ │ -
972} // namespace Dune
│ │ │ │ -
973
│ │ │ │ -
974#endif // HAVE_ARPACKPP
│ │ │ │ -
975
│ │ │ │ -
976#endif // DUNE_ISTL_EIGENVALUE_ARPACKPP_HH
│ │ │ │ -
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.
│ │ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ - │ │ │ │ -
void printvector(std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
Print an ISTL vector.
Definition io.hh:89
│ │ │ │ +
960 private:
│ │ │ │ +
961 VertexPropertiesGraph(const VertexPropertiesGraph&)
│ │ │ │ +
962 {}
│ │ │ │ +
963
│ │ │ │ +
965 Graph& graph_;
│ │ │ │ +
967 VertexMap vmap_;
│ │ │ │ +
969 std::vector<VertexProperties> vertexProperties_;
│ │ │ │ +
970
│ │ │ │ +
971 };
│ │ │ │ +
│ │ │ │ +
972
│ │ │ │ +
976 template<class G, class VP, class EP, class VM=IdentityMap, class EM=IdentityMap>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
978 {
│ │ │ │ +
979 public:
│ │ │ │ +
983 typedef G Graph;
│ │ │ │ +
984
│ │ │ │ +
988 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ │ +
989
│ │ │ │ +
993 typedef typename Graph::EdgeDescriptor EdgeDescriptor;
│ │ │ │ +
994
│ │ │ │ + │ │ │ │ +
999
│ │ │ │ +
1011 typedef VM VertexMap;
│ │ │ │ +
1012
│ │ │ │ +
1016 typedef EP EdgeProperties;
│ │ │ │ +
1017
│ │ │ │ +
1018
│ │ │ │ +
1030 typedef EM EdgeMap;
│ │ │ │ +
1031
│ │ │ │ +
1032 template<class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1034 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ │ +
1035 C>::value,
│ │ │ │ +
1036 typename Graph::EdgeIterator,
│ │ │ │ +
1037 typename Graph::ConstEdgeIterator>::type
│ │ │ │ +
1038 {
│ │ │ │ +
1039
│ │ │ │ +
1040 friend class EdgeIteratorT<const typename std::remove_const<C>::type>;
│ │ │ │ +
1041 friend class EdgeIteratorT<typename std::remove_const<C>::type>;
│ │ │ │ +
1042 public:
│ │ │ │ +
1046 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ │ +
1047 C>::value,
│ │ │ │ +
1048 typename Graph::EdgeIterator,
│ │ │ │ +
1049 typename Graph::ConstEdgeIterator>::type
│ │ │ │ + │ │ │ │ +
1051
│ │ │ │ +
1057 explicit EdgeIteratorT(const Father& iter,
│ │ │ │ +
1058 C* graph);
│ │ │ │ +
1059
│ │ │ │ +
1067 explicit EdgeIteratorT(const Father& iter);
│ │ │ │ +
1068
│ │ │ │ +
1073 template<class C1>
│ │ │ │ +
1074 EdgeIteratorT(const EdgeIteratorT<C1>& other);
│ │ │ │ +
1075
│ │ │ │ +
1079 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ │ +
1080 EdgeProperties&,
│ │ │ │ +
1081 const EdgeProperties&>::type
│ │ │ │ +
1082 properties() const;
│ │ │ │ +
1083
│ │ │ │ +
1084 private:
│ │ │ │ +
1088 C* graph_;
│ │ │ │ +
1089 };
│ │ │ │ +
│ │ │ │ +
1090
│ │ │ │ +
1094 typedef EdgeIteratorT<PropertiesGraph<Graph,
│ │ │ │ +
1095 VertexProperties,
│ │ │ │ +
1096 EdgeProperties,VM,EM> > EdgeIterator;
│ │ │ │ +
1097
│ │ │ │ +
1101 typedef EdgeIteratorT<const PropertiesGraph<Graph,
│ │ │ │ +
1102 VertexProperties,
│ │ │ │ +
1103 EdgeProperties,VM,EM> > ConstEdgeIterator;
│ │ │ │ +
1104
│ │ │ │ +
1110 EdgeIterator beginEdges(const VertexDescriptor& source);
│ │ │ │ +
1111
│ │ │ │ +
1117 EdgeIterator endEdges(const VertexDescriptor& source);
│ │ │ │ +
1118
│ │ │ │ +
1124 ConstEdgeIterator beginEdges(const VertexDescriptor& source) const;
│ │ │ │ +
1125
│ │ │ │ +
1131 ConstEdgeIterator endEdges(const VertexDescriptor& source) const;
│ │ │ │ +
1132
│ │ │ │ +
1133
│ │ │ │ +
1134 template<class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1136 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ │ +
1137 C>::value,
│ │ │ │ +
1138 typename Graph::VertexIterator,
│ │ │ │ +
1139 typename Graph::ConstVertexIterator>::type
│ │ │ │ +
1140 {
│ │ │ │ +
1141 friend class VertexIteratorT<const typename std::remove_const<C>::type>;
│ │ │ │ +
1142 friend class VertexIteratorT<typename std::remove_const<C>::type>;
│ │ │ │ +
1143 public:
│ │ │ │ +
1147 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ │ +
1148 C>::value,
│ │ │ │ +
1149 typename Graph::VertexIterator,
│ │ │ │ +
1150 typename Graph::ConstVertexIterator>::type
│ │ │ │ + │ │ │ │ +
1152
│ │ │ │ +
1158 explicit VertexIteratorT(const Father& iter,
│ │ │ │ +
1159 C* graph);
│ │ │ │ +
1160
│ │ │ │ +
1161
│ │ │ │ +
1169 explicit VertexIteratorT(const Father& iter);
│ │ │ │ +
1170
│ │ │ │ +
1175 template<class C1>
│ │ │ │ +
1176 VertexIteratorT(const VertexIteratorT<C1>& other);
│ │ │ │ +
1177
│ │ │ │ +
1181 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ │ +
1182 VertexProperties&,
│ │ │ │ +
1183 const VertexProperties&>::type
│ │ │ │ +
1184 properties() const;
│ │ │ │ +
1185
│ │ │ │ +
1191 EdgeIteratorT<C> begin() const;
│ │ │ │ +
1192
│ │ │ │ +
1198 EdgeIteratorT<C> end() const;
│ │ │ │ +
1199
│ │ │ │ +
1200 private:
│ │ │ │ +
1204 C* graph_;
│ │ │ │ +
1205 };
│ │ │ │ +
│ │ │ │ +
1206
│ │ │ │ +
1210 typedef VertexIteratorT<PropertiesGraph<Graph,
│ │ │ │ +
1211 VertexProperties,
│ │ │ │ +
1212 EdgeProperties,VM,EM> > VertexIterator;
│ │ │ │ +
1213
│ │ │ │ +
1217 typedef VertexIteratorT<const PropertiesGraph<Graph,
│ │ │ │ +
1218 VertexProperties,
│ │ │ │ +
1219 EdgeProperties,VM,EM> > ConstVertexIterator;
│ │ │ │ +
1220
│ │ │ │ + │ │ │ │ +
1226
│ │ │ │ + │ │ │ │ +
1232
│ │ │ │ +
1237 ConstVertexIterator begin() const;
│ │ │ │ +
1238
│ │ │ │ + │ │ │ │ +
1244
│ │ │ │ +
1250 VertexProperties& getVertexProperties(const VertexDescriptor& vertex);
│ │ │ │ +
1251
│ │ │ │ +
1257 const VertexProperties& getVertexProperties(const VertexDescriptor& vertex) const;
│ │ │ │ +
1258
│ │ │ │ +
│ │ │ │ +
1265 EdgeDescriptor findEdge(const VertexDescriptor& source,
│ │ │ │ +
1266 const VertexDescriptor& target)
│ │ │ │ +
1267 {
│ │ │ │ +
1268 return graph_.findEdge(source,target);
│ │ │ │ +
1269 }
│ │ │ │ +
│ │ │ │ +
1270
│ │ │ │ + │ │ │ │ +
1277
│ │ │ │ +
1278
│ │ │ │ + │ │ │ │ +
1285
│ │ │ │ + │ │ │ │ +
1293 const VertexDescriptor& target);
│ │ │ │ +
1294
│ │ │ │ + │ │ │ │ +
1302 const VertexDescriptor& target) const;
│ │ │ │ +
1303
│ │ │ │ +
1308 const Graph& graph() const;
│ │ │ │ +
1309
│ │ │ │ +
1313 std::size_t noVertices() const;
│ │ │ │ +
1314
│ │ │ │ +
1318 std::size_t noEdges() const;
│ │ │ │ +
1319
│ │ │ │ + │ │ │ │ +
1327
│ │ │ │ + │ │ │ │ +
1335 const EdgeMap& emap=EdgeMap());
│ │ │ │ +
1336
│ │ │ │ +
1337 private:
│ │ │ │ + │ │ │ │ +
1339 {}
│ │ │ │ +
1340
│ │ │ │ +
1342 Graph& graph_;
│ │ │ │ +
1345 VertexMap vmap_;
│ │ │ │ +
1346 std::vector<VertexProperties> vertexProperties_;
│ │ │ │ +
1348 EdgeMap emap_;
│ │ │ │ +
1350 std::vector<EdgeProperties> edgeProperties_;
│ │ │ │ +
1351
│ │ │ │ +
1352 };
│ │ │ │ +
│ │ │ │ +
1353
│ │ │ │ +
1354
│ │ │ │ +
1359 template<typename G>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1361 {
│ │ │ │ +
1362 public:
│ │ │ │ +
1366 typedef G Graph;
│ │ │ │ +
1370 typedef typename G::VertexProperties VertexProperties;
│ │ │ │ +
1374 typedef typename G::VertexDescriptor Vertex;
│ │ │ │ +
1375
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1381 : graph_(g)
│ │ │ │ +
1382 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1387 : graph_(0)
│ │ │ │ +
1388 {}
│ │ │ │ +
│ │ │ │ +
1389
│ │ │ │ +
1390
│ │ │ │ +
│ │ │ │ +
1395 VertexProperties& operator[](const Vertex& vertex) const
│ │ │ │ +
1396 {
│ │ │ │ +
1397 return graph_->getVertexProperties(vertex);
│ │ │ │ +
1398 }
│ │ │ │ +
│ │ │ │ +
1399 private:
│ │ │ │ +
1400 Graph* graph_;
│ │ │ │ +
1401 };
│ │ │ │ +
│ │ │ │ +
1402
│ │ │ │ +
1407 template<typename G>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1409 {
│ │ │ │ +
1410 public:
│ │ │ │ +
1414 typedef G Graph;
│ │ │ │ +
1418 typedef typename G::EdgeProperties EdgeProperties;
│ │ │ │ +
1422 typedef typename G::EdgeDescriptor Edge;
│ │ │ │ +
1423
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1429 : graph_(g)
│ │ │ │ +
1430 {}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1435 : graph_(0)
│ │ │ │ +
1436 {}
│ │ │ │ +
│ │ │ │ +
1437
│ │ │ │ +
│ │ │ │ +
1442 EdgeProperties& operator[](const Edge& edge) const
│ │ │ │ +
1443 {
│ │ │ │ +
1444 return graph_->getEdgeProperties(edge);
│ │ │ │ +
1445 }
│ │ │ │ +
│ │ │ │ +
1446 private:
│ │ │ │ +
1447 Graph* graph_;
│ │ │ │ +
1448 };
│ │ │ │ +
│ │ │ │ +
1449
│ │ │ │ +
1450
│ │ │ │ +
1461 template<class G, class V>
│ │ │ │ +
1462 int visitNeighbours(const G& graph, const typename G::VertexDescriptor& vertex,
│ │ │ │ +
1463 V& visitor);
│ │ │ │ +
1464
│ │ │ │ +
1465#ifndef DOXYGEN
│ │ │ │ +
1466
│ │ │ │ +
1467 template<class M>
│ │ │ │ + │ │ │ │ +
1469 : matrix_(matrix)
│ │ │ │ +
1470 {
│ │ │ │ +
1471 if(matrix_.N()!=matrix_.M())
│ │ │ │ +
1472 DUNE_THROW(ISTLError, "Matrix has to have as many columns as rows!");
│ │ │ │ +
1473
│ │ │ │ +
1474 start_ = new EdgeDescriptor[matrix_.N()+1];
│ │ │ │ +
1475
│ │ │ │ +
1476 typedef typename M::ConstIterator Iterator;
│ │ │ │ +
1477 start_[matrix_.begin().index()] = 0;
│ │ │ │ +
1478
│ │ │ │ +
1479 for(Iterator row=matrix_.begin(); row != matrix_.end(); ++row)
│ │ │ │ +
1480 start_[row.index()+1] = start_[row.index()] + row->size();
│ │ │ │ +
1481 }
│ │ │ │ +
1482
│ │ │ │ +
1483 template<class M>
│ │ │ │ +
1484 MatrixGraph<M>::~MatrixGraph()
│ │ │ │ +
1485 {
│ │ │ │ +
1486 delete[] start_;
│ │ │ │ +
1487 }
│ │ │ │ +
1488
│ │ │ │ +
1489 template<class M>
│ │ │ │ +
1490 inline std::size_t MatrixGraph<M>::noEdges() const
│ │ │ │ +
1491 {
│ │ │ │ +
1492 return start_[matrix_.N()];
│ │ │ │ +
1493 }
│ │ │ │ +
1494
│ │ │ │ +
1495 template<class M>
│ │ │ │ +
1496 inline std::size_t MatrixGraph<M>::noVertices() const
│ │ │ │ +
1497 {
│ │ │ │ +
1498 return matrix_.N();
│ │ │ │ +
1499 }
│ │ │ │ +
1500
│ │ │ │ +
1501 template<class M>
│ │ │ │ +
1502 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::maxVertex() const
│ │ │ │ +
1503 {
│ │ │ │ +
1504 return matrix_.N()-1;
│ │ │ │ +
1505 }
│ │ │ │ +
1506
│ │ │ │ +
1507 template<class M>
│ │ │ │ +
1508 typename MatrixGraph<M>::EdgeDescriptor
│ │ │ │ +
1509 MatrixGraph<M>::findEdge(const VertexDescriptor& source,
│ │ │ │ +
1510 const VertexDescriptor& target) const
│ │ │ │ +
1511 {
│ │ │ │ +
1512 typename M::ConstColIterator found =matrix_[source].find(target);
│ │ │ │ +
1513 if(found == matrix_[source].end())
│ │ │ │ +
1514 return std::numeric_limits<EdgeDescriptor>::max();
│ │ │ │ +
1515 std::size_t offset = found.offset();
│ │ │ │ +
1516 if(target>source)
│ │ │ │ +
1517 offset--;
│ │ │ │ +
1518
│ │ │ │ +
1519 assert(offset<noEdges());
│ │ │ │ +
1520
│ │ │ │ +
1521 return start_[source]+offset;
│ │ │ │ +
1522 }
│ │ │ │ +
1523
│ │ │ │ +
1524
│ │ │ │ +
1525 template<class M>
│ │ │ │ +
1526 inline M& MatrixGraph<M>::matrix()
│ │ │ │ +
1527 {
│ │ │ │ +
1528 return matrix_;
│ │ │ │ +
1529 }
│ │ │ │ +
1530
│ │ │ │ +
1531 template<class M>
│ │ │ │ +
1532 inline const M& MatrixGraph<M>::matrix() const
│ │ │ │ +
1533 {
│ │ │ │ +
1534 return matrix_;
│ │ │ │ +
1535 }
│ │ │ │ +
1536
│ │ │ │ +
1537 template<class M>
│ │ │ │ +
1538 template<class C>
│ │ │ │ +
1539 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const VertexDescriptor& source, const ColIterator& block,
│ │ │ │ +
1540 const ColIterator& end, const EdgeDescriptor& edge)
│ │ │ │ +
1541 : source_(source), block_(block), blockEnd_(end), edge_(edge)
│ │ │ │ +
1542 {
│ │ │ │ +
1543 if(block_!=blockEnd_ && block_.index() == source_) {
│ │ │ │ +
1544 // This is the edge from the diagonal to the diagonal. Skip it.
│ │ │ │ +
1545 ++block_;
│ │ │ │ +
1546 }
│ │ │ │ +
1547 }
│ │ │ │ +
1548
│ │ │ │ +
1549 template<class M>
│ │ │ │ +
1550 template<class C>
│ │ │ │ +
1551 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const ColIterator& block)
│ │ │ │ +
1552 : block_(block)
│ │ │ │ +
1553 {}
│ │ │ │ +
1554
│ │ │ │ +
1555 template<class M>
│ │ │ │ +
1556 template<class C>
│ │ │ │ +
1557 template<class C1>
│ │ │ │ +
1558 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const EdgeIteratorT<C1>& other)
│ │ │ │ +
1559 : source_(other.source_), block_(other.block_), blockEnd_(other.blockEnd_), edge_(other.edge_)
│ │ │ │ +
1560 {}
│ │ │ │ +
1561
│ │ │ │ +
1562
│ │ │ │ +
1563 template<class M>
│ │ │ │ +
1564 template<class C>
│ │ │ │ +
1565 inline typename MatrixGraph<M>::template EdgeIteratorT<C>::WeightType&
│ │ │ │ +
1566 MatrixGraph<M>::EdgeIteratorT<C>::weight() const
│ │ │ │ +
1567 {
│ │ │ │ +
1568 return *block_;
│ │ │ │ +
1569 }
│ │ │ │ +
1570
│ │ │ │ +
1571 template<class M>
│ │ │ │ +
1572 template<class C>
│ │ │ │ +
1573 inline typename MatrixGraph<M>::template EdgeIteratorT<C>& MatrixGraph<M>::EdgeIteratorT<C>::operator++()
│ │ │ │ +
1574 {
│ │ │ │ +
1575 ++block_;
│ │ │ │ +
1576 ++edge_;
│ │ │ │ +
1577
│ │ │ │ +
1578 if(block_!=blockEnd_ && block_.index() == source_) {
│ │ │ │ +
1579 // This is the edge from the diagonal to the diagonal. Skip it.
│ │ │ │ +
1580 ++block_;
│ │ │ │ +
1581 }
│ │ │ │ +
1582
│ │ │ │ +
1583 return *this;
│ │ │ │ +
1584 }
│ │ │ │ +
1585
│ │ │ │ +
1586 template<class M>
│ │ │ │ +
1587 template<class C>
│ │ │ │ +
1588 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator!=(const typename MatrixGraph<M>::template EdgeIteratorT<typename std::remove_const<C>::type>& other) const
│ │ │ │ +
1589 {
│ │ │ │ +
1590 return block_!=other.block_;
│ │ │ │ +
1591 }
│ │ │ │ +
1592
│ │ │ │ +
1593 template<class M>
│ │ │ │ +
1594 template<class C>
│ │ │ │ +
1595 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator!=(const typename MatrixGraph<M>::template EdgeIteratorT<const typename std::remove_const<C>::type>& other) const
│ │ │ │ +
1596 {
│ │ │ │ +
1597 return block_!=other.block_;
│ │ │ │ +
1598 }
│ │ │ │ +
1599
│ │ │ │ +
1600 template<class M>
│ │ │ │ +
1601 template<class C>
│ │ │ │ +
1602 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator==(const typename MatrixGraph<M>::template EdgeIteratorT<typename std::remove_const<C>::type>& other) const
│ │ │ │ +
1603 {
│ │ │ │ +
1604 return block_==other.block_;
│ │ │ │ +
1605 }
│ │ │ │ +
1606
│ │ │ │ +
1607 template<class M>
│ │ │ │ +
1608 template<class C>
│ │ │ │ +
1609 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator==(const typename MatrixGraph<M>::template EdgeIteratorT<const typename std::remove_const<C>::type>& other) const
│ │ │ │ +
1610 {
│ │ │ │ +
1611 return block_==other.block_;
│ │ │ │ +
1612 }
│ │ │ │ +
1613
│ │ │ │ +
1614 template<class M>
│ │ │ │ +
1615 template<class C>
│ │ │ │ +
1616 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::EdgeIteratorT<C>::target() const
│ │ │ │ +
1617 {
│ │ │ │ +
1618 return block_.index();
│ │ │ │ +
1619 }
│ │ │ │ +
1620
│ │ │ │ +
1621 template<class M>
│ │ │ │ +
1622 template<class C>
│ │ │ │ +
1623 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::EdgeIteratorT<C>::source() const
│ │ │ │ +
1624 {
│ │ │ │ +
1625 return source_;
│ │ │ │ +
1626 }
│ │ │ │ +
1627
│ │ │ │ +
1628 template<class M>
│ │ │ │ +
1629 template<class C>
│ │ │ │ +
1630 inline const typename MatrixGraph<M>::EdgeDescriptor& MatrixGraph<M>::EdgeIteratorT<C>::operator*() const
│ │ │ │ +
1631 {
│ │ │ │ +
1632 return edge_;
│ │ │ │ +
1633 }
│ │ │ │ +
1634
│ │ │ │ +
1635 template<class M>
│ │ │ │ +
1636 template<class C>
│ │ │ │ +
1637 inline const typename MatrixGraph<M>::EdgeDescriptor* MatrixGraph<M>::EdgeIteratorT<C>::operator->() const
│ │ │ │ +
1638 {
│ │ │ │ +
1639 return &edge_;
│ │ │ │ +
1640 }
│ │ │ │ +
1641
│ │ │ │ +
1642 template<class M>
│ │ │ │ +
1643 template<class C>
│ │ │ │ +
1644 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(C* graph,
│ │ │ │ +
1645 const VertexDescriptor& current)
│ │ │ │ +
1646 : graph_(graph), current_(current)
│ │ │ │ +
1647 {}
│ │ │ │ +
1648
│ │ │ │ +
1649
│ │ │ │ +
1650 template<class M>
│ │ │ │ +
1651 template<class C>
│ │ │ │ +
1652 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(const VertexDescriptor& current)
│ │ │ │ +
1653 : current_(current)
│ │ │ │ +
1654 {}
│ │ │ │ +
1655
│ │ │ │ +
1656 template<class M>
│ │ │ │ +
1657 template<class C>
│ │ │ │ +
1658 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(const VertexIteratorT<MutableContainer>& other)
│ │ │ │ +
1659 : graph_(other.graph_), current_(other.current_)
│ │ │ │ +
1660 {}
│ │ │ │ +
1661
│ │ │ │ +
1662 template<class M>
│ │ │ │ +
1663 template<class C>
│ │ │ │ +
1664 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator!=(const VertexIteratorT<MutableContainer>& other) const
│ │ │ │ +
1665 {
│ │ │ │ +
1666 return current_ != other.current_;
│ │ │ │ +
1667 }
│ │ │ │ +
1668
│ │ │ │ +
1669 template<class M>
│ │ │ │ +
1670 template<class C>
│ │ │ │ +
1671 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator!=(const VertexIteratorT<ConstContainer>& other) const
│ │ │ │ +
1672 {
│ │ │ │ +
1673 return current_ != other.current_;
│ │ │ │ +
1674 }
│ │ │ │ +
1675
│ │ │ │ +
1676
│ │ │ │ +
1677 template<class M>
│ │ │ │ +
1678 template<class C>
│ │ │ │ +
1679 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator==(const VertexIteratorT<MutableContainer>& other) const
│ │ │ │ +
1680 {
│ │ │ │ +
1681 return current_ == other.current_;
│ │ │ │ +
1682 }
│ │ │ │ +
1683
│ │ │ │ +
1684 template<class M>
│ │ │ │ +
1685 template<class C>
│ │ │ │ +
1686 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator==(const VertexIteratorT<ConstContainer>& other) const
│ │ │ │ +
1687 {
│ │ │ │ +
1688 return current_ == other.current_;
│ │ │ │ +
1689 }
│ │ │ │ +
1690
│ │ │ │ +
1691 template<class M>
│ │ │ │ +
1692 template<class C>
│ │ │ │ +
1693 inline typename MatrixGraph<M>::template VertexIteratorT<C>& MatrixGraph<M>::VertexIteratorT<C>::operator++()
│ │ │ │ +
1694 {
│ │ │ │ +
1695 ++current_;
│ │ │ │ +
1696 return *this;
│ │ │ │ +
1697 }
│ │ │ │ +
1698
│ │ │ │ +
1699 template<class M>
│ │ │ │ +
1700 template<class C>
│ │ │ │ +
1701 inline typename MatrixGraph<M>::template VertexIteratorT<C>::WeightType&
│ │ │ │ +
1702 MatrixGraph<M>::VertexIteratorT<C>::weight() const
│ │ │ │ +
1703 {
│ │ │ │ +
1704 return graph_->matrix()[current_][current_];
│ │ │ │ +
1705 }
│ │ │ │ +
1706
│ │ │ │ +
1707 template<class M>
│ │ │ │ +
1708 template<class C>
│ │ │ │ +
1709 inline const typename MatrixGraph<M>::VertexDescriptor&
│ │ │ │ +
1710 MatrixGraph<M>::VertexIteratorT<C>::operator*() const
│ │ │ │ +
1711 {
│ │ │ │ +
1712 return current_;
│ │ │ │ +
1713 }
│ │ │ │ +
1714
│ │ │ │ +
1715 template<class M>
│ │ │ │ +
1716 template<class C>
│ │ │ │ +
1717 inline typename MatrixGraph<M>::template EdgeIteratorT<C>
│ │ │ │ +
1718 MatrixGraph<M>::VertexIteratorT<C>::begin() const
│ │ │ │ +
1719 {
│ │ │ │ +
1720 return graph_->beginEdges(current_);
│ │ │ │ +
1721 }
│ │ │ │ +
1722
│ │ │ │ +
1723 template<class M>
│ │ │ │ +
1724 template<class C>
│ │ │ │ +
1725 inline typename MatrixGraph<M>::template EdgeIteratorT<C>
│ │ │ │ +
1726 MatrixGraph<M>::VertexIteratorT<C>::end() const
│ │ │ │ +
1727 {
│ │ │ │ +
1728 return graph_->endEdges(current_);
│ │ │ │ +
1729 }
│ │ │ │ +
1730
│ │ │ │ +
1731 template<class M>
│ │ │ │ +
1732 inline typename MatrixGraph<M>::template VertexIteratorT<MatrixGraph<M> >
│ │ │ │ +
1733 MatrixGraph<M>::begin()
│ │ │ │ +
1734 {
│ │ │ │ +
1735 return VertexIterator(this,0);
│ │ │ │ +
1736 }
│ │ │ │ +
1737
│ │ │ │ +
1738 template<class M>
│ │ │ │ +
1739 inline typename MatrixGraph<M>::template VertexIteratorT<MatrixGraph<M> >
│ │ │ │ +
1740 MatrixGraph<M>::end()
│ │ │ │ +
1741 {
│ │ │ │ +
1742 return VertexIterator(matrix_.N());
│ │ │ │ +
1743 }
│ │ │ │ +
1744
│ │ │ │ +
1745
│ │ │ │ +
1746 template<class M>
│ │ │ │ +
1747 inline typename MatrixGraph<M>::template VertexIteratorT<const MatrixGraph<M> >
│ │ │ │ +
1748 MatrixGraph<M>::begin() const
│ │ │ │ +
1749 {
│ │ │ │ +
1750 return ConstVertexIterator(this, 0);
│ │ │ │ +
1751 }
│ │ │ │ +
1752
│ │ │ │ +
1753 template<class M>
│ │ │ │ +
1754 inline typename MatrixGraph<M>::template VertexIteratorT<const MatrixGraph<M> >
│ │ │ │ +
1755 MatrixGraph<M>::end() const
│ │ │ │ +
1756 {
│ │ │ │ +
1757 return ConstVertexIterator(matrix_.N());
│ │ │ │ +
1758 }
│ │ │ │ +
1759
│ │ │ │ +
1760 template<class M>
│ │ │ │ +
1761 inline typename MatrixGraph<M>::template EdgeIteratorT<MatrixGraph<M> >
│ │ │ │ +
1762 MatrixGraph<M>::beginEdges(const VertexDescriptor& source)
│ │ │ │ +
1763 {
│ │ │ │ +
1764 return EdgeIterator(source, matrix_.operator[](source).begin(),
│ │ │ │ +
1765 matrix_.operator[](source).end(), start_[source]);
│ │ │ │ +
1766 }
│ │ │ │ +
1767
│ │ │ │ +
1768 template<class M>
│ │ │ │ +
1769 inline typename MatrixGraph<M>::template EdgeIteratorT<MatrixGraph<M> >
│ │ │ │ +
1770 MatrixGraph<M>::endEdges(const VertexDescriptor& source)
│ │ │ │ +
1771 {
│ │ │ │ +
1772 return EdgeIterator(matrix_.operator[](source).end());
│ │ │ │ +
1773 }
│ │ │ │ +
1774
│ │ │ │ +
1775
│ │ │ │ +
1776 template<class M>
│ │ │ │ +
1777 inline typename MatrixGraph<M>::template EdgeIteratorT<const MatrixGraph<M> >
│ │ │ │ +
1778 MatrixGraph<M>::beginEdges(const VertexDescriptor& source) const
│ │ │ │ +
1779 {
│ │ │ │ +
1780 return ConstEdgeIterator(source, matrix_.operator[](source).begin(),
│ │ │ │ +
1781 matrix_.operator[](source).end(), start_[source]);
│ │ │ │ +
1782 }
│ │ │ │ +
1783
│ │ │ │ +
1784 template<class M>
│ │ │ │ +
1785 inline typename MatrixGraph<M>::template EdgeIteratorT<const MatrixGraph<M> >
│ │ │ │ +
1786 MatrixGraph<M>::endEdges(const VertexDescriptor& source) const
│ │ │ │ +
1787 {
│ │ │ │ +
1788 return ConstEdgeIterator(matrix_.operator[](source).end());
│ │ │ │ +
1789 }
│ │ │ │ +
1790
│ │ │ │ +
1791
│ │ │ │ +
1792 template<class G, class T>
│ │ │ │ +
1793 SubGraph<G,T>::EdgeIterator::EdgeIterator(const VertexDescriptor& source,
│ │ │ │ +
1794 const EdgeDescriptor& edge)
│ │ │ │ +
1795 : source_(source), edge_(edge)
│ │ │ │ +
1796 {}
│ │ │ │ +
1797
│ │ │ │ +
1798
│ │ │ │ +
1799 template<class G, class T>
│ │ │ │ +
1800 SubGraph<G,T>::EdgeIterator::EdgeIterator(const EdgeDescriptor& edge)
│ │ │ │ +
1801 : edge_(edge)
│ │ │ │ +
1802 {}
│ │ │ │ +
1803
│ │ │ │ +
1804 template<class G, class T>
│ │ │ │ +
1805 typename SubGraph<G,T>::EdgeIndexMap SubGraph<G,T>::getEdgeIndexMap()
│ │ │ │ +
1806 {
│ │ │ │ +
1807 return EdgeIndexMap(edges_);
│ │ │ │ +
1808 }
│ │ │ │ +
1809
│ │ │ │ +
1810 template<class G, class T>
│ │ │ │ +
1811 inline bool SubGraph<G,T>::EdgeIterator::equals(const EdgeIterator & other) const
│ │ │ │ +
1812 {
│ │ │ │ +
1813 return other.edge_==edge_;
│ │ │ │ +
1814 }
│ │ │ │ +
1815
│ │ │ │ +
1816 template<class G, class T>
│ │ │ │ +
1817 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::increment()
│ │ │ │ +
1818 {
│ │ │ │ +
1819 ++edge_;
│ │ │ │ +
1820 return *this;
│ │ │ │ +
1821 }
│ │ │ │ +
1822
│ │ │ │ +
1823 template<class G, class T>
│ │ │ │ +
1824 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::decrement()
│ │ │ │ +
1825 {
│ │ │ │ +
1826 --edge_;
│ │ │ │ +
1827 return *this;
│ │ │ │ +
1828 }
│ │ │ │ +
1829
│ │ │ │ +
1830 template<class G, class T>
│ │ │ │ +
1831 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::advance(std::ptrdiff_t n)
│ │ │ │ +
1832 {
│ │ │ │ +
1833 edge_+=n;
│ │ │ │ +
1834 return *this;
│ │ │ │ +
1835 }
│ │ │ │ +
1836 template<class G, class T>
│ │ │ │ +
1837 inline const typename G::VertexDescriptor& SubGraph<G,T>::EdgeIterator::source() const
│ │ │ │ +
1838 {
│ │ │ │ +
1839 return source_;
│ │ │ │ +
1840 }
│ │ │ │ +
1841
│ │ │ │ +
1842 template<class G, class T>
│ │ │ │ +
1843 inline const typename G::VertexDescriptor& SubGraph<G,T>::EdgeIterator::target() const
│ │ │ │ +
1844 {
│ │ │ │ +
1845 return *edge_;
│ │ │ │ +
1846 }
│ │ │ │ +
1847
│ │ │ │ +
1848
│ │ │ │ +
1849 template<class G, class T>
│ │ │ │ +
1850 inline const typename SubGraph<G,T>::EdgeDescriptor& SubGraph<G,T>::EdgeIterator::dereference() const
│ │ │ │ +
1851 {
│ │ │ │ +
1852 return edge_;
│ │ │ │ +
1853 }
│ │ │ │ +
1854
│ │ │ │ +
1855 template<class G, class T>
│ │ │ │ +
1856 inline std::ptrdiff_t SubGraph<G,T>::EdgeIterator::distanceTo(const EdgeIterator & other) const
│ │ │ │ +
1857 {
│ │ │ │ +
1858 return other.edge_-edge_;
│ │ │ │ +
1859 }
│ │ │ │ +
1860
│ │ │ │ +
1861 template<class G, class T>
│ │ │ │ +
1862 SubGraph<G,T>::VertexIterator::VertexIterator(const SubGraph<G,T>* graph,
│ │ │ │ +
1863 const VertexDescriptor& current,
│ │ │ │ +
1864 const VertexDescriptor& end)
│ │ │ │ +
1865 : graph_(graph), current_(current), end_(end)
│ │ │ │ +
1866 {
│ │ │ │ +
1867 // Skip excluded vertices
│ │ │ │ +
1868 typedef typename T::const_iterator Iterator;
│ │ │ │ +
1869
│ │ │ │ +
1870 for(Iterator vertex = graph_->excluded_.begin();
│ │ │ │ +
1871 current_ != end_ && *vertex;
│ │ │ │ +
1872 ++vertex)
│ │ │ │ +
1873 ++current_;
│ │ │ │ +
1874 assert(current_ == end_ || !graph_->excluded_[current_]);
│ │ │ │ +
1875 }
│ │ │ │ +
1876
│ │ │ │ +
1877 template<class G, class T>
│ │ │ │ +
1878 SubGraph<G,T>::VertexIterator::VertexIterator(const VertexDescriptor& current)
│ │ │ │ +
1879 : current_(current)
│ │ │ │ +
1880 {}
│ │ │ │ +
1881
│ │ │ │ +
1882 template<class G, class T>
│ │ │ │ +
1883 inline typename SubGraph<G,T>::VertexIterator& SubGraph<G,T>::VertexIterator::increment()
│ │ │ │ +
1884 {
│ │ │ │ +
1885 ++current_;
│ │ │ │ +
1886 //Skip excluded vertices
│ │ │ │ +
1887 while(current_ != end_ && graph_->excluded_[current_])
│ │ │ │ +
1888 ++current_;
│ │ │ │ +
1889
│ │ │ │ +
1890 assert(current_ == end_ || !graph_->excluded_[current_]);
│ │ │ │ +
1891 return *this;
│ │ │ │ +
1892 }
│ │ │ │ +
1893
│ │ │ │ +
1894 template<class G, class T>
│ │ │ │ +
1895 inline bool SubGraph<G,T>::VertexIterator::equals(const VertexIterator & other) const
│ │ │ │ +
1896 {
│ │ │ │ +
1897 return current_==other.current_;
│ │ │ │ +
1898 }
│ │ │ │ +
1899
│ │ │ │ +
1900 template<class G, class T>
│ │ │ │ +
1901 inline const typename G::VertexDescriptor& SubGraph<G,T>::VertexIterator::dereference() const
│ │ │ │ +
1902 {
│ │ │ │ +
1903 return current_;
│ │ │ │ +
1904 }
│ │ │ │ +
1905
│ │ │ │ +
1906 template<class G, class T>
│ │ │ │ +
1907 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::VertexIterator::begin() const
│ │ │ │ +
1908 {
│ │ │ │ +
1909 return graph_->beginEdges(current_);
│ │ │ │ +
1910 }
│ │ │ │ +
1911
│ │ │ │ +
1912 template<class G, class T>
│ │ │ │ +
1913 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::VertexIterator::end() const
│ │ │ │ +
1914 {
│ │ │ │ +
1915 return graph_->endEdges(current_);
│ │ │ │ +
1916 }
│ │ │ │ +
1917
│ │ │ │ +
1918 template<class G, class T>
│ │ │ │ +
1919 inline typename SubGraph<G,T>::VertexIterator SubGraph<G,T>::begin() const
│ │ │ │ +
1920 {
│ │ │ │ +
1921 return VertexIterator(this, 0, endVertex_);
│ │ │ │ +
1922 }
│ │ │ │ +
1923
│ │ │ │ +
1924
│ │ │ │ +
1925 template<class G, class T>
│ │ │ │ +
1926 inline typename SubGraph<G,T>::VertexIterator SubGraph<G,T>::end() const
│ │ │ │ +
1927 {
│ │ │ │ +
1928 return VertexIterator(endVertex_);
│ │ │ │ +
1929 }
│ │ │ │ +
1930
│ │ │ │ +
1931
│ │ │ │ +
1932 template<class G, class T>
│ │ │ │ +
1933 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::beginEdges(const VertexDescriptor& source) const
│ │ │ │ +
1934 {
│ │ │ │ +
1935 return EdgeIterator(source, edges_+start_[source]);
│ │ │ │ +
1936 }
│ │ │ │ +
1937
│ │ │ │ +
1938 template<class G, class T>
│ │ │ │ +
1939 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::endEdges(const VertexDescriptor& source) const
│ │ │ │ +
1940 {
│ │ │ │ +
1941 return EdgeIterator(edges_+end_[source]);
│ │ │ │ +
1942 }
│ │ │ │ +
1943
│ │ │ │ +
1944 template<class G, class T>
│ │ │ │ +
1945 std::size_t SubGraph<G,T>::noVertices() const
│ │ │ │ +
1946 {
│ │ │ │ +
1947 return noVertices_;
│ │ │ │ +
1948 }
│ │ │ │ +
1949
│ │ │ │ +
1950 template<class G, class T>
│ │ │ │ +
1951 inline typename SubGraph<G,T>::VertexDescriptor SubGraph<G,T>::maxVertex() const
│ │ │ │ +
1952 {
│ │ │ │ +
1953 return maxVertex_;
│ │ │ │ +
1954 }
│ │ │ │ +
1955
│ │ │ │ +
1956 template<class G, class T>
│ │ │ │ +
1957 inline std::size_t SubGraph<G,T>::noEdges() const
│ │ │ │ +
1958 {
│ │ │ │ +
1959 return noEdges_;
│ │ │ │ +
1960 }
│ │ │ │ +
1961
│ │ │ │ +
1962 template<class G, class T>
│ │ │ │ +
1963 inline typename SubGraph<G,T>::EdgeDescriptor SubGraph<G,T>::findEdge(const VertexDescriptor& source,
│ │ │ │ +
1964 const VertexDescriptor& target) const
│ │ │ │ +
1965 {
│ │ │ │ +
1966 const EdgeDescriptor edge = std::lower_bound(edges_+start_[source], edges_+end_[source], target);
│ │ │ │ +
1967 if(edge==edges_+end_[source] || *edge!=target)
│ │ │ │ +
1968 return std::numeric_limits<EdgeDescriptor>::max();
│ │ │ │ +
1969
│ │ │ │ +
1970 return edge;
│ │ │ │ +
1971 }
│ │ │ │ +
1972
│ │ │ │ +
1973 template<class G, class T>
│ │ │ │ +
1974 SubGraph<G,T>::~SubGraph()
│ │ │ │ +
1975 {
│ │ │ │ +
1976 delete[] edges_;
│ │ │ │ +
1977 delete[] end_;
│ │ │ │ +
1978 delete[] start_;
│ │ │ │ +
1979 }
│ │ │ │ +
1980
│ │ │ │ +
1981 template<class G, class T>
│ │ │ │ +
1982 SubGraph<G,T>::SubGraph(const G& graph, const T& excluded)
│ │ │ │ +
1983 : excluded_(excluded), noVertices_(0), endVertex_(0), maxVertex_(graph.maxVertex())
│ │ │ │ +
1984 {
│ │ │ │ +
1985 start_ = new std::ptrdiff_t[graph.noVertices()];
│ │ │ │ +
1986 end_ = new std::ptrdiff_t[graph.noVertices()];
│ │ │ │ +
1987 edges_ = new VertexDescriptor[graph.noEdges()];
│ │ │ │ +
1988
│ │ │ │ +
1989 VertexDescriptor* edge=edges_;
│ │ │ │ +
1990
│ │ │ │ +
1991 // Cater for the case that there are no vertices.
│ │ │ │ +
1992 // Otherwise endVertex_ will get 1 below.
│ │ │ │ +
1993 if ( graph.noVertices() == 0)
│ │ │ │ +
1994 return;
│ │ │ │ +
1995
│ │ │ │ +
1996 typedef typename Graph::ConstVertexIterator Iterator;
│ │ │ │ +
1997 Iterator endVertex=graph.end();
│ │ │ │ +
1998
│ │ │ │ +
1999 for(Iterator vertex = graph.begin(); vertex != endVertex; ++vertex)
│ │ │ │ +
2000 if(excluded_[*vertex])
│ │ │ │ +
2001 start_[*vertex]=end_[*vertex]=-1;
│ │ │ │ +
2002 else{
│ │ │ │ +
2003 ++noVertices_;
│ │ │ │ +
2004 endVertex_ = std::max(*vertex, endVertex_);
│ │ │ │ +
2005
│ │ │ │ +
2006 start_[*vertex] = edge-edges_;
│ │ │ │ +
2007
│ │ │ │ +
2008 auto endEdge = vertex.end();
│ │ │ │ +
2009
│ │ │ │ +
2010 for(auto iter=vertex.begin(); iter!= endEdge; ++iter)
│ │ │ │ +
2011 if(!excluded[iter.target()]) {
│ │ │ │ +
2012 *edge = iter.target();
│ │ │ │ +
2013 ++edge;
│ │ │ │ +
2014 }
│ │ │ │ +
2015
│ │ │ │ +
2016 end_[*vertex] = edge - edges_;
│ │ │ │ +
2017
│ │ │ │ +
2018 // Sort the edges
│ │ │ │ +
2019 std::sort(edges_+start_[*vertex], edge);
│ │ │ │ +
2020 }
│ │ │ │ +
2021 noEdges_ = edge-edges_;
│ │ │ │ +
2022 ++endVertex_;
│ │ │ │ +
2023 }
│ │ │ │ +
2024
│ │ │ │ +
2025 template<class G, class V, class VM>
│ │ │ │ +
2026 inline std::size_t VertexPropertiesGraph<G,V,VM>::noEdges() const
│ │ │ │ +
2027 {
│ │ │ │ +
2028 return graph_.noEdges();
│ │ │ │ +
2029 }
│ │ │ │ +
2030
│ │ │ │ +
2031 template<class G, class V, class VM>
│ │ │ │ +
2032 inline typename VertexPropertiesGraph<G,V,VM>::EdgeIterator
│ │ │ │ +
2033 VertexPropertiesGraph<G,V,VM>::beginEdges(const VertexDescriptor& source)
│ │ │ │ +
2034 {
│ │ │ │ +
2035 return graph_.beginEdges(source);
│ │ │ │ +
2036 }
│ │ │ │ +
2037
│ │ │ │ +
2038 template<class G, class V, class VM>
│ │ │ │ +
2039 inline typename VertexPropertiesGraph<G,V,VM>::EdgeIterator
│ │ │ │ +
2040 VertexPropertiesGraph<G,V,VM>::endEdges(const VertexDescriptor& source)
│ │ │ │ +
2041 {
│ │ │ │ +
2042 return graph_.endEdges(source);
│ │ │ │ +
2043 }
│ │ │ │ +
2044
│ │ │ │ +
2045 template<class G, class V, class VM>
│ │ │ │ +
2046 typename VertexPropertiesGraph<G,V,VM>::ConstEdgeIterator
│ │ │ │ +
2047 inline VertexPropertiesGraph<G,V,VM>::beginEdges(const VertexDescriptor& source) const
│ │ │ │ +
2048 {
│ │ │ │ +
2049 return graph_.beginEdges(source);
│ │ │ │ +
2050 }
│ │ │ │ +
2051
│ │ │ │ +
2052 template<class G, class V, class VM>
│ │ │ │ +
2053 typename VertexPropertiesGraph<G,V,VM>::ConstEdgeIterator
│ │ │ │ +
2054 VertexPropertiesGraph<G,V,VM>::endEdges(const VertexDescriptor& source) const
│ │ │ │ +
2055 {
│ │ │ │ +
2056 return graph_.endEdges(source);
│ │ │ │ +
2057 }
│ │ │ │ +
2058
│ │ │ │ +
2059 template<class G, class V, class VM>
│ │ │ │ +
2060 template<class C>
│ │ │ │ +
2061 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ │ +
2062 ::VertexIteratorT(const Father& iter,
│ │ │ │ +
2063 C* graph)
│ │ │ │ +
2064 : Father(iter), graph_(graph)
│ │ │ │ +
2065 {}
│ │ │ │ +
2066
│ │ │ │ +
2067 template<class G, class V, class VM>
│ │ │ │ +
2068 template<class C>
│ │ │ │ +
2069 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ │ +
2070 ::VertexIteratorT(const Father& iter)
│ │ │ │ +
2071 : Father(iter)
│ │ │ │ +
2072 {}
│ │ │ │ +
2073
│ │ │ │ +
2074 template<class G, class V, class VM>
│ │ │ │ +
2075 template<class C>
│ │ │ │ +
2076 template<class C1>
│ │ │ │ +
2077 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ │ +
2078 ::VertexIteratorT(const VertexIteratorT<C1>& other)
│ │ │ │ +
2079 : Father(other), graph_(other.graph_)
│ │ │ │ +
2080 {}
│ │ │ │ +
2081
│ │ │ │ +
2082 template<class G, class V, class VM>
│ │ │ │ +
2083 template<class C>
│ │ │ │ +
2084 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ │ +
2085 V&, const V&>::type
│ │ │ │ +
2086 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::properties() const
│ │ │ │ +
2087 {
│ │ │ │ +
2088 return graph_->getVertexProperties(Father::operator*());
│ │ │ │ +
2089 }
│ │ │ │ +
2090
│ │ │ │ +
2091 template<class G, class V, class VM>
│ │ │ │ +
2092 template<class C>
│ │ │ │ +
2093 typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ │ +
2094 C>::value,
│ │ │ │ +
2095 typename G::EdgeIterator,
│ │ │ │ +
2096 typename G::ConstEdgeIterator>::type
│ │ │ │ +
2097 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::begin() const
│ │ │ │ +
2098 {
│ │ │ │ +
2099 return graph_->beginEdges(Father::operator*());
│ │ │ │ +
2100 }
│ │ │ │ +
2101
│ │ │ │ +
2102 template<class G, class V, class VM>
│ │ │ │ +
2103 template<class C>
│ │ │ │ +
2104 typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ │ +
2105 C>::value,
│ │ │ │ +
2106 typename G::EdgeIterator,
│ │ │ │ +
2107 typename G::ConstEdgeIterator>::type
│ │ │ │ +
2108 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::end() const
│ │ │ │ +
2109 {
│ │ │ │ +
2110 return graph_->endEdges(Father::operator*());
│ │ │ │ +
2111 }
│ │ │ │ +
2112
│ │ │ │ +
2113 template<class G, class V, class VM>
│ │ │ │ +
2114 inline typename VertexPropertiesGraph<G,V,VM>::VertexIterator VertexPropertiesGraph<G,V,VM>::begin()
│ │ │ │ +
2115 {
│ │ │ │ +
2116 return VertexIterator(graph_.begin(), this);
│ │ │ │ +
2117 }
│ │ │ │ +
2118
│ │ │ │ +
2119 template<class G, class V, class VM>
│ │ │ │ +
2120 inline typename VertexPropertiesGraph<G,V,VM>::VertexIterator VertexPropertiesGraph<G,V,VM>::end()
│ │ │ │ +
2121 {
│ │ │ │ +
2122 return VertexIterator(graph_.end());
│ │ │ │ +
2123 }
│ │ │ │ +
2124
│ │ │ │ +
2125
│ │ │ │ +
2126 template<class G, class V, class VM>
│ │ │ │ +
2127 inline typename VertexPropertiesGraph<G,V,VM>::ConstVertexIterator VertexPropertiesGraph<G,V,VM>::begin() const
│ │ │ │ +
2128 {
│ │ │ │ +
2129 return ConstVertexIterator(graph_.begin(), this);
│ │ │ │ +
2130 }
│ │ │ │ +
2131
│ │ │ │ +
2132 template<class G, class V, class VM>
│ │ │ │ +
2133 inline typename VertexPropertiesGraph<G,V,VM>::ConstVertexIterator VertexPropertiesGraph<G,V,VM>::end() const
│ │ │ │ +
2134 {
│ │ │ │ +
2135 return ConstVertexIterator(graph_.end());
│ │ │ │ +
2136 }
│ │ │ │ +
2137
│ │ │ │ +
2138 template<class G, class V, class VM>
│ │ │ │ +
2139 inline V& VertexPropertiesGraph<G,V,VM>::getVertexProperties(const VertexDescriptor& vertex)
│ │ │ │ +
2140 {
│ │ │ │ +
2141 return vertexProperties_[vmap_[vertex]];
│ │ │ │ +
2142 }
│ │ │ │ +
2143
│ │ │ │ +
2144 template<class G, class V, class VM>
│ │ │ │ +
2145 inline const V& VertexPropertiesGraph<G,V,VM>::getVertexProperties(const VertexDescriptor& vertex) const
│ │ │ │ +
2146 {
│ │ │ │ +
2147 return vertexProperties_[vmap_[vertex]];
│ │ │ │ +
2148 }
│ │ │ │ +
2149
│ │ │ │ +
2150 template<class G, class V, class VM>
│ │ │ │ +
2151 inline const G& VertexPropertiesGraph<G,V,VM>::graph() const
│ │ │ │ +
2152 {
│ │ │ │ +
2153 return graph_;
│ │ │ │ +
2154 }
│ │ │ │ +
2155
│ │ │ │ +
2156 template<class G, class V, class VM>
│ │ │ │ +
2157 inline std::size_t VertexPropertiesGraph<G,V,VM>::noVertices() const
│ │ │ │ +
2158 {
│ │ │ │ +
2159 return graph_.noVertices();
│ │ │ │ +
2160 }
│ │ │ │ +
2161
│ │ │ │ +
2162
│ │ │ │ +
2163 template<class G, class V, class VM>
│ │ │ │ +
2164 inline typename VertexPropertiesGraph<G,V,VM>::VertexDescriptor VertexPropertiesGraph<G,V,VM>::maxVertex() const
│ │ │ │ +
2165 {
│ │ │ │ +
2166 return graph_.maxVertex();
│ │ │ │ +
2167 }
│ │ │ │ +
2168
│ │ │ │ +
2169 template<class G, class V, class VM>
│ │ │ │ +
2170 VertexPropertiesGraph<G,V,VM>::VertexPropertiesGraph(Graph& graph, const VM vmap)
│ │ │ │ +
2171 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex()+1], V())
│ │ │ │ +
2172 {}
│ │ │ │ +
2173
│ │ │ │ +
2174 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2175 template<class C>
│ │ │ │ +
2176 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const Father& iter,
│ │ │ │ +
2177 C* graph)
│ │ │ │ +
2178 : Father(iter), graph_(graph)
│ │ │ │ +
2179 {}
│ │ │ │ +
2180
│ │ │ │ +
2181 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2182 template<class C>
│ │ │ │ +
2183 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const Father& iter)
│ │ │ │ +
2184 : Father(iter)
│ │ │ │ +
2185 {}
│ │ │ │ +
2186
│ │ │ │ +
2187 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2188 template<class C>
│ │ │ │ +
2189 template<class C1>
│ │ │ │ +
2190 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const EdgeIteratorT<C1>& other)
│ │ │ │ +
2191 : Father(other), graph_(other.graph_)
│ │ │ │ +
2192 {}
│ │ │ │ +
2193
│ │ │ │ +
2194
│ │ │ │ +
2195 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2196 inline std::size_t PropertiesGraph<G,V,E,VM,EM>::noEdges() const
│ │ │ │ +
2197 {
│ │ │ │ +
2198 return graph_.noEdges();
│ │ │ │ +
2199 }
│ │ │ │ +
2200
│ │ │ │ +
2201 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2202 template<class C>
│ │ │ │ +
2203 inline typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,E&,const E&>::type
│ │ │ │ +
2204 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::properties() const
│ │ │ │ +
2205 {
│ │ │ │ +
2206 return graph_->getEdgeProperties(Father::operator*());
│ │ │ │ +
2207 }
│ │ │ │ +
2208
│ │ │ │ +
2209 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2210 inline typename PropertiesGraph<G,V,E,VM,EM>::EdgeIterator
│ │ │ │ +
2211 PropertiesGraph<G,V,E,VM,EM>::beginEdges(const VertexDescriptor& source)
│ │ │ │ +
2212 {
│ │ │ │ +
2213 return EdgeIterator(graph_.beginEdges(source), this);
│ │ │ │ +
2214 }
│ │ │ │ +
2215
│ │ │ │ +
2216 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2217 inline typename PropertiesGraph<G,V,E,VM,EM>::EdgeIterator
│ │ │ │ +
2218 PropertiesGraph<G,V,E,VM,EM>::endEdges(const VertexDescriptor& source)
│ │ │ │ +
2219 {
│ │ │ │ +
2220 return EdgeIterator(graph_.endEdges(source));
│ │ │ │ +
2221 }
│ │ │ │ +
2222
│ │ │ │ +
2223 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2224 typename PropertiesGraph<G,V,E,VM,EM>::ConstEdgeIterator
│ │ │ │ +
2225 inline PropertiesGraph<G,V,E,VM,EM>::beginEdges(const VertexDescriptor& source) const
│ │ │ │ +
2226 {
│ │ │ │ +
2227 return ConstEdgeIterator(graph_.beginEdges(source), this);
│ │ │ │ +
2228 }
│ │ │ │ +
2229
│ │ │ │ +
2230 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2231 typename PropertiesGraph<G,V,E,VM,EM>::ConstEdgeIterator
│ │ │ │ +
2232 PropertiesGraph<G,V,E,VM,EM>::endEdges(const VertexDescriptor& source) const
│ │ │ │ +
2233 {
│ │ │ │ +
2234 return ConstEdgeIterator(graph_.endEdges(source));
│ │ │ │ +
2235 }
│ │ │ │ +
2236
│ │ │ │ +
2237 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2238 template<class C>
│ │ │ │ +
2239 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ │ +
2240 ::VertexIteratorT(const Father& iter,
│ │ │ │ +
2241 C* graph)
│ │ │ │ +
2242 : Father(iter), graph_(graph)
│ │ │ │ +
2243 {}
│ │ │ │ +
2244
│ │ │ │ +
2245 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2246 template<class C>
│ │ │ │ +
2247 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ │ +
2248 ::VertexIteratorT(const Father& iter)
│ │ │ │ +
2249 : Father(iter)
│ │ │ │ +
2250 {}
│ │ │ │ +
2251
│ │ │ │ +
2252 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2253 template<class C>
│ │ │ │ +
2254 template<class C1>
│ │ │ │ +
2255 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ │ +
2256 ::VertexIteratorT(const VertexIteratorT<C1>& other)
│ │ │ │ +
2257 : Father(other), graph_(other.graph_)
│ │ │ │ +
2258 {}
│ │ │ │ +
2259
│ │ │ │ +
2260 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2261 template<class C>
│ │ │ │ +
2262 inline typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ │ +
2263 V&, const V&>::type
│ │ │ │ +
2264 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::properties() const
│ │ │ │ +
2265 {
│ │ │ │ +
2266 return graph_->getVertexProperties(Father::operator*());
│ │ │ │ +
2267 }
│ │ │ │ +
2268
│ │ │ │ +
2269 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2270 template<class C>
│ │ │ │ +
2271 inline typename PropertiesGraph<G,V,E,VM,EM>::template EdgeIteratorT<C>
│ │ │ │ +
2272 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::begin() const
│ │ │ │ +
2273 {
│ │ │ │ +
2274 return graph_->beginEdges(Father::operator*());
│ │ │ │ +
2275 }
│ │ │ │ +
2276
│ │ │ │ +
2277 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2278 template<class C>
│ │ │ │ +
2279 inline typename PropertiesGraph<G,V,E,VM,EM>::template EdgeIteratorT<C>
│ │ │ │ +
2280 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::end() const
│ │ │ │ +
2281 {
│ │ │ │ +
2282 return graph_->endEdges(Father::operator*());
│ │ │ │ +
2283 }
│ │ │ │ +
2284
│ │ │ │ +
2285 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2286 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexIterator PropertiesGraph<G,V,E,VM,EM>::begin()
│ │ │ │ +
2287 {
│ │ │ │ +
2288 return VertexIterator(graph_.begin(), this);
│ │ │ │ +
2289 }
│ │ │ │ +
2290
│ │ │ │ +
2291 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2292 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexIterator PropertiesGraph<G,V,E,VM,EM>::end()
│ │ │ │ +
2293 {
│ │ │ │ +
2294 return VertexIterator(graph_.end());
│ │ │ │ +
2295 }
│ │ │ │ +
2296
│ │ │ │ +
2297
│ │ │ │ +
2298 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2299 inline typename PropertiesGraph<G,V,E,VM,EM>::ConstVertexIterator PropertiesGraph<G,V,E,VM,EM>::begin() const
│ │ │ │ +
2300 {
│ │ │ │ +
2301 return ConstVertexIterator(graph_.begin(), this);
│ │ │ │ +
2302 }
│ │ │ │ +
2303
│ │ │ │ +
2304 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2305 inline typename PropertiesGraph<G,V,E,VM,EM>::ConstVertexIterator PropertiesGraph<G,V,E,VM,EM>::end() const
│ │ │ │ +
2306 {
│ │ │ │ +
2307 return ConstVertexIterator(graph_.end());
│ │ │ │ +
2308 }
│ │ │ │ +
2309
│ │ │ │ +
2310 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2311 inline V& PropertiesGraph<G,V,E,VM,EM>::getVertexProperties(const VertexDescriptor& vertex)
│ │ │ │ +
2312 {
│ │ │ │ +
2313 return vertexProperties_[vmap_[vertex]];
│ │ │ │ +
2314 }
│ │ │ │ +
2315
│ │ │ │ +
2316 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2317 inline const V& PropertiesGraph<G,V,E,VM,EM>::getVertexProperties(const VertexDescriptor& vertex) const
│ │ │ │ +
2318 {
│ │ │ │ +
2319 return vertexProperties_[vmap_[vertex]];
│ │ │ │ +
2320 }
│ │ │ │ +
2321
│ │ │ │ +
2322 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2323 inline E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const EdgeDescriptor& edge)
│ │ │ │ +
2324 {
│ │ │ │ +
2325 return edgeProperties_[emap_[edge]];
│ │ │ │ +
2326 }
│ │ │ │ +
2327
│ │ │ │ +
2328 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2329 inline const E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const EdgeDescriptor& edge) const
│ │ │ │ +
2330 {
│ │ │ │ +
2331 return edgeProperties_[emap_[edge]];
│ │ │ │ +
2332 }
│ │ │ │ +
2333
│ │ │ │ +
2334 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2335 inline E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const VertexDescriptor& source,
│ │ │ │ +
2336 const VertexDescriptor& target)
│ │ │ │ +
2337 {
│ │ │ │ +
2338 return getEdgeProperties(graph_.findEdge(source,target));
│ │ │ │ +
2339 }
│ │ │ │ +
2340
│ │ │ │ +
2341 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2342 inline const E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const VertexDescriptor& source,
│ │ │ │ +
2343 const VertexDescriptor& target) const
│ │ │ │ +
2344 {
│ │ │ │ +
2345 return getEdgeProperties(graph_.findEdge(source,target));
│ │ │ │ +
2346 }
│ │ │ │ +
2347
│ │ │ │ +
2348 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2349 inline const G& PropertiesGraph<G,V,E,VM,EM>::graph() const
│ │ │ │ +
2350 {
│ │ │ │ +
2351 return graph_;
│ │ │ │ +
2352 }
│ │ │ │ +
2353
│ │ │ │ +
2354 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2355 inline std::size_t PropertiesGraph<G,V,E,VM,EM>::noVertices() const
│ │ │ │ +
2356 {
│ │ │ │ +
2357 return graph_.noVertices();
│ │ │ │ +
2358 }
│ │ │ │ +
2359
│ │ │ │ +
2360
│ │ │ │ +
2361 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2362 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexDescriptor PropertiesGraph<G,V,E,VM,EM>::maxVertex() const
│ │ │ │ +
2363 {
│ │ │ │ +
2364 return graph_.maxVertex();
│ │ │ │ +
2365 }
│ │ │ │ +
2366
│ │ │ │ +
2367 template<class G, class V, class E, class VM, class EM>
│ │ │ │ +
2368 PropertiesGraph<G,V,E,VM,EM>::PropertiesGraph(Graph& graph, const VM& vmap, const EM& emap)
│ │ │ │ +
2369 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex()+1], V()),
│ │ │ │ +
2370 emap_(emap), edgeProperties_(graph_.noEdges(), E())
│ │ │ │ +
2371 {}
│ │ │ │ +
2372
│ │ │ │ +
2373 template<class G, class V>
│ │ │ │ +
2374 inline int visitNeighbours(const G& graph, const typename G::VertexDescriptor& vertex,
│ │ │ │ +
2375 V& visitor)
│ │ │ │ +
2376 {
│ │ │ │ +
2377 typedef typename G::ConstEdgeIterator iterator;
│ │ │ │ +
2378 const iterator end = graph.endEdges(vertex);
│ │ │ │ +
2379 int noNeighbours=0;
│ │ │ │ +
2380 for(iterator edge = graph.beginEdges(vertex); edge != end; ++edge, ++noNeighbours)
│ │ │ │ +
2381 visitor(edge);
│ │ │ │ +
2382 return noNeighbours;
│ │ │ │ +
2383 }
│ │ │ │ +
2384
│ │ │ │ +
2385#endif // DOXYGEN
│ │ │ │ +
2386
│ │ │ │ +
2388 }
│ │ │ │ +
2389}
│ │ │ │ +
2390#endif
│ │ │ │ + │ │ │ │ +
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bcrsmatrix.hh:488
│ │ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:401
│ │ │ │ -
A::size_type size_type
The type for the index access.
Definition bvector.hh:410
│ │ │ │ -
Wrapper to use a range of ARPACK++ eigenvalue solvers.
Definition arpackpp.hh:245
│ │ │ │ -
const unsigned int verbosity_level_
Definition arpackpp.hh:958
│ │ │ │ -
unsigned int getIterationCount() const
Return the number of iterations in last application of an algorithm.
Definition arpackpp.hh:944
│ │ │ │ -
const std::string title_
Definition arpackpp.hh:966
│ │ │ │ -
BlockVector::field_type Real
Definition arpackpp.hh:247
│ │ │ │ -
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
│ │ │ │ -
const BCRSMatrix & m_
Definition arpackpp.hh:954
│ │ │ │ -
const unsigned int nIterationsMax_
Definition arpackpp.hh:955
│ │ │ │ -
const std::string blank_
Definition arpackpp.hh:967
│ │ │ │ -
ArPackPlusPlus_Algorithms(const BCRSMatrix &m, const unsigned int nIterationsMax=100000, const unsigned int verbosity_level=0)
Construct from required parameters.
Definition arpackpp.hh:268
│ │ │ │ -
void computeSymCond2(const Real &epsilon, Real &cond_2) const
Assume the matrix to be square, symmetric and perform IRLM to compute an approximation of its spectra...
Definition arpackpp.hh:493
│ │ │ │ -
unsigned int nIterations_
Definition arpackpp.hh:963
│ │ │ │ -
void computeNonSymMin(const Real &epsilon, BlockVector &x, Real &sigma) const
Assume the matrix to be nonsymmetric and perform IRLM to compute an approximation sigma of its smalle...
Definition arpackpp.hh:721
│ │ │ │ -
void computeNonSymCond2(const Real &epsilon, Real &cond_2) const
Assume the matrix to be nonsymmetric and perform IRLM to compute an approximation of its spectral con...
Definition arpackpp.hh:830
│ │ │ │ -
void computeNonSymMax(const Real &epsilon, BlockVector &x, Real &sigma) const
Assume the matrix to be nonsymmetric and perform IRLM to compute an approximation sigma of its larges...
Definition arpackpp.hh:609
│ │ │ │
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ │ +
MatrixGraph(Matrix &matrix)
Constructor.
│ │ │ │ +
VertexIterator end()
Get an iterator over the vertices.
│ │ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ │ +
M Matrix
The type of the matrix we are a graph for.
Definition graph.hh:56
│ │ │ │ +
ConstVertexIterator begin() const
Get an iterator over the vertices.
│ │ │ │ +
VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:308
│ │ │ │ +
~MatrixGraph()
Destructor.
│ │ │ │ +
std::ptrdiff_t EdgeDescriptor
The edge descriptor.
Definition graph.hh:80
│ │ │ │ +
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ │ +
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ │ +
const Matrix & matrix() const
Get the underlying matrix.
│ │ │ │ +
@ mutableMatrix
Definition graph.hh:86
│ │ │ │ +
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ │ +
ConstVertexIterator end() const
Get an iterator over the vertices.
│ │ │ │ +
EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:298
│ │ │ │ +
EdgeIterator beginEdges(const VertexDescriptor &source)
Get an iterator over the edges starting at a vertex.
│ │ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ │ +
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target) const
Find the descriptor of an edge.
│ │ │ │ +
M::block_type Weight
The type of the weights.
Definition graph.hh:66
│ │ │ │ +
std::remove_const< M >::type MutableMatrix
The mutable type of the matrix we are a graph for.
Definition graph.hh:61
│ │ │ │ +
EdgeIteratorT< MatrixGraph< Matrix > > EdgeIterator
The mutable edge iterator type.
Definition graph.hh:303
│ │ │ │ +
VertexIteratorT< MatrixGraph< Matrix > > VertexIterator
The mutable vertex iterator type.
Definition graph.hh:313
│ │ │ │ +
EdgeIterator endEdges(const VertexDescriptor &source)
Get an iterator over the edges starting at a vertex.
│ │ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ │ +
Matrix & matrix()
Get the underlying matrix.
│ │ │ │ +
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ │ +
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ │ +
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type WeightType
Definition graph.hh:156
│ │ │ │ +
EdgeIteratorT(const VertexDescriptor &source, const ColIterator &block, const ColIterator &end, const EdgeDescriptor &edge)
Constructor.
│ │ │ │ +
@ isMutable
whether C is mutable.
Definition graph.hh:112
│ │ │ │ +
VertexDescriptor target() const
The index of the target vertex of the current edge.
│ │ │ │ +
EdgeIteratorT< C > & operator++()
preincrement operator.
│ │ │ │ +
bool operator!=(const EdgeIteratorT< const typename std::remove_const< C >::type > &other) const
Inequality operator.
│ │ │ │ +
bool operator==(const EdgeIteratorT< const typename std::remove_const< C >::type > &other) const
Equality operator.
│ │ │ │ +
EdgeIteratorT(const EdgeIteratorT< C1 > &other)
Copy Constructor.
│ │ │ │ +
bool operator!=(const EdgeIteratorT< typename std::remove_const< C >::type > &other) const
Inequality operator.
│ │ │ │ +
WeightType & weight() const
Access the edge weight.
│ │ │ │ +
VertexDescriptor source() const
The index of the source vertex of the current edge.
│ │ │ │ +
std::conditional< isMutable &&C::mutableMatrix, typenameMatrix::row_type::Iterator, typenameMatrix::row_type::ConstIterator >::type ColIterator
The column iterator of the matrix we use.
Definition graph.hh:120
│ │ │ │ +
const std::remove_const< C >::type ConstContainer
The constant type of the container type.
Definition graph.hh:105
│ │ │ │ +
bool operator==(const EdgeIteratorT< typename std::remove_const< C >::type > &other) const
Equality operator.
│ │ │ │ +
EdgeIteratorT(const ColIterator &block)
Constructor for the end iterator.
│ │ │ │ +
std::conditional< isMutable &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type Weight
The matrix block type we use as weights.
Definition graph.hh:127
│ │ │ │ +
const EdgeDescriptor & operator*() const
Get the edge descriptor.
│ │ │ │ +
const EdgeDescriptor * operator->() const
Get the edge descriptor.
│ │ │ │ +
std::remove_const< C >::type MutableContainer
The mutable type of the container type.
Definition graph.hh:101
│ │ │ │ +
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │ │ +
EdgeIteratorT< C > begin() const
Get an iterator over all edges starting at the current vertex.
│ │ │ │ +
const VertexDescriptor & operator*() const
Get the descriptor of the current vertex.
│ │ │ │ +
WeightType & weight() const
Access the weight of the vertex.
│ │ │ │ +
VertexIteratorT(C *graph, const VertexDescriptor &current)
Constructor.
│ │ │ │ +
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type WeightType
Definition graph.hh:266
│ │ │ │ +
VertexIteratorT(const VertexIteratorT< MutableContainer > &other)
│ │ │ │ +
std::remove_const< C >::type MutableContainer
The mutable type of the container type.
Definition graph.hh:214
│ │ │ │ +
bool operator!=(const VertexIteratorT< MutableContainer > &other) const
Inequality operator.
│ │ │ │ +
@ isMutable
whether C is mutable.
Definition graph.hh:225
│ │ │ │ +
bool operator==(const VertexIteratorT< MutableContainer > &other) const
Equality operator.
│ │ │ │ +
const std::remove_const< C >::type ConstContainer
The constant type of the container type.
Definition graph.hh:218
│ │ │ │ +
VertexIteratorT< C > & operator++()
Move to the next vertex.
│ │ │ │ +
EdgeIteratorT< C > end() const
Get an iterator over all edges starting at the current vertex.
│ │ │ │ +
bool operator==(const VertexIteratorT< ConstContainer > &other) const
Equality operator.
│ │ │ │ +
bool operator!=(const VertexIteratorT< ConstContainer > &other) const
Inequality operator.
│ │ │ │ +
VertexIteratorT(const VertexDescriptor &current)
Constructor for the end iterator.
│ │ │ │ +
A subgraph of a graph.
Definition graph.hh:443
│ │ │ │ +
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target) const
Find the descriptor of an edge.
│ │ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ │ +
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
│ │ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ │ +
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ │ +
ConstVertexIterator end() const
Get an iterator over the vertices.
│ │ │ │ +
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ │ +
T Excluded
Random access container providing information about which vertices are excluded.
Definition graph.hh:454
│ │ │ │ +
~SubGraph()
Destructor.
│ │ │ │ +
EdgeIterator ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:618
│ │ │ │ +
G Graph
The type of the graph we are a sub graph for.
Definition graph.hh:448
│ │ │ │ +
VertexIterator ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:623
│ │ │ │ +
SubGraph(const Graph &graph, const T &excluded)
Constructor.
│ │ │ │ +
ConstVertexIterator begin() const
Get an iterator over the vertices.
│ │ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:459
│ │ │ │ +
VertexDescriptor * EdgeDescriptor
Definition graph.hh:461
│ │ │ │ +
An index map for mapping the edges to indices.
Definition graph.hh:470
│ │ │ │ +
EdgeIndexMap(const EdgeIndexMap &emap)
Protect copy construction.
Definition graph.hh:479
│ │ │ │ +
ReadablePropertyMapTag Category
Definition graph.hh:472
│ │ │ │ +
EdgeIndexMap(const EdgeDescriptor &firstEdge)
Definition graph.hh:474
│ │ │ │ +
std::size_t operator[](const EdgeDescriptor &edge) const
Definition graph.hh:483
│ │ │ │ +
The edge iterator of the graph.
Definition graph.hh:505
│ │ │ │ +
const EdgeDescriptor & dereference() const
The descriptor of the current edge.
│ │ │ │ +
EdgeIterator(const EdgeDescriptor &edge)
Constructor for the end iterator.
│ │ │ │ +
bool equals(const EdgeIterator &other) const
Equality operator.
│ │ │ │ +
EdgeIterator & advance(std::ptrdiff_t n)
│ │ │ │ +
EdgeIterator & increment()
Preincrement operator.
│ │ │ │ +
const VertexDescriptor & target() const
The index of the target vertex of the current edge.
│ │ │ │ +
const VertexDescriptor & source() const
The index of the source vertex of the current edge.
│ │ │ │ +
EdgeIterator & decrement()
Preincrement operator.
│ │ │ │ +
std::ptrdiff_t distanceTo(const EdgeIterator &other) const
│ │ │ │ +
EdgeIterator(const VertexDescriptor &source, const EdgeDescriptor &edge)
Constructor.
│ │ │ │ +
The vertex iterator of the graph.
Definition graph.hh:560
│ │ │ │ +
VertexIterator(const VertexDescriptor &current)
Constructor for end iterator.
│ │ │ │ +
VertexIterator & increment()
Preincrement operator.
│ │ │ │ +
EdgeIterator begin() const
Get an iterator over all edges starting at the current vertex.
│ │ │ │ +
bool equals(const VertexIterator &other) const
Equality iterator.
│ │ │ │ +
VertexIterator(const SubGraph< G, T > *graph, const VertexDescriptor &current, const VertexDescriptor &end)
Constructor.
│ │ │ │ +
EdgeIterator end() const
Get an iterator over all edges starting at the current vertex.
│ │ │ │ +
const VertexDescriptor & dereference() const
Get the descriptor of the current vertex.
│ │ │ │ +
Attaches properties to the vertices of a graph.
Definition graph.hh:723
│ │ │ │ +
const Graph & graph() const
Get the graph the properties are attached to.
│ │ │ │ +
Graph::ConstEdgeIterator ConstEdgeIterator
The type of the constant edge iterator.
Definition graph.hh:766
│ │ │ │ +
VertexProperties & getVertexProperties(const VertexDescriptor &vertex)
Get the properties associated with a vertex.
│ │ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ │ +
Graph::EdgeDescriptor EdgeDescriptor
The edge descritor.
Definition graph.hh:738
│ │ │ │ +
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:733
│ │ │ │ +
G Graph
The graph we attach properties to.
Definition graph.hh:728
│ │ │ │ +
VM VertexMap
The type of the map for converting the VertexDescriptor to std::size_t.
Definition graph.hh:756
│ │ │ │ +
EdgeIterator endEdges(const VertexDescriptor &source)
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ │ +
EdgeIterator beginEdges(const VertexDescriptor &source)
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ │ +
VP VertexProperties
The type of the properties of the vertices.
Definition graph.hh:743
│ │ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ │ +
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ │ +
Graph::EdgeIterator EdgeIterator
The type of the mutable edge iterator.
Definition graph.hh:761
│ │ │ │ + │ │ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type EdgeIterator
The class of the edge iterator.
Definition graph.hh:823
│ │ │ │ +
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value, VertexProperties &, constVertexProperties & >::type properties() const
Get the properties of the current Vertex.
│ │ │ │ +
EdgeIterator end() const
Get an iterator over the edges starting from the current vertex.
│ │ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >::type Father
The father class.
Definition graph.hh:814
│ │ │ │ +
EdgeIterator begin() const
Get an iterator over the edges starting from the current vertex.
│ │ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ │ +
Graph::EdgeDescriptor EdgeDescriptor
The edge descritor.
Definition graph.hh:993
│ │ │ │ +
const EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const VertexDescriptor &target) const
Get the properties associated with a edge.
│ │ │ │ +
const EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) const
Get the properties associated with a edge.
│ │ │ │ +
const Graph & graph() const
Get the graph the properties are attached to.
│ │ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ │ +
G Graph
The graph we attach properties to.
Definition graph.hh:983
│ │ │ │ +
EM EdgeMap
The type of the map for converting the EdgeDescriptor to std::size_t.
Definition graph.hh:1030
│ │ │ │ +
VM VertexMap
The type of the map for converting the VertexDescriptor to std::size_t.
Definition graph.hh:1011
│ │ │ │ +
VP VertexProperties
The type of the properties of the vertices.
Definition graph.hh:998
│ │ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ │ +
EP EdgeProperties
The type of the properties of the edges;.
Definition graph.hh:1016
│ │ │ │ +
EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const VertexDescriptor &target)
Get the properties associated with a edge.
│ │ │ │ +
EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge)
Get the properties associated with a edge.
│ │ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:988
│ │ │ │ +
PropertiesGraph(Graph &graph, const VertexMap &vmap=VertexMap(), const EdgeMap &emap=EdgeMap())
Constructor.
│ │ │ │ + │ │ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type Father
The father class.
Definition graph.hh:1050
│ │ │ │ + │ │ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >::type Father
The father class.
Definition graph.hh:1151
│ │ │ │ +
Wrapper to access the internal edge properties of a graph via operator[]()
Definition graph.hh:1361
│ │ │ │ +
GraphVertexPropertiesSelector(G &g)
Constructor.
Definition graph.hh:1380
│ │ │ │ +
VertexProperties & operator[](const Vertex &vertex) const
Get the properties associated to a vertex.
Definition graph.hh:1395
│ │ │ │ +
G Graph
The type of the graph with internal properties.
Definition graph.hh:1366
│ │ │ │ +
G::VertexProperties VertexProperties
The type of the vertex properties.
Definition graph.hh:1370
│ │ │ │ +
GraphVertexPropertiesSelector()
Default constructor.
Definition graph.hh:1386
│ │ │ │ +
G::VertexDescriptor Vertex
The vertex descriptor.
Definition graph.hh:1374
│ │ │ │ +
Wrapper to access the internal vertex properties of a graph via operator[]()
Definition graph.hh:1409
│ │ │ │ +
EdgeProperties & operator[](const Edge &edge) const
Get the properties associated to a vertex.
Definition graph.hh:1442
│ │ │ │ +
G::EdgeProperties EdgeProperties
The type of the vertex properties.
Definition graph.hh:1418
│ │ │ │ +
G::EdgeDescriptor Edge
The edge descriptor.
Definition graph.hh:1422
│ │ │ │ +
GraphEdgePropertiesSelector()
Default constructor.
Definition graph.hh:1434
│ │ │ │ +
G Graph
The type of the graph with internal properties.
Definition graph.hh:1414
│ │ │ │ +
GraphEdgePropertiesSelector(G &g)
Constructor.
Definition graph.hh:1428
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,954 +1,2286 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ -arpackpp.hh │ │ │ │ │ + * _p_a_a_m_g │ │ │ │ │ +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 (C) 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_EIGENVALUE_ARPACKPP_HH │ │ │ │ │ -6#define DUNE_ISTL_EIGENVALUE_ARPACKPP_HH │ │ │ │ │ +5#ifndef DUNE_AMG_GRAPH_HH │ │ │ │ │ +6#define DUNE_AMG_GRAPH_HH │ │ │ │ │ 7 │ │ │ │ │ -8#if HAVE_ARPACKPP || defined DOXYGEN │ │ │ │ │ -9 │ │ │ │ │ -10#include // provides std::abs, std::pow, std::sqrt │ │ │ │ │ -11 │ │ │ │ │ -12#include // provides std::cout, std::endl │ │ │ │ │ -13#include // provides std::string │ │ │ │ │ -14 │ │ │ │ │ -15#include // provides Dune::FieldVector │ │ │ │ │ -16#include // provides DUNE_THROW(...) │ │ │ │ │ +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 │ │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> // provides Dune::blockLevel │ │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> // provides Dune::BlockVector │ │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> // provides Dune::ISTLError │ │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> // provides Dune::printvector(...) │ │ │ │ │ -22 │ │ │ │ │ -23#ifdef Status │ │ │ │ │ -24#undef Status // prevent preprocessor from damaging the ARPACK++ │ │ │ │ │ -25 // code when "X11/Xlib.h" is included (the latter │ │ │ │ │ -26 // defines Status as "#define Status int" and │ │ │ │ │ -27 // ARPACK++ provides a class with a method called │ │ │ │ │ -28 // Status) │ │ │ │ │ -29#endif │ │ │ │ │ -30#include "arssym.h" // provides ARSymStdEig │ │ │ │ │ -31 │ │ │ │ │ -32namespace _D_u_n_e │ │ │ │ │ -33{ │ │ │ │ │ -34 │ │ │ │ │ -39 namespace Impl { │ │ │ │ │ -55 template │ │ │ │ │ -56 class ArPackPlusPlus_BCRSMatrixWrapper │ │ │ │ │ -57 { │ │ │ │ │ -58 public: │ │ │ │ │ -60 typedef typename _B_C_R_S_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e Real; │ │ │ │ │ -61 │ │ │ │ │ -62 public: │ │ │ │ │ -64 ArPackPlusPlus_BCRSMatrixWrapper (const BCRSMatrix& A) │ │ │ │ │ -65 : A_(A), │ │ │ │ │ -66 m_(A_.M() * mBlock), n_(A_.N() * nBlock) │ │ │ │ │ -67 { │ │ │ │ │ -68 // assert that BCRSMatrix type has blocklevel 2 │ │ │ │ │ -69 static_assert │ │ │ │ │ -70 (blockLevel() == 2, │ │ │ │ │ -71 "Only BCRSMatrices with blocklevel 2 are supported."); │ │ │ │ │ -72 │ │ │ │ │ -73 // allocate memory for auxiliary block vector objects │ │ │ │ │ -74 // which are compatible to matrix rows / columns │ │ │ │ │ -75 domainBlockVector.resize(A_.N()); │ │ │ │ │ -76 rangeBlockVector.resize(A_.M()); │ │ │ │ │ -77 } │ │ │ │ │ -78 │ │ │ │ │ -80 inline void multMv (Real* v, Real* w) │ │ │ │ │ -81 { │ │ │ │ │ -82 // get vector v as an object of appropriate type │ │ │ │ │ -83 arrayToDomainBlockVector(v,domainBlockVector); │ │ │ │ │ -84 │ │ │ │ │ -85 // perform matrix-vector product │ │ │ │ │ -86 A_.mv(domainBlockVector,rangeBlockVector); │ │ │ │ │ -87 │ │ │ │ │ -88 // get vector w from object of appropriate type │ │ │ │ │ -89 rangeBlockVectorToArray(rangeBlockVector,w); │ │ │ │ │ -90 }; │ │ │ │ │ -91 │ │ │ │ │ -93 inline void multMtMv (Real* v, Real* w) │ │ │ │ │ -94 { │ │ │ │ │ -95 // get vector v as an object of appropriate type │ │ │ │ │ -96 arrayToDomainBlockVector(v,domainBlockVector); │ │ │ │ │ -97 │ │ │ │ │ -98 // perform matrix-vector product │ │ │ │ │ -99 A_.mv(domainBlockVector,rangeBlockVector); │ │ │ │ │ -100 A_.mtv(rangeBlockVector,domainBlockVector); │ │ │ │ │ -101 │ │ │ │ │ -102 // get vector w from object of appropriate type │ │ │ │ │ -103 domainBlockVectorToArray(domainBlockVector,w); │ │ │ │ │ -104 }; │ │ │ │ │ -105 │ │ │ │ │ -107 inline void multMMtv (Real* v, Real* w) │ │ │ │ │ -108 { │ │ │ │ │ -109 // get vector v as an object of appropriate type │ │ │ │ │ -110 arrayToRangeBlockVector(v,rangeBlockVector); │ │ │ │ │ -111 │ │ │ │ │ -112 // perform matrix-vector product │ │ │ │ │ -113 A_.mtv(rangeBlockVector,domainBlockVector); │ │ │ │ │ -114 A_.mv(domainBlockVector,rangeBlockVector); │ │ │ │ │ -115 │ │ │ │ │ -116 // get vector w from object of appropriate type │ │ │ │ │ -117 rangeBlockVectorToArray(rangeBlockVector,w); │ │ │ │ │ -118 }; │ │ │ │ │ -119 │ │ │ │ │ -121 inline int nrows () const { return m_; } │ │ │ │ │ -122 │ │ │ │ │ -124 inline int ncols () const { return n_; } │ │ │ │ │ -125 │ │ │ │ │ -126 protected: │ │ │ │ │ -127 // Number of rows and columns in each block of the matrix │ │ │ │ │ -128 constexpr static int mBlock = BCRSMatrix::block_type::rows; │ │ │ │ │ -129 constexpr static int nBlock = BCRSMatrix::block_type::cols; │ │ │ │ │ -130 │ │ │ │ │ -131 // Type of vectors in the domain of the linear map associated with │ │ │ │ │ -132 // the matrix, i.e. block vectors compatible to matrix rows │ │ │ │ │ -133 constexpr static int dbvBlockSize = nBlock; │ │ │ │ │ -134 typedef Dune::FieldVector DomainBlockVectorBlock; │ │ │ │ │ -135 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_D_o_m_a_i_n_B_l_o_c_k_V_e_c_t_o_r_B_l_o_c_k_> DomainBlockVector; │ │ │ │ │ -136 │ │ │ │ │ -137 // Type of vectors in the range of the linear map associated with │ │ │ │ │ -138 // the matrix, i.e. block vectors compatible to matrix columns │ │ │ │ │ -139 constexpr static int rbvBlockSize = mBlock; │ │ │ │ │ -140 typedef Dune::FieldVector RangeBlockVectorBlock; │ │ │ │ │ -141 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_R_a_n_g_e_B_l_o_c_k_V_e_c_t_o_r_B_l_o_c_k_> RangeBlockVector; │ │ │ │ │ -142 │ │ │ │ │ -143 // Types for vector index access │ │ │ │ │ -144 typedef typename _D_o_m_a_i_n_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e dbv_size_type; │ │ │ │ │ -145 typedef typename _R_a_n_g_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e rbv_size_type; │ │ │ │ │ -146 typedef typename DomainBlockVectorBlock::size_type dbvb_size_type; │ │ │ │ │ -147 typedef typename RangeBlockVectorBlock::size_type rbvb_size_type; │ │ │ │ │ -148 │ │ │ │ │ -149 // Get vector v from a block vector object which is compatible to │ │ │ │ │ -150 // matrix rows │ │ │ │ │ -151 static inline void │ │ │ │ │ -152 domainBlockVectorToArray (const DomainBlockVector& dbv, Real* v) │ │ │ │ │ -153 { │ │ │ │ │ -154 for (dbv_size_type block = 0; block < dbv.N(); ++block) │ │ │ │ │ -155 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock) │ │ │ │ │ -156 v[block*dbvBlockSize + iBlock] = dbv[block][iBlock]; │ │ │ │ │ -157 } │ │ │ │ │ -158 │ │ │ │ │ -159 // Get vector v from a block vector object which is compatible to │ │ │ │ │ -160 // matrix columns │ │ │ │ │ -161 static inline void │ │ │ │ │ -162 rangeBlockVectorToArray (const RangeBlockVector& rbv, Real* v) │ │ │ │ │ -163 { │ │ │ │ │ -164 for (rbv_size_type block = 0; block < rbv.N(); ++block) │ │ │ │ │ -165 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock) │ │ │ │ │ -166 v[block*rbvBlockSize + iBlock] = rbv[block][iBlock]; │ │ │ │ │ -167 } │ │ │ │ │ +18namespace _D_u_n_e │ │ │ │ │ +19{ │ │ │ │ │ +20 namespace Amg │ │ │ │ │ +21 { │ │ │ │ │ +49 template │ │ │ │ │ +_5_0 class _M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +51 { │ │ │ │ │ +52 public: │ │ │ │ │ +_5_6 typedef M _M_a_t_r_i_x; │ │ │ │ │ +57 │ │ │ │ │ +_6_1 typedef typename std::remove_const::type _M_u_t_a_b_l_e_M_a_t_r_i_x; │ │ │ │ │ +62 │ │ │ │ │ +_6_6 typedef typename M::block_type _W_e_i_g_h_t; │ │ │ │ │ +67 │ │ │ │ │ +_7_3 typedef typename M::size_type _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +74 │ │ │ │ │ +_8_0 typedef std::ptrdiff_t _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +81 │ │ │ │ │ +82 enum { │ │ │ │ │ +83 /* │ │ │ │ │ +84 * @brief Whether Matrix is mutable. │ │ │ │ │ +85 */ │ │ │ │ │ +86 _m_u_t_a_b_l_e_M_a_t_r_i_x = std::is_same::type>::value │ │ │ │ │ +_8_7 }; │ │ │ │ │ +88 │ │ │ │ │ +89 │ │ │ │ │ +93 template │ │ │ │ │ +_9_4 class _E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +95 { │ │ │ │ │ +96 │ │ │ │ │ +97 public: │ │ │ │ │ +_1_0_1 typedef typename std::remove_const::type _M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r; │ │ │ │ │ +_1_0_5 typedef const typename std::remove_const::type _C_o_n_s_t_C_o_n_t_a_i_n_e_r; │ │ │ │ │ +106 │ │ │ │ │ +107 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r>; │ │ │ │ │ +108 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T<_C_o_n_s_t_C_o_n_t_a_i_n_e_r>; │ │ │ │ │ +109 │ │ │ │ │ +110 enum { │ │ │ │ │ +112 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ │ +_1_1_3 }; │ │ │ │ │ +114 │ │ │ │ │ +118 typedef typename std::conditional<_i_s_M_u_t_a_b_l_e && C::mutableMatrix,typename │ │ │ │ │ +Matrix::row_type::Iterator, │ │ │ │ │ +119 typename Matrix::row_type::ConstIterator>::type │ │ │ │ │ +_1_2_0 _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +121 │ │ │ │ │ +125 typedef typename std::conditional<_i_s_M_u_t_a_b_l_e && C::mutableMatrix,typename │ │ │ │ │ +M::block_type, │ │ │ │ │ +126 const typename M::block_type>::type │ │ │ │ │ +_1_2_7 _W_e_i_g_h_t; │ │ │ │ │ +128 │ │ │ │ │ +_1_3_6 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _s_o_u_r_c_e, const _C_o_l_I_t_e_r_a_t_o_r& block, │ │ │ │ │ +137 const _C_o_l_I_t_e_r_a_t_o_r& _e_n_d, const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ │ +138 │ │ │ │ │ +_1_4_5 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _C_o_l_I_t_e_r_a_t_o_r& block); │ │ │ │ │ +146 │ │ │ │ │ +151 template │ │ │ │ │ +_1_5_2 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_1_>& other); │ │ │ │ │ +153 │ │ │ │ │ +154 typedef typename std::conditional::type>::value && C::mutableMatrix, │ │ │ │ │ +155 typename M::block_type, const typename M::block_type>::type │ │ │ │ │ +_1_5_6 _W_e_i_g_h_t_T_y_p_e; │ │ │ │ │ +157 │ │ │ │ │ +_1_6_1 _W_e_i_g_h_t_T_y_p_e& _w_e_i_g_h_t() const; │ │ │ │ │ +162 │ │ │ │ │ +_1_6_4 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_>& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +165 │ │ │ │ │ +_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 │ │ │ │ │ -169 public: │ │ │ │ │ -172 static inline void arrayToDomainBlockVector (const Real* v, │ │ │ │ │ -173 DomainBlockVector& dbv) │ │ │ │ │ -174 { │ │ │ │ │ -175 for (dbv_size_type block = 0; block < dbv.N(); ++block) │ │ │ │ │ -176 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock) │ │ │ │ │ -177 dbv[block][iBlock] = v[block*dbvBlockSize + iBlock]; │ │ │ │ │ -178 } │ │ │ │ │ -179 │ │ │ │ │ -182 static inline void arrayToRangeBlockVector (const Real* v, │ │ │ │ │ -183 RangeBlockVector& rbv) │ │ │ │ │ -184 { │ │ │ │ │ -185 for (rbv_size_type block = 0; block < rbv.N(); ++block) │ │ │ │ │ -186 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock) │ │ │ │ │ -187 rbv[block][iBlock] = v[block*rbvBlockSize + iBlock]; │ │ │ │ │ -188 } │ │ │ │ │ +_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 protected: │ │ │ │ │ -191 // The DUNE-ISTL BCRSMatrix │ │ │ │ │ -192 const BCRSMatrix& A_; │ │ │ │ │ -193 │ │ │ │ │ -194 // Number of rows and columns in the matrix │ │ │ │ │ -195 const int m_, n_; │ │ │ │ │ -196 │ │ │ │ │ -197 // Auxiliary block vector objects which are │ │ │ │ │ -198 // compatible to matrix rows / columns │ │ │ │ │ -199 mutable DomainBlockVector domainBlockVector; │ │ │ │ │ -200 mutable RangeBlockVector rangeBlockVector; │ │ │ │ │ -201 }; │ │ │ │ │ -202 } // end namespace Impl │ │ │ │ │ +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 │ │ │ │ │ -243 template │ │ │ │ │ -_2_4_4 class _A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ -245 { │ │ │ │ │ -246 public: │ │ │ │ │ -_2_4_7 typedef typename _B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e _R_e_a_l; │ │ │ │ │ -248 │ │ │ │ │ -249 public: │ │ │ │ │ -_2_6_8 _A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s (const _B_C_R_S_M_a_t_r_i_x& m, │ │ │ │ │ -269 const unsigned int nIterationsMax = 100000, │ │ │ │ │ -270 const unsigned int verbosity_level = 0) │ │ │ │ │ -271 : _m__(m), _n_I_t_e_r_a_t_i_o_n_s_M_a_x__(nIterationsMax), │ │ │ │ │ -272 _v_e_r_b_o_s_i_t_y___l_e_v_e_l__(verbosity_level), │ │ │ │ │ -273 _n_I_t_e_r_a_t_i_o_n_s__(0), │ │ │ │ │ -274 _t_i_t_l_e__(" ArPackPlusPlus_Algorithms: "), │ │ │ │ │ -275 _b_l_a_n_k__(_t_i_t_l_e__.length(),' ') │ │ │ │ │ -276 {} │ │ │ │ │ -277 │ │ │ │ │ -_2_8_9 inline void _c_o_m_p_u_t_e_S_y_m_M_a_x_M_a_g_n_i_t_u_d_e (const _R_e_a_l& epsilon, │ │ │ │ │ -290 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ -291 { │ │ │ │ │ -292 // print verbosity information │ │ │ │ │ -293 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -294 std::cout << _t_i_t_l_e__ << "Computing an approximation of " │ │ │ │ │ -295 << "the dominant eigenvalue of a matrix which " │ │ │ │ │ -296 << "is assumed to be symmetric." << std::endl; │ │ │ │ │ -297 │ │ │ │ │ -298 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ -299 // and to perform the product A*v (LU decomposition is not used) │ │ │ │ │ -300 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ -301 WrappedMatrix A(_m__); │ │ │ │ │ -302 │ │ │ │ │ -303 // get number of rows and columns in A │ │ │ │ │ -304 const int nrows = A.nrows(); │ │ │ │ │ -305 const int ncols = A.ncols(); │ │ │ │ │ -306 │ │ │ │ │ -307 // assert that A is square │ │ │ │ │ -308 if (nrows != ncols) │ │ │ │ │ -309 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ -310 << nrows << "x" << ncols << ")."); │ │ │ │ │ -311 │ │ │ │ │ -312 // allocate memory for variables, set parameters │ │ │ │ │ -313 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ -314 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ -each iteration (0 == auto) │ │ │ │ │ -315 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ -values) (0 == machine precision) │ │ │ │ │ -316 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ -iterations allowed (0 == 100*nev) │ │ │ │ │ -317 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A │ │ │ │ │ -318 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ -determined │ │ │ │ │ -319 int nconv; // Number of converged eigenvalues │ │ │ │ │ +207 template │ │ │ │ │ +_2_0_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +209 { │ │ │ │ │ +210 public: │ │ │ │ │ +_2_1_4 typedef typename std::remove_const::type _M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r; │ │ │ │ │ +_2_1_8 typedef const typename std::remove_const::type _C_o_n_s_t_C_o_n_t_a_i_n_e_r; │ │ │ │ │ +219 │ │ │ │ │ +220 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r>; │ │ │ │ │ +221 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T<_C_o_n_s_t_C_o_n_t_a_i_n_e_r>; │ │ │ │ │ +222 │ │ │ │ │ +223 enum { │ │ │ │ │ +225 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ │ +_2_2_6 }; │ │ │ │ │ +227 │ │ │ │ │ +_2_3_3 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(C* graph, const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ │ +234 │ │ │ │ │ +_2_4_2 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ │ +243 │ │ │ │ │ +_2_4_4 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other); │ │ │ │ │ +245 │ │ │ │ │ +_2_5_0 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_>& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ +251 │ │ │ │ │ +_2_5_3 bool _o_p_e_r_a_t_o_r_!_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_o_n_s_t_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ │ +254 │ │ │ │ │ +_2_5_6 bool _o_p_e_r_a_t_o_r_=_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_o_n_s_t_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ │ +257 │ │ │ │ │ +_2_5_9 bool _o_p_e_r_a_t_o_r_!_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ │ +260 │ │ │ │ │ +_2_6_2 bool _o_p_e_r_a_t_o_r_=_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ │ +263 │ │ │ │ │ +264 typedef typename std::conditional::type>::value && C::mutableMatrix, │ │ │ │ │ +265 typename M::block_type, const typename M::block_type>::type │ │ │ │ │ +_2_6_6 _W_e_i_g_h_t_T_y_p_e; │ │ │ │ │ +_2_6_8 _W_e_i_g_h_t_T_y_p_e& _w_e_i_g_h_t() const; │ │ │ │ │ +269 │ │ │ │ │ +_2_7_4 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_*() const; │ │ │ │ │ +275 │ │ │ │ │ +_2_8_1 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_> _b_e_g_i_n() const; │ │ │ │ │ +282 │ │ │ │ │ +_2_8_8 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_> _e_n_d() const; │ │ │ │ │ +289 │ │ │ │ │ +290 private: │ │ │ │ │ +291 C* graph_; │ │ │ │ │ +292 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r current_; │ │ │ │ │ +293 }; │ │ │ │ │ +294 │ │ │ │ │ +_2_9_8 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T_<_c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +299 │ │ │ │ │ +_3_0_3 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T_<_M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +304 │ │ │ │ │ +_3_0_8 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ │ +309 │ │ │ │ │ +_3_1_3 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ │ +314 │ │ │ │ │ +_3_1_9 _M_a_t_r_i_x_G_r_a_p_h(_M_a_t_r_i_x& _m_a_t_r_i_x); │ │ │ │ │ 320 │ │ │ │ │ -321 // define what we need: eigenvalues with largest magnitude │ │ │ │ │ -322 char which[] = "LM"; │ │ │ │ │ -323 ARSymStdEig │ │ │ │ │ -324 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit); │ │ │ │ │ +_3_2_4 _~_M_a_t_r_i_x_G_r_a_p_h(); │ │ │ │ │ 325 │ │ │ │ │ -326 // set ARPACK verbosity mode if requested │ │ │ │ │ -327 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ -328 │ │ │ │ │ -329 // find eigenvalues and eigenvectors of A, obtain the eigenvalues │ │ │ │ │ -330 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ +_3_3_0 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ │ 331 │ │ │ │ │ -332 // obtain approximated dominant eigenvalue of A │ │ │ │ │ -333 lambda = ev[nev-1]; │ │ │ │ │ -334 │ │ │ │ │ -335 // obtain associated approximated eigenvector of A │ │ │ │ │ -336 _R_e_a_l* x_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ -337 WrappedMatrix::arrayToDomainBlockVector(x_raw,x); │ │ │ │ │ -338 │ │ │ │ │ -339 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ -340 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ -341 │ │ │ │ │ -342 // compute residual norm │ │ │ │ │ -343 _B_l_o_c_k_V_e_c_t_o_r r(x); │ │ │ │ │ -344 _R_e_a_l* Ax_raw = new _R_e_a_l[nrows]; │ │ │ │ │ -345 A.multMv(x_raw,Ax_raw); │ │ │ │ │ -346 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r); │ │ │ │ │ -347 r.axpy(-lambda,x); │ │ │ │ │ -348 const _R_e_a_l r_norm = r.two_norm(); │ │ │ │ │ +_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 │ │ │ │ │ -350 // print verbosity information │ │ │ │ │ -351 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -352 { │ │ │ │ │ -353 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -354 { │ │ │ │ │ -355 // print some information about the problem │ │ │ │ │ -356 std::cout << _b_l_a_n_k__ << "Obtained eigenvalues of A by solving " │ │ │ │ │ -357 << "A*x = λ*x using the ARPACK++ class ARSym" │ │ │ │ │ -358 << "StdEig:" << std::endl; │ │ │ │ │ -359 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A: " │ │ │ │ │ -360 << nconv << " / " << nev << std::endl; │ │ │ │ │ -361 std::cout << _b_l_a_n_k__ << " dominant eigenvalue of A: " │ │ │ │ │ -362 << lambda << std::endl; │ │ │ │ │ -363 } │ │ │ │ │ -364 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -365 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -366 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -367 << "λ = " << lambda << std::endl; │ │ │ │ │ -368 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -369 { │ │ │ │ │ -370 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ -371 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -372 } │ │ │ │ │ -373 } │ │ │ │ │ +_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 │ │ │ │ │ -375 // free dynamically allocated memory │ │ │ │ │ -376 delete[] Ax_raw; │ │ │ │ │ -377 delete[] ev; │ │ │ │ │ -378 } │ │ │ │ │ -379 │ │ │ │ │ -_3_9_1 inline void _c_o_m_p_u_t_e_S_y_m_M_i_n_M_a_g_n_i_t_u_d_e (const _R_e_a_l& epsilon, │ │ │ │ │ -392 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ -393 { │ │ │ │ │ -394 // print verbosity information │ │ │ │ │ -395 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -396 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ -397 << "least dominant eigenvalue of a matrix which " │ │ │ │ │ -398 << "is assumed to be symmetric." << std::endl; │ │ │ │ │ +_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 │ │ │ │ │ -400 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ -401 // and to perform the product A*v (LU decomposition is not used) │ │ │ │ │ -402 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ -403 WrappedMatrix A(_m__); │ │ │ │ │ -404 │ │ │ │ │ -405 // get number of rows and columns in A │ │ │ │ │ -406 const int nrows = A.nrows(); │ │ │ │ │ -407 const int ncols = A.ncols(); │ │ │ │ │ -408 │ │ │ │ │ -409 // assert that A is square │ │ │ │ │ -410 if (nrows != ncols) │ │ │ │ │ -411 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ -412 << nrows << "x" << ncols << ")."); │ │ │ │ │ -413 │ │ │ │ │ -414 // allocate memory for variables, set parameters │ │ │ │ │ -415 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ -416 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ -each iteration (0 == auto) │ │ │ │ │ -417 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ -values) (0 == machine precision) │ │ │ │ │ -418 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ -iterations allowed (0 == 100*nev) │ │ │ │ │ -419 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A │ │ │ │ │ -420 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ -determined │ │ │ │ │ -421 int nconv; // Number of converged eigenvalues │ │ │ │ │ -422 │ │ │ │ │ -423 // define what we need: eigenvalues with smallest magnitude │ │ │ │ │ -424 char which[] = "SM"; │ │ │ │ │ -425 ARSymStdEig │ │ │ │ │ -426 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit); │ │ │ │ │ -427 │ │ │ │ │ -428 // set ARPACK verbosity mode if requested │ │ │ │ │ -429 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ -430 │ │ │ │ │ -431 // find eigenvalues and eigenvectors of A, obtain the eigenvalues │ │ │ │ │ -432 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ -433 │ │ │ │ │ -434 // obtain approximated least dominant eigenvalue of A │ │ │ │ │ -435 lambda = ev[nev-1]; │ │ │ │ │ -436 │ │ │ │ │ -437 // obtain associated approximated eigenvector of A │ │ │ │ │ -438 _R_e_a_l* x_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ -439 WrappedMatrix::arrayToDomainBlockVector(x_raw,x); │ │ │ │ │ -440 │ │ │ │ │ -441 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ -442 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ -443 │ │ │ │ │ -444 // compute residual norm │ │ │ │ │ -445 _B_l_o_c_k_V_e_c_t_o_r r(x); │ │ │ │ │ -446 _R_e_a_l* Ax_raw = new _R_e_a_l[nrows]; │ │ │ │ │ -447 A.multMv(x_raw,Ax_raw); │ │ │ │ │ -448 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r); │ │ │ │ │ -449 r.axpy(-lambda,x); │ │ │ │ │ -450 const _R_e_a_l r_norm = r.two_norm(); │ │ │ │ │ -451 │ │ │ │ │ -452 // print verbosity information │ │ │ │ │ -453 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -454 { │ │ │ │ │ -455 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -456 { │ │ │ │ │ -457 // print some information about the problem │ │ │ │ │ -458 std::cout << _b_l_a_n_k__ << "Obtained eigenvalues of A by solving " │ │ │ │ │ -459 << "A*x = λ*x using the ARPACK++ class ARSym" │ │ │ │ │ -460 << "StdEig:" << std::endl; │ │ │ │ │ -461 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A: " │ │ │ │ │ -462 << nconv << " / " << nev << std::endl; │ │ │ │ │ -463 std::cout << _b_l_a_n_k__ << " least dominant eigenvalue of A: " │ │ │ │ │ -464 << lambda << std::endl; │ │ │ │ │ -465 } │ │ │ │ │ -466 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -467 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -468 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -469 << "λ = " << lambda << std::endl; │ │ │ │ │ -470 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -471 { │ │ │ │ │ -472 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ -473 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -474 } │ │ │ │ │ -475 } │ │ │ │ │ -476 │ │ │ │ │ -477 // free dynamically allocated memory │ │ │ │ │ -478 delete[] Ax_raw; │ │ │ │ │ -479 delete[] ev; │ │ │ │ │ -480 } │ │ │ │ │ -481 │ │ │ │ │ -_4_9_3 inline void _c_o_m_p_u_t_e_S_y_m_C_o_n_d_2 (const _R_e_a_l& epsilon, _R_e_a_l& cond_2) const │ │ │ │ │ -494 { │ │ │ │ │ -495 // print verbosity information │ │ │ │ │ -496 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -497 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ -498 << "spectral condition number of a matrix which " │ │ │ │ │ -499 << "is assumed to be symmetric." << std::endl; │ │ │ │ │ +_4_0_6 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ │ +407 │ │ │ │ │ +_4_1_1 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ │ +412 │ │ │ │ │ +_4_1_9 _E_d_g_e_D_e_s_c_r_i_p_t_o_r _f_i_n_d_E_d_g_e(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ │ +420 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ │ +421 │ │ │ │ │ +422 private: │ │ │ │ │ +424 _M_a_t_r_i_x& matrix_; │ │ │ │ │ +426 _E_d_g_e_D_e_s_c_r_i_p_t_o_r* start_; │ │ │ │ │ +428 _M_a_t_r_i_x_G_r_a_p_h(const _M_a_t_r_i_x_G_r_a_p_h&); │ │ │ │ │ +429 │ │ │ │ │ +430 }; │ │ │ │ │ +431 │ │ │ │ │ +441 template │ │ │ │ │ +_4_4_2 class _S_u_b_G_r_a_p_h │ │ │ │ │ +443 { │ │ │ │ │ +444 public: │ │ │ │ │ +_4_4_8 typedef G _G_r_a_p_h; │ │ │ │ │ +449 │ │ │ │ │ +_4_5_4 typedef T _E_x_c_l_u_d_e_d; │ │ │ │ │ +455 │ │ │ │ │ +_4_5_9 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +460 │ │ │ │ │ +_4_6_1 typedef _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r* _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +462 │ │ │ │ │ +_4_6_9 class _E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ │ +470 { │ │ │ │ │ +471 public: │ │ │ │ │ +_4_7_2 typedef ReadablePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ │ +473 │ │ │ │ │ +_4_7_4 _E_d_g_e_I_n_d_e_x_M_a_p(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& firstEdge) │ │ │ │ │ +475 : firstEdge_(firstEdge) │ │ │ │ │ +476 {} │ │ │ │ │ +477 │ │ │ │ │ +_4_7_9 _E_d_g_e_I_n_d_e_x_M_a_p(const _E_d_g_e_I_n_d_e_x_M_a_p& emap) │ │ │ │ │ +480 : firstEdge_(emap.firstEdge_) │ │ │ │ │ +481 {} │ │ │ │ │ +482 │ │ │ │ │ +_4_8_3 std::size_t _o_p_e_r_a_t_o_r_[_](const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge) const │ │ │ │ │ +484 { │ │ │ │ │ +485 return edge-firstEdge_; │ │ │ │ │ +486 } │ │ │ │ │ +487 private: │ │ │ │ │ +489 _E_d_g_e_D_e_s_c_r_i_p_t_o_r firstEdge_; │ │ │ │ │ +491 _E_d_g_e_I_n_d_e_x_M_a_p() │ │ │ │ │ +492 {} │ │ │ │ │ +493 }; │ │ │ │ │ +494 │ │ │ │ │ +_4_9_9 _E_d_g_e_I_n_d_e_x_M_a_p _g_e_t_E_d_g_e_I_n_d_e_x_M_a_p(); │ │ │ │ │ 500 │ │ │ │ │ -501 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ -502 // and to perform the product A*v (LU decomposition is not used) │ │ │ │ │ -503 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ -504 WrappedMatrix A(_m__); │ │ │ │ │ -505 │ │ │ │ │ -506 // get number of rows and columns in A │ │ │ │ │ -507 const int nrows = A.nrows(); │ │ │ │ │ -508 const int ncols = A.ncols(); │ │ │ │ │ -509 │ │ │ │ │ -510 // assert that A is square │ │ │ │ │ -511 if (nrows != ncols) │ │ │ │ │ -512 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ -513 << nrows << "x" << ncols << ")."); │ │ │ │ │ -514 │ │ │ │ │ -515 // allocate memory for variables, set parameters │ │ │ │ │ -516 const int nev = 2; // Number of eigenvalues to compute │ │ │ │ │ -517 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ -each iteration (0 == auto) │ │ │ │ │ -518 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ -values) (0 == machine precision) │ │ │ │ │ -519 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ -iterations allowed (0 == 100*nev) │ │ │ │ │ -520 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A │ │ │ │ │ -521 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ -determined │ │ │ │ │ -522 int nconv; // Number of converged eigenvalues │ │ │ │ │ -523 │ │ │ │ │ -524 // define what we need: eigenvalues from both ends of the spectrum │ │ │ │ │ -525 char which[] = "BE"; │ │ │ │ │ -526 ARSymStdEig │ │ │ │ │ -527 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit); │ │ │ │ │ +_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 │ │ │ │ │ -529 // set ARPACK verbosity mode if requested │ │ │ │ │ -530 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ +_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 │ │ │ │ │ -532 // find eigenvalues and eigenvectors of A, obtain the eigenvalues │ │ │ │ │ -533 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ -534 │ │ │ │ │ -535 // obtain approximated dominant and least dominant eigenvalue of A │ │ │ │ │ -536 const _R_e_a_l& lambda_max = ev[nev-1]; │ │ │ │ │ -537 const _R_e_a_l& lambda_min = ev[0]; │ │ │ │ │ -538 │ │ │ │ │ -539 // obtain associated approximated eigenvectors of A │ │ │ │ │ -540 _R_e_a_l* x_max_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ -541 _R_e_a_l* x_min_raw = dprob.RawEigenvector(0); │ │ │ │ │ +_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 │ │ │ │ │ -543 // obtain approximated spectral condition number of A │ │ │ │ │ -544 cond_2 = std::abs(lambda_max / lambda_min); │ │ │ │ │ -545 │ │ │ │ │ -546 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ -547 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ -548 │ │ │ │ │ -549 // compute each residual norm │ │ │ │ │ -550 _R_e_a_l* Ax_max_raw = new _R_e_a_l[nrows]; │ │ │ │ │ -551 _R_e_a_l* Ax_min_raw = new _R_e_a_l[nrows]; │ │ │ │ │ -552 A.multMv(x_max_raw,Ax_max_raw); │ │ │ │ │ -553 A.multMv(x_min_raw,Ax_min_raw); │ │ │ │ │ -554 _R_e_a_l r_max_norm = 0.0; │ │ │ │ │ -555 _R_e_a_l r_min_norm = 0.0; │ │ │ │ │ -556 for (int i = 0; i < nrows; ++i) │ │ │ │ │ -557 { │ │ │ │ │ -558 r_max_norm += std::pow(Ax_max_raw[i] - lambda_max * x_max_raw[i],2); │ │ │ │ │ -559 r_min_norm += std::pow(Ax_min_raw[i] - lambda_min * x_min_raw[i],2); │ │ │ │ │ -560 } │ │ │ │ │ -561 r_max_norm = std::sqrt(r_max_norm); │ │ │ │ │ -562 r_min_norm = std::sqrt(r_min_norm); │ │ │ │ │ -563 │ │ │ │ │ -564 // print verbosity information │ │ │ │ │ -565 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -566 { │ │ │ │ │ -567 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -568 { │ │ │ │ │ -569 // print some information about the problem │ │ │ │ │ -570 std::cout << _b_l_a_n_k__ << "Obtained eigenvalues of A by solving " │ │ │ │ │ -571 << "A*x = λ*x using the ARPACK++ class ARSym" │ │ │ │ │ -572 << "StdEig:" << std::endl; │ │ │ │ │ -573 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A: " │ │ │ │ │ -574 << nconv << " / " << nev << std::endl; │ │ │ │ │ -575 std::cout << _b_l_a_n_k__ << " dominant eigenvalue of A: " │ │ │ │ │ -576 << lambda_max << std::endl; │ │ │ │ │ -577 std::cout << _b_l_a_n_k__ << " least dominant eigenvalue of A: " │ │ │ │ │ -578 << lambda_min << std::endl; │ │ │ │ │ -579 std::cout << _b_l_a_n_k__ << " spectral condition number of A: " │ │ │ │ │ -580 << cond_2 << std::endl; │ │ │ │ │ -581 } │ │ │ │ │ -582 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -583 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -584 << "║residual║_2 = {" << r_max_norm << "," │ │ │ │ │ -585 << r_min_norm << "}, " << "λ = {" │ │ │ │ │ -586 << lambda_max << "," << lambda_min │ │ │ │ │ -587 << "}): cond_2 = " << cond_2 << std::endl; │ │ │ │ │ -588 } │ │ │ │ │ -589 │ │ │ │ │ -590 // free dynamically allocated memory │ │ │ │ │ -591 delete[] Ax_min_raw; │ │ │ │ │ -592 delete[] Ax_max_raw; │ │ │ │ │ -593 delete[] ev; │ │ │ │ │ -594 } │ │ │ │ │ -595 │ │ │ │ │ -_6_0_9 inline void _c_o_m_p_u_t_e_N_o_n_S_y_m_M_a_x (const _R_e_a_l& epsilon, │ │ │ │ │ -610 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& sigma) const │ │ │ │ │ -611 { │ │ │ │ │ -612 // print verbosity information │ │ │ │ │ -613 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -614 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ -615 << "largest singular value of a matrix which " │ │ │ │ │ -616 << "is assumed to be nonsymmetric." << std::endl; │ │ │ │ │ -617 │ │ │ │ │ -618 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ -619 // and to perform the product A^T*A*v (LU decomposition is not used) │ │ │ │ │ -620 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ -621 WrappedMatrix A(_m__); │ │ │ │ │ -622 │ │ │ │ │ -623 // get number of rows and columns in A │ │ │ │ │ -624 const int nrows = A.nrows(); │ │ │ │ │ -625 const int ncols = A.ncols(); │ │ │ │ │ -626 │ │ │ │ │ -627 // assert that A has more rows than columns (extend code later to the │ │ │ │ │ -opposite case!) │ │ │ │ │ -628 if (nrows < ncols) │ │ │ │ │ -629 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix has less rows than " │ │ │ │ │ -630 << "columns (" << nrows << "x" << ncols << ")." │ │ │ │ │ -631 << " This case is not implemented, yet."); │ │ │ │ │ -632 │ │ │ │ │ -633 // allocate memory for variables, set parameters │ │ │ │ │ -634 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ -635 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ -each iteration (0 == auto) │ │ │ │ │ -636 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ -values) (0 == machine precision) │ │ │ │ │ -637 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ -iterations allowed (0 == 100*nev) │ │ │ │ │ -638 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A^T*A │ │ │ │ │ -639 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ -determined │ │ │ │ │ -640 int nconv; // Number of converged eigenvalues │ │ │ │ │ -641 │ │ │ │ │ -642 // define what we need: eigenvalues with largest algebraic value │ │ │ │ │ -643 char which[] = "LA"; │ │ │ │ │ -644 ARSymStdEig │ │ │ │ │ -645 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit); │ │ │ │ │ -646 │ │ │ │ │ -647 // set ARPACK verbosity mode if requested │ │ │ │ │ -648 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ -649 │ │ │ │ │ -650 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues │ │ │ │ │ -651 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ +_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 │ │ │ │ │ -653 // obtain approximated largest eigenvalue of A^T*A │ │ │ │ │ -654 const _R_e_a_l& lambda = ev[nev-1]; │ │ │ │ │ -655 │ │ │ │ │ -656 // obtain associated approximated eigenvector of A^T*A │ │ │ │ │ -657 _R_e_a_l* x_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ -658 WrappedMatrix::arrayToDomainBlockVector(x_raw,x); │ │ │ │ │ -659 │ │ │ │ │ -660 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ -661 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ -662 │ │ │ │ │ -663 // compute residual norm │ │ │ │ │ -664 _B_l_o_c_k_V_e_c_t_o_r r(x); │ │ │ │ │ -665 _R_e_a_l* AtAx_raw = new _R_e_a_l[ncols]; │ │ │ │ │ -666 A.multMtMv(x_raw,AtAx_raw); │ │ │ │ │ -667 WrappedMatrix::arrayToDomainBlockVector(AtAx_raw,r); │ │ │ │ │ -668 r.axpy(-lambda,x); │ │ │ │ │ -669 const _R_e_a_l r_norm = r.two_norm(); │ │ │ │ │ -670 │ │ │ │ │ -671 // calculate largest singular value of A (note that │ │ │ │ │ -672 // x is right-singular / left-singular vector of A) │ │ │ │ │ -673 sigma = std::sqrt(lambda); │ │ │ │ │ -674 │ │ │ │ │ -675 // print verbosity information │ │ │ │ │ -676 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -677 { │ │ │ │ │ -678 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -679 { │ │ │ │ │ -680 // print some information about the problem │ │ │ │ │ -681 std::cout << _b_l_a_n_k__ << "Obtained singular values of A by sol" │ │ │ │ │ -682 << "ving (A^T*A)*x = σ²*x using the ARPACK++ " │ │ │ │ │ -683 << "class ARSymStdEig:" << std::endl; │ │ │ │ │ -684 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A^T*A: " │ │ │ │ │ -685 << nconv << " / " << nev << std::endl; │ │ │ │ │ -686 std::cout << _b_l_a_n_k__ << " largest eigenvalue of A^T*A: " │ │ │ │ │ -687 << lambda << std::endl; │ │ │ │ │ -688 std::cout << _b_l_a_n_k__ << " => largest singular value of A: " │ │ │ │ │ -689 << sigma << std::endl; │ │ │ │ │ -690 } │ │ │ │ │ -691 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -692 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -693 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -694 << "σ = " << sigma << std::endl; │ │ │ │ │ -695 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -696 { │ │ │ │ │ -697 // print approximated right-singular / left-singular vector │ │ │ │ │ -698 // via DUNE-ISTL I/O methods │ │ │ │ │ -699 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -700 } │ │ │ │ │ -701 } │ │ │ │ │ -702 │ │ │ │ │ -703 // free dynamically allocated memory │ │ │ │ │ -704 delete[] AtAx_raw; │ │ │ │ │ -705 delete[] ev; │ │ │ │ │ -706 } │ │ │ │ │ -707 │ │ │ │ │ -_7_2_1 inline void _c_o_m_p_u_t_e_N_o_n_S_y_m_M_i_n (const _R_e_a_l& epsilon, │ │ │ │ │ -722 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& sigma) const │ │ │ │ │ +_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 // print verbosity information │ │ │ │ │ -725 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -726 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ -727 << "smallest singular value of a matrix which " │ │ │ │ │ -728 << "is assumed to be nonsymmetric." << std::endl; │ │ │ │ │ +724 public: │ │ │ │ │ +_7_2_8 typedef G _G_r_a_p_h; │ │ │ │ │ 729 │ │ │ │ │ -730 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ -731 // and to perform the product A^T*A*v (LU decomposition is not used) │ │ │ │ │ -732 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ -733 WrappedMatrix A(_m__); │ │ │ │ │ +_7_3_3 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ 734 │ │ │ │ │ -735 // get number of rows and columns in A │ │ │ │ │ -736 const int nrows = A.nrows(); │ │ │ │ │ -737 const int ncols = A.ncols(); │ │ │ │ │ -738 │ │ │ │ │ -739 // assert that A has more rows than columns (extend code later to the │ │ │ │ │ -opposite case!) │ │ │ │ │ -740 if (nrows < ncols) │ │ │ │ │ -741 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix has less rows than " │ │ │ │ │ -742 << "columns (" << nrows << "x" << ncols << ")." │ │ │ │ │ -743 << " This case is not implemented, yet."); │ │ │ │ │ +_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 │ │ │ │ │ -745 // allocate memory for variables, set parameters │ │ │ │ │ -746 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ -747 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ -each iteration (0 == auto) │ │ │ │ │ -748 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ -values) (0 == machine precision) │ │ │ │ │ -749 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ -iterations allowed (0 == 100*nev) │ │ │ │ │ -750 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A^T*A │ │ │ │ │ -751 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ -determined │ │ │ │ │ -752 int nconv; // Number of converged eigenvalues │ │ │ │ │ -753 │ │ │ │ │ -754 // define what we need: eigenvalues with smallest algebraic value │ │ │ │ │ -755 char which[] = "SA"; │ │ │ │ │ -756 ARSymStdEig │ │ │ │ │ -757 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit); │ │ │ │ │ -758 │ │ │ │ │ -759 // set ARPACK verbosity mode if requested │ │ │ │ │ -760 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ -761 │ │ │ │ │ -762 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues │ │ │ │ │ -763 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ -764 │ │ │ │ │ -765 // obtain approximated smallest eigenvalue of A^T*A │ │ │ │ │ -766 const _R_e_a_l& lambda = ev[nev-1]; │ │ │ │ │ +_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 │ │ │ │ │ -768 // obtain associated approximated eigenvector of A^T*A │ │ │ │ │ -769 _R_e_a_l* x_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ -770 WrappedMatrix::arrayToDomainBlockVector(x_raw,x); │ │ │ │ │ -771 │ │ │ │ │ -772 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ -773 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ +_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 │ │ │ │ │ -775 // compute residual norm │ │ │ │ │ -776 _B_l_o_c_k_V_e_c_t_o_r r(x); │ │ │ │ │ -777 _R_e_a_l* AtAx_raw = new _R_e_a_l[ncols]; │ │ │ │ │ -778 A.multMtMv(x_raw,AtAx_raw); │ │ │ │ │ -779 WrappedMatrix::arrayToDomainBlockVector(AtAx_raw,r); │ │ │ │ │ -780 r.axpy(-lambda,x); │ │ │ │ │ -781 const _R_e_a_l r_norm = r.two_norm(); │ │ │ │ │ -782 │ │ │ │ │ -783 // calculate smallest singular value of A (note that │ │ │ │ │ -784 // x is right-singular / left-singular vector of A) │ │ │ │ │ -785 sigma = std::sqrt(lambda); │ │ │ │ │ -786 │ │ │ │ │ -787 // print verbosity information │ │ │ │ │ -788 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -789 { │ │ │ │ │ -790 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -791 { │ │ │ │ │ -792 // print some information about the problem │ │ │ │ │ -793 std::cout << _b_l_a_n_k__ << "Obtained singular values of A by sol" │ │ │ │ │ -794 << "ving (A^T*A)*x = σ²*x using the ARPACK++ " │ │ │ │ │ -795 << "class ARSymStdEig:" << std::endl; │ │ │ │ │ -796 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A^T*A: " │ │ │ │ │ -797 << nconv << " / " << nev << std::endl; │ │ │ │ │ -798 std::cout << _b_l_a_n_k__ << " smallest eigenvalue of A^T*A: " │ │ │ │ │ -799 << lambda << std::endl; │ │ │ │ │ -800 std::cout << _b_l_a_n_k__ << " => smallest singular value of A: " │ │ │ │ │ -801 << sigma << std::endl; │ │ │ │ │ -802 } │ │ │ │ │ -803 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -804 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -805 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -806 << "σ = " << sigma << std::endl; │ │ │ │ │ -807 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -808 { │ │ │ │ │ -809 // print approximated right-singular / left-singular vector │ │ │ │ │ -810 // via DUNE-ISTL I/O methods │ │ │ │ │ -811 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -812 } │ │ │ │ │ -813 } │ │ │ │ │ -814 │ │ │ │ │ -815 // free dynamically allocated memory │ │ │ │ │ -816 delete[] AtAx_raw; │ │ │ │ │ -817 delete[] ev; │ │ │ │ │ -818 } │ │ │ │ │ -819 │ │ │ │ │ -_8_3_0 inline void _c_o_m_p_u_t_e_N_o_n_S_y_m_C_o_n_d_2 (const _R_e_a_l& epsilon, _R_e_a_l& cond_2) const │ │ │ │ │ -831 { │ │ │ │ │ -832 // print verbosity information │ │ │ │ │ -833 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -834 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ -835 << "spectral condition number of a matrix which " │ │ │ │ │ -836 << "is assumed to be nonsymmetric." << std::endl; │ │ │ │ │ -837 │ │ │ │ │ -838 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ -839 // and to perform the product A^T*A*v (LU decomposition is not used) │ │ │ │ │ -840 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ -841 WrappedMatrix A(_m__); │ │ │ │ │ +_7_8_0 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ │ +781 │ │ │ │ │ +_7_8_7 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ │ +788 │ │ │ │ │ +_7_9_4 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ │ +795 │ │ │ │ │ +796 │ │ │ │ │ +797 template │ │ │ │ │ +_7_9_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +799 : public std::conditional::type, │ │ │ │ │ +800 C>::value, │ │ │ │ │ +801 typename Graph::VertexIterator, │ │ │ │ │ +802 typename Graph::ConstVertexIterator>::type │ │ │ │ │ +803 { │ │ │ │ │ +804 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ │ +805 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ │ +806 public: │ │ │ │ │ +810 typedef typename std::conditional::type, │ │ │ │ │ +811 C>::value, │ │ │ │ │ +812 typename Graph::VertexIterator, │ │ │ │ │ +813 typename Graph::ConstVertexIterator>::type │ │ │ │ │ +_8_1_4 _F_a_t_h_e_r; │ │ │ │ │ +815 │ │ │ │ │ +819 typedef typename std::conditional::type, │ │ │ │ │ +820 C>::value, │ │ │ │ │ +821 typename Graph::EdgeIterator, │ │ │ │ │ +822 typename Graph::ConstEdgeIterator>::type │ │ │ │ │ +_8_2_3 _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +824 │ │ │ │ │ +_8_3_0 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ │ +831 C* graph); │ │ │ │ │ +832 │ │ │ │ │ +833 │ │ │ │ │ +_8_4_1 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ │ 842 │ │ │ │ │ -843 // get number of rows and columns in A │ │ │ │ │ -844 const int nrows = A.nrows(); │ │ │ │ │ -845 const int ncols = A.ncols(); │ │ │ │ │ -846 │ │ │ │ │ -847 // assert that A has more rows than columns (extend code later to the │ │ │ │ │ -opposite case!) │ │ │ │ │ -848 if (nrows < ncols) │ │ │ │ │ -849 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix has less rows than " │ │ │ │ │ -850 << "columns (" << nrows << "x" << ncols << ")." │ │ │ │ │ -851 << " This case is not implemented, yet."); │ │ │ │ │ -852 │ │ │ │ │ -853 // allocate memory for variables, set parameters │ │ │ │ │ -854 const int nev = 2; // Number of eigenvalues to compute │ │ │ │ │ -855 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ -each iteration (0 == auto) │ │ │ │ │ -856 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ -values) (0 == machine precision) │ │ │ │ │ -857 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ -iterations allowed (0 == 100*nev) │ │ │ │ │ -858 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A^T*A │ │ │ │ │ -859 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ -determined │ │ │ │ │ -860 int nconv; // Number of converged eigenvalues │ │ │ │ │ -861 │ │ │ │ │ -862 // define what we need: eigenvalues from both ends of the spectrum │ │ │ │ │ -863 char which[] = "BE"; │ │ │ │ │ -864 ARSymStdEig │ │ │ │ │ -865 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit); │ │ │ │ │ -866 │ │ │ │ │ -867 // set ARPACK verbosity mode if requested │ │ │ │ │ -868 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ -869 │ │ │ │ │ -870 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues │ │ │ │ │ -871 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ -872 │ │ │ │ │ -873 // obtain approximated largest and smallest eigenvalue of A^T*A │ │ │ │ │ -874 const _R_e_a_l& lambda_max = ev[nev-1]; │ │ │ │ │ -875 const _R_e_a_l& lambda_min = ev[0]; │ │ │ │ │ -876 │ │ │ │ │ -877 // obtain associated approximated eigenvectors of A^T*A │ │ │ │ │ -878 _R_e_a_l* x_max_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ -879 _R_e_a_l* x_min_raw = dprob.RawEigenvector(0); │ │ │ │ │ -880 │ │ │ │ │ -881 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ -882 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ -883 │ │ │ │ │ -884 // compute each residual norm │ │ │ │ │ -885 _R_e_a_l* AtAx_max_raw = new _R_e_a_l[ncols]; │ │ │ │ │ -886 _R_e_a_l* AtAx_min_raw = new _R_e_a_l[ncols]; │ │ │ │ │ -887 A.multMtMv(x_max_raw,AtAx_max_raw); │ │ │ │ │ -888 A.multMtMv(x_min_raw,AtAx_min_raw); │ │ │ │ │ -889 _R_e_a_l r_max_norm = 0.0; │ │ │ │ │ -890 _R_e_a_l r_min_norm = 0.0; │ │ │ │ │ -891 for (int i = 0; i < ncols; ++i) │ │ │ │ │ -892 { │ │ │ │ │ -893 r_max_norm += std::pow(AtAx_max_raw[i] - lambda_max * x_max_raw[i],2); │ │ │ │ │ -894 r_min_norm += std::pow(AtAx_min_raw[i] - lambda_min * x_min_raw[i],2); │ │ │ │ │ -895 } │ │ │ │ │ -896 r_max_norm = std::sqrt(r_max_norm); │ │ │ │ │ -897 r_min_norm = std::sqrt(r_min_norm); │ │ │ │ │ -898 │ │ │ │ │ -899 // calculate largest and smallest singular value of A │ │ │ │ │ -900 const _R_e_a_l sigma_max = std::sqrt(lambda_max); │ │ │ │ │ -901 const _R_e_a_l sigma_min = std::sqrt(lambda_min); │ │ │ │ │ +847 template │ │ │ │ │ +_8_4_8 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const VertexIteratorT& other); │ │ │ │ │ +849 │ │ │ │ │ +853 typename std::conditional:: │ │ │ │ │ +type>::value, │ │ │ │ │ +854 VertexProperties&, │ │ │ │ │ +855 const VertexProperties&>::type │ │ │ │ │ +_8_5_6 _p_r_o_p_e_r_t_i_e_s() const; │ │ │ │ │ +857 │ │ │ │ │ +_8_6_3 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ │ +864 │ │ │ │ │ +_8_7_0 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ │ +871 │ │ │ │ │ +872 private: │ │ │ │ │ +876 C* graph_; │ │ │ │ │ +877 }; │ │ │ │ │ +878 │ │ │ │ │ +882 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ │ +884 │ │ │ │ │ +888 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ │ +890 │ │ │ │ │ +_8_9_5 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ │ +896 │ │ │ │ │ +_9_0_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ │ 902 │ │ │ │ │ -903 // obtain approximated spectral condition number of A │ │ │ │ │ -904 cond_2 = sigma_max / sigma_min; │ │ │ │ │ -905 │ │ │ │ │ -906 // print verbosity information │ │ │ │ │ -907 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -908 { │ │ │ │ │ -909 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -910 { │ │ │ │ │ -911 // print some information about the problem │ │ │ │ │ -912 std::cout << _b_l_a_n_k__ << "Obtained singular values of A by sol" │ │ │ │ │ -913 << "ving (A^T*A)*x = σ²*x using the ARPACK++ " │ │ │ │ │ -914 << "class ARSymStdEig:" << std::endl; │ │ │ │ │ -915 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A^T*A: " │ │ │ │ │ -916 << nconv << " / " << nev << std::endl; │ │ │ │ │ -917 std::cout << _b_l_a_n_k__ << " largest eigenvalue of A^T*A: " │ │ │ │ │ -918 << lambda_max << std::endl; │ │ │ │ │ -919 std::cout << _b_l_a_n_k__ << " smallest eigenvalue of A^T*A: " │ │ │ │ │ -920 << lambda_min << std::endl; │ │ │ │ │ -921 std::cout << _b_l_a_n_k__ << " => largest singular value of A: " │ │ │ │ │ -922 << sigma_max << std::endl; │ │ │ │ │ -923 std::cout << _b_l_a_n_k__ << " => smallest singular value of A: " │ │ │ │ │ -924 << sigma_min << std::endl; │ │ │ │ │ -925 } │ │ │ │ │ -926 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -927 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -928 << "║residual║_2 = {" << r_max_norm << "," │ │ │ │ │ -929 << r_min_norm << "}, " << "σ = {" │ │ │ │ │ -930 << sigma_max << "," << sigma_min │ │ │ │ │ -931 << "}): cond_2 = " << cond_2 << std::endl; │ │ │ │ │ -932 } │ │ │ │ │ -933 │ │ │ │ │ -934 // free dynamically allocated memory │ │ │ │ │ -935 delete[] AtAx_min_raw; │ │ │ │ │ -936 delete[] AtAx_max_raw; │ │ │ │ │ -937 delete[] ev; │ │ │ │ │ -938 } │ │ │ │ │ +_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_4 inline unsigned int _g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t () const │ │ │ │ │ -945 { │ │ │ │ │ -946 if (_n_I_t_e_r_a_t_i_o_n_s__ == 0) │ │ │ │ │ -947 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"No algorithm applied, yet."); │ │ │ │ │ -948 │ │ │ │ │ -949 return _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ -950 } │ │ │ │ │ -951 │ │ │ │ │ -952 protected: │ │ │ │ │ -953 // parameters related to iterative eigenvalue algorithms │ │ │ │ │ -_9_5_4 const _B_C_R_S_M_a_t_r_i_x& _m__; │ │ │ │ │ -_9_5_5 const unsigned int _n_I_t_e_r_a_t_i_o_n_s_M_a_x__; │ │ │ │ │ -956 │ │ │ │ │ -957 // verbosity setting │ │ │ │ │ -_9_5_8 const unsigned int _v_e_r_b_o_s_i_t_y___l_e_v_e_l__; │ │ │ │ │ +_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 // memory for storing temporary variables (mutable as they shall │ │ │ │ │ -961 // just be effectless auxiliary variables of the const apply*(...) │ │ │ │ │ -962 // methods) │ │ │ │ │ -_9_6_3 mutable unsigned int _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ -964 │ │ │ │ │ -965 // constants for printing verbosity information │ │ │ │ │ -_9_6_6 const std::string _t_i_t_l_e__; │ │ │ │ │ -_9_6_7 const std::string _b_l_a_n_k__; │ │ │ │ │ -968 }; │ │ │ │ │ -969 │ │ │ │ │ -972} // namespace Dune │ │ │ │ │ -973 │ │ │ │ │ -974#endif // HAVE_ARPACKPP │ │ │ │ │ -975 │ │ │ │ │ -976#endif // DUNE_ISTL_EIGENVALUE_ARPACKPP_HH │ │ │ │ │ -_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. │ │ │ │ │ -_i_o_._h_h │ │ │ │ │ -Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ +960 private: │ │ │ │ │ +961 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(const VertexPropertiesGraph&) │ │ │ │ │ +962 {} │ │ │ │ │ +963 │ │ │ │ │ +965 _G_r_a_p_h& graph_; │ │ │ │ │ +967 _V_e_r_t_e_x_M_a_p vmap_; │ │ │ │ │ +_9_6_9 std::vector vertexProperties_; │ │ │ │ │ +970 │ │ │ │ │ +971 }; │ │ │ │ │ +972 │ │ │ │ │ +976 template │ │ │ │ │ +_9_7_7 class _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +978 { │ │ │ │ │ +979 public: │ │ │ │ │ +_9_8_3 typedef G _G_r_a_p_h; │ │ │ │ │ +984 │ │ │ │ │ +_9_8_8 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +989 │ │ │ │ │ +_9_9_3 typedef typename Graph::EdgeDescriptor _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ │ +994 │ │ │ │ │ +_9_9_8 typedef VP _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ │ +999 │ │ │ │ │ +_1_0_1_1 typedef VM _V_e_r_t_e_x_M_a_p; │ │ │ │ │ +1012 │ │ │ │ │ +_1_0_1_6 typedef EP _E_d_g_e_P_r_o_p_e_r_t_i_e_s; │ │ │ │ │ +1017 │ │ │ │ │ +1018 │ │ │ │ │ +_1_0_3_0 typedef EM _E_d_g_e_M_a_p; │ │ │ │ │ +1031 │ │ │ │ │ +1032 template │ │ │ │ │ +_1_0_3_3 class _E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +1034 : public std::conditional:: │ │ │ │ │ +type, │ │ │ │ │ +1035 C>::value, │ │ │ │ │ +1036 typename Graph::EdgeIterator, │ │ │ │ │ +1037 typename Graph::ConstEdgeIterator>::type │ │ │ │ │ +1038 { │ │ │ │ │ +1039 │ │ │ │ │ +1040 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ │ +1041 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ │ +1042 public: │ │ │ │ │ +1046 typedef typename std::conditional::type, │ │ │ │ │ +1047 C>::value, │ │ │ │ │ +1048 typename Graph::EdgeIterator, │ │ │ │ │ +1049 typename Graph::ConstEdgeIterator>::type │ │ │ │ │ +_1_0_5_0 _F_a_t_h_e_r; │ │ │ │ │ +1051 │ │ │ │ │ +_1_0_5_7 explicit _E_d_g_e_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ │ +1058 C* graph); │ │ │ │ │ +1059 │ │ │ │ │ +_1_0_6_7 explicit _E_d_g_e_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ │ +1068 │ │ │ │ │ +1073 template │ │ │ │ │ +_1_0_7_4 _E_d_g_e_I_t_e_r_a_t_o_r_T(const EdgeIteratorT& other); │ │ │ │ │ +1075 │ │ │ │ │ +1079 typename std::conditional:: │ │ │ │ │ +type>::value, │ │ │ │ │ +1080 EdgeProperties&, │ │ │ │ │ +1081 const EdgeProperties&>::type │ │ │ │ │ +_1_0_8_2 properties() const; │ │ │ │ │ +1083 │ │ │ │ │ +1084 private: │ │ │ │ │ +_1_0_8_8 C* graph_; │ │ │ │ │ +1089 }; │ │ │ │ │ +1090 │ │ │ │ │ +1094 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T > _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +1097 │ │ │ │ │ +1101 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ │ +1104 │ │ │ │ │ +_1_1_1_0 _E_d_g_e_I_t_e_r_a_t_o_r beginEdges(const VertexDescriptor& source); │ │ │ │ │ +1111 │ │ │ │ │ +_1_1_1_7 _E_d_g_e_I_t_e_r_a_t_o_r endEdges(const VertexDescriptor& source); │ │ │ │ │ +1118 │ │ │ │ │ +_1_1_2_4 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r beginEdges(const VertexDescriptor& source) const; │ │ │ │ │ +1125 │ │ │ │ │ +_1_1_3_1 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r endEdges(const VertexDescriptor& source) const; │ │ │ │ │ +1132 │ │ │ │ │ +1133 │ │ │ │ │ +1134 template │ │ │ │ │ +_1_1_3_5 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +1136 : public std::conditional:: │ │ │ │ │ +type, │ │ │ │ │ +1137 C>::value, │ │ │ │ │ +1138 typename Graph::VertexIterator, │ │ │ │ │ +1139 typename Graph::ConstVertexIterator>::type │ │ │ │ │ +1140 { │ │ │ │ │ +1141 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ │ +1142 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ │ +1143 public: │ │ │ │ │ +1147 typedef typename std::conditional::type, │ │ │ │ │ +1148 C>::value, │ │ │ │ │ +1149 typename Graph::VertexIterator, │ │ │ │ │ +1150 typename Graph::ConstVertexIterator>::type │ │ │ │ │ +_1_1_5_1 _F_a_t_h_e_r; │ │ │ │ │ +1152 │ │ │ │ │ +_1_1_5_8 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ │ +1159 C* graph); │ │ │ │ │ +1160 │ │ │ │ │ +1161 │ │ │ │ │ +_1_1_6_9 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ │ +1170 │ │ │ │ │ +1175 template │ │ │ │ │ +_1_1_7_6 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const VertexIteratorT& other); │ │ │ │ │ +1177 │ │ │ │ │ +1181 typename std::conditional:: │ │ │ │ │ +type>::value, │ │ │ │ │ +1182 VertexProperties&, │ │ │ │ │ +1183 const VertexProperties&>::type │ │ │ │ │ +_1_1_8_4 properties() const; │ │ │ │ │ +1185 │ │ │ │ │ +_1_1_9_1 _E_d_g_e_I_t_e_r_a_t_o_r_T begin() const; │ │ │ │ │ +1192 │ │ │ │ │ +_1_1_9_8 _E_d_g_e_I_t_e_r_a_t_o_r_T end() const; │ │ │ │ │ +1199 │ │ │ │ │ +1200 private: │ │ │ │ │ +1204 C* graph_; │ │ │ │ │ +1205 }; │ │ │ │ │ +1206 │ │ │ │ │ +1210 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ │ +1213 │ │ │ │ │ +1217 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ │ +1220 │ │ │ │ │ +_1_2_2_5 _V_e_r_t_e_x_I_t_e_r_a_t_o_r begin(); │ │ │ │ │ +1226 │ │ │ │ │ +_1_2_3_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r end(); │ │ │ │ │ +1232 │ │ │ │ │ +_1_2_3_7 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r begin() const; │ │ │ │ │ +1238 │ │ │ │ │ +_1_2_4_3 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r end() const; │ │ │ │ │ +1244 │ │ │ │ │ +_1_2_5_0 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& getVertexProperties(const VertexDescriptor& vertex); │ │ │ │ │ +1251 │ │ │ │ │ +_1_2_5_7 const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& getVertexProperties(const VertexDescriptor& │ │ │ │ │ +vertex) const; │ │ │ │ │ +1258 │ │ │ │ │ +_1_2_6_5 _E_d_g_e_D_e_s_c_r_i_p_t_o_r findEdge(const VertexDescriptor& source, │ │ │ │ │ +1266 const VertexDescriptor& target) │ │ │ │ │ +1267 { │ │ │ │ │ +1268 return graph_.findEdge(source,target); │ │ │ │ │ +1269 } │ │ │ │ │ +1270 │ │ │ │ │ +_1_2_7_6 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ │ +1277 │ │ │ │ │ +1278 │ │ │ │ │ +_1_2_8_4 const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge) const; │ │ │ │ │ +1285 │ │ │ │ │ +_1_2_9_2 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ │ +1293 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target); │ │ │ │ │ +1294 │ │ │ │ │ +_1_3_0_1 const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ │ +1302 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ │ +1303 │ │ │ │ │ +_1_3_0_8 const _G_r_a_p_h& _g_r_a_p_h() const; │ │ │ │ │ +1309 │ │ │ │ │ +_1_3_1_3 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ │ +1314 │ │ │ │ │ +_1_3_1_8 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ │ +1319 │ │ │ │ │ +_1_3_2_6 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ │ +1327 │ │ │ │ │ +_1_3_3_4 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(_G_r_a_p_h& graph, const _V_e_r_t_e_x_M_a_p& vmap=_V_e_r_t_e_x_M_a_p(), │ │ │ │ │ +1335 const _E_d_g_e_M_a_p& emap=_E_d_g_e_M_a_p()); │ │ │ │ │ +1336 │ │ │ │ │ +1337 private: │ │ │ │ │ +1338 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(const _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h&) │ │ │ │ │ +1339 {} │ │ │ │ │ +1340 │ │ │ │ │ +1342 Graph& graph_; │ │ │ │ │ +1345 VertexMap vmap_; │ │ │ │ │ +1346 std::vector vertexProperties_; │ │ │ │ │ +1348 EdgeMap emap_; │ │ │ │ │ +_1_3_5_0 std::vector edgeProperties_; │ │ │ │ │ +1351 │ │ │ │ │ +1352 }; │ │ │ │ │ +1353 │ │ │ │ │ +1354 │ │ │ │ │ +1359 template │ │ │ │ │ +_1_3_6_0 class _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +1361 { │ │ │ │ │ +1362 public: │ │ │ │ │ +_1_3_6_6 typedef G _G_r_a_p_h; │ │ │ │ │ +_1_3_7_0 typedef typename G::VertexProperties _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ │ +_1_3_7_4 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ │ +1375 │ │ │ │ │ +_1_3_8_0 _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r(G& g) │ │ │ │ │ +1381 : graph_(g) │ │ │ │ │ +1382 {} │ │ │ │ │ +_1_3_8_6 _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r() │ │ │ │ │ +1387 : graph_(0) │ │ │ │ │ +1388 {} │ │ │ │ │ +1389 │ │ │ │ │ +1390 │ │ │ │ │ +_1_3_9_5 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x& vertex) const │ │ │ │ │ +1396 { │ │ │ │ │ +1397 return graph_->getVertexProperties(vertex); │ │ │ │ │ +1398 } │ │ │ │ │ +1399 private: │ │ │ │ │ +1400 Graph* graph_; │ │ │ │ │ +1401 }; │ │ │ │ │ +1402 │ │ │ │ │ +1407 template │ │ │ │ │ +_1_4_0_8 class _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +1409 { │ │ │ │ │ +1410 public: │ │ │ │ │ +_1_4_1_4 typedef G _G_r_a_p_h; │ │ │ │ │ +_1_4_1_8 typedef typename G::EdgeProperties _E_d_g_e_P_r_o_p_e_r_t_i_e_s; │ │ │ │ │ +_1_4_2_2 typedef typename G::EdgeDescriptor _E_d_g_e; │ │ │ │ │ +1423 │ │ │ │ │ +_1_4_2_8 _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r(G& g) │ │ │ │ │ +1429 : graph_(g) │ │ │ │ │ +1430 {} │ │ │ │ │ +_1_4_3_4 _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r() │ │ │ │ │ +1435 : graph_(0) │ │ │ │ │ +1436 {} │ │ │ │ │ +1437 │ │ │ │ │ +_1_4_4_2 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _o_p_e_r_a_t_o_r_[_](const _E_d_g_e& edge) const │ │ │ │ │ +1443 { │ │ │ │ │ +1444 return graph_->getEdgeProperties(edge); │ │ │ │ │ +1445 } │ │ │ │ │ +1446 private: │ │ │ │ │ +1447 Graph* graph_; │ │ │ │ │ +1448 }; │ │ │ │ │ +1449 │ │ │ │ │ +1450 │ │ │ │ │ +1461 template │ │ │ │ │ +_1_4_6_2 int _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(const G& graph, const typename G::VertexDescriptor& │ │ │ │ │ +vertex, │ │ │ │ │ +1463 V& visitor); │ │ │ │ │ +1464 │ │ │ │ │ +1465#ifndef DOXYGEN │ │ │ │ │ +1466 │ │ │ │ │ +1467 template │ │ │ │ │ +1468 _M_a_t_r_i_x_G_r_a_p_h_<_M_>_:_:_M_a_t_r_i_x_G_r_a_p_h(M& matrix) │ │ │ │ │ +1469 : matrix_(matrix) │ │ │ │ │ +1470 { │ │ │ │ │ +1471 if(matrix_.N()!=matrix_.M()) │ │ │ │ │ +1472 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Matrix has to have as many columns as rows!"); │ │ │ │ │ +1473 │ │ │ │ │ +1474 start_ = new EdgeDescriptor[matrix_.N()+1]; │ │ │ │ │ +1475 │ │ │ │ │ +1476 typedef typename M::ConstIterator Iterator; │ │ │ │ │ +1477 start_[matrix_.begin().index()] = 0; │ │ │ │ │ +1478 │ │ │ │ │ +1479 for(Iterator row=matrix_.begin(); row != matrix_.end(); ++row) │ │ │ │ │ +1480 start_[row.index()+1] = start_[row.index()] + row->size(); │ │ │ │ │ +1481 } │ │ │ │ │ +1482 │ │ │ │ │ +1483 template │ │ │ │ │ +1484 MatrixGraph::~MatrixGraph() │ │ │ │ │ +1485 { │ │ │ │ │ +1486 delete[] start_; │ │ │ │ │ +1487 } │ │ │ │ │ +1488 │ │ │ │ │ +1489 template │ │ │ │ │ +1490 inline std::size_t MatrixGraph::noEdges() const │ │ │ │ │ +1491 { │ │ │ │ │ +1492 return start_[matrix_.N()]; │ │ │ │ │ +1493 } │ │ │ │ │ +1494 │ │ │ │ │ +1495 template │ │ │ │ │ +1496 inline std::size_t MatrixGraph::noVertices() const │ │ │ │ │ +1497 { │ │ │ │ │ +1498 return matrix_.N(); │ │ │ │ │ +1499 } │ │ │ │ │ +1500 │ │ │ │ │ +1501 template │ │ │ │ │ +1502 inline typename MatrixGraph::VertexDescriptor MatrixGraph::maxVertex │ │ │ │ │ +() const │ │ │ │ │ +1503 { │ │ │ │ │ +1504 return matrix_.N()-1; │ │ │ │ │ +1505 } │ │ │ │ │ +1506 │ │ │ │ │ +1507 template │ │ │ │ │ +1508 typename MatrixGraph::EdgeDescriptor │ │ │ │ │ +1509 MatrixGraph::findEdge(const VertexDescriptor& source, │ │ │ │ │ +1510 const VertexDescriptor& target) const │ │ │ │ │ +1511 { │ │ │ │ │ +1512 typename M::ConstColIterator found =matrix_[source].find(target); │ │ │ │ │ +1513 if(found == matrix_[source].end()) │ │ │ │ │ +1514 return std::numeric_limits::max(); │ │ │ │ │ +1515 std::size_t offset = found.offset(); │ │ │ │ │ +1516 if(target>source) │ │ │ │ │ +1517 offset--; │ │ │ │ │ +1518 │ │ │ │ │ +1519 assert(offset │ │ │ │ │ +1526 inline M& MatrixGraph::matrix() │ │ │ │ │ +1527 { │ │ │ │ │ +1528 return matrix_; │ │ │ │ │ +1529 } │ │ │ │ │ +1530 │ │ │ │ │ +1531 template │ │ │ │ │ +1532 inline const M& MatrixGraph::matrix() const │ │ │ │ │ +1533 { │ │ │ │ │ +1534 return matrix_; │ │ │ │ │ +1535 } │ │ │ │ │ +1536 │ │ │ │ │ +1537 template │ │ │ │ │ +1538 template │ │ │ │ │ +1539 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const VertexDescriptor& │ │ │ │ │ +source, const ColIterator& block, │ │ │ │ │ +1540 const ColIterator& end, const EdgeDescriptor& edge) │ │ │ │ │ +1541 : source_(source), block_(block), blockEnd_(end), edge_(edge) │ │ │ │ │ +1542 { │ │ │ │ │ +1543 if(block_!=blockEnd_ && block_.index() == source_) { │ │ │ │ │ +1544 // This is the edge from the diagonal to the diagonal. Skip it. │ │ │ │ │ +1545 ++block_; │ │ │ │ │ +1546 } │ │ │ │ │ +1547 } │ │ │ │ │ +1548 │ │ │ │ │ +1549 template │ │ │ │ │ +1550 template │ │ │ │ │ +1551 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const ColIterator& block) │ │ │ │ │ +1552 : block_(block) │ │ │ │ │ +1553 {} │ │ │ │ │ +1554 │ │ │ │ │ +1555 template │ │ │ │ │ +1556 template │ │ │ │ │ +1557 template │ │ │ │ │ +1558 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const EdgeIteratorT& │ │ │ │ │ +other) │ │ │ │ │ +1559 : source_(other.source_), block_(other.block_), blockEnd_ │ │ │ │ │ +(other.blockEnd_), edge_(other.edge_) │ │ │ │ │ +1560 {} │ │ │ │ │ +1561 │ │ │ │ │ +1562 │ │ │ │ │ +1563 template │ │ │ │ │ +1564 template │ │ │ │ │ +1565 inline typename MatrixGraph::template EdgeIteratorT::WeightType& │ │ │ │ │ +1566 MatrixGraph::EdgeIteratorT::weight() const │ │ │ │ │ +1567 { │ │ │ │ │ +1568 return *block_; │ │ │ │ │ +1569 } │ │ │ │ │ +1570 │ │ │ │ │ +1571 template │ │ │ │ │ +1572 template │ │ │ │ │ +1573 inline typename MatrixGraph::template EdgeIteratorT& │ │ │ │ │ +MatrixGraph::EdgeIteratorT::operator++() │ │ │ │ │ +1574 { │ │ │ │ │ +1575 ++block_; │ │ │ │ │ +1576 ++edge_; │ │ │ │ │ +1577 │ │ │ │ │ +1578 if(block_!=blockEnd_ && block_.index() == source_) { │ │ │ │ │ +1579 // This is the edge from the diagonal to the diagonal. Skip it. │ │ │ │ │ +1580 ++block_; │ │ │ │ │ +1581 } │ │ │ │ │ +1582 │ │ │ │ │ +1583 return *this; │ │ │ │ │ +1584 } │ │ │ │ │ +1585 │ │ │ │ │ +1586 template │ │ │ │ │ +1587 template │ │ │ │ │ +1588 inline bool MatrixGraph::EdgeIteratorT::operator!=(const typename │ │ │ │ │ +MatrixGraph::template EdgeIteratorT::type>& │ │ │ │ │ +other) const │ │ │ │ │ +1589 { │ │ │ │ │ +1590 return block_!=other.block_; │ │ │ │ │ +1591 } │ │ │ │ │ +1592 │ │ │ │ │ +1593 template │ │ │ │ │ +1594 template │ │ │ │ │ +1595 inline bool MatrixGraph::EdgeIteratorT::operator!=(const typename │ │ │ │ │ +MatrixGraph::template EdgeIteratorT:: │ │ │ │ │ +type>& other) const │ │ │ │ │ +1596 { │ │ │ │ │ +1597 return block_!=other.block_; │ │ │ │ │ +1598 } │ │ │ │ │ +1599 │ │ │ │ │ +1600 template │ │ │ │ │ +1601 template │ │ │ │ │ +1602 inline bool MatrixGraph::EdgeIteratorT::operator==(const typename │ │ │ │ │ +MatrixGraph::template EdgeIteratorT::type>& │ │ │ │ │ +other) const │ │ │ │ │ +1603 { │ │ │ │ │ +1604 return block_==other.block_; │ │ │ │ │ +1605 } │ │ │ │ │ +1606 │ │ │ │ │ +1607 template │ │ │ │ │ +1608 template │ │ │ │ │ +1609 inline bool MatrixGraph::EdgeIteratorT::operator==(const typename │ │ │ │ │ +MatrixGraph::template EdgeIteratorT:: │ │ │ │ │ +type>& other) const │ │ │ │ │ +1610 { │ │ │ │ │ +1611 return block_==other.block_; │ │ │ │ │ +1612 } │ │ │ │ │ +1613 │ │ │ │ │ +1614 template │ │ │ │ │ +1615 template │ │ │ │ │ +1616 inline typename MatrixGraph::VertexDescriptor MatrixGraph:: │ │ │ │ │ +EdgeIteratorT::target() const │ │ │ │ │ +1617 { │ │ │ │ │ +1618 return block_.index(); │ │ │ │ │ +1619 } │ │ │ │ │ +1620 │ │ │ │ │ +1621 template │ │ │ │ │ +1622 template │ │ │ │ │ +1623 inline typename MatrixGraph::VertexDescriptor MatrixGraph:: │ │ │ │ │ +EdgeIteratorT::source() const │ │ │ │ │ +1624 { │ │ │ │ │ +1625 return source_; │ │ │ │ │ +1626 } │ │ │ │ │ +1627 │ │ │ │ │ +1628 template │ │ │ │ │ +1629 template │ │ │ │ │ +1630 inline const typename MatrixGraph::EdgeDescriptor& MatrixGraph:: │ │ │ │ │ +EdgeIteratorT::operator*() const │ │ │ │ │ +1631 { │ │ │ │ │ +1632 return edge_; │ │ │ │ │ +1633 } │ │ │ │ │ +1634 │ │ │ │ │ +1635 template │ │ │ │ │ +1636 template │ │ │ │ │ +1637 inline const typename MatrixGraph::EdgeDescriptor* MatrixGraph:: │ │ │ │ │ +EdgeIteratorT::operator->() const │ │ │ │ │ +1638 { │ │ │ │ │ +1639 return &edge_; │ │ │ │ │ +1640 } │ │ │ │ │ +1641 │ │ │ │ │ +1642 template │ │ │ │ │ +1643 template │ │ │ │ │ +1644 MatrixGraph::VertexIteratorT::VertexIteratorT(C* graph, │ │ │ │ │ +1645 const VertexDescriptor& current) │ │ │ │ │ +1646 : graph_(graph), current_(current) │ │ │ │ │ +1647 {} │ │ │ │ │ +1648 │ │ │ │ │ +1649 │ │ │ │ │ +1650 template │ │ │ │ │ +1651 template │ │ │ │ │ +1652 MatrixGraph::VertexIteratorT::VertexIteratorT(const │ │ │ │ │ +VertexDescriptor& current) │ │ │ │ │ +1653 : current_(current) │ │ │ │ │ +1654 {} │ │ │ │ │ +1655 │ │ │ │ │ +1656 template │ │ │ │ │ +1657 template │ │ │ │ │ +1658 MatrixGraph::VertexIteratorT::VertexIteratorT(const │ │ │ │ │ +VertexIteratorT& other) │ │ │ │ │ +1659 : graph_(other.graph_), current_(other.current_) │ │ │ │ │ +1660 {} │ │ │ │ │ +1661 │ │ │ │ │ +1662 template │ │ │ │ │ +1663 template │ │ │ │ │ +1664 inline bool MatrixGraph::VertexIteratorT::operator!=(const │ │ │ │ │ +VertexIteratorT& other) const │ │ │ │ │ +1665 { │ │ │ │ │ +1666 return current_ != other.current_; │ │ │ │ │ +1667 } │ │ │ │ │ +1668 │ │ │ │ │ +1669 template │ │ │ │ │ +1670 template │ │ │ │ │ +1671 inline bool MatrixGraph::VertexIteratorT::operator!=(const │ │ │ │ │ +VertexIteratorT& other) const │ │ │ │ │ +1672 { │ │ │ │ │ +1673 return current_ != other.current_; │ │ │ │ │ +1674 } │ │ │ │ │ +1675 │ │ │ │ │ +1676 │ │ │ │ │ +1677 template │ │ │ │ │ +1678 template │ │ │ │ │ +1679 inline bool MatrixGraph::VertexIteratorT::operator==(const │ │ │ │ │ +VertexIteratorT& other) const │ │ │ │ │ +1680 { │ │ │ │ │ +1681 return current_ == other.current_; │ │ │ │ │ +1682 } │ │ │ │ │ +1683 │ │ │ │ │ +1684 template │ │ │ │ │ +1685 template │ │ │ │ │ +1686 inline bool MatrixGraph::VertexIteratorT::operator==(const │ │ │ │ │ +VertexIteratorT& other) const │ │ │ │ │ +1687 { │ │ │ │ │ +1688 return current_ == other.current_; │ │ │ │ │ +1689 } │ │ │ │ │ +1690 │ │ │ │ │ +1691 template │ │ │ │ │ +1692 template │ │ │ │ │ +1693 inline typename MatrixGraph::template VertexIteratorT& │ │ │ │ │ +MatrixGraph::VertexIteratorT::operator++() │ │ │ │ │ +1694 { │ │ │ │ │ +1695 ++current_; │ │ │ │ │ +1696 return *this; │ │ │ │ │ +1697 } │ │ │ │ │ +1698 │ │ │ │ │ +1699 template │ │ │ │ │ +1700 template │ │ │ │ │ +1701 inline typename MatrixGraph::template VertexIteratorT::WeightType& │ │ │ │ │ +1702 MatrixGraph::VertexIteratorT::weight() const │ │ │ │ │ +1703 { │ │ │ │ │ +1704 return graph_->matrix()[current_][current_]; │ │ │ │ │ +1705 } │ │ │ │ │ +1706 │ │ │ │ │ +1707 template │ │ │ │ │ +1708 template │ │ │ │ │ +1709 inline const typename MatrixGraph::VertexDescriptor& │ │ │ │ │ +1710 MatrixGraph::VertexIteratorT::operator*() const │ │ │ │ │ +1711 { │ │ │ │ │ +1712 return current_; │ │ │ │ │ +1713 } │ │ │ │ │ +1714 │ │ │ │ │ +1715 template │ │ │ │ │ +1716 template │ │ │ │ │ +1717 inline typename MatrixGraph::template EdgeIteratorT │ │ │ │ │ +1718 MatrixGraph::VertexIteratorT::begin() const │ │ │ │ │ +1719 { │ │ │ │ │ +1720 return graph_->beginEdges(current_); │ │ │ │ │ +1721 } │ │ │ │ │ +1722 │ │ │ │ │ +1723 template │ │ │ │ │ +1724 template │ │ │ │ │ +1725 inline typename MatrixGraph::template EdgeIteratorT │ │ │ │ │ +1726 MatrixGraph::VertexIteratorT::end() const │ │ │ │ │ +1727 { │ │ │ │ │ +1728 return graph_->endEdges(current_); │ │ │ │ │ +1729 } │ │ │ │ │ +1730 │ │ │ │ │ +1731 template │ │ │ │ │ +1732 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ │ +1733 MatrixGraph::begin() │ │ │ │ │ +1734 { │ │ │ │ │ +1735 return VertexIterator(this,0); │ │ │ │ │ +1736 } │ │ │ │ │ +1737 │ │ │ │ │ +1738 template │ │ │ │ │ +1739 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ │ +1740 MatrixGraph::end() │ │ │ │ │ +1741 { │ │ │ │ │ +1742 return VertexIterator(matrix_.N()); │ │ │ │ │ +1743 } │ │ │ │ │ +1744 │ │ │ │ │ +1745 │ │ │ │ │ +1746 template │ │ │ │ │ +1747 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ │ +1748 MatrixGraph::begin() const │ │ │ │ │ +1749 { │ │ │ │ │ +1750 return ConstVertexIterator(this, 0); │ │ │ │ │ +1751 } │ │ │ │ │ +1752 │ │ │ │ │ +1753 template │ │ │ │ │ +1754 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ │ +1755 MatrixGraph::end() const │ │ │ │ │ +1756 { │ │ │ │ │ +1757 return ConstVertexIterator(matrix_.N()); │ │ │ │ │ +1758 } │ │ │ │ │ +1759 │ │ │ │ │ +1760 template │ │ │ │ │ +1761 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ │ +1762 MatrixGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ │ +1763 { │ │ │ │ │ +1764 return EdgeIterator(source, matrix_.operator[](source).begin(), │ │ │ │ │ +1765 matrix_.operator[](source).end(), start_[source]); │ │ │ │ │ +1766 } │ │ │ │ │ +1767 │ │ │ │ │ +1768 template │ │ │ │ │ +1769 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ │ +1770 MatrixGraph::endEdges(const VertexDescriptor& source) │ │ │ │ │ +1771 { │ │ │ │ │ +1772 return EdgeIterator(matrix_.operator[](source).end()); │ │ │ │ │ +1773 } │ │ │ │ │ +1774 │ │ │ │ │ +1775 │ │ │ │ │ +1776 template │ │ │ │ │ +1777 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ │ +1778 MatrixGraph::beginEdges(const VertexDescriptor& source) const │ │ │ │ │ +1779 { │ │ │ │ │ +1780 return ConstEdgeIterator(source, matrix_.operator[](source).begin(), │ │ │ │ │ +1781 matrix_.operator[](source).end(), start_[source]); │ │ │ │ │ +1782 } │ │ │ │ │ +1783 │ │ │ │ │ +1784 template │ │ │ │ │ +1785 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ │ +1786 MatrixGraph::endEdges(const VertexDescriptor& source) const │ │ │ │ │ +1787 { │ │ │ │ │ +1788 return ConstEdgeIterator(matrix_.operator[](source).end()); │ │ │ │ │ +1789 } │ │ │ │ │ +1790 │ │ │ │ │ +1791 │ │ │ │ │ +1792 template │ │ │ │ │ +1793 SubGraph::EdgeIterator::EdgeIterator(const VertexDescriptor& source, │ │ │ │ │ +1794 const EdgeDescriptor& edge) │ │ │ │ │ +1795 : source_(source), edge_(edge) │ │ │ │ │ +1796 {} │ │ │ │ │ +1797 │ │ │ │ │ +1798 │ │ │ │ │ +1799 template │ │ │ │ │ +1800 SubGraph::EdgeIterator::EdgeIterator(const EdgeDescriptor& edge) │ │ │ │ │ +1801 : edge_(edge) │ │ │ │ │ +1802 {} │ │ │ │ │ +1803 │ │ │ │ │ +1804 template │ │ │ │ │ +1805 typename SubGraph::EdgeIndexMap SubGraph::getEdgeIndexMap() │ │ │ │ │ +1806 { │ │ │ │ │ +1807 return EdgeIndexMap(edges_); │ │ │ │ │ +1808 } │ │ │ │ │ +1809 │ │ │ │ │ +1810 template │ │ │ │ │ +1811 inline bool SubGraph::EdgeIterator::equals(const EdgeIterator & │ │ │ │ │ +other) const │ │ │ │ │ +1812 { │ │ │ │ │ +1813 return other.edge_==edge_; │ │ │ │ │ +1814 } │ │ │ │ │ +1815 │ │ │ │ │ +1816 template │ │ │ │ │ +1817 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ │ +increment() │ │ │ │ │ +1818 { │ │ │ │ │ +1819 ++edge_; │ │ │ │ │ +1820 return *this; │ │ │ │ │ +1821 } │ │ │ │ │ +1822 │ │ │ │ │ +1823 template │ │ │ │ │ +1824 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ │ +decrement() │ │ │ │ │ +1825 { │ │ │ │ │ +1826 --edge_; │ │ │ │ │ +1827 return *this; │ │ │ │ │ +1828 } │ │ │ │ │ +1829 │ │ │ │ │ +1830 template │ │ │ │ │ +1831 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ │ +advance(std::ptrdiff_t n) │ │ │ │ │ +1832 { │ │ │ │ │ +1833 edge_+=n; │ │ │ │ │ +1834 return *this; │ │ │ │ │ +1835 } │ │ │ │ │ +1836 template │ │ │ │ │ +1837 inline const typename G::VertexDescriptor& SubGraph::EdgeIterator:: │ │ │ │ │ +source() const │ │ │ │ │ +1838 { │ │ │ │ │ +1839 return source_; │ │ │ │ │ +1840 } │ │ │ │ │ +1841 │ │ │ │ │ +1842 template │ │ │ │ │ +1843 inline const typename G::VertexDescriptor& SubGraph::EdgeIterator:: │ │ │ │ │ +target() const │ │ │ │ │ +1844 { │ │ │ │ │ +1845 return *edge_; │ │ │ │ │ +1846 } │ │ │ │ │ +1847 │ │ │ │ │ +1848 │ │ │ │ │ +1849 template │ │ │ │ │ +1850 inline const typename SubGraph::EdgeDescriptor& SubGraph:: │ │ │ │ │ +EdgeIterator::dereference() const │ │ │ │ │ +1851 { │ │ │ │ │ +1852 return edge_; │ │ │ │ │ +1853 } │ │ │ │ │ +1854 │ │ │ │ │ +1855 template │ │ │ │ │ +1856 inline std::ptrdiff_t SubGraph::EdgeIterator::distanceTo(const │ │ │ │ │ +EdgeIterator & other) const │ │ │ │ │ +1857 { │ │ │ │ │ +1858 return other.edge_-edge_; │ │ │ │ │ +1859 } │ │ │ │ │ +1860 │ │ │ │ │ +1861 template │ │ │ │ │ +1862 SubGraph::VertexIterator::VertexIterator(const SubGraph* graph, │ │ │ │ │ +1863 const VertexDescriptor& current, │ │ │ │ │ +1864 const VertexDescriptor& end) │ │ │ │ │ +1865 : graph_(graph), current_(current), end_(end) │ │ │ │ │ +1866 { │ │ │ │ │ +1867 // Skip excluded vertices │ │ │ │ │ +1868 typedef typename T::const_iterator Iterator; │ │ │ │ │ +1869 │ │ │ │ │ +1870 for(Iterator vertex = graph_->excluded_.begin(); │ │ │ │ │ +1871 current_ != end_ && *vertex; │ │ │ │ │ +1872 ++vertex) │ │ │ │ │ +1873 ++current_; │ │ │ │ │ +1874 assert(current_ == end_ || !graph_->excluded_[current_]); │ │ │ │ │ +1875 } │ │ │ │ │ +1876 │ │ │ │ │ +1877 template │ │ │ │ │ +1878 SubGraph::VertexIterator::VertexIterator(const VertexDescriptor& │ │ │ │ │ +current) │ │ │ │ │ +1879 : current_(current) │ │ │ │ │ +1880 {} │ │ │ │ │ +1881 │ │ │ │ │ +1882 template │ │ │ │ │ +1883 inline typename SubGraph::VertexIterator& SubGraph:: │ │ │ │ │ +VertexIterator::increment() │ │ │ │ │ +1884 { │ │ │ │ │ +1885 ++current_; │ │ │ │ │ +1886 //Skip excluded vertices │ │ │ │ │ +1887 while(current_ != end_ && graph_->excluded_[current_]) │ │ │ │ │ +1888 ++current_; │ │ │ │ │ +1889 │ │ │ │ │ +1890 assert(current_ == end_ || !graph_->excluded_[current_]); │ │ │ │ │ +1891 return *this; │ │ │ │ │ +1892 } │ │ │ │ │ +1893 │ │ │ │ │ +1894 template │ │ │ │ │ +1895 inline bool SubGraph::VertexIterator::equals(const VertexIterator & │ │ │ │ │ +other) const │ │ │ │ │ +1896 { │ │ │ │ │ +1897 return current_==other.current_; │ │ │ │ │ +1898 } │ │ │ │ │ +1899 │ │ │ │ │ +1900 template │ │ │ │ │ +1901 inline const typename G::VertexDescriptor& SubGraph::VertexIterator:: │ │ │ │ │ +dereference() const │ │ │ │ │ +1902 { │ │ │ │ │ +1903 return current_; │ │ │ │ │ +1904 } │ │ │ │ │ +1905 │ │ │ │ │ +1906 template │ │ │ │ │ +1907 inline typename SubGraph::EdgeIterator SubGraph:: │ │ │ │ │ +VertexIterator::begin() const │ │ │ │ │ +1908 { │ │ │ │ │ +1909 return graph_->beginEdges(current_); │ │ │ │ │ +1910 } │ │ │ │ │ +1911 │ │ │ │ │ +1912 template │ │ │ │ │ +1913 inline typename SubGraph::EdgeIterator SubGraph:: │ │ │ │ │ +VertexIterator::end() const │ │ │ │ │ +1914 { │ │ │ │ │ +1915 return graph_->endEdges(current_); │ │ │ │ │ +1916 } │ │ │ │ │ +1917 │ │ │ │ │ +1918 template │ │ │ │ │ +1919 inline typename SubGraph::VertexIterator SubGraph::begin() const │ │ │ │ │ +1920 { │ │ │ │ │ +1921 return VertexIterator(this, 0, endVertex_); │ │ │ │ │ +1922 } │ │ │ │ │ +1923 │ │ │ │ │ +1924 │ │ │ │ │ +1925 template │ │ │ │ │ +1926 inline typename SubGraph::VertexIterator SubGraph::end() const │ │ │ │ │ +1927 { │ │ │ │ │ +1928 return VertexIterator(endVertex_); │ │ │ │ │ +1929 } │ │ │ │ │ +1930 │ │ │ │ │ +1931 │ │ │ │ │ +1932 template │ │ │ │ │ +1933 inline typename SubGraph::EdgeIterator SubGraph::beginEdges │ │ │ │ │ +(const VertexDescriptor& source) const │ │ │ │ │ +1934 { │ │ │ │ │ +1935 return EdgeIterator(source, edges_+start_[source]); │ │ │ │ │ +1936 } │ │ │ │ │ +1937 │ │ │ │ │ +1938 template │ │ │ │ │ +1939 inline typename SubGraph::EdgeIterator SubGraph::endEdges(const │ │ │ │ │ +VertexDescriptor& source) const │ │ │ │ │ +1940 { │ │ │ │ │ +1941 return EdgeIterator(edges_+end_[source]); │ │ │ │ │ +1942 } │ │ │ │ │ +1943 │ │ │ │ │ +1944 template │ │ │ │ │ +1945 std::size_t SubGraph::noVertices() const │ │ │ │ │ +1946 { │ │ │ │ │ +1947 return noVertices_; │ │ │ │ │ +1948 } │ │ │ │ │ +1949 │ │ │ │ │ +1950 template │ │ │ │ │ +1951 inline typename SubGraph::VertexDescriptor SubGraph::maxVertex() │ │ │ │ │ +const │ │ │ │ │ +1952 { │ │ │ │ │ +1953 return maxVertex_; │ │ │ │ │ +1954 } │ │ │ │ │ +1955 │ │ │ │ │ +1956 template │ │ │ │ │ +1957 inline std::size_t SubGraph::noEdges() const │ │ │ │ │ +1958 { │ │ │ │ │ +1959 return noEdges_; │ │ │ │ │ +1960 } │ │ │ │ │ +1961 │ │ │ │ │ +1962 template │ │ │ │ │ +1963 inline typename SubGraph::EdgeDescriptor SubGraph::findEdge │ │ │ │ │ +(const VertexDescriptor& source, │ │ │ │ │ +1964 const VertexDescriptor& target) const │ │ │ │ │ +1965 { │ │ │ │ │ +1966 const EdgeDescriptor edge = std::lower_bound(edges_+start_[source], │ │ │ │ │ +edges_+end_[source], target); │ │ │ │ │ +1967 if(edge==edges_+end_[source] || *edge!=target) │ │ │ │ │ +1968 return std::numeric_limits::max(); │ │ │ │ │ +1969 │ │ │ │ │ +1970 return edge; │ │ │ │ │ +1971 } │ │ │ │ │ +1972 │ │ │ │ │ +1973 template │ │ │ │ │ +1974 SubGraph::~SubGraph() │ │ │ │ │ +1975 { │ │ │ │ │ +1976 delete[] edges_; │ │ │ │ │ +1977 delete[] end_; │ │ │ │ │ +1978 delete[] start_; │ │ │ │ │ +1979 } │ │ │ │ │ +1980 │ │ │ │ │ +1981 template │ │ │ │ │ +1982 SubGraph::SubGraph(const G& graph, const T& excluded) │ │ │ │ │ +1983 : excluded_(excluded), noVertices_(0), endVertex_(0), maxVertex_ │ │ │ │ │ +(graph.maxVertex()) │ │ │ │ │ +1984 { │ │ │ │ │ +1985 start_ = new std::ptrdiff_t[graph.noVertices()]; │ │ │ │ │ +1986 end_ = new std::ptrdiff_t[graph.noVertices()]; │ │ │ │ │ +1987 edges_ = new VertexDescriptor[graph.noEdges()]; │ │ │ │ │ +1988 │ │ │ │ │ +1989 VertexDescriptor* edge=edges_; │ │ │ │ │ +1990 │ │ │ │ │ +1991 // Cater for the case that there are no vertices. │ │ │ │ │ +1992 // Otherwise endVertex_ will get 1 below. │ │ │ │ │ +1993 if ( graph.noVertices() == 0) │ │ │ │ │ +1994 return; │ │ │ │ │ +1995 │ │ │ │ │ +1996 typedef typename Graph::ConstVertexIterator Iterator; │ │ │ │ │ +1997 Iterator endVertex=graph.end(); │ │ │ │ │ +1998 │ │ │ │ │ +1999 for(Iterator vertex = graph.begin(); vertex != endVertex; ++vertex) │ │ │ │ │ +2000 if(excluded_[*vertex]) │ │ │ │ │ +2001 start_[*vertex]=end_[*vertex]=-1; │ │ │ │ │ +2002 else{ │ │ │ │ │ +2003 ++noVertices_; │ │ │ │ │ +2004 endVertex_ = std::max(*vertex, endVertex_); │ │ │ │ │ +2005 │ │ │ │ │ +2006 start_[*vertex] = edge-edges_; │ │ │ │ │ +2007 │ │ │ │ │ +2008 auto endEdge = vertex.end(); │ │ │ │ │ +2009 │ │ │ │ │ +2010 for(auto iter=vertex.begin(); iter!= endEdge; ++iter) │ │ │ │ │ +2011 if(!excluded[iter.target()]) { │ │ │ │ │ +2012 *edge = iter.target(); │ │ │ │ │ +2013 ++edge; │ │ │ │ │ +2014 } │ │ │ │ │ +2015 │ │ │ │ │ +2016 end_[*vertex] = edge - edges_; │ │ │ │ │ +2017 │ │ │ │ │ +2018 // Sort the edges │ │ │ │ │ +2019 std::sort(edges_+start_[*vertex], edge); │ │ │ │ │ +2020 } │ │ │ │ │ +2021 noEdges_ = edge-edges_; │ │ │ │ │ +2022 ++endVertex_; │ │ │ │ │ +2023 } │ │ │ │ │ +2024 │ │ │ │ │ +2025 template │ │ │ │ │ +2026 inline std::size_t VertexPropertiesGraph::noEdges() const │ │ │ │ │ +2027 { │ │ │ │ │ +2028 return graph_.noEdges(); │ │ │ │ │ +2029 } │ │ │ │ │ +2030 │ │ │ │ │ +2031 template │ │ │ │ │ +2032 inline typename VertexPropertiesGraph::EdgeIterator │ │ │ │ │ +2033 VertexPropertiesGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ │ +2034 { │ │ │ │ │ +2035 return graph_.beginEdges(source); │ │ │ │ │ +2036 } │ │ │ │ │ +2037 │ │ │ │ │ +2038 template │ │ │ │ │ +2039 inline typename VertexPropertiesGraph::EdgeIterator │ │ │ │ │ +2040 VertexPropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ │ +2041 { │ │ │ │ │ +2042 return graph_.endEdges(source); │ │ │ │ │ +2043 } │ │ │ │ │ +2044 │ │ │ │ │ +2045 template │ │ │ │ │ +2046 typename VertexPropertiesGraph::ConstEdgeIterator │ │ │ │ │ +2047 inline VertexPropertiesGraph::beginEdges(const VertexDescriptor& │ │ │ │ │ +source) const │ │ │ │ │ +2048 { │ │ │ │ │ +2049 return graph_.beginEdges(source); │ │ │ │ │ +2050 } │ │ │ │ │ +2051 │ │ │ │ │ +2052 template │ │ │ │ │ +2053 typename VertexPropertiesGraph::ConstEdgeIterator │ │ │ │ │ +2054 VertexPropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ │ +const │ │ │ │ │ +2055 { │ │ │ │ │ +2056 return graph_.endEdges(source); │ │ │ │ │ +2057 } │ │ │ │ │ +2058 │ │ │ │ │ +2059 template │ │ │ │ │ +2060 template │ │ │ │ │ +2061 VertexPropertiesGraph::VertexIteratorT │ │ │ │ │ +2062 ::VertexIteratorT(const Father& iter, │ │ │ │ │ +2063 C* graph) │ │ │ │ │ +2064 : Father(iter), graph_(graph) │ │ │ │ │ +2065 {} │ │ │ │ │ +2066 │ │ │ │ │ +2067 template │ │ │ │ │ +2068 template │ │ │ │ │ +2069 VertexPropertiesGraph::VertexIteratorT │ │ │ │ │ +2070 ::VertexIteratorT(const Father& iter) │ │ │ │ │ +2071 : Father(iter) │ │ │ │ │ +2072 {} │ │ │ │ │ +2073 │ │ │ │ │ +2074 template │ │ │ │ │ +2075 template │ │ │ │ │ +2076 template │ │ │ │ │ +2077 VertexPropertiesGraph::VertexIteratorT │ │ │ │ │ +2078 ::VertexIteratorT(const VertexIteratorT& other) │ │ │ │ │ +2079 : Father(other), graph_(other.graph_) │ │ │ │ │ +2080 {} │ │ │ │ │ +2081 │ │ │ │ │ +2082 template │ │ │ │ │ +2083 template │ │ │ │ │ +2084 typename std::conditional:: │ │ │ │ │ +type>::value, │ │ │ │ │ +2085 V&, const V&>::type │ │ │ │ │ +2086 inline VertexPropertiesGraph::VertexIteratorT::properties() │ │ │ │ │ +const │ │ │ │ │ +2087 { │ │ │ │ │ +2088 return graph_->getVertexProperties(Father::operator*()); │ │ │ │ │ +2089 } │ │ │ │ │ +2090 │ │ │ │ │ +2091 template │ │ │ │ │ +2092 template │ │ │ │ │ +2093 typename std::conditional:: │ │ │ │ │ +type, │ │ │ │ │ +2094 C>::value, │ │ │ │ │ +2095 typename G::EdgeIterator, │ │ │ │ │ +2096 typename G::ConstEdgeIterator>::type │ │ │ │ │ +2097 inline VertexPropertiesGraph::VertexIteratorT::begin() const │ │ │ │ │ +2098 { │ │ │ │ │ +2099 return graph_->beginEdges(Father::operator*()); │ │ │ │ │ +2100 } │ │ │ │ │ +2101 │ │ │ │ │ +2102 template │ │ │ │ │ +2103 template │ │ │ │ │ +2104 typename std::conditional:: │ │ │ │ │ +type, │ │ │ │ │ +2105 C>::value, │ │ │ │ │ +2106 typename G::EdgeIterator, │ │ │ │ │ +2107 typename G::ConstEdgeIterator>::type │ │ │ │ │ +2108 inline VertexPropertiesGraph::VertexIteratorT::end() const │ │ │ │ │ +2109 { │ │ │ │ │ +2110 return graph_->endEdges(Father::operator*()); │ │ │ │ │ +2111 } │ │ │ │ │ +2112 │ │ │ │ │ +2113 template │ │ │ │ │ +2114 inline typename VertexPropertiesGraph::VertexIterator │ │ │ │ │ +VertexPropertiesGraph::begin() │ │ │ │ │ +2115 { │ │ │ │ │ +2116 return VertexIterator(graph_.begin(), this); │ │ │ │ │ +2117 } │ │ │ │ │ +2118 │ │ │ │ │ +2119 template │ │ │ │ │ +2120 inline typename VertexPropertiesGraph::VertexIterator │ │ │ │ │ +VertexPropertiesGraph::end() │ │ │ │ │ +2121 { │ │ │ │ │ +2122 return VertexIterator(graph_.end()); │ │ │ │ │ +2123 } │ │ │ │ │ +2124 │ │ │ │ │ +2125 │ │ │ │ │ +2126 template │ │ │ │ │ +2127 inline typename VertexPropertiesGraph::ConstVertexIterator │ │ │ │ │ +VertexPropertiesGraph::begin() const │ │ │ │ │ +2128 { │ │ │ │ │ +2129 return ConstVertexIterator(graph_.begin(), this); │ │ │ │ │ +2130 } │ │ │ │ │ +2131 │ │ │ │ │ +2132 template │ │ │ │ │ +2133 inline typename VertexPropertiesGraph::ConstVertexIterator │ │ │ │ │ +VertexPropertiesGraph::end() const │ │ │ │ │ +2134 { │ │ │ │ │ +2135 return ConstVertexIterator(graph_.end()); │ │ │ │ │ +2136 } │ │ │ │ │ +2137 │ │ │ │ │ +2138 template │ │ │ │ │ +2139 inline V& VertexPropertiesGraph::getVertexProperties(const │ │ │ │ │ +VertexDescriptor& vertex) │ │ │ │ │ +2140 { │ │ │ │ │ +2141 return vertexProperties_[vmap_[vertex]]; │ │ │ │ │ +2142 } │ │ │ │ │ +2143 │ │ │ │ │ +2144 template │ │ │ │ │ +2145 inline const V& VertexPropertiesGraph::getVertexProperties(const │ │ │ │ │ +VertexDescriptor& vertex) const │ │ │ │ │ +2146 { │ │ │ │ │ +2147 return vertexProperties_[vmap_[vertex]]; │ │ │ │ │ +2148 } │ │ │ │ │ +2149 │ │ │ │ │ +2150 template │ │ │ │ │ +2151 inline const G& VertexPropertiesGraph::graph() const │ │ │ │ │ +2152 { │ │ │ │ │ +2153 return graph_; │ │ │ │ │ +2154 } │ │ │ │ │ +2155 │ │ │ │ │ +2156 template │ │ │ │ │ +2157 inline std::size_t VertexPropertiesGraph::noVertices() const │ │ │ │ │ +2158 { │ │ │ │ │ +2159 return graph_.noVertices(); │ │ │ │ │ +2160 } │ │ │ │ │ +2161 │ │ │ │ │ +2162 │ │ │ │ │ +2163 template │ │ │ │ │ +2164 inline typename VertexPropertiesGraph::VertexDescriptor │ │ │ │ │ +VertexPropertiesGraph::maxVertex() const │ │ │ │ │ +2165 { │ │ │ │ │ +2166 return graph_.maxVertex(); │ │ │ │ │ +2167 } │ │ │ │ │ +2168 │ │ │ │ │ +2169 template │ │ │ │ │ +2170 VertexPropertiesGraph::VertexPropertiesGraph(Graph& graph, const │ │ │ │ │ +VM vmap) │ │ │ │ │ +2171 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex │ │ │ │ │ +()+1], V()) │ │ │ │ │ +2172 {} │ │ │ │ │ +2173 │ │ │ │ │ +2174 template │ │ │ │ │ +2175 template │ │ │ │ │ +2176 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ │ +Father& iter, │ │ │ │ │ +2177 C* graph) │ │ │ │ │ +2178 : Father(iter), graph_(graph) │ │ │ │ │ +2179 {} │ │ │ │ │ +2180 │ │ │ │ │ +2181 template │ │ │ │ │ +2182 template │ │ │ │ │ +2183 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ │ +Father& iter) │ │ │ │ │ +2184 : Father(iter) │ │ │ │ │ +2185 {} │ │ │ │ │ +2186 │ │ │ │ │ +2187 template │ │ │ │ │ +2188 template │ │ │ │ │ +2189 template │ │ │ │ │ +2190 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ │ +EdgeIteratorT& other) │ │ │ │ │ +2191 : Father(other), graph_(other.graph_) │ │ │ │ │ +2192 {} │ │ │ │ │ +2193 │ │ │ │ │ +2194 │ │ │ │ │ +2195 template │ │ │ │ │ +2196 inline std::size_t PropertiesGraph::noEdges() const │ │ │ │ │ +2197 { │ │ │ │ │ +2198 return graph_.noEdges(); │ │ │ │ │ +2199 } │ │ │ │ │ +2200 │ │ │ │ │ +2201 template │ │ │ │ │ +2202 template │ │ │ │ │ +2203 inline typename std::conditional::type>::value,E&,const E&>::type │ │ │ │ │ +2204 PropertiesGraph::EdgeIteratorT::properties() const │ │ │ │ │ +2205 { │ │ │ │ │ +2206 return graph_->getEdgeProperties(Father::operator*()); │ │ │ │ │ +2207 } │ │ │ │ │ +2208 │ │ │ │ │ +2209 template │ │ │ │ │ +2210 inline typename PropertiesGraph::EdgeIterator │ │ │ │ │ +2211 PropertiesGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ │ +2212 { │ │ │ │ │ +2213 return EdgeIterator(graph_.beginEdges(source), this); │ │ │ │ │ +2214 } │ │ │ │ │ +2215 │ │ │ │ │ +2216 template │ │ │ │ │ +2217 inline typename PropertiesGraph::EdgeIterator │ │ │ │ │ +2218 PropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ │ +2219 { │ │ │ │ │ +2220 return EdgeIterator(graph_.endEdges(source)); │ │ │ │ │ +2221 } │ │ │ │ │ +2222 │ │ │ │ │ +2223 template │ │ │ │ │ +2224 typename PropertiesGraph::ConstEdgeIterator │ │ │ │ │ +2225 inline PropertiesGraph::beginEdges(const VertexDescriptor& │ │ │ │ │ +source) const │ │ │ │ │ +2226 { │ │ │ │ │ +2227 return ConstEdgeIterator(graph_.beginEdges(source), this); │ │ │ │ │ +2228 } │ │ │ │ │ +2229 │ │ │ │ │ +2230 template │ │ │ │ │ +2231 typename PropertiesGraph::ConstEdgeIterator │ │ │ │ │ +2232 PropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ │ +const │ │ │ │ │ +2233 { │ │ │ │ │ +2234 return ConstEdgeIterator(graph_.endEdges(source)); │ │ │ │ │ +2235 } │ │ │ │ │ +2236 │ │ │ │ │ +2237 template │ │ │ │ │ +2238 template │ │ │ │ │ +2239 PropertiesGraph::VertexIteratorT │ │ │ │ │ +2240 ::VertexIteratorT(const Father& iter, │ │ │ │ │ +2241 C* graph) │ │ │ │ │ +2242 : Father(iter), graph_(graph) │ │ │ │ │ +2243 {} │ │ │ │ │ +2244 │ │ │ │ │ +2245 template │ │ │ │ │ +2246 template │ │ │ │ │ +2247 PropertiesGraph::VertexIteratorT │ │ │ │ │ +2248 ::VertexIteratorT(const Father& iter) │ │ │ │ │ +2249 : Father(iter) │ │ │ │ │ +2250 {} │ │ │ │ │ +2251 │ │ │ │ │ +2252 template │ │ │ │ │ +2253 template │ │ │ │ │ +2254 template │ │ │ │ │ +2255 PropertiesGraph::VertexIteratorT │ │ │ │ │ +2256 ::VertexIteratorT(const VertexIteratorT& other) │ │ │ │ │ +2257 : Father(other), graph_(other.graph_) │ │ │ │ │ +2258 {} │ │ │ │ │ +2259 │ │ │ │ │ +2260 template │ │ │ │ │ +2261 template │ │ │ │ │ +2262 inline typename std::conditional::type>::value, │ │ │ │ │ +2263 V&, const V&>::type │ │ │ │ │ +2264 PropertiesGraph::VertexIteratorT::properties() const │ │ │ │ │ +2265 { │ │ │ │ │ +2266 return graph_->getVertexProperties(Father::operator*()); │ │ │ │ │ +2267 } │ │ │ │ │ +2268 │ │ │ │ │ +2269 template │ │ │ │ │ +2270 template │ │ │ │ │ +2271 inline typename PropertiesGraph::template EdgeIteratorT │ │ │ │ │ +2272 PropertiesGraph::VertexIteratorT::begin() const │ │ │ │ │ +2273 { │ │ │ │ │ +2274 return graph_->beginEdges(Father::operator*()); │ │ │ │ │ +2275 } │ │ │ │ │ +2276 │ │ │ │ │ +2277 template │ │ │ │ │ +2278 template │ │ │ │ │ +2279 inline typename PropertiesGraph::template EdgeIteratorT │ │ │ │ │ +2280 PropertiesGraph::VertexIteratorT::end() const │ │ │ │ │ +2281 { │ │ │ │ │ +2282 return graph_->endEdges(Father::operator*()); │ │ │ │ │ +2283 } │ │ │ │ │ +2284 │ │ │ │ │ +2285 template │ │ │ │ │ +2286 inline typename PropertiesGraph::VertexIterator │ │ │ │ │ +PropertiesGraph::begin() │ │ │ │ │ +2287 { │ │ │ │ │ +2288 return VertexIterator(graph_.begin(), this); │ │ │ │ │ +2289 } │ │ │ │ │ +2290 │ │ │ │ │ +2291 template │ │ │ │ │ +2292 inline typename PropertiesGraph::VertexIterator │ │ │ │ │ +PropertiesGraph::end() │ │ │ │ │ +2293 { │ │ │ │ │ +2294 return VertexIterator(graph_.end()); │ │ │ │ │ +2295 } │ │ │ │ │ +2296 │ │ │ │ │ +2297 │ │ │ │ │ +2298 template │ │ │ │ │ +2299 inline typename PropertiesGraph::ConstVertexIterator │ │ │ │ │ +PropertiesGraph::begin() const │ │ │ │ │ +2300 { │ │ │ │ │ +2301 return ConstVertexIterator(graph_.begin(), this); │ │ │ │ │ +2302 } │ │ │ │ │ +2303 │ │ │ │ │ +2304 template │ │ │ │ │ +2305 inline typename PropertiesGraph::ConstVertexIterator │ │ │ │ │ +PropertiesGraph::end() const │ │ │ │ │ +2306 { │ │ │ │ │ +2307 return ConstVertexIterator(graph_.end()); │ │ │ │ │ +2308 } │ │ │ │ │ +2309 │ │ │ │ │ +2310 template │ │ │ │ │ +2311 inline V& PropertiesGraph::getVertexProperties(const │ │ │ │ │ +VertexDescriptor& vertex) │ │ │ │ │ +2312 { │ │ │ │ │ +2313 return vertexProperties_[vmap_[vertex]]; │ │ │ │ │ +2314 } │ │ │ │ │ +2315 │ │ │ │ │ +2316 template │ │ │ │ │ +2317 inline const V& PropertiesGraph::getVertexProperties(const │ │ │ │ │ +VertexDescriptor& vertex) const │ │ │ │ │ +2318 { │ │ │ │ │ +2319 return vertexProperties_[vmap_[vertex]]; │ │ │ │ │ +2320 } │ │ │ │ │ +2321 │ │ │ │ │ +2322 template │ │ │ │ │ +2323 inline E& PropertiesGraph::getEdgeProperties(const │ │ │ │ │ +EdgeDescriptor& edge) │ │ │ │ │ +2324 { │ │ │ │ │ +2325 return edgeProperties_[emap_[edge]]; │ │ │ │ │ +2326 } │ │ │ │ │ +2327 │ │ │ │ │ +2328 template │ │ │ │ │ +2329 inline const E& PropertiesGraph::getEdgeProperties(const │ │ │ │ │ +EdgeDescriptor& edge) const │ │ │ │ │ +2330 { │ │ │ │ │ +2331 return edgeProperties_[emap_[edge]]; │ │ │ │ │ +2332 } │ │ │ │ │ +2333 │ │ │ │ │ +2334 template │ │ │ │ │ +2335 inline E& PropertiesGraph::getEdgeProperties(const │ │ │ │ │ +VertexDescriptor& source, │ │ │ │ │ +2336 const VertexDescriptor& target) │ │ │ │ │ +2337 { │ │ │ │ │ +2338 return getEdgeProperties(graph_.findEdge(source,target)); │ │ │ │ │ +2339 } │ │ │ │ │ +2340 │ │ │ │ │ +2341 template │ │ │ │ │ +2342 inline const E& PropertiesGraph::getEdgeProperties(const │ │ │ │ │ +VertexDescriptor& source, │ │ │ │ │ +2343 const VertexDescriptor& target) const │ │ │ │ │ +2344 { │ │ │ │ │ +2345 return getEdgeProperties(graph_.findEdge(source,target)); │ │ │ │ │ +2346 } │ │ │ │ │ +2347 │ │ │ │ │ +2348 template │ │ │ │ │ +2349 inline const G& PropertiesGraph::graph() const │ │ │ │ │ +2350 { │ │ │ │ │ +2351 return graph_; │ │ │ │ │ +2352 } │ │ │ │ │ +2353 │ │ │ │ │ +2354 template │ │ │ │ │ +2355 inline std::size_t PropertiesGraph::noVertices() const │ │ │ │ │ +2356 { │ │ │ │ │ +2357 return graph_.noVertices(); │ │ │ │ │ +2358 } │ │ │ │ │ +2359 │ │ │ │ │ +2360 │ │ │ │ │ +2361 template │ │ │ │ │ +2362 inline typename PropertiesGraph::VertexDescriptor │ │ │ │ │ +PropertiesGraph::maxVertex() const │ │ │ │ │ +2363 { │ │ │ │ │ +2364 return graph_.maxVertex(); │ │ │ │ │ +2365 } │ │ │ │ │ +2366 │ │ │ │ │ +2367 template │ │ │ │ │ +2368 PropertiesGraph::PropertiesGraph(Graph& graph, const VM& │ │ │ │ │ +vmap, const EM& emap) │ │ │ │ │ +2369 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex │ │ │ │ │ +()+1], V()), │ │ │ │ │ +2370 emap_(emap), edgeProperties_(graph_.noEdges(), E()) │ │ │ │ │ +2371 {} │ │ │ │ │ +2372 │ │ │ │ │ +2373 template │ │ │ │ │ +2374 inline int _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(const G& graph, const typename G:: │ │ │ │ │ +VertexDescriptor& vertex, │ │ │ │ │ +2375 V& visitor) │ │ │ │ │ +2376 { │ │ │ │ │ +2377 typedef typename G::ConstEdgeIterator iterator; │ │ │ │ │ +2378 const iterator end = graph.endEdges(vertex); │ │ │ │ │ +2379 int noNeighbours=0; │ │ │ │ │ +2380 for(iterator edge = graph.beginEdges(vertex); edge != end; ++edge, │ │ │ │ │ +++noNeighbours) │ │ │ │ │ +2381 visitor(edge); │ │ │ │ │ +2382 return noNeighbours; │ │ │ │ │ +2383 } │ │ │ │ │ +2384 │ │ │ │ │ +2385#endif // DOXYGEN │ │ │ │ │ +2386 │ │ │ │ │ +2388 } │ │ │ │ │ +2389} │ │ │ │ │ +2390#endif │ │ │ │ │ _i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ -_D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ -void printvector(std::ostream &s, const V &v, std::string title, std::string │ │ │ │ │ -rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ -Print an ISTL vector. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:89 │ │ │ │ │ +_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_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:488 │ │ │ │ │ -_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:395 │ │ │ │ │ -_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:401 │ │ │ │ │ -_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:410 │ │ │ │ │ -_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_:_:_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ │ │ │ │ │ -const unsigned int verbosity_level_ │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:958 │ │ │ │ │ -_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_:_:_g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t │ │ │ │ │ -unsigned int getIterationCount() const │ │ │ │ │ -Return the number of iterations in last application of an algorithm. │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:944 │ │ │ │ │ -_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_:_:_t_i_t_l_e__ │ │ │ │ │ -const std::string title_ │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:966 │ │ │ │ │ -_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_:_:_R_e_a_l │ │ │ │ │ -BlockVector::field_type Real │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:247 │ │ │ │ │ -_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_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s_:_:_m__ │ │ │ │ │ -const BCRSMatrix & m_ │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:954 │ │ │ │ │ -_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_:_:_n_I_t_e_r_a_t_i_o_n_s_M_a_x__ │ │ │ │ │ -const unsigned int nIterationsMax_ │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:955 │ │ │ │ │ -_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_:_:_b_l_a_n_k__ │ │ │ │ │ -const std::string blank_ │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:967 │ │ │ │ │ -_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_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ -ArPackPlusPlus_Algorithms(const BCRSMatrix &m, const unsigned int │ │ │ │ │ -nIterationsMax=100000, const unsigned int verbosity_level=0) │ │ │ │ │ -Construct from required parameters. │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:268 │ │ │ │ │ -_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_C_o_n_d_2 │ │ │ │ │ -void computeSymCond2(const Real &epsilon, Real &cond_2) const │ │ │ │ │ -Assume the matrix to be square, symmetric and perform IRLM to compute an │ │ │ │ │ -approximation of its spectra... │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:493 │ │ │ │ │ -_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_:_:_n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ -unsigned int nIterations_ │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:963 │ │ │ │ │ -_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_N_o_n_S_y_m_M_i_n │ │ │ │ │ -void computeNonSymMin(const Real &epsilon, BlockVector &x, Real &sigma) const │ │ │ │ │ -Assume the matrix to be nonsymmetric and perform IRLM to compute an │ │ │ │ │ -approximation sigma of its smalle... │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:721 │ │ │ │ │ -_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_N_o_n_S_y_m_C_o_n_d_2 │ │ │ │ │ -void computeNonSymCond2(const Real &epsilon, Real &cond_2) const │ │ │ │ │ -Assume the matrix to be nonsymmetric and perform IRLM to compute an │ │ │ │ │ -approximation of its spectral con... │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:830 │ │ │ │ │ -_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_N_o_n_S_y_m_M_a_x │ │ │ │ │ -void computeNonSymMax(const Real &epsilon, BlockVector &x, Real &sigma) const │ │ │ │ │ -Assume the matrix to be nonsymmetric and perform IRLM to compute an │ │ │ │ │ -approximation sigma of its larges... │ │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:609 │ │ │ │ │ _D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ derive error class from the base class in common │ │ │ │ │ DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +The (undirected) graph of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +MatrixGraph(Matrix &matrix) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d │ │ │ │ │ +VertexIterator end() │ │ │ │ │ +Get an iterator over the vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_a_t_r_i_x │ │ │ │ │ +M Matrix │ │ │ │ │ +The type of the matrix we are a graph for. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ │ +ConstVertexIterator begin() const │ │ │ │ │ +Get an iterator over the vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ │ +VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator │ │ │ │ │ +The constant vertex iterator type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:308 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_~_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +~MatrixGraph() │ │ │ │ │ +Destructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +std::ptrdiff_t EdgeDescriptor │ │ │ │ │ +The edge descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ │ +ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +M::size_type VertexDescriptor │ │ │ │ │ +The vertex descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_t_r_i_x │ │ │ │ │ +const Matrix & matrix() const │ │ │ │ │ +Get the underlying matrix. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_u_t_a_b_l_e_M_a_t_r_i_x │ │ │ │ │ +@ mutableMatrix │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ │ +ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d │ │ │ │ │ +ConstVertexIterator end() const │ │ │ │ │ +Get an iterator over the vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator │ │ │ │ │ +The constant edge iterator type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:298 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ │ +EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ +std::size_t noVertices() const │ │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_f_i_n_d_E_d_g_e │ │ │ │ │ +EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ │ +&target) const │ │ │ │ │ +Find the descriptor of an edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_W_e_i_g_h_t │ │ │ │ │ +M::block_type Weight │ │ │ │ │ +The type of the weights. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_u_t_a_b_l_e_M_a_t_r_i_x │ │ │ │ │ +std::remove_const< M >::type MutableMatrix │ │ │ │ │ +The mutable type of the matrix we are a graph for. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +EdgeIteratorT< MatrixGraph< Matrix > > EdgeIterator │ │ │ │ │ +The mutable edge iterator type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:303 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ │ +VertexIteratorT< MatrixGraph< Matrix > > VertexIterator │ │ │ │ │ +The mutable vertex iterator type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:313 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ │ +EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ │ +std::size_t noEdges() const │ │ │ │ │ +Get the number of edges in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_t_r_i_x │ │ │ │ │ +Matrix & matrix() │ │ │ │ │ +Get the underlying matrix. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ │ +VertexIterator begin() │ │ │ │ │ +Get an iterator over the vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +Iterator over all edges starting from a vertex. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t_T_y_p_e │ │ │ │ │ +std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ │ +value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >:: │ │ │ │ │ +type WeightType │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:156 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +EdgeIteratorT(const VertexDescriptor &source, const ColIterator &block, const │ │ │ │ │ +ColIterator &end, const EdgeDescriptor &edge) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ │ +@ isMutable │ │ │ │ │ +whether C is mutable. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_t_a_r_g_e_t │ │ │ │ │ +VertexDescriptor target() const │ │ │ │ │ +The index of the target vertex of the current edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +EdgeIteratorT< C > & operator++() │ │ │ │ │ +preincrement operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const EdgeIteratorT< const typename std::remove_const< C >:: │ │ │ │ │ +type > &other) const │ │ │ │ │ +Inequality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const EdgeIteratorT< const typename std::remove_const< C >:: │ │ │ │ │ +type > &other) const │ │ │ │ │ +Equality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +EdgeIteratorT(const EdgeIteratorT< C1 > &other) │ │ │ │ │ +Copy Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const EdgeIteratorT< typename std::remove_const< C >::type > │ │ │ │ │ +&other) const │ │ │ │ │ +Inequality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_w_e_i_g_h_t │ │ │ │ │ +WeightType & weight() const │ │ │ │ │ +Access the edge weight. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_s_o_u_r_c_e │ │ │ │ │ +VertexDescriptor source() const │ │ │ │ │ +The index of the source vertex of the current edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +std::conditional< isMutable &&C::mutableMatrix, typenameMatrix::row_type:: │ │ │ │ │ +Iterator, typenameMatrix::row_type::ConstIterator >::type ColIterator │ │ │ │ │ +The column iterator of the matrix we use. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_C_o_n_s_t_C_o_n_t_a_i_n_e_r │ │ │ │ │ +const std::remove_const< C >::type ConstContainer │ │ │ │ │ +The constant type of the container type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const EdgeIteratorT< typename std::remove_const< C >::type > │ │ │ │ │ +&other) const │ │ │ │ │ +Equality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +EdgeIteratorT(const ColIterator &block) │ │ │ │ │ +Constructor for the end iterator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t │ │ │ │ │ +std::conditional< isMutable &&C::mutableMatrix, typenameM::block_type, │ │ │ │ │ +consttypenameM::block_type >::type Weight │ │ │ │ │ +The matrix block type we use as weights. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:127 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +const EdgeDescriptor & operator*() const │ │ │ │ │ +Get the edge descriptor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ +const EdgeDescriptor * operator->() const │ │ │ │ │ +Get the edge descriptor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r │ │ │ │ │ +std::remove_const< C >::type MutableContainer │ │ │ │ │ +The mutable type of the container type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +The vertex iterator type of the graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_b_e_g_i_n │ │ │ │ │ +EdgeIteratorT< C > begin() const │ │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +const VertexDescriptor & operator*() const │ │ │ │ │ +Get the descriptor of the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_w_e_i_g_h_t │ │ │ │ │ +WeightType & weight() const │ │ │ │ │ +Access the weight of the vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +VertexIteratorT(C *graph, const VertexDescriptor ¤t) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t_T_y_p_e │ │ │ │ │ +std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ │ +value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >:: │ │ │ │ │ +type WeightType │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:266 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +VertexIteratorT(const VertexIteratorT< MutableContainer > &other) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r │ │ │ │ │ +std::remove_const< C >::type MutableContainer │ │ │ │ │ +The mutable type of the container type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:214 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const VertexIteratorT< MutableContainer > &other) const │ │ │ │ │ +Inequality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ │ +@ isMutable │ │ │ │ │ +whether C is mutable. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:225 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const VertexIteratorT< MutableContainer > &other) const │ │ │ │ │ +Equality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_C_o_n_s_t_C_o_n_t_a_i_n_e_r │ │ │ │ │ +const std::remove_const< C >::type ConstContainer │ │ │ │ │ +The constant type of the container type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:218 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ +VertexIteratorT< C > & operator++() │ │ │ │ │ +Move to the next vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_e_n_d │ │ │ │ │ +EdgeIteratorT< C > end() const │ │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const VertexIteratorT< ConstContainer > &other) const │ │ │ │ │ +Equality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const VertexIteratorT< ConstContainer > &other) const │ │ │ │ │ +Inequality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +VertexIteratorT(const VertexDescriptor ¤t) │ │ │ │ │ +Constructor for the end iterator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h │ │ │ │ │ +A subgraph of a graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:443 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_f_i_n_d_E_d_g_e │ │ │ │ │ +EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ │ +&target) const │ │ │ │ │ +Find the descriptor of an edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ │ +EdgeIndexMap getEdgeIndexMap() │ │ │ │ │ +Get an edge index map for the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ │ +std::size_t noEdges() const │ │ │ │ │ +Get the number of edges in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ │ +ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_e_n_d │ │ │ │ │ +ConstVertexIterator end() const │ │ │ │ │ +Get an iterator over the vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ │ +ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ +std::size_t noVertices() const │ │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_x_c_l_u_d_e_d │ │ │ │ │ +T Excluded │ │ │ │ │ +Random access container providing information about which vertices are │ │ │ │ │ +excluded. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:454 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_~_S_u_b_G_r_a_p_h │ │ │ │ │ +~SubGraph() │ │ │ │ │ +Destructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +EdgeIterator ConstEdgeIterator │ │ │ │ │ +The constant edge iterator type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:618 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ │ +G Graph │ │ │ │ │ +The type of the graph we are a sub graph for. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:448 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ │ +VertexIterator ConstVertexIterator │ │ │ │ │ +The constant vertex iterator type. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:623 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_S_u_b_G_r_a_p_h │ │ │ │ │ +SubGraph(const Graph &graph, const T &excluded) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ │ +ConstVertexIterator begin() const │ │ │ │ │ +Get an iterator over the vertices. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ │ +The vertex descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:459 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +VertexDescriptor * EdgeDescriptor │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:461 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ │ +An index map for mapping the edges to indices. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:470 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ │ +EdgeIndexMap(const EdgeIndexMap &emap) │ │ │ │ │ +Protect copy construction. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:479 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ +ReadablePropertyMapTag Category │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:472 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ │ +EdgeIndexMap(const EdgeDescriptor &firstEdge) │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:474 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +std::size_t operator[](const EdgeDescriptor &edge) const │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:483 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +The edge iterator of the graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:505 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +const EdgeDescriptor & dereference() const │ │ │ │ │ +The descriptor of the current edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +EdgeIterator(const EdgeDescriptor &edge) │ │ │ │ │ +Constructor for the end iterator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const EdgeIterator &other) const │ │ │ │ │ +Equality operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ +EdgeIterator & advance(std::ptrdiff_t n) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +EdgeIterator & increment() │ │ │ │ │ +Preincrement operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_t_a_r_g_e_t │ │ │ │ │ +const VertexDescriptor & target() const │ │ │ │ │ +The index of the target vertex of the current edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_s_o_u_r_c_e │ │ │ │ │ +const VertexDescriptor & source() const │ │ │ │ │ +The index of the source vertex of the current edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ +EdgeIterator & decrement() │ │ │ │ │ +Preincrement operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ +std::ptrdiff_t distanceTo(const EdgeIterator &other) const │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +EdgeIterator(const VertexDescriptor &source, const EdgeDescriptor &edge) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ │ +The vertex iterator of the graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ │ +VertexIterator(const VertexDescriptor ¤t) │ │ │ │ │ +Constructor for end iterator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +VertexIterator & increment() │ │ │ │ │ +Preincrement operator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_b_e_g_i_n │ │ │ │ │ +EdgeIterator begin() const │ │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const VertexIterator &other) const │ │ │ │ │ +Equality iterator. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ │ +VertexIterator(const SubGraph< G, T > *graph, const VertexDescriptor ¤t, │ │ │ │ │ +const VertexDescriptor &end) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_e_n_d │ │ │ │ │ +EdgeIterator end() const │ │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +const VertexDescriptor & dereference() const │ │ │ │ │ +Get the descriptor of the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +Attaches properties to the vertices of a graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:723 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_r_a_p_h │ │ │ │ │ +const Graph & graph() const │ │ │ │ │ +Get the graph the properties are attached to. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Graph::ConstEdgeIterator ConstEdgeIterator │ │ │ │ │ +The type of the constant edge iterator. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:766 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +VertexProperties & getVertexProperties(const VertexDescriptor &vertex) │ │ │ │ │ +Get the properties associated with a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ │ +std::size_t noEdges() const │ │ │ │ │ +Get the number of edges in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +Graph::EdgeDescriptor EdgeDescriptor │ │ │ │ │ +The edge descritor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:738 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ │ +ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ │ +The vertex descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:733 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ │ +G Graph │ │ │ │ │ +The graph we attach properties to. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:728 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_M_a_p │ │ │ │ │ +VM VertexMap │ │ │ │ │ +The type of the map for converting the VertexDescriptor to std::size_t. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:756 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ │ +EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ │ +EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +VP VertexProperties │ │ │ │ │ +The type of the properties of the vertices. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:743 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ +std::size_t noVertices() const │ │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ │ +ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +Graph::EdgeIterator EdgeIterator │ │ │ │ │ +The type of the mutable edge iterator. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:761 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:803 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ │ +value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type │ │ │ │ │ +EdgeIterator │ │ │ │ │ +The class of the edge iterator. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:823 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ │ +std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ │ +value, VertexProperties &, constVertexProperties & >::type properties() const │ │ │ │ │ +Get the properties of the current Vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_e_n_d │ │ │ │ │ +EdgeIterator end() const │ │ │ │ │ +Get an iterator over the edges starting from the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ │ +value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >:: │ │ │ │ │ +type Father │ │ │ │ │ +The father class. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:814 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_b_e_g_i_n │ │ │ │ │ +EdgeIterator begin() const │ │ │ │ │ +Get an iterator over the edges starting from the current vertex. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ │ +std::size_t noVertices() const │ │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +Graph::EdgeDescriptor EdgeDescriptor │ │ │ │ │ +The edge descritor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:993 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +const EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const │ │ │ │ │ +VertexDescriptor &target) const │ │ │ │ │ +Get the properties associated with a edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +const EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) const │ │ │ │ │ +Get the properties associated with a edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_r_a_p_h │ │ │ │ │ +const Graph & graph() const │ │ │ │ │ +Get the graph the properties are attached to. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ │ +G Graph │ │ │ │ │ +The graph we attach properties to. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:983 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_M_a_p │ │ │ │ │ +EM EdgeMap │ │ │ │ │ +The type of the map for converting the EdgeDescriptor to std::size_t. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1030 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_M_a_p │ │ │ │ │ +VM VertexMap │ │ │ │ │ +The type of the map for converting the VertexDescriptor to std::size_t. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1011 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +VP VertexProperties │ │ │ │ │ +The type of the properties of the vertices. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:998 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ │ +std::size_t noEdges() const │ │ │ │ │ +Get the number of edges in the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +EP EdgeProperties │ │ │ │ │ +The type of the properties of the edges;. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1016 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const │ │ │ │ │ +VertexDescriptor &target) │ │ │ │ │ +Get the properties associated with a edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) │ │ │ │ │ +Get the properties associated with a edge. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ │ +The vertex descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:988 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +PropertiesGraph(Graph &graph, const VertexMap &vmap=VertexMap(), const EdgeMap │ │ │ │ │ +&emap=EdgeMap()) │ │ │ │ │ +Constructor. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1038 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ │ +value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type │ │ │ │ │ +Father │ │ │ │ │ +The father class. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1050 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1140 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ │ +value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >:: │ │ │ │ │ +type Father │ │ │ │ │ +The father class. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1151 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +Wrapper to access the internal edge properties of a graph via operator[]() │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1361 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +GraphVertexPropertiesSelector(G &g) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1380 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +VertexProperties & operator[](const Vertex &vertex) const │ │ │ │ │ +Get the properties associated to a vertex. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1395 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h │ │ │ │ │ +G Graph │ │ │ │ │ +The type of the graph with internal properties. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1366 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +G::VertexProperties VertexProperties │ │ │ │ │ +The type of the vertex properties. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1370 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +GraphVertexPropertiesSelector() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1386 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ │ +G::VertexDescriptor Vertex │ │ │ │ │ +The vertex descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1374 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +Wrapper to access the internal vertex properties of a graph via operator[]() │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1409 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +EdgeProperties & operator[](const Edge &edge) const │ │ │ │ │ +Get the properties associated to a vertex. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1442 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +G::EdgeProperties EdgeProperties │ │ │ │ │ +The type of the vertex properties. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1418 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_E_d_g_e │ │ │ │ │ +G::EdgeDescriptor Edge │ │ │ │ │ +The edge descriptor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1422 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +GraphEdgePropertiesSelector() │ │ │ │ │ +Default constructor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1434 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h │ │ │ │ │ +G Graph │ │ │ │ │ +The type of the graph with internal properties. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1414 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ │ +GraphEdgePropertiesSelector(G &g) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:1428 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00167.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: poweriteration.hh File Reference │ │ │ │ +dune-istl: amg.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,55 +65,79 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
poweriteration.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#include <cstddef>
│ │ │ │ -#include <cmath>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <ios>
│ │ │ │ -#include <iomanip>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <string>
│ │ │ │ + │ │ │ │ +

The AMG preconditioner. │ │ │ │ +More...

│ │ │ │ +
#include <memory>
│ │ │ │ +#include <sstream>
│ │ │ │ #include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ -#include <dune/istl/operators.hh>
│ │ │ │ -#include <dune/istl/solvercategory.hh>
│ │ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ │ -#include <dune/istl/istlexception.hh>
│ │ │ │ -#include <dune/istl/io.hh>
│ │ │ │ -#include <dune/istl/solvers.hh>
│ │ │ │ +#include <dune/istl/paamg/smoother.hh>
│ │ │ │ +#include <dune/istl/paamg/transfer.hh>
│ │ │ │ +#include <dune/istl/paamg/matrixhierarchy.hh>
│ │ │ │ +#include <dune/istl/solvers.hh>
│ │ │ │ +#include <dune/istl/scalarproducts.hh>
│ │ │ │ +#include <dune/istl/superlu.hh>
│ │ │ │ +#include <dune/istl/umfpack.hh>
│ │ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ │ +#include <dune/common/typetraits.hh>
│ │ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +#include <dune/common/parametertree.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::PowerIteration_Algorithms< BCRSMatrix, BlockVector >
 Iterative eigenvalue algorithms based on power iteration. 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::isValidBlockType< class >
 
struct  Dune::AMGCreator::isValidBlockType< FieldMatrix< T, n, m > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

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

Detailed Description

│ │ │ │ +

The AMG preconditioner.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,36 +1,60 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -poweriteration.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#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 <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._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_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._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_s_t_l_e_x_c_e_p_t_i_o_n_._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_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ │ #include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _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_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_<_ _B_C_R_S_M_a_t_r_i_x_,_ _B_l_o_c_k_V_e_c_t_o_r_ _> │ │ │ │ │ -  Iterative eigenvalue algorithms based on power iteration. _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_B_l_o_c_k_T_y_p_e_<_ _c_l_a_s_s_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("amg", _A_M_G_C_r_e_a_t_o_r()) │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +The AMG preconditioner. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00167_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: poweriteration.hh Source File │ │ │ │ +dune-istl: amg.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,875 +70,1282 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
poweriteration.hh
│ │ │ │ +
amg.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_EIGENVALUE_POWERITERATION_HH
│ │ │ │ -
6#define DUNE_ISTL_EIGENVALUE_POWERITERATION_HH
│ │ │ │ +
5#ifndef DUNE_AMG_AMG_HH
│ │ │ │ +
6#define DUNE_AMG_AMG_HH
│ │ │ │
7
│ │ │ │ -
8#include <cstddef> // provides std::size_t
│ │ │ │ -
9#include <cmath> // provides std::sqrt, std::abs
│ │ │ │ -
10
│ │ │ │ -
11#include <type_traits> // provides std::is_same
│ │ │ │ -
12#include <iostream> // provides std::cout, std::endl
│ │ │ │ -
13#include <limits> // provides std::numeric_limits
│ │ │ │ -
14#include <ios> // provides std::left, std::ios::left
│ │ │ │ -
15#include <iomanip> // provides std::setw, std::resetiosflags
│ │ │ │ -
16#include <memory> // provides std::unique_ptr
│ │ │ │ -
17#include <string> // provides std::string
│ │ │ │ -
18
│ │ │ │ -
19#include <dune/common/exceptions.hh> // provides DUNE_THROW(...)
│ │ │ │ -
20
│ │ │ │ -
21#include <dune/istl/blocklevel.hh> // provides Dune::blockLevel
│ │ │ │ -
22#include <dune/istl/operators.hh> // provides Dune::LinearOperator
│ │ │ │ -
23#include <dune/istl/solvercategory.hh> // provides Dune::SolverCategory::sequential
│ │ │ │ -
24#include <dune/istl/solvertype.hh> // provides Dune::IsDirectSolver
│ │ │ │ -
25#include <dune/istl/operators.hh> // provides Dune::MatrixAdapter
│ │ │ │ -
26#include <dune/istl/istlexception.hh> // provides Dune::ISTLError
│ │ │ │ -
27#include <dune/istl/io.hh> // provides Dune::printvector(...)
│ │ │ │ -
28#include <dune/istl/solvers.hh> // provides Dune::InverseOperatorResult
│ │ │ │ -
29
│ │ │ │ -
30namespace Dune
│ │ │ │ -
31{
│ │ │ │ -
32
│ │ │ │ -
37 namespace Impl {
│ │ │ │ -
45 template <class X, class Y = X>
│ │ │ │ -
46 class ScalingLinearOperator : public Dune::LinearOperator<X,Y>
│ │ │ │ -
47 {
│ │ │ │ -
48 public:
│ │ │ │ -
49 typedef X domain_type;
│ │ │ │ -
50 typedef Y range_type;
│ │ │ │ -
51 typedef typename X::field_type field_type;
│ │ │ │ -
52
│ │ │ │ -
53 ScalingLinearOperator (field_type immutable_scaling,
│ │ │ │ -
54 const field_type& mutable_scaling)
│ │ │ │ -
55 : immutable_scaling_(immutable_scaling),
│ │ │ │ -
56 mutable_scaling_(mutable_scaling)
│ │ │ │ -
57 {}
│ │ │ │ -
58
│ │ │ │ -
59 virtual void apply (const X& x, Y& y) const
│ │ │ │ -
60 {
│ │ │ │ -
61 y = x;
│ │ │ │ -
62 y *= immutable_scaling_*mutable_scaling_;
│ │ │ │ -
63 }
│ │ │ │ -
64
│ │ │ │ -
65 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
│ │ │ │ -
66 {
│ │ │ │ -
67 X temp(x);
│ │ │ │ -
68 temp *= immutable_scaling_*mutable_scaling_;
│ │ │ │ -
69 y.axpy(alpha,temp);
│ │ │ │ -
70 }
│ │ │ │ -
71
│ │ │ │ - │ │ │ │ -
74 {
│ │ │ │ - │ │ │ │ -
76 }
│ │ │ │ -
77
│ │ │ │ -
78 protected:
│ │ │ │ -
79 const field_type immutable_scaling_;
│ │ │ │ -
80 const field_type& mutable_scaling_;
│ │ │ │ -
81 };
│ │ │ │ -
82
│ │ │ │ -
83
│ │ │ │ -
92 template <class OP1, class OP2>
│ │ │ │ -
93 class LinearOperatorSum
│ │ │ │ -
94 : public Dune::LinearOperator<typename OP1::domain_type,
│ │ │ │ -
95 typename OP1::range_type>
│ │ │ │ -
96 {
│ │ │ │ -
97 public:
│ │ │ │ -
98 typedef typename OP1::domain_type domain_type;
│ │ │ │ -
99 typedef typename OP1::range_type range_type;
│ │ │ │ -
100 typedef typename domain_type::field_type field_type;
│ │ │ │ +
8#include <memory>
│ │ │ │ +
9#include <sstream>
│ │ │ │ +
10#include <dune/common/exceptions.hh>
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
14#include <dune/istl/solvers.hh>
│ │ │ │ + │ │ │ │ +
16#include <dune/istl/superlu.hh>
│ │ │ │ +
17#include <dune/istl/umfpack.hh>
│ │ │ │ + │ │ │ │ +
19#include <dune/common/typetraits.hh>
│ │ │ │ +
20#include <dune/common/exceptions.hh>
│ │ │ │ +
21#include <dune/common/scalarvectorview.hh>
│ │ │ │ +
22#include <dune/common/scalarmatrixview.hh>
│ │ │ │ +
23#include <dune/common/parametertree.hh>
│ │ │ │ +
24
│ │ │ │ +
25namespace Dune
│ │ │ │ +
26{
│ │ │ │ +
27 namespace Amg
│ │ │ │ +
28 {
│ │ │ │ +
46 template<class M, class X, class S, class P, class K, class A>
│ │ │ │ +
47 class KAMG;
│ │ │ │ +
48
│ │ │ │ +
49 template<class T>
│ │ │ │ +
50 class KAmgTwoGrid;
│ │ │ │ +
51
│ │ │ │ +
62 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ │ +
63 class A=std::allocator<X> >
│ │ │ │ +
│ │ │ │ +
64 class AMG : public Preconditioner<X,X>
│ │ │ │ +
65 {
│ │ │ │ +
66 template<class M1, class X1, class S1, class P1, class K1, class A1>
│ │ │ │ +
67 friend class KAMG;
│ │ │ │ +
68
│ │ │ │ +
69 friend class KAmgTwoGrid<AMG>;
│ │ │ │ +
70
│ │ │ │ +
71 public:
│ │ │ │ +
73 typedef M Operator;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
85
│ │ │ │ +
87 typedef X Domain;
│ │ │ │ +
89 typedef X Range;
│ │ │ │ + │ │ │ │ +
97 typedef S Smoother;
│ │ │ │ +
98
│ │ │ │ + │ │ │ │
101
│ │ │ │ -
102 LinearOperatorSum (const OP1& op1, const OP2& op2)
│ │ │ │ -
103 : op1_(op1), op2_(op2)
│ │ │ │ -
104 {
│ │ │ │ -
105 static_assert(std::is_same<typename OP2::domain_type,domain_type>::value,
│ │ │ │ -
106 "Domain type of both operators doesn't match!");
│ │ │ │ -
107 static_assert(std::is_same<typename OP2::range_type,range_type>::value,
│ │ │ │ -
108 "Range type of both operators doesn't match!");
│ │ │ │ -
109 }
│ │ │ │ -
110
│ │ │ │ -
111 virtual void apply (const domain_type& x, range_type& y) const
│ │ │ │ -
112 {
│ │ │ │ -
113 op1_.apply(x,y);
│ │ │ │ -
114 op2_.applyscaleadd(1.0,x,y);
│ │ │ │ -
115 }
│ │ │ │ -
116
│ │ │ │ -
117 virtual void applyscaleadd (field_type alpha,
│ │ │ │ -
118 const domain_type& x, range_type& y) const
│ │ │ │ -
119 {
│ │ │ │ -
120 range_type temp(y);
│ │ │ │ -
121 op1_.apply(x,temp);
│ │ │ │ -
122 op2_.applyscaleadd(1.0,x,temp);
│ │ │ │ -
123 y.axpy(alpha,temp);
│ │ │ │ -
124 }
│ │ │ │ -
125
│ │ │ │ -
127 virtual SolverCategory::Category category() const
│ │ │ │ -
128 {
│ │ │ │ - │ │ │ │ -
130 }
│ │ │ │ -
131
│ │ │ │ -
132 protected:
│ │ │ │ -
133 const OP1& op1_;
│ │ │ │ -
134 const OP2& op2_;
│ │ │ │ -
135 };
│ │ │ │ -
136 } // end namespace Impl
│ │ │ │ -
137
│ │ │ │ -
174 template <typename BCRSMatrix, typename BlockVector>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
176 {
│ │ │ │ -
177 protected:
│ │ │ │ -
178 // Type definitions for type of iteration operator (m_ - mu_*I)
│ │ │ │ - │ │ │ │ - │ │ │ │ -
181 typedef Impl::ScalingLinearOperator<BlockVector> ScalingOperator;
│ │ │ │ -
182 typedef Impl::LinearOperatorSum<MatrixOperator,ScalingOperator> OperatorSum;
│ │ │ │ -
183
│ │ │ │ -
184 public:
│ │ │ │ - │ │ │ │ -
187
│ │ │ │ - │ │ │ │ -
190
│ │ │ │ -
191 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
207 const unsigned int nIterationsMax = 1000,
│ │ │ │ -
208 const unsigned int verbosity_level = 0)
│ │ │ │ -
209 : m_(m), nIterationsMax_(nIterationsMax),
│ │ │ │ -
210 verbosity_level_(verbosity_level),
│ │ │ │ -
211 mu_(0.0),
│ │ │ │ - │ │ │ │ -
213 scalingOperator_(-1.0,mu_),
│ │ │ │ - │ │ │ │ -
215 nIterations_(0),
│ │ │ │ -
216 title_(" PowerIteration_Algorithms: "),
│ │ │ │ -
217 blank_(title_.length(),' ')
│ │ │ │ -
218 {
│ │ │ │ -
219 // assert that BCRSMatrix type has blocklevel 2
│ │ │ │ -
220 static_assert
│ │ │ │ -
221 (blockLevel<BCRSMatrix>() == 2,
│ │ │ │ -
222 "Only BCRSMatrices with blocklevel 2 are supported.");
│ │ │ │ -
223
│ │ │ │ -
224 // assert that BCRSMatrix type has square blocks
│ │ │ │ -
225 static_assert
│ │ │ │ -
226 (BCRSMatrix::block_type::rows == BCRSMatrix::block_type::cols,
│ │ │ │ -
227 "Only BCRSMatrices with square blocks are supported.");
│ │ │ │ -
228
│ │ │ │ -
229 // assert that m_ is square
│ │ │ │ -
230 const int nrows = m_.M() * BCRSMatrix::block_type::rows;
│ │ │ │ -
231 const int ncols = m_.N() * BCRSMatrix::block_type::cols;
│ │ │ │ -
232 if (nrows != ncols)
│ │ │ │ -
233 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ -
234 << nrows << "x" << ncols << ").");
│ │ │ │ -
235 }
│ │ │ │ -
│ │ │ │ -
236
│ │ │ │ - │ │ │ │ -
241
│ │ │ │ - │ │ │ │ - │ │ │ │ -
247
│ │ │ │ -
│ │ │ │ -
260 inline void applyPowerIteration (const Real& epsilon,
│ │ │ │ -
261 BlockVector& x, Real& lambda) const
│ │ │ │ -
262 {
│ │ │ │ -
263 // print verbosity information
│ │ │ │ -
264 if (verbosity_level_ > 0)
│ │ │ │ -
265 std::cout << title_
│ │ │ │ -
266 << "Performing power iteration approximating "
│ │ │ │ -
267 << "the dominant eigenvalue." << std::endl;
│ │ │ │ -
268
│ │ │ │ -
269 // allocate memory for auxiliary variables
│ │ │ │ -
270 BlockVector y(x);
│ │ │ │ -
271 BlockVector temp(x);
│ │ │ │ -
272
│ │ │ │ -
273 // perform power iteration
│ │ │ │ -
274 x *= (1.0 / x.two_norm());
│ │ │ │ -
275 m_.mv(x,y);
│ │ │ │ -
276 Real r_norm = std::numeric_limits<Real>::max();
│ │ │ │ -
277 nIterations_ = 0;
│ │ │ │ -
278 while (r_norm > epsilon)
│ │ │ │ -
279 {
│ │ │ │ -
280 // update and check number of iterations
│ │ │ │ - │ │ │ │ -
282 DUNE_THROW(Dune::ISTLError,"Power iteration did not converge "
│ │ │ │ -
283 << "in " << nIterationsMax_ << " iterations "
│ │ │ │ -
284 << "(║residual║_2 = " << r_norm << ", epsilon = "
│ │ │ │ -
285 << epsilon << ").");
│ │ │ │ -
286
│ │ │ │ -
287 // do one iteration of the power iteration algorithm
│ │ │ │ -
288 // (use that y = m_ * x)
│ │ │ │ -
289 x = y;
│ │ │ │ -
290 x *= (1.0 / y.two_norm());
│ │ │ │ -
291
│ │ │ │ -
292 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ -
293 m_.mv(x,y);
│ │ │ │ -
294 lambda = x * y;
│ │ │ │ -
295
│ │ │ │ -
296 // get norm of residual (use that y = m_ * x)
│ │ │ │ -
297 temp = y;
│ │ │ │ -
298 temp.axpy(-lambda,x);
│ │ │ │ -
299 r_norm = temp.two_norm();
│ │ │ │ -
300
│ │ │ │ -
301 // print verbosity information
│ │ │ │ -
302 if (verbosity_level_ > 1)
│ │ │ │ -
303 std::cout << blank_ << std::left
│ │ │ │ -
304 << "iteration " << std::setw(3) << nIterations_
│ │ │ │ -
305 << " (║residual║_2 = " << std::setw(11) << r_norm
│ │ │ │ -
306 << "): λ = " << lambda << std::endl
│ │ │ │ -
307 << std::resetiosflags(std::ios::left);
│ │ │ │ -
308 }
│ │ │ │ -
309
│ │ │ │ -
310 // print verbosity information
│ │ │ │ -
311 if (verbosity_level_ > 0)
│ │ │ │ -
312 {
│ │ │ │ -
313 std::cout << blank_ << "Result ("
│ │ │ │ -
314 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
315 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
316 << "λ = " << lambda << std::endl;
│ │ │ │ -
317 if (verbosity_level_ > 2)
│ │ │ │ -
318 {
│ │ │ │ -
319 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ -
320 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
321 }
│ │ │ │ -
322 }
│ │ │ │ -
323 }
│ │ │ │ -
│ │ │ │ -
324
│ │ │ │ -
353 template <typename ISTLLinearSolver,
│ │ │ │ -
354 bool avoidLinSolverCrime = false>
│ │ │ │ -
│ │ │ │ -
355 inline void applyInverseIteration (const Real& epsilon,
│ │ │ │ -
356 ISTLLinearSolver& solver,
│ │ │ │ -
357 BlockVector& x, Real& lambda) const
│ │ │ │ -
358 {
│ │ │ │ -
359 constexpr Real gamma = 0.0;
│ │ │ │ -
360 applyInverseIteration(gamma,epsilon,solver,x,lambda);
│ │ │ │ -
361 }
│ │ │ │ -
│ │ │ │ -
362
│ │ │ │ -
392 template <typename ISTLLinearSolver,
│ │ │ │ -
393 bool avoidLinSolverCrime = false>
│ │ │ │ -
│ │ │ │ -
394 inline void applyInverseIteration (const Real& gamma,
│ │ │ │ -
395 const Real& epsilon,
│ │ │ │ -
396 ISTLLinearSolver& solver,
│ │ │ │ -
397 BlockVector& x, Real& lambda) const
│ │ │ │ -
398 {
│ │ │ │ -
399 // print verbosity information
│ │ │ │ -
400 if (verbosity_level_ > 0)
│ │ │ │ -
401 {
│ │ │ │ -
402 std::cout << title_;
│ │ │ │ -
403 if (gamma == 0.0)
│ │ │ │ -
404 std::cout << "Performing inverse iteration approximating "
│ │ │ │ -
405 << "the least dominant eigenvalue." << std::endl;
│ │ │ │ -
406 else
│ │ │ │ -
407 std::cout << "Performing inverse iteration with shift "
│ │ │ │ -
408 << "gamma = " << gamma << " approximating the "
│ │ │ │ -
409 << "eigenvalue closest to gamma." << std::endl;
│ │ │ │ -
410 }
│ │ │ │ -
411
│ │ │ │ -
412 // initialize iteration operator,
│ │ │ │ -
413 // initialize iteration matrix when needed
│ │ │ │ -
414 updateShiftMu(gamma,solver);
│ │ │ │ -
415
│ │ │ │ -
416 // allocate memory for linear solver statistics
│ │ │ │ -
417 Dune::InverseOperatorResult solver_statistics;
│ │ │ │ -
418
│ │ │ │ -
419 // allocate memory for auxiliary variables
│ │ │ │ -
420 BlockVector y(x);
│ │ │ │ -
421 Real y_norm;
│ │ │ │ -
422 BlockVector temp(x);
│ │ │ │ -
423
│ │ │ │ -
424 // perform inverse iteration with shift
│ │ │ │ -
425 x *= (1.0 / x.two_norm());
│ │ │ │ -
426 Real r_norm = std::numeric_limits<Real>::max();
│ │ │ │ -
427 nIterations_ = 0;
│ │ │ │ -
428 while (r_norm > epsilon)
│ │ │ │ -
429 {
│ │ │ │ -
430 // update and check number of iterations
│ │ │ │ - │ │ │ │ -
432 DUNE_THROW(Dune::ISTLError,"Inverse iteration "
│ │ │ │ -
433 << (gamma != 0.0 ? "with shift " : "") << "did not "
│ │ │ │ -
434 << "converge in " << nIterationsMax_ << " iterations "
│ │ │ │ -
435 << "(║residual║_2 = " << r_norm << ", epsilon = "
│ │ │ │ -
436 << epsilon << ").");
│ │ │ │ -
437
│ │ │ │ -
438 // do one iteration of the inverse iteration with shift algorithm,
│ │ │ │ -
439 // part 1: solve (m_ - gamma*I) * y = x for y
│ │ │ │ -
440 // (protect x from being changed)
│ │ │ │ -
441 temp = x;
│ │ │ │ -
442 solver.apply(y,temp,solver_statistics);
│ │ │ │ -
443
│ │ │ │ -
444 // get norm of y
│ │ │ │ -
445 y_norm = y.two_norm();
│ │ │ │ -
446
│ │ │ │ -
447 // compile time switch between accuracy and efficiency
│ │ │ │ -
448 if (avoidLinSolverCrime)
│ │ │ │ -
449 {
│ │ │ │ -
450 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ -
451 // (use that x_new = y / y_norm)
│ │ │ │ -
452 m_.mv(y,temp);
│ │ │ │ -
453 lambda = (y * temp) / (y_norm * y_norm);
│ │ │ │ -
454
│ │ │ │ -
455 // get norm of residual
│ │ │ │ -
456 // (use that x_new = y / y_norm, additionally use that temp = m_ * y)
│ │ │ │ -
457 temp.axpy(-lambda,y);
│ │ │ │ -
458 r_norm = temp.two_norm() / y_norm;
│ │ │ │ -
459 }
│ │ │ │ -
460 else
│ │ │ │ -
461 {
│ │ │ │ -
462 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ -
463 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x)
│ │ │ │ -
464 lambda = gamma + (y * x) / (y_norm * y_norm);
│ │ │ │ -
465
│ │ │ │ -
466 // get norm of residual
│ │ │ │ -
467 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x)
│ │ │ │ -
468 temp = x; temp.axpy(gamma-lambda,y);
│ │ │ │ -
469 r_norm = temp.two_norm() / y_norm;
│ │ │ │ -
470 }
│ │ │ │ -
471
│ │ │ │ -
472 // do one iteration of the inverse iteration with shift algorithm,
│ │ │ │ -
473 // part 2: update x
│ │ │ │ -
474 x = y;
│ │ │ │ -
475 x *= (1.0 / y_norm);
│ │ │ │ -
476
│ │ │ │ -
477 // print verbosity information
│ │ │ │ -
478 if (verbosity_level_ > 1)
│ │ │ │ -
479 std::cout << blank_ << std::left
│ │ │ │ -
480 << "iteration " << std::setw(3) << nIterations_
│ │ │ │ -
481 << " (║residual║_2 = " << std::setw(11) << r_norm
│ │ │ │ -
482 << "): λ = " << lambda << std::endl
│ │ │ │ -
483 << std::resetiosflags(std::ios::left);
│ │ │ │ -
484 }
│ │ │ │ -
485
│ │ │ │ -
486 // print verbosity information
│ │ │ │ -
487 if (verbosity_level_ > 0)
│ │ │ │ -
488 {
│ │ │ │ -
489 std::cout << blank_ << "Result ("
│ │ │ │ -
490 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
491 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
492 << "λ = " << lambda << std::endl;
│ │ │ │ -
493 if (verbosity_level_ > 2)
│ │ │ │ -
494 {
│ │ │ │ -
495 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ -
496 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
497 }
│ │ │ │ -
498 }
│ │ │ │ -
499 }
│ │ │ │ -
│ │ │ │ -
500
│ │ │ │ -
531 template <typename ISTLLinearSolver,
│ │ │ │ -
532 bool avoidLinSolverCrime = false>
│ │ │ │ -
│ │ │ │ -
533 inline void applyRayleighQuotientIteration (const Real& epsilon,
│ │ │ │ -
534 ISTLLinearSolver& solver,
│ │ │ │ -
535 BlockVector& x, Real& lambda) const
│ │ │ │ -
536 {
│ │ │ │ -
537 // print verbosity information
│ │ │ │ -
538 if (verbosity_level_ > 0)
│ │ │ │ -
539 std::cout << title_
│ │ │ │ -
540 << "Performing Rayleigh quotient iteration for "
│ │ │ │ -
541 << "estimated eigenvalue " << lambda << "." << std::endl;
│ │ │ │ +
│ │ │ │ +
111 AMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ │ +
112 const SmootherArgs& smootherArgs, const Parameters& parms);
│ │ │ │ +
113
│ │ │ │ +
125 template<class C>
│ │ │ │ +
│ │ │ │ +
126 AMG(const Operator& fineOperator, const C& criterion,
│ │ │ │ +
127 const SmootherArgs& smootherArgs=SmootherArgs(),
│ │ │ │ + │ │ │ │ +
129
│ │ │ │ +
│ │ │ │ +
180 AMG(std::shared_ptr<const Operator> fineOperator, const ParameterTree& configuration, const ParallelInformation& pinfo=ParallelInformation());
│ │ │ │ +
181
│ │ │ │ +
│ │ │ │ +
185 AMG(const AMG& amg);
│ │ │ │ +
186
│ │ │ │ +
│ │ │ │ +
188 void pre(Domain& x, Range& b);
│ │ │ │ +
189
│ │ │ │ +
│ │ │ │ +
191 void apply(Domain& v, const Range& d);
│ │ │ │ +
192
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
195 {
│ │ │ │ +
196 return category_;
│ │ │ │ +
197 }
│ │ │ │ +
│ │ │ │ +
198
│ │ │ │ +
│ │ │ │ +
200 void post(Domain& x);
│ │ │ │ +
201
│ │ │ │ +
206 template<class A1>
│ │ │ │ +
│ │ │ │ +
207 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ │ +
208
│ │ │ │ +
│ │ │ │ +
209 std::size_t levels();
│ │ │ │ +
210
│ │ │ │ +
│ │ │ │ +
211 std::size_t maxlevels();
│ │ │ │ +
212
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
222 {
│ │ │ │ +
223 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ │ +
224 }
│ │ │ │ +
│ │ │ │ +
225
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
231
│ │ │ │ +
232 private:
│ │ │ │ +
233 /*
│ │ │ │ +
234 * @brief Helper function to create hierarchies with parameter tree.
│ │ │ │ +
235 *
│ │ │ │ +
236 * Will create the coarsen criterion with the norm and create the
│ │ │ │ +
237 * Hierarchies
│ │ │ │ +
238 * \tparam Norm Type of the norm to use.
│ │ │ │ +
239 */
│ │ │ │ +
240 template<class Norm>
│ │ │ │ +
241 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ │ +
242 const PI& pinfo, const Norm&,
│ │ │ │ +
243 const ParameterTree& configuration,
│ │ │ │ +
244 std::true_type compiles = std::true_type());
│ │ │ │ +
245 template<class Norm>
│ │ │ │ +
246 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ │ +
247 const PI& pinfo, const Norm&,
│ │ │ │ +
248 const ParameterTree& configuration,
│ │ │ │ +
249 std::false_type);
│ │ │ │ +
254 template<class C>
│ │ │ │ +
255 void createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr,
│ │ │ │ +
256 const PI& pinfo, const ParameterTree& configuration);
│ │ │ │ +
263 template<class C>
│ │ │ │ +
264 void createHierarchies(C& criterion,
│ │ │ │ +
265 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ +
266 const PI& pinfo);
│ │ │ │ +
273 struct LevelContext
│ │ │ │ +
274 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
283 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ │ + │ │ │ │ +
291 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ │ +
295 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
311 std::size_t level;
│ │ │ │ +
312 };
│ │ │ │ +
313
│ │ │ │ +
314
│ │ │ │ +
319 void mgc(LevelContext& levelContext);
│ │ │ │ +
320
│ │ │ │ +
321 void additiveMgc();
│ │ │ │ +
322
│ │ │ │ +
329 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel);
│ │ │ │ +
330
│ │ │ │ +
335 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ │ +
336
│ │ │ │ +
341 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ │ +
342
│ │ │ │ +
344 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ │ +
346 SmootherArgs smootherArgs_;
│ │ │ │ +
348 std::shared_ptr<Hierarchy<Smoother,A> > smoothers_;
│ │ │ │ +
350 std::shared_ptr<CoarseSolver> solver_;
│ │ │ │ +
352 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ │ +
354 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ │ +
356 std::shared_ptr<Hierarchy<Domain,A>> update_;
│ │ │ │ + │ │ │ │ +
360 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ │ +
362 std::size_t gamma_;
│ │ │ │ +
364 std::size_t preSteps_;
│ │ │ │ +
366 std::size_t postSteps_;
│ │ │ │ +
367 bool buildHierarchy_;
│ │ │ │ +
368 bool additive;
│ │ │ │ +
369 bool coarsesolverconverged;
│ │ │ │ +
370 std::shared_ptr<Smoother> coarseSmoother_;
│ │ │ │ +
372 SolverCategory::Category category_;
│ │ │ │ +
374 std::size_t verbosity_;
│ │ │ │ +
375
│ │ │ │ +
376 struct ToLower
│ │ │ │ +
377 {
│ │ │ │ +
│ │ │ │ +
378 std::string operator()(const std::string& str)
│ │ │ │ +
379 {
│ │ │ │ +
380 std::stringstream retval;
│ │ │ │ +
381 std::ostream_iterator<char> out(retval);
│ │ │ │ +
382 std::transform(str.begin(), str.end(), out,
│ │ │ │ +
383 [](char c){
│ │ │ │ +
384 return std::tolower(c, std::locale::classic());
│ │ │ │ +
385 });
│ │ │ │ +
386 return retval.str();
│ │ │ │ +
387 }
│ │ │ │ +
│ │ │ │ +
388 };
│ │ │ │ +
389 };
│ │ │ │ +
390
│ │ │ │ +
391 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ +
392 inline AMG<M,X,S,PI,A>::AMG(const AMG& amg)
│ │ │ │ +
393 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_),
│ │ │ │ +
394 smoothers_(amg.smoothers_), solver_(amg.solver_),
│ │ │ │ +
395 rhs_(), lhs_(), update_(),
│ │ │ │ +
396 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_),
│ │ │ │ +
397 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ │ +
398 buildHierarchy_(amg.buildHierarchy_),
│ │ │ │ +
399 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ │ +
400 coarseSmoother_(amg.coarseSmoother_),
│ │ │ │ +
401 category_(amg.category_),
│ │ │ │ +
402 verbosity_(amg.verbosity_)
│ │ │ │ +
403 {}
│ │ │ │ +
│ │ │ │ +
404
│ │ │ │ +
405 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
407 const SmootherArgs& smootherArgs,
│ │ │ │ +
408 const Parameters& parms)
│ │ │ │ +
409 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_(smootherArgs),
│ │ │ │ +
410 smoothers_(new Hierarchy<Smoother,A>), solver_(&coarseSolver),
│ │ │ │ +
411 rhs_(), lhs_(), update_(), scalarProduct_(0),
│ │ │ │ +
412 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ │ +
413 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ │ +
414 additive(parms.getAdditive()), coarsesolverconverged(true),
│ │ │ │ +
415 coarseSmoother_(),
│ │ │ │ +
416// #warning should category be retrieved from matrices?
│ │ │ │ +
417 category_(SolverCategory::category(*smoothers_->coarsest())),
│ │ │ │ +
418 verbosity_(parms.debugLevel())
│ │ │ │ +
419 {
│ │ │ │ +
420 assert(matrices_->isBuilt());
│ │ │ │ +
421
│ │ │ │ +
422 // build the necessary smoother hierarchies
│ │ │ │ +
423 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ │ +
424 }
│ │ │ │ +
│ │ │ │ +
425
│ │ │ │ +
426 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
427 template<class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
429 const C& criterion,
│ │ │ │ +
430 const SmootherArgs& smootherArgs,
│ │ │ │ +
431 const PI& pinfo)
│ │ │ │ +
432 : smootherArgs_(smootherArgs),
│ │ │ │ +
433 smoothers_(new Hierarchy<Smoother,A>), solver_(),
│ │ │ │ +
434 rhs_(), lhs_(), update_(), scalarProduct_(),
│ │ │ │ +
435 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()),
│ │ │ │ +
436 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true),
│ │ │ │ +
437 additive(criterion.getAdditive()), coarsesolverconverged(true),
│ │ │ │ +
438 coarseSmoother_(),
│ │ │ │ +
439 category_(SolverCategory::category(pinfo)),
│ │ │ │ +
440 verbosity_(criterion.debugLevel())
│ │ │ │ +
441 {
│ │ │ │ + │ │ │ │ +
443 DUNE_THROW(InvalidSolverCategory, "Matrix and Communication must have the same SolverCategory!");
│ │ │ │ +
444 // TODO: reestablish compile time checks.
│ │ │ │ +
445 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ │ +
446 // "Matrix and Solver must match in terms of category!");
│ │ │ │ +
447 auto matrixptr = stackobject_to_shared_ptr(matrix);
│ │ │ │ +
448 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ │ +
449 }
│ │ │ │ +
│ │ │ │ +
450
│ │ │ │ +
451 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ +
452 AMG<M,X,S,PI,A>::AMG(std::shared_ptr<const Operator> matrixptr,
│ │ │ │ +
453 const ParameterTree& configuration,
│ │ │ │ +
454 const ParallelInformation& pinfo) :
│ │ │ │ +
455 smoothers_(new Hierarchy<Smoother,A>),
│ │ │ │ +
456 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_(true),
│ │ │ │ +
457 coarsesolverconverged(true), coarseSmoother_(),
│ │ │ │ +
458 category_(SolverCategory::category(pinfo))
│ │ │ │ +
459 {
│ │ │ │ +
460
│ │ │ │ +
461 if (configuration.hasKey ("smootherIterations"))
│ │ │ │ +
462 smootherArgs_.iterations = configuration.get<int>("smootherIterations");
│ │ │ │ +
463
│ │ │ │ +
464 if (configuration.hasKey ("smootherRelaxation"))
│ │ │ │ +
465 smootherArgs_.relaxationFactor = configuration.get<typename SmootherArgs::RelaxationFactor>("smootherRelaxation");
│ │ │ │ +
466
│ │ │ │ +
467 auto normName = ToLower()(configuration.get("strengthMeasure", "diagonal"));
│ │ │ │ +
468 auto index = configuration.get<int>("diagonalRowIndex", 0);
│ │ │ │ +
469
│ │ │ │ +
470 if ( normName == "diagonal")
│ │ │ │ +
471 {
│ │ │ │ +
472 using field_type = typename M::field_type;
│ │ │ │ +
473 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
474 std::is_convertible<field_type, real_type> compiles;
│ │ │ │ +
475
│ │ │ │ +
476 switch (index)
│ │ │ │ +
477 {
│ │ │ │ +
478 case 0:
│ │ │ │ +
479 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<0>(), configuration, compiles);
│ │ │ │ +
480 break;
│ │ │ │ +
481 case 1:
│ │ │ │ +
482 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<1>(), configuration, compiles);
│ │ │ │ +
483 break;
│ │ │ │ +
484 case 2:
│ │ │ │ +
485 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<2>(), configuration, compiles);
│ │ │ │ +
486 break;
│ │ │ │ +
487 case 3:
│ │ │ │ +
488 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<3>(), configuration, compiles);
│ │ │ │ +
489 break;
│ │ │ │ +
490 case 4:
│ │ │ │ +
491 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<4>(), configuration, compiles);
│ │ │ │ +
492 break;
│ │ │ │ +
493 default:
│ │ │ │ +
494 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not supported.");
│ │ │ │ +
495 }
│ │ │ │ +
496 }
│ │ │ │ +
497 else if (normName == "rowsum")
│ │ │ │ +
498 createCriterionAndHierarchies(matrixptr, pinfo, RowSum(), configuration);
│ │ │ │ +
499 else if (normName == "frobenius")
│ │ │ │ +
500 createCriterionAndHierarchies(matrixptr, pinfo, FrobeniusNorm(), configuration);
│ │ │ │ +
501 else if (normName == "one")
│ │ │ │ +
502 createCriterionAndHierarchies(matrixptr, pinfo, AlwaysOneNorm(), configuration);
│ │ │ │ +
503 else
│ │ │ │ +
504 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure "<<normName<<" is not supported by AMG");
│ │ │ │ +
505 }
│ │ │ │ +
│ │ │ │ +
506
│ │ │ │ +
507 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
508 template<class Norm>
│ │ │ │ +
509 void AMG<M,X,S,PI,A>::createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const Norm&, const ParameterTree& configuration, std::false_type)
│ │ │ │ +
510 {
│ │ │ │ +
511 DUNE_THROW(InvalidStateException, "Strength of connection measure does not support this type ("
│ │ │ │ +
512 << className<typename M::field_type>() << ") as it is lacking a conversion to"
│ │ │ │ +
513 << className<typename FieldTraits<typename M::field_type>::real_type>() << ".");
│ │ │ │ +
514 }
│ │ │ │ +
515
│ │ │ │ +
516 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
517 template<class Norm>
│ │ │ │ +
518 void AMG<M,X,S,PI,A>::createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const Norm&, const ParameterTree& configuration, std::true_type)
│ │ │ │ +
519 {
│ │ │ │ +
520 if (configuration.get<bool>("criterionSymmetric", true))
│ │ │ │ +
521 {
│ │ │ │ +
522 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ │ + │ │ │ │ +
524 Criterion criterion;
│ │ │ │ +
525 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ │ +
526 }
│ │ │ │ +
527 else
│ │ │ │ +
528 {
│ │ │ │ +
529 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ │ + │ │ │ │ +
531 Criterion criterion;
│ │ │ │ +
532 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ │ +
533 }
│ │ │ │ +
534 }
│ │ │ │ +
535
│ │ │ │ +
536 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
537 template<class C>
│ │ │ │ +
538 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const ParameterTree& configuration)
│ │ │ │ +
539 {
│ │ │ │ +
540 if (configuration.hasKey ("maxLevel"))
│ │ │ │ +
541 criterion.setMaxLevel(configuration.get<int>("maxLevel"));
│ │ │ │
542
│ │ │ │ -
543 // allocate memory for linear solver statistics
│ │ │ │ -
544 Dune::InverseOperatorResult solver_statistics;
│ │ │ │ +
543 if (configuration.hasKey ("minCoarseningRate"))
│ │ │ │ +
544 criterion.setMinCoarsenRate(configuration.get<int>("minCoarseningRate"));
│ │ │ │
545
│ │ │ │ -
546 // allocate memory for auxiliary variables
│ │ │ │ -
547 BlockVector y(x);
│ │ │ │ -
548 Real y_norm;
│ │ │ │ -
549 Real lambda_update;
│ │ │ │ -
550 BlockVector temp(x);
│ │ │ │ -
551
│ │ │ │ -
552 // perform Rayleigh quotient iteration
│ │ │ │ -
553 x *= (1.0 / x.two_norm());
│ │ │ │ -
554 Real r_norm = std::numeric_limits<Real>::max();
│ │ │ │ -
555 nIterations_ = 0;
│ │ │ │ -
556 while (r_norm > epsilon)
│ │ │ │ -
557 {
│ │ │ │ -
558 // update and check number of iterations
│ │ │ │ - │ │ │ │ -
560 DUNE_THROW(Dune::ISTLError,"Rayleigh quotient iteration did not "
│ │ │ │ -
561 << "converge in " << nIterationsMax_ << " iterations "
│ │ │ │ -
562 << "(║residual║_2 = " << r_norm << ", epsilon = "
│ │ │ │ -
563 << epsilon << ").");
│ │ │ │ -
564
│ │ │ │ -
565 // update iteration operator,
│ │ │ │ -
566 // update iteration matrix when needed
│ │ │ │ -
567 updateShiftMu(lambda,solver);
│ │ │ │ -
568
│ │ │ │ -
569 // do one iteration of the Rayleigh quotient iteration algorithm,
│ │ │ │ -
570 // part 1: solve (m_ - lambda*I) * y = x for y
│ │ │ │ -
571 // (protect x from being changed)
│ │ │ │ -
572 temp = x;
│ │ │ │ -
573 solver.apply(y,temp,solver_statistics);
│ │ │ │ -
574
│ │ │ │ -
575 // get norm of y
│ │ │ │ -
576 y_norm = y.two_norm();
│ │ │ │ -
577
│ │ │ │ -
578 // compile time switch between accuracy and efficiency
│ │ │ │ -
579 if (avoidLinSolverCrime)
│ │ │ │ -
580 {
│ │ │ │ -
581 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ -
582 // (use that x_new = y / y_norm)
│ │ │ │ -
583 m_.mv(y,temp);
│ │ │ │ -
584 lambda = (y * temp) / (y_norm * y_norm);
│ │ │ │ -
585
│ │ │ │ -
586 // get norm of residual
│ │ │ │ -
587 // (use that x_new = y / y_norm, additionally use that temp = m_ * y)
│ │ │ │ -
588 temp.axpy(-lambda,y);
│ │ │ │ -
589 r_norm = temp.two_norm() / y_norm;
│ │ │ │ -
590 }
│ │ │ │ -
591 else
│ │ │ │ -
592 {
│ │ │ │ -
593 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ -
594 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x)
│ │ │ │ -
595 lambda_update = (y * x) / (y_norm * y_norm);
│ │ │ │ -
596 lambda += lambda_update;
│ │ │ │ -
597
│ │ │ │ -
598 // get norm of residual
│ │ │ │ -
599 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x)
│ │ │ │ -
600 temp = x; temp.axpy(-lambda_update,y);
│ │ │ │ -
601 r_norm = temp.two_norm() / y_norm;
│ │ │ │ -
602 }
│ │ │ │ +
546 if (configuration.hasKey ("coarsenTarget"))
│ │ │ │ +
547 criterion.setCoarsenTarget (configuration.get<int>("coarsenTarget"));
│ │ │ │ +
548
│ │ │ │ +
549 if (configuration.hasKey ("accumulationMode"))
│ │ │ │ +
550 {
│ │ │ │ +
551 std::string mode = ToLower()(configuration.get<std::string>("accumulationMode"));
│ │ │ │ +
552 if ( mode == "none")
│ │ │ │ +
553 criterion.setAccumulate(AccumulationMode::noAccu);
│ │ │ │ +
554 else if ( mode == "atonce" )
│ │ │ │ +
555 criterion.setAccumulate(AccumulationMode::atOnceAccu);
│ │ │ │ +
556 else if ( mode == "successive")
│ │ │ │ +
557 criterion.setCoarsenTarget (AccumulationMode::successiveAccu);
│ │ │ │ +
558 else
│ │ │ │ +
559 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ │ +
560 << mode <<".");
│ │ │ │ +
561 }
│ │ │ │ +
562
│ │ │ │ +
563 if (configuration.hasKey ("prolongationDampingFactor"))
│ │ │ │ +
564 criterion.setProlongationDampingFactor (configuration.get<double>("prolongationDampingFactor"));
│ │ │ │ +
565
│ │ │ │ +
566 if (configuration.hasKey("defaultAggregationSizeMode"))
│ │ │ │ +
567 {
│ │ │ │ +
568 auto mode = ToLower()(configuration.get<std::string>("defaultAggregationSizeMode"));
│ │ │ │ +
569 auto dim = configuration.get<std::size_t>("defaultAggregationDimension");
│ │ │ │ +
570 std::size_t maxDistance = 2;
│ │ │ │ +
571 if (configuration.hasKey("MaxAggregateDistance"))
│ │ │ │ +
572 maxDistance = configuration.get<std::size_t>("maxAggregateDistance");
│ │ │ │ +
573 if (mode == "isotropic")
│ │ │ │ +
574 criterion.setDefaultValuesIsotropic(dim, maxDistance);
│ │ │ │ +
575 else if(mode == "anisotropic")
│ │ │ │ +
576 criterion.setDefaultValuesAnisotropic(dim, maxDistance);
│ │ │ │ +
577 else
│ │ │ │ +
578 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ │ +
579 << mode <<".");
│ │ │ │ +
580 }
│ │ │ │ +
581
│ │ │ │ +
582 if (configuration.hasKey("maxAggregateDistance"))
│ │ │ │ +
583 criterion.setMaxDistance(configuration.get<std::size_t>("maxAggregateDistance"));
│ │ │ │ +
584
│ │ │ │ +
585 if (configuration.hasKey("minAggregateSize"))
│ │ │ │ +
586 criterion.setMinAggregateSize(configuration.get<std::size_t>("minAggregateSize"));
│ │ │ │ +
587
│ │ │ │ +
588 if (configuration.hasKey("maxAggregateSize"))
│ │ │ │ +
589 criterion.setMaxAggregateSize(configuration.get<std::size_t>("maxAggregateSize"));
│ │ │ │ +
590
│ │ │ │ +
591 if (configuration.hasKey("maxAggregateConnectivity"))
│ │ │ │ +
592 criterion.setMaxConnectivity(configuration.get<std::size_t>("maxAggregateConnectivity"));
│ │ │ │ +
593
│ │ │ │ +
594 if (configuration.hasKey ("alpha"))
│ │ │ │ +
595 criterion.setAlpha (configuration.get<double> ("alpha"));
│ │ │ │ +
596
│ │ │ │ +
597 if (configuration.hasKey ("beta"))
│ │ │ │ +
598 criterion.setBeta (configuration.get<double> ("beta"));
│ │ │ │ +
599
│ │ │ │ +
600 if (configuration.hasKey ("gamma"))
│ │ │ │ +
601 criterion.setGamma (configuration.get<std::size_t> ("gamma"));
│ │ │ │ +
602 gamma_ = criterion.getGamma();
│ │ │ │
603
│ │ │ │ -
604 // do one iteration of the Rayleigh quotient iteration algorithm,
│ │ │ │ -
605 // part 2: update x
│ │ │ │ -
606 x = y;
│ │ │ │ -
607 x *= (1.0 / y_norm);
│ │ │ │ -
608
│ │ │ │ -
609 // print verbosity information
│ │ │ │ -
610 if (verbosity_level_ > 1)
│ │ │ │ -
611 std::cout << blank_ << std::left
│ │ │ │ -
612 << "iteration " << std::setw(3) << nIterations_
│ │ │ │ -
613 << " (║residual║_2 = " << std::setw(11) << r_norm
│ │ │ │ -
614 << "): λ = " << lambda << std::endl
│ │ │ │ -
615 << std::resetiosflags(std::ios::left);
│ │ │ │ -
616 }
│ │ │ │ -
617
│ │ │ │ -
618 // print verbosity information
│ │ │ │ -
619 if (verbosity_level_ > 0)
│ │ │ │ -
620 {
│ │ │ │ -
621 std::cout << blank_ << "Result ("
│ │ │ │ -
622 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
623 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
624 << "λ = " << lambda << std::endl;
│ │ │ │ -
625 if (verbosity_level_ > 2)
│ │ │ │ -
626 {
│ │ │ │ -
627 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ -
628 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
629 }
│ │ │ │ -
630 }
│ │ │ │ -
631 }
│ │ │ │ -
│ │ │ │ -
632
│ │ │ │ -
689 template <typename ISTLLinearSolver,
│ │ │ │ -
690 bool avoidLinSolverCrime = false>
│ │ │ │ -
│ │ │ │ -
691 inline void applyTLIMEIteration (const Real& gamma, const Real& eta,
│ │ │ │ -
692 const Real& epsilon,
│ │ │ │ -
693 ISTLLinearSolver& solver,
│ │ │ │ -
694 const Real& delta, const std::size_t& m,
│ │ │ │ -
695 bool& extrnl,
│ │ │ │ -
696 BlockVector& x, Real& lambda) const
│ │ │ │ -
697 {
│ │ │ │ -
698 // use same variable names as in [Szyld, 1988]
│ │ │ │ -
699 BlockVector& x_s = x;
│ │ │ │ -
700 Real& mu_s = lambda;
│ │ │ │ -
701
│ │ │ │ -
702 // print verbosity information
│ │ │ │ -
703 if (verbosity_level_ > 0)
│ │ │ │ -
704 std::cout << title_
│ │ │ │ -
705 << "Performing TLIME iteration for "
│ │ │ │ -
706 << "estimated eigenvalue in the "
│ │ │ │ -
707 << "interval (" << gamma - eta << ","
│ │ │ │ -
708 << gamma + eta << ")." << std::endl;
│ │ │ │ -
709
│ │ │ │ -
710 // allocate memory for linear solver statistics
│ │ │ │ -
711 Dune::InverseOperatorResult solver_statistics;
│ │ │ │ -
712
│ │ │ │ -
713 // allocate memory for auxiliary variables
│ │ │ │ -
714 bool doRQI;
│ │ │ │ -
715 Real mu;
│ │ │ │ -
716 BlockVector y(x_s);
│ │ │ │ -
717 Real omega;
│ │ │ │ -
718 Real mu_s_old;
│ │ │ │ -
719 Real mu_s_update;
│ │ │ │ -
720 BlockVector temp(x_s);
│ │ │ │ -
721 Real q_norm, r_norm;
│ │ │ │ -
722
│ │ │ │ -
723 // perform TLIME iteration
│ │ │ │ -
724 x_s *= (1.0 / x_s.two_norm());
│ │ │ │ -
725 extrnl = true;
│ │ │ │ -
726 doRQI = false;
│ │ │ │ -
727 r_norm = std::numeric_limits<Real>::max();
│ │ │ │ -
728 nIterations_ = 0;
│ │ │ │ -
729 while (r_norm > epsilon)
│ │ │ │ -
730 {
│ │ │ │ -
731 // update and check number of iterations
│ │ │ │ - │ │ │ │ -
733 DUNE_THROW(Dune::ISTLError,"TLIME iteration did not "
│ │ │ │ -
734 << "converge in " << nIterationsMax_
│ │ │ │ -
735 << " iterations (║residual║_2 = " << r_norm
│ │ │ │ -
736 << ", epsilon = " << epsilon << ").");
│ │ │ │ -
737
│ │ │ │ -
738 // set shift for next iteration according to inverse iteration
│ │ │ │ -
739 // with shift (II) resp. Rayleigh quotient iteration (RQI)
│ │ │ │ -
740 if (doRQI)
│ │ │ │ -
741 mu = mu_s;
│ │ │ │ -
742 else
│ │ │ │ -
743 mu = gamma;
│ │ │ │ -
744
│ │ │ │ -
745 // update II/RQI iteration operator,
│ │ │ │ -
746 // update II/RQI iteration matrix when needed
│ │ │ │ -
747 updateShiftMu(mu,solver);
│ │ │ │ -
748
│ │ │ │ -
749 // do one iteration of the II/RQI algorithm,
│ │ │ │ -
750 // part 1: solve (m_ - mu*I) * y = x for y
│ │ │ │ -
751 temp = x_s;
│ │ │ │ -
752 solver.apply(y,temp,solver_statistics);
│ │ │ │ -
753
│ │ │ │ -
754 // do one iteration of the II/RQI algorithm,
│ │ │ │ -
755 // part 2: compute omega
│ │ │ │ -
756 omega = (1.0 / y.two_norm());
│ │ │ │ -
757
│ │ │ │ -
758 // backup the old Rayleigh quotient
│ │ │ │ -
759 mu_s_old = mu_s;
│ │ │ │ -
760
│ │ │ │ -
761 // compile time switch between accuracy and efficiency
│ │ │ │ -
762 if (avoidLinSolverCrime)
│ │ │ │ -
763 {
│ │ │ │ -
764 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue
│ │ │ │ -
765 // (use that x_new = y * omega)
│ │ │ │ -
766 m_.mv(y,temp);
│ │ │ │ -
767 mu_s = (y * temp) * (omega * omega);
│ │ │ │ -
768
│ │ │ │ -
769 // get norm of "the residual with respect to the shift used by II",
│ │ │ │ -
770 // use normal representation of q
│ │ │ │ -
771 // (use that x_new = y * omega, use that temp = m_ * y)
│ │ │ │ -
772 temp.axpy(-gamma,y);
│ │ │ │ -
773 q_norm = temp.two_norm() * omega;
│ │ │ │ -
774
│ │ │ │ -
775 // get norm of "the residual with respect to the Rayleigh quotient"
│ │ │ │ -
776 r_norm = q_norm*q_norm - (gamma-mu_s)*(gamma-mu_s);
│ │ │ │ -
777 // prevent that truncation errors invalidate the norm
│ │ │ │ -
778 // (we don't want to calculate sqrt of a negative number)
│ │ │ │ -
779 if (r_norm >= 0)
│ │ │ │ -
780 {
│ │ │ │ -
781 // use relation between the norms of r and q for efficiency
│ │ │ │ -
782 r_norm = std::sqrt(r_norm);
│ │ │ │ -
783 }
│ │ │ │ -
784 else
│ │ │ │ -
785 {
│ │ │ │ -
786 // use relation between r and q
│ │ │ │ -
787 // (use that x_new = y * omega, use that temp = (m_ - gamma*I) * y = q / omega)
│ │ │ │ -
788 temp.axpy(gamma-mu_s,y);
│ │ │ │ -
789 r_norm = temp.two_norm() * omega;
│ │ │ │ +
604 if (configuration.hasKey ("additive"))
│ │ │ │ +
605 criterion.setAdditive (configuration.get<bool>("additive"));
│ │ │ │ +
606 additive = criterion.getAdditive();
│ │ │ │ +
607
│ │ │ │ +
608 if (configuration.hasKey ("preSteps"))
│ │ │ │ +
609 criterion.setNoPreSmoothSteps (configuration.get<std::size_t> ("preSteps"));
│ │ │ │ +
610 preSteps_ = criterion.getNoPreSmoothSteps ();
│ │ │ │ +
611
│ │ │ │ +
612 if (configuration.hasKey ("postSteps"))
│ │ │ │ +
613 criterion.setNoPostSmoothSteps (configuration.get<std::size_t> ("postSteps"));
│ │ │ │ +
614 postSteps_ = criterion.getNoPostSmoothSteps ();
│ │ │ │ +
615
│ │ │ │ +
616 verbosity_ = configuration.get("verbosity", 0);
│ │ │ │ +
617 criterion.setDebugLevel (verbosity_);
│ │ │ │ +
618
│ │ │ │ +
619 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ │ +
620 }
│ │ │ │ +
621
│ │ │ │ +
622 template <class Matrix,
│ │ │ │ +
623 class Vector>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
625 {
│ │ │ │ +
626 typedef typename Matrix :: field_type field_type;
│ │ │ │ + │ │ │ │ +
628
│ │ │ │ +
629 static constexpr SolverType solver =
│ │ │ │ +
630#if DISABLE_AMG_DIRECTSOLVER
│ │ │ │ +
631 none;
│ │ │ │ +
632#elif HAVE_SUITESPARSE_UMFPACK
│ │ │ │ + │ │ │ │ +
634#elif HAVE_SUPERLU
│ │ │ │ +
635 superlu ;
│ │ │ │ +
636#else
│ │ │ │ +
637 none;
│ │ │ │ +
638#endif
│ │ │ │ +
639
│ │ │ │ +
640 template <class M, SolverType>
│ │ │ │ +
│ │ │ │ +
641 struct Solver
│ │ │ │ +
642 {
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
644 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ │ +
645 {
│ │ │ │ +
646 DUNE_THROW(NotImplemented,"DirectSolver not selected");
│ │ │ │ +
647 return nullptr;
│ │ │ │ +
648 }
│ │ │ │ +
│ │ │ │ +
649 static std::string name () { return "None"; }
│ │ │ │ +
650 };
│ │ │ │ +
│ │ │ │ +
651#if HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
652 template <class M>
│ │ │ │ +
653 struct Solver< M, umfpack >
│ │ │ │ +
654 {
│ │ │ │ +
655 typedef UMFPack< M > type;
│ │ │ │ +
656 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ │ +
657 {
│ │ │ │ +
658 return new type(mat, verbose, reusevector );
│ │ │ │ +
659 }
│ │ │ │ +
660 static std::string name () { return "UMFPack"; }
│ │ │ │ +
661 };
│ │ │ │ +
662#endif
│ │ │ │ +
663#if HAVE_SUPERLU
│ │ │ │ +
664 template <class M>
│ │ │ │ +
│ │ │ │ +
665 struct Solver< M, superlu >
│ │ │ │ +
666 {
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
668 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ │ +
669 {
│ │ │ │ +
670 return new type(mat, verbose, reusevector );
│ │ │ │ +
671 }
│ │ │ │ +
│ │ │ │ +
672 static std::string name () { return "SuperLU"; }
│ │ │ │ +
673 };
│ │ │ │ +
│ │ │ │ +
674#endif
│ │ │ │ +
675
│ │ │ │ +
676 // define direct solver type to be used
│ │ │ │ + │ │ │ │ +
678 typedef typename SelectedSolver :: type DirectSolver;
│ │ │ │ +
679 static constexpr bool isDirectSolver = solver != none;
│ │ │ │ +
680 static std::string name() { return SelectedSolver :: name (); }
│ │ │ │ +
│ │ │ │ +
681 static DirectSolver* create(const Matrix& mat, bool verbose, bool reusevector )
│ │ │ │ +
682 {
│ │ │ │ +
683 return SelectedSolver :: create( mat, verbose, reusevector );
│ │ │ │ +
684 }
│ │ │ │ +
│ │ │ │ +
685 };
│ │ │ │ +
│ │ │ │ +
686
│ │ │ │ +
687 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
688 template<class C>
│ │ │ │ +
689 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion,
│ │ │ │ +
690 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ │ +
691 const PI& pinfo)
│ │ │ │ +
692 {
│ │ │ │ +
693 Timer watch;
│ │ │ │ +
694 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ │ +
695 std::const_pointer_cast<Operator>(matrixptr),
│ │ │ │ +
696 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ │ +
697
│ │ │ │ +
698 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ │ +
699
│ │ │ │ +
700 // build the necessary smoother hierarchies
│ │ │ │ +
701 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ │ +
702
│ │ │ │ +
703 // test whether we should solve on the coarse level. That is the case if we
│ │ │ │ +
704 // have that level and if there was a redistribution on this level then our
│ │ │ │ +
705 // communicator has to be valid (size()>0) as the smoother might try to communicate
│ │ │ │ +
706 // in the constructor.
│ │ │ │ +
707 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()
│ │ │ │ +
708 && ( ! matrices_->redistributeInformation().back().isSetup() ||
│ │ │ │ +
709 matrices_->parallelInformation().coarsest().getRedistributed().communicator().size() ) )
│ │ │ │ +
710 {
│ │ │ │ +
711 // We have the carsest level. Create the coarse Solver
│ │ │ │ +
712 SmootherArgs sargs(smootherArgs_);
│ │ │ │ +
713 sargs.iterations = 1;
│ │ │ │ +
714
│ │ │ │ + │ │ │ │ +
716 cargs.setArgs(sargs);
│ │ │ │ +
717 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ │ +
718 // Solve on the redistributed partitioning
│ │ │ │ +
719 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ │ +
720 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ │ +
721 }else{
│ │ │ │ +
722 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ │ +
723 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ │ +
724 }
│ │ │ │ +
725
│ │ │ │ +
726 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ │ +
727 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ │ +
728
│ │ │ │ +
729 typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector;
│ │ │ │ +
730
│ │ │ │ +
731 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ │ +
732 if( SolverSelector::isDirectSolver &&
│ │ │ │ +
733 (std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ │ +
734 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ │ +
735 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ │ +
736 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ │ +
737 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0) )
│ │ │ │ +
738 )
│ │ │ │ +
739 { // redistribute and 1 proc
│ │ │ │ +
740 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ +
741 {
│ │ │ │ +
742 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ +
743 {
│ │ │ │ +
744 // We are still participating on this level
│ │ │ │ +
745 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ │ +
746 }
│ │ │ │ +
747 else
│ │ │ │ +
748 solver_.reset();
│ │ │ │ +
749 }
│ │ │ │ +
750 else
│ │ │ │ +
751 {
│ │ │ │ +
752 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ │ +
753 }
│ │ │ │ +
754 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ │ +
755 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << ")" << std::endl;
│ │ │ │ +
756 }
│ │ │ │ +
757 else
│ │ │ │ +
758 {
│ │ │ │ +
759 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ │ +
760 {
│ │ │ │ +
761 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ │ +
762 // We are still participating on this level
│ │ │ │ +
763
│ │ │ │ +
764 // we have to allocate these types using the rebound allocator
│ │ │ │ +
765 // in order to ensure that we fulfill the alignment requirements
│ │ │ │ +
766 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ │ +
767 *scalarProduct_,
│ │ │ │ +
768 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ +
769 else
│ │ │ │ +
770 solver_.reset();
│ │ │ │ +
771 }else
│ │ │ │ +
772 {
│ │ │ │ +
773 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ │ +
774 *scalarProduct_,
│ │ │ │ +
775 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ │ +
776 // // we have to allocate these types using the rebound allocator
│ │ │ │ +
777 // // in order to ensure that we fulfill the alignment requirements
│ │ │ │ +
778 // using Alloc = typename std::allocator_traits<A>::template rebind_alloc<BiCGSTABSolver<X>>;
│ │ │ │ +
779 // Alloc alloc;
│ │ │ │ +
780 // auto p = alloc.allocate(1);
│ │ │ │ +
781 // std::allocator_traits<Alloc>::construct(alloc, p,
│ │ │ │ +
782 // const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ │ +
783 // *scalarProduct_,
│ │ │ │ +
784 // *coarseSmoother_, 1E-2, 1000, 0);
│ │ │ │ +
785 // solver_.reset(p,[](BiCGSTABSolver<X>* p){
│ │ │ │ +
786 // Alloc alloc;
│ │ │ │ +
787 // std::allocator_traits<Alloc>::destroy(alloc, p);
│ │ │ │ +
788 // alloc.deallocate(p,1);
│ │ │ │ +
789 // });
│ │ │ │
790 }
│ │ │ │
791 }
│ │ │ │ -
792 else
│ │ │ │ -
793 {
│ │ │ │ -
794 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue
│ │ │ │ -
795 if (!doRQI)
│ │ │ │ -
796 {
│ │ │ │ -
797 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = x_s)
│ │ │ │ -
798 mu_s = gamma + (y * x_s) * (omega * omega);
│ │ │ │ -
799 }
│ │ │ │ -
800 else
│ │ │ │ -
801 {
│ │ │ │ -
802 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y = x_s)
│ │ │ │ -
803 mu_s_update = (y * x_s) * (omega * omega);
│ │ │ │ -
804 mu_s += mu_s_update;
│ │ │ │ -
805 }
│ │ │ │ -
806
│ │ │ │ -
807 // get norm of "the residual with respect to the shift used by II"
│ │ │ │ -
808 if (!doRQI)
│ │ │ │ -
809 {
│ │ │ │ -
810 // use special representation of q in the II case
│ │ │ │ -
811 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = x_s)
│ │ │ │ -
812 q_norm = omega;
│ │ │ │ -
813 }
│ │ │ │ -
814 else
│ │ │ │ -
815 {
│ │ │ │ -
816 // use special representation of q in the RQI case
│ │ │ │ -
817 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y = x_s)
│ │ │ │ -
818 temp = x_s; temp.axpy(mu_s-gamma,y);
│ │ │ │ -
819 q_norm = temp.two_norm() * omega;
│ │ │ │ -
820 }
│ │ │ │ -
821
│ │ │ │ -
822 // get norm of "the residual with respect to the Rayleigh quotient"
│ │ │ │ -
823 // don't use efficient relation between the norms of r and q, as
│ │ │ │ -
824 // this relation seems to yield a less accurate r_norm in the case
│ │ │ │ -
825 // where linear solver crime is admitted
│ │ │ │ -
826 if (!doRQI)
│ │ │ │ -
827 {
│ │ │ │ -
828 // (use that x_new = y * omega and use that (m_ - gamma*I) * y = x_s)
│ │ │ │ -
829 temp = x_s; temp.axpy(gamma-lambda,y);
│ │ │ │ -
830 r_norm = temp.two_norm() * omega;
│ │ │ │ -
831 }
│ │ │ │ -
832 else
│ │ │ │ -
833 {
│ │ │ │ -
834 // (use that x_new = y * omega and use that (m_ - mu_s_old*I) * y = x_s)
│ │ │ │ -
835 temp = x_s; temp.axpy(-mu_s_update,y);
│ │ │ │ -
836 r_norm = temp.two_norm() * omega;
│ │ │ │ -
837 }
│ │ │ │ -
838 }
│ │ │ │ -
839
│ │ │ │ -
840 // do one iteration of the II/RQI algorithm,
│ │ │ │ -
841 // part 3: update x
│ │ │ │ -
842 x_s = y; x_s *= omega;
│ │ │ │ -
843
│ │ │ │ -
844 // // for relative residual norm mode, scale with mu_s^{-1}
│ │ │ │ -
845 // r_norm /= std::abs(mu_s);
│ │ │ │ -
846
│ │ │ │ -
847 // print verbosity information
│ │ │ │ -
848 if (verbosity_level_ > 1)
│ │ │ │ -
849 std::cout << blank_ << "iteration "
│ │ │ │ -
850 << std::left << std::setw(3) << nIterations_
│ │ │ │ -
851 << " (" << (doRQI ? "RQI," : "II, ")
│ │ │ │ -
852 << " " << (doRQI ? "—>" : " ") << " "
│ │ │ │ -
853 << "║r║_2 = " << std::setw(11) << r_norm
│ │ │ │ -
854 << ", " << (doRQI ? " " : "—>") << " "
│ │ │ │ -
855 << "║q║_2 = " << std::setw(11) << q_norm
│ │ │ │ -
856 << "): λ = " << lambda << std::endl
│ │ │ │ -
857 << std::resetiosflags(std::ios::left);
│ │ │ │ -
858
│ │ │ │ -
859 // check if the eigenvalue closest to gamma lies in J
│ │ │ │ -
860 if (!doRQI && q_norm < eta)
│ │ │ │ -
861 {
│ │ │ │ -
862 // J is not free of eigenvalues
│ │ │ │ -
863 extrnl = false;
│ │ │ │ -
864
│ │ │ │ -
865 // by theory we know now that mu_s also lies in J
│ │ │ │ -
866 assert(std::abs(mu_s-gamma) < eta);
│ │ │ │ +
792 }
│ │ │ │ +
793
│ │ │ │ +
794 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ │ +
795 std::cout<<"Building hierarchy of "<<matrices_->maxlevels()<<" levels "
│ │ │ │ +
796 <<"(including coarse solver) took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ │ +
797 }
│ │ │ │ +
798
│ │ │ │ +
799
│ │ │ │ +
800 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
802 {
│ │ │ │ +
803 // Detect Matrix rows where all offdiagonal entries are
│ │ │ │ +
804 // zero and set x such that A_dd*x_d=b_d
│ │ │ │ +
805 // Thus users can be more careless when setting up their linear
│ │ │ │ +
806 // systems.
│ │ │ │ +
807 typedef typename M::matrix_type Matrix;
│ │ │ │ +
808 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ │ +
809 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ │ +
810 typedef typename Matrix::block_type Block;
│ │ │ │ +
811 Block zero;
│ │ │ │ +
812 zero=typename Matrix::field_type();
│ │ │ │ +
813
│ │ │ │ +
814 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ │ +
815 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ │ +
816 bool isDirichlet = true;
│ │ │ │ +
817 bool hasDiagonal = false;
│ │ │ │ +
818 Block diagonal{};
│ │ │ │ +
819 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ │ +
820 if(row.index()==col.index()) {
│ │ │ │ +
821 diagonal = *col;
│ │ │ │ +
822 hasDiagonal = true;
│ │ │ │ +
823 }else{
│ │ │ │ +
824 if(*col!=zero)
│ │ │ │ +
825 isDirichlet = false;
│ │ │ │ +
826 }
│ │ │ │ +
827 }
│ │ │ │ +
828 if(isDirichlet && hasDiagonal)
│ │ │ │ +
829 {
│ │ │ │ +
830 auto&& xEntry = Impl::asVector(x[row.index()]);
│ │ │ │ +
831 auto&& bEntry = Impl::asVector(b[row.index()]);
│ │ │ │ +
832 Impl::asMatrix(diagonal).solve(xEntry, bEntry);
│ │ │ │ +
833 }
│ │ │ │ +
834 }
│ │ │ │ +
835
│ │ │ │ +
836 if(smoothers_->levels()>0)
│ │ │ │ +
837 smoothers_->finest()->pre(x,b);
│ │ │ │ +
838 else
│ │ │ │ +
839 // No smoother to make x consistent! Do it by hand
│ │ │ │ +
840 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ │ +
841 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ │ +
842 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ +
843 update_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ │ +
844 matrices_->coarsenVector(*rhs_);
│ │ │ │ +
845 matrices_->coarsenVector(*lhs_);
│ │ │ │ +
846 matrices_->coarsenVector(*update_);
│ │ │ │ +
847
│ │ │ │ +
848 // Preprocess all smoothers
│ │ │ │ +
849 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ │ +
850 typedef typename Hierarchy<Range,A>::Iterator RIterator;
│ │ │ │ +
851 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ │ +
852 Iterator coarsest = smoothers_->coarsest();
│ │ │ │ +
853 Iterator smoother = smoothers_->finest();
│ │ │ │ +
854 RIterator rhs = rhs_->finest();
│ │ │ │ +
855 DIterator lhs = lhs_->finest();
│ │ │ │ +
856 if(smoothers_->levels()>1) {
│ │ │ │ +
857
│ │ │ │ +
858 assert(lhs_->levels()==rhs_->levels());
│ │ │ │ +
859 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels()==matrices_->maxlevels());
│ │ │ │ +
860 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels()<matrices_->maxlevels());
│ │ │ │ +
861
│ │ │ │ +
862 if(smoother!=coarsest)
│ │ │ │ +
863 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, ++rhs)
│ │ │ │ +
864 smoother->pre(*lhs,*rhs);
│ │ │ │ +
865 smoother->pre(*lhs,*rhs);
│ │ │ │ +
866 }
│ │ │ │
867
│ │ │ │ -
868 // switch to RQI
│ │ │ │ -
869 doRQI = true;
│ │ │ │ -
870 }
│ │ │ │ -
871
│ │ │ │ -
872 // revert to II if J is not free of eigenvalues but
│ │ │ │ -
873 // at some point mu_s falls back again outside J
│ │ │ │ -
874 if (!extrnl && doRQI && std::abs(mu_s-gamma) >= eta)
│ │ │ │ -
875 doRQI = false;
│ │ │ │ -
876
│ │ │ │ -
877 // if eigenvalue closest to gamma does not lie in J use RQI
│ │ │ │ -
878 // solely to accelerate the convergence to this eigenvalue
│ │ │ │ -
879 // when II has become stationary
│ │ │ │ -
880 if (extrnl && !doRQI)
│ │ │ │ -
881 {
│ │ │ │ -
882 // switch to RQI if the relative change of the Rayleigh
│ │ │ │ -
883 // quotient indicates that II has become stationary
│ │ │ │ -
884 if (nIterations_ >= m &&
│ │ │ │ -
885 std::abs(mu_s - mu_s_old) / std::abs(mu_s) < delta)
│ │ │ │ -
886 doRQI = true;
│ │ │ │ -
887 }
│ │ │ │ -
888 }
│ │ │ │ -
889
│ │ │ │ -
890 // // compute final residual and lambda again (paranoia....)
│ │ │ │ -
891 // m_.mv(x_s,temp);
│ │ │ │ -
892 // mu_s = x_s * temp;
│ │ │ │ -
893 // temp.axpy(-mu_s,x_s);
│ │ │ │ -
894 // r_norm = temp.two_norm();
│ │ │ │ -
895 // // r_norm /= std::abs(mu_s);
│ │ │ │ -
896
│ │ │ │ -
897 // print verbosity information
│ │ │ │ -
898 if (verbosity_level_ > 0)
│ │ │ │ -
899 {
│ │ │ │ -
900 if (extrnl)
│ │ │ │ -
901 std::cout << blank_ << "Interval "
│ │ │ │ -
902 << "(" << gamma - eta << "," << gamma + eta
│ │ │ │ -
903 << ") is free of eigenvalues, approximating "
│ │ │ │ -
904 << "the closest eigenvalue." << std::endl;
│ │ │ │ -
905 std::cout << blank_ << "Result ("
│ │ │ │ -
906 << "#iterations = " << nIterations_ << ", "
│ │ │ │ -
907 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ -
908 << "λ = " << lambda << std::endl;
│ │ │ │ -
909 if (verbosity_level_ > 2)
│ │ │ │ -
910 {
│ │ │ │ -
911 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ -
912 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ -
913 }
│ │ │ │ -
914 }
│ │ │ │ -
915 }
│ │ │ │ -
│ │ │ │ -
916
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
926 {
│ │ │ │ -
927 // return iteration operator
│ │ │ │ -
928 return itOperator_;
│ │ │ │ -
929 }
│ │ │ │ -
│ │ │ │ -
930
│ │ │ │ -
│ │ │ │ -
945 inline const BCRSMatrix& getIterationMatrix () const
│ │ │ │ -
946 {
│ │ │ │ -
947 // create iteration matrix on demand
│ │ │ │ -
948 if (!itMatrix_)
│ │ │ │ -
949 itMatrix_ = std::make_unique<BCRSMatrix>(m_);
│ │ │ │ -
950
│ │ │ │ -
951 // return iteration matrix
│ │ │ │ -
952 return *itMatrix_;
│ │ │ │ -
953 }
│ │ │ │ -
│ │ │ │ -
954
│ │ │ │ -
│ │ │ │ -
959 inline unsigned int getIterationCount () const
│ │ │ │ -
960 {
│ │ │ │ -
961 if (nIterations_ == 0)
│ │ │ │ -
962 DUNE_THROW(Dune::ISTLError,"No algorithm applied, yet.");
│ │ │ │ -
963
│ │ │ │ -
964 return nIterations_;
│ │ │ │ -
965 }
│ │ │ │ -
│ │ │ │ -
966
│ │ │ │ -
967 protected:
│ │ │ │ -
982 template <typename ISTLLinearSolver>
│ │ │ │ -
│ │ │ │ -
983 inline void updateShiftMu (const Real& mu,
│ │ │ │ -
984 ISTLLinearSolver& solver) const
│ │ │ │ -
985 {
│ │ │ │ -
986 // do nothing if new shift equals the old one
│ │ │ │ -
987 if (mu == mu_) return;
│ │ │ │ -
988
│ │ │ │ -
989 // update shift mu_, i.e. update iteration operator
│ │ │ │ -
990 mu_ = mu;
│ │ │ │ -
991
│ │ │ │ -
992 // update iteration matrix when needed
│ │ │ │ -
993 if (itMatrix_)
│ │ │ │ -
994 {
│ │ │ │ -
995 // iterate over entries in iteration matrix diagonal
│ │ │ │ -
996 constexpr int rowBlockSize = BCRSMatrix::block_type::rows;
│ │ │ │ -
997 constexpr int colBlockSize = BCRSMatrix::block_type::cols;
│ │ │ │ -
998 for (typename BCRSMatrix::size_type i = 0;
│ │ │ │ -
999 i < itMatrix_->M()*rowBlockSize; ++i)
│ │ │ │ -
1000 {
│ │ │ │ -
1001 // access m_[i,i] where i is the flat index of a row/column
│ │ │ │ -
1002 const Real& m_entry = m_
│ │ │ │ -
1003 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize];
│ │ │ │ -
1004 // access *itMatrix[i,i] where i is the flat index of a row/column
│ │ │ │ -
1005 Real& entry = (*itMatrix_)
│ │ │ │ -
1006 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize];
│ │ │ │ -
1007 // change current entry in iteration matrix diagonal
│ │ │ │ -
1008 entry = m_entry - mu_;
│ │ │ │ -
1009 }
│ │ │ │ -
1010 // notify linear solver about change of the iteration matrix object
│ │ │ │ - │ │ │ │ -
1012 (solver,*itMatrix_);
│ │ │ │ -
1013 }
│ │ │ │ -
1014 }
│ │ │ │ -
│ │ │ │ -
1015
│ │ │ │ -
1016 protected:
│ │ │ │ -
1017 // parameters related to iterative eigenvalue algorithms
│ │ │ │ - │ │ │ │ -
1019 const unsigned int nIterationsMax_;
│ │ │ │ -
1020
│ │ │ │ -
1021 // verbosity setting
│ │ │ │ -
1022 const unsigned int verbosity_level_;
│ │ │ │ -
1023
│ │ │ │ -
1024 // shift mu_ used by iteration operator/matrix (m_ - mu_*I)
│ │ │ │ -
1025 mutable Real mu_;
│ │ │ │ -
1026
│ │ │ │ -
1027 // iteration operator (m_ - mu_*I), passing shift mu_ by reference
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
1031
│ │ │ │ -
1032 // iteration matrix (m_ - mu_*I), provided on demand when needed
│ │ │ │ -
1033 // (e.g. for preconditioning)
│ │ │ │ -
1034 mutable std::unique_ptr<BCRSMatrix> itMatrix_;
│ │ │ │ -
1035
│ │ │ │ -
1036 // memory for storing temporary variables (mutable as they shall
│ │ │ │ -
1037 // just be effectless auxiliary variables of the const apply*(...)
│ │ │ │ -
1038 // methods)
│ │ │ │ -
1039 mutable unsigned int nIterations_;
│ │ │ │ -
1040
│ │ │ │ -
1041 // constants for printing verbosity information
│ │ │ │ -
1042 const std::string title_;
│ │ │ │ -
1043 const std::string blank_;
│ │ │ │ -
1044 };
│ │ │ │ -
│ │ │ │ -
1045
│ │ │ │ -
1048} // namespace Dune
│ │ │ │ -
1049
│ │ │ │ -
1050#endif // DUNE_ISTL_EIGENVALUE_POWERITERATION_HH
│ │ │ │ - │ │ │ │ -
Helper functions for determining the vector/matrix block level.
│ │ │ │ -
Templates characterizing the type of a solver.
│ │ │ │ -
Implementations of the inverse operator interface.
│ │ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ - │ │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ -
void printvector(std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
Print an ISTL vector.
Definition io.hh:89
│ │ │ │ +
868
│ │ │ │ +
869 // The preconditioner might change x and b. So we have to
│ │ │ │ +
870 // copy the changes to the original vectors.
│ │ │ │ +
871 x = *lhs_->finest();
│ │ │ │ +
872 b = *rhs_->finest();
│ │ │ │ +
873
│ │ │ │ +
874 }
│ │ │ │ +
│ │ │ │ +
875 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
877 {
│ │ │ │ +
878 return matrices_->levels();
│ │ │ │ +
879 }
│ │ │ │ +
│ │ │ │ +
880 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
882 {
│ │ │ │ +
883 return matrices_->maxlevels();
│ │ │ │ +
884 }
│ │ │ │ +
│ │ │ │ +
885
│ │ │ │ +
887 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
889 {
│ │ │ │ +
890 LevelContext levelContext;
│ │ │ │ +
891
│ │ │ │ +
892 if(additive) {
│ │ │ │ +
893 *(rhs_->finest())=d;
│ │ │ │ +
894 additiveMgc();
│ │ │ │ +
895 v=*lhs_->finest();
│ │ │ │ +
896 }else{
│ │ │ │ +
897 // Init all iterators for the current level
│ │ │ │ +
898 initIteratorsWithFineLevel(levelContext);
│ │ │ │ +
899
│ │ │ │ +
900
│ │ │ │ +
901 *levelContext.lhs = v;
│ │ │ │ +
902 *levelContext.rhs = d;
│ │ │ │ +
903 *levelContext.update=0;
│ │ │ │ +
904 levelContext.level=0;
│ │ │ │ +
905
│ │ │ │ +
906 mgc(levelContext);
│ │ │ │ +
907
│ │ │ │ +
908 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ │ +
909 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ │ +
910
│ │ │ │ +
911 v=*levelContext.update;
│ │ │ │ +
912 }
│ │ │ │ +
913
│ │ │ │ +
914 }
│ │ │ │ +
│ │ │ │ +
915
│ │ │ │ +
916 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
917 void AMG<M,X,S,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ │ +
918 {
│ │ │ │ +
919 levelContext.smoother = smoothers_->finest();
│ │ │ │ +
920 levelContext.matrix = matrices_->matrices().finest();
│ │ │ │ +
921 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ │ +
922 levelContext.redist =
│ │ │ │ +
923 matrices_->redistributeInformation().begin();
│ │ │ │ +
924 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ │ +
925 levelContext.lhs = lhs_->finest();
│ │ │ │ +
926 levelContext.update = update_->finest();
│ │ │ │ +
927 levelContext.rhs = rhs_->finest();
│ │ │ │ +
928 }
│ │ │ │ +
929
│ │ │ │ +
930 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
931 bool AMG<M,X,S,PI,A>
│ │ │ │ +
932 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ │ +
933 {
│ │ │ │ +
934
│ │ │ │ +
935 bool processNextLevel=true;
│ │ │ │ +
936
│ │ │ │ +
937 if(levelContext.redist->isSetup()) {
│ │ │ │ +
938 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.rhs),
│ │ │ │ +
939 levelContext.rhs.getRedistributed());
│ │ │ │ +
940 processNextLevel = levelContext.rhs.getRedistributed().size()>0;
│ │ │ │ +
941 if(processNextLevel) {
│ │ │ │ +
942 //restrict defect to coarse level right hand side.
│ │ │ │ +
943 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ │ +
944 ++levelContext.pinfo;
│ │ │ │ +
945 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
946 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ │ +
947 static_cast<const Range&>(fineRhs.getRedistributed()),
│ │ │ │ +
948 *levelContext.pinfo);
│ │ │ │ +
949 }
│ │ │ │ +
950 }else{
│ │ │ │ +
951 //restrict defect to coarse level right hand side.
│ │ │ │ +
952 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ │ +
953 ++levelContext.pinfo;
│ │ │ │ +
954 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
955 ::restrictVector(*(*levelContext.aggregates),
│ │ │ │ +
956 *levelContext.rhs, static_cast<const Range&>(*fineRhs),
│ │ │ │ +
957 *levelContext.pinfo);
│ │ │ │ +
958 }
│ │ │ │ +
959
│ │ │ │ +
960 if(processNextLevel) {
│ │ │ │ +
961 // prepare coarse system
│ │ │ │ +
962 ++levelContext.lhs;
│ │ │ │ +
963 ++levelContext.update;
│ │ │ │ +
964 ++levelContext.matrix;
│ │ │ │ +
965 ++levelContext.level;
│ │ │ │ +
966 ++levelContext.redist;
│ │ │ │ +
967
│ │ │ │ +
968 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ +
969 // next level is not the globally coarsest one
│ │ │ │ +
970 ++levelContext.smoother;
│ │ │ │ +
971 ++levelContext.aggregates;
│ │ │ │ +
972 }
│ │ │ │ +
973 // prepare the update on the next level
│ │ │ │ +
974 *levelContext.update=0;
│ │ │ │ +
975 }
│ │ │ │ +
976 return processNextLevel;
│ │ │ │ +
977 }
│ │ │ │ +
978
│ │ │ │ +
979 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
980 void AMG<M,X,S,PI,A>
│ │ │ │ +
981 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel)
│ │ │ │ +
982 {
│ │ │ │ +
983 if(processNextLevel) {
│ │ │ │ +
984 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ │ +
985 // previous level is not the globally coarsest one
│ │ │ │ +
986 --levelContext.smoother;
│ │ │ │ +
987 --levelContext.aggregates;
│ │ │ │ +
988 }
│ │ │ │ +
989 --levelContext.redist;
│ │ │ │ +
990 --levelContext.level;
│ │ │ │ +
991 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ │ +
992 --levelContext.matrix;
│ │ │ │ +
993
│ │ │ │ +
994 //typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--;
│ │ │ │ +
995 --levelContext.lhs;
│ │ │ │ +
996 --levelContext.pinfo;
│ │ │ │ +
997 }
│ │ │ │ +
998 if(levelContext.redist->isSetup()) {
│ │ │ │ +
999 // Need to redistribute during prolongateVector
│ │ │ │ +
1000 levelContext.lhs.getRedistributed()=0;
│ │ │ │ +
1001 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
1002 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ │ +
1003 levelContext.lhs.getRedistributed(),
│ │ │ │ +
1004 matrices_->getProlongationDampingFactor(),
│ │ │ │ +
1005 *levelContext.pinfo, *levelContext.redist);
│ │ │ │ +
1006 }else{
│ │ │ │ +
1007 *levelContext.lhs=0;
│ │ │ │ +
1008 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
1009 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ │ +
1010 matrices_->getProlongationDampingFactor(),
│ │ │ │ +
1011 *levelContext.pinfo);
│ │ │ │ +
1012 }
│ │ │ │ +
1013
│ │ │ │ +
1014
│ │ │ │ +
1015 if(processNextLevel) {
│ │ │ │ +
1016 --levelContext.update;
│ │ │ │ +
1017 --levelContext.rhs;
│ │ │ │ +
1018 }
│ │ │ │ +
1019
│ │ │ │ +
1020 *levelContext.update += *levelContext.lhs;
│ │ │ │ +
1021 }
│ │ │ │ +
1022
│ │ │ │ +
1023 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1025 {
│ │ │ │ + │ │ │ │ +
1027 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
1028
│ │ │ │ +
1029 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
1030 void AMG<M,X,S,PI,A>::mgc(LevelContext& levelContext){
│ │ │ │ +
1031 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ │ +
1032 // Solve directly
│ │ │ │ + │ │ │ │ +
1034 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ │ +
1035 if(levelContext.redist->isSetup()) {
│ │ │ │ +
1036 levelContext.redist->redistribute(*levelContext.rhs, levelContext.rhs.getRedistributed());
│ │ │ │ +
1037 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ │ +
1038 // We are still participating in the computation
│ │ │ │ +
1039 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ │ +
1040 levelContext.rhs.getRedistributed());
│ │ │ │ +
1041 solver_->apply(levelContext.update.getRedistributed(),
│ │ │ │ +
1042 levelContext.rhs.getRedistributed(), res);
│ │ │ │ +
1043 }
│ │ │ │ +
1044 levelContext.redist->redistributeBackward(*levelContext.update, levelContext.update.getRedistributed());
│ │ │ │ +
1045 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ │ +
1046 }else{
│ │ │ │ +
1047 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs);
│ │ │ │ +
1048 solver_->apply(*levelContext.update, *levelContext.rhs, res);
│ │ │ │ +
1049 }
│ │ │ │ +
1050
│ │ │ │ +
1051 if (!res.converged)
│ │ │ │ +
1052 coarsesolverconverged = false;
│ │ │ │ +
1053 }else{
│ │ │ │ +
1054 // presmoothing
│ │ │ │ +
1055 presmooth(levelContext, preSteps_);
│ │ │ │ +
1056
│ │ │ │ +
1057#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ │ +
1058 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ │ +
1059
│ │ │ │ +
1060 if(processNextLevel) {
│ │ │ │ +
1061 // next level
│ │ │ │ +
1062 for(std::size_t i=0; i<gamma_; i++){
│ │ │ │ +
1063 mgc(levelContext);
│ │ │ │ +
1064 if (levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels())
│ │ │ │ +
1065 break;
│ │ │ │ +
1066 if(i+1 < gamma_){
│ │ │ │ +
1067 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, *levelContext.rhs);
│ │ │ │ +
1068 }
│ │ │ │ +
1069 }
│ │ │ │ +
1070 }
│ │ │ │ +
1071
│ │ │ │ +
1072 moveToFineLevel(levelContext, processNextLevel);
│ │ │ │ +
1073#else
│ │ │ │ +
1074 *lhs=0;
│ │ │ │ +
1075#endif
│ │ │ │ +
1076
│ │ │ │ +
1077 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ │ +
1078 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ │ +
1079 if(!coarsesolverconverged)
│ │ │ │ +
1080 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ │ +
1081 }
│ │ │ │ +
1082 // postsmoothing
│ │ │ │ +
1083 postsmooth(levelContext, postSteps_);
│ │ │ │ +
1084
│ │ │ │ +
1085 }
│ │ │ │ +
1086 }
│ │ │ │ +
1087
│ │ │ │ +
1088 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
1089 void AMG<M,X,S,PI,A>::additiveMgc(){
│ │ │ │ +
1090
│ │ │ │ +
1091 // restrict residual to all levels
│ │ │ │ +
1092 typename ParallelInformationHierarchy::Iterator pinfo=matrices_->parallelInformation().finest();
│ │ │ │ +
1093 typename Hierarchy<Range,A>::Iterator rhs=rhs_->finest();
│ │ │ │ +
1094 typename Hierarchy<Domain,A>::Iterator lhs = lhs_->finest();
│ │ │ │ +
1095 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates=matrices_->aggregatesMaps().begin();
│ │ │ │ +
1096
│ │ │ │ +
1097 for(typename Hierarchy<Range,A>::Iterator fineRhs=rhs++; fineRhs != rhs_->coarsest(); fineRhs=rhs++, ++aggregates) {
│ │ │ │ +
1098 ++pinfo;
│ │ │ │ +
1099 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
1100 ::restrictVector(*(*aggregates), *rhs, static_cast<const Range&>(*fineRhs), *pinfo);
│ │ │ │ +
1101 }
│ │ │ │ +
1102
│ │ │ │ +
1103 // pinfo is invalid, set to coarsest level
│ │ │ │ +
1104 //pinfo = matrices_->parallelInformation().coarsest
│ │ │ │ +
1105 // calculate correction for all levels
│ │ │ │ +
1106 lhs = lhs_->finest();
│ │ │ │ +
1107 typename Hierarchy<Smoother,A>::Iterator smoother = smoothers_->finest();
│ │ │ │ +
1108
│ │ │ │ +
1109 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) {
│ │ │ │ +
1110 // presmoothing
│ │ │ │ +
1111 *lhs=0;
│ │ │ │ +
1112 smoother->apply(*lhs, *rhs);
│ │ │ │ +
1113 }
│ │ │ │ +
1114
│ │ │ │ +
1115 // Coarse level solve
│ │ │ │ +
1116#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ │ +
1117 InverseOperatorResult res;
│ │ │ │ +
1118 pinfo->copyOwnerToAll(*rhs, *rhs);
│ │ │ │ +
1119 solver_->apply(*lhs, *rhs, res);
│ │ │ │ +
1120
│ │ │ │ +
1121 if(!res.converged)
│ │ │ │ +
1122 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ │ +
1123#else
│ │ │ │ +
1124 *lhs=0;
│ │ │ │ +
1125#endif
│ │ │ │ +
1126 // Prologate and add up corrections from all levels
│ │ │ │ +
1127 --pinfo;
│ │ │ │ +
1128 --aggregates;
│ │ │ │ +
1129
│ │ │ │ +
1130 for(typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--; coarseLhs != lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) {
│ │ │ │ +
1131 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ │ +
1132 ::prolongateVector(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo);
│ │ │ │ +
1133 }
│ │ │ │ +
1134 }
│ │ │ │ +
1135
│ │ │ │ +
1136
│ │ │ │ +
1138 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
│ │ │ │ +
1139 void AMG<M,X,S,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ │ +
1140 {
│ │ │ │ +
1141 // Postprocess all smoothers
│ │ │ │ +
1142 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ │ +
1143 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ │ +
1144 Iterator coarsest = smoothers_->coarsest();
│ │ │ │ +
1145 Iterator smoother = smoothers_->finest();
│ │ │ │ +
1146 DIterator lhs = lhs_->finest();
│ │ │ │ +
1147 if(smoothers_->levels()>0) {
│ │ │ │ +
1148 if(smoother != coarsest || matrices_->levels()<matrices_->maxlevels())
│ │ │ │ +
1149 smoother->post(*lhs);
│ │ │ │ +
1150 if(smoother!=coarsest)
│ │ │ │ +
1151 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs)
│ │ │ │ +
1152 smoother->post(*lhs);
│ │ │ │ +
1153 smoother->post(*lhs);
│ │ │ │ +
1154 }
│ │ │ │ +
1155 lhs_ = nullptr;
│ │ │ │ +
1156 update_ = nullptr;
│ │ │ │ +
1157 rhs_ = nullptr;
│ │ │ │ +
1158 }
│ │ │ │ +
│ │ │ │ +
1159
│ │ │ │ +
1160 template<class M, class X, class S, class PI, class A>
│ │ │ │ +
1161 template<class A1>
│ │ │ │ +
│ │ │ │ +
1162 void AMG<M,X,S,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ │ +
1163 {
│ │ │ │ +
1164 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ │ +
1165 }
│ │ │ │ +
│ │ │ │ +
1166
│ │ │ │ +
1167 } // end namespace Amg
│ │ │ │ +
1168
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
1170 template<class> struct isValidBlockType : std::false_type{};
│ │ │ │ +
1171 template<class T, int n, int m> struct isValidBlockType<FieldMatrix<T,n,m>> : std::true_type{};
│ │ │ │ +
1172
│ │ │ │ +
1173 template<class OP>
│ │ │ │ +
1174 std::shared_ptr<Dune::Preconditioner<typename OP::element_type::domain_type, typename OP::element_type::range_type> >
│ │ │ │ +
│ │ │ │ +
1175 makeAMG(const OP& op, const std::string& smoother, const Dune::ParameterTree& config) const
│ │ │ │ +
1176 {
│ │ │ │ +
1177 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG");
│ │ │ │ +
1178 }
│ │ │ │ +
│ │ │ │ +
1179
│ │ │ │ +
1180 template<class M, class X, class Y>
│ │ │ │ +
1181 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ │ +
│ │ │ │ +
1182 makeAMG(const std::shared_ptr<MatrixAdapter<M,X,Y>>& op, const std::string& smoother,
│ │ │ │ +
1183 const Dune::ParameterTree& config) const
│ │ │ │ +
1184 {
│ │ │ │ +
1185 using OP = MatrixAdapter<M,X,Y>;
│ │ │ │ +
1186
│ │ │ │ +
1187 if(smoother == "ssor")
│ │ │ │ +
1188 return std::make_shared<Amg::AMG<OP, X, SeqSSOR<M,X,Y>>>(op, config);
│ │ │ │ +
1189 if(smoother == "sor")
│ │ │ │ +
1190 return std::make_shared<Amg::AMG<OP, X, SeqSOR<M,X,Y>>>(op, config);
│ │ │ │ +
1191 if(smoother == "jac")
│ │ │ │ +
1192 return std::make_shared<Amg::AMG<OP, X, SeqJac<M,X,Y>>>(op, config);
│ │ │ │ +
1193 if(smoother == "gs")
│ │ │ │ +
1194 return std::make_shared<Amg::AMG<OP, X, SeqGS<M,X,Y>>>(op, config);
│ │ │ │ +
1195 if(smoother == "ilu")
│ │ │ │ +
1196 return std::make_shared<Amg::AMG<OP, X, SeqILU<M,X,Y>>>(op, config);
│ │ │ │ +
1197 else
│ │ │ │ +
1198 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ │ +
1199 }
│ │ │ │ +
│ │ │ │ +
1200
│ │ │ │ +
1201 template<class M, class X, class Y, class C>
│ │ │ │ +
1202 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ │ +
│ │ │ │ +
1203 makeAMG(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ │ +
1204 const Dune::ParameterTree& config) const
│ │ │ │ +
1205 {
│ │ │ │ + │ │ │ │ +
1207
│ │ │ │ +
1208 auto cop = std::static_pointer_cast<const OP>(op);
│ │ │ │ +
1209
│ │ │ │ +
1210 if(smoother == "ssor")
│ │ │ │ +
1211 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ +
1212 if(smoother == "sor")
│ │ │ │ +
1213 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ +
1214 if(smoother == "jac")
│ │ │ │ +
1215 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqJac<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ +
1216 if(smoother == "gs")
│ │ │ │ +
1217 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqGS<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ +
1218 if(smoother == "ilu")
│ │ │ │ +
1219 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqILU<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ │ +
1220 else
│ │ │ │ +
1221 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ │ +
1222 }
│ │ │ │ +
│ │ │ │ +
1223
│ │ │ │ +
1224 template<class M, class X, class Y, class C>
│ │ │ │ +
1225 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ │ +
│ │ │ │ +
1226 makeAMG(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ │ +
1227 const Dune::ParameterTree& config) const
│ │ │ │ +
1228 {
│ │ │ │ + │ │ │ │ +
1230
│ │ │ │ +
1231 if(smoother == "ssor")
│ │ │ │ +
1232 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ +
1233 if(smoother == "sor")
│ │ │ │ +
1234 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ +
1235 if(smoother == "jac")
│ │ │ │ +
1236 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqJac<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ +
1237 if(smoother == "gs")
│ │ │ │ +
1238 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqGS<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ +
1239 if(smoother == "ilu")
│ │ │ │ +
1240 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqILU<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ │ +
1241 else
│ │ │ │ +
1242 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ │ +
1243 }
│ │ │ │ +
│ │ │ │ +
1244
│ │ │ │ +
1245 template<typename TL, typename OP>
│ │ │ │ +
1246 std::shared_ptr<Dune::Preconditioner<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ +
1247 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ +
│ │ │ │ +
1248 operator() (TL tl, const std::shared_ptr<OP>& op, const Dune::ParameterTree& config,
│ │ │ │ + │ │ │ │ +
1250 {
│ │ │ │ +
1251 using field_type = typename OP::matrix_type::field_type;
│ │ │ │ +
1252 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
1253 if (!std::is_convertible<field_type, real_type>())
│ │ │ │ +
1254 DUNE_THROW(UnsupportedType, "AMG needs field_type(" <<
│ │ │ │ +
1255 className<field_type>() <<
│ │ │ │ +
1256 ") to be convertible to its real_type (" <<
│ │ │ │ +
1257 className<real_type>() <<
│ │ │ │ +
1258 ").");
│ │ │ │ +
1259 using D = typename Dune::TypeListElement<1, decltype(tl)>::type;
│ │ │ │ +
1260 using R = typename Dune::TypeListElement<2, decltype(tl)>::type;
│ │ │ │ +
1261 std::shared_ptr<Preconditioner<D,R>> amg;
│ │ │ │ +
1262 std::string smoother = config.get("smoother", "ssor");
│ │ │ │ +
1263 return makeAMG(op, smoother, config);
│ │ │ │ +
1264 }
│ │ │ │ +
│ │ │ │ +
1265
│ │ │ │ +
1266 template<typename TL, typename OP>
│ │ │ │ +
1267 std::shared_ptr<Dune::Preconditioner<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ +
1268 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ +
│ │ │ │ +
1269 operator() (TL /*tl*/, const std::shared_ptr<OP>& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ │ + │ │ │ │ +
1271 {
│ │ │ │ +
1272 DUNE_THROW(UnsupportedType, "AMG needs a FieldMatrix as Matrix block_type");
│ │ │ │ +
1273 }
│ │ │ │ +
│ │ │ │ +
1274 };
│ │ │ │ +
│ │ │ │ +
1275
│ │ │ │ + │ │ │ │ +
1277} // end namespace Dune
│ │ │ │ +
1278
│ │ │ │ +
1279#endif
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
Classes for using SuperLU with ISTL matrices.
│ │ │ │ +
Implementations of the inverse operator interface.
│ │ │ │ +
Templates characterizing the type of a solver.
│ │ │ │ +
Provides a classes representing the hierarchies in AMG.
│ │ │ │ +
Classes for the generic construction and application of the smoothers.
│ │ │ │ +
Prolongation and restriction for amg.
│ │ │ │ +
Classes for using UMFPack with ISTL matrices.
│ │ │ │ +
Define base class for scalar product and norm.
│ │ │ │ +
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:16
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
AMG(const AMG &amg)
Copy constructor.
Definition amg.hh:392
│ │ │ │ +
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition amg.hh:801
│ │ │ │ +
static DirectSolver * create(const Matrix &mat, bool verbose, bool reusevector)
Definition amg.hh:681
│ │ │ │ +
static std::string name()
Definition amg.hh:680
│ │ │ │ +
Hierarchy< Domain, A >::Iterator update
The iterator over the updates.
Definition amg.hh:303
│ │ │ │ +
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition amg.hh:307
│ │ │ │ +
static std::string name()
Definition amg.hh:672
│ │ │ │ +
bool usesDirectCoarseLevelSolver() const
Check whether the coarse solver used is a direct solver.
Definition amg.hh:1024
│ │ │ │ +
X Domain
The domain type.
Definition amg.hh:87
│ │ │ │ +
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:644
│ │ │ │ +
AMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms)
Construct a new amg with a specific coarse solver.
Definition amg.hh:406
│ │ │ │ +
AMG(std::shared_ptr< const Operator > fineOperator, const ParameterTree &configuration, const ParallelInformation &pinfo=ParallelInformation())
Constructor an AMG via ParameterTree.
Definition amg.hh:452
│ │ │ │ +
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition amg.hh:287
│ │ │ │ +
SolverType
Definition amg.hh:627
│ │ │ │ +
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition amg.hh:295
│ │ │ │ +
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ │ +
Solver< Matrix, solver > SelectedSolver
Definition amg.hh:677
│ │ │ │ +
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< MatrixAdapter< M, X, Y > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1182
│ │ │ │ +
std::string operator()(const std::string &str)
Definition amg.hh:378
│ │ │ │ +
std::shared_ptr< Dune::Preconditioner< typename OP::element_type::domain_type, typename OP::element_type::range_type > > makeAMG(const OP &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1175
│ │ │ │ +
S Smoother
The type of the smoother.
Definition amg.hh:97
│ │ │ │ +
static std::string name()
Definition amg.hh:649
│ │ │ │ +
Hierarchy< Smoother, A >::Iterator smoother
The iterator over the smoothers.
Definition amg.hh:279
│ │ │ │ +
M Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ │ +
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition amg.hh:283
│ │ │ │ + │ │ │ │ +
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:668
│ │ │ │ +
OperatorHierarchy::RedistributeInfoList::const_iterator redist
The iterator over the redistribution information.
Definition amg.hh:291
│ │ │ │ +
X Range
The range type.
Definition amg.hh:89
│ │ │ │ +
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ │ +
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition amg.hh:1162
│ │ │ │ +
std::size_t levels()
Definition amg.hh:876
│ │ │ │ +
InverseOperator< Vector, Vector > type
Definition amg.hh:643
│ │ │ │ +
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1203
│ │ │ │ +
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition amg.hh:299
│ │ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ │ +
static constexpr SolverType solver
Definition amg.hh:629
│ │ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ │ +
static constexpr bool isDirectSolver
Definition amg.hh:679
│ │ │ │ +
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition amg.hh:221
│ │ │ │ +
Matrix::field_type field_type
Definition amg.hh:626
│ │ │ │ +
SelectedSolver::type DirectSolver
Definition amg.hh:678
│ │ │ │ +
std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL tl, const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std::enable_if_t< isValidBlockType< typename OP::matrix_type::block_type >::value, int >=0) const
Definition amg.hh:1248
│ │ │ │ +
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
The parallal data distribution hierarchy type.
Definition amg.hh:84
│ │ │ │ +
InverseOperator< X, X > CoarseSolver
the type of the coarse solver.
Definition amg.hh:91
│ │ │ │ +
void post(Domain &x)
Clean up.
Definition amg.hh:1139
│ │ │ │ +
std::size_t maxlevels()
Definition amg.hh:881
│ │ │ │ +
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1226
│ │ │ │ +
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ │ +
std::size_t level
The level index.
Definition amg.hh:311
│ │ │ │ +
AMG(const Operator &fineOperator, const C &criterion, const SmootherArgs &smootherArgs=SmootherArgs(), const ParallelInformation &pinfo=ParallelInformation())
Construct an AMG with an inexact coarse solver based on the smoother.
Definition amg.hh:428
│ │ │ │ +
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition amg.hh:888
│ │ │ │ +
Smoother SmootherType
Definition amg.hh:275
│ │ │ │ +
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
The operator hierarchy type.
Definition amg.hh:82
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition amg.hh:194
│ │ │ │ +
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:80
│ │ │ │ +
@ none
Definition amg.hh:627
│ │ │ │ +
@ umfpack
Definition amg.hh:627
│ │ │ │ +
@ superlu
Definition amg.hh:627
│ │ │ │ +
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:244
│ │ │ │ +
@ noAccu
No data accumulution.
Definition parameters.hh:238
│ │ │ │ +
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:248
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ -
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:1978
│ │ │ │ -
void mv(const X &x, Y &y) const
y = A x
Definition bcrsmatrix.hh:1612
│ │ │ │ -
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:401
│ │ │ │ -
Iterative eigenvalue algorithms based on power iteration.
Definition poweriteration.hh:176
│ │ │ │ -
std::unique_ptr< BCRSMatrix > itMatrix_
Definition poweriteration.hh:1034
│ │ │ │ -
PowerIteration_Algorithms(const PowerIteration_Algorithms &)=delete
│ │ │ │ -
Impl::ScalingLinearOperator< BlockVector > ScalingOperator
Definition poweriteration.hh:181
│ │ │ │ -
const std::string blank_
Definition poweriteration.hh:1043
│ │ │ │ -
Impl::LinearOperatorSum< MatrixOperator, ScalingOperator > OperatorSum
Definition poweriteration.hh:182
│ │ │ │ -
Dune::MatrixAdapter< BCRSMatrix, BlockVector, BlockVector > MatrixOperator
Definition poweriteration.hh:180
│ │ │ │ -
void applyInverseIteration(const Real &epsilon, ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const
Perform the inverse iteration algorithm to compute an approximation lambda of the least dominant (i....
Definition poweriteration.hh:355
│ │ │ │ -
void applyTLIMEIteration(const Real &gamma, const Real &eta, const Real &epsilon, ISTLLinearSolver &solver, const Real &delta, const std::size_t &m, bool &extrnl, BlockVector &x, Real &lambda) const
Perform the "two-level iterative method for eigenvalue calculations (TLIME)" iteration algorit...
Definition poweriteration.hh:691
│ │ │ │ -
IterationOperator & getIterationOperator()
Return the iteration operator (m_ - mu_*I).
Definition poweriteration.hh:925
│ │ │ │ -
OperatorSum itOperator_
Definition poweriteration.hh:1030
│ │ │ │ -
const BCRSMatrix & m_
Definition poweriteration.hh:1018
│ │ │ │ -
PowerIteration_Algorithms(const BCRSMatrix &m, const unsigned int nIterationsMax=1000, const unsigned int verbosity_level=0)
Construct from required parameters.
Definition poweriteration.hh:206
│ │ │ │ -
const unsigned int nIterationsMax_
Definition poweriteration.hh:1019
│ │ │ │ -
void applyPowerIteration(const Real &epsilon, BlockVector &x, Real &lambda) const
Perform the power iteration algorithm to compute an approximation lambda of the dominant (i....
Definition poweriteration.hh:260
│ │ │ │ -
OperatorSum IterationOperator
Type of iteration operator (m_ - mu_*I)
Definition poweriteration.hh:189
│ │ │ │ -
void applyRayleighQuotientIteration(const Real &epsilon, ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const
Perform the Rayleigh quotient iteration algorithm to compute an approximation lambda of an eigenvalue...
Definition poweriteration.hh:533
│ │ │ │ -
void applyInverseIteration(const Real &gamma, const Real &epsilon, ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const
Perform the inverse iteration with shift algorithm to compute an approximation lambda of the eigenval...
Definition poweriteration.hh:394
│ │ │ │ -
const ScalingOperator scalingOperator_
Definition poweriteration.hh:1029
│ │ │ │ -
void updateShiftMu(const Real &mu, ISTLLinearSolver &solver) const
Update shift mu_, i.e. update iteration operator/matrix (m_ - mu_*I).
Definition poweriteration.hh:983
│ │ │ │ -
PowerIteration_Algorithms & operator=(const PowerIteration_Algorithms &)=delete
│ │ │ │ -
unsigned int getIterationCount() const
Return the number of iterations in last application of an algorithm.
Definition poweriteration.hh:959
│ │ │ │ -
const MatrixOperator matrixOperator_
Definition poweriteration.hh:1028
│ │ │ │ -
const BCRSMatrix & getIterationMatrix() const
Return the iteration matrix (m_ - mu_*I), provided on demand when needed (e.g. for direct solvers or ...
Definition poweriteration.hh:945
│ │ │ │ -
unsigned int nIterations_
Definition poweriteration.hh:1039
│ │ │ │ -
const unsigned int verbosity_level_
Definition poweriteration.hh:1022
│ │ │ │ -
const std::string title_
Definition poweriteration.hh:1042
│ │ │ │ -
BlockVector::field_type Real
Type of underlying field.
Definition poweriteration.hh:186
│ │ │ │ -
Real mu_
Definition poweriteration.hh:1025
│ │ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
A linear operator.
Definition operators.hh:67
│ │ │ │ -
X::field_type field_type
The field type of the operator.
Definition operators.hh:74
│ │ │ │ -
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0
apply operator to x, scale and add:
│ │ │ │ -
virtual SolverCategory::Category category() const =0
Category of the linear operator (see SolverCategory::Category)
│ │ │ │ -
Y range_type
The type of the range of the operator.
Definition operators.hh:72
│ │ │ │ -
virtual void apply(const X &x, Y &y) const =0
apply operator to x: The input vector is consistent and the output must also be consistent on the in...
│ │ │ │ -
X domain_type
The type of the domain of the operator.
Definition operators.hh:70
│ │ │ │ +
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ │ +
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ │ +
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ +
Definition matrixutils.hh:27
│ │ │ │ +
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ +
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:379
│ │ │ │ +
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:463
│ │ │ │ +
Definition aggregates.hh:480
│ │ │ │ +
Definition aggregates.hh:496
│ │ │ │ +
Criterion taking advantage of symmetric matrices.
Definition aggregates.hh:519
│ │ │ │ +
Criterion suitable for unsymmetric matrices.
Definition aggregates.hh:539
│ │ │ │ +
an algebraic multigrid method using a Krylov-cycle.
Definition kamg.hh:140
│ │ │ │ +
Two grid operator for AMG with Krylov cycle.
Definition kamg.hh:33
│ │ │ │ +
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ │ +
Definition amg.hh:625
│ │ │ │ + │ │ │ │ +
Definition amg.hh:1169
│ │ │ │ + │ │ │ │ +
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ │ + │ │ │ │ +
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ │ +
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ │ +
The criterion describing the stop criteria for the coarsening process.
Definition matrixhierarchy.hh:283
│ │ │ │ +
All parameters for AMG.
Definition parameters.hh:393
│ │ │ │ +
Definition pinfo.hh:28
│ │ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition preconditioner.hh:39
│ │ │ │ +
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ │
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ -
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:524
│ │ │ │ +
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
│ │ │ │ +
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ +
Categories for the solvers.
Definition solvercategory.hh:22
│ │ │ │
Category
Definition solvercategory.hh:23
│ │ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ +
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │ │ +
Definition solvercategory.hh:54
│ │ │ │ +
Definition solverregistry.hh:77
│ │ │ │ +
Definition solvertype.hh:16
│ │ │ │ +
SuperLu Solver.
Definition superlu.hh:271
│ │ │ │ +
Definition umfpack.hh:49
│ │ │ │ +
The UMFPack direct sparse solver.
Definition umfpack.hh:215
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -utf-8 │ │ │ │ │ +us-ascii │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,993 +1,1596 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ - * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ -poweriteration.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 (C) 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_EIGENVALUE_POWERITERATION_HH │ │ │ │ │ -6#define DUNE_ISTL_EIGENVALUE_POWERITERATION_HH │ │ │ │ │ +5#ifndef DUNE_AMG_AMG_HH │ │ │ │ │ +6#define DUNE_AMG_AMG_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include // provides std::size_t │ │ │ │ │ -9#include // provides std::sqrt, std::abs │ │ │ │ │ -10 │ │ │ │ │ -11#include // provides std::is_same │ │ │ │ │ -12#include // provides std::cout, std::endl │ │ │ │ │ -13#include // provides std::numeric_limits │ │ │ │ │ -14#include // provides std::left, std::ios::left │ │ │ │ │ -15#include // provides std::setw, std::resetiosflags │ │ │ │ │ -16#include // provides std::unique_ptr │ │ │ │ │ -17#include // provides std::string │ │ │ │ │ -18 │ │ │ │ │ -19#include // provides DUNE_THROW(...) │ │ │ │ │ -20 │ │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> // provides Dune::blockLevel │ │ │ │ │ -22#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> // provides Dune::LinearOperator │ │ │ │ │ -23#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> // provides Dune::SolverCategory:: │ │ │ │ │ -sequential │ │ │ │ │ -24#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> // provides Dune::IsDirectSolver │ │ │ │ │ -25#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> // provides Dune::MatrixAdapter │ │ │ │ │ -26#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> // provides Dune::ISTLError │ │ │ │ │ -27#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> // provides Dune::printvector(...) │ │ │ │ │ -28#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> // provides Dune::InverseOperatorResult │ │ │ │ │ -29 │ │ │ │ │ -30namespace _D_u_n_e │ │ │ │ │ -31{ │ │ │ │ │ -32 │ │ │ │ │ -37 namespace Impl { │ │ │ │ │ -45 template │ │ │ │ │ -46 class ScalingLinearOperator : public _D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -47 { │ │ │ │ │ -48 public: │ │ │ │ │ -49 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -50 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -51 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -52 │ │ │ │ │ -53 ScalingLinearOperator (field_type immutable_scaling, │ │ │ │ │ -54 const field_type& mutable_scaling) │ │ │ │ │ -55 : immutable_scaling_(immutable_scaling), │ │ │ │ │ -56 mutable_scaling_(mutable_scaling) │ │ │ │ │ -57 {} │ │ │ │ │ -58 │ │ │ │ │ -59 virtual void _a_p_p_l_y (const X& x, Y& y) const │ │ │ │ │ -60 { │ │ │ │ │ -61 y = x; │ │ │ │ │ -62 y *= immutable_scaling_*mutable_scaling_; │ │ │ │ │ -63 } │ │ │ │ │ -64 │ │ │ │ │ -65 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (field_type alpha, const X& x, Y& y) const │ │ │ │ │ -66 { │ │ │ │ │ -67 X temp(x); │ │ │ │ │ -68 temp *= immutable_scaling_*mutable_scaling_; │ │ │ │ │ -69 y.axpy(alpha,temp); │ │ │ │ │ -70 } │ │ │ │ │ -71 │ │ │ │ │ -73 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 │ │ │ │ │ -74 { │ │ │ │ │ -75 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; │ │ │ │ │ -76 } │ │ │ │ │ -77 │ │ │ │ │ -78 protected: │ │ │ │ │ -79 const field_type immutable_scaling_; │ │ │ │ │ -80 const field_type& mutable_scaling_; │ │ │ │ │ -81 }; │ │ │ │ │ -82 │ │ │ │ │ -83 │ │ │ │ │ -92 template │ │ │ │ │ -93 class LinearOperatorSum │ │ │ │ │ -94 : public _D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -96 { │ │ │ │ │ -97 public: │ │ │ │ │ -98 typedef typename OP1::domain_type domain_type; │ │ │ │ │ -99 typedef typename OP1::range_type range_type; │ │ │ │ │ -100 typedef typename domain_type::field_type field_type; │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ +15#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ │ +16#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ │ +17#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22#include │ │ │ │ │ +23#include │ │ │ │ │ +24 │ │ │ │ │ +25namespace _D_u_n_e │ │ │ │ │ +26{ │ │ │ │ │ +27 namespace Amg │ │ │ │ │ +28 { │ │ │ │ │ +46 template │ │ │ │ │ +47 class KAMG; │ │ │ │ │ +48 │ │ │ │ │ +49 template │ │ │ │ │ +50 class KAmgTwoGrid; │ │ │ │ │ +51 │ │ │ │ │ +62 template > │ │ │ │ │ +_6_4 class _A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +65 { │ │ │ │ │ +66 template │ │ │ │ │ +_6_7 friend class _K_A_M_G; │ │ │ │ │ +68 │ │ │ │ │ +69 friend class _K_A_m_g_T_w_o_G_r_i_d<_A_M_G>; │ │ │ │ │ +70 │ │ │ │ │ +71 public: │ │ │ │ │ +_7_3 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ │ +_8_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ │ +_8_2 typedef _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_> _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ │ +_8_4 typedef typename _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ │ +85 │ │ │ │ │ +_8_7 typedef X _D_o_m_a_i_n; │ │ │ │ │ +_8_9 typedef X _R_a_n_g_e; │ │ │ │ │ +_9_1 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_X_> _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ │ +_9_7 typedef S _S_m_o_o_t_h_e_r; │ │ │ │ │ +98 │ │ │ │ │ +_1_0_0 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ │ 101 │ │ │ │ │ -102 LinearOperatorSum (const OP1& op1, const OP2& op2) │ │ │ │ │ -103 : op1_(op1), op2_(op2) │ │ │ │ │ -104 { │ │ │ │ │ -105 static_assert(std::is_same::value, │ │ │ │ │ -106 "Domain type of both operators doesn't match!"); │ │ │ │ │ -107 static_assert(std::is_same::value, │ │ │ │ │ -108 "Range type of both operators doesn't match!"); │ │ │ │ │ -109 } │ │ │ │ │ -110 │ │ │ │ │ -111 virtual void _a_p_p_l_y (const domain_type& x, range_type& y) const │ │ │ │ │ -112 { │ │ │ │ │ -113 op1_.apply(x,y); │ │ │ │ │ -114 op2_.applyscaleadd(1.0,x,y); │ │ │ │ │ -115 } │ │ │ │ │ -116 │ │ │ │ │ -117 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (field_type alpha, │ │ │ │ │ -118 const domain_type& x, range_type& y) const │ │ │ │ │ -119 { │ │ │ │ │ -120 range_type temp(y); │ │ │ │ │ -121 op1_.apply(x,temp); │ │ │ │ │ -122 op2_.applyscaleadd(1.0,x,temp); │ │ │ │ │ -123 y.axpy(alpha,temp); │ │ │ │ │ -124 } │ │ │ │ │ -125 │ │ │ │ │ -127 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 │ │ │ │ │ -128 { │ │ │ │ │ -129 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; │ │ │ │ │ -130 } │ │ │ │ │ -131 │ │ │ │ │ -132 protected: │ │ │ │ │ -133 const OP1& op1_; │ │ │ │ │ -134 const OP2& op2_; │ │ │ │ │ -135 }; │ │ │ │ │ -136 } // end namespace Impl │ │ │ │ │ -137 │ │ │ │ │ -174 template │ │ │ │ │ -_1_7_5 class _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ -176 { │ │ │ │ │ -177 protected: │ │ │ │ │ -178 // Type definitions for type of iteration operator (m_ - mu_*I) │ │ │ │ │ -179 typedef typename _D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_<_B_C_R_S_M_a_t_r_i_x_,_B_l_o_c_k_V_e_c_t_o_r_,_B_l_o_c_k_V_e_c_t_o_r_> │ │ │ │ │ -_1_8_0 _M_a_t_r_i_x_O_p_e_r_a_t_o_r; │ │ │ │ │ -_1_8_1 typedef Impl::ScalingLinearOperator _S_c_a_l_i_n_g_O_p_e_r_a_t_o_r; │ │ │ │ │ -_1_8_2 typedef Impl::LinearOperatorSum │ │ │ │ │ -_O_p_e_r_a_t_o_r_S_u_m; │ │ │ │ │ -183 │ │ │ │ │ -184 public: │ │ │ │ │ -_1_8_6 typedef typename _B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e _R_e_a_l; │ │ │ │ │ -187 │ │ │ │ │ -_1_8_9 typedef _O_p_e_r_a_t_o_r_S_u_m _I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r; │ │ │ │ │ -190 │ │ │ │ │ -191 public: │ │ │ │ │ -_2_0_6 _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s (const _B_C_R_S_M_a_t_r_i_x& m, │ │ │ │ │ -207 const unsigned int nIterationsMax = 1000, │ │ │ │ │ -208 const unsigned int verbosity_level = 0) │ │ │ │ │ -209 : _m__(m), _n_I_t_e_r_a_t_i_o_n_s_M_a_x__(nIterationsMax), │ │ │ │ │ -210 _v_e_r_b_o_s_i_t_y___l_e_v_e_l__(verbosity_level), │ │ │ │ │ -211 _m_u__(0.0), │ │ │ │ │ -212 _m_a_t_r_i_x_O_p_e_r_a_t_o_r__(_m__), │ │ │ │ │ -213 _s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__(-1.0,_m_u__), │ │ │ │ │ -214 _i_t_O_p_e_r_a_t_o_r__(_m_a_t_r_i_x_O_p_e_r_a_t_o_r__,_s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__), │ │ │ │ │ -215 _n_I_t_e_r_a_t_i_o_n_s__(0), │ │ │ │ │ -216 _t_i_t_l_e__(" PowerIteration_Algorithms: "), │ │ │ │ │ -217 _b_l_a_n_k__(_t_i_t_l_e__.length(),' ') │ │ │ │ │ -218 { │ │ │ │ │ -219 // assert that BCRSMatrix type has blocklevel 2 │ │ │ │ │ -220 static_assert │ │ │ │ │ -221 (blockLevel() == 2, │ │ │ │ │ -222 "Only BCRSMatrices with blocklevel 2 are supported."); │ │ │ │ │ -223 │ │ │ │ │ -224 // assert that BCRSMatrix type has square blocks │ │ │ │ │ -225 static_assert │ │ │ │ │ -226 (BCRSMatrix::block_type::rows == BCRSMatrix::block_type::cols, │ │ │ │ │ -227 "Only BCRSMatrices with square blocks are supported."); │ │ │ │ │ -228 │ │ │ │ │ -229 // assert that m_ is square │ │ │ │ │ -230 const int nrows = _m__._M() * BCRSMatrix::block_type::rows; │ │ │ │ │ -231 const int ncols = _m__._N() * BCRSMatrix::block_type::cols; │ │ │ │ │ -232 if (nrows != ncols) │ │ │ │ │ -233 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ -234 << nrows << "x" << ncols << ")."); │ │ │ │ │ -235 } │ │ │ │ │ -236 │ │ │ │ │ -_2_4_0 _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s (const _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s&) = delete; │ │ │ │ │ -241 │ │ │ │ │ -245 _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s& │ │ │ │ │ -_2_4_6 _o_p_e_r_a_t_o_r_=_ (const _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s&) = delete; │ │ │ │ │ -247 │ │ │ │ │ -_2_6_0 inline void _a_p_p_l_y_P_o_w_e_r_I_t_e_r_a_t_i_o_n (const _R_e_a_l& epsilon, │ │ │ │ │ -261 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ -262 { │ │ │ │ │ -263 // print verbosity information │ │ │ │ │ -264 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -265 std::cout << _t_i_t_l_e__ │ │ │ │ │ -266 << "Performing power iteration approximating " │ │ │ │ │ -267 << "the dominant eigenvalue." << std::endl; │ │ │ │ │ -268 │ │ │ │ │ -269 // allocate memory for auxiliary variables │ │ │ │ │ -270 _B_l_o_c_k_V_e_c_t_o_r y(x); │ │ │ │ │ -271 _B_l_o_c_k_V_e_c_t_o_r temp(x); │ │ │ │ │ -272 │ │ │ │ │ -273 // perform power iteration │ │ │ │ │ -274 x *= (1.0 / x.two_norm()); │ │ │ │ │ -275 _m__._m_v(x,y); │ │ │ │ │ -276 _R_e_a_l r_norm = std::numeric_limits::max(); │ │ │ │ │ -277 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ -278 while (r_norm > epsilon) │ │ │ │ │ -279 { │ │ │ │ │ -280 // update and check number of iterations │ │ │ │ │ -281 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ -282 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Power iteration did not converge " │ │ │ │ │ -283 << "in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ << " iterations " │ │ │ │ │ -284 << "(║residual║_2 = " << r_norm << ", epsilon = " │ │ │ │ │ -285 << epsilon << ")."); │ │ │ │ │ -286 │ │ │ │ │ -287 // do one iteration of the power iteration algorithm │ │ │ │ │ -288 // (use that y = m_ * x) │ │ │ │ │ -289 x = y; │ │ │ │ │ -290 x *= (1.0 / y.two_norm()); │ │ │ │ │ -291 │ │ │ │ │ -292 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ -293 _m__._m_v(x,y); │ │ │ │ │ -294 lambda = x * y; │ │ │ │ │ -295 │ │ │ │ │ -296 // get norm of residual (use that y = m_ * x) │ │ │ │ │ -297 temp = y; │ │ │ │ │ -298 temp.axpy(-lambda,x); │ │ │ │ │ -299 r_norm = temp.two_norm(); │ │ │ │ │ -300 │ │ │ │ │ -301 // print verbosity information │ │ │ │ │ -302 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -303 std::cout << _b_l_a_n_k__ << std::left │ │ │ │ │ -304 << "iteration " << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ -305 << " (║residual║_2 = " << std::setw(11) << r_norm │ │ │ │ │ -306 << "): λ = " << lambda << std::endl │ │ │ │ │ -307 << std::resetiosflags(std::ios::left); │ │ │ │ │ -308 } │ │ │ │ │ -309 │ │ │ │ │ -310 // print verbosity information │ │ │ │ │ -311 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -312 { │ │ │ │ │ -313 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -314 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -315 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -316 << "λ = " << lambda << std::endl; │ │ │ │ │ -317 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -318 { │ │ │ │ │ -319 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ -320 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -321 } │ │ │ │ │ -322 } │ │ │ │ │ -323 } │ │ │ │ │ -324 │ │ │ │ │ -353 template │ │ │ │ │ -_3_5_5 inline void _a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n (const _R_e_a_l& epsilon, │ │ │ │ │ -356 ISTLLinearSolver& solver, │ │ │ │ │ -357 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ -358 { │ │ │ │ │ -359 constexpr _R_e_a_l gamma = 0.0; │ │ │ │ │ -360 _a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n(gamma,epsilon,solver,x,lambda); │ │ │ │ │ -361 } │ │ │ │ │ -362 │ │ │ │ │ -392 template │ │ │ │ │ -_3_9_4 inline void _a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n (const _R_e_a_l& gamma, │ │ │ │ │ -395 const _R_e_a_l& epsilon, │ │ │ │ │ -396 ISTLLinearSolver& solver, │ │ │ │ │ -397 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ -398 { │ │ │ │ │ -399 // print verbosity information │ │ │ │ │ -400 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -401 { │ │ │ │ │ -402 std::cout << _t_i_t_l_e__; │ │ │ │ │ -403 if (gamma == 0.0) │ │ │ │ │ -404 std::cout << "Performing inverse iteration approximating " │ │ │ │ │ -405 << "the least dominant eigenvalue." << std::endl; │ │ │ │ │ -406 else │ │ │ │ │ -407 std::cout << "Performing inverse iteration with shift " │ │ │ │ │ -408 << "gamma = " << gamma << " approximating the " │ │ │ │ │ -409 << "eigenvalue closest to gamma." << std::endl; │ │ │ │ │ -410 } │ │ │ │ │ -411 │ │ │ │ │ -412 // initialize iteration operator, │ │ │ │ │ -413 // initialize iteration matrix when needed │ │ │ │ │ -414 _u_p_d_a_t_e_S_h_i_f_t_M_u(gamma,solver); │ │ │ │ │ -415 │ │ │ │ │ -416 // allocate memory for linear solver statistics │ │ │ │ │ -417 _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 solver_statistics; │ │ │ │ │ -418 │ │ │ │ │ -419 // allocate memory for auxiliary variables │ │ │ │ │ -420 _B_l_o_c_k_V_e_c_t_o_r y(x); │ │ │ │ │ -421 _R_e_a_l y_norm; │ │ │ │ │ -422 _B_l_o_c_k_V_e_c_t_o_r temp(x); │ │ │ │ │ -423 │ │ │ │ │ -424 // perform inverse iteration with shift │ │ │ │ │ -425 x *= (1.0 / x.two_norm()); │ │ │ │ │ -426 _R_e_a_l r_norm = std::numeric_limits::max(); │ │ │ │ │ -427 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ -428 while (r_norm > epsilon) │ │ │ │ │ -429 { │ │ │ │ │ -430 // update and check number of iterations │ │ │ │ │ -431 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ -432 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Inverse iteration " │ │ │ │ │ -433 << (gamma != 0.0 ? "with shift " : "") << "did not " │ │ │ │ │ -434 << "converge in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ << " iterations " │ │ │ │ │ -435 << "(║residual║_2 = " << r_norm << ", epsilon = " │ │ │ │ │ -436 << epsilon << ")."); │ │ │ │ │ -437 │ │ │ │ │ -438 // do one iteration of the inverse iteration with shift algorithm, │ │ │ │ │ -439 // part 1: solve (m_ - gamma*I) * y = x for y │ │ │ │ │ -440 // (protect x from being changed) │ │ │ │ │ -441 temp = x; │ │ │ │ │ -442 solver.apply(y,temp,solver_statistics); │ │ │ │ │ -443 │ │ │ │ │ -444 // get norm of y │ │ │ │ │ -445 y_norm = y.two_norm(); │ │ │ │ │ -446 │ │ │ │ │ -447 // compile time switch between accuracy and efficiency │ │ │ │ │ -448 if (avoidLinSolverCrime) │ │ │ │ │ -449 { │ │ │ │ │ -450 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ -451 // (use that x_new = y / y_norm) │ │ │ │ │ -452 _m__._m_v(y,temp); │ │ │ │ │ -453 lambda = (y * temp) / (y_norm * y_norm); │ │ │ │ │ -454 │ │ │ │ │ -455 // get norm of residual │ │ │ │ │ -456 // (use that x_new = y / y_norm, additionally use that temp = m_ * y) │ │ │ │ │ -457 temp.axpy(-lambda,y); │ │ │ │ │ -458 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ -459 } │ │ │ │ │ -460 else │ │ │ │ │ -461 { │ │ │ │ │ -462 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ -463 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x) │ │ │ │ │ -464 lambda = gamma + (y * x) / (y_norm * y_norm); │ │ │ │ │ -465 │ │ │ │ │ -466 // get norm of residual │ │ │ │ │ -467 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x) │ │ │ │ │ -468 temp = x; temp.axpy(gamma-lambda,y); │ │ │ │ │ -469 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ -470 } │ │ │ │ │ -471 │ │ │ │ │ -472 // do one iteration of the inverse iteration with shift algorithm, │ │ │ │ │ -473 // part 2: update x │ │ │ │ │ -474 x = y; │ │ │ │ │ -475 x *= (1.0 / y_norm); │ │ │ │ │ -476 │ │ │ │ │ -477 // print verbosity information │ │ │ │ │ -478 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -479 std::cout << _b_l_a_n_k__ << std::left │ │ │ │ │ -480 << "iteration " << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ -481 << " (║residual║_2 = " << std::setw(11) << r_norm │ │ │ │ │ -482 << "): λ = " << lambda << std::endl │ │ │ │ │ -483 << std::resetiosflags(std::ios::left); │ │ │ │ │ -484 } │ │ │ │ │ -485 │ │ │ │ │ -486 // print verbosity information │ │ │ │ │ -487 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -488 { │ │ │ │ │ -489 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -490 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -491 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -492 << "λ = " << lambda << std::endl; │ │ │ │ │ -493 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -494 { │ │ │ │ │ -495 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ -496 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -497 } │ │ │ │ │ -498 } │ │ │ │ │ -499 } │ │ │ │ │ -500 │ │ │ │ │ -531 template │ │ │ │ │ -_5_3_3 inline void _a_p_p_l_y_R_a_y_l_e_i_g_h_Q_u_o_t_i_e_n_t_I_t_e_r_a_t_i_o_n (const _R_e_a_l& epsilon, │ │ │ │ │ -534 ISTLLinearSolver& solver, │ │ │ │ │ -535 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ -536 { │ │ │ │ │ -537 // print verbosity information │ │ │ │ │ -538 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -539 std::cout << _t_i_t_l_e__ │ │ │ │ │ -540 << "Performing Rayleigh quotient iteration for " │ │ │ │ │ -541 << "estimated eigenvalue " << lambda << "." << std::endl; │ │ │ │ │ +_1_1_1 _A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ │ +112 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& parms); │ │ │ │ │ +113 │ │ │ │ │ +125 template │ │ │ │ │ +_1_2_6 _A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ │ +127 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs=_S_m_o_o_t_h_e_r_A_r_g_s(), │ │ │ │ │ +128 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ +129 │ │ │ │ │ +_1_8_0 _A_M_G(std::shared_ptr fineOperator, const ParameterTree& │ │ │ │ │ +configuration, const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ +181 │ │ │ │ │ +_1_8_5 _A_M_G(const _A_M_G& amg); │ │ │ │ │ +186 │ │ │ │ │ +_1_8_8 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ │ +189 │ │ │ │ │ +_1_9_1 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ │ +192 │ │ │ │ │ +_1_9_4 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +195 { │ │ │ │ │ +196 return category_; │ │ │ │ │ +197 } │ │ │ │ │ +198 │ │ │ │ │ +_2_0_0 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ │ +201 │ │ │ │ │ +206 template │ │ │ │ │ +_2_0_7 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont); │ │ │ │ │ +208 │ │ │ │ │ +_2_0_9 std::size_t _l_e_v_e_l_s(); │ │ │ │ │ +210 │ │ │ │ │ +_2_1_1 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ │ +212 │ │ │ │ │ +_2_2_1 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ │ +222 { │ │ │ │ │ +223 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ │ +224 } │ │ │ │ │ +225 │ │ │ │ │ +_2_3_0 bool _u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const; │ │ │ │ │ +231 │ │ │ │ │ +232 private: │ │ │ │ │ +233 /* │ │ │ │ │ +234 * @brief Helper function to create hierarchies with parameter tree. │ │ │ │ │ +235 * │ │ │ │ │ +236 * Will create the coarsen criterion with the norm and create the │ │ │ │ │ +237 * Hierarchies │ │ │ │ │ +238 * \tparam Norm Type of the norm to use. │ │ │ │ │ +239 */ │ │ │ │ │ +240 template │ │ │ │ │ +241 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ │ +matrixptr, │ │ │ │ │ +242 const PI& pinfo, const Norm&, │ │ │ │ │ +243 const ParameterTree& configuration, │ │ │ │ │ +244 std::true_type compiles = std::true_type()); │ │ │ │ │ +245 template │ │ │ │ │ +246 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ │ +matrixptr, │ │ │ │ │ +247 const PI& pinfo, const Norm&, │ │ │ │ │ +248 const ParameterTree& configuration, │ │ │ │ │ +249 std::false_type); │ │ │ │ │ +254 template │ │ │ │ │ +255 void createHierarchies(C& criterion, std::shared_ptr │ │ │ │ │ +matrixptr, │ │ │ │ │ +256 const PI& pinfo, const ParameterTree& configuration); │ │ │ │ │ +263 template │ │ │ │ │ +264 void createHierarchies(C& criterion, │ │ │ │ │ +265 const std::shared_ptr& matrixptr, │ │ │ │ │ +266 const PI& pinfo); │ │ │ │ │ +273 struct LevelContext │ │ │ │ │ +274 { │ │ │ │ │ +_2_7_5 typedef _S_m_o_o_t_h_e_r _S_m_o_o_t_h_e_r_T_y_p_e; │ │ │ │ │ +_2_7_9 typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r _s_m_o_o_t_h_e_r; │ │ │ │ │ +_2_8_3 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ │ +_2_8_7 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r _p_i_n_f_o; │ │ │ │ │ +_2_9_1 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ │ +_2_9_5 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ │ +_2_9_9 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _l_h_s; │ │ │ │ │ +_3_0_3 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _u_p_d_a_t_e; │ │ │ │ │ +_3_0_7 typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r _r_h_s; │ │ │ │ │ +_3_1_1 std::size_t _l_e_v_e_l; │ │ │ │ │ +312 }; │ │ │ │ │ +313 │ │ │ │ │ +314 │ │ │ │ │ +319 void mgc(LevelContext& levelContext); │ │ │ │ │ +320 │ │ │ │ │ +321 void additiveMgc(); │ │ │ │ │ +322 │ │ │ │ │ +329 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel); │ │ │ │ │ +330 │ │ │ │ │ +335 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ │ +336 │ │ │ │ │ +341 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ │ +342 │ │ │ │ │ +344 std::shared_ptr matrices_; │ │ │ │ │ +346 _S_m_o_o_t_h_e_r_A_r_g_s smootherArgs_; │ │ │ │ │ +348 std::shared_ptr > smoothers_; │ │ │ │ │ +350 std::shared_ptr solver_; │ │ │ │ │ +352 std::shared_ptr> rhs_; │ │ │ │ │ +354 std::shared_ptr> lhs_; │ │ │ │ │ +356 std::shared_ptr> update_; │ │ │ │ │ +358 using _S_c_a_l_a_r_P_r_o_d_u_c_t = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ │ +360 std::shared_ptr scalarProduct_; │ │ │ │ │ +362 std::size_t gamma_; │ │ │ │ │ +364 std::size_t preSteps_; │ │ │ │ │ +366 std::size_t postSteps_; │ │ │ │ │ +367 bool buildHierarchy_; │ │ │ │ │ +368 bool additive; │ │ │ │ │ +369 bool coarsesolverconverged; │ │ │ │ │ +370 std::shared_ptr coarseSmoother_; │ │ │ │ │ +372 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category_; │ │ │ │ │ +374 std::size_t verbosity_; │ │ │ │ │ +375 │ │ │ │ │ +376 struct ToLower │ │ │ │ │ +377 { │ │ │ │ │ +_3_7_8 std::string _o_p_e_r_a_t_o_r_(_)(const std::string& str) │ │ │ │ │ +379 { │ │ │ │ │ +380 std::stringstream retval; │ │ │ │ │ +381 std::ostream_iterator out(retval); │ │ │ │ │ +382 std::transform(str.begin(), str.end(), out, │ │ │ │ │ +383 [](char c){ │ │ │ │ │ +384 return std::tolower(c, std::locale::classic()); │ │ │ │ │ +385 }); │ │ │ │ │ +386 return retval.str(); │ │ │ │ │ +387 } │ │ │ │ │ +388 }; │ │ │ │ │ +389 }; │ │ │ │ │ +390 │ │ │ │ │ +391 template │ │ │ │ │ +_3_9_2 inline _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _A_M_G& amg) │ │ │ │ │ +393 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_), │ │ │ │ │ +394 smoothers_(amg.smoothers_), solver_(amg.solver_), │ │ │ │ │ +395 rhs_(), lhs_(), update_(), │ │ │ │ │ +396 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_), │ │ │ │ │ +397 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ │ +398 buildHierarchy_(amg.buildHierarchy_), │ │ │ │ │ +399 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ │ +400 coarseSmoother_(amg.coarseSmoother_), │ │ │ │ │ +401 category_(amg.category_), │ │ │ │ │ +402 verbosity_(amg.verbosity_) │ │ │ │ │ +403 {} │ │ │ │ │ +404 │ │ │ │ │ +405 template │ │ │ │ │ +_4_0_6 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& │ │ │ │ │ +coarseSolver, │ │ │ │ │ +407 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ │ +408 const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ │ +409 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_ │ │ │ │ │ +(smootherArgs), │ │ │ │ │ +410 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(&coarseSolver), │ │ │ │ │ +411 rhs_(), lhs_(), update_(), scalarProduct_(0), │ │ │ │ │ +412 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ │ +413 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ │ +414 additive(parms.getAdditive()), coarsesolverconverged(true), │ │ │ │ │ +415 coarseSmoother_(), │ │ │ │ │ +416// #warning should category be retrieved from matrices? │ │ │ │ │ +417 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(*smoothers_->coarsest())), │ │ │ │ │ +418 verbosity_(parms.debugLevel()) │ │ │ │ │ +419 { │ │ │ │ │ +420 assert(matrices_->isBuilt()); │ │ │ │ │ +421 │ │ │ │ │ +422 // build the necessary smoother hierarchies │ │ │ │ │ +423 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ │ +424 } │ │ │ │ │ +425 │ │ │ │ │ +426 template │ │ │ │ │ +427 template │ │ │ │ │ +_4_2_8 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _O_p_e_r_a_t_o_r& matrix, │ │ │ │ │ +429 const C& criterion, │ │ │ │ │ +430 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ │ +431 const PI& pinfo) │ │ │ │ │ +432 : smootherArgs_(smootherArgs), │ │ │ │ │ +433 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(), │ │ │ │ │ +434 rhs_(), lhs_(), update_(), scalarProduct_(), │ │ │ │ │ +435 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()), │ │ │ │ │ +436 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true), │ │ │ │ │ +437 additive(criterion.getAdditive()), coarsesolverconverged(true), │ │ │ │ │ +438 coarseSmoother_(), │ │ │ │ │ +439 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(pinfo)), │ │ │ │ │ +440 verbosity_(criterion.debugLevel()) │ │ │ │ │ +441 { │ │ │ │ │ +442 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(matrix) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo)) │ │ │ │ │ +443 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "Matrix and Communication must have the │ │ │ │ │ +same SolverCategory!"); │ │ │ │ │ +444 // TODO: reestablish compile time checks. │ │ │ │ │ +445 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ │ +category), │ │ │ │ │ +446 // "Matrix and Solver must match in terms of category!"); │ │ │ │ │ +447 auto matrixptr = stackobject_to_shared_ptr(matrix); │ │ │ │ │ +448 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ │ +449 } │ │ │ │ │ +450 │ │ │ │ │ +451 template │ │ │ │ │ +_4_5_2 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(std::shared_ptr matrixptr, │ │ │ │ │ +453 const ParameterTree& configuration, │ │ │ │ │ +454 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo) : │ │ │ │ │ +455 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), │ │ │ │ │ +456 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_ │ │ │ │ │ +(true), │ │ │ │ │ +457 coarsesolverconverged(true), coarseSmoother_(), │ │ │ │ │ +458 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(pinfo)) │ │ │ │ │ +459 { │ │ │ │ │ +460 │ │ │ │ │ +461 if (configuration.hasKey ("smootherIterations")) │ │ │ │ │ +462 smootherArgs_.iterations = configuration.get("smootherIterations"); │ │ │ │ │ +463 │ │ │ │ │ +464 if (configuration.hasKey ("smootherRelaxation")) │ │ │ │ │ +465 smootherArgs_.relaxationFactor = configuration.get("smootherRelaxation"); │ │ │ │ │ +466 │ │ │ │ │ +467 auto normName = ToLower()(configuration.get("strengthMeasure", │ │ │ │ │ +"diagonal")); │ │ │ │ │ +468 auto index = configuration.get("diagonalRowIndex", 0); │ │ │ │ │ +469 │ │ │ │ │ +470 if ( normName == "diagonal") │ │ │ │ │ +471 { │ │ │ │ │ +472 using _f_i_e_l_d___t_y_p_e = typename M::field_type; │ │ │ │ │ +473 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +474 std::is_convertible compiles; │ │ │ │ │ +475 │ │ │ │ │ +476 switch (index) │ │ │ │ │ +477 { │ │ │ │ │ +478 case 0: │ │ │ │ │ +479 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_0_>(), │ │ │ │ │ +configuration, compiles); │ │ │ │ │ +480 break; │ │ │ │ │ +481 case 1: │ │ │ │ │ +482 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_1_>(), │ │ │ │ │ +configuration, compiles); │ │ │ │ │ +483 break; │ │ │ │ │ +484 case 2: │ │ │ │ │ +485 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_2_>(), │ │ │ │ │ +configuration, compiles); │ │ │ │ │ +486 break; │ │ │ │ │ +487 case 3: │ │ │ │ │ +488 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_3_>(), │ │ │ │ │ +configuration, compiles); │ │ │ │ │ +489 break; │ │ │ │ │ +490 case 4: │ │ │ │ │ +491 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_4_>(), │ │ │ │ │ +configuration, compiles); │ │ │ │ │ +492 break; │ │ │ │ │ +493 default: │ │ │ │ │ +494 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not │ │ │ │ │ +supported."); │ │ │ │ │ +495 } │ │ │ │ │ +496 } │ │ │ │ │ +497 else if (normName == "rowsum") │ │ │ │ │ +498 createCriterionAndHierarchies(matrixptr, pinfo, _R_o_w_S_u_m(), configuration); │ │ │ │ │ +499 else if (normName == "frobenius") │ │ │ │ │ +500 createCriterionAndHierarchies(matrixptr, pinfo, _F_r_o_b_e_n_i_u_s_N_o_r_m(), │ │ │ │ │ +configuration); │ │ │ │ │ +501 else if (normName == "one") │ │ │ │ │ +502 createCriterionAndHierarchies(matrixptr, pinfo, _A_l_w_a_y_s_O_n_e_N_o_r_m(), │ │ │ │ │ +configuration); │ │ │ │ │ +503 else │ │ │ │ │ +504 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure │ │ │ │ │ +"< │ │ │ │ │ +508 template │ │ │ │ │ +509 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_c_r_e_a_t_e_C_r_i_t_e_r_i_o_n_A_n_d_H_i_e_r_a_r_c_h_i_e_s(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ │ +configuration, std::false_type) │ │ │ │ │ +510 { │ │ │ │ │ +511 DUNE_THROW(InvalidStateException, "Strength of connection measure does not │ │ │ │ │ +support this type (" │ │ │ │ │ +512 << className() << ") as it is lacking a conversion │ │ │ │ │ +to" │ │ │ │ │ +513 << className::real_type>() << │ │ │ │ │ +"."); │ │ │ │ │ +514 } │ │ │ │ │ +515 │ │ │ │ │ +516 template │ │ │ │ │ +517 template │ │ │ │ │ +518 void AMG::createCriterionAndHierarchies(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ │ +configuration, std::true_type) │ │ │ │ │ +519 { │ │ │ │ │ +520 if (configuration.get("criterionSymmetric", true)) │ │ │ │ │ +521 { │ │ │ │ │ +522 using Criterion = _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n< │ │ │ │ │ +523 _D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_N_o_r_m_> >; │ │ │ │ │ +524 Criterion criterion; │ │ │ │ │ +525 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ │ +526 } │ │ │ │ │ +527 else │ │ │ │ │ +528 { │ │ │ │ │ +529 using Criterion = _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n< │ │ │ │ │ +530 _D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_N_o_r_m_> >; │ │ │ │ │ +531 Criterion criterion; │ │ │ │ │ +532 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ │ +533 } │ │ │ │ │ +534 } │ │ │ │ │ +535 │ │ │ │ │ +536 template │ │ │ │ │ +537 template │ │ │ │ │ +538 void AMG::createHierarchies(C& criterion, std::shared_ptr matrixptr, const PI& pinfo, const ParameterTree& configuration) │ │ │ │ │ +539 { │ │ │ │ │ +540 if (configuration.hasKey ("maxLevel")) │ │ │ │ │ +541 criterion.setMaxLevel(configuration.get("maxLevel")); │ │ │ │ │ 542 │ │ │ │ │ -543 // allocate memory for linear solver statistics │ │ │ │ │ -544 _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 solver_statistics; │ │ │ │ │ +543 if (configuration.hasKey ("minCoarseningRate")) │ │ │ │ │ +544 criterion.setMinCoarsenRate(configuration.get("minCoarseningRate")); │ │ │ │ │ 545 │ │ │ │ │ -546 // allocate memory for auxiliary variables │ │ │ │ │ -547 _B_l_o_c_k_V_e_c_t_o_r y(x); │ │ │ │ │ -548 _R_e_a_l y_norm; │ │ │ │ │ -549 _R_e_a_l lambda_update; │ │ │ │ │ -550 _B_l_o_c_k_V_e_c_t_o_r temp(x); │ │ │ │ │ -551 │ │ │ │ │ -552 // perform Rayleigh quotient iteration │ │ │ │ │ -553 x *= (1.0 / x.two_norm()); │ │ │ │ │ -554 _R_e_a_l r_norm = std::numeric_limits::max(); │ │ │ │ │ -555 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ -556 while (r_norm > epsilon) │ │ │ │ │ -557 { │ │ │ │ │ -558 // update and check number of iterations │ │ │ │ │ -559 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ -560 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Rayleigh quotient iteration did not " │ │ │ │ │ -561 << "converge in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ << " iterations " │ │ │ │ │ -562 << "(║residual║_2 = " << r_norm << ", epsilon = " │ │ │ │ │ -563 << epsilon << ")."); │ │ │ │ │ -564 │ │ │ │ │ -565 // update iteration operator, │ │ │ │ │ -566 // update iteration matrix when needed │ │ │ │ │ -567 _u_p_d_a_t_e_S_h_i_f_t_M_u(lambda,solver); │ │ │ │ │ -568 │ │ │ │ │ -569 // do one iteration of the Rayleigh quotient iteration algorithm, │ │ │ │ │ -570 // part 1: solve (m_ - lambda*I) * y = x for y │ │ │ │ │ -571 // (protect x from being changed) │ │ │ │ │ -572 temp = x; │ │ │ │ │ -573 solver.apply(y,temp,solver_statistics); │ │ │ │ │ -574 │ │ │ │ │ -575 // get norm of y │ │ │ │ │ -576 y_norm = y.two_norm(); │ │ │ │ │ -577 │ │ │ │ │ -578 // compile time switch between accuracy and efficiency │ │ │ │ │ -579 if (avoidLinSolverCrime) │ │ │ │ │ -580 { │ │ │ │ │ -581 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ -582 // (use that x_new = y / y_norm) │ │ │ │ │ -583 _m__._m_v(y,temp); │ │ │ │ │ -584 lambda = (y * temp) / (y_norm * y_norm); │ │ │ │ │ -585 │ │ │ │ │ -586 // get norm of residual │ │ │ │ │ -587 // (use that x_new = y / y_norm, additionally use that temp = m_ * y) │ │ │ │ │ -588 temp.axpy(-lambda,y); │ │ │ │ │ -589 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ -590 } │ │ │ │ │ -591 else │ │ │ │ │ -592 { │ │ │ │ │ -593 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ -594 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x) │ │ │ │ │ -595 lambda_update = (y * x) / (y_norm * y_norm); │ │ │ │ │ -596 lambda += lambda_update; │ │ │ │ │ -597 │ │ │ │ │ -598 // get norm of residual │ │ │ │ │ -599 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x) │ │ │ │ │ -600 temp = x; temp.axpy(-lambda_update,y); │ │ │ │ │ -601 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ -602 } │ │ │ │ │ +546 if (configuration.hasKey ("coarsenTarget")) │ │ │ │ │ +547 criterion.setCoarsenTarget (configuration.get("coarsenTarget")); │ │ │ │ │ +548 │ │ │ │ │ +549 if (configuration.hasKey ("accumulationMode")) │ │ │ │ │ +550 { │ │ │ │ │ +551 std::string mode = ToLower()(configuration.get │ │ │ │ │ +("accumulationMode")); │ │ │ │ │ +552 if ( mode == "none") │ │ │ │ │ +553 criterion.setAccumulate(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_n_o_A_c_c_u); │ │ │ │ │ +554 else if ( mode == "atonce" ) │ │ │ │ │ +555 criterion.setAccumulate(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_a_t_O_n_c_e_A_c_c_u); │ │ │ │ │ +556 else if ( mode == "successive") │ │ │ │ │ +557 criterion.setCoarsenTarget (_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u); │ │ │ │ │ +558 else │ │ │ │ │ +559 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ │ +does not allow value " │ │ │ │ │ +560 << mode <<"."); │ │ │ │ │ +561 } │ │ │ │ │ +562 │ │ │ │ │ +563 if (configuration.hasKey ("prolongationDampingFactor")) │ │ │ │ │ +564 criterion.setProlongationDampingFactor (configuration.get │ │ │ │ │ +("prolongationDampingFactor")); │ │ │ │ │ +565 │ │ │ │ │ +566 if (configuration.hasKey("defaultAggregationSizeMode")) │ │ │ │ │ +567 { │ │ │ │ │ +568 auto mode = ToLower()(configuration.get │ │ │ │ │ +("defaultAggregationSizeMode")); │ │ │ │ │ +569 auto dim = configuration.get("defaultAggregationDimension"); │ │ │ │ │ +570 std::size_t maxDistance = 2; │ │ │ │ │ +571 if (configuration.hasKey("MaxAggregateDistance")) │ │ │ │ │ +572 maxDistance = configuration.get("maxAggregateDistance"); │ │ │ │ │ +573 if (mode == "isotropic") │ │ │ │ │ +574 criterion.setDefaultValuesIsotropic(dim, maxDistance); │ │ │ │ │ +575 else if(mode == "anisotropic") │ │ │ │ │ +576 criterion.setDefaultValuesAnisotropic(dim, maxDistance); │ │ │ │ │ +577 else │ │ │ │ │ +578 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ │ +does not allow value " │ │ │ │ │ +579 << mode <<"."); │ │ │ │ │ +580 } │ │ │ │ │ +581 │ │ │ │ │ +582 if (configuration.hasKey("maxAggregateDistance")) │ │ │ │ │ +583 criterion.setMaxDistance(configuration.get │ │ │ │ │ +("maxAggregateDistance")); │ │ │ │ │ +584 │ │ │ │ │ +585 if (configuration.hasKey("minAggregateSize")) │ │ │ │ │ +586 criterion.setMinAggregateSize(configuration.get │ │ │ │ │ +("minAggregateSize")); │ │ │ │ │ +587 │ │ │ │ │ +588 if (configuration.hasKey("maxAggregateSize")) │ │ │ │ │ +589 criterion.setMaxAggregateSize(configuration.get │ │ │ │ │ +("maxAggregateSize")); │ │ │ │ │ +590 │ │ │ │ │ +591 if (configuration.hasKey("maxAggregateConnectivity")) │ │ │ │ │ +592 criterion.setMaxConnectivity(configuration.get │ │ │ │ │ +("maxAggregateConnectivity")); │ │ │ │ │ +593 │ │ │ │ │ +594 if (configuration.hasKey ("alpha")) │ │ │ │ │ +595 criterion.setAlpha (configuration.get ("alpha")); │ │ │ │ │ +596 │ │ │ │ │ +597 if (configuration.hasKey ("beta")) │ │ │ │ │ +598 criterion.setBeta (configuration.get ("beta")); │ │ │ │ │ +599 │ │ │ │ │ +600 if (configuration.hasKey ("gamma")) │ │ │ │ │ +601 criterion.setGamma (configuration.get ("gamma")); │ │ │ │ │ +602 gamma_ = criterion.getGamma(); │ │ │ │ │ 603 │ │ │ │ │ -604 // do one iteration of the Rayleigh quotient iteration algorithm, │ │ │ │ │ -605 // part 2: update x │ │ │ │ │ -606 x = y; │ │ │ │ │ -607 x *= (1.0 / y_norm); │ │ │ │ │ -608 │ │ │ │ │ -609 // print verbosity information │ │ │ │ │ -610 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -611 std::cout << _b_l_a_n_k__ << std::left │ │ │ │ │ -612 << "iteration " << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ -613 << " (║residual║_2 = " << std::setw(11) << r_norm │ │ │ │ │ -614 << "): λ = " << lambda << std::endl │ │ │ │ │ -615 << std::resetiosflags(std::ios::left); │ │ │ │ │ -616 } │ │ │ │ │ -617 │ │ │ │ │ -618 // print verbosity information │ │ │ │ │ -619 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -620 { │ │ │ │ │ -621 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -622 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -623 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -624 << "λ = " << lambda << std::endl; │ │ │ │ │ -625 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -626 { │ │ │ │ │ -627 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ -628 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -629 } │ │ │ │ │ -630 } │ │ │ │ │ -631 } │ │ │ │ │ -632 │ │ │ │ │ -689 template │ │ │ │ │ -_6_9_1 inline void _a_p_p_l_y_T_L_I_M_E_I_t_e_r_a_t_i_o_n (const _R_e_a_l& gamma, const _R_e_a_l& eta, │ │ │ │ │ -692 const _R_e_a_l& epsilon, │ │ │ │ │ -693 ISTLLinearSolver& solver, │ │ │ │ │ -694 const _R_e_a_l& delta, const std::size_t& m, │ │ │ │ │ -695 bool& extrnl, │ │ │ │ │ -696 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ -697 { │ │ │ │ │ -698 // use same variable names as in [Szyld, 1988] │ │ │ │ │ -699 _B_l_o_c_k_V_e_c_t_o_r& x_s = x; │ │ │ │ │ -700 _R_e_a_l& mu_s = lambda; │ │ │ │ │ -701 │ │ │ │ │ -702 // print verbosity information │ │ │ │ │ -703 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -704 std::cout << _t_i_t_l_e__ │ │ │ │ │ -705 << "Performing TLIME iteration for " │ │ │ │ │ -706 << "estimated eigenvalue in the " │ │ │ │ │ -707 << "interval (" << gamma - eta << "," │ │ │ │ │ -708 << gamma + eta << ")." << std::endl; │ │ │ │ │ -709 │ │ │ │ │ -710 // allocate memory for linear solver statistics │ │ │ │ │ -711 _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 solver_statistics; │ │ │ │ │ -712 │ │ │ │ │ -713 // allocate memory for auxiliary variables │ │ │ │ │ -714 bool doRQI; │ │ │ │ │ -715 _R_e_a_l mu; │ │ │ │ │ -716 _B_l_o_c_k_V_e_c_t_o_r y(x_s); │ │ │ │ │ -717 _R_e_a_l omega; │ │ │ │ │ -718 _R_e_a_l mu_s_old; │ │ │ │ │ -719 _R_e_a_l mu_s_update; │ │ │ │ │ -720 _B_l_o_c_k_V_e_c_t_o_r temp(x_s); │ │ │ │ │ -721 _R_e_a_l q_norm, r_norm; │ │ │ │ │ -722 │ │ │ │ │ -723 // perform TLIME iteration │ │ │ │ │ -724 x_s *= (1.0 / x_s.two_norm()); │ │ │ │ │ -725 extrnl = true; │ │ │ │ │ -726 doRQI = false; │ │ │ │ │ -727 r_norm = std::numeric_limits::max(); │ │ │ │ │ -728 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ -729 while (r_norm > epsilon) │ │ │ │ │ -730 { │ │ │ │ │ -731 // update and check number of iterations │ │ │ │ │ -732 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ -733 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"TLIME iteration did not " │ │ │ │ │ -734 << "converge in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ │ │ │ │ │ -735 << " iterations (║residual║_2 = " << r_norm │ │ │ │ │ -736 << ", epsilon = " << epsilon << ")."); │ │ │ │ │ -737 │ │ │ │ │ -738 // set shift for next iteration according to inverse iteration │ │ │ │ │ -739 // with shift (II) resp. Rayleigh quotient iteration (RQI) │ │ │ │ │ -740 if (doRQI) │ │ │ │ │ -741 mu = mu_s; │ │ │ │ │ -742 else │ │ │ │ │ -743 mu = gamma; │ │ │ │ │ -744 │ │ │ │ │ -745 // update II/RQI iteration operator, │ │ │ │ │ -746 // update II/RQI iteration matrix when needed │ │ │ │ │ -747 _u_p_d_a_t_e_S_h_i_f_t_M_u(mu,solver); │ │ │ │ │ -748 │ │ │ │ │ -749 // do one iteration of the II/RQI algorithm, │ │ │ │ │ -750 // part 1: solve (m_ - mu*I) * y = x for y │ │ │ │ │ -751 temp = x_s; │ │ │ │ │ -752 solver.apply(y,temp,solver_statistics); │ │ │ │ │ -753 │ │ │ │ │ -754 // do one iteration of the II/RQI algorithm, │ │ │ │ │ -755 // part 2: compute omega │ │ │ │ │ -756 omega = (1.0 / y.two_norm()); │ │ │ │ │ -757 │ │ │ │ │ -758 // backup the old Rayleigh quotient │ │ │ │ │ -759 mu_s_old = mu_s; │ │ │ │ │ -760 │ │ │ │ │ -761 // compile time switch between accuracy and efficiency │ │ │ │ │ -762 if (avoidLinSolverCrime) │ │ │ │ │ -763 { │ │ │ │ │ -764 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue │ │ │ │ │ -765 // (use that x_new = y * omega) │ │ │ │ │ -766 _m__._m_v(y,temp); │ │ │ │ │ -767 mu_s = (y * temp) * (omega * omega); │ │ │ │ │ -768 │ │ │ │ │ -769 // get norm of "the residual with respect to the shift used by II", │ │ │ │ │ -770 // use normal representation of q │ │ │ │ │ -771 // (use that x_new = y * omega, use that temp = m_ * y) │ │ │ │ │ -772 temp.axpy(-gamma,y); │ │ │ │ │ -773 q_norm = temp.two_norm() * omega; │ │ │ │ │ -774 │ │ │ │ │ -775 // get norm of "the residual with respect to the Rayleigh quotient" │ │ │ │ │ -776 r_norm = q_norm*q_norm - (gamma-mu_s)*(gamma-mu_s); │ │ │ │ │ -777 // prevent that truncation errors invalidate the norm │ │ │ │ │ -778 // (we don't want to calculate sqrt of a negative number) │ │ │ │ │ -779 if (r_norm >= 0) │ │ │ │ │ -780 { │ │ │ │ │ -781 // use relation between the norms of r and q for efficiency │ │ │ │ │ -782 r_norm = std::sqrt(r_norm); │ │ │ │ │ -783 } │ │ │ │ │ -784 else │ │ │ │ │ -785 { │ │ │ │ │ -786 // use relation between r and q │ │ │ │ │ -787 // (use that x_new = y * omega, use that temp = (m_ - gamma*I) * y = q / │ │ │ │ │ -omega) │ │ │ │ │ -788 temp.axpy(gamma-mu_s,y); │ │ │ │ │ -789 r_norm = temp.two_norm() * omega; │ │ │ │ │ +604 if (configuration.hasKey ("additive")) │ │ │ │ │ +605 criterion.setAdditive (configuration.get("additive")); │ │ │ │ │ +606 additive = criterion.getAdditive(); │ │ │ │ │ +607 │ │ │ │ │ +608 if (configuration.hasKey ("preSteps")) │ │ │ │ │ +609 criterion.setNoPreSmoothSteps (configuration.get │ │ │ │ │ +("preSteps")); │ │ │ │ │ +610 preSteps_ = criterion.getNoPreSmoothSteps (); │ │ │ │ │ +611 │ │ │ │ │ +612 if (configuration.hasKey ("postSteps")) │ │ │ │ │ +613 criterion.setNoPostSmoothSteps (configuration.get │ │ │ │ │ +("postSteps")); │ │ │ │ │ +614 postSteps_ = criterion.getNoPostSmoothSteps (); │ │ │ │ │ +615 │ │ │ │ │ +616 verbosity_ = configuration.get("verbosity", 0); │ │ │ │ │ +617 criterion.setDebugLevel (verbosity_); │ │ │ │ │ +618 │ │ │ │ │ +619 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ │ +620 } │ │ │ │ │ +621 │ │ │ │ │ +622 template │ │ │ │ │ +_6_2_4 struct _D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ +625 { │ │ │ │ │ +_6_2_6 typedef typename Matrix :: field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_6_2_7 enum _S_o_l_v_e_r_T_y_p_e { _u_m_f_p_a_c_k, _s_u_p_e_r_l_u, _n_o_n_e }; │ │ │ │ │ +628 │ │ │ │ │ +_6_2_9 static constexpr _S_o_l_v_e_r_T_y_p_e _s_o_l_v_e_r = │ │ │ │ │ +630#if DISABLE_AMG_DIRECTSOLVER │ │ │ │ │ +631 _n_o_n_e; │ │ │ │ │ +632#elif HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +633 _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _f_i_e_l_d___t_y_p_e_ _> :: valid ? _u_m_f_p_a_c_k : _n_o_n_e ; │ │ │ │ │ +634#elif HAVE_SUPERLU │ │ │ │ │ +635 _s_u_p_e_r_l_u ; │ │ │ │ │ +636#else │ │ │ │ │ +637 _n_o_n_e; │ │ │ │ │ +638#endif │ │ │ │ │ +639 │ │ │ │ │ +640 template │ │ │ │ │ +_6_4_1 struct _S_o_l_v_e_r │ │ │ │ │ +642 { │ │ │ │ │ +_6_4_3 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_V_e_c_t_o_r_,_V_e_c_t_o_r_> _t_y_p_e; │ │ │ │ │ +_6_4_4 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ │ +645 { │ │ │ │ │ +646 DUNE_THROW(NotImplemented,"DirectSolver not selected"); │ │ │ │ │ +647 return nullptr; │ │ │ │ │ +648 } │ │ │ │ │ +_6_4_9 static std::string _n_a_m_e () { return "None"; } │ │ │ │ │ +650 }; │ │ │ │ │ +651#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +652 template │ │ │ │ │ +653 struct Solver< M, _u_m_f_p_a_c_k > │ │ │ │ │ +654 { │ │ │ │ │ +655 typedef _U_M_F_P_a_c_k_<_ _M_ _> _t_y_p_e; │ │ │ │ │ +656 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ │ +657 { │ │ │ │ │ +658 return new _t_y_p_e(_m_a_t, verbose, reusevector ); │ │ │ │ │ +659 } │ │ │ │ │ +660 static std::string _n_a_m_e () { return "UMFPack"; } │ │ │ │ │ +661 }; │ │ │ │ │ +662#endif │ │ │ │ │ +663#if HAVE_SUPERLU │ │ │ │ │ +664 template │ │ │ │ │ +_6_6_5 struct _S_o_l_v_e_r< M, _s_u_p_e_r_l_u > │ │ │ │ │ +666 { │ │ │ │ │ +_6_6_7 typedef _S_u_p_e_r_L_U_<_ _M_ _> _t_y_p_e; │ │ │ │ │ +_6_6_8 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ │ +669 { │ │ │ │ │ +670 return new _t_y_p_e(_m_a_t, verbose, reusevector ); │ │ │ │ │ +671 } │ │ │ │ │ +_6_7_2 static std::string _n_a_m_e () { return "SuperLU"; } │ │ │ │ │ +673 }; │ │ │ │ │ +674#endif │ │ │ │ │ +675 │ │ │ │ │ +676 // define direct solver type to be used │ │ │ │ │ +_6_7_7 typedef _S_o_l_v_e_r_<_ _M_a_t_r_i_x_,_ _s_o_l_v_e_r_ _> _S_e_l_e_c_t_e_d_S_o_l_v_e_r ; │ │ │ │ │ +_6_7_8 typedef typename SelectedSolver :: type _D_i_r_e_c_t_S_o_l_v_e_r; │ │ │ │ │ +_6_7_9 static constexpr bool _i_s_D_i_r_e_c_t_S_o_l_v_e_r = _s_o_l_v_e_r != _n_o_n_e; │ │ │ │ │ +_6_8_0 static std::string _n_a_m_e() { return SelectedSolver :: name (); } │ │ │ │ │ +_6_8_1 static _D_i_r_e_c_t_S_o_l_v_e_r* _c_r_e_a_t_e(const _M_a_t_r_i_x& _m_a_t, bool verbose, bool │ │ │ │ │ +reusevector ) │ │ │ │ │ +682 { │ │ │ │ │ +683 return SelectedSolver :: create( _m_a_t, verbose, reusevector ); │ │ │ │ │ +684 } │ │ │ │ │ +685 }; │ │ │ │ │ +686 │ │ │ │ │ +687 template │ │ │ │ │ +688 template │ │ │ │ │ +689 void AMG::createHierarchies(C& criterion, │ │ │ │ │ +690 const std::shared_ptr& matrixptr, │ │ │ │ │ +691 const PI& pinfo) │ │ │ │ │ +692 { │ │ │ │ │ +693 Timer watch; │ │ │ │ │ +694 matrices_ = std::make_shared( │ │ │ │ │ +695 std::const_pointer_cast(matrixptr), │ │ │ │ │ +696 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ │ +697 │ │ │ │ │ +698 matrices_->template build >(criterion); │ │ │ │ │ +699 │ │ │ │ │ +700 // build the necessary smoother hierarchies │ │ │ │ │ +701 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ │ +702 │ │ │ │ │ +703 // test whether we should solve on the coarse level. That is the case if we │ │ │ │ │ +704 // have that level and if there was a redistribution on this level then our │ │ │ │ │ +705 // communicator has to be valid (size()>0) as the smoother might try to │ │ │ │ │ +communicate │ │ │ │ │ +706 // in the constructor. │ │ │ │ │ +707 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels() │ │ │ │ │ +708 && ( ! matrices_->redistributeInformation().back().isSetup() || │ │ │ │ │ +709 matrices_->parallelInformation().coarsest().getRedistributed().communicator │ │ │ │ │ +().size() ) ) │ │ │ │ │ +710 { │ │ │ │ │ +711 // We have the carsest level. Create the coarse Solver │ │ │ │ │ +712 SmootherArgs sargs(smootherArgs_); │ │ │ │ │ +713 sargs.iterations = 1; │ │ │ │ │ +714 │ │ │ │ │ +715 typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s cargs; │ │ │ │ │ +716 cargs.setArgs(sargs); │ │ │ │ │ +717 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ │ +718 // Solve on the redistributed partitioning │ │ │ │ │ +719 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ │ +()); │ │ │ │ │ +720 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ +()); │ │ │ │ │ +721 }else{ │ │ │ │ │ +722 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ │ +723 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ │ +724 } │ │ │ │ │ +725 │ │ │ │ │ +726 coarseSmoother_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_c_o_n_s_t_r_u_c_t(cargs); │ │ │ │ │ +727 scalarProduct_ = createScalarProduct(cargs.getComm(),category()); │ │ │ │ │ +728 │ │ │ │ │ +729 typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector; │ │ │ │ │ +730 │ │ │ │ │ +731 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ │ +the coarsest level. │ │ │ │ │ +732 if( SolverSelector::isDirectSolver && │ │ │ │ │ +733 (std::is_same::value / │ │ │ │ │ +/ sequential mode │ │ │ │ │ +734 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ │ +parallel mode and only one processor │ │ │ │ │ +735 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ │ +736 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ +().communicator().size()==1 │ │ │ │ │ +737 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ │ +().communicator().size()>0) ) │ │ │ │ │ +738 ) │ │ │ │ │ +739 { // redistribute and 1 proc │ │ │ │ │ +740 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ +741 { │ │ │ │ │ +742 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ +743 { │ │ │ │ │ +744 // We are still participating on this level │ │ │ │ │ +745 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest │ │ │ │ │ +().getRedistributed().getmat(), false, false)); │ │ │ │ │ +746 } │ │ │ │ │ +747 else │ │ │ │ │ +748 solver_.reset(); │ │ │ │ │ +749 } │ │ │ │ │ +750 else │ │ │ │ │ +751 { │ │ │ │ │ +752 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()- │ │ │ │ │ +>getmat(), false, false)); │ │ │ │ │ +753 } │ │ │ │ │ +754 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ │ +>communicator().rank()==0) │ │ │ │ │ +755 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << │ │ │ │ │ +")" << std::endl; │ │ │ │ │ +756 } │ │ │ │ │ +757 else │ │ │ │ │ +758 { │ │ │ │ │ +759 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ │ +760 { │ │ │ │ │ +761 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ │ +762 // We are still participating on this level │ │ │ │ │ +763 │ │ │ │ │ +764 // we have to allocate these types using the rebound allocator │ │ │ │ │ +765 // in order to ensure that we fulfill the alignment requirements │ │ │ │ │ +766 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ │ +().coarsest().getRedistributed()), │ │ │ │ │ +767 *scalarProduct_, │ │ │ │ │ +768 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ +769 else │ │ │ │ │ +770 solver_.reset(); │ │ │ │ │ +771 }else │ │ │ │ │ +772 { │ │ │ │ │ +773 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ │ +().coarsest()), │ │ │ │ │ +774 *scalarProduct_, │ │ │ │ │ +775 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ │ +776 // // we have to allocate these types using the rebound allocator │ │ │ │ │ +777 // // in order to ensure that we fulfill the alignment requirements │ │ │ │ │ +778 // using Alloc = typename std::allocator_traits::template │ │ │ │ │ +rebind_alloc>; │ │ │ │ │ +779 // Alloc alloc; │ │ │ │ │ +780 // auto p = alloc.allocate(1); │ │ │ │ │ +781 // std::allocator_traits::construct(alloc, p, │ │ │ │ │ +782 // const_cast(*matrices_->matrices().coarsest()), │ │ │ │ │ +783 // *scalarProduct_, │ │ │ │ │ +784 // *coarseSmoother_, 1E-2, 1000, 0); │ │ │ │ │ +785 // solver_.reset(p,[](BiCGSTABSolver* p){ │ │ │ │ │ +786 // Alloc alloc; │ │ │ │ │ +787 // std::allocator_traits::destroy(alloc, p); │ │ │ │ │ +788 // alloc.deallocate(p,1); │ │ │ │ │ +789 // }); │ │ │ │ │ 790 } │ │ │ │ │ 791 } │ │ │ │ │ -792 else │ │ │ │ │ -793 { │ │ │ │ │ -794 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue │ │ │ │ │ -795 if (!doRQI) │ │ │ │ │ -796 { │ │ │ │ │ -797 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = │ │ │ │ │ -x_s) │ │ │ │ │ -798 mu_s = gamma + (y * x_s) * (omega * omega); │ │ │ │ │ -799 } │ │ │ │ │ -800 else │ │ │ │ │ -801 { │ │ │ │ │ -802 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y │ │ │ │ │ -= x_s) │ │ │ │ │ -803 mu_s_update = (y * x_s) * (omega * omega); │ │ │ │ │ -804 mu_s += mu_s_update; │ │ │ │ │ -805 } │ │ │ │ │ -806 │ │ │ │ │ -807 // get norm of "the residual with respect to the shift used by II" │ │ │ │ │ -808 if (!doRQI) │ │ │ │ │ -809 { │ │ │ │ │ -810 // use special representation of q in the II case │ │ │ │ │ -811 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = │ │ │ │ │ -x_s) │ │ │ │ │ -812 q_norm = omega; │ │ │ │ │ -813 } │ │ │ │ │ -814 else │ │ │ │ │ -815 { │ │ │ │ │ -816 // use special representation of q in the RQI case │ │ │ │ │ -817 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y │ │ │ │ │ -= x_s) │ │ │ │ │ -818 temp = x_s; temp.axpy(mu_s-gamma,y); │ │ │ │ │ -819 q_norm = temp.two_norm() * omega; │ │ │ │ │ -820 } │ │ │ │ │ -821 │ │ │ │ │ -822 // get norm of "the residual with respect to the Rayleigh quotient" │ │ │ │ │ -823 // don't use efficient relation between the norms of r and q, as │ │ │ │ │ -824 // this relation seems to yield a less accurate r_norm in the case │ │ │ │ │ -825 // where linear solver crime is admitted │ │ │ │ │ -826 if (!doRQI) │ │ │ │ │ -827 { │ │ │ │ │ -828 // (use that x_new = y * omega and use that (m_ - gamma*I) * y = x_s) │ │ │ │ │ -829 temp = x_s; temp.axpy(gamma-lambda,y); │ │ │ │ │ -830 r_norm = temp.two_norm() * omega; │ │ │ │ │ -831 } │ │ │ │ │ -832 else │ │ │ │ │ -833 { │ │ │ │ │ -834 // (use that x_new = y * omega and use that (m_ - mu_s_old*I) * y = x_s) │ │ │ │ │ -835 temp = x_s; temp.axpy(-mu_s_update,y); │ │ │ │ │ -836 r_norm = temp.two_norm() * omega; │ │ │ │ │ -837 } │ │ │ │ │ -838 } │ │ │ │ │ -839 │ │ │ │ │ -840 // do one iteration of the II/RQI algorithm, │ │ │ │ │ -841 // part 3: update x │ │ │ │ │ -842 x_s = y; x_s *= omega; │ │ │ │ │ -843 │ │ │ │ │ -844 // // for relative residual norm mode, scale with mu_s^{-1} │ │ │ │ │ -845 // r_norm /= std::abs(mu_s); │ │ │ │ │ -846 │ │ │ │ │ -847 // print verbosity information │ │ │ │ │ -848 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ -849 std::cout << _b_l_a_n_k__ << "iteration " │ │ │ │ │ -850 << std::left << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ -851 << " (" << (doRQI ? "RQI," : "II, ") │ │ │ │ │ -852 << " " << (doRQI ? "—>" : " ") << " " │ │ │ │ │ -853 << "║r║_2 = " << std::setw(11) << r_norm │ │ │ │ │ -854 << ", " << (doRQI ? " " : "—>") << " " │ │ │ │ │ -855 << "║q║_2 = " << std::setw(11) << q_norm │ │ │ │ │ -856 << "): λ = " << lambda << std::endl │ │ │ │ │ -857 << std::resetiosflags(std::ios::left); │ │ │ │ │ -858 │ │ │ │ │ -859 // check if the eigenvalue closest to gamma lies in J │ │ │ │ │ -860 if (!doRQI && q_norm < eta) │ │ │ │ │ -861 { │ │ │ │ │ -862 // J is not free of eigenvalues │ │ │ │ │ -863 extrnl = false; │ │ │ │ │ -864 │ │ │ │ │ -865 // by theory we know now that mu_s also lies in J │ │ │ │ │ -866 assert(std::abs(mu_s-gamma) < eta); │ │ │ │ │ +792 } │ │ │ │ │ +793 │ │ │ │ │ +794 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ │ +().rank()==0) │ │ │ │ │ +795 std::cout<<"Building hierarchy of "<maxlevels()<<" levels " │ │ │ │ │ +796 <<"(including coarse solver) took "< │ │ │ │ │ +_8_0_1 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ │ +802 { │ │ │ │ │ +803 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ │ +804 // zero and set x such that A_dd*x_d=b_d │ │ │ │ │ +805 // Thus users can be more careless when setting up their linear │ │ │ │ │ +806 // systems. │ │ │ │ │ +807 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ │ +808 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r RowIter; │ │ │ │ │ +809 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIter; │ │ │ │ │ +810 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ │ +811 Block zero; │ │ │ │ │ +812 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ │ +813 │ │ │ │ │ +814 const _M_a_t_r_i_x& _m_a_t=matrices_->matrices().finest()->getmat(); │ │ │ │ │ +815 for(RowIter row=_m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ │ +816 bool isDirichlet = true; │ │ │ │ │ +817 bool hasDiagonal = false; │ │ │ │ │ +818 Block diagonal{}; │ │ │ │ │ +819 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ │ +820 if(row.index()==_c_o_l.index()) { │ │ │ │ │ +821 diagonal = *_c_o_l; │ │ │ │ │ +822 hasDiagonal = true; │ │ │ │ │ +823 }else{ │ │ │ │ │ +824 if(*_c_o_l!=zero) │ │ │ │ │ +825 isDirichlet = false; │ │ │ │ │ +826 } │ │ │ │ │ +827 } │ │ │ │ │ +828 if(isDirichlet && hasDiagonal) │ │ │ │ │ +829 { │ │ │ │ │ +830 auto&& xEntry = Impl::asVector(x[row.index()]); │ │ │ │ │ +831 auto&& bEntry = Impl::asVector(b[row.index()]); │ │ │ │ │ +832 Impl::asMatrix(diagonal).solve(xEntry, bEntry); │ │ │ │ │ +833 } │ │ │ │ │ +834 } │ │ │ │ │ +835 │ │ │ │ │ +836 if(smoothers_->levels()>0) │ │ │ │ │ +837 smoothers_->finest()->pre(x,b); │ │ │ │ │ +838 else │ │ │ │ │ +839 // No smoother to make x consistent! Do it by hand │ │ │ │ │ +840 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ │ +841 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ │ +842 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ │ +843 update_ = std::make_shared>(std::make_shared │ │ │ │ │ +(x)); │ │ │ │ │ +844 matrices_->coarsenVector(*rhs_); │ │ │ │ │ +845 matrices_->coarsenVector(*lhs_); │ │ │ │ │ +846 matrices_->coarsenVector(*update_); │ │ │ │ │ +847 │ │ │ │ │ +848 // Preprocess all smoothers │ │ │ │ │ +849 typedef typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ +850 typedef typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r RIterator; │ │ │ │ │ +851 typedef typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r DIterator; │ │ │ │ │ +852 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ │ +853 Iterator smoother = smoothers_->finest(); │ │ │ │ │ +854 RIterator rhs = rhs_->finest(); │ │ │ │ │ +855 DIterator lhs = lhs_->finest(); │ │ │ │ │ +856 if(smoothers_->levels()>1) { │ │ │ │ │ +857 │ │ │ │ │ +858 assert(lhs_->levels()==rhs_->levels()); │ │ │ │ │ +859 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels │ │ │ │ │ +()==matrices_->maxlevels()); │ │ │ │ │ +860 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels │ │ │ │ │ +()maxlevels()); │ │ │ │ │ +861 │ │ │ │ │ +862 if(smoother!=coarsest) │ │ │ │ │ +863 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, │ │ │ │ │ +++rhs) │ │ │ │ │ +864 smoother->pre(*lhs,*rhs); │ │ │ │ │ +865 smoother->pre(*lhs,*rhs); │ │ │ │ │ +866 } │ │ │ │ │ 867 │ │ │ │ │ -868 // switch to RQI │ │ │ │ │ -869 doRQI = true; │ │ │ │ │ -870 } │ │ │ │ │ -871 │ │ │ │ │ -872 // revert to II if J is not free of eigenvalues but │ │ │ │ │ -873 // at some point mu_s falls back again outside J │ │ │ │ │ -874 if (!extrnl && doRQI && std::abs(mu_s-gamma) >= eta) │ │ │ │ │ -875 doRQI = false; │ │ │ │ │ -876 │ │ │ │ │ -877 // if eigenvalue closest to gamma does not lie in J use RQI │ │ │ │ │ -878 // solely to accelerate the convergence to this eigenvalue │ │ │ │ │ -879 // when II has become stationary │ │ │ │ │ -880 if (extrnl && !doRQI) │ │ │ │ │ -881 { │ │ │ │ │ -882 // switch to RQI if the relative change of the Rayleigh │ │ │ │ │ -883 // quotient indicates that II has become stationary │ │ │ │ │ -884 if (_n_I_t_e_r_a_t_i_o_n_s__ >= m && │ │ │ │ │ -885 std::abs(mu_s - mu_s_old) / std::abs(mu_s) < delta) │ │ │ │ │ -886 doRQI = true; │ │ │ │ │ -887 } │ │ │ │ │ -888 } │ │ │ │ │ -889 │ │ │ │ │ -890 // // compute final residual and lambda again (paranoia....) │ │ │ │ │ -891 // m_.mv(x_s,temp); │ │ │ │ │ -892 // mu_s = x_s * temp; │ │ │ │ │ -893 // temp.axpy(-mu_s,x_s); │ │ │ │ │ -894 // r_norm = temp.two_norm(); │ │ │ │ │ -895 // // r_norm /= std::abs(mu_s); │ │ │ │ │ -896 │ │ │ │ │ -897 // print verbosity information │ │ │ │ │ -898 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ -899 { │ │ │ │ │ -900 if (extrnl) │ │ │ │ │ -901 std::cout << _b_l_a_n_k__ << "Interval " │ │ │ │ │ -902 << "(" << gamma - eta << "," << gamma + eta │ │ │ │ │ -903 << ") is free of eigenvalues, approximating " │ │ │ │ │ -904 << "the closest eigenvalue." << std::endl; │ │ │ │ │ -905 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ -906 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ -907 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ -908 << "λ = " << lambda << std::endl; │ │ │ │ │ -909 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ -910 { │ │ │ │ │ -911 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ -912 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ -913 } │ │ │ │ │ +868 │ │ │ │ │ +869 // The preconditioner might change x and b. So we have to │ │ │ │ │ +870 // copy the changes to the original vectors. │ │ │ │ │ +871 x = *lhs_->finest(); │ │ │ │ │ +872 b = *rhs_->finest(); │ │ │ │ │ +873 │ │ │ │ │ +874 } │ │ │ │ │ +875 template │ │ │ │ │ +_8_7_6 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ │ +877 { │ │ │ │ │ +878 return matrices_->levels(); │ │ │ │ │ +879 } │ │ │ │ │ +880 template │ │ │ │ │ +_8_8_1 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ │ +882 { │ │ │ │ │ +883 return matrices_->maxlevels(); │ │ │ │ │ +884 } │ │ │ │ │ +885 │ │ │ │ │ +887 template │ │ │ │ │ +_8_8_8 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ │ +889 { │ │ │ │ │ +890 LevelContext levelContext; │ │ │ │ │ +891 │ │ │ │ │ +892 if(additive) { │ │ │ │ │ +893 *(rhs_->finest())=d; │ │ │ │ │ +894 additiveMgc(); │ │ │ │ │ +895 v=*lhs_->finest(); │ │ │ │ │ +896 }else{ │ │ │ │ │ +897 // Init all iterators for the current level │ │ │ │ │ +898 initIteratorsWithFineLevel(levelContext); │ │ │ │ │ +899 │ │ │ │ │ +900 │ │ │ │ │ +901 *levelContext.lhs = v; │ │ │ │ │ +902 *levelContext.rhs = d; │ │ │ │ │ +903 *levelContext.update=0; │ │ │ │ │ +904 levelContext.level=0; │ │ │ │ │ +905 │ │ │ │ │ +906 mgc(levelContext); │ │ │ │ │ +907 │ │ │ │ │ +908 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ │ +909 levelContext.pinfo->copyOwnerToAll(*levelContext.update, │ │ │ │ │ +*levelContext.update); │ │ │ │ │ +910 │ │ │ │ │ +911 v=*levelContext.update; │ │ │ │ │ +912 } │ │ │ │ │ +913 │ │ │ │ │ 914 } │ │ │ │ │ -915 } │ │ │ │ │ -916 │ │ │ │ │ -_9_2_5 inline _I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r& _g_e_t_I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r () │ │ │ │ │ -926 { │ │ │ │ │ -927 // return iteration operator │ │ │ │ │ -928 return _i_t_O_p_e_r_a_t_o_r__; │ │ │ │ │ -929 } │ │ │ │ │ -930 │ │ │ │ │ -_9_4_5 inline const _B_C_R_S_M_a_t_r_i_x& _g_e_t_I_t_e_r_a_t_i_o_n_M_a_t_r_i_x () const │ │ │ │ │ -946 { │ │ │ │ │ -947 // create iteration matrix on demand │ │ │ │ │ -948 if (!_i_t_M_a_t_r_i_x__) │ │ │ │ │ -949 _i_t_M_a_t_r_i_x__ = std::make_unique(_m__); │ │ │ │ │ -950 │ │ │ │ │ -951 // return iteration matrix │ │ │ │ │ -952 return *_i_t_M_a_t_r_i_x__; │ │ │ │ │ -953 } │ │ │ │ │ -954 │ │ │ │ │ -_9_5_9 inline unsigned int _g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t () const │ │ │ │ │ -960 { │ │ │ │ │ -961 if (_n_I_t_e_r_a_t_i_o_n_s__ == 0) │ │ │ │ │ -962 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"No algorithm applied, yet."); │ │ │ │ │ -963 │ │ │ │ │ -964 return _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ -965 } │ │ │ │ │ -966 │ │ │ │ │ -967 protected: │ │ │ │ │ -982 template │ │ │ │ │ -_9_8_3 inline void _u_p_d_a_t_e_S_h_i_f_t_M_u (const _R_e_a_l& mu, │ │ │ │ │ -984 ISTLLinearSolver& solver) const │ │ │ │ │ -985 { │ │ │ │ │ -986 // do nothing if new shift equals the old one │ │ │ │ │ -987 if (mu == _m_u__) return; │ │ │ │ │ -988 │ │ │ │ │ -989 // update shift mu_, i.e. update iteration operator │ │ │ │ │ -990 _m_u__ = mu; │ │ │ │ │ -991 │ │ │ │ │ -992 // update iteration matrix when needed │ │ │ │ │ -993 if (_i_t_M_a_t_r_i_x__) │ │ │ │ │ -994 { │ │ │ │ │ -995 // iterate over entries in iteration matrix diagonal │ │ │ │ │ -996 constexpr int rowBlockSize = BCRSMatrix::block_type::rows; │ │ │ │ │ -997 constexpr int colBlockSize = BCRSMatrix::block_type::cols; │ │ │ │ │ -998 for (typename _B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e i = 0; │ │ │ │ │ -999 i < _i_t_M_a_t_r_i_x__->M()*rowBlockSize; ++i) │ │ │ │ │ -1000 { │ │ │ │ │ -1001 // access m_[i,i] where i is the flat index of a row/column │ │ │ │ │ -1002 const _R_e_a_l& m_entry = _m__ │ │ │ │ │ -1003 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize]; │ │ │ │ │ -1004 // access *itMatrix[i,i] where i is the flat index of a row/column │ │ │ │ │ -1005 _R_e_a_l& entry = (*itMatrix_) │ │ │ │ │ -1006 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize]; │ │ │ │ │ -1007 // change current entry in iteration matrix diagonal │ │ │ │ │ -1008 entry = m_entry - _m_u__; │ │ │ │ │ -1009 } │ │ │ │ │ -1010 // notify linear solver about change of the iteration matrix object │ │ │ │ │ -1011 _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_>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ │ -1012 (solver,*_i_t_M_a_t_r_i_x__); │ │ │ │ │ -1013 } │ │ │ │ │ -1014 } │ │ │ │ │ -1015 │ │ │ │ │ -1016 protected: │ │ │ │ │ -1017 // parameters related to iterative eigenvalue algorithms │ │ │ │ │ -_1_0_1_8 const _B_C_R_S_M_a_t_r_i_x& _m__; │ │ │ │ │ -_1_0_1_9 const unsigned int _n_I_t_e_r_a_t_i_o_n_s_M_a_x__; │ │ │ │ │ -1020 │ │ │ │ │ -1021 // verbosity setting │ │ │ │ │ -_1_0_2_2 const unsigned int _v_e_r_b_o_s_i_t_y___l_e_v_e_l__; │ │ │ │ │ -1023 │ │ │ │ │ -1024 // shift mu_ used by iteration operator/matrix (m_ - mu_*I) │ │ │ │ │ -_1_0_2_5 mutable _R_e_a_l _m_u__; │ │ │ │ │ -1026 │ │ │ │ │ -1027 // iteration operator (m_ - mu_*I), passing shift mu_ by reference │ │ │ │ │ -_1_0_2_8 const _M_a_t_r_i_x_O_p_e_r_a_t_o_r _m_a_t_r_i_x_O_p_e_r_a_t_o_r__; │ │ │ │ │ -_1_0_2_9 const _S_c_a_l_i_n_g_O_p_e_r_a_t_o_r _s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__; │ │ │ │ │ -_1_0_3_0 _O_p_e_r_a_t_o_r_S_u_m _i_t_O_p_e_r_a_t_o_r__; │ │ │ │ │ -1031 │ │ │ │ │ -1032 // iteration matrix (m_ - mu_*I), provided on demand when needed │ │ │ │ │ -1033 // (e.g. for preconditioning) │ │ │ │ │ -_1_0_3_4 mutable std::unique_ptr _i_t_M_a_t_r_i_x__; │ │ │ │ │ -1035 │ │ │ │ │ -1036 // memory for storing temporary variables (mutable as they shall │ │ │ │ │ -1037 // just be effectless auxiliary variables of the const apply*(...) │ │ │ │ │ -1038 // methods) │ │ │ │ │ -_1_0_3_9 mutable unsigned int _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ -1040 │ │ │ │ │ -1041 // constants for printing verbosity information │ │ │ │ │ -_1_0_4_2 const std::string _t_i_t_l_e__; │ │ │ │ │ -_1_0_4_3 const std::string _b_l_a_n_k__; │ │ │ │ │ -1044 }; │ │ │ │ │ -1045 │ │ │ │ │ -1048} // namespace Dune │ │ │ │ │ -1049 │ │ │ │ │ -1050#endif // DUNE_ISTL_EIGENVALUE_POWERITERATION_HH │ │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ -_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ │ +915 │ │ │ │ │ +916 template │ │ │ │ │ +917 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_i_n_i_t_I_t_e_r_a_t_o_r_s_W_i_t_h_F_i_n_e_L_e_v_e_l(LevelContext& │ │ │ │ │ +levelContext) │ │ │ │ │ +918 { │ │ │ │ │ +919 levelContext.smoother = smoothers_->finest(); │ │ │ │ │ +920 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ │ +921 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ │ +922 levelContext.redist = │ │ │ │ │ +923 matrices_->redistributeInformation().begin(); │ │ │ │ │ +924 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ │ +925 levelContext.lhs = lhs_->finest(); │ │ │ │ │ +926 levelContext.update = update_->finest(); │ │ │ │ │ +927 levelContext.rhs = rhs_->finest(); │ │ │ │ │ +928 } │ │ │ │ │ +929 │ │ │ │ │ +930 template │ │ │ │ │ +931 bool AMG │ │ │ │ │ +932 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ │ +933 { │ │ │ │ │ +934 │ │ │ │ │ +935 bool processNextLevel=true; │ │ │ │ │ +936 │ │ │ │ │ +937 if(levelContext.redist->isSetup()) { │ │ │ │ │ +938 levelContext.redist->redistribute(static_cast │ │ │ │ │ +(*levelContext.rhs), │ │ │ │ │ +939 levelContext.rhs.getRedistributed()); │ │ │ │ │ +940 processNextLevel = levelContext.rhs.getRedistributed().size()>0; │ │ │ │ │ +941 if(processNextLevel) { │ │ │ │ │ +942 //restrict defect to coarse level right hand side. │ │ │ │ │ +943 typename Hierarchy::Iterator fineRhs = levelContext.rhs++; │ │ │ │ │ +944 ++levelContext.pinfo; │ │ │ │ │ +945 Transfer │ │ │ │ │ +946 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ │ +947 static_cast(fineRhs.getRedistributed()), │ │ │ │ │ +948 *levelContext.pinfo); │ │ │ │ │ +949 } │ │ │ │ │ +950 }else{ │ │ │ │ │ +951 //restrict defect to coarse level right hand side. │ │ │ │ │ +952 typename Hierarchy::Iterator fineRhs = levelContext.rhs++; │ │ │ │ │ +953 ++levelContext.pinfo; │ │ │ │ │ +954 Transfer │ │ │ │ │ +955 ::restrictVector(*(*levelContext.aggregates), │ │ │ │ │ +956 *levelContext.rhs, static_cast(*fineRhs), │ │ │ │ │ +957 *levelContext.pinfo); │ │ │ │ │ +958 } │ │ │ │ │ +959 │ │ │ │ │ +960 if(processNextLevel) { │ │ │ │ │ +961 // prepare coarse system │ │ │ │ │ +962 ++levelContext.lhs; │ │ │ │ │ +963 ++levelContext.update; │ │ │ │ │ +964 ++levelContext.matrix; │ │ │ │ │ +965 ++levelContext.level; │ │ │ │ │ +966 ++levelContext.redist; │ │ │ │ │ +967 │ │ │ │ │ +968 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ +>levels()maxlevels()) { │ │ │ │ │ +969 // next level is not the globally coarsest one │ │ │ │ │ +970 ++levelContext.smoother; │ │ │ │ │ +971 ++levelContext.aggregates; │ │ │ │ │ +972 } │ │ │ │ │ +973 // prepare the update on the next level │ │ │ │ │ +974 *levelContext.update=0; │ │ │ │ │ +975 } │ │ │ │ │ +976 return processNextLevel; │ │ │ │ │ +977 } │ │ │ │ │ +978 │ │ │ │ │ +979 template │ │ │ │ │ +980 void AMG │ │ │ │ │ +981 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel) │ │ │ │ │ +982 { │ │ │ │ │ +983 if(processNextLevel) { │ │ │ │ │ +984 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ │ +>levels()maxlevels()) { │ │ │ │ │ +985 // previous level is not the globally coarsest one │ │ │ │ │ +986 --levelContext.smoother; │ │ │ │ │ +987 --levelContext.aggregates; │ │ │ │ │ +988 } │ │ │ │ │ +989 --levelContext.redist; │ │ │ │ │ +990 --levelContext.level; │ │ │ │ │ +991 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ │ +992 --levelContext.matrix; │ │ │ │ │ +993 │ │ │ │ │ +994 //typename Hierarchy::Iterator coarseLhs = lhs--; │ │ │ │ │ +995 --levelContext.lhs; │ │ │ │ │ +996 --levelContext.pinfo; │ │ │ │ │ +997 } │ │ │ │ │ +998 if(levelContext.redist->isSetup()) { │ │ │ │ │ +999 // Need to redistribute during prolongateVector │ │ │ │ │ +1000 levelContext.lhs.getRedistributed()=0; │ │ │ │ │ +1001 Transfer │ │ │ │ │ +1002 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ │ +*levelContext.lhs, │ │ │ │ │ +1003 levelContext.lhs.getRedistributed(), │ │ │ │ │ +1004 matrices_->getProlongationDampingFactor(), │ │ │ │ │ +1005 *levelContext.pinfo, *levelContext.redist); │ │ │ │ │ +1006 }else{ │ │ │ │ │ +1007 *levelContext.lhs=0; │ │ │ │ │ +1008 Transfer │ │ │ │ │ +1009 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ │ +*levelContext.lhs, │ │ │ │ │ +1010 matrices_->getProlongationDampingFactor(), │ │ │ │ │ +1011 *levelContext.pinfo); │ │ │ │ │ +1012 } │ │ │ │ │ +1013 │ │ │ │ │ +1014 │ │ │ │ │ +1015 if(processNextLevel) { │ │ │ │ │ +1016 --levelContext.update; │ │ │ │ │ +1017 --levelContext.rhs; │ │ │ │ │ +1018 } │ │ │ │ │ +1019 │ │ │ │ │ +1020 *levelContext.update += *levelContext.lhs; │ │ │ │ │ +1021 } │ │ │ │ │ +1022 │ │ │ │ │ +1023 template │ │ │ │ │ +_1_0_2_4 bool _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const │ │ │ │ │ +1025 { │ │ │ │ │ +1026 return _I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _C_o_a_r_s_e_S_o_l_v_e_r_>_:_:_v_a_l_u_e; │ │ │ │ │ +1027 } │ │ │ │ │ +1028 │ │ │ │ │ +1029 template │ │ │ │ │ +1030 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_m_g_c(LevelContext& levelContext){ │ │ │ │ │ +1031 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ │ +()==maxlevels()) { │ │ │ │ │ +1032 // Solve directly │ │ │ │ │ +1033 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ +1034 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ │ +1035 if(levelContext.redist->isSetup()) { │ │ │ │ │ +1036 levelContext.redist->redistribute(*levelContext.rhs, │ │ │ │ │ +levelContext.rhs.getRedistributed()); │ │ │ │ │ +1037 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ │ +1038 // We are still participating in the computation │ │ │ │ │ +1039 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ │ +(levelContext.rhs.getRedistributed(), │ │ │ │ │ +1040 levelContext.rhs.getRedistributed()); │ │ │ │ │ +1041 solver_->apply(levelContext.update.getRedistributed(), │ │ │ │ │ +1042 levelContext.rhs.getRedistributed(), res); │ │ │ │ │ +1043 } │ │ │ │ │ +1044 levelContext.redist->redistributeBackward(*levelContext.update, │ │ │ │ │ +levelContext.update.getRedistributed()); │ │ │ │ │ +1045 levelContext.pinfo->copyOwnerToAll(*levelContext.update, │ │ │ │ │ +*levelContext.update); │ │ │ │ │ +1046 }else{ │ │ │ │ │ +1047 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs); │ │ │ │ │ +1048 solver_->apply(*levelContext.update, *levelContext.rhs, res); │ │ │ │ │ +1049 } │ │ │ │ │ +1050 │ │ │ │ │ +1051 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ │ +1052 coarsesolverconverged = false; │ │ │ │ │ +1053 }else{ │ │ │ │ │ +1054 // presmoothing │ │ │ │ │ +1055 _p_r_e_s_m_o_o_t_h(levelContext, preSteps_); │ │ │ │ │ +1056 │ │ │ │ │ +1057#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ │ +1058 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ │ +1059 │ │ │ │ │ +1060 if(processNextLevel) { │ │ │ │ │ +1061 // next level │ │ │ │ │ +1062 for(std::size_t i=0; imatrices().coarsest() && levels │ │ │ │ │ +()==maxlevels()) │ │ │ │ │ +1065 break; │ │ │ │ │ +1066 if(i+1 < gamma_){ │ │ │ │ │ +1067 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, │ │ │ │ │ +*levelContext.rhs); │ │ │ │ │ +1068 } │ │ │ │ │ +1069 } │ │ │ │ │ +1070 } │ │ │ │ │ +1071 │ │ │ │ │ +1072 moveToFineLevel(levelContext, processNextLevel); │ │ │ │ │ +1073#else │ │ │ │ │ +1074 *lhs=0; │ │ │ │ │ +1075#endif │ │ │ │ │ +1076 │ │ │ │ │ +1077 if(levelContext.matrix == matrices_->matrices().finest()) { │ │ │ │ │ +1078 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ │ +>communicator().prod(coarsesolverconverged); │ │ │ │ │ +1079 if(!coarsesolverconverged) │ │ │ │ │ +1080 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ │ +1081 } │ │ │ │ │ +1082 // postsmoothing │ │ │ │ │ +1083 _p_o_s_t_s_m_o_o_t_h(levelContext, postSteps_); │ │ │ │ │ +1084 │ │ │ │ │ +1085 } │ │ │ │ │ +1086 } │ │ │ │ │ +1087 │ │ │ │ │ +1088 template │ │ │ │ │ +1089 void AMG::additiveMgc(){ │ │ │ │ │ +1090 │ │ │ │ │ +1091 // restrict residual to all levels │ │ │ │ │ +1092 typename ParallelInformationHierarchy::Iterator pinfo=matrices_- │ │ │ │ │ +>parallelInformation().finest(); │ │ │ │ │ +1093 typename Hierarchy::Iterator rhs=rhs_->finest(); │ │ │ │ │ +1094 typename Hierarchy::Iterator lhs = lhs_->finest(); │ │ │ │ │ +1095 typename OperatorHierarchy::AggregatesMapList::const_iterator │ │ │ │ │ +aggregates=matrices_->aggregatesMaps().begin(); │ │ │ │ │ +1096 │ │ │ │ │ +1097 for(typename Hierarchy::Iterator fineRhs=rhs++; fineRhs != rhs_- │ │ │ │ │ +>coarsest(); fineRhs=rhs++, ++aggregates) { │ │ │ │ │ +1098 ++pinfo; │ │ │ │ │ +1099 Transfer │ │ │ │ │ +1100 ::restrictVector(*(*aggregates), *rhs, static_cast │ │ │ │ │ +(*fineRhs), *pinfo); │ │ │ │ │ +1101 } │ │ │ │ │ +1102 │ │ │ │ │ +1103 // pinfo is invalid, set to coarsest level │ │ │ │ │ +1104 //pinfo = matrices_->parallelInformation().coarsest │ │ │ │ │ +1105 // calculate correction for all levels │ │ │ │ │ +1106 lhs = lhs_->finest(); │ │ │ │ │ +1107 typename Hierarchy::Iterator smoother = smoothers_->finest(); │ │ │ │ │ +1108 │ │ │ │ │ +1109 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) │ │ │ │ │ +{ │ │ │ │ │ +1110 // presmoothing │ │ │ │ │ +1111 *lhs=0; │ │ │ │ │ +1112 smoother->apply(*lhs, *rhs); │ │ │ │ │ +1113 } │ │ │ │ │ +1114 │ │ │ │ │ +1115 // Coarse level solve │ │ │ │ │ +1116#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ │ +1117 InverseOperatorResult res; │ │ │ │ │ +1118 pinfo->copyOwnerToAll(*rhs, *rhs); │ │ │ │ │ +1119 solver_->apply(*lhs, *rhs, res); │ │ │ │ │ +1120 │ │ │ │ │ +1121 if(!res.converged) │ │ │ │ │ +1122 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ │ +1123#else │ │ │ │ │ +1124 *lhs=0; │ │ │ │ │ +1125#endif │ │ │ │ │ +1126 // Prologate and add up corrections from all levels │ │ │ │ │ +1127 --pinfo; │ │ │ │ │ +1128 --aggregates; │ │ │ │ │ +1129 │ │ │ │ │ +1130 for(typename Hierarchy::Iterator coarseLhs = lhs--; coarseLhs != │ │ │ │ │ +lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) { │ │ │ │ │ +1131 Transfer │ │ │ │ │ +1132 ::prolongateVector(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo); │ │ │ │ │ +1133 } │ │ │ │ │ +1134 } │ │ │ │ │ +1135 │ │ │ │ │ +1136 │ │ │ │ │ +1138 template │ │ │ │ │ +_1_1_3_9 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_p_o_s_t([[maybe_unused]] _D_o_m_a_i_n& x) │ │ │ │ │ +1140 { │ │ │ │ │ +1141 // Postprocess all smoothers │ │ │ │ │ +1142 typedef typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ │ +1143 typedef typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r DIterator; │ │ │ │ │ +1144 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ │ +1145 Iterator smoother = smoothers_->finest(); │ │ │ │ │ +1146 DIterator lhs = lhs_->finest(); │ │ │ │ │ +1147 if(smoothers_->levels()>0) { │ │ │ │ │ +1148 if(smoother != coarsest || matrices_->levels()maxlevels()) │ │ │ │ │ +1149 smoother->post(*lhs); │ │ │ │ │ +1150 if(smoother!=coarsest) │ │ │ │ │ +1151 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs) │ │ │ │ │ +1152 smoother->post(*lhs); │ │ │ │ │ +1153 smoother->post(*lhs); │ │ │ │ │ +1154 } │ │ │ │ │ +1155 lhs_ = nullptr; │ │ │ │ │ +1156 update_ = nullptr; │ │ │ │ │ +1157 rhs_ = nullptr; │ │ │ │ │ +1158 } │ │ │ │ │ +1159 │ │ │ │ │ +1160 template │ │ │ │ │ +1161 template │ │ │ │ │ +_1_1_6_2 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont) │ │ │ │ │ +1163 { │ │ │ │ │ +1164 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ │ +1165 } │ │ │ │ │ +1166 │ │ │ │ │ +1167 } // end namespace Amg │ │ │ │ │ +1168 │ │ │ │ │ +_1_1_6_9 struct _A_M_G_C_r_e_a_t_o_r{ │ │ │ │ │ +_1_1_7_0 template struct _i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e : std::false_type{}; │ │ │ │ │ +_1_1_7_1 template struct │ │ │ │ │ +_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e<_F_i_e_l_d_M_a_t_r_i_x> : std::true_type{}; │ │ │ │ │ +1172 │ │ │ │ │ +1173 template │ │ │ │ │ +1174 std::shared_ptr > │ │ │ │ │ +_1_1_7_5 _m_a_k_e_A_M_G(const OP& op, const std::string& smoother, const Dune:: │ │ │ │ │ +ParameterTree& config) const │ │ │ │ │ +1176 { │ │ │ │ │ +1177 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG"); │ │ │ │ │ +1178 } │ │ │ │ │ +1179 │ │ │ │ │ +1180 template │ │ │ │ │ +1181 std::shared_ptr > │ │ │ │ │ +_1_1_8_2 _m_a_k_e_A_M_G(const std::shared_ptr<_M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_>>& op, const std:: │ │ │ │ │ +string& smoother, │ │ │ │ │ +1183 const Dune::ParameterTree& config) const │ │ │ │ │ +1184 { │ │ │ │ │ +1185 using OP = _M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_>; │ │ │ │ │ +1186 │ │ │ │ │ +1187 if(smoother == "ssor") │ │ │ │ │ +1188 return std::make_shared>>(op, config); │ │ │ │ │ +1189 if(smoother == "sor") │ │ │ │ │ +1190 return std::make_shared>>(op, config); │ │ │ │ │ +1191 if(smoother == "jac") │ │ │ │ │ +1192 return std::make_shared>>(op, config); │ │ │ │ │ +1193 if(smoother == "gs") │ │ │ │ │ +1194 return std::make_shared>>(op, config); │ │ │ │ │ +1195 if(smoother == "ilu") │ │ │ │ │ +1196 return std::make_shared>>(op, config); │ │ │ │ │ +1197 else │ │ │ │ │ +1198 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ │ +1199 } │ │ │ │ │ +1200 │ │ │ │ │ +1201 template │ │ │ │ │ +1202 std::shared_ptr > │ │ │ │ │ +_1_2_0_3 _m_a_k_e_A_M_G(const std::shared_ptr<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>>& op, │ │ │ │ │ +const std::string& smoother, │ │ │ │ │ +1204 const Dune::ParameterTree& config) const │ │ │ │ │ +1205 { │ │ │ │ │ +1206 using OP = _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>; │ │ │ │ │ +1207 │ │ │ │ │ +1208 auto cop = std::static_pointer_cast(op); │ │ │ │ │ +1209 │ │ │ │ │ +1210 if(smoother == "ssor") │ │ │ │ │ +1211 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ +()); │ │ │ │ │ +1212 if(smoother == "sor") │ │ │ │ │ +1213 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ +()); │ │ │ │ │ +1214 if(smoother == "jac") │ │ │ │ │ +1215 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ +()); │ │ │ │ │ +1216 if(smoother == "gs") │ │ │ │ │ +1217 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ +()); │ │ │ │ │ +1218 if(smoother == "ilu") │ │ │ │ │ +1219 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ │ +()); │ │ │ │ │ +1220 else │ │ │ │ │ +1221 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ │ +1222 } │ │ │ │ │ +1223 │ │ │ │ │ +1224 template │ │ │ │ │ +1225 std::shared_ptr > │ │ │ │ │ +_1_2_2_6 _m_a_k_e_A_M_G(const std::shared_ptr<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>>& op, │ │ │ │ │ +const std::string& smoother, │ │ │ │ │ +1227 const Dune::ParameterTree& config) const │ │ │ │ │ +1228 { │ │ │ │ │ +1229 using OP = _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>; │ │ │ │ │ +1230 │ │ │ │ │ +1231 if(smoother == "ssor") │ │ │ │ │ +1232 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ +>getCommunication()); │ │ │ │ │ +1233 if(smoother == "sor") │ │ │ │ │ +1234 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ +>getCommunication()); │ │ │ │ │ +1235 if(smoother == "jac") │ │ │ │ │ +1236 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ +>getCommunication()); │ │ │ │ │ +1237 if(smoother == "gs") │ │ │ │ │ +1238 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ +>getCommunication()); │ │ │ │ │ +1239 if(smoother == "ilu") │ │ │ │ │ +1240 return std::make_shared>,C>>(op, config, op- │ │ │ │ │ +>getCommunication()); │ │ │ │ │ +1241 else │ │ │ │ │ +1242 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ │ +1243 } │ │ │ │ │ +1244 │ │ │ │ │ +1245 template │ │ │ │ │ +1246 std::shared_ptr::type, │ │ │ │ │ +1247 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ +_1_2_4_8 _o_p_e_r_a_t_o_r_(_)_ (TL tl, const std::shared_ptr& op, const Dune:: │ │ │ │ │ +ParameterTree& config, │ │ │ │ │ +1249 std::enable_if_t<_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_t_y_p_e_n_a_m_e_ _O_P_:_:_m_a_t_r_i_x___t_y_p_e_:_:_b_l_o_c_k___t_y_p_e_>_:_: │ │ │ │ │ +_v_a_l_u_e,int> = 0) const │ │ │ │ │ +1250 { │ │ │ │ │ +1251 using field_type = typename OP::matrix_type::field_type; │ │ │ │ │ +1252 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +1253 if (!std::is_convertible()) │ │ │ │ │ +1254 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "AMG needs field_type(" << │ │ │ │ │ +1255 className() << │ │ │ │ │ +1256 ") to be convertible to its real_type (" << │ │ │ │ │ +1257 className() << │ │ │ │ │ +1258 ")."); │ │ │ │ │ +1259 using D = typename Dune::TypeListElement<1, decltype(tl)>::type; │ │ │ │ │ +1260 using R = typename Dune::TypeListElement<2, decltype(tl)>::type; │ │ │ │ │ +1261 std::shared_ptr> amg; │ │ │ │ │ +1262 std::string smoother = config.get("smoother", "ssor"); │ │ │ │ │ +1263 return _m_a_k_e_A_M_G(op, smoother, config); │ │ │ │ │ +1264 } │ │ │ │ │ +1265 │ │ │ │ │ +1266 template │ │ │ │ │ +1267 std::shared_ptr::type, │ │ │ │ │ +1268 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ +_1_2_6_9 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const std::shared_ptr& /*mat*/, const Dune:: │ │ │ │ │ +ParameterTree& /*config*/, │ │ │ │ │ +1270 std::enable_if_t_:_: │ │ │ │ │ +_v_a_l_u_e,int> = 0) const │ │ │ │ │ +1271 { │ │ │ │ │ +1272 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"); │ │ │ │ │ +1273 } │ │ │ │ │ +1274 }; │ │ │ │ │ +1275 │ │ │ │ │ +_1_2_7_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("amg", _A_M_G_C_r_e_a_t_o_r()); │ │ │ │ │ +1277} // end namespace Dune │ │ │ │ │ +1278 │ │ │ │ │ +1279#endif │ │ │ │ │ +_s_u_p_e_r_l_u_._h_h │ │ │ │ │ +Classes for using SuperLU with ISTL matrices. │ │ │ │ │ _s_o_l_v_e_r_s_._h_h │ │ │ │ │ Implementations of the inverse operator interface. │ │ │ │ │ -_i_o_._h_h │ │ │ │ │ -Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._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_:_:_p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ -void printvector(std::ostream &s, const V &v, std::string title, std::string │ │ │ │ │ -rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ -Print an ISTL vector. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:89 │ │ │ │ │ +_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ +Templates characterizing the type of a solver. │ │ │ │ │ +_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. │ │ │ │ │ +_t_r_a_n_s_f_e_r_._h_h │ │ │ │ │ +Prolongation and restriction for amg. │ │ │ │ │ +_u_m_f_p_a_c_k_._h_h │ │ │ │ │ +Classes for using UMFPack with ISTL matrices. │ │ │ │ │ +_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ │ +Define base class for scalar product and norm. │ │ │ │ │ +_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R │ │ │ │ │ +#define DUNE_REGISTER_PRECONDITIONER(name,...) │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ +AMG(const AMG &amg) │ │ │ │ │ +Copy constructor. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:392 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_p_r_e │ │ │ │ │ +void pre(Domain &x, Range &b) │ │ │ │ │ +Prepare the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:801 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_c_r_e_a_t_e │ │ │ │ │ +static DirectSolver * create(const Matrix &mat, bool verbose, bool reusevector) │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:681 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_n_a_m_e │ │ │ │ │ +static std::string name() │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:680 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_u_p_d_a_t_e │ │ │ │ │ +Hierarchy< Domain, A >::Iterator update │ │ │ │ │ +The iterator over the updates. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:303 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_h_s │ │ │ │ │ +Hierarchy< Range, A >::Iterator rhs │ │ │ │ │ +The iterator over the right hand sided. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:307 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_n_a_m_e │ │ │ │ │ +static std::string name() │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:672 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r │ │ │ │ │ +bool usesDirectCoarseLevelSolver() const │ │ │ │ │ +Check whether the coarse solver used is a direct solver. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1024 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ │ +X Domain │ │ │ │ │ +The domain type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:87 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_c_r_e_a_t_e │ │ │ │ │ +static type * create(const M &mat, bool verbose, bool reusevector) │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:644 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ +AMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs │ │ │ │ │ +&smootherArgs, const Parameters &parms) │ │ │ │ │ +Construct a new amg with a specific coarse solver. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:406 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ +AMG(std::shared_ptr< const Operator > fineOperator, const ParameterTree │ │ │ │ │ +&configuration, const ParallelInformation &pinfo=ParallelInformation()) │ │ │ │ │ +Constructor an AMG via ParameterTree. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:452 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_p_i_n_f_o │ │ │ │ │ +ParallelInformationHierarchy::Iterator pinfo │ │ │ │ │ +The iterator over the parallel information. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:287 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_T_y_p_e │ │ │ │ │ +SolverType │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_a_g_g_r_e_g_a_t_e_s │ │ │ │ │ +OperatorHierarchy::AggregatesMapList::const_iterator aggregates │ │ │ │ │ +The iterator over the aggregates maps. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:295 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ +SmootherTraits< Smoother >::Arguments SmootherArgs │ │ │ │ │ +The argument type for the construction of the smoother. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:100 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_e_l_e_c_t_e_d_S_o_l_v_e_r │ │ │ │ │ +Solver< Matrix, solver > SelectedSolver │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:677 │ │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ +std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ │ +MatrixAdapter< M, X, Y > > &op, const std::string &smoother, const Dune:: │ │ │ │ │ +ParameterTree &config) const │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1182 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_T_o_L_o_w_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +std::string operator()(const std::string &str) │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:378 │ │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ +std::shared_ptr< Dune::Preconditioner< typename OP::element_type::domain_type, │ │ │ │ │ +typename OP::element_type::range_type > > makeAMG(const OP &op, const std:: │ │ │ │ │ +string &smoother, const Dune::ParameterTree &config) const │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1175 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r │ │ │ │ │ +S Smoother │ │ │ │ │ +The type of the smoother. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:97 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_n_a_m_e │ │ │ │ │ +static std::string name() │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:649 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_s_m_o_o_t_h_e_r │ │ │ │ │ +Hierarchy< Smoother, A >::Iterator smoother │ │ │ │ │ +The iterator over the smoothers. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:279 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ │ +M Operator │ │ │ │ │ +The matrix operator type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_m_a_t_r_i_x │ │ │ │ │ +OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix │ │ │ │ │ +The iterator over the matrices. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:283 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_t_y_p_e │ │ │ │ │ +SuperLU< M > type │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:667 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_c_r_e_a_t_e │ │ │ │ │ +static type * create(const M &mat, bool verbose, bool reusevector) │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:668 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_d_i_s_t │ │ │ │ │ +OperatorHierarchy::RedistributeInfoList::const_iterator redist │ │ │ │ │ +The iterator over the redistribution information. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:291 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_R_a_n_g_e │ │ │ │ │ +X Range │ │ │ │ │ +The range type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h │ │ │ │ │ +void presmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ +Apply pre smoothing on the current level. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:406 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s │ │ │ │ │ +void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont) │ │ │ │ │ +Get the aggregate number of each unknown on the coarsest level. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1162 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_l_e_v_e_l_s │ │ │ │ │ +std::size_t levels() │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:876 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_t_y_p_e │ │ │ │ │ +InverseOperator< Vector, Vector > type │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:643 │ │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ +std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ │ +OverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, │ │ │ │ │ +const Dune::ParameterTree &config) const │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1203 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_h_s │ │ │ │ │ +Hierarchy< Domain, A >::Iterator lhs │ │ │ │ │ +The iterator over the left hand side. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:299 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ │ +const void * Arguments │ │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_s_o_l_v_e_r │ │ │ │ │ +static constexpr SolverType solver │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:629 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_i_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ +static constexpr bool isDirectSolver │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:679 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y │ │ │ │ │ +void recalculateHierarchy() │ │ │ │ │ +Recalculate the matrix hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:221 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +Matrix::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:626 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ +SelectedSolver::type DirectSolver │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:678 │ │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL │ │ │ │ │ +>::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL tl, │ │ │ │ │ +const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std:: │ │ │ │ │ +enable_if_t< isValidBlockType< typename OP::matrix_type::block_type >::value, │ │ │ │ │ +int >=0) const │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1248 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ │ +OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ │ +The parallal data distribution hierarchy type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ │ +InverseOperator< X, X > CoarseSolver │ │ │ │ │ +the type of the coarse solver. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:91 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_p_o_s_t │ │ │ │ │ +void post(Domain &x) │ │ │ │ │ +Clean up. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1139 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ │ +std::size_t maxlevels() │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:881 │ │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ │ +std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ │ +NonoverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, │ │ │ │ │ +const Dune::ParameterTree &config) const │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1226 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ │ +void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ │ +Apply post smoothing on the current level. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_e_v_e_l │ │ │ │ │ +std::size_t level │ │ │ │ │ +The level index. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:311 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ │ +AMG(const Operator &fineOperator, const C &criterion, const SmootherArgs │ │ │ │ │ +&smootherArgs=SmootherArgs(), const ParallelInformation │ │ │ │ │ +&pinfo=ParallelInformation()) │ │ │ │ │ +Construct an AMG with an inexact coarse solver based on the smoother. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:428 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_a_p_p_l_y │ │ │ │ │ +void apply(Domain &v, const Range &d) │ │ │ │ │ +Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:888 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_S_m_o_o_t_h_e_r_T_y_p_e │ │ │ │ │ +Smoother SmootherType │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ │ +MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy │ │ │ │ │ +The operator hierarchy type. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +PI ParallelInformation │ │ │ │ │ +The type of the parallel information. Either OwnerOverlapCommunication or │ │ │ │ │ +another type describing the... │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_n_o_n_e │ │ │ │ │ +@ none │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_u_m_f_p_a_c_k │ │ │ │ │ +@ umfpack │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_s_u_p_e_r_l_u │ │ │ │ │ +@ superlu │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ │ +@ atOnceAccu │ │ │ │ │ +Accumulate data to one process at once. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:244 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u │ │ │ │ │ +@ noAccu │ │ │ │ │ +No data accumulution. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:238 │ │ │ │ │ +_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:248 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -The type for the index access and the size. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ -_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:1978 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ -void mv(const X &x, Y &y) const │ │ │ │ │ -y = A x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1612 │ │ │ │ │ -_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:1972 │ │ │ │ │ -_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:395 │ │ │ │ │ -_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:401 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ -Iterative eigenvalue algorithms based on power iteration. │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:176 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_i_t_M_a_t_r_i_x__ │ │ │ │ │ -std::unique_ptr< BCRSMatrix > itMatrix_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1034 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ -PowerIteration_Algorithms(const PowerIteration_Algorithms &)=delete │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_S_c_a_l_i_n_g_O_p_e_r_a_t_o_r │ │ │ │ │ -Impl::ScalingLinearOperator< BlockVector > ScalingOperator │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:181 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_b_l_a_n_k__ │ │ │ │ │ -const std::string blank_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1043 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_O_p_e_r_a_t_o_r_S_u_m │ │ │ │ │ -Impl::LinearOperatorSum< MatrixOperator, ScalingOperator > OperatorSum │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ │ -Dune::MatrixAdapter< BCRSMatrix, BlockVector, BlockVector > MatrixOperator │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n │ │ │ │ │ -void applyInverseIteration(const Real &epsilon, ISTLLinearSolver &solver, │ │ │ │ │ -BlockVector &x, Real &lambda) const │ │ │ │ │ -Perform the inverse iteration algorithm to compute an approximation lambda of │ │ │ │ │ -the least dominant (i.... │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:355 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_T_L_I_M_E_I_t_e_r_a_t_i_o_n │ │ │ │ │ -void applyTLIMEIteration(const Real &gamma, const Real &eta, const Real │ │ │ │ │ -&epsilon, ISTLLinearSolver &solver, const Real &delta, const std::size_t &m, │ │ │ │ │ -bool &extrnl, BlockVector &x, Real &lambda) const │ │ │ │ │ -Perform the "two-level iterative method for eigenvalue calculations (TLIME)" │ │ │ │ │ -iteration algorit... │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:691 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_g_e_t_I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ -IterationOperator & getIterationOperator() │ │ │ │ │ -Return the iteration operator (m_ - mu_*I). │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:925 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_i_t_O_p_e_r_a_t_o_r__ │ │ │ │ │ -OperatorSum itOperator_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1030 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_m__ │ │ │ │ │ -const BCRSMatrix & m_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1018 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ -PowerIteration_Algorithms(const BCRSMatrix &m, const unsigned int │ │ │ │ │ -nIterationsMax=1000, const unsigned int verbosity_level=0) │ │ │ │ │ -Construct from required parameters. │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:206 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_n_I_t_e_r_a_t_i_o_n_s_M_a_x__ │ │ │ │ │ -const unsigned int nIterationsMax_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1019 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_P_o_w_e_r_I_t_e_r_a_t_i_o_n │ │ │ │ │ -void applyPowerIteration(const Real &epsilon, BlockVector &x, Real &lambda) │ │ │ │ │ -const │ │ │ │ │ -Perform the power iteration algorithm to compute an approximation lambda of the │ │ │ │ │ -dominant (i.... │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:260 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ -OperatorSum IterationOperator │ │ │ │ │ -Type of iteration operator (m_ - mu_*I) │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:189 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_R_a_y_l_e_i_g_h_Q_u_o_t_i_e_n_t_I_t_e_r_a_t_i_o_n │ │ │ │ │ -void applyRayleighQuotientIteration(const Real &epsilon, ISTLLinearSolver │ │ │ │ │ -&solver, BlockVector &x, Real &lambda) const │ │ │ │ │ -Perform the Rayleigh quotient iteration algorithm to compute an approximation │ │ │ │ │ -lambda of an eigenvalue... │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:533 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n │ │ │ │ │ -void applyInverseIteration(const Real &gamma, const Real &epsilon, │ │ │ │ │ -ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const │ │ │ │ │ -Perform the inverse iteration with shift algorithm to compute an approximation │ │ │ │ │ -lambda of the eigenval... │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:394 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__ │ │ │ │ │ -const ScalingOperator scalingOperator_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1029 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_u_p_d_a_t_e_S_h_i_f_t_M_u │ │ │ │ │ -void updateShiftMu(const Real &mu, ISTLLinearSolver &solver) const │ │ │ │ │ -Update shift mu_, i.e. update iteration operator/matrix (m_ - mu_*I). │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:983 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -PowerIteration_Algorithms & operator=(const PowerIteration_Algorithms &)=delete │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t │ │ │ │ │ -unsigned int getIterationCount() const │ │ │ │ │ -Return the number of iterations in last application of an algorithm. │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:959 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_m_a_t_r_i_x_O_p_e_r_a_t_o_r__ │ │ │ │ │ -const MatrixOperator matrixOperator_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1028 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_g_e_t_I_t_e_r_a_t_i_o_n_M_a_t_r_i_x │ │ │ │ │ -const BCRSMatrix & getIterationMatrix() const │ │ │ │ │ -Return the iteration matrix (m_ - mu_*I), provided on demand when needed (e.g. │ │ │ │ │ -for direct solvers or ... │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:945 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ -unsigned int nIterations_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1039 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ │ │ │ │ │ -const unsigned int verbosity_level_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1022 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_t_i_t_l_e__ │ │ │ │ │ -const std::string title_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1042 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_R_e_a_l │ │ │ │ │ -BlockVector::field_type Real │ │ │ │ │ -Type of underlying field. │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:186 │ │ │ │ │ -_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_m_u__ │ │ │ │ │ -Real mu_ │ │ │ │ │ -DDeeffiinniittiioonn poweriteration.hh:1025 │ │ │ │ │ -_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_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -A linear operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 operators.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ -virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0 │ │ │ │ │ -apply operator to x, scale and add: │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 linear operator (see SolverCategory::Category) │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(const X &x, Y &y) const =0 │ │ │ │ │ -apply operator to x: The input vector is consistent and the output must also be │ │ │ │ │ -consistent on the in... │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ │ +Export the type representing the underlying field. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ +row_type::const_iterator ConstColIterator │ │ │ │ │ +Const iterator for the entries of each row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +T block_type │ │ │ │ │ +Export the type representing the components. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:568 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ +A nonoverlapping operator with communication object. │ │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:61 │ │ │ │ │ _D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ │ Adapter to turn a matrix into a linear operator. │ │ │ │ │ DDeeffiinniittiioonn operators.hh:137 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l │ │ │ │ │ +Norm that uses only the [N][N] entry of the block to determine couplings. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:379 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m │ │ │ │ │ +Functor using the row sum (infinity) norm to determine strong couplings. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:463 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:480 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:496 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +Criterion taking advantage of symmetric matrices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:519 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ │ +Criterion suitable for unsymmetric matrices. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:539 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G │ │ │ │ │ +an algebraic multigrid method using a Krylov-cycle. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ │ +Two grid operator for AMG with Krylov cycle. │ │ │ │ │ +DDeeffiinniittiioonn kamg.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G │ │ │ │ │ +Parallel algebraic multigrid based on agglomeration. │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:625 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:642 │ │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1169 │ │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn amg.hh:1170 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ +An overlapping Schwarz operator. │ │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ +LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ │ +> Iterator │ │ │ │ │ +Type of the mutable iterator. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ │ +Iterator over the levels in the hierarchy. │ │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ │ +The hierarchies build by the coarsening process. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ │ +The criterion describing the stop criteria for the coarsening process. │ │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:283 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ +All parameters for AMG. │ │ │ │ │ +DDeeffiinniittiioonn parameters.hh:393 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ │ +The default class for the smoother arguments. │ │ │ │ │ +DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ +Base class for matrix free definition of preconditioners. │ │ │ │ │ +DDeeffiinniittiioonn preconditioner.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _X_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn preconditioner.hh:39 │ │ │ │ │ +_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:48 │ │ │ │ │ -_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:524 │ │ │ │ │ +_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:73 │ │ │ │ │ +_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:99 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ │ +Categories for the solvers. │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:22 │ │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ Category │ │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ │ -@ sequential │ │ │ │ │ -Category for sequential solvers. │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ │ +Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ │ +newly introduced virtu... │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U │ │ │ │ │ +SuperLu Solver. │ │ │ │ │ +DDeeffiinniittiioonn superlu.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ │ +The UMFPack direct sparse solver. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:215 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00170.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bccsmatrix.hh File Reference │ │ │ │ +dune-istl: smoother.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,36 +65,126 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces
│ │ │ │ -
bccsmatrix.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ + │ │ │ │ +

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

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

│ │ │ │ Namespaces

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

provides functions for sparse matrix matrix multiplication. │ │ │ │ -More...

│ │ │ │
#include <tuple>
│ │ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/timer.hh>
│ │ │ │ +#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::MatMultMatResult< M1, M2 >
 Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$) More...
 
struct  Dune::MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >
 
struct  Dune::MatMultMatResult< BCRSMatrix< FieldMatrix< T, n, k >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > >
 
struct  Dune::TransposedMatMultMatResult< M1, M2 >
 Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$) More...
struct  Dune::Amg::PropertiesGraphCreator< M, PI >
 
struct  Dune::TransposedMatMultMatResult< FieldMatrix< T, k, n >, FieldMatrix< T, k, m > >
 
struct  Dune::TransposedMatMultMatResult< BCRSMatrix< FieldMatrix< T, k, n >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > >
struct  Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<class T , class A , class A1 , class A2 , int n, int m, int k>
void Dune::matMultTransposeMat (BCRSMatrix< FieldMatrix< T, n, k >, A > &res, const BCRSMatrix< FieldMatrix< T, n, m >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
 Calculate product of a sparse matrix with a transposed sparse matrices ( $C=A*B^T$).
 
template<class T , class A , class A1 , class A2 , int n, int m, int k>
void Dune::matMultMat (BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, n, k >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
 Calculate product of two sparse matrices ( $C=A*B$).
 
template<class T , class A , class A1 , class A2 , int n, int m, int k>
void Dune::transposeMatMultMat (BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, k, n >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
 Calculate product of a transposed sparse matrix with another sparse matrices ( $C=A^T*B$).
 
namespace  Dune::Amg
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

provides functions for sparse matrix matrix multiplication.

│ │ │ │ -
Author
Markus Blatt
│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,66 +1,28 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -matrixmatrix.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 │ │ │ │ │ -provides functions for sparse matrix matrix multiplication. _M_o_r_e_._._. │ │ │ │ │ + * _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 │ │ │ │ │ #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 │ │ │ │ │ _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_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _M_1_,_ _M_2_ _> │ │ │ │ │ -  Helper TMP to get the result type of a sparse matrix matrix │ │ │ │ │ - multiplication ( [$C=A*B$]) _M_o_r_e_._._. │ │ │ │ │ +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_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _> │ │ │ │ │ - _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _A_ _>_, │ │ │ │ │ - _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _M_1_,_ _M_2_ _> │ │ │ │ │ -  Helper TMP to get the result type of a sparse matrix matrix │ │ │ │ │ - multiplication ( [$C=A*B$]) _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_< │ │ │ │ │ - _T_,_ _k_,_ _m_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_, │ │ │ │ │ - _A_ _>_,_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _> │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_m_a_t_M_u_l_t_T_r_a_n_s_p_o_s_e_M_a_t (_B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, n, k >, A > &res, │ │ │ │ │ - const _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, n, m >, A1 > &_m_a_t, const _B_C_R_S_M_a_t_r_i_x< │ │ │ │ │ - _F_i_e_l_d_M_a_t_r_i_x< T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ -  Calculate product of a sparse matrix with a transposed sparse matrices ( │ │ │ │ │ - [$C=A*B^T$]). │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_m_a_t_M_u_l_t_M_a_t (_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 > &res, const │ │ │ │ │ - _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, n, k >, A1 > &_m_a_t, const _B_C_R_S_M_a_t_r_i_x< │ │ │ │ │ - _F_i_e_l_d_M_a_t_r_i_x< T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ -  Calculate product of two sparse matrices ( [$C=A*B$]). │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_t_r_a_n_s_p_o_s_e_M_a_t_M_u_l_t_M_a_t (_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 > &res, │ │ │ │ │ - const _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< T, k, n >, A1 > &_m_a_t, const _B_C_R_S_M_a_t_r_i_x< │ │ │ │ │ - _F_i_e_l_d_M_a_t_r_i_x< T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ -  Calculate product of a transposed sparse matrix with another sparse │ │ │ │ │ - matrices ( [$C=A^T*B$]). │ │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -provides functions for sparse matrix matrix multiplication. │ │ │ │ │ - Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00173_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixmatrix.hh Source File │ │ │ │ +dune-istl: graphcreator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,626 +70,156 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
matrixmatrix.hh
│ │ │ │ +
graphcreator.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_MATRIXMATRIX_HH
│ │ │ │ -
6#define DUNE_ISTL_MATRIXMATRIX_HH
│ │ │ │ +
5#ifndef DUNE_AMG_GRAPHCREATOR_HH
│ │ │ │ +
6#define DUNE_AMG_GRAPHCREATOR_HH
│ │ │ │
7
│ │ │ │
8#include <tuple>
│ │ │ │
9
│ │ │ │ - │ │ │ │ -
11#include <dune/common/fmatrix.hh>
│ │ │ │ -
12#include <dune/common/timer.hh>
│ │ │ │ -
13namespace Dune
│ │ │ │ -
14{
│ │ │ │ +
10#include "graph.hh"
│ │ │ │ +
11#include "dependency.hh"
│ │ │ │ +
12#include "pinfo.hh"
│ │ │ │ + │ │ │ │ + │ │ │ │
15
│ │ │ │ -
26 namespace
│ │ │ │ -
27 {
│ │ │ │ -
28
│ │ │ │ -
37 template<int b>
│ │ │ │ -
38 struct NonzeroPatternTraverser
│ │ │ │ -
39 {};
│ │ │ │ -
40
│ │ │ │ -
41
│ │ │ │ -
42 template<>
│ │ │ │ -
43 struct NonzeroPatternTraverser<0>
│ │ │ │ -
44 {
│ │ │ │ -
45 template<class T,class A1, class A2, class F, int n, int m, int k>
│ │ │ │ -
46 static void traverse(const Dune::BCRSMatrix<Dune::FieldMatrix<T,n,k>,A1>& A,
│ │ │ │ - │ │ │ │ -
48 F& func)
│ │ │ │ -
49 {
│ │ │ │ -
50 if(A.M()!=B.N())
│ │ │ │ -
51 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "<<A.M()<<"!="<<B.N());
│ │ │ │ +
16namespace Dune
│ │ │ │ +
17{
│ │ │ │ +
18 namespace Amg
│ │ │ │ +
19 {
│ │ │ │ +
20 template<class M, class PI>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
22 {
│ │ │ │ +
23 typedef typename M::matrix_type Matrix;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
26 std::vector<bool> > SubGraph;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
30 IdentityMap,
│ │ │ │ + │ │ │ │ + │ │ │ │ +
33
│ │ │ │ +
34 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
│ │ │ │ +
35
│ │ │ │ +
36 template<class OF, class T>
│ │ │ │ +
│ │ │ │ +
37 static GraphTuple create(const M& matrix, T& excluded,
│ │ │ │ +
38 PI& pinfo, const OF& of)
│ │ │ │ +
39 {
│ │ │ │ +
40 MatrixGraph* mg = new MatrixGraph(matrix.getmat());
│ │ │ │ +
41 typedef typename PI::ParallelIndexSet ParallelIndexSet;
│ │ │ │ +
42 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ │ +
43 IndexIterator iend = pinfo.indexSet().end();
│ │ │ │ +
44
│ │ │ │ +
45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
│ │ │ │ +
46 excluded[index->local()] = of.contains(index->local().attribute());
│ │ │ │ +
47
│ │ │ │ +
48 SubGraph* sg= new SubGraph(*mg, excluded);
│ │ │ │ +
49 PropertiesGraph* pg = new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
│ │ │ │ +
50 return GraphTuple(mg,pg,sg);
│ │ │ │ +
51 }
│ │ │ │ +
│ │ │ │
52
│ │ │ │ -
53 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,n,k>,A1>::ConstRowIterator Row;
│ │ │ │ -
54 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,n,k>,A1>::ConstColIterator Col;
│ │ │ │ -
55 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,m>,A2>::ConstColIterator BCol;
│ │ │ │ -
56 for(Row row= A.begin(); row != A.end(); ++row) {
│ │ │ │ -
57 // Loop over all column entries
│ │ │ │ -
58 for(Col col = row->begin(); col != row->end(); ++col) {
│ │ │ │ -
59 // entry at i,k
│ │ │ │ -
60 // search for all nonzeros in row k
│ │ │ │ -
61 for(BCol bcol = B[col.index()].begin(); bcol != B[col.index()].end(); ++bcol) {
│ │ │ │ -
62 func(*col, *bcol, row.index(), bcol.index());
│ │ │ │ -
63 }
│ │ │ │ -
64 }
│ │ │ │ -
65 }
│ │ │ │ -
66 }
│ │ │ │ -
67
│ │ │ │ -
68 };
│ │ │ │ -
69
│ │ │ │ -
70 template<>
│ │ │ │ -
71 struct NonzeroPatternTraverser<1>
│ │ │ │ -
72 {
│ │ │ │ -
73 template<class T, class A1, class A2, class F, int n, int m, int k>
│ │ │ │ -
74 static void traverse(const Dune::BCRSMatrix<Dune::FieldMatrix<T,k,n>,A1>& A,
│ │ │ │ - │ │ │ │ -
76 F& func)
│ │ │ │ -
77 {
│ │ │ │ -
78
│ │ │ │ -
79 if(A.N()!=B.N())
│ │ │ │ -
80 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "<<A.N()<<"!="<<B.N());
│ │ │ │ -
81
│ │ │ │ -
82 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,n>,A1>::ConstRowIterator Row;
│ │ │ │ -
83 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,n>,A1>::ConstColIterator Col;
│ │ │ │ -
84 typedef typename Dune::BCRSMatrix<Dune::FieldMatrix<T,k,m>,A2>::ConstColIterator BCol;
│ │ │ │ +
│ │ │ │ +
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 for(Row row=A.begin(); row!=A.end(); ++row) {
│ │ │ │ -
87 for(Col col=row->begin(); col!=row->end(); ++col) {
│ │ │ │ -
88 for(BCol bcol = B[row.index()].begin(); bcol != B[row.index()].end(); ++bcol) {
│ │ │ │ -
89 func(*col, *bcol, col.index(), bcol.index());
│ │ │ │ -
90 }
│ │ │ │ -
91 }
│ │ │ │ -
92 }
│ │ │ │ -
93 }
│ │ │ │ -
94 };
│ │ │ │ -
95
│ │ │ │ -
96 template<>
│ │ │ │ -
97 struct NonzeroPatternTraverser<2>
│ │ │ │ -
98 {
│ │ │ │ -
99 template<class T, class A1, class A2, class F, int n, int m, int k>
│ │ │ │ -
100 static void traverse(const BCRSMatrix<FieldMatrix<T,n,m>,A1>& mat,
│ │ │ │ -
101 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt,
│ │ │ │ -
102 F& func)
│ │ │ │ -
103 {
│ │ │ │ -
104 if(mat.M()!=matt.M())
│ │ │ │ -
105 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "<<mat.M()<<"!="<<matt.M());
│ │ │ │ -
106
│ │ │ │ -
107 typedef typename BCRSMatrix<FieldMatrix<T,n,m>,A1>::ConstRowIterator row_iterator;
│ │ │ │ -
108 typedef typename BCRSMatrix<FieldMatrix<T,n,m>,A1>::ConstColIterator col_iterator;
│ │ │ │ -
109 typedef typename BCRSMatrix<FieldMatrix<T,k,m>,A2>::ConstRowIterator row_iterator_t;
│ │ │ │ -
110 typedef typename BCRSMatrix<FieldMatrix<T,k,m>,A2>::ConstColIterator col_iterator_t;
│ │ │ │ -
111
│ │ │ │ -
112 for(row_iterator mrow=mat.begin(); mrow != mat.end(); ++mrow) {
│ │ │ │ -
113 //iterate over the column entries
│ │ │ │ -
114 // mt is a transposed matrix crs therefore it is treated as a ccs matrix
│ │ │ │ -
115 // and the row_iterator iterates over the columns of the transposed matrix.
│ │ │ │ -
116 // search the row of the transposed matrix for an entry with the same index
│ │ │ │ -
117 // as the mcol iterator
│ │ │ │ -
118
│ │ │ │ -
119 for(row_iterator_t mtcol=matt.begin(); mtcol != matt.end(); ++mtcol) {
│ │ │ │ -
120 //Search for col entries in mat that have a corrsponding row index in matt
│ │ │ │ -
121 // (i.e. corresponding col index in the as this is the transposed matrix
│ │ │ │ -
122 col_iterator_t mtrow=mtcol->begin();
│ │ │ │ -
123 bool funcCalled = false;
│ │ │ │ -
124 for(col_iterator mcol=mrow->begin(); mcol != mrow->end(); ++mcol) {
│ │ │ │ -
125 // search
│ │ │ │ -
126 // TODO: This should probably be substituted by a binary search
│ │ │ │ -
127 for( ; mtrow != mtcol->end(); ++mtrow)
│ │ │ │ -
128 if(mtrow.index()>=mcol.index())
│ │ │ │ -
129 break;
│ │ │ │ -
130 if(mtrow != mtcol->end() && mtrow.index()==mcol.index()) {
│ │ │ │ -
131 func(*mcol, *mtrow, mtcol.index());
│ │ │ │ -
132 funcCalled = true;
│ │ │ │ -
133 // In some cases we only search for one pair, then we break here
│ │ │ │ -
134 // and continue with the next column.
│ │ │ │ -
135 if(F::do_break)
│ │ │ │ -
136 break;
│ │ │ │ -
137 }
│ │ │ │ -
138 }
│ │ │ │ -
139 // move on with func only if func was called, otherwise they might
│ │ │ │ -
140 // get out of sync
│ │ │ │ -
141 if (funcCalled)
│ │ │ │ -
142 func.nextCol();
│ │ │ │ -
143 }
│ │ │ │ -
144 func.nextRow();
│ │ │ │ -
145 }
│ │ │ │ -
146 }
│ │ │ │ -
147 };
│ │ │ │ -
148
│ │ │ │ -
149
│ │ │ │ -
150
│ │ │ │ -
151 template<class T, class A, int n, int m>
│ │ │ │ -
152 class SparsityPatternInitializer
│ │ │ │ -
153 {
│ │ │ │ -
154 public:
│ │ │ │ -
155 enum {do_break=true};
│ │ │ │ - │ │ │ │ - │ │ │ │ -
158
│ │ │ │ -
159 SparsityPatternInitializer(CreateIterator iter)
│ │ │ │ -
160 : rowiter(iter)
│ │ │ │ -
161 {}
│ │ │ │ -
162
│ │ │ │ -
163 template<class T1, class T2>
│ │ │ │ -
164 void operator()(const T1&, const T2&, size_type j)
│ │ │ │ -
165 {
│ │ │ │ -
166 rowiter.insert(j);
│ │ │ │ -
167 }
│ │ │ │ -
168
│ │ │ │ -
169 void nextRow()
│ │ │ │ -
170 {
│ │ │ │ -
171 ++rowiter;
│ │ │ │ -
172 }
│ │ │ │ -
173 void nextCol()
│ │ │ │ -
174 {}
│ │ │ │ -
175
│ │ │ │ -
176 private:
│ │ │ │ -
177 CreateIterator rowiter;
│ │ │ │ -
178 };
│ │ │ │ -
179
│ │ │ │ -
180
│ │ │ │ -
181 template<int transpose, class T, class TA, int n, int m>
│ │ │ │ -
182 class MatrixInitializer
│ │ │ │ -
183 {
│ │ │ │ -
184 public:
│ │ │ │ -
185 enum {do_break=true};
│ │ │ │ - │ │ │ │ - │ │ │ │ -
188 typedef typename Matrix::size_type size_type;
│ │ │ │ -
189
│ │ │ │ -
190 MatrixInitializer(Matrix& A_, size_type)
│ │ │ │ -
191 : count(0), A(A_)
│ │ │ │ -
192 {}
│ │ │ │ -
193 template<class T1, class T2>
│ │ │ │ -
194 void operator()(const T1&, const T2&, int)
│ │ │ │ -
195 {
│ │ │ │ -
196 ++count;
│ │ │ │ -
197 }
│ │ │ │ -
198
│ │ │ │ -
199 void nextCol()
│ │ │ │ -
200 {}
│ │ │ │ -
201
│ │ │ │ -
202 void nextRow()
│ │ │ │ -
203 {}
│ │ │ │ -
204
│ │ │ │ -
205 std::size_t nonzeros()
│ │ │ │ -
206 {
│ │ │ │ -
207 return count;
│ │ │ │ -
208 }
│ │ │ │ -
209
│ │ │ │ -
210 template<class A1, class A2, int n2, int m2, int n3, int m3>
│ │ │ │ -
211 void initPattern(const BCRSMatrix<FieldMatrix<T,n2,m2>,A1>& mat1,
│ │ │ │ -
212 const BCRSMatrix<FieldMatrix<T,n3,m3>,A2>& mat2)
│ │ │ │ -
213 {
│ │ │ │ -
214 SparsityPatternInitializer<T, TA, n, m> sparsity(A.createbegin());
│ │ │ │ -
215 NonzeroPatternTraverser<transpose>::traverse(mat1,mat2,sparsity);
│ │ │ │ -
216 }
│ │ │ │ -
217
│ │ │ │ -
218 private:
│ │ │ │ -
219 std::size_t count;
│ │ │ │ -
220 Matrix& A;
│ │ │ │ -
221 };
│ │ │ │ -
222
│ │ │ │ -
223 template<class T, class TA, int n, int m>
│ │ │ │ -
224 class MatrixInitializer<1,T,TA,n,m>
│ │ │ │ -
225 {
│ │ │ │ -
226 public:
│ │ │ │ -
227 enum {do_break=false};
│ │ │ │ - │ │ │ │ - │ │ │ │ -
230 typedef typename Matrix::size_type size_type;
│ │ │ │ -
231
│ │ │ │ -
232 MatrixInitializer(Matrix& A_, size_type rows)
│ │ │ │ -
233 : A(A_), entries(rows)
│ │ │ │ -
234 {}
│ │ │ │ -
235
│ │ │ │ -
236 template<class T1, class T2>
│ │ │ │ -
237 void operator()(const T1&, const T2&, size_type i, size_type j)
│ │ │ │ -
238 {
│ │ │ │ -
239 entries[i].insert(j);
│ │ │ │ -
240 }
│ │ │ │ -
241
│ │ │ │ -
242 void nextCol()
│ │ │ │ -
243 {}
│ │ │ │ -
244
│ │ │ │ -
245 size_type nonzeros()
│ │ │ │ -
246 {
│ │ │ │ -
247 size_type nnz=0;
│ │ │ │ -
248 typedef typename std::vector<std::set<size_t> >::const_iterator Iter;
│ │ │ │ -
249 for(Iter iter = entries.begin(); iter != entries.end(); ++iter)
│ │ │ │ -
250 nnz+=(*iter).size();
│ │ │ │ -
251 return nnz;
│ │ │ │ -
252 }
│ │ │ │ -
253 template<class A1, class A2, int n2, int m2, int n3, int m3>
│ │ │ │ -
254 void initPattern(const BCRSMatrix<FieldMatrix<T,n2,m2>,A1>&,
│ │ │ │ -
255 const BCRSMatrix<FieldMatrix<T,n3,m3>,A2>&)
│ │ │ │ -
256 {
│ │ │ │ -
257 typedef typename std::vector<std::set<size_t> >::const_iterator Iter;
│ │ │ │ -
258 CreateIterator citer = A.createbegin();
│ │ │ │ -
259 for(Iter iter = entries.begin(); iter != entries.end(); ++iter, ++citer) {
│ │ │ │ -
260 typedef std::set<size_t>::const_iterator SetIter;
│ │ │ │ -
261 for(SetIter index=iter->begin(); index != iter->end(); ++index)
│ │ │ │ -
262 citer.insert(*index);
│ │ │ │ -
263 }
│ │ │ │ -
264 }
│ │ │ │ -
265
│ │ │ │ -
266 private:
│ │ │ │ -
267 Matrix& A;
│ │ │ │ -
268 std::vector<std::set<size_t> > entries;
│ │ │ │ -
269 };
│ │ │ │ -
270
│ │ │ │ -
271 template<class T, class TA, int n, int m>
│ │ │ │ -
272 struct MatrixInitializer<0,T,TA,n,m>
│ │ │ │ -
273 : public MatrixInitializer<1,T,TA,n,m>
│ │ │ │ -
274 {
│ │ │ │ -
275 MatrixInitializer(Dune::BCRSMatrix<Dune::FieldMatrix<T,n,m>,TA>& A_,
│ │ │ │ - │ │ │ │ -
277 : MatrixInitializer<1,T,TA,n,m>(A_,rows)
│ │ │ │ -
278 {}
│ │ │ │ -
279 };
│ │ │ │ -
280
│ │ │ │ -
281
│ │ │ │ -
282 template<class T, class T1, class T2, int n, int m, int k>
│ │ │ │ -
283 void addMatMultTransposeMat(FieldMatrix<T,n,k>& res, const FieldMatrix<T1,n,m>& mat,
│ │ │ │ -
284 const FieldMatrix<T2,k,m>& matt)
│ │ │ │ -
285 {
│ │ │ │ -
286 typedef typename FieldMatrix<T,n,k>::size_type size_type;
│ │ │ │ -
287
│ │ │ │ -
288 for(size_type row=0; row<n; ++row)
│ │ │ │ -
289 for(size_type col=0; col<k; ++col) {
│ │ │ │ -
290 for(size_type i=0; i < m; ++i)
│ │ │ │ -
291 res[row][col]+=mat[row][i]*matt[col][i];
│ │ │ │ -
292 }
│ │ │ │ -
293 }
│ │ │ │ -
294
│ │ │ │ -
295 template<class T, class T1, class T2, int n, int m, int k>
│ │ │ │ -
296 void addTransposeMatMultMat(FieldMatrix<T,n,k>& res, const FieldMatrix<T1,m,n>& mat,
│ │ │ │ -
297 const FieldMatrix<T2,m,k>& matt)
│ │ │ │ -
298 {
│ │ │ │ -
299 typedef typename FieldMatrix<T,n,k>::size_type size_type;
│ │ │ │ -
300 for(size_type i=0; i<m; ++i)
│ │ │ │ -
301 for(size_type row=0; row<n; ++row) {
│ │ │ │ -
302 for(size_type col=0; col < k; ++col)
│ │ │ │ -
303 res[row][col]+=mat[i][row]*matt[i][col];
│ │ │ │ -
304 }
│ │ │ │ -
305 }
│ │ │ │ -
306
│ │ │ │ -
307 template<class T, class T1, class T2, int n, int m, int k>
│ │ │ │ -
308 void addMatMultMat(FieldMatrix<T,n,m>& res, const FieldMatrix<T1,n,k>& mat,
│ │ │ │ -
309 const FieldMatrix<T2,k,m>& matt)
│ │ │ │ -
310 {
│ │ │ │ -
311 typedef typename FieldMatrix<T,n,k>::size_type size_type;
│ │ │ │ -
312 for(size_type row=0; row<n; ++row)
│ │ │ │ -
313 for(size_type col=0; col<m; ++col) {
│ │ │ │ -
314 for(size_type i=0; i < k; ++i)
│ │ │ │ -
315 res[row][col]+=mat[row][i]*matt[i][col];
│ │ │ │ -
316 }
│ │ │ │ -
317 }
│ │ │ │ -
318
│ │ │ │ -
319
│ │ │ │ -
320 template<class T, class A, int n, int m>
│ │ │ │ -
321 class EntryAccumulatorFather
│ │ │ │ -
322 {
│ │ │ │ -
323 public:
│ │ │ │ -
324 enum {do_break=false};
│ │ │ │ - │ │ │ │ -
326 typedef typename Matrix::RowIterator Row;
│ │ │ │ -
327 typedef typename Matrix::ColIterator Col;
│ │ │ │ -
328
│ │ │ │ -
329 EntryAccumulatorFather(Matrix& mat_)
│ │ │ │ -
330 : mat(mat_), row(mat.begin())
│ │ │ │ -
331 {
│ │ │ │ -
332 mat=0;
│ │ │ │ -
333 col=row->begin();
│ │ │ │ -
334 }
│ │ │ │ -
335 void nextRow()
│ │ │ │ -
336 {
│ │ │ │ -
337 ++row;
│ │ │ │ -
338 if(row!=mat.end())
│ │ │ │ -
339 col=row->begin();
│ │ │ │ -
340 }
│ │ │ │ -
341
│ │ │ │ -
342 void nextCol()
│ │ │ │ -
343 {
│ │ │ │ -
344 ++this->col;
│ │ │ │ -
345 }
│ │ │ │ -
346 protected:
│ │ │ │ -
347 Matrix& mat;
│ │ │ │ -
348 private:
│ │ │ │ -
349 Row row;
│ │ │ │ -
350 protected:
│ │ │ │ - │ │ │ │ -
352 };
│ │ │ │ -
353
│ │ │ │ -
354 template<class T, class A, int n, int m, int transpose>
│ │ │ │ -
355 class EntryAccumulator
│ │ │ │ -
356 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ -
357 {
│ │ │ │ -
358 public:
│ │ │ │ - │ │ │ │ -
360 typedef typename Matrix::size_type size_type;
│ │ │ │ -
361
│ │ │ │ -
362 EntryAccumulator(Matrix& mat_)
│ │ │ │ -
363 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ -
364 {}
│ │ │ │ -
365
│ │ │ │ -
366 template<class T1, class T2>
│ │ │ │ -
367 void operator()(const T1& t1, const T2& t2, size_type i)
│ │ │ │ -
368 {
│ │ │ │ -
369 assert(this->col.index()==i);
│ │ │ │ -
370 addMatMultMat(*(this->col),t1,t2);
│ │ │ │ -
371 }
│ │ │ │ -
372 };
│ │ │ │ -
373
│ │ │ │ -
374 template<class T, class A, int n, int m>
│ │ │ │ -
375 class EntryAccumulator<T,A,n,m,0>
│ │ │ │ -
376 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ -
377 {
│ │ │ │ -
378 public:
│ │ │ │ - │ │ │ │ -
380 typedef typename Matrix::size_type size_type;
│ │ │ │ -
381
│ │ │ │ -
382 EntryAccumulator(Matrix& mat_)
│ │ │ │ -
383 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ -
384 {}
│ │ │ │ -
385
│ │ │ │ -
386 template<class T1, class T2>
│ │ │ │ -
387 void operator()(const T1& t1, const T2& t2, size_type i, size_type j)
│ │ │ │ -
388 {
│ │ │ │ -
389 addMatMultMat(this->mat[i][j], t1, t2);
│ │ │ │ -
390 }
│ │ │ │ -
391 };
│ │ │ │ -
392
│ │ │ │ -
393 template<class T, class A, int n, int m>
│ │ │ │ -
394 class EntryAccumulator<T,A,n,m,1>
│ │ │ │ -
395 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ -
396 {
│ │ │ │ -
397 public:
│ │ │ │ - │ │ │ │ -
399 typedef typename Matrix::size_type size_type;
│ │ │ │ -
400
│ │ │ │ -
401 EntryAccumulator(Matrix& mat_)
│ │ │ │ -
402 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ -
403 {}
│ │ │ │ -
404
│ │ │ │ -
405 template<class T1, class T2>
│ │ │ │ -
406 void operator()(const T1& t1, const T2& t2, size_type i, size_type j)
│ │ │ │ -
407 {
│ │ │ │ -
408 addTransposeMatMultMat(this->mat[i][j], t1, t2);
│ │ │ │ -
409 }
│ │ │ │ -
410 };
│ │ │ │ -
411
│ │ │ │ -
412 template<class T, class A, int n, int m>
│ │ │ │ -
413 class EntryAccumulator<T,A,n,m,2>
│ │ │ │ -
414 : public EntryAccumulatorFather<T,A,n,m>
│ │ │ │ -
415 {
│ │ │ │ -
416 public:
│ │ │ │ - │ │ │ │ -
418 typedef typename Matrix::size_type size_type;
│ │ │ │ -
419
│ │ │ │ -
420 EntryAccumulator(Matrix& mat_)
│ │ │ │ -
421 : EntryAccumulatorFather<T,A,n,m>(mat_)
│ │ │ │ -
422 {}
│ │ │ │ -
423
│ │ │ │ -
424 template<class T1, class T2>
│ │ │ │ -
425 void operator()(const T1& t1, const T2& t2, [[maybe_unused]] size_type i)
│ │ │ │ -
426 {
│ │ │ │ -
427 assert(this->col.index()==i);
│ │ │ │ -
428 addMatMultTransposeMat(*this->col,t1,t2);
│ │ │ │ -
429 }
│ │ │ │ -
430 };
│ │ │ │ -
431
│ │ │ │ -
432
│ │ │ │ -
433 template<int transpose>
│ │ │ │ -
434 struct SizeSelector
│ │ │ │ -
435 {};
│ │ │ │ -
436
│ │ │ │ -
437 template<>
│ │ │ │ -
438 struct SizeSelector<0>
│ │ │ │ -
439 {
│ │ │ │ -
440 template<class M1, class M2>
│ │ │ │ -
441 static std::tuple<typename M1::size_type, typename M2::size_type>
│ │ │ │ -
442 size(const M1& m1, const M2& m2)
│ │ │ │ -
443 {
│ │ │ │ -
444 return std::make_tuple(m1.N(), m2.M());
│ │ │ │ -
445 }
│ │ │ │ -
446 };
│ │ │ │ -
447
│ │ │ │ -
448 template<>
│ │ │ │ -
449 struct SizeSelector<1>
│ │ │ │ -
450 {
│ │ │ │ -
451 template<class M1, class M2>
│ │ │ │ -
452 static std::tuple<typename M1::size_type, typename M2::size_type>
│ │ │ │ -
453 size(const M1& m1, const M2& m2)
│ │ │ │ -
454 {
│ │ │ │ -
455 return std::make_tuple(m1.M(), m2.M());
│ │ │ │ -
456 }
│ │ │ │ -
457 };
│ │ │ │ -
458
│ │ │ │ -
459
│ │ │ │ -
460 template<>
│ │ │ │ -
461 struct SizeSelector<2>
│ │ │ │ -
462 {
│ │ │ │ -
463 template<class M1, class M2>
│ │ │ │ -
464 static std::tuple<typename M1::size_type, typename M2::size_type>
│ │ │ │ -
465 size(const M1& m1, const M2& m2)
│ │ │ │ -
466 {
│ │ │ │ -
467 return std::make_tuple(m1.N(), m2.N());
│ │ │ │ -
468 }
│ │ │ │ -
469 };
│ │ │ │ -
470
│ │ │ │ -
471 template<int transpose, class T, class A, class A1, class A2, int n1, int m1, int n2, int m2, int n3, int m3>
│ │ │ │ -
472 void matMultMat(BCRSMatrix<FieldMatrix<T,n1,m1>,A>& res, const BCRSMatrix<FieldMatrix<T,n2,m2>,A1>& mat1,
│ │ │ │ -
473 const BCRSMatrix<FieldMatrix<T,n3,m3>,A2>& mat2)
│ │ │ │ -
474 {
│ │ │ │ -
475 // First step is to count the number of nonzeros
│ │ │ │ -
476 typename BCRSMatrix<FieldMatrix<T,n1,m1>,A>::size_type rows, cols;
│ │ │ │ -
477 std::tie(rows,cols)=SizeSelector<transpose>::size(mat1, mat2);
│ │ │ │ -
478 MatrixInitializer<transpose,T,A,n1,m1> patternInit(res, rows);
│ │ │ │ -
479 Timer timer;
│ │ │ │ -
480 NonzeroPatternTraverser<transpose>::traverse(mat1,mat2,patternInit);
│ │ │ │ -
481 res.setSize(rows, cols, patternInit.nonzeros());
│ │ │ │ -
482 res.setBuildMode(BCRSMatrix<FieldMatrix<T,n1,m1>,A>::row_wise);
│ │ │ │ -
483
│ │ │ │ -
484 //std::cout<<"Counting nonzeros took "<<timer.elapsed()<<std::endl;
│ │ │ │ -
485 timer.reset();
│ │ │ │ -
486
│ │ │ │ -
487 // Second step is to allocate the storage for the result and initialize the nonzero pattern
│ │ │ │ -
488 patternInit.initPattern(mat1, mat2);
│ │ │ │ -
489
│ │ │ │ -
490 //std::cout<<"Setting up sparsity pattern took "<<timer.elapsed()<<std::endl;
│ │ │ │ -
491 timer.reset();
│ │ │ │ -
492 // As a last step calculate the entries
│ │ │ │ -
493 res = 0.0;
│ │ │ │ -
494 EntryAccumulator<T,A,n1,m1, transpose> entriesAccu(res);
│ │ │ │ -
495 NonzeroPatternTraverser<transpose>::traverse(mat1,mat2,entriesAccu);
│ │ │ │ -
496 //std::cout<<"Calculating entries took "<<timer.elapsed()<<std::endl;
│ │ │ │ -
497 }
│ │ │ │ -
498
│ │ │ │ -
499 }
│ │ │ │ -
500
│ │ │ │ -
508 template<typename M1, typename M2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
510 {};
│ │ │ │ -
│ │ │ │ -
511
│ │ │ │ -
512 template<typename T, int n, int k, int m>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
514 {
│ │ │ │ - │ │ │ │ -
516 };
│ │ │ │ -
│ │ │ │ -
517
│ │ │ │ -
518 template<typename T, typename A, typename A1, int n, int k, int m>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
520 {
│ │ │ │ - │ │ │ │ -
522 std::allocator<typename MatMultMatResult<FieldMatrix<T,n,k>,FieldMatrix<T,k,m> >::type> > type;
│ │ │ │ -
523 };
│ │ │ │ -
│ │ │ │ -
524
│ │ │ │ -
525
│ │ │ │ -
533 template<typename M1, typename M2>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
535 {};
│ │ │ │ -
│ │ │ │ -
536
│ │ │ │ -
537 template<typename T, int n, int k, int m>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
539 {
│ │ │ │ - │ │ │ │ -
541 };
│ │ │ │ -
│ │ │ │ -
542
│ │ │ │ -
543 template<typename T, typename A, typename A1, int n, int k, int m>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
545 {
│ │ │ │ - │ │ │ │ -
547 std::allocator<typename MatMultMatResult<FieldMatrix<T,n,k>,FieldMatrix<T,k,m> >::type> > type;
│ │ │ │ -
548 };
│ │ │ │ -
│ │ │ │ -
549
│ │ │ │ -
550
│ │ │ │ -
559 template<class T, class A, class A1, class A2, int n, int m, int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
561 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt, [[maybe_unused]] bool tryHard=false)
│ │ │ │ -
562 {
│ │ │ │ -
563 matMultMat<2>(res,mat, matt);
│ │ │ │ -
564 }
│ │ │ │ -
│ │ │ │ -
565
│ │ │ │ -
574 template<class T, class A, class A1, class A2, int n, int m, int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
576 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt, bool tryHard=false)
│ │ │ │ -
577 {
│ │ │ │ -
578 matMultMat<0>(res,mat, matt);
│ │ │ │ -
579 }
│ │ │ │ -
│ │ │ │ -
580
│ │ │ │ -
589 template<class T, class A, class A1, class A2, int n, int m, int k>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
591 const BCRSMatrix<FieldMatrix<T,k,m>,A2>& matt, [[maybe_unused]] bool tryHard=false)
│ │ │ │ -
592 {
│ │ │ │ -
593 matMultMat<1>(res,mat, matt);
│ │ │ │ -
594 }
│ │ │ │ -
│ │ │ │ -
595
│ │ │ │ -
596}
│ │ │ │ -
597#endif
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ -
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:379
│ │ │ │ -
FieldMatrix< T, n, m > type
Definition matrixmatrix.hh:515
│ │ │ │ -
void transposeMatMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, k, n >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
Calculate product of a transposed sparse matrix with another sparse matrices ( ).
Definition matrixmatrix.hh:590
│ │ │ │ -
void matMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< FieldMatrix< T, n, k >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
Calculate product of two sparse matrices ( ).
Definition matrixmatrix.hh:575
│ │ │ │ -
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:359
│ │ │ │ -
Matrix::RowIterator Row
Definition matrixmatrix.hh:326
│ │ │ │ -
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:417
│ │ │ │ -
Dune::BCRSMatrix< Dune::FieldMatrix< T, n, m >, TA > Matrix
Definition matrixmatrix.hh:228
│ │ │ │ -
Matrix::size_type size_type
Definition matrixmatrix.hh:360
│ │ │ │ -
Matrix::size_type size_type
Definition matrixmatrix.hh:380
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
Matrix::ColIterator Col
Definition matrixmatrix.hh:327
│ │ │ │ -
Matrix::size_type size_type
Definition matrixmatrix.hh:188
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
Matrix::size_type size_type
Definition matrixmatrix.hh:230
│ │ │ │ - │ │ │ │ -
void matMultTransposeMat(BCRSMatrix< FieldMatrix< T, n, k >, A > &res, const BCRSMatrix< FieldMatrix< T, n, m >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 > &matt, bool tryHard=false)
Calculate product of a sparse matrix with a transposed sparse matrices ( ).
Definition matrixmatrix.hh:560
│ │ │ │ -
BCRSMatrix< FieldMatrix< T, n, m >, A >::CreateIterator CreateIterator
Definition matrixmatrix.hh:156
│ │ │ │ -
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:398
│ │ │ │ -
Dune::BCRSMatrix< FieldMatrix< T, n, m >, TA > Matrix
Definition matrixmatrix.hh:186
│ │ │ │ -
BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type > > type
Definition matrixmatrix.hh:522
│ │ │ │ -
Matrix::CreateIterator CreateIterator
Definition matrixmatrix.hh:229
│ │ │ │ -
BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
Definition matrixmatrix.hh:325
│ │ │ │ -
Matrix::size_type size_type
Definition matrixmatrix.hh:399
│ │ │ │ -
Matrix::CreateIterator CreateIterator
Definition matrixmatrix.hh:187
│ │ │ │ -
BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type > > type
Definition matrixmatrix.hh:547
│ │ │ │ -
Matrix::size_type size_type
Definition matrixmatrix.hh:418
│ │ │ │ -
BCRSMatrix< FieldMatrix< T, n, m >, A >::size_type size_type
Definition matrixmatrix.hh:157
│ │ │ │ -
@ do_break
Definition matrixmatrix.hh:155
│ │ │ │ -
@ do_break
Definition matrixmatrix.hh:324
│ │ │ │ -
@ do_break
Definition matrixmatrix.hh:185
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ + │ │ │ │ +
Provides classes for building the matrix graph.
│ │ │ │ +
Provides classes for initializing the link attributes of a matrix graph.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:681
│ │ │ │ -
row_type::Iterator ColIterator
Iterator for the entries of each row.
Definition bcrsmatrix.hh:704
│ │ │ │ -
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ -
CreateIterator createbegin()
get initial create iterator
Definition bcrsmatrix.hh:1097
│ │ │ │ -
Iterator access to matrix rows
Definition bcrsmatrix.hh:579
│ │ │ │ -
Iterator class for sequential creation of blocks
Definition bcrsmatrix.hh:957
│ │ │ │ -
void insert(size_type j)
put column index in row
Definition bcrsmatrix.hh:1064
│ │ │ │ -
Helper TMP to get the result type of a sparse matrix matrix multiplication ( )
Definition matrixmatrix.hh:510
│ │ │ │ -
Helper TMP to get the result type of a sparse matrix matrix multiplication ( )
Definition matrixmatrix.hh:535
│ │ │ │ -
Definition matrixutils.hh:27
│ │ │ │ +
Class representing the properties of an ede in the matrix graph.
Definition dependency.hh:39
│ │ │ │ +
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ │ +
A subgraph of a graph.
Definition graph.hh:443
│ │ │ │ +
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
│ │ │ │ +
An index map for mapping the edges to indices.
Definition graph.hh:470
│ │ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ │ +
Definition graphcreator.hh:22
│ │ │ │ +
Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph
Definition graphcreator.hh:26
│ │ │ │ +
Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph
Definition graphcreator.hh:32
│ │ │ │ +
M::matrix_type Matrix
Definition graphcreator.hh:23
│ │ │ │ +
static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of)
Definition graphcreator.hh:37
│ │ │ │ +
static void free(GraphTuple &graphs)
Definition graphcreator.hh:53
│ │ │ │ +
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:24
│ │ │ │ +
std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple
Definition graphcreator.hh:34
│ │ │ │ +
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:65
│ │ │ │ +
M::matrix_type Matrix
Definition graphcreator.hh:63
│ │ │ │ +
Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, IdentityMap, IdentityMap > PropertiesGraph
Definition graphcreator.hh:71
│ │ │ │ +
std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple
Definition graphcreator.hh:73
│ │ │ │ +
static GraphTuple create(const M &matrix, T &excluded, const SequentialInformation &pinfo, const OF &)
Definition graphcreator.hh:76
│ │ │ │ +
static void free(GraphTuple &graphs)
Definition graphcreator.hh:86
│ │ │ │ +
Definition pinfo.hh:28
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,742 +1,188 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -matrixmatrix.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 (C) 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_MATRIXMATRIX_HH │ │ │ │ │ -6#define DUNE_ISTL_MATRIXMATRIX_HH │ │ │ │ │ +5#ifndef DUNE_AMG_GRAPHCREATOR_HH │ │ │ │ │ +6#define DUNE_AMG_GRAPHCREATOR_HH │ │ │ │ │ 7 │ │ │ │ │ 8#include │ │ │ │ │ 9 │ │ │ │ │ -10#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13namespace _D_u_n_e │ │ │ │ │ -14{ │ │ │ │ │ +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 │ │ │ │ │ -26 namespace │ │ │ │ │ -27 { │ │ │ │ │ -28 │ │ │ │ │ -37 template │ │ │ │ │ -38 struct NonzeroPatternTraverser │ │ │ │ │ -39 {}; │ │ │ │ │ -40 │ │ │ │ │ -41 │ │ │ │ │ -42 template<> │ │ │ │ │ -43 struct NonzeroPatternTraverser<0> │ │ │ │ │ -44 { │ │ │ │ │ -45 template │ │ │ │ │ -46 static void traverse(const _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_<_T_,_n_,_k_>,A1>& A, │ │ │ │ │ -47 const _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_<_T_,_k_,_m_>,A2>& B, │ │ │ │ │ -48 F& func) │ │ │ │ │ -49 { │ │ │ │ │ -50 if(A.M()!=B.N()) │ │ │ │ │ -51 DUNE_THROW(ISTLError, "The sizes of the matrices do not match: "< entriesAccu(res); │ │ │ │ │ -495 NonzeroPatternTraverser::traverse(mat1,mat2,entriesAccu); │ │ │ │ │ -496 //std::cout<<"Calculating entries took "< │ │ │ │ │ -_5_0_9 struct _M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ -510 {}; │ │ │ │ │ -511 │ │ │ │ │ -512 template │ │ │ │ │ -_5_1_3 struct _M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_F_i_e_l_d_M_a_t_r_i_x,_F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ │ -514 { │ │ │ │ │ -_5_1_5 typedef _F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_> _t_y_p_e; │ │ │ │ │ -516 }; │ │ │ │ │ -517 │ │ │ │ │ -518 template │ │ │ │ │ -_5_1_9 struct _M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A │ │ │ │ │ ->,_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A1 > > │ │ │ │ │ -520 { │ │ │ │ │ -521 typedef _B_C_R_S_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e │ │ │ │ │ -_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type, │ │ │ │ │ -_5_2_2 std::allocator,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type> > _t_y_p_e; │ │ │ │ │ -523 }; │ │ │ │ │ -524 │ │ │ │ │ -525 │ │ │ │ │ -533 template │ │ │ │ │ -_5_3_4 struct _T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ -535 {}; │ │ │ │ │ -536 │ │ │ │ │ -537 template │ │ │ │ │ -_5_3_8 struct _T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_F_i_e_l_d_M_a_t_r_i_x,_F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ │ -539 { │ │ │ │ │ -_5_4_0 typedef _F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_> _t_y_p_e; │ │ │ │ │ -541 }; │ │ │ │ │ -542 │ │ │ │ │ -543 template │ │ │ │ │ -_5_4_4 struct _T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A │ │ │ │ │ ->,_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A1 > > │ │ │ │ │ -545 { │ │ │ │ │ -546 typedef _B_C_R_S_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e │ │ │ │ │ -_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type, │ │ │ │ │ -_5_4_7 std::allocator,_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_> >::type> > _t_y_p_e; │ │ │ │ │ -548 }; │ │ │ │ │ -549 │ │ │ │ │ -550 │ │ │ │ │ -559 template │ │ │ │ │ -_5_6_0 void _m_a_t_M_u_l_t_T_r_a_n_s_p_o_s_e_M_a_t(_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,A>& res, const │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_>,A1>& _m_a_t, │ │ │ │ │ -561 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_>,A2>& matt, [[maybe_unused]] bool │ │ │ │ │ -tryHard=false) │ │ │ │ │ -562 { │ │ │ │ │ -563 matMultMat<2>(res,_m_a_t, matt); │ │ │ │ │ -564 } │ │ │ │ │ -565 │ │ │ │ │ -574 template │ │ │ │ │ -_5_7_5 void _m_a_t_M_u_l_t_M_a_t(_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>& res, const │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_k_>,A1>& _m_a_t, │ │ │ │ │ -576 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_>,A2>& matt, bool tryHard=false) │ │ │ │ │ -577 { │ │ │ │ │ -578 matMultMat<0>(res,_m_a_t, matt); │ │ │ │ │ -579 } │ │ │ │ │ -580 │ │ │ │ │ -589 template │ │ │ │ │ -_5_9_0 void _t_r_a_n_s_p_o_s_e_M_a_t_M_u_l_t_M_a_t(_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>& res, const │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_n_>,A1>& _m_a_t, │ │ │ │ │ -591 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_k_,_m_>,A2>& matt, [[maybe_unused]] bool │ │ │ │ │ -tryHard=false) │ │ │ │ │ -592 { │ │ │ │ │ -593 matMultMat<1>(res,_m_a_t, matt); │ │ │ │ │ -594 } │ │ │ │ │ -595 │ │ │ │ │ -596} │ │ │ │ │ -597#endif │ │ │ │ │ +_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 │ │ │ │ │ +_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. │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _0_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:379 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -FieldMatrix< T, n, m > type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:515 │ │ │ │ │ -_D_u_n_e_:_:_t_r_a_n_s_p_o_s_e_M_a_t_M_u_l_t_M_a_t │ │ │ │ │ -void transposeMatMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, k, n >, A1 > &mat, const BCRSMatrix< FieldMatrix< │ │ │ │ │ -T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ -Calculate product of a transposed sparse matrix with another sparse matrices │ │ │ │ │ -( ). │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:590 │ │ │ │ │ -_D_u_n_e_:_:_m_a_t_M_u_l_t_M_a_t │ │ │ │ │ -void matMultMat(BCRSMatrix< FieldMatrix< T, n, m >, A > &res, const BCRSMatrix< │ │ │ │ │ -FieldMatrix< T, n, k >, A1 > &mat, const BCRSMatrix< FieldMatrix< T, k, m >, A2 │ │ │ │ │ -> &matt, bool tryHard=false) │ │ │ │ │ -Calculate product of two sparse matrices ( ). │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:575 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_:_:_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:359 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_R_o_w │ │ │ │ │ -Matrix::RowIterator Row │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:326 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _2_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:417 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _1_,_ _T_,_ _T_A_,_ _n_,_ _m_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ -Dune::BCRSMatrix< Dune::FieldMatrix< T, n, m >, TA > Matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:228 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:360 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _0_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:380 │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_C_o_l │ │ │ │ │ -Matrix::ColIterator Col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:327 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:188 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _1_,_ _T_,_ _T_A_,_ _n_,_ _m_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:230 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_,_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m │ │ │ │ │ -_>_ _>_:_:_t_y_p_e │ │ │ │ │ -FieldMatrix< T, n, m > type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:540 │ │ │ │ │ -_D_u_n_e_:_:_m_a_t_M_u_l_t_T_r_a_n_s_p_o_s_e_M_a_t │ │ │ │ │ -void matMultTransposeMat(BCRSMatrix< FieldMatrix< T, n, k >, A > &res, const │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A1 > &mat, const BCRSMatrix< FieldMatrix< │ │ │ │ │ -T, k, m >, A2 > &matt, bool tryHard=false) │ │ │ │ │ -Calculate product of a sparse matrix with a transposed sparse matrices ( ). │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:560 │ │ │ │ │ -_D_u_n_e_:_:_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_I_n_i_t_i_a_l_i_z_e_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A >::CreateIterator CreateIterator │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:156 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _1_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:398 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ -Dune::BCRSMatrix< FieldMatrix< T, n, m >, TA > Matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:186 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _k_ _>_,_ _A_ _>_,_ _B_C_R_S_M_a_t_r_i_x_< │ │ │ │ │ -_F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, │ │ │ │ │ -k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k │ │ │ │ │ ->, FieldMatrix< T, k, m > >::type > > type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:522 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _1_,_ _T_,_ _T_A_,_ _n_,_ _m_ _>_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -Matrix::CreateIterator CreateIterator │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:229 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:325 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _1_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:399 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -Matrix::CreateIterator CreateIterator │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:187 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _n_ _>_,_ _A_ _>_, │ │ │ │ │ -_B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _k_,_ _m_ _>_,_ _A_1_ _>_ _>_:_:_t_y_p_e │ │ │ │ │ -BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, │ │ │ │ │ -k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k │ │ │ │ │ ->, FieldMatrix< T, k, m > >::type > > type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:547 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_<_ _T_,_ _A_,_ _n_,_ _m_,_ _2_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:418 │ │ │ │ │ -_D_u_n_e_:_:_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_I_n_i_t_i_a_l_i_z_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -BCRSMatrix< FieldMatrix< T, n, m >, A >::size_type size_type │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:157 │ │ │ │ │ -_D_u_n_e_:_:_S_p_a_r_s_i_t_y_P_a_t_t_e_r_n_I_n_i_t_i_a_l_i_z_e_r_:_:_d_o___b_r_e_a_k │ │ │ │ │ -@ do_break │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_E_n_t_r_y_A_c_c_u_m_u_l_a_t_o_r_F_a_t_h_e_r_:_:_d_o___b_r_e_a_k │ │ │ │ │ -@ do_break │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:324 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_:_:_d_o___b_r_e_a_k │ │ │ │ │ -@ do_break │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:185 │ │ │ │ │ +_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. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -Iterator end() │ │ │ │ │ -Get iterator to one beyond last row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:681 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -row_type::Iterator ColIterator │ │ │ │ │ -Iterator for the entries of each row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:704 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -The type for the index access and the size. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ -_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_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator access to matrix rows │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:579 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator class for sequential creation of blocks │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:957 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_n_s_e_r_t │ │ │ │ │ -void insert(size_type j) │ │ │ │ │ -put column index in row │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1064 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ -Helper TMP to get the result type of a sparse matrix matrix multiplication ( ) │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:510 │ │ │ │ │ -_D_u_n_e_:_:_T_r_a_n_s_p_o_s_e_d_M_a_t_M_u_l_t_M_a_t_R_e_s_u_l_t │ │ │ │ │ -Helper TMP to get the result type of a sparse matrix matrix multiplication ( ) │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:535 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ +_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 ede in the matrix graph. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +Class representing a node in the matrix graph. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +The (undirected) graph of a matrix. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h │ │ │ │ │ +A subgraph of a graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:443 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ │ +EdgeIndexMap getEdgeIndexMap() │ │ │ │ │ +Get an edge index map for the graph. │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ │ +An index map for mapping the edges to indices. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:470 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:22 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_S_u_b_G_r_a_p_h │ │ │ │ │ +Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, │ │ │ │ │ +IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_M_a_t_r_i_x │ │ │ │ │ +M::matrix_type Matrix │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_c_r_e_a_t_e │ │ │ │ │ +static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of) │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_f_r_e_e │ │ │ │ │ +static void free(GraphTuple &graphs) │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +Dune::Amg::MatrixGraph< const Matrix > MatrixGraph │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_G_r_a_p_h_T_u_p_l_e │ │ │ │ │ +std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ │ +Dune::Amg::MatrixGraph< const Matrix > MatrixGraph │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +M::matrix_type Matrix │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, │ │ │ │ │ +IdentityMap, IdentityMap > PropertiesGraph │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_G_r_a_p_h_T_u_p_l_e │ │ │ │ │ +std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_c_r_e_a_t_e │ │ │ │ │ +static GraphTuple create(const M &matrix, T &excluded, const │ │ │ │ │ +SequentialInformation &pinfo, const OF &) │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_f_r_e_e │ │ │ │ │ +static void free(GraphTuple &graphs) │ │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00176.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: multitypeblockvector.hh File Reference │ │ │ │ +dune-istl: properties.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,64 +65,50 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
multitypeblockvector.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ -
#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"
│ │ │ │ + │ │ │ │ +

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

│ │ │ │ +
#include <dune/common/propertymap.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::FieldTraits< MultiTypeBlockVector< Args... > >
 
class  Dune::MultiTypeBlockVector< Args >
 A Vector class to support different block types. More...
struct  Dune::Amg::VertexVisitedTag
 Tag idnetifying the visited property of a vertex. More...
 
struct  std::tuple_element< i, Dune::MultiTypeBlockVector< Args... > >
 Make std::tuple_element work for MultiTypeBlockVector. 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
 
namespace  std
 STL namespace.
namespace  Dune::Amg
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

template<typename... Args>
std::ostream & Dune::operator<< (std::ostream &s, const MultiTypeBlockVector< Args... > &v)
 Send MultiTypeBlockVector to an outstream.
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

Provides classes for handling internal properties in a graph.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,42 +1,33 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -multitypeblockvector.hh File Reference │ │ │ │ │ -#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 "_g_s_e_t_c_._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 │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_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_:_:_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_._._. │ │ │ │ │ + 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 │ │ │ │ │   │ │ │ │ │ -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. │ │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │   │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Provides classes for handling internal properties in a graph. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00176_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: multitypeblockvector.hh Source File │ │ │ │ +dune-istl: properties.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,358 +70,99 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
multitypeblockvector.hh
│ │ │ │ +
properties.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_MULTITYPEBLOCKVECTOR_HH
│ │ │ │ -
6#define DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_AMG_PROPERTIES_HH
│ │ │ │ +
6#define DUNE_ISTL_AMG_PROPERTIES_HH
│ │ │ │
7
│ │ │ │ -
8#include <cmath>
│ │ │ │ -
9#include <iostream>
│ │ │ │ -
10#include <tuple>
│ │ │ │ -
11
│ │ │ │ -
12#include <dune/common/dotproduct.hh>
│ │ │ │ -
13#include <dune/common/ftraits.hh>
│ │ │ │ -
14#include <dune/common/hybridutilities.hh>
│ │ │ │ -
15#include <dune/common/typetraits.hh>
│ │ │ │ -
16#include <dune/common/std/type_traits.hh>
│ │ │ │ -
17
│ │ │ │ -
18#include "istlexception.hh"
│ │ │ │ -
19
│ │ │ │ -
20// forward declaration
│ │ │ │ -
21namespace Dune {
│ │ │ │ -
22 template < typename... Args >
│ │ │ │ -
23 class MultiTypeBlockVector;
│ │ │ │ -
24}
│ │ │ │ -
25
│ │ │ │ -
26#include "gsetc.hh"
│ │ │ │ -
27
│ │ │ │ -
28namespace Dune {
│ │ │ │ -
29
│ │ │ │ -
41 template <typename... Args>
│ │ │ │ -
│ │ │ │ -
42 struct FieldTraits< MultiTypeBlockVector<Args...> >
│ │ │ │ -
43 {
│ │ │ │ -
44 using field_type = typename MultiTypeBlockVector<Args...>::field_type;
│ │ │ │ -
45 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
46 };
│ │ │ │ -
│ │ │ │ -
56 template < typename... Args >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
58 : public std::tuple<Args...>
│ │ │ │ -
59 {
│ │ │ │ -
61 typedef std::tuple<Args...> TupleType;
│ │ │ │ -
62 public:
│ │ │ │ +
8#include <dune/common/propertymap.hh>
│ │ │ │ +
9
│ │ │ │ +
10namespace Dune
│ │ │ │ +
11{
│ │ │ │ +
12
│ │ │ │ +
13 namespace Amg
│ │ │ │ +
14 {
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
29 {};
│ │ │ │ +
│ │ │ │ +
30
│ │ │ │ +
31
│ │ │ │ +
38 template<typename C, typename K, std::size_t i,typename T=typename C::ValueType,
│ │ │ │ +
39 typename R = typename C::Reference>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
41 : public RAPropertyMapHelper<R,
│ │ │ │ +
42 RandomAccessBundledPropertyMap<C,K,i,T,R> >
│ │ │ │ +
43 {
│ │ │ │ +
44 public:
│ │ │ │ +
46 typedef C Container;
│ │ │ │ +
47
│ │ │ │ +
49 typedef R Reference;
│ │ │ │ +
50
│ │ │ │ +
52 typedef K Key;
│ │ │ │ +
53
│ │ │ │ +
57 typedef LvaluePropertyMapTag Category;
│ │ │ │ +
58
│ │ │ │ +
59 enum {
│ │ │ │ +
61 index = i
│ │ │ │ +
62 };
│ │ │ │
63
│ │ │ │ -
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
│ │ │ │ -
84 // make sure that we have an std::common_type: using an assertion produces a more readable error message
│ │ │ │ -
85 // than a compiler template instantiation error
│ │ │ │ -
86 static_assert ( sizeof...(Args) == 0 or not std::is_same_v<field_type, Std::nonesuch>,
│ │ │ │ -
87 "No std::common_type implemented for the given field_types of the Args. Please provide an implementation and check that a FieldTraits class is present for your type.");
│ │ │ │ -
88
│ │ │ │ -
89
│ │ │ │ -
│ │ │ │ -
95 static constexpr size_type size()
│ │ │ │ -
96 {
│ │ │ │ -
97 return sizeof...(Args);
│ │ │ │ -
98 }
│ │ │ │ -
│ │ │ │ -
99
│ │ │ │ -
│ │ │ │ -
102 static constexpr size_type N()
│ │ │ │ -
103 {
│ │ │ │ -
104 return sizeof...(Args);
│ │ │ │ -
105 }
│ │ │ │ -
│ │ │ │ -
106
│ │ │ │ -
113 [[deprecated("Use method 'N' instead")]]
│ │ │ │ -
│ │ │ │ -
114 int count() const
│ │ │ │ -
115 {
│ │ │ │ -
116 return sizeof...(Args);
│ │ │ │ -
117 }
│ │ │ │ -
│ │ │ │ -
118
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
121 {
│ │ │ │ -
122 size_type result = 0;
│ │ │ │ -
123 Hybrid::forEach(std::make_index_sequence<N()>{},
│ │ │ │ -
124 [&](auto i){result += std::get<i>(*this).dim();});
│ │ │ │ -
125
│ │ │ │ -
126 return result;
│ │ │ │ -
127 }
│ │ │ │ -
│ │ │ │ -
128
│ │ │ │ -
147 template< size_type index >
│ │ │ │ -
148 typename std::tuple_element<index,TupleType>::type&
│ │ │ │ -
│ │ │ │ -
149 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable)
│ │ │ │ -
150 {
│ │ │ │ -
151 return std::get<index>(*this);
│ │ │ │ -
152 }
│ │ │ │ -
│ │ │ │ -
153
│ │ │ │ -
159 template< size_type index >
│ │ │ │ -
160 const typename std::tuple_element<index,TupleType>::type&
│ │ │ │ -
│ │ │ │ -
161 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable) const
│ │ │ │ -
162 {
│ │ │ │ -
163 return std::get<index>(*this);
│ │ │ │ -
164 }
│ │ │ │ -
│ │ │ │ -
165
│ │ │ │ -
168 template<typename T>
│ │ │ │ -
│ │ │ │ -
169 void operator= (const T& newval) {
│ │ │ │ -
170 Dune::Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ │ -
171 entry = newval;
│ │ │ │ -
172 });
│ │ │ │ -
173 }
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
│ │ │ │ -
178 void operator+= (const type& newv) {
│ │ │ │ -
179 using namespace Dune::Hybrid;
│ │ │ │ -
180 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ │ -
181 (*this)[i] += newv[i];
│ │ │ │ -
182 });
│ │ │ │ -
183 }
│ │ │ │ -
│ │ │ │ -
184
│ │ │ │ -
│ │ │ │ -
188 void operator-= (const type& newv) {
│ │ │ │ -
189 using namespace Dune::Hybrid;
│ │ │ │ -
190 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ │ -
191 (*this)[i] -= newv[i];
│ │ │ │ -
192 });
│ │ │ │ -
193 }
│ │ │ │ -
│ │ │ │ -
194
│ │ │ │ -
196 template<class T,
│ │ │ │ -
197 std::enable_if_t< IsNumber<T>::value, int> = 0>
│ │ │ │ -
│ │ │ │ -
198 void operator*= (const T& w) {
│ │ │ │ -
199 Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ │ -
200 entry *= w;
│ │ │ │ -
201 });
│ │ │ │ -
202 }
│ │ │ │ -
│ │ │ │ -
203
│ │ │ │ -
205 template<class T,
│ │ │ │ -
206 std::enable_if_t< IsNumber<T>::value, int> = 0>
│ │ │ │ -
│ │ │ │ -
207 void operator/= (const T& w) {
│ │ │ │ -
208 Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ │ -
209 entry /= w;
│ │ │ │ -
210 });
│ │ │ │ -
211 }
│ │ │ │ -
│ │ │ │ -
212
│ │ │ │ -
│ │ │ │ -
213 field_type operator* (const type& newv) const {
│ │ │ │ -
214 using namespace Dune::Hybrid;
│ │ │ │ -
215 return accumulate(integralRange(Hybrid::size(*this)), field_type(0), [&](auto&& a, auto&& i) {
│ │ │ │ -
216 return a + (*this)[i]*newv[i];
│ │ │ │ -
217 });
│ │ │ │ -
218 }
│ │ │ │ -
│ │ │ │ -
219
│ │ │ │ -
│ │ │ │ -
220 field_type dot (const type& newv) const {
│ │ │ │ -
221 using namespace Dune::Hybrid;
│ │ │ │ -
222 return accumulate(integralRange(Hybrid::size(*this)), field_type(0), [&](auto&& a, auto&& i) {
│ │ │ │ -
223 return a + (*this)[i].dot(newv[i]);
│ │ │ │ -
224 });
│ │ │ │ -
225 }
│ │ │ │ -
│ │ │ │ -
226
│ │ │ │ -
│ │ │ │ -
229 auto one_norm() const {
│ │ │ │ -
230 using namespace Dune::Hybrid;
│ │ │ │ -
231 return accumulate(*this, typename FieldTraits<field_type>::real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ │ -
232 return a + entry.one_norm();
│ │ │ │ -
233 });
│ │ │ │ -
234 }
│ │ │ │ -
│ │ │ │ -
235
│ │ │ │ -
│ │ │ │ -
238 auto one_norm_real() const {
│ │ │ │ -
239 using namespace Dune::Hybrid;
│ │ │ │ -
240 return accumulate(*this, typename FieldTraits<field_type>::real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ │ -
241 return a + entry.one_norm_real();
│ │ │ │ -
242 });
│ │ │ │ -
243 }
│ │ │ │ -
│ │ │ │ -
244
│ │ │ │ -
│ │ │ │ -
247 typename FieldTraits<field_type>::real_type two_norm2() const {
│ │ │ │ -
248 using namespace Dune::Hybrid;
│ │ │ │ -
249 return accumulate(*this, typename FieldTraits<field_type>::real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ │ -
250 return a + entry.two_norm2();
│ │ │ │ -
251 });
│ │ │ │ -
252 }
│ │ │ │ -
│ │ │ │ -
253
│ │ │ │ -
256 typename FieldTraits<field_type>::real_type two_norm() const {return sqrt(this->two_norm2());}
│ │ │ │ -
257
│ │ │ │ -
│ │ │ │ -
260 typename FieldTraits<field_type>::real_type infinity_norm() const
│ │ │ │ -
261 {
│ │ │ │ -
262 using namespace Dune::Hybrid;
│ │ │ │ -
263 using std::max;
│ │ │ │ -
264 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
265
│ │ │ │ -
266 real_type result = 0.0;
│ │ │ │ -
267 // Compute max norm tracking appearing nan values
│ │ │ │ -
268 // if the field type supports nan.
│ │ │ │ -
269 if constexpr (HasNaN<field_type>()) {
│ │ │ │ -
270 // This variable will preserve any nan value
│ │ │ │ -
271 real_type nanTracker = 1.0;
│ │ │ │ -
272 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
273 forEach(*this, [&](auto&& entry) {
│ │ │ │ -
274 real_type entryNorm = entry.infinity_norm();
│ │ │ │ -
275 result = max(entryNorm, result);
│ │ │ │ -
276 nanTracker += entryNorm;
│ │ │ │ -
277 });
│ │ │ │ -
278 // Incorporate possible nan value into result
│ │ │ │ -
279 result *= (nanTracker / nanTracker);
│ │ │ │ -
280 } else {
│ │ │ │ -
281 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
282 forEach(*this, [&](auto&& entry) {
│ │ │ │ -
283 result = max(entry.infinity_norm(), result);
│ │ │ │ -
284 });
│ │ │ │ -
285 }
│ │ │ │ -
286 return result;
│ │ │ │ -
287 }
│ │ │ │ -
│ │ │ │ -
288
│ │ │ │ -
│ │ │ │ -
291 typename FieldTraits<field_type>::real_type infinity_norm_real() const
│ │ │ │ -
292 {
│ │ │ │ -
293 using namespace Dune::Hybrid;
│ │ │ │ -
294 using std::max;
│ │ │ │ -
295 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
296
│ │ │ │ -
297 real_type result = 0.0;
│ │ │ │ -
298 // Compute max norm tracking appearing nan values
│ │ │ │ -
299 // if the field type supports nan.
│ │ │ │ -
300 if constexpr (HasNaN<field_type>()) {
│ │ │ │ -
301 // This variable will preserve any nan value
│ │ │ │ -
302 real_type nanTracker = 1.0;
│ │ │ │ -
303 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
304 forEach(*this, [&](auto&& entry) {
│ │ │ │ -
305 real_type entryNorm = entry.infinity_norm_real();
│ │ │ │ -
306 result = max(entryNorm, result);
│ │ │ │ -
307 nanTracker += entryNorm;
│ │ │ │ -
308 });
│ │ │ │ -
309 // Incorporate possible nan value into result
│ │ │ │ -
310 result *= (nanTracker / nanTracker);
│ │ │ │ -
311 } else {
│ │ │ │ -
312 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ │ -
313 forEach(*this, [&](auto&& entry) {
│ │ │ │ -
314 result = max(entry.infinity_norm_real(), result);
│ │ │ │ -
315 });
│ │ │ │ -
316 }
│ │ │ │ -
317 return result;
│ │ │ │ -
318 }
│ │ │ │ -
│ │ │ │ -
319
│ │ │ │ -
324 template<typename Ta>
│ │ │ │ -
│ │ │ │ -
325 void axpy (const Ta& a, const type& y) {
│ │ │ │ -
326 using namespace Dune::Hybrid;
│ │ │ │ -
327 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ │ -
328 (*this)[i].axpy(a, y[i]);
│ │ │ │ -
329 });
│ │ │ │ -
330 }
│ │ │ │ -
│ │ │ │ -
331
│ │ │ │ -
332 };
│ │ │ │ -
│ │ │ │ -
333
│ │ │ │ -
334
│ │ │ │ -
335
│ │ │ │ -
338 template <typename... Args>
│ │ │ │ -
│ │ │ │ -
339 std::ostream& operator<< (std::ostream& s, const MultiTypeBlockVector<Args...>& v) {
│ │ │ │ -
340 using namespace Dune::Hybrid;
│ │ │ │ -
341 forEach(integralRange(Dune::Hybrid::size(v)), [&](auto&& i) {
│ │ │ │ -
342 s << "\t(" << i << "):\n" << v[i] << "\n";
│ │ │ │ -
343 });
│ │ │ │ -
344 return s;
│ │ │ │ -
345 }
│ │ │ │ -
│ │ │ │ -
346
│ │ │ │ -
347} // end namespace Dune
│ │ │ │ -
348
│ │ │ │ -
349namespace std
│ │ │ │ -
350{
│ │ │ │ -
355 template <size_t i, typename... Args>
│ │ │ │ -
│ │ │ │ -
356 struct tuple_element<i,Dune::MultiTypeBlockVector<Args...> >
│ │ │ │ -
357 {
│ │ │ │ -
358 using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
│ │ │ │ -
359 };
│ │ │ │ -
│ │ │ │ -
360}
│ │ │ │ -
361
│ │ │ │ -
362#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:169
│ │ │ │ -
std::size_t size_type
Type used for vector sizes.
Definition multitypeblockvector.hh:65
│ │ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition multitypeblockvector.hh:45
│ │ │ │ -
int count() const
Definition multitypeblockvector.hh:114
│ │ │ │ -
static constexpr size_type N()
Number of elements.
Definition multitypeblockvector.hh:102
│ │ │ │ -
Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > >::field_type... > field_type
The type used for scalars.
Definition multitypeblockvector.hh:82
│ │ │ │ -
static constexpr size_type size()
Return the number of non-zero vector entries.
Definition multitypeblockvector.hh:95
│ │ │ │ -
std::tuple_element< index, TupleType >::type & operator[](const std::integral_constant< size_type, index > indexVariable)
Random-access operator.
Definition multitypeblockvector.hh:149
│ │ │ │ -
FieldTraits< field_type >::real_type two_norm() const
Compute the Euclidean norm.
Definition multitypeblockvector.hh:256
│ │ │ │ -
typename MultiTypeBlockVector< Args... >::field_type field_type
Definition multitypeblockvector.hh:44
│ │ │ │ -
size_type dim() const
Number of scalar elements.
Definition multitypeblockvector.hh:120
│ │ │ │ -
field_type dot(const type &newv) const
Definition multitypeblockvector.hh:220
│ │ │ │ -
void operator*=(const T &w)
Multiplication with a scalar.
Definition multitypeblockvector.hh:198
│ │ │ │ -
void axpy(const Ta &a, const type &y)
Axpy operation on this vector (*this += a * y)
Definition multitypeblockvector.hh:325
│ │ │ │ -
void operator/=(const T &w)
Division by a scalar.
Definition multitypeblockvector.hh:207
│ │ │ │ -
MultiTypeBlockVector< Args... > type
Definition multitypeblockvector.hh:75
│ │ │ │ -
FieldTraits< field_type >::real_type infinity_norm_real() const
Compute the simplified maximum norm (uses 1-norm for complex values)
Definition multitypeblockvector.hh:291
│ │ │ │ -
auto one_norm() const
Compute the 1-norm.
Definition multitypeblockvector.hh:229
│ │ │ │ -
void operator-=(const type &newv)
Definition multitypeblockvector.hh:188
│ │ │ │ -
field_type operator*(const type &newv) const
Definition multitypeblockvector.hh:213
│ │ │ │ -
void operator+=(const type &newv)
Definition multitypeblockvector.hh:178
│ │ │ │ -
typename std::tuple_element< i, std::tuple< Args... > >::type type
Definition multitypeblockvector.hh:358
│ │ │ │ -
FieldTraits< field_type >::real_type infinity_norm() const
Compute the maximum norm.
Definition multitypeblockvector.hh:260
│ │ │ │ -
auto one_norm_real() const
Compute the simplified 1-norm (uses 1-norm also for complex values)
Definition multitypeblockvector.hh:238
│ │ │ │ -
FieldTraits< field_type >::real_type two_norm2() const
Compute the squared Euclidean norm.
Definition multitypeblockvector.hh:247
│ │ │ │ -
STL namespace.
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ -
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:590
│ │ │ │ -
A Vector class to support different block types.
Definition multitypeblockvector.hh:59
│ │ │ │ +
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ │ +
A property map that extracts one property out of a bundle using operator[]()
Definition properties.hh:43
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,393 +1,110 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -multitypeblockvector.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 (C) 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_MULTITYPEBLOCKVECTOR_HH │ │ │ │ │ -6#define DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_AMG_PROPERTIES_HH │ │ │ │ │ +6#define DUNE_ISTL_AMG_PROPERTIES_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17 │ │ │ │ │ -18#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -19 │ │ │ │ │ -20// forward declaration │ │ │ │ │ -21namespace _D_u_n_e { │ │ │ │ │ -22 template < typename... Args > │ │ │ │ │ -23 class MultiTypeBlockVector; │ │ │ │ │ -24} │ │ │ │ │ -25 │ │ │ │ │ -26#include "_g_s_e_t_c_._h_h" │ │ │ │ │ -27 │ │ │ │ │ -28namespace _D_u_n_e { │ │ │ │ │ -29 │ │ │ │ │ -41 template │ │ │ │ │ -_4_2 struct FieldTraits< _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e │ │ │ │ │ +11{ │ │ │ │ │ +12 │ │ │ │ │ +13 namespace Amg │ │ │ │ │ +14 { │ │ │ │ │ +_2_8 struct _V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ +29 {}; │ │ │ │ │ +30 │ │ │ │ │ +31 │ │ │ │ │ +38 template │ │ │ │ │ +_4_0 class _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ +41 : public RAPropertyMapHelper > │ │ │ │ │ 43 { │ │ │ │ │ -_4_4 using _f_i_e_l_d___t_y_p_e = typename _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r::field_type; │ │ │ │ │ -_4_5 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ -46 }; │ │ │ │ │ -56 template < typename... Args > │ │ │ │ │ -_5_7 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ │ -58 : public std::tuple │ │ │ │ │ -59 { │ │ │ │ │ -61 typedef std::tuple TupleType; │ │ │ │ │ -62 public: │ │ │ │ │ +44 public: │ │ │ │ │ +_4_6 typedef C _C_o_n_t_a_i_n_e_r; │ │ │ │ │ +47 │ │ │ │ │ +_4_9 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ │ +50 │ │ │ │ │ +_5_2 typedef K _K_e_y; │ │ │ │ │ +53 │ │ │ │ │ +_5_7 typedef LvaluePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ │ +58 │ │ │ │ │ +59 enum { │ │ │ │ │ +61 _i_n_d_e_x = i │ │ │ │ │ +_6_2 }; │ │ │ │ │ 63 │ │ │ │ │ -_6_5 using _s_i_z_e___t_y_p_e = std::size_t; │ │ │ │ │ -66 │ │ │ │ │ -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 │ │ │ │ │ -84 // make sure that we have an std::common_type: using an assertion produces a │ │ │ │ │ -more readable error message │ │ │ │ │ -85 // than a compiler template instantiation error │ │ │ │ │ -86 static_assert ( sizeof...(Args) == 0 or not std::is_same_v, │ │ │ │ │ -87 "No std::common_type implemented for the given field_types of the Args. │ │ │ │ │ -Please provide an implementation and check that a FieldTraits class is present │ │ │ │ │ -for your type."); │ │ │ │ │ -88 │ │ │ │ │ -89 │ │ │ │ │ -_9_5 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e() │ │ │ │ │ -96 { │ │ │ │ │ -97 return sizeof...(Args); │ │ │ │ │ -98 } │ │ │ │ │ -99 │ │ │ │ │ -_1_0_2 static constexpr _s_i_z_e___t_y_p_e _N() │ │ │ │ │ -103 { │ │ │ │ │ -104 return sizeof...(Args); │ │ │ │ │ -105 } │ │ │ │ │ -106 │ │ │ │ │ -113 [[deprecated("Use method 'N' instead")]] │ │ │ │ │ -_1_1_4 int _c_o_u_n_t() const │ │ │ │ │ -115 { │ │ │ │ │ -116 return sizeof...(Args); │ │ │ │ │ -117 } │ │ │ │ │ -118 │ │ │ │ │ -_1_2_0 _s_i_z_e___t_y_p_e _d_i_m() const │ │ │ │ │ -121 { │ │ │ │ │ -122 _s_i_z_e___t_y_p_e result = 0; │ │ │ │ │ -123 Hybrid::forEach(std::make_index_sequence<_N()>{}, │ │ │ │ │ -124 [&](auto i){result += std::get(*this).dim();}); │ │ │ │ │ -125 │ │ │ │ │ -126 return result; │ │ │ │ │ -127 } │ │ │ │ │ -128 │ │ │ │ │ -147 template< size_type index > │ │ │ │ │ -148 typename std::tuple_element::type& │ │ │ │ │ -_1_4_9 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ -> indexVariable) │ │ │ │ │ -150 { │ │ │ │ │ -151 return std::get(*this); │ │ │ │ │ -152 } │ │ │ │ │ -153 │ │ │ │ │ -159 template< size_type index > │ │ │ │ │ -160 const typename std::tuple_element::type& │ │ │ │ │ -_1_6_1 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ │ -> indexVariable) const │ │ │ │ │ -162 { │ │ │ │ │ -163 return std::get(*this); │ │ │ │ │ -164 } │ │ │ │ │ -165 │ │ │ │ │ -168 template │ │ │ │ │ -_1_6_9 void _o_p_e_r_a_t_o_r_=_ (const T& newval) { │ │ │ │ │ -170 Dune::Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ │ -171 entry = newval; │ │ │ │ │ -172 }); │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -_1_7_8 void _o_p_e_r_a_t_o_r_+_=_ (const _t_y_p_e& newv) { │ │ │ │ │ -179 using namespace Dune::Hybrid; │ │ │ │ │ -180 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ │ -181 (*this)[i] += newv[i]; │ │ │ │ │ -182 }); │ │ │ │ │ -183 } │ │ │ │ │ -184 │ │ │ │ │ -_1_8_8 void _o_p_e_r_a_t_o_r_-_=_ (const _t_y_p_e& newv) { │ │ │ │ │ -189 using namespace Dune::Hybrid; │ │ │ │ │ -190 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ │ -191 (*this)[i] -= newv[i]; │ │ │ │ │ -192 }); │ │ │ │ │ -193 } │ │ │ │ │ -194 │ │ │ │ │ -196 template::value, int> = 0> │ │ │ │ │ -_1_9_8 void _o_p_e_r_a_t_o_r_*_=_ (const T& w) { │ │ │ │ │ -199 Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ │ -200 entry *= w; │ │ │ │ │ -201 }); │ │ │ │ │ -202 } │ │ │ │ │ -203 │ │ │ │ │ -205 template::value, int> = 0> │ │ │ │ │ -_2_0_7 void _o_p_e_r_a_t_o_r_/_=_ (const T& w) { │ │ │ │ │ -208 Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ │ -209 entry /= w; │ │ │ │ │ -210 }); │ │ │ │ │ -211 } │ │ │ │ │ -212 │ │ │ │ │ -_2_1_3 _f_i_e_l_d___t_y_p_e _o_p_e_r_a_t_o_r_*_ (const _t_y_p_e& newv) const { │ │ │ │ │ -214 using namespace Dune::Hybrid; │ │ │ │ │ -215 return accumulate(integralRange(Hybrid::size(*this)), _f_i_e_l_d___t_y_p_e(0), [&] │ │ │ │ │ -(auto&& a, auto&& i) { │ │ │ │ │ -216 return a + (*this)[i]*newv[i]; │ │ │ │ │ -217 }); │ │ │ │ │ -218 } │ │ │ │ │ -219 │ │ │ │ │ -_2_2_0 _f_i_e_l_d___t_y_p_e _d_o_t (const _t_y_p_e& newv) const { │ │ │ │ │ -221 using namespace Dune::Hybrid; │ │ │ │ │ -222 return accumulate(integralRange(Hybrid::size(*this)), _f_i_e_l_d___t_y_p_e(0), [&] │ │ │ │ │ -(auto&& a, auto&& i) { │ │ │ │ │ -223 return a + (*this)[i].dot(newv[i]); │ │ │ │ │ -224 }); │ │ │ │ │ -225 } │ │ │ │ │ -226 │ │ │ │ │ -_2_2_9 auto _o_n_e___n_o_r_m() const { │ │ │ │ │ -230 using namespace Dune::Hybrid; │ │ │ │ │ -231 return accumulate(*this, typename FieldTraits::real_type(0), │ │ │ │ │ -[&](auto&& a, auto&& entry) { │ │ │ │ │ -232 return a + entry.one_norm(); │ │ │ │ │ -233 }); │ │ │ │ │ -234 } │ │ │ │ │ -235 │ │ │ │ │ -_2_3_8 auto _o_n_e___n_o_r_m___r_e_a_l() const { │ │ │ │ │ -239 using namespace Dune::Hybrid; │ │ │ │ │ -240 return accumulate(*this, typename FieldTraits::real_type(0), │ │ │ │ │ -[&](auto&& a, auto&& entry) { │ │ │ │ │ -241 return a + entry.one_norm_real(); │ │ │ │ │ -242 }); │ │ │ │ │ -243 } │ │ │ │ │ -244 │ │ │ │ │ -_2_4_7 typename FieldTraits::real_type _t_w_o___n_o_r_m_2() const { │ │ │ │ │ -248 using namespace Dune::Hybrid; │ │ │ │ │ -249 return accumulate(*this, typename FieldTraits::real_type(0), │ │ │ │ │ -[&](auto&& a, auto&& entry) { │ │ │ │ │ -250 return a + entry.two_norm2(); │ │ │ │ │ -251 }); │ │ │ │ │ -252 } │ │ │ │ │ -253 │ │ │ │ │ -_2_5_6 typename FieldTraits::real_type _t_w_o___n_o_r_m() const {return sqrt │ │ │ │ │ -(this->_t_w_o___n_o_r_m_2());} │ │ │ │ │ -257 │ │ │ │ │ -_2_6_0 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const │ │ │ │ │ -261 { │ │ │ │ │ -262 using namespace Dune::Hybrid; │ │ │ │ │ -263 using std::max; │ │ │ │ │ -264 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -265 │ │ │ │ │ -266 real_type result = 0.0; │ │ │ │ │ -267 // Compute max norm tracking appearing nan values │ │ │ │ │ -268 // if the field type supports nan. │ │ │ │ │ -269 if constexpr (HasNaN()) { │ │ │ │ │ -270 // This variable will preserve any nan value │ │ │ │ │ -271 real_type nanTracker = 1.0; │ │ │ │ │ -272 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -273 forEach(*this, [&](auto&& entry) { │ │ │ │ │ -274 real_type entryNorm = entry.infinity_norm(); │ │ │ │ │ -275 result = max(entryNorm, result); │ │ │ │ │ -276 nanTracker += entryNorm; │ │ │ │ │ -277 }); │ │ │ │ │ -278 // Incorporate possible nan value into result │ │ │ │ │ -279 result *= (nanTracker / nanTracker); │ │ │ │ │ -280 } else { │ │ │ │ │ -281 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -282 forEach(*this, [&](auto&& entry) { │ │ │ │ │ -283 result = max(entry.infinity_norm(), result); │ │ │ │ │ -284 }); │ │ │ │ │ -285 } │ │ │ │ │ -286 return result; │ │ │ │ │ -287 } │ │ │ │ │ -288 │ │ │ │ │ -_2_9_1 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const │ │ │ │ │ -292 { │ │ │ │ │ -293 using namespace Dune::Hybrid; │ │ │ │ │ -294 using std::max; │ │ │ │ │ -295 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -296 │ │ │ │ │ -297 real_type result = 0.0; │ │ │ │ │ -298 // Compute max norm tracking appearing nan values │ │ │ │ │ -299 // if the field type supports nan. │ │ │ │ │ -300 if constexpr (HasNaN()) { │ │ │ │ │ -301 // This variable will preserve any nan value │ │ │ │ │ -302 real_type nanTracker = 1.0; │ │ │ │ │ -303 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -304 forEach(*this, [&](auto&& entry) { │ │ │ │ │ -305 real_type entryNorm = entry.infinity_norm_real(); │ │ │ │ │ -306 result = max(entryNorm, result); │ │ │ │ │ -307 nanTracker += entryNorm; │ │ │ │ │ -308 }); │ │ │ │ │ -309 // Incorporate possible nan value into result │ │ │ │ │ -310 result *= (nanTracker / nanTracker); │ │ │ │ │ -311 } else { │ │ │ │ │ -312 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ │ -313 forEach(*this, [&](auto&& entry) { │ │ │ │ │ -314 result = max(entry.infinity_norm_real(), result); │ │ │ │ │ -315 }); │ │ │ │ │ -316 } │ │ │ │ │ -317 return result; │ │ │ │ │ -318 } │ │ │ │ │ -319 │ │ │ │ │ -324 template │ │ │ │ │ -_3_2_5 void _a_x_p_y (const Ta& a, const _t_y_p_e& y) { │ │ │ │ │ -326 using namespace Dune::Hybrid; │ │ │ │ │ -327 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ │ -328 (*this)[i].axpy(a, y[i]); │ │ │ │ │ -329 }); │ │ │ │ │ -330 } │ │ │ │ │ -331 │ │ │ │ │ -332 }; │ │ │ │ │ -333 │ │ │ │ │ -334 │ │ │ │ │ -335 │ │ │ │ │ -338 template │ │ │ │ │ -_3_3_9 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) { │ │ │ │ │ -340 using namespace Dune::Hybrid; │ │ │ │ │ -341 forEach(integralRange(Dune::Hybrid::size(v)), [&](auto&& i) { │ │ │ │ │ -342 s << "\t(" << i << "):\n" << v[i] << "\n"; │ │ │ │ │ -343 }); │ │ │ │ │ -344 return s; │ │ │ │ │ -345 } │ │ │ │ │ -346 │ │ │ │ │ -347} // end namespace Dune │ │ │ │ │ -348 │ │ │ │ │ -349namespace _s_t_d │ │ │ │ │ -350{ │ │ │ │ │ -355 template │ │ │ │ │ -_3_5_6 struct tuple_element > │ │ │ │ │ -357 { │ │ │ │ │ -_3_5_8 using _t_y_p_e = typename std::tuple_element >::type; │ │ │ │ │ -359 }; │ │ │ │ │ -360} │ │ │ │ │ -361 │ │ │ │ │ -362#endif │ │ │ │ │ -_g_s_e_t_c_._h_h │ │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ -generic way. │ │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ -_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:169 │ │ │ │ │ -_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_:_:_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 FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_c_o_u_n_t │ │ │ │ │ -int count() const │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:114 │ │ │ │ │ -_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:102 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > │ │ │ │ │ ->::field_type... > field_type │ │ │ │ │ -The type used for scalars. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ │ -static constexpr size_type size() │ │ │ │ │ -Return the number of non-zero vector entries. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:95 │ │ │ │ │ -_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:149 │ │ │ │ │ -_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 │ │ │ │ │ -FieldTraits< field_type >::real_type two_norm() const │ │ │ │ │ -Compute the Euclidean norm. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:256 │ │ │ │ │ -_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:120 │ │ │ │ │ -_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:220 │ │ │ │ │ -_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:198 │ │ │ │ │ -_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:325 │ │ │ │ │ -_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:207 │ │ │ │ │ -_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_:_:_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 │ │ │ │ │ -Compute the simplified maximum norm (uses 1-norm for complex values) │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:291 │ │ │ │ │ -_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:229 │ │ │ │ │ -_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:188 │ │ │ │ │ -_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:213 │ │ │ │ │ -_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:178 │ │ │ │ │ -_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:358 │ │ │ │ │ -_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 │ │ │ │ │ -FieldTraits< field_type >::real_type infinity_norm() const │ │ │ │ │ -Compute the maximum norm. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:260 │ │ │ │ │ -_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:238 │ │ │ │ │ -_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 │ │ │ │ │ -FieldTraits< field_type >::real_type two_norm2() const │ │ │ │ │ -Compute the squared Euclidean norm. │ │ │ │ │ -DDeeffiinniittiioonn multitypeblockvector.hh:247 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +_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_:_:_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:590 │ │ │ │ │ -_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 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ +Tag idnetifying the visited property of a vertex. │ │ │ │ │ +DDeeffiinniittiioonn properties.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ +A property map that extracts one property out of a bundle using operator[]() │ │ │ │ │ +DDeeffiinniittiioonn properties.hh:43 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00179.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bcrsmatrix.hh File Reference │ │ │ │ +dune-istl: transfer.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,79 +65,55 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
bcrsmatrix.hh File Reference
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Implementation of the BCRSMatrix class. │ │ │ │ +

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

│ │ │ │ -
#include <cmath>
│ │ │ │ -#include <complex>
│ │ │ │ -#include <set>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <algorithm>
│ │ │ │ -#include <numeric>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <map>
│ │ │ │ -#include <memory>
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ -#include "bvector.hh"
│ │ │ │ -#include "matrixutils.hh"
│ │ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ │ -#include <dune/common/iteratorfacades.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/ftraits.hh>
│ │ │ │ -#include <dune/common/scalarvectorview.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ +
#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

struct  Dune::CompressionStatistics< size_type >
 Statistics about compression achieved in implicit mode. More...
class  Dune::Amg::Transfer< V1, V2, T >
 
class  Dune::ImplicitMatrixBuilder< M_ >
 A wrapper for uniform access to the BCRSMatrix during and after the build stage in implicit build mode. More...
class  Dune::Amg::Transfer< V, V1, SequentialInformation >
 
class  Dune::ImplicitMatrixBuilder< M_ >::row_object
 Proxy row object for entry access. More...
 
class  Dune::BCRSMatrix< B, A >
 A sparse block matrix with compressed row storage. More...
 
class  Dune::BCRSMatrix< B, A >::RealRowIterator< T >
 Iterator access to matrix rows More...
 
class  Dune::BCRSMatrix< B, A >::CreateIterator
 Iterator class for sequential creation of blocks More...
 
struct  Dune::FieldTraits< BCRSMatrix< B, A > >
class  Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ │

Detailed Description

│ │ │ │ -

Implementation of the BCRSMatrix class.

│ │ │ │ +

Prolongation and restriction for amg.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,58 +1,37 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -bcrsmatrix.hh File Reference │ │ │ │ │ -Implementation of the BCRSMatrix class. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#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 "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +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 │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_<_ _s_i_z_e___t_y_p_e_ _> │ │ │ │ │ -  Statistics about compression achieved in implicit mode. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_1_,_ _V_2_,_ _T_ _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_<_ _M___ _> │ │ │ │ │ -  A wrapper for uniform access to the _B_C_R_S_M_a_t_r_i_x during and after the │ │ │ │ │ - build stage in implicit build mode. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_<_ _M___ _>_:_:_r_o_w___o_b_j_e_c_t │ │ │ │ │ -  Proxy row object for entry access. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _> │ │ │ │ │ -  A sparse block matrix with compressed row storage. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_ _T_ _> │ │ │ │ │ -  Iterator access to matrix rows _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -  Iterator class for sequential creation of blocks _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _> │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ │ +Prolongation and restriction for amg. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00179_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bcrsmatrix.hh Source File │ │ │ │ +dune-istl: transfer.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,2076 +70,250 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
bcrsmatrix.hh
│ │ │ │ +
transfer.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_BCRSMATRIX_HH
│ │ │ │ -
7#define DUNE_ISTL_BCRSMATRIX_HH
│ │ │ │ -
8
│ │ │ │ -
9#include <cmath>
│ │ │ │ -
10#include <complex>
│ │ │ │ -
11#include <set>
│ │ │ │ -
12#include <iostream>
│ │ │ │ -
13#include <algorithm>
│ │ │ │ -
14#include <numeric>
│ │ │ │ -
15#include <vector>
│ │ │ │ -
16#include <map>
│ │ │ │ -
17#include <memory>
│ │ │ │ -
18
│ │ │ │ -
19#include "istlexception.hh"
│ │ │ │ -
20#include "bvector.hh"
│ │ │ │ -
21#include "matrixutils.hh"
│ │ │ │ -
22#include <dune/common/stdstreams.hh>
│ │ │ │ -
23#include <dune/common/iteratorfacades.hh>
│ │ │ │ -
24#include <dune/common/typetraits.hh>
│ │ │ │ -
25#include <dune/common/ftraits.hh>
│ │ │ │ -
26#include <dune/common/scalarvectorview.hh>
│ │ │ │ -
27#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
28
│ │ │ │ - │ │ │ │ -
30
│ │ │ │ -
35namespace Dune {
│ │ │ │ -
36
│ │ │ │ -
76 template<typename M>
│ │ │ │ -
77 struct MatrixDimension;
│ │ │ │ -
78
│ │ │ │ -
80
│ │ │ │ -
86 template<typename size_type>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
88 {
│ │ │ │ -
90 double avg;
│ │ │ │ -
92 size_type maximum;
│ │ │ │ -
94 size_type overflow_total;
│ │ │ │ -
96
│ │ │ │ -
99 double mem_ratio;
│ │ │ │ -
100 };
│ │ │ │ -
│ │ │ │ -
101
│ │ │ │ -
103
│ │ │ │ -
115 template<class M_>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
117 {
│ │ │ │ -
118
│ │ │ │ -
119 public:
│ │ │ │ -
120
│ │ │ │ -
122 typedef M_ Matrix;
│ │ │ │ +
5#ifndef DUNE_AMGTRANSFER_HH
│ │ │ │ +
6#define DUNE_AMGTRANSFER_HH
│ │ │ │ +
7
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
13#include <dune/common/exceptions.hh>
│ │ │ │ +
14
│ │ │ │ +
15namespace Dune
│ │ │ │ +
16{
│ │ │ │ +
17 namespace Amg
│ │ │ │ +
18 {
│ │ │ │ +
19
│ │ │ │ +
30 template<class V1, class V2, class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
32 {
│ │ │ │ +
33
│ │ │ │ +
34 public:
│ │ │ │ +
35 typedef V1 Vertex;
│ │ │ │ +
36 typedef V2 Vector;
│ │ │ │ +
37
│ │ │ │ +
38 template<typename T1, typename R>
│ │ │ │ +
39 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ │ +
40 Vector& fineRedist,T1 damp, R& redistributor=R());
│ │ │ │ +
41
│ │ │ │ +
42 template<typename T1, typename R>
│ │ │ │ +
43 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ │ +
44 T1 damp);
│ │ │ │ +
45
│ │ │ │ +
46 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ │ +
47 T& comm);
│ │ │ │ +
48 };
│ │ │ │ +
│ │ │ │ +
49
│ │ │ │ +
50 template<class V,class V1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
52 {
│ │ │ │ +
53 public:
│ │ │ │ +
54 typedef V Vertex;
│ │ │ │ +
55 typedef V1 Vector;
│ │ │ │ + │ │ │ │ +
57 template<typename T1>
│ │ │ │ +
58 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ │ +
59 Vector& fineRedist, T1 damp,
│ │ │ │ + │ │ │ │ +
61 const Redist& redist=Redist());
│ │ │ │ +
62 template<typename T1>
│ │ │ │ +
63 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ │ +
64 T1 damp,
│ │ │ │ + │ │ │ │ +
66
│ │ │ │ +
67
│ │ │ │ +
68 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ │ +
69 const SequentialInformation& comm);
│ │ │ │ +
70 };
│ │ │ │ +
│ │ │ │ +
71
│ │ │ │ +
72#if HAVE_MPI
│ │ │ │ +
73
│ │ │ │ +
74 template<class V,class V1, class T1, class T2>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
76 {
│ │ │ │ +
77 public:
│ │ │ │ +
78 typedef V Vertex;
│ │ │ │ +
79 typedef V1 Vector;
│ │ │ │ + │ │ │ │ +
81 template<typename T3>
│ │ │ │ +
82 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ │ +
83 Vector& fineRedist, T3 damp, OwnerOverlapCopyCommunication<T1,T2>& comm,
│ │ │ │ +
84 const Redist& redist);
│ │ │ │ +
85 template<typename T3>
│ │ │ │ +
86 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ │ + │ │ │ │ +
88
│ │ │ │ +
89 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ │ + │ │ │ │ +
91 };
│ │ │ │ +
│ │ │ │ +
92
│ │ │ │ +
93#endif
│ │ │ │ +
94
│ │ │ │ +
95 template<class V, class V1>
│ │ │ │ +
96 template<typename T>
│ │ │ │ +
97 inline void
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
99 Vector& coarse, Vector& fine,
│ │ │ │ +
100 [[maybe_unused]] Vector& fineRedist,
│ │ │ │ +
101 T damp,
│ │ │ │ +
102 [[maybe_unused]] const SequentialInformation& comm,
│ │ │ │ +
103 [[maybe_unused]] const Redist& redist)
│ │ │ │ +
104 {
│ │ │ │ +
105 prolongateVector(aggregates, coarse, fine, damp);
│ │ │ │ +
106 }
│ │ │ │ +
│ │ │ │ +
107 template<class V, class V1>
│ │ │ │ +
108 template<typename T>
│ │ │ │ +
109 inline void
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
111 Vector& coarse, Vector& fine,
│ │ │ │ +
112 T damp,
│ │ │ │ +
113 [[maybe_unused]] const SequentialInformation& comm)
│ │ │ │ +
114 {
│ │ │ │ +
115 typedef typename Vector::iterator Iterator;
│ │ │ │ +
116
│ │ │ │ +
117 Iterator end = coarse.end();
│ │ │ │ +
118 Iterator begin= coarse.begin();
│ │ │ │ +
119 for(; begin!=end; ++begin)
│ │ │ │ +
120 *begin*=damp;
│ │ │ │ +
121 end=fine.end();
│ │ │ │ +
122 begin=fine.begin();
│ │ │ │
123
│ │ │ │ - │ │ │ │ -
126
│ │ │ │ -
128 typedef typename Matrix::size_type size_type;
│ │ │ │ -
129
│ │ │ │ -
131
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
137 {
│ │ │ │ -
138
│ │ │ │ -
139 public:
│ │ │ │ -
140
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
143 {
│ │ │ │ -
144 return _m.entry(_i,j);
│ │ │ │ -
145 }
│ │ │ │ -
│ │ │ │ -
146
│ │ │ │ -
147#ifndef DOXYGEN
│ │ │ │ -
148
│ │ │ │ - │ │ │ │ -
150 : _m(m)
│ │ │ │ -
151 , _i(i)
│ │ │ │ -
152 {}
│ │ │ │ -
153
│ │ │ │ -
154#endif
│ │ │ │ -
155
│ │ │ │ -
156 private:
│ │ │ │ -
157
│ │ │ │ -
158 Matrix& _m;
│ │ │ │ - │ │ │ │ -
160
│ │ │ │ -
161 };
│ │ │ │ -
│ │ │ │ -
162
│ │ │ │ -
164
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
171 : _m(m)
│ │ │ │ -
172 {
│ │ │ │ -
173 if (m.buildMode() != Matrix::implicit)
│ │ │ │ -
174 DUNE_THROW(BCRSMatrixError,"You can only create an ImplicitBuilder for a matrix in implicit build mode");
│ │ │ │ -
175 if (m.buildStage() != Matrix::building)
│ │ │ │ -
176 DUNE_THROW(BCRSMatrixError,"You can only create an ImplicitBuilder for a matrix with set size that has not been compressed() yet");
│ │ │ │ -
177 }
│ │ │ │ -
│ │ │ │ -
178
│ │ │ │ -
180
│ │ │ │ -
│ │ │ │ -
194 ImplicitMatrixBuilder(Matrix& m, size_type rows, size_type cols, size_type avg_cols_per_row, double overflow_fraction)
│ │ │ │ -
195 : _m(m)
│ │ │ │ -
196 {
│ │ │ │ -
197 if (m.buildStage() != Matrix::notAllocated)
│ │ │ │ -
198 DUNE_THROW(BCRSMatrixError,"You can only set up a matrix for this ImplicitBuilder if it has no memory allocated yet");
│ │ │ │ -
199 m.setBuildMode(Matrix::implicit);
│ │ │ │ -
200 m.setImplicitBuildModeParameters(avg_cols_per_row,overflow_fraction);
│ │ │ │ -
201 m.setSize(rows,cols);
│ │ │ │ -
202 }
│ │ │ │ -
│ │ │ │ -
203
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
206 {
│ │ │ │ -
207 return row_object(_m,i);
│ │ │ │ -
208 }
│ │ │ │ -
│ │ │ │ -
209
│ │ │ │ -
│ │ │ │ -
211 size_type N() const
│ │ │ │ -
212 {
│ │ │ │ -
213 return _m.N();
│ │ │ │ -
214 }
│ │ │ │ -
│ │ │ │ -
215
│ │ │ │ -
│ │ │ │ -
217 size_type M() const
│ │ │ │ -
218 {
│ │ │ │ -
219 return _m.M();
│ │ │ │ -
220 }
│ │ │ │ -
│ │ │ │ -
221
│ │ │ │ -
222 private:
│ │ │ │ -
223
│ │ │ │ -
224 Matrix& _m;
│ │ │ │ -
225
│ │ │ │ -
226 };
│ │ │ │ -
│ │ │ │ -
227
│ │ │ │ -
464 template<class B, class A=std::allocator<B> >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
466 {
│ │ │ │ -
467 friend struct MatrixDimension<BCRSMatrix>;
│ │ │ │ -
468 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
482 built=3
│ │ │ │ -
483 };
│ │ │ │ -
│ │ │ │ -
484
│ │ │ │ -
485 //===== type definitions and constants
│ │ │ │ -
486
│ │ │ │ -
488 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
489
│ │ │ │ -
491 typedef B block_type;
│ │ │ │ -
492
│ │ │ │ -
494 typedef A allocator_type;
│ │ │ │ -
495
│ │ │ │ -
497 typedef Imp::CompressedBlockVectorWindow<B,A> row_type;
│ │ │ │ -
498
│ │ │ │ -
500 typedef typename A::size_type size_type;
│ │ │ │ -
501
│ │ │ │ -
503 typedef ::Dune::CompressionStatistics<size_type> CompressionStatistics;
│ │ │ │ -
504
│ │ │ │ -
506 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
507 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ -
508
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
543 unknown
│ │ │ │ -
544 };
│ │ │ │ -
│ │ │ │ -
545
│ │ │ │ -
546 //===== random access interface to rows of the matrix
│ │ │ │ -
547
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
550 {
│ │ │ │ -
551#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
552 if (build_mode == implicit && ready != built)
│ │ │ │ -
553 DUNE_THROW(BCRSMatrixError,"You cannot use operator[] in implicit build mode before calling compress()");
│ │ │ │ -
554 if (r==0) DUNE_THROW(BCRSMatrixError,"row not initialized yet");
│ │ │ │ -
555 if (i>=n) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
556#endif
│ │ │ │ -
557 return r[i];
│ │ │ │ -
558 }
│ │ │ │ -
│ │ │ │ -
559
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
562 {
│ │ │ │ -
563#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
564 if (build_mode == implicit && ready != built)
│ │ │ │ -
565 DUNE_THROW(BCRSMatrixError,"You cannot use operator[] in implicit build mode before calling compress()");
│ │ │ │ -
566 if (built!=ready) DUNE_THROW(BCRSMatrixError,"row not initialized yet");
│ │ │ │ -
567 if (i>=n) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
568#endif
│ │ │ │ -
569 return r[i];
│ │ │ │ -
570 }
│ │ │ │ -
│ │ │ │ -
571
│ │ │ │ -
572
│ │ │ │ -
573 //===== iterator interface to rows of the matrix
│ │ │ │ -
574
│ │ │ │ -
576 template<class T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
578 : public RandomAccessIteratorFacade<RealRowIterator<T>, T>
│ │ │ │ -
579 {
│ │ │ │ -
580
│ │ │ │ -
581 public:
│ │ │ │ -
583 typedef typename std::remove_const<T>::type ValueType;
│ │ │ │ -
584
│ │ │ │ -
585 friend class RandomAccessIteratorFacade<RealRowIterator<const ValueType>, const ValueType>;
│ │ │ │ -
586 friend class RandomAccessIteratorFacade<RealRowIterator<ValueType>, ValueType>;
│ │ │ │ -
587 friend class RealRowIterator<const ValueType>;
│ │ │ │ -
588 friend class RealRowIterator<ValueType>;
│ │ │ │ -
589
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
592 : p(_p), i(_i)
│ │ │ │ -
593 {}
│ │ │ │ -
│ │ │ │ -
594
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
597 : p(0), i(0)
│ │ │ │ -
598 {}
│ │ │ │ -
│ │ │ │ -
599
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
601 : p(it.p), i(it.i)
│ │ │ │ -
602 {}
│ │ │ │ -
│ │ │ │ -
603
│ │ │ │ -
604
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
607 {
│ │ │ │ -
608 return i;
│ │ │ │ -
609 }
│ │ │ │ -
│ │ │ │ -
610
│ │ │ │ -
│ │ │ │ -
611 std::ptrdiff_t distanceTo(const RealRowIterator<ValueType>& other) const
│ │ │ │ -
612 {
│ │ │ │ -
613 assert(other.p==p);
│ │ │ │ -
614 return (other.i-i);
│ │ │ │ -
615 }
│ │ │ │ -
│ │ │ │ -
616
│ │ │ │ -
│ │ │ │ -
617 std::ptrdiff_t distanceTo(const RealRowIterator<const ValueType>& other) const
│ │ │ │ -
618 {
│ │ │ │ -
619 assert(other.p==p);
│ │ │ │ -
620 return (other.i-i);
│ │ │ │ -
621 }
│ │ │ │ -
│ │ │ │ -
622
│ │ │ │ -
│ │ │ │ -
624 bool equals (const RealRowIterator<ValueType>& other) const
│ │ │ │ -
625 {
│ │ │ │ -
626 assert(other.p==p);
│ │ │ │ -
627 return i==other.i;
│ │ │ │ -
628 }
│ │ │ │ -
│ │ │ │ -
629
│ │ │ │ -
│ │ │ │ -
631 bool equals (const RealRowIterator<const ValueType>& other) const
│ │ │ │ -
632 {
│ │ │ │ -
633 assert(other.p==p);
│ │ │ │ -
634 return i==other.i;
│ │ │ │ -
635 }
│ │ │ │ -
│ │ │ │ -
636
│ │ │ │ -
637 private:
│ │ │ │ -
639 void increment()
│ │ │ │ -
640 {
│ │ │ │ -
641 ++i;
│ │ │ │ -
642 }
│ │ │ │ -
643
│ │ │ │ -
645 void decrement()
│ │ │ │ -
646 {
│ │ │ │ -
647 --i;
│ │ │ │ -
648 }
│ │ │ │ -
649
│ │ │ │ -
650 void advance(std::ptrdiff_t diff)
│ │ │ │ -
651 {
│ │ │ │ -
652 i+=diff;
│ │ │ │ -
653 }
│ │ │ │ -
654
│ │ │ │ -
655 T& elementAt(std::ptrdiff_t diff) const
│ │ │ │ -
656 {
│ │ │ │ -
657 return p[i+diff];
│ │ │ │ -
658 }
│ │ │ │ -
659
│ │ │ │ -
661 row_type& dereference () const
│ │ │ │ -
662 {
│ │ │ │ -
663 return p[i];
│ │ │ │ -
664 }
│ │ │ │ -
665
│ │ │ │ -
666 row_type* p;
│ │ │ │ -
667 size_type i;
│ │ │ │ -
668 };
│ │ │ │ -
│ │ │ │ -
669
│ │ │ │ - │ │ │ │ - │ │ │ │ -
673
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
676 {
│ │ │ │ -
677 return Iterator(r,0);
│ │ │ │ -
678 }
│ │ │ │ -
│ │ │ │ -
679
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
682 {
│ │ │ │ -
683 return Iterator(r,n);
│ │ │ │ -
684 }
│ │ │ │ -
│ │ │ │ -
685
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
689 {
│ │ │ │ -
690 return Iterator(r,n-1);
│ │ │ │ -
691 }
│ │ │ │ -
│ │ │ │ -
692
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
696 {
│ │ │ │ -
697 return Iterator(r,-1);
│ │ │ │ -
698 }
│ │ │ │ -
│ │ │ │ -
699
│ │ │ │ - │ │ │ │ -
702
│ │ │ │ -
704 typedef typename row_type::Iterator ColIterator;
│ │ │ │ -
705
│ │ │ │ - │ │ │ │ - │ │ │ │ -
709
│ │ │ │ -
710
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
713 {
│ │ │ │ -
714 return ConstIterator(r,0);
│ │ │ │ -
715 }
│ │ │ │ -
│ │ │ │ -
716
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
719 {
│ │ │ │ -
720 return ConstIterator(r,n);
│ │ │ │ -
721 }
│ │ │ │ -
│ │ │ │ -
722
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
726 {
│ │ │ │ -
727 return ConstIterator(r,n-1);
│ │ │ │ -
728 }
│ │ │ │ -
│ │ │ │ -
729
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
733 {
│ │ │ │ -
734 return ConstIterator(r,-1);
│ │ │ │ -
735 }
│ │ │ │ -
│ │ │ │ -
736
│ │ │ │ - │ │ │ │ -
739
│ │ │ │ -
741 typedef typename row_type::ConstIterator ConstColIterator;
│ │ │ │ -
742
│ │ │ │ -
743 //===== constructors & resizers
│ │ │ │ -
744
│ │ │ │ -
745 // we use a negative compressionBufferSize to indicate that the implicit
│ │ │ │ -
746 // mode parameters have not been set yet
│ │ │ │ -
747
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
750 : build_mode(unknown), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ -
751 allocationSize_(0), r(0), a(0),
│ │ │ │ - │ │ │ │ -
753 {}
│ │ │ │ -
│ │ │ │ -
754
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
757 : build_mode(bm), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ -
758 allocationSize_(0), r(0), a(0),
│ │ │ │ - │ │ │ │ -
760 {
│ │ │ │ -
761 allocate(_n, _m, _nnz,true,false);
│ │ │ │ -
762 }
│ │ │ │ -
│ │ │ │ -
763
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
766 : build_mode(bm), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ -
767 allocationSize_(0), r(0), a(0),
│ │ │ │ - │ │ │ │ -
769 {
│ │ │ │ -
770 allocate(_n, _m,0,true,false);
│ │ │ │ -
771 }
│ │ │ │ -
│ │ │ │ -
772
│ │ │ │ -
774
│ │ │ │ -
│ │ │ │ -
784 BCRSMatrix (size_type _n, size_type _m, size_type _avg, double compressionBufferSize, BuildMode bm)
│ │ │ │ -
785 : build_mode(bm), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ -
786 allocationSize_(0), r(0), a(0),
│ │ │ │ -
787 avg(_avg), compressionBufferSize_(compressionBufferSize)
│ │ │ │ -
788 {
│ │ │ │ -
789 if (bm != implicit)
│ │ │ │ -
790 DUNE_THROW(BCRSMatrixError,"Only call this constructor when using the implicit build mode");
│ │ │ │ -
791 // Prevent user from setting a negative compression buffer size:
│ │ │ │ -
792 // 1) It doesn't make sense
│ │ │ │ -
793 // 2) We use a negative value to indicate that the parameters
│ │ │ │ -
794 // have not been set yet
│ │ │ │ -
795 if (compressionBufferSize_ < 0.0)
│ │ │ │ -
796 DUNE_THROW(BCRSMatrixError,"You cannot set a negative overflow fraction");
│ │ │ │ -
797 implicit_allocate(_n,_m);
│ │ │ │ -
798 }
│ │ │ │ -
│ │ │ │ -
799
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
806 : build_mode(Mat.build_mode), ready(notAllocated), n(0), m(0), nnz_(0),
│ │ │ │ -
807 allocationSize_(0), r(0), a(0),
│ │ │ │ - │ │ │ │ -
809 {
│ │ │ │ -
810 if (!(Mat.ready == notAllocated || Mat.ready == built))
│ │ │ │ -
811 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copy-constructed when source matrix is completely empty (size not set) or fully built)");
│ │ │ │ -
812
│ │ │ │ -
813 // deep copy in global array
│ │ │ │ -
814 size_type _nnz = Mat.nonzeroes();
│ │ │ │ -
815
│ │ │ │ -
816 j_ = Mat.j_; // enable column index sharing, release array in case of row-wise allocation
│ │ │ │ -
817 allocate(Mat.n, Mat.m, _nnz, true, true);
│ │ │ │ -
818
│ │ │ │ -
819 // build window structure
│ │ │ │ - │ │ │ │ -
821 }
│ │ │ │ -
│ │ │ │ -
822
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
825 {
│ │ │ │ -
826 deallocate();
│ │ │ │ -
827 }
│ │ │ │ -
│ │ │ │ -
828
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
834 {
│ │ │ │ -
835 if (ready == notAllocated)
│ │ │ │ -
836 {
│ │ │ │ -
837 build_mode = bm;
│ │ │ │ -
838 return;
│ │ │ │ -
839 }
│ │ │ │ -
840 if (ready == building && (build_mode == unknown || build_mode == random || build_mode == row_wise) && (bm == row_wise || bm == random))
│ │ │ │ -
841 build_mode = bm;
│ │ │ │ -
842 else
│ │ │ │ -
843 DUNE_THROW(InvalidStateException, "Matrix structure cannot be changed at this stage anymore (ready == "<<ready<<").");
│ │ │ │ -
844 }
│ │ │ │ -
│ │ │ │ -
845
│ │ │ │ -
│ │ │ │ -
861 void setSize(size_type rows, size_type columns, size_type nnz=0)
│ │ │ │ -
862 {
│ │ │ │ -
863 // deallocate already setup memory
│ │ │ │ -
864 deallocate();
│ │ │ │ -
865
│ │ │ │ -
866 if (build_mode == implicit)
│ │ │ │ -
867 {
│ │ │ │ -
868 if (nnz>0)
│ │ │ │ -
869 DUNE_THROW(Dune::BCRSMatrixError,"number of non-zeroes may not be set in implicit mode, use setImplicitBuildModeParameters() instead");
│ │ │ │ -
870
│ │ │ │ -
871 // implicit allocates differently
│ │ │ │ -
872 implicit_allocate(rows,columns);
│ │ │ │ -
873 }
│ │ │ │ -
874 else
│ │ │ │ -
875 {
│ │ │ │ -
876 // allocate matrix memory
│ │ │ │ -
877 allocate(rows, columns, nnz, true, false);
│ │ │ │ -
878 }
│ │ │ │ -
879 }
│ │ │ │ -
│ │ │ │ -
880
│ │ │ │ -
│ │ │ │ -
889 void setImplicitBuildModeParameters(size_type _avg, double compressionBufferSize)
│ │ │ │ -
890 {
│ │ │ │ -
891 // Prevent user from setting a negative compression buffer size:
│ │ │ │ -
892 // 1) It doesn't make sense
│ │ │ │ -
893 // 2) We use a negative value to indicate that the parameters
│ │ │ │ -
894 // have not been set yet
│ │ │ │ -
895 if (compressionBufferSize < 0.0)
│ │ │ │ -
896 DUNE_THROW(BCRSMatrixError,"You cannot set a negative compressionBufferSize value");
│ │ │ │ -
897
│ │ │ │ -
898 // make sure the parameters aren't changed after memory has been allocated
│ │ │ │ -
899 if (ready != notAllocated)
│ │ │ │ -
900 DUNE_THROW(InvalidStateException,"You cannot modify build mode parameters at this stage anymore");
│ │ │ │ -
901 avg = _avg;
│ │ │ │ -
902 compressionBufferSize_ = compressionBufferSize;
│ │ │ │ -
903 }
│ │ │ │ -
│ │ │ │ -
904
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
912 {
│ │ │ │ -
913 // return immediately when self-assignment
│ │ │ │ -
914 if (&Mat==this) return *this;
│ │ │ │ -
915
│ │ │ │ -
916 if (!((ready == notAllocated || ready == built) && (Mat.ready == notAllocated || Mat.ready == built)))
│ │ │ │ -
917 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copied when both target and source are empty or fully built)");
│ │ │ │ -
918
│ │ │ │ -
919 // make it simple: ALWAYS throw away memory for a and j_
│ │ │ │ -
920 // and deallocate rows only if n != Mat.n
│ │ │ │ -
921 deallocate(n!=Mat.n);
│ │ │ │ -
922
│ │ │ │ -
923 // reallocate the rows if required
│ │ │ │ -
924 if (n>0 && n!=Mat.n) {
│ │ │ │ -
925 // free rows
│ │ │ │ -
926 for(row_type *riter=r+(n-1), *rend=r-1; riter!=rend; --riter)
│ │ │ │ -
927 std::allocator_traits<decltype(rowAllocator_)>::destroy(rowAllocator_, riter);
│ │ │ │ -
928 rowAllocator_.deallocate(r,n);
│ │ │ │ -
929 }
│ │ │ │ -
930
│ │ │ │ -
931 nnz_ = Mat.nonzeroes();
│ │ │ │ -
932
│ │ │ │ -
933 // allocate a, share j_
│ │ │ │ -
934 j_ = Mat.j_;
│ │ │ │ -
935 allocate(Mat.n, Mat.m, nnz_, n!=Mat.n, true);
│ │ │ │ -
936
│ │ │ │ -
937 // build window structure
│ │ │ │ - │ │ │ │ -
939 return *this;
│ │ │ │ -
940 }
│ │ │ │ -
│ │ │ │ -
941
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
944 {
│ │ │ │ -
945
│ │ │ │ -
946 if (!(ready == notAllocated || ready == built))
│ │ │ │ -
947 DUNE_THROW(InvalidStateException,"Scalar assignment only works on fully built BCRSMatrix)");
│ │ │ │ -
948
│ │ │ │ -
949 for (size_type i=0; i<n; i++) r[i] = k;
│ │ │ │ -
950 return *this;
│ │ │ │ -
951 }
│ │ │ │ -
│ │ │ │ -
952
│ │ │ │ -
953 //===== row-wise creation interface
│ │ │ │ -
954
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
957 {
│ │ │ │ -
958 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
961 : Mat(_Mat), i(_i), nnz(0), current_row(nullptr, Mat.j_.get(), 0)
│ │ │ │ -
962 {
│ │ │ │ -
963 if (Mat.build_mode == unknown && Mat.ready == building)
│ │ │ │ -
964 {
│ │ │ │ -
965 Mat.build_mode = row_wise;
│ │ │ │ -
966 }
│ │ │ │ -
967 if (i==0 && Mat.ready != building)
│ │ │ │ -
968 DUNE_THROW(BCRSMatrixError,"creation only allowed for uninitialized matrix");
│ │ │ │ -
969 if(Mat.build_mode!=row_wise)
│ │ │ │ -
970 DUNE_THROW(BCRSMatrixError,"creation only allowed if row wise allocation was requested in the constructor");
│ │ │ │ -
971 if(i==0 && _Mat.N()==0)
│ │ │ │ -
972 // empty Matrix is always built.
│ │ │ │ -
973 Mat.ready = built;
│ │ │ │ -
974 }
│ │ │ │ -
│ │ │ │ -
975
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
978 {
│ │ │ │ -
979 // this should only be called if matrix is in creation
│ │ │ │ -
980 if (Mat.ready != building)
│ │ │ │ -
981 DUNE_THROW(BCRSMatrixError,"matrix already built up");
│ │ │ │ -
982
│ │ │ │ -
983 // row i is defined through the pattern
│ │ │ │ -
984 // get memory for the row and initialize the j_ array
│ │ │ │ -
985 // this depends on the allocation mode
│ │ │ │ -
986
│ │ │ │ -
987 // compute size of the row
│ │ │ │ -
988 size_type s = pattern.size();
│ │ │ │ -
989
│ │ │ │ -
990 if(s>0) {
│ │ │ │ -
991 // update number of nonzeroes including this row
│ │ │ │ -
992 nnz += s;
│ │ │ │ -
993
│ │ │ │ -
994 // alloc memory / set window
│ │ │ │ -
995 if (Mat.nnz_ > 0)
│ │ │ │ -
996 {
│ │ │ │ -
997 // memory is allocated in one long array
│ │ │ │ -
998
│ │ │ │ -
999 // check if that memory is sufficient
│ │ │ │ -
1000 if (nnz > Mat.nnz_)
│ │ │ │ -
1001 DUNE_THROW(BCRSMatrixError,"allocated nnz too small");
│ │ │ │ -
1002
│ │ │ │ -
1003 // set row i
│ │ │ │ -
1004 Mat.r[i].set(s,nullptr,current_row.getindexptr());
│ │ │ │ -
1005 current_row.setindexptr(current_row.getindexptr()+s);
│ │ │ │ -
1006 }else{
│ │ │ │ -
1007 // memory is allocated individually per row
│ │ │ │ -
1008 // allocate and set row i
│ │ │ │ -
1009 B* b = Mat.allocator_.allocate(s);
│ │ │ │ -
1010 // use placement new to call constructor that allocates
│ │ │ │ -
1011 // additional memory.
│ │ │ │ -
1012 new (b) B[s];
│ │ │ │ -
1013 size_type* j = Mat.sizeAllocator_.allocate(s);
│ │ │ │ -
1014 Mat.r[i].set(s,b,j);
│ │ │ │ -
1015 }
│ │ │ │ -
1016 }else
│ │ │ │ -
1017 // setup empty row
│ │ │ │ -
1018 Mat.r[i].set(0,nullptr,nullptr);
│ │ │ │ -
1019
│ │ │ │ -
1020 // initialize the j array for row i from pattern
│ │ │ │ -
1021 std::copy(pattern.cbegin(), pattern.cend(), Mat.r[i].getindexptr());
│ │ │ │ -
1022
│ │ │ │ -
1023 // now go to next row
│ │ │ │ -
1024 i++;
│ │ │ │ -
1025 pattern.clear();
│ │ │ │ -
1026
│ │ │ │ -
1027 // check if this was last row
│ │ │ │ -
1028 if (i==Mat.n)
│ │ │ │ -
1029 {
│ │ │ │ -
1030 Mat.ready = built;
│ │ │ │ -
1031 if(Mat.nnz_ > 0)
│ │ │ │ -
1032 {
│ │ │ │ -
1033 // Set nnz to the exact number of nonzero blocks inserted
│ │ │ │ -
1034 // as some methods rely on it
│ │ │ │ -
1035 Mat.nnz_ = nnz;
│ │ │ │ -
1036 // allocate data array
│ │ │ │ -
1037 Mat.allocateData();
│ │ │ │ -
1038 Mat.setDataPointers();
│ │ │ │ -
1039 }
│ │ │ │ -
1040 }
│ │ │ │ -
1041 // done
│ │ │ │ -
1042 return *this;
│ │ │ │ -
1043 }
│ │ │ │ -
│ │ │ │ -
1044
│ │ │ │ -
│ │ │ │ -
1046 bool operator!= (const CreateIterator& it) const
│ │ │ │ -
1047 {
│ │ │ │ -
1048 return (i!=it.i) || (&Mat!=&it.Mat);
│ │ │ │ -
1049 }
│ │ │ │ -
│ │ │ │ -
1050
│ │ │ │ -
│ │ │ │ -
1052 bool operator== (const CreateIterator& it) const
│ │ │ │ -
1053 {
│ │ │ │ -
1054 return (i==it.i) && (&Mat==&it.Mat);
│ │ │ │ -
1055 }
│ │ │ │ -
│ │ │ │ -
1056
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1059 {
│ │ │ │ -
1060 return i;
│ │ │ │ -
1061 }
│ │ │ │ -
│ │ │ │ -
1062
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1065 {
│ │ │ │ -
1066 pattern.insert(j);
│ │ │ │ -
1067 }
│ │ │ │ -
│ │ │ │ -
1068
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1071 {
│ │ │ │ -
1072 return pattern.find(j) != pattern.end();
│ │ │ │ -
1073 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1080 {
│ │ │ │ -
1081 return pattern.size();
│ │ │ │ -
1082 }
│ │ │ │ -
│ │ │ │ -
1083
│ │ │ │ -
1084 private:
│ │ │ │ -
1085 BCRSMatrix& Mat; // the matrix we are defining
│ │ │ │ -
1086 size_type i; // current row to be defined
│ │ │ │ -
1087 size_type nnz; // count total number of nonzeros
│ │ │ │ -
1088 typedef std::set<size_type,std::less<size_type> > PatternType;
│ │ │ │ -
1089 PatternType pattern; // used to compile entries in a row
│ │ │ │ -
1090 row_type current_row; // row pointing to the current row to setup
│ │ │ │ -
1091 };
│ │ │ │ +
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 }
│ │ │ │
│ │ │ │ -
1092
│ │ │ │ -
1094 friend class CreateIterator;
│ │ │ │ -
1095
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1098 {
│ │ │ │ -
1099 return CreateIterator(*this,0);
│ │ │ │ -
1100 }
│ │ │ │ -
│ │ │ │ -
1101
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1104 {
│ │ │ │ -
1105 return CreateIterator(*this,n);
│ │ │ │ -
1106 }
│ │ │ │ -
│ │ │ │ -
1107
│ │ │ │ -
1108
│ │ │ │ -
1109 //===== random creation interface
│ │ │ │ -
1110
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1118 {
│ │ │ │ -
1119 if (build_mode!=random)
│ │ │ │ -
1120 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ -
1121 if (ready != building)
│ │ │ │ -
1122 DUNE_THROW(BCRSMatrixError,"matrix row sizes already built up");
│ │ │ │ -
1123
│ │ │ │ -
1124 r[i].setsize(s);
│ │ │ │ -
1125 }
│ │ │ │ -
│ │ │ │ -
1126
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1129 {
│ │ │ │ -
1130#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1131 if (r==0) DUNE_THROW(BCRSMatrixError,"row not initialized yet");
│ │ │ │ -
1132 if (i>=n) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1133#endif
│ │ │ │ -
1134 return r[i].getsize();
│ │ │ │ -
1135 }
│ │ │ │ -
│ │ │ │ -
1136
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1139 {
│ │ │ │ -
1140 if (build_mode!=random)
│ │ │ │ -
1141 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ -
1142 if (ready != building)
│ │ │ │ -
1143 DUNE_THROW(BCRSMatrixError,"matrix row sizes already built up");
│ │ │ │ -
1144
│ │ │ │ -
1145 r[i].setsize(r[i].getsize()+s);
│ │ │ │ -
1146 }
│ │ │ │ -
│ │ │ │ -
1147
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1150 {
│ │ │ │ -
1151 if (build_mode!=random)
│ │ │ │ -
1152 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ -
1153 if (ready != building)
│ │ │ │ -
1154 DUNE_THROW(BCRSMatrixError,"matrix row sizes already built up");
│ │ │ │ -
1155
│ │ │ │ -
1156 // compute total size, check positivity
│ │ │ │ -
1157 size_type total=0;
│ │ │ │ -
1158 for (size_type i=0; i<n; i++)
│ │ │ │ -
1159 {
│ │ │ │ -
1160 total += r[i].getsize();
│ │ │ │ -
1161 }
│ │ │ │ -
1162
│ │ │ │ -
1163 if(nnz_ == 0)
│ │ │ │ -
1164 // allocate/check memory
│ │ │ │ -
1165 allocate(n,m,total,false,false);
│ │ │ │ -
1166 else if(nnz_ < total)
│ │ │ │ -
1167 DUNE_THROW(BCRSMatrixError,"Specified number of nonzeros ("<<nnz_<<") not "
│ │ │ │ -
1168 <<"sufficient for calculated nonzeros ("<<total<<"! ");
│ │ │ │ -
1169
│ │ │ │ -
1170 // set the window pointers correctly
│ │ │ │ - │ │ │ │ -
1172
│ │ │ │ -
1173 // initialize j_ array with m (an invalid column index)
│ │ │ │ -
1174 // this indicates an unused entry
│ │ │ │ -
1175 for (size_type k=0; k<nnz_; k++)
│ │ │ │ -
1176 j_.get()[k] = m;
│ │ │ │ - │ │ │ │ -
1178 }
│ │ │ │ -
│ │ │ │ -
1179
│ │ │ │ -
1181
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1192 {
│ │ │ │ -
1193 if (build_mode!=random)
│ │ │ │ -
1194 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ -
1195 if (ready==built)
│ │ │ │ -
1196 DUNE_THROW(BCRSMatrixError,"matrix already built up");
│ │ │ │ -
1197 if (ready==building)
│ │ │ │ -
1198 DUNE_THROW(BCRSMatrixError,"matrix row sizes not built up yet");
│ │ │ │ -
1199 if (ready==notAllocated)
│ │ │ │ -
1200 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ -
1201
│ │ │ │ -
1202 if (col >= m)
│ │ │ │ -
1203 DUNE_THROW(BCRSMatrixError,"column index exceeds matrix size");
│ │ │ │ -
1204
│ │ │ │ -
1205 // get row range
│ │ │ │ -
1206 size_type* const first = r[row].getindexptr();
│ │ │ │ -
1207 size_type* const last = first + r[row].getsize();
│ │ │ │ -
1208
│ │ │ │ -
1209 // find correct insertion position for new column index
│ │ │ │ -
1210 size_type* pos = std::lower_bound(first,last,col);
│ │ │ │ -
1211
│ │ │ │ -
1212 // check if index is already in row
│ │ │ │ -
1213 if (pos!=last && *pos == col) return;
│ │ │ │ -
1214
│ │ │ │ -
1215 // find end of already inserted column indices
│ │ │ │ -
1216 size_type* end = std::lower_bound(pos,last,m);
│ │ │ │ -
1217 if (end==last)
│ │ │ │ -
1218 DUNE_THROW(BCRSMatrixError,"row is too small");
│ │ │ │ -
1219
│ │ │ │ -
1220 // insert new column index at correct position
│ │ │ │ -
1221 std::copy_backward(pos,end,end+1);
│ │ │ │ -
1222 *pos = col;
│ │ │ │ -
1223 }
│ │ │ │ -
│ │ │ │ -
1224
│ │ │ │ -
1226
│ │ │ │ -
1233 template<typename It>
│ │ │ │ -
│ │ │ │ -
1234 void setIndices(size_type row, It begin, It end)
│ │ │ │ -
1235 {
│ │ │ │ -
1236 size_type row_size = r[row].size();
│ │ │ │ -
1237 size_type* col_begin = r[row].getindexptr();
│ │ │ │ -
1238 size_type* col_end;
│ │ │ │ -
1239 // consistency check between allocated row size and number of passed column indices
│ │ │ │ -
1240 if ((col_end = std::copy(begin,end,r[row].getindexptr())) != col_begin + row_size)
│ │ │ │ -
1241 DUNE_THROW(BCRSMatrixError,"Given size of row " << row
│ │ │ │ -
1242 << " (" << row_size
│ │ │ │ -
1243 << ") does not match number of passed entries (" << (col_end - col_begin) << ")");
│ │ │ │ -
1244 std::sort(col_begin,col_end);
│ │ │ │ -
1245 }
│ │ │ │ -
│ │ │ │ -
1246
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1249 {
│ │ │ │ -
1250 if (build_mode!=random)
│ │ │ │ -
1251 DUNE_THROW(BCRSMatrixError,"requires random build mode");
│ │ │ │ -
1252 if (ready==built)
│ │ │ │ -
1253 DUNE_THROW(BCRSMatrixError,"matrix already built up");
│ │ │ │ -
1254 if (ready==building)
│ │ │ │ -
1255 DUNE_THROW(BCRSMatrixError,"row sizes are not built up yet");
│ │ │ │ -
1256 if (ready==notAllocated)
│ │ │ │ -
1257 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ -
1258
│ │ │ │ -
1259 // check if there are undefined indices
│ │ │ │ -
1260 RowIterator endi=end();
│ │ │ │ -
1261 for (RowIterator i=begin(); i!=endi; ++i)
│ │ │ │ -
1262 {
│ │ │ │ -
1263 ColIterator endj = (*i).end();
│ │ │ │ -
1264 for (ColIterator j=(*i).begin(); j!=endj; ++j) {
│ │ │ │ -
1265 if (j.index() >= m) {
│ │ │ │ -
1266 dwarn << "WARNING: size of row "<< i.index()<<" is "<<j.offset()<<". But was specified as being "<< (*i).end().offset()
│ │ │ │ -
1267 <<". This means you are wasting valuable space and creating additional cache misses!"<<std::endl;
│ │ │ │ -
1268 nnz_ -= ((*i).end().offset() - j.offset());
│ │ │ │ -
1269 r[i.index()].setsize(j.offset());
│ │ │ │ -
1270 break;
│ │ │ │ -
1271 }
│ │ │ │ -
1272 }
│ │ │ │ -
1273 }
│ │ │ │ -
1274
│ │ │ │ -
1275 allocateData();
│ │ │ │ - │ │ │ │ -
1277
│ │ │ │ -
1278 // if not, set matrix to built
│ │ │ │ -
1279 ready = built;
│ │ │ │ -
1280 }
│ │ │ │ -
│ │ │ │ -
1281
│ │ │ │ -
1282 //===== implicit creation interface
│ │ │ │ -
1283
│ │ │ │ -
1285
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1297 {
│ │ │ │ -
1298#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1299 if (build_mode!=implicit)
│ │ │ │ -
1300 DUNE_THROW(BCRSMatrixError,"requires implicit build mode");
│ │ │ │ -
1301 if (ready==built)
│ │ │ │ -
1302 DUNE_THROW(BCRSMatrixError,"matrix already built up, use operator[] for entry access now");
│ │ │ │ -
1303 if (ready==notAllocated)
│ │ │ │ -
1304 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ -
1305 if (ready!=building)
│ │ │ │ -
1306 DUNE_THROW(InvalidStateException,"You may only use entry() during the 'building' stage");
│ │ │ │ -
1307
│ │ │ │ -
1308 if (row >= n)
│ │ │ │ -
1309 DUNE_THROW(BCRSMatrixError,"row index exceeds matrix size");
│ │ │ │ -
1310 if (col >= m)
│ │ │ │ -
1311 DUNE_THROW(BCRSMatrixError,"column index exceeds matrix size");
│ │ │ │ -
1312#endif
│ │ │ │ -
1313
│ │ │ │ -
1314 size_type* begin = r[row].getindexptr();
│ │ │ │ -
1315 size_type* end = begin + r[row].getsize();
│ │ │ │ -
1316
│ │ │ │ -
1317 size_type* pos = std::find(begin, end, col);
│ │ │ │ -
1318
│ │ │ │ -
1319 //treat the case that there was a match in the array
│ │ │ │ -
1320 if (pos != end)
│ │ │ │ -
1321 if (*pos == col)
│ │ │ │ -
1322 {
│ │ │ │ -
1323 std::ptrdiff_t offset = pos - r[row].getindexptr();
│ │ │ │ -
1324 B* aptr = r[row].getptr() + offset;
│ │ │ │ -
1325
│ │ │ │ -
1326 return *aptr;
│ │ │ │ -
1327 }
│ │ │ │ -
1328
│ │ │ │ -
1329 //determine whether overflow has to be taken into account or not
│ │ │ │ -
1330 if (r[row].getsize() == avg)
│ │ │ │ -
1331 return overflow[std::make_pair(row,col)];
│ │ │ │ -
1332 else
│ │ │ │ -
1333 {
│ │ │ │ -
1334 //modify index array
│ │ │ │ -
1335 *end = col;
│ │ │ │ -
1336
│ │ │ │ -
1337 //do simultaneous operations on data array a
│ │ │ │ -
1338 std::ptrdiff_t offset = end - r[row].getindexptr();
│ │ │ │ -
1339 B* apos = r[row].getptr() + offset;
│ │ │ │ -
1340
│ │ │ │ -
1341 //increase rowsize
│ │ │ │ -
1342 r[row].setsize(r[row].getsize()+1);
│ │ │ │ -
1343
│ │ │ │ -
1344 //return reference to the newly created entry
│ │ │ │ -
1345 return *apos;
│ │ │ │ -
1346 }
│ │ │ │ -
1347 }
│ │ │ │ -
│ │ │ │ -
1348
│ │ │ │ -
1350
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1361 {
│ │ │ │ -
1362 if (build_mode!=implicit)
│ │ │ │ -
1363 DUNE_THROW(BCRSMatrixError,"requires implicit build mode");
│ │ │ │ -
1364 if (ready==built)
│ │ │ │ -
1365 DUNE_THROW(BCRSMatrixError,"matrix already built up, no more need for compression");
│ │ │ │ -
1366 if (ready==notAllocated)
│ │ │ │ -
1367 DUNE_THROW(BCRSMatrixError,"matrix size not set and no memory allocated yet");
│ │ │ │ -
1368 if (ready!=building)
│ │ │ │ -
1369 DUNE_THROW(InvalidStateException,"You may only call compress() at the end of the 'building' stage");
│ │ │ │ -
1370
│ │ │ │ -
1371 //calculate statistics
│ │ │ │ - │ │ │ │ -
1373 stats.overflow_total = overflow.size();
│ │ │ │ -
1374 stats.maximum = 0;
│ │ │ │ -
1375
│ │ │ │ -
1376 //get insertion iterators pointing to one before start (for later use of ++it)
│ │ │ │ -
1377 size_type* jiit = j_.get();
│ │ │ │ -
1378 B* aiit = a;
│ │ │ │ -
1379
│ │ │ │ -
1380 //get iterator to the smallest overflow element
│ │ │ │ -
1381 typename OverflowType::iterator oit = overflow.begin();
│ │ │ │ -
1382
│ │ │ │ -
1383 //store a copy of index pointers on which to perform sorting
│ │ │ │ -
1384 std::vector<size_type*> perm;
│ │ │ │ -
1385
│ │ │ │ -
1386 //iterate over all rows and copy elements into their position in the compressed array
│ │ │ │ -
1387 for (size_type i=0; i<n; i++)
│ │ │ │ -
1388 {
│ │ │ │ -
1389 //get old pointers into a and j and size without overflow changes
│ │ │ │ -
1390 size_type* begin = r[i].getindexptr();
│ │ │ │ -
1391 //B* apos = r[i].getptr();
│ │ │ │ -
1392 size_type size = r[i].getsize();
│ │ │ │ -
1393
│ │ │ │ -
1394 perm.resize(size);
│ │ │ │ -
1395
│ │ │ │ -
1396 typename std::vector<size_type*>::iterator it = perm.begin();
│ │ │ │ -
1397 for (size_type* iit = begin; iit < begin + size; ++iit, ++it)
│ │ │ │ -
1398 *it = iit;
│ │ │ │ -
1399
│ │ │ │ -
1400 //sort permutation array
│ │ │ │ -
1401 std::sort(perm.begin(),perm.end(),PointerCompare<size_type>());
│ │ │ │ -
1402
│ │ │ │ -
1403 //change row window pointer to their new positions
│ │ │ │ -
1404 r[i].setindexptr(jiit);
│ │ │ │ -
1405 r[i].setptr(aiit);
│ │ │ │ -
1406
│ │ │ │ -
1407 for (it = perm.begin(); it != perm.end(); ++it)
│ │ │ │ -
1408 {
│ │ │ │ -
1409 //check whether there are elements in the overflow area which take precedence
│ │ │ │ -
1410 while ((oit!=overflow.end()) && (oit->first < std::make_pair(i,**it)))
│ │ │ │ -
1411 {
│ │ │ │ -
1412 //check whether there is enough memory to write to
│ │ │ │ -
1413 if (jiit > begin)
│ │ │ │ - │ │ │ │ -
1415 "Allocated memory for BCRSMatrix exhausted during compress()!"
│ │ │ │ -
1416 "Please increase either the average number of entries per row or the compressionBufferSize value."
│ │ │ │ -
1417 );
│ │ │ │ -
1418 //copy an element from the overflow area to the insertion position in a and j
│ │ │ │ -
1419 *jiit = oit->first.second;
│ │ │ │ -
1420 ++jiit;
│ │ │ │ -
1421 *aiit = oit->second;
│ │ │ │ -
1422 ++aiit;
│ │ │ │ -
1423 ++oit;
│ │ │ │ -
1424 r[i].setsize(r[i].getsize()+1);
│ │ │ │ -
1425 }
│ │ │ │ -
1426
│ │ │ │ -
1427 //check whether there is enough memory to write to
│ │ │ │ -
1428 if (jiit > begin)
│ │ │ │ - │ │ │ │ -
1430 "Allocated memory for BCRSMatrix exhausted during compress()!"
│ │ │ │ -
1431 "Please increase either the average number of entries per row or the compressionBufferSize value."
│ │ │ │ -
1432 );
│ │ │ │ -
1433
│ │ │ │ -
1434 //copy element from array
│ │ │ │ -
1435 *jiit = **it;
│ │ │ │ -
1436 ++jiit;
│ │ │ │ -
1437 B* apos = *it - j_.get() + a;
│ │ │ │ -
1438 *aiit = *apos;
│ │ │ │ -
1439 ++aiit;
│ │ │ │ -
1440 }
│ │ │ │ -
1441
│ │ │ │ -
1442 //copy remaining elements from the overflow area
│ │ │ │ -
1443 while ((oit!=overflow.end()) && (oit->first.first == i))
│ │ │ │ -
1444 {
│ │ │ │ -
1445 //check whether there is enough memory to write to
│ │ │ │ -
1446 if (jiit > begin)
│ │ │ │ - │ │ │ │ -
1448 "Allocated memory for BCRSMatrix exhausted during compress()!"
│ │ │ │ -
1449 "Please increase either the average number of entries per row or the compressionBufferSize value."
│ │ │ │ -
1450 );
│ │ │ │ -
1451
│ │ │ │ -
1452 //copy and element from the overflow area to the insertion position in a and j
│ │ │ │ -
1453 *jiit = oit->first.second;
│ │ │ │ -
1454 ++jiit;
│ │ │ │ -
1455 *aiit = oit->second;
│ │ │ │ -
1456 ++aiit;
│ │ │ │ -
1457 ++oit;
│ │ │ │ -
1458 r[i].setsize(r[i].getsize()+1);
│ │ │ │ -
1459 }
│ │ │ │ -
1460
│ │ │ │ -
1461 // update maximum row size
│ │ │ │ -
1462 if (r[i].getsize()>stats.maximum)
│ │ │ │ -
1463 stats.maximum = r[i].getsize();
│ │ │ │ -
1464 }
│ │ │ │ -
1465
│ │ │ │ -
1466 // overflow area may be cleared
│ │ │ │ -
1467 overflow.clear();
│ │ │ │ -
1468
│ │ │ │ -
1469 //determine average number of entries and memory usage
│ │ │ │ -
1470 std::ptrdiff_t diff = (r[n-1].getindexptr() + r[n-1].getsize() - j_.get());
│ │ │ │ -
1471 nnz_ = diff;
│ │ │ │ -
1472 stats.avg = (double) (nnz_) / (double) n;
│ │ │ │ -
1473 stats.mem_ratio = (double) (nnz_) / (double) allocationSize_;
│ │ │ │ -
1474
│ │ │ │ -
1475 //matrix is now built
│ │ │ │ -
1476 ready = built;
│ │ │ │ -
1477
│ │ │ │ -
1478 return stats;
│ │ │ │ -
1479 }
│ │ │ │ -
│ │ │ │ -
1480
│ │ │ │ -
1481 //===== vector space arithmetic
│ │ │ │ -
1482
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1485 {
│ │ │ │ -
1486#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1487 if (ready != built)
│ │ │ │ -
1488 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1489#endif
│ │ │ │ -
1490
│ │ │ │ -
1491 if (nnz_ > 0)
│ │ │ │ -
1492 {
│ │ │ │ -
1493 // process 1D array
│ │ │ │ -
1494 for (size_type i=0; i<nnz_; i++)
│ │ │ │ -
1495 a[i] *= k;
│ │ │ │ -
1496 }
│ │ │ │ -
1497 else
│ │ │ │ -
1498 {
│ │ │ │ -
1499 RowIterator endi=end();
│ │ │ │ -
1500 for (RowIterator i=begin(); i!=endi; ++i)
│ │ │ │ -
1501 {
│ │ │ │ -
1502 ColIterator endj = (*i).end();
│ │ │ │ -
1503 for (ColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1504 (*j) *= k;
│ │ │ │ -
1505 }
│ │ │ │ -
1506 }
│ │ │ │ -
1507
│ │ │ │ -
1508 return *this;
│ │ │ │ -
1509 }
│ │ │ │ -
│ │ │ │ -
1510
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1513 {
│ │ │ │ -
1514#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1515 if (ready != built)
│ │ │ │ -
1516 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1517#endif
│ │ │ │ -
1518
│ │ │ │ -
1519 if (nnz_ > 0)
│ │ │ │ -
1520 {
│ │ │ │ -
1521 // process 1D array
│ │ │ │ -
1522 for (size_type i=0; i<nnz_; i++)
│ │ │ │ -
1523 a[i] /= k;
│ │ │ │ -
1524 }
│ │ │ │ -
1525 else
│ │ │ │ -
1526 {
│ │ │ │ -
1527 RowIterator endi=end();
│ │ │ │ -
1528 for (RowIterator i=begin(); i!=endi; ++i)
│ │ │ │ -
1529 {
│ │ │ │ -
1530 ColIterator endj = (*i).end();
│ │ │ │ -
1531 for (ColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1532 (*j) /= k;
│ │ │ │ -
1533 }
│ │ │ │ -
1534 }
│ │ │ │ -
1535
│ │ │ │ -
1536 return *this;
│ │ │ │ -
1537 }
│ │ │ │ -
│ │ │ │ -
1538
│ │ │ │ -
1539
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1546 {
│ │ │ │ -
1547#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1548 if (ready != built || b.ready != built)
│ │ │ │ -
1549 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1550 if(N()!=b.N() || M() != b.M())
│ │ │ │ -
1551 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ -
1552#endif
│ │ │ │ -
1553 RowIterator endi=end();
│ │ │ │ -
1554 ConstRowIterator j=b.begin();
│ │ │ │ -
1555 for (RowIterator i=begin(); i!=endi; ++i, ++j) {
│ │ │ │ -
1556 i->operator+=(*j);
│ │ │ │ -
1557 }
│ │ │ │ -
1558
│ │ │ │ -
1559 return *this;
│ │ │ │ -
1560 }
│ │ │ │ -
│ │ │ │ -
1561
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1568 {
│ │ │ │ -
1569#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1570 if (ready != built || b.ready != built)
│ │ │ │ -
1571 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1572 if(N()!=b.N() || M() != b.M())
│ │ │ │ -
1573 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ -
1574#endif
│ │ │ │ -
1575 RowIterator endi=end();
│ │ │ │ -
1576 ConstRowIterator j=b.begin();
│ │ │ │ -
1577 for (RowIterator i=begin(); i!=endi; ++i, ++j) {
│ │ │ │ -
1578 i->operator-=(*j);
│ │ │ │ -
1579 }
│ │ │ │ -
1580
│ │ │ │ -
1581 return *this;
│ │ │ │ -
1582 }
│ │ │ │ -
│ │ │ │ -
1583
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1593 {
│ │ │ │ -
1594#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1595 if (ready != built || b.ready != built)
│ │ │ │ -
1596 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1597 if(N()!=b.N() || M() != b.M())
│ │ │ │ -
1598 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ -
1599#endif
│ │ │ │ -
1600 RowIterator endi=end();
│ │ │ │ -
1601 ConstRowIterator j=b.begin();
│ │ │ │ -
1602 for(RowIterator i=begin(); i!=endi; ++i, ++j)
│ │ │ │ -
1603 i->axpy(alpha, *j);
│ │ │ │ -
1604
│ │ │ │ -
1605 return *this;
│ │ │ │ -
1606 }
│ │ │ │ -
│ │ │ │ -
1607
│ │ │ │ -
1608 //===== linear maps
│ │ │ │ -
1609
│ │ │ │ -
1611 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1612 void mv (const X& x, Y& y) const
│ │ │ │ -
1613 {
│ │ │ │ -
1614#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1615 if (ready != built)
│ │ │ │ -
1616 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1617 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,
│ │ │ │ -
1618 "Size mismatch: M: " << N() << "x" << M() << " x: " << x.N());
│ │ │ │ -
1619 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,
│ │ │ │ -
1620 "Size mismatch: M: " << N() << "x" << M() << " y: " << y.N());
│ │ │ │ -
1621#endif
│ │ │ │ -
1622 ConstRowIterator endi=end();
│ │ │ │ -
1623 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1624 {
│ │ │ │ -
1625 y[i.index()]=0;
│ │ │ │ -
1626 ConstColIterator endj = (*i).end();
│ │ │ │ -
1627 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1628 {
│ │ │ │ -
1629 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ -
1630 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ -
1631 Impl::asMatrix(*j).umv(xj, yi);
│ │ │ │ -
1632 }
│ │ │ │ -
1633 }
│ │ │ │ -
1634 }
│ │ │ │ -
│ │ │ │ -
1635
│ │ │ │ -
1637 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1638 void umv (const X& x, Y& y) const
│ │ │ │ -
1639 {
│ │ │ │ -
1640#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1641 if (ready != built)
│ │ │ │ -
1642 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1643 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1644 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1645#endif
│ │ │ │ -
1646 ConstRowIterator endi=end();
│ │ │ │ -
1647 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1648 {
│ │ │ │ -
1649 ConstColIterator endj = (*i).end();
│ │ │ │ -
1650 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1651 {
│ │ │ │ -
1652 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ -
1653 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ -
1654 Impl::asMatrix(*j).umv(xj,yi);
│ │ │ │ -
1655 }
│ │ │ │ -
1656 }
│ │ │ │ -
1657 }
│ │ │ │ -
│ │ │ │ -
1658
│ │ │ │ -
1660 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1661 void mmv (const X& x, Y& y) const
│ │ │ │ -
1662 {
│ │ │ │ -
1663#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1664 if (ready != built)
│ │ │ │ -
1665 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1666 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1667 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1668#endif
│ │ │ │ -
1669 ConstRowIterator endi=end();
│ │ │ │ -
1670 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1671 {
│ │ │ │ -
1672 ConstColIterator endj = (*i).end();
│ │ │ │ -
1673 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1674 {
│ │ │ │ -
1675 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ -
1676 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ -
1677 Impl::asMatrix(*j).mmv(xj,yi);
│ │ │ │ -
1678 }
│ │ │ │ -
1679 }
│ │ │ │ -
1680 }
│ │ │ │ -
│ │ │ │ -
1681
│ │ │ │ -
1683 template<class X, class Y, class F>
│ │ │ │ -
│ │ │ │ -
1684 void usmv (F&& alpha, const X& x, Y& y) const
│ │ │ │ -
1685 {
│ │ │ │ -
1686#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1687 if (ready != built)
│ │ │ │ -
1688 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1689 if (x.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1690 if (y.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1691#endif
│ │ │ │ -
1692 ConstRowIterator endi=end();
│ │ │ │ -
1693 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1694 {
│ │ │ │ -
1695 ConstColIterator endj = (*i).end();
│ │ │ │ -
1696 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1697 {
│ │ │ │ -
1698 auto&& xj = Impl::asVector(x[j.index()]);
│ │ │ │ -
1699 auto&& yi = Impl::asVector(y[i.index()]);
│ │ │ │ -
1700 Impl::asMatrix(*j).usmv(alpha,xj,yi);
│ │ │ │ -
1701 }
│ │ │ │ -
1702 }
│ │ │ │ -
1703 }
│ │ │ │ -
│ │ │ │ -
1704
│ │ │ │ -
1706 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1707 void mtv (const X& x, Y& y) const
│ │ │ │ -
1708 {
│ │ │ │ -
1709#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1710 if (ready != built)
│ │ │ │ -
1711 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1712 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1713 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1714#endif
│ │ │ │ -
1715 for(size_type i=0; i<y.N(); ++i)
│ │ │ │ -
1716 y[i]=0;
│ │ │ │ -
1717 umtv(x,y);
│ │ │ │ -
1718 }
│ │ │ │ -
│ │ │ │ -
1719
│ │ │ │ -
1721 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1722 void umtv (const X& x, Y& y) const
│ │ │ │ -
1723 {
│ │ │ │ -
1724#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1725 if (ready != built)
│ │ │ │ -
1726 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1727 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1728 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1729#endif
│ │ │ │ -
1730 ConstRowIterator endi=end();
│ │ │ │ -
1731 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1732 {
│ │ │ │ -
1733 ConstColIterator endj = (*i).end();
│ │ │ │ -
1734 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1735 {
│ │ │ │ -
1736 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ -
1737 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ -
1738 Impl::asMatrix(*j).umtv(xi,yj);
│ │ │ │ -
1739 }
│ │ │ │ -
1740 }
│ │ │ │ -
1741 }
│ │ │ │ -
│ │ │ │ -
1742
│ │ │ │ -
1744 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1745 void mmtv (const X& x, Y& y) const
│ │ │ │ -
1746 {
│ │ │ │ -
1747#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1748 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1749 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1750#endif
│ │ │ │ -
1751 ConstRowIterator endi=end();
│ │ │ │ -
1752 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1753 {
│ │ │ │ -
1754 ConstColIterator endj = (*i).end();
│ │ │ │ -
1755 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1756 {
│ │ │ │ -
1757 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ -
1758 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ -
1759 Impl::asMatrix(*j).mmtv(xi,yj);
│ │ │ │ -
1760 }
│ │ │ │ -
1761 }
│ │ │ │ -
1762 }
│ │ │ │ -
│ │ │ │ -
1763
│ │ │ │ -
1765 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1766 void usmtv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ -
1767 {
│ │ │ │ -
1768#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1769 if (ready != built)
│ │ │ │ -
1770 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1771 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1772 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1773#endif
│ │ │ │ -
1774 ConstRowIterator endi=end();
│ │ │ │ -
1775 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1776 {
│ │ │ │ -
1777 ConstColIterator endj = (*i).end();
│ │ │ │ -
1778 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1779 {
│ │ │ │ -
1780 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ -
1781 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ -
1782 Impl::asMatrix(*j).usmtv(alpha,xi,yj);
│ │ │ │ -
1783 }
│ │ │ │ -
1784 }
│ │ │ │ -
1785 }
│ │ │ │ -
│ │ │ │ -
1786
│ │ │ │ -
1788 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1789 void umhv (const X& x, Y& y) const
│ │ │ │ -
1790 {
│ │ │ │ -
1791#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1792 if (ready != built)
│ │ │ │ -
1793 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1794 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1795 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1796#endif
│ │ │ │ -
1797 ConstRowIterator endi=end();
│ │ │ │ -
1798 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1799 {
│ │ │ │ -
1800 ConstColIterator endj = (*i).end();
│ │ │ │ -
1801 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1802 {
│ │ │ │ -
1803 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ -
1804 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ -
1805 Impl::asMatrix(*j).umhv(xi,yj);
│ │ │ │ -
1806 }
│ │ │ │ -
1807 }
│ │ │ │ -
1808 }
│ │ │ │ -
│ │ │ │ -
1809
│ │ │ │ -
1811 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1812 void mmhv (const X& x, Y& y) const
│ │ │ │ -
1813 {
│ │ │ │ -
1814#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1815 if (ready != built)
│ │ │ │ -
1816 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1817 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1818 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1819#endif
│ │ │ │ -
1820 ConstRowIterator endi=end();
│ │ │ │ -
1821 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1822 {
│ │ │ │ -
1823 ConstColIterator endj = (*i).end();
│ │ │ │ -
1824 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1825 {
│ │ │ │ -
1826 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ -
1827 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ -
1828 Impl::asMatrix(*j).mmhv(xi,yj);
│ │ │ │ -
1829 }
│ │ │ │ -
1830 }
│ │ │ │ -
1831 }
│ │ │ │ -
│ │ │ │ -
1832
│ │ │ │ -
1834 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
1835 void usmhv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ -
1836 {
│ │ │ │ -
1837#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1838 if (ready != built)
│ │ │ │ -
1839 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1840 if (x.N()!=N()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1841 if (y.N()!=M()) DUNE_THROW(BCRSMatrixError,"index out of range");
│ │ │ │ -
1842#endif
│ │ │ │ -
1843 ConstRowIterator endi=end();
│ │ │ │ -
1844 for (ConstRowIterator i=this->begin(); i!=endi; ++i)
│ │ │ │ -
1845 {
│ │ │ │ -
1846 ConstColIterator endj = (*i).end();
│ │ │ │ -
1847 for (ConstColIterator j=(*i).begin(); j!=endj; ++j)
│ │ │ │ -
1848 {
│ │ │ │ -
1849 auto&& xi = Impl::asVector(x[i.index()]);
│ │ │ │ -
1850 auto&& yj = Impl::asVector(y[j.index()]);
│ │ │ │ -
1851 Impl::asMatrix(*j).usmhv(alpha,xi,yj);
│ │ │ │ -
1852 }
│ │ │ │ -
1853 }
│ │ │ │ -
1854 }
│ │ │ │ -
│ │ │ │ -
1855
│ │ │ │ -
1856
│ │ │ │ -
1857 //===== norms
│ │ │ │ -
1858
│ │ │ │ -
│ │ │ │ -
1860 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ │ -
1861 {
│ │ │ │ -
1862#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1863 if (ready != built)
│ │ │ │ -
1864 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1865#endif
│ │ │ │ -
1866
│ │ │ │ -
1867 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
1868
│ │ │ │ -
1869 for (auto&& row : (*this))
│ │ │ │ -
1870 for (auto&& entry : row)
│ │ │ │ -
1871 sum += Impl::asMatrix(entry).frobenius_norm2();
│ │ │ │ -
1872
│ │ │ │ -
1873 return sum;
│ │ │ │ -
1874 }
│ │ │ │ -
│ │ │ │ -
1875
│ │ │ │ -
│ │ │ │ -
1877 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ -
1878 {
│ │ │ │ -
1879 return sqrt(frobenius_norm2());
│ │ │ │ -
1880 }
│ │ │ │ -
│ │ │ │ -
1881
│ │ │ │ -
1883 template <typename ft = field_type,
│ │ │ │ -
1884 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
1885 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
1886 if (ready != built)
│ │ │ │ -
1887 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1888
│ │ │ │ -
1889 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
1890 using std::max;
│ │ │ │ -
1891
│ │ │ │ -
1892 real_type norm = 0;
│ │ │ │ -
1893 for (auto const &x : *this) {
│ │ │ │ -
1894 real_type sum = 0;
│ │ │ │ -
1895 for (auto const &y : x)
│ │ │ │ -
1896 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ -
1897 norm = max(sum, norm);
│ │ │ │ -
1898 }
│ │ │ │ -
1899 return norm;
│ │ │ │ -
1900 }
│ │ │ │ -
│ │ │ │ -
1901
│ │ │ │ -
1903 template <typename ft = field_type,
│ │ │ │ -
1904 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
1905 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
1906 if (ready != built)
│ │ │ │ -
1907 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1908
│ │ │ │ -
1909 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
1910 using std::max;
│ │ │ │ -
1911
│ │ │ │ -
1912 real_type norm = 0;
│ │ │ │ -
1913 for (auto const &x : *this) {
│ │ │ │ -
1914 real_type sum = 0;
│ │ │ │ -
1915 for (auto const &y : x)
│ │ │ │ -
1916 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ -
1917 norm = max(sum, norm);
│ │ │ │ -
1918 }
│ │ │ │ -
1919 return norm;
│ │ │ │ -
1920 }
│ │ │ │ -
│ │ │ │ -
1921
│ │ │ │ -
1923 template <typename ft = field_type,
│ │ │ │ -
1924 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
1925 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
1926 if (ready != built)
│ │ │ │ -
1927 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1928
│ │ │ │ -
1929 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
1930 using std::max;
│ │ │ │ -
1931
│ │ │ │ -
1932 real_type norm = 0;
│ │ │ │ -
1933 real_type isNaN = 1;
│ │ │ │ -
1934 for (auto const &x : *this) {
│ │ │ │ -
1935 real_type sum = 0;
│ │ │ │ -
1936 for (auto const &y : x)
│ │ │ │ -
1937 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ -
1938 norm = max(sum, norm);
│ │ │ │ -
1939 isNaN += sum;
│ │ │ │ -
1940 }
│ │ │ │ -
1941
│ │ │ │ -
1942 return norm * (isNaN / isNaN);
│ │ │ │ -
1943 }
│ │ │ │ -
│ │ │ │ -
1944
│ │ │ │ -
1946 template <typename ft = field_type,
│ │ │ │ -
1947 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
1948 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
1949 if (ready != built)
│ │ │ │ -
1950 DUNE_THROW(BCRSMatrixError,"You can only call arithmetic operations on fully built BCRSMatrix instances");
│ │ │ │ -
1951
│ │ │ │ -
1952 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
1953 using std::max;
│ │ │ │ -
1954
│ │ │ │ -
1955 real_type norm = 0;
│ │ │ │ -
1956 real_type isNaN = 1;
│ │ │ │ -
1957
│ │ │ │ -
1958 for (auto const &x : *this) {
│ │ │ │ -
1959 real_type sum = 0;
│ │ │ │ -
1960 for (auto const &y : x)
│ │ │ │ -
1961 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ -
1962 norm = max(sum, norm);
│ │ │ │ -
1963 isNaN += sum;
│ │ │ │ -
1964 }
│ │ │ │ -
1965
│ │ │ │ -
1966 return norm * (isNaN / isNaN);
│ │ │ │ -
1967 }
│ │ │ │ -
│ │ │ │ -
1968
│ │ │ │ -
1969 //===== sizes
│ │ │ │ -
1970
│ │ │ │ -
│ │ │ │ -
1972 size_type N () const
│ │ │ │ -
1973 {
│ │ │ │ -
1974 return n;
│ │ │ │ -
1975 }
│ │ │ │ -
│ │ │ │ -
1976
│ │ │ │ -
│ │ │ │ -
1978 size_type M () const
│ │ │ │ -
1979 {
│ │ │ │ -
1980 return m;
│ │ │ │ -
1981 }
│ │ │ │ -
│ │ │ │ -
1982
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1985 {
│ │ │ │ -
1986 // in case of row-wise allocation
│ │ │ │ -
1987 if( nnz_ <= 0 )
│ │ │ │ -
1988 nnz_ = std::accumulate( begin(), end(), size_type( 0 ), [] ( size_type s, const row_type &row ) { return s+row.getsize(); } );
│ │ │ │ -
1989 return nnz_;
│ │ │ │ -
1990 }
│ │ │ │ -
│ │ │ │ -
1991
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
1994 {
│ │ │ │ -
1995 return ready;
│ │ │ │ -
1996 }
│ │ │ │ -
│ │ │ │ -
1997
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2000 {
│ │ │ │ -
2001 return build_mode;
│ │ │ │ -
2002 }
│ │ │ │ -
│ │ │ │ -
2003
│ │ │ │ -
2004 //===== query
│ │ │ │ -
2005
│ │ │ │ -
│ │ │ │ -
2007 bool exists (size_type i, size_type j) const
│ │ │ │ -
2008 {
│ │ │ │ -
2009#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
2010 if (i<0 || i>=n) DUNE_THROW(BCRSMatrixError,"row index out of range");
│ │ │ │ -
2011 if (j<0 || j>=m) DUNE_THROW(BCRSMatrixError,"column index out of range");
│ │ │ │ -
2012#endif
│ │ │ │ -
2013 return (r[i].size() && r[i].find(j) != r[i].end());
│ │ │ │ -
2014 }
│ │ │ │ -
│ │ │ │ -
2015
│ │ │ │ -
2016
│ │ │ │ -
2017 protected:
│ │ │ │ -
2018 // state information
│ │ │ │ -
2019 BuildMode build_mode; // row wise or whole matrix
│ │ │ │ -
2020 BuildStage ready; // indicate the stage the matrix building is in
│ │ │ │ -
2021
│ │ │ │ -
2022 // The allocator used for memory management
│ │ │ │ -
2023 typename std::allocator_traits<A>::template rebind_alloc<B> allocator_;
│ │ │ │ -
2024
│ │ │ │ -
2025 typename std::allocator_traits<A>::template rebind_alloc<row_type> rowAllocator_;
│ │ │ │ -
2026
│ │ │ │ -
2027 typename std::allocator_traits<A>::template rebind_alloc<size_type> sizeAllocator_;
│ │ │ │ -
2028
│ │ │ │ -
2029 // size of the matrix
│ │ │ │ -
2030 size_type n; // number of rows
│ │ │ │ -
2031 size_type m; // number of columns
│ │ │ │ -
2032 mutable size_type nnz_; // number of nonzeroes contained in the matrix
│ │ │ │ -
2033 size_type allocationSize_; //allocated size of a and j arrays, except in implicit mode: nnz_==allocationsSize_
│ │ │ │ -
2034 // zero means that memory is allocated separately for each row.
│ │ │ │ -
2035
│ │ │ │ -
2036 // the rows are dynamically allocated
│ │ │ │ -
2037 row_type* r; // [n] the individual rows having pointers into a,j arrays
│ │ │ │ -
2038
│ │ │ │ -
2039 // dynamically allocated memory
│ │ │ │ -
2040 B* a; // [allocationSize] non-zero entries of the matrix in row-wise ordering
│ │ │ │ -
2041 // If a single array of column indices is used, it can be shared
│ │ │ │ -
2042 // between different matrices with the same sparsity pattern
│ │ │ │ -
2043 std::shared_ptr<size_type> j_; // [allocationSize] column indices of entries
│ │ │ │ -
2044
│ │ │ │ -
2045 // additional data is needed in implicit buildmode
│ │ │ │ - │ │ │ │ - │ │ │ │ -
2048
│ │ │ │ -
2049 typedef std::map<std::pair<size_type,size_type>, B> OverflowType;
│ │ │ │ - │ │ │ │ -
2051
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2053 {
│ │ │ │ -
2054 row_type current_row(a,j_.get(),0); // Pointers to current row data
│ │ │ │ -
2055 for (size_type i=0; i<n; i++, ++row) {
│ │ │ │ -
2056 // set row i
│ │ │ │ -
2057 size_type s = row->getsize();
│ │ │ │ -
2058
│ │ │ │ -
2059 if (s>0) {
│ │ │ │ -
2060 // setup pointers and size
│ │ │ │ -
2061 r[i].set(s,current_row.getptr(), current_row.getindexptr());
│ │ │ │ -
2062 // update pointer for next row
│ │ │ │ -
2063 current_row.setptr(current_row.getptr()+s);
│ │ │ │ -
2064 current_row.setindexptr(current_row.getindexptr()+s);
│ │ │ │ -
2065 } else{
│ │ │ │ -
2066 // empty row
│ │ │ │ -
2067 r[i].set(0,nullptr,nullptr);
│ │ │ │ -
2068 }
│ │ │ │ -
2069 }
│ │ │ │ -
2070 }
│ │ │ │ -
│ │ │ │ -
2071
│ │ │ │ -
2073
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2078 {
│ │ │ │ -
2079 size_type* jptr = j_.get();
│ │ │ │ -
2080 for (size_type i=0; i<n; ++i, ++row) {
│ │ │ │ -
2081 // set row i
│ │ │ │ -
2082 size_type s = row->getsize();
│ │ │ │ -
2083
│ │ │ │ -
2084 if (s>0) {
│ │ │ │ -
2085 // setup pointers and size
│ │ │ │ -
2086 r[i].setsize(s);
│ │ │ │ -
2087 r[i].setindexptr(jptr);
│ │ │ │ -
2088 } else{
│ │ │ │ -
2089 // empty row
│ │ │ │ -
2090 r[i].set(0,nullptr,nullptr);
│ │ │ │ -
2091 }
│ │ │ │ -
2092
│ │ │ │ -
2093 // advance position in global array
│ │ │ │ -
2094 jptr += s;
│ │ │ │ -
2095 }
│ │ │ │ -
2096 }
│ │ │ │ -
│ │ │ │ -
2097
│ │ │ │ -
2099
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2104 {
│ │ │ │ -
2105 B* aptr = a;
│ │ │ │ -
2106 for (size_type i=0; i<n; ++i) {
│ │ │ │ -
2107 // set row i
│ │ │ │ -
2108 if (r[i].getsize() > 0) {
│ │ │ │ -
2109 // setup pointers and size
│ │ │ │ -
2110 r[i].setptr(aptr);
│ │ │ │ -
2111 } else{
│ │ │ │ -
2112 // empty row
│ │ │ │ -
2113 r[i].set(0,nullptr,nullptr);
│ │ │ │ -
2114 }
│ │ │ │ -
2115
│ │ │ │ -
2116 // advance position in global array
│ │ │ │ -
2117 aptr += r[i].getsize();
│ │ │ │ -
2118 }
│ │ │ │ -
2119 }
│ │ │ │ -
│ │ │ │ -
2120
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2123 {
│ │ │ │ -
2124 setWindowPointers(Mat.begin());
│ │ │ │ -
2125
│ │ │ │ -
2126 // copy data
│ │ │ │ -
2127 for (size_type i=0; i<n; i++) r[i] = Mat.r[i];
│ │ │ │ -
2128
│ │ │ │ -
2129 // finish off
│ │ │ │ -
2130 build_mode = row_wise; // dummy
│ │ │ │ -
2131 ready = built;
│ │ │ │ -
2132 }
│ │ │ │ -
│ │ │ │ -
2133
│ │ │ │ -
│ │ │ │ -
2139 void deallocate(bool deallocateRows=true)
│ │ │ │ -
2140 {
│ │ │ │ -
2141
│ │ │ │ -
2142 if (notAllocated)
│ │ │ │ -
2143 return;
│ │ │ │ -
2144
│ │ │ │ -
2145 if (allocationSize_>0)
│ │ │ │ -
2146 {
│ │ │ │ -
2147 // a,j_ have been allocated as one long vector
│ │ │ │ -
2148 j_.reset();
│ │ │ │ -
2149 if (a)
│ │ │ │ -
2150 {
│ │ │ │ -
2151 for(B *aiter=a+(allocationSize_-1), *aend=a-1; aiter!=aend; --aiter)
│ │ │ │ -
2152 std::allocator_traits<decltype(allocator_)>::destroy(allocator_, aiter);
│ │ │ │ -
2153 allocator_.deallocate(a,allocationSize_);
│ │ │ │ -
2154 a = nullptr;
│ │ │ │ -
2155 }
│ │ │ │ -
2156 }
│ │ │ │ -
2157 else if (r)
│ │ │ │ -
2158 {
│ │ │ │ -
2159 // check if memory for rows have been allocated individually
│ │ │ │ -
2160 for (size_type i=0; i<n; i++)
│ │ │ │ -
2161 if (r[i].getsize()>0)
│ │ │ │ -
2162 {
│ │ │ │ -
2163 for (B *col=r[i].getptr()+(r[i].getsize()-1),
│ │ │ │ -
2164 *colend = r[i].getptr()-1; col!=colend; --col) {
│ │ │ │ -
2165 std::allocator_traits<decltype(allocator_)>::destroy(allocator_, col);
│ │ │ │ -
2166 }
│ │ │ │ -
2167 sizeAllocator_.deallocate(r[i].getindexptr(),1);
│ │ │ │ -
2168 allocator_.deallocate(r[i].getptr(),1);
│ │ │ │ -
2169 // clear out row data in case we don't want to deallocate the rows
│ │ │ │ -
2170 // otherwise we might run into a double free problem here later
│ │ │ │ -
2171 r[i].set(0,nullptr,nullptr);
│ │ │ │ -
2172 }
│ │ │ │ -
2173 }
│ │ │ │ -
2174
│ │ │ │ -
2175 // deallocate the rows
│ │ │ │ -
2176 if (n>0 && deallocateRows && r) {
│ │ │ │ -
2177 for(row_type *riter=r+(n-1), *rend=r-1; riter!=rend; --riter)
│ │ │ │ -
2178 std::allocator_traits<decltype(rowAllocator_)>::destroy(rowAllocator_, riter);
│ │ │ │ -
2179 rowAllocator_.deallocate(r,n);
│ │ │ │ -
2180 r = nullptr;
│ │ │ │ -
2181 }
│ │ │ │ -
2182
│ │ │ │ -
2183 // Mark matrix as not built at all.
│ │ │ │ - │ │ │ │ -
2185
│ │ │ │ -
2186 }
│ │ │ │ -
│ │ │ │ -
2187
│ │ │ │ -
│ │ │ │ -
2205 void allocate(size_type rows, size_type columns, size_type allocationSize, bool allocateRows, bool allocate_data)
│ │ │ │ -
2206 {
│ │ │ │ -
2207 // Store size
│ │ │ │ -
2208 n = rows;
│ │ │ │ -
2209 m = columns;
│ │ │ │ -
2210 nnz_ = allocationSize;
│ │ │ │ -
2211 allocationSize_ = allocationSize;
│ │ │ │ -
2212
│ │ │ │ -
2213 // allocate rows
│ │ │ │ -
2214 if(allocateRows) {
│ │ │ │ -
2215 if (n>0) {
│ │ │ │ -
2216 if (r)
│ │ │ │ -
2217 DUNE_THROW(InvalidStateException,"Rows have already been allocated, cannot allocate a second time");
│ │ │ │ -
2218 r = rowAllocator_.allocate(rows);
│ │ │ │ -
2219 // initialize row entries
│ │ │ │ -
2220 for(row_type* ri=r; ri!=r+rows; ++ri)
│ │ │ │ -
2221 std::allocator_traits<decltype(rowAllocator_)>::construct(rowAllocator_, ri, row_type());
│ │ │ │ -
2222 }else{
│ │ │ │ -
2223 r = 0;
│ │ │ │ -
2224 }
│ │ │ │ -
2225 }
│ │ │ │ -
2226
│ │ │ │ -
2227 // allocate a and j_ array
│ │ │ │ -
2228 if (allocate_data)
│ │ │ │ -
2229 allocateData();
│ │ │ │ -
2230 // allocate column indices only if not yet present (enable sharing)
│ │ │ │ -
2231 if (allocationSize_>0) {
│ │ │ │ -
2232 // we copy allocator and size to the deleter since _j may outlive this class
│ │ │ │ -
2233 if (!j_.get())
│ │ │ │ -
2234 j_.reset(sizeAllocator_.allocate(allocationSize_),
│ │ │ │ -
2235 [alloc = sizeAllocator_, size = allocationSize_](auto ptr) mutable {
│ │ │ │ -
2236 alloc.deallocate(ptr, size);
│ │ │ │ -
2237 });
│ │ │ │ -
2238 }else{
│ │ │ │ -
2239 j_.reset();
│ │ │ │ -
2240 }
│ │ │ │ -
2241
│ │ │ │ -
2242 // Mark the matrix as not built.
│ │ │ │ -
2243 ready = building;
│ │ │ │ -
2244 }
│ │ │ │ -
│ │ │ │ -
2245
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2247 {
│ │ │ │ -
2248 if (a)
│ │ │ │ -
2249 DUNE_THROW(InvalidStateException,"Cannot allocate data array (already allocated)");
│ │ │ │ -
2250 if (allocationSize_>0) {
│ │ │ │ -
2251 a = allocator_.allocate(allocationSize_);
│ │ │ │ -
2252 // use placement new to call constructor that allocates
│ │ │ │ -
2253 // additional memory.
│ │ │ │ -
2254 new (a) B[allocationSize_];
│ │ │ │ -
2255 } else {
│ │ │ │ -
2256 a = nullptr;
│ │ │ │ -
2257 }
│ │ │ │ -
2258 }
│ │ │ │ -
│ │ │ │ -
2259
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
2266 {
│ │ │ │ -
2267 if (build_mode != implicit)
│ │ │ │ -
2268 DUNE_THROW(InvalidStateException,"implicit_allocate() may only be called in implicit build mode");
│ │ │ │ -
2269 if (ready != notAllocated)
│ │ │ │ -
2270 DUNE_THROW(InvalidStateException,"memory has already been allocated");
│ │ │ │ -
2271
│ │ │ │ -
2272 // check to make sure the user has actually set the parameters
│ │ │ │ -
2273 if (compressionBufferSize_ < 0)
│ │ │ │ -
2274 DUNE_THROW(InvalidStateException,"You have to set the implicit build mode parameters before starting to build the matrix");
│ │ │ │ -
2275 //calculate size of overflow region, add buffer for row sort!
│ │ │ │ - │ │ │ │ -
2277 allocationSize_ = _n*avg + osize;
│ │ │ │ -
2278
│ │ │ │ -
2279 allocate(_n, _m, allocationSize_,true,true);
│ │ │ │ -
2280
│ │ │ │ -
2281 //set row pointers correctly
│ │ │ │ -
2282 size_type* jptr = j_.get() + osize;
│ │ │ │ -
2283 B* aptr = a + osize;
│ │ │ │ -
2284 for (size_type i=0; i<n; i++)
│ │ │ │ -
2285 {
│ │ │ │ -
2286 r[i].set(0,aptr,jptr);
│ │ │ │ -
2287 jptr = jptr + avg;
│ │ │ │ -
2288 aptr = aptr + avg;
│ │ │ │ -
2289 }
│ │ │ │ -
2290
│ │ │ │ -
2291 ready = building;
│ │ │ │ -
2292 }
│ │ │ │ -
│ │ │ │ -
2293 };
│ │ │ │ -
│ │ │ │ -
2294
│ │ │ │ -
2295
│ │ │ │ -
2296 template<class B, class A>
│ │ │ │ -
│ │ │ │ -
2297 struct FieldTraits< BCRSMatrix<B, A> >
│ │ │ │ -
2298 {
│ │ │ │ - │ │ │ │ -
2300 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
2301 };
│ │ │ │ -
│ │ │ │ -
2302
│ │ │ │ -
2305} // end namespace
│ │ │ │ -
2306
│ │ │ │ -
2307#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.
│ │ │ │ -
Some handy generic functions for ISTL matrices.
│ │ │ │ - │ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
131
│ │ │ │ +
132 template<class V, class V1>
│ │ │ │ +
133 inline void
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
135 Vector& coarse,
│ │ │ │ +
136 const Vector& fine,
│ │ │ │ +
137 [[maybe_unused]] const SequentialInformation& comm)
│ │ │ │ +
138 {
│ │ │ │ +
139 // Set coarse vector to zero
│ │ │ │ +
140 coarse=0;
│ │ │ │ +
141
│ │ │ │ +
142 typedef typename Vector::const_iterator Iterator;
│ │ │ │ +
143 Iterator end = fine.end();
│ │ │ │ +
144 Iterator begin=fine.begin();
│ │ │ │ +
145
│ │ │ │ +
146 for(Iterator block=begin; block != end; ++block) {
│ │ │ │ +
147 const Vertex& vertex = aggregates[block-begin];
│ │ │ │ + │ │ │ │ +
149 coarse[vertex] += *block;
│ │ │ │ +
150 }
│ │ │ │ +
151 }
│ │ │ │ +
│ │ │ │ +
152
│ │ │ │ +
153#if HAVE_MPI
│ │ │ │ +
154 template<class V, class V1, class T1, class T2>
│ │ │ │ +
155 template<typename T3>
│ │ │ │ +
│ │ │ │ +
156 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::prolongateVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
157 Vector& coarse, Vector& fine,
│ │ │ │ +
158 Vector& fineRedist, T3 damp,
│ │ │ │ + │ │ │ │ +
160 const Redist& redist)
│ │ │ │ +
161 {
│ │ │ │ +
162 if(fineRedist.size()>0)
│ │ │ │ +
163 // we operated on the coarse level
│ │ │ │ +
164 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fineRedist, damp);
│ │ │ │ +
165
│ │ │ │ +
166 // TODO This could be accomplished with one communication, too!
│ │ │ │ +
167 redist.redistributeBackward(fine, fineRedist);
│ │ │ │ +
168 comm.copyOwnerToAll(fine,fine);
│ │ │ │ +
169 }
│ │ │ │ +
│ │ │ │ +
170
│ │ │ │ +
171 template<class V, class V1, class T1, class T2>
│ │ │ │ +
172 template<typename T3>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
174 const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
175 Vector& coarse, Vector& fine, T3 damp,
│ │ │ │ +
176 [[maybe_unused]] OwnerOverlapCopyCommunication<T1,T2>& comm)
│ │ │ │ +
177 {
│ │ │ │ +
178 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fine, damp);
│ │ │ │ +
179 }
│ │ │ │ +
│ │ │ │ +
180 template<class V, class V1, class T1, class T2>
│ │ │ │ +
│ │ │ │ +
181 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::restrictVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ │ +
182 Vector& coarse, const Vector& fine,
│ │ │ │ + │ │ │ │ +
184 {
│ │ │ │ + │ │ │ │ +
186 // We need this here to avoid it in the smoothers on the coarse level.
│ │ │ │ +
187 // There (in the preconditioner d is const.
│ │ │ │ +
188 comm.project(coarse);
│ │ │ │ +
189 }
│ │ │ │ +
│ │ │ │ +
190#endif
│ │ │ │ +
192 } // namspace Amg
│ │ │ │ +
193} // namspace Dune
│ │ │ │ +
194#endif
│ │ │ │ +
Functionality for redistributing a sparse matrix.
│ │ │ │ +
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...
│ │ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │ -
Definition matrixutils.hh:211
│ │ │ │ -
Statistics about compression achieved in implicit mode.
Definition bcrsmatrix.hh:88
│ │ │ │ -
size_type overflow_total
total number of elements written to the overflow area during construction.
Definition bcrsmatrix.hh:94
│ │ │ │ -
size_type maximum
maximum number of non-zeroes per row.
Definition bcrsmatrix.hh:92
│ │ │ │ -
double avg
average number of non-zeroes per row.
Definition bcrsmatrix.hh:90
│ │ │ │ -
double mem_ratio
fraction of wasted memory resulting from non-used overflow area.
Definition bcrsmatrix.hh:99
│ │ │ │ -
A wrapper for uniform access to the BCRSMatrix during and after the build stage in implicit build mod...
Definition bcrsmatrix.hh:117
│ │ │ │ -
Matrix::block_type block_type
The block_type of the underlying matrix.
Definition bcrsmatrix.hh:125
│ │ │ │ -
ImplicitMatrixBuilder(Matrix &m)
Creates an ImplicitMatrixBuilder for matrix m.
Definition bcrsmatrix.hh:170
│ │ │ │ -
M_ Matrix
The underlying matrix.
Definition bcrsmatrix.hh:122
│ │ │ │ -
ImplicitMatrixBuilder(Matrix &m, size_type rows, size_type cols, size_type avg_cols_per_row, double overflow_fraction)
Sets up matrix m for implicit construction using the given parameters and creates an ImplicitBmatrixu...
Definition bcrsmatrix.hh:194
│ │ │ │ -
size_type M() const
The number of columns in the matrix.
Definition bcrsmatrix.hh:217
│ │ │ │ -
Matrix::size_type size_type
The size_type of the underlying matrix.
Definition bcrsmatrix.hh:128
│ │ │ │ -
row_object operator[](size_type i) const
Returns a proxy for entries in row i.
Definition bcrsmatrix.hh:205
│ │ │ │ -
size_type N() const
The number of rows in the matrix.
Definition bcrsmatrix.hh:211
│ │ │ │ -
Proxy row object for entry access.
Definition bcrsmatrix.hh:137
│ │ │ │ -
block_type & operator[](size_type j) const
Returns entry in column j.
Definition bcrsmatrix.hh:142
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bcrsmatrix.hh:488
│ │ │ │ -
std::allocator_traits< A >::template rebind_alloc< row_type > rowAllocator_
Definition bcrsmatrix.hh:2025
│ │ │ │ -
bool exists(size_type i, size_type j) const
return true if (i,j) is in pattern
Definition bcrsmatrix.hh:2007
│ │ │ │ -
BuildStage buildStage() const
The current build stage of the matrix.
Definition bcrsmatrix.hh:1993
│ │ │ │ -
Iterator begin()
Get iterator to first row.
Definition bcrsmatrix.hh:675
│ │ │ │ -
void copyWindowStructure(const BCRSMatrix &Mat)
Copy the window structure from another matrix.
Definition bcrsmatrix.hh:2122
│ │ │ │ -
B & entry(size_type row, size_type col)
Returns reference to entry (row,col) of the matrix.
Definition bcrsmatrix.hh:1296
│ │ │ │ -
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition bcrsmatrix.hh:1812
│ │ │ │ -
void usmhv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition bcrsmatrix.hh:1835
│ │ │ │ -
void umtv(const X &x, Y &y) const
y += A^T x
Definition bcrsmatrix.hh:1722
│ │ │ │ -
double compressionBufferSize_
Definition bcrsmatrix.hh:2047
│ │ │ │ -
size_type m
Definition bcrsmatrix.hh:2031
│ │ │ │ -
RealRowIterator< const row_type > const_iterator
The const iterator over the matrix rows.
Definition bcrsmatrix.hh:707
│ │ │ │ -
static constexpr unsigned int blocklevel
increment block level counter
Definition bcrsmatrix.hh:507
│ │ │ │ -
void allocate(size_type rows, size_type columns, size_type allocationSize, bool allocateRows, bool allocate_data)
Allocate memory for the matrix structure.
Definition bcrsmatrix.hh:2205
│ │ │ │ -
BCRSMatrix & axpy(field_type alpha, const BCRSMatrix &b)
Add the scaled entries of another matrix to this one.
Definition bcrsmatrix.hh:1592
│ │ │ │ -
FieldTraits< ft >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition bcrsmatrix.hh:1905
│ │ │ │ -
~BCRSMatrix()
destructor
Definition bcrsmatrix.hh:824
│ │ │ │ -
void allocateData()
Definition bcrsmatrix.hh:2246
│ │ │ │ -
void deallocate(bool deallocateRows=true)
deallocate memory of the matrix.
Definition bcrsmatrix.hh:2139
│ │ │ │ -
Iterator RowIterator
rename the iterators for easier access
Definition bcrsmatrix.hh:701
│ │ │ │ -
row_type & operator[](size_type i)
random access to the rows
Definition bcrsmatrix.hh:549
│ │ │ │ -
BCRSMatrix()
an empty matrix
Definition bcrsmatrix.hh:749
│ │ │ │ -
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1149
│ │ │ │ -
void incrementrowsize(size_type i, size_type s=1)
increment size of row i by s (1 by default)
Definition bcrsmatrix.hh:1138
│ │ │ │ -
void mtv(const X &x, Y &y) const
y = A^T x
Definition bcrsmatrix.hh:1707
│ │ │ │ -
void umhv(const X &x, Y &y) const
y += A^H x
Definition bcrsmatrix.hh:1789
│ │ │ │ -
size_type nonzeroes() const
number of blocks that are stored (the number of blocks that possibly are nonzero)
Definition bcrsmatrix.hh:1984
│ │ │ │ -
size_type allocationSize_
Definition bcrsmatrix.hh:2033
│ │ │ │ -
ConstIterator ConstRowIterator
rename the const row iterator for easier access
Definition bcrsmatrix.hh:738
│ │ │ │ -
BuildStage ready
Definition bcrsmatrix.hh:2020
│ │ │ │ -
BuildMode build_mode
Definition bcrsmatrix.hh:2019
│ │ │ │ -
void setrowsize(size_type i, size_type s)
Set number of indices in row i to s.
Definition bcrsmatrix.hh:1117
│ │ │ │ -
RealRowIterator< row_type > Iterator
Definition bcrsmatrix.hh:672
│ │ │ │ -
size_type nnz_
Definition bcrsmatrix.hh:2032
│ │ │ │ -
BCRSMatrix & operator*=(const field_type &k)
vector space multiplication with scalar
Definition bcrsmatrix.hh:1484
│ │ │ │ -
std::allocator_traits< A >::template rebind_alloc< size_type > sizeAllocator_
Definition bcrsmatrix.hh:2027
│ │ │ │ -
RealRowIterator< row_type > iterator
The iterator over the (mutable matrix rows.
Definition bcrsmatrix.hh:671
│ │ │ │ -
void usmtv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition bcrsmatrix.hh:1766
│ │ │ │ -
ConstIterator beforeBegin() const
Definition bcrsmatrix.hh:732
│ │ │ │ -
RealRowIterator< const row_type > ConstIterator
Definition bcrsmatrix.hh:708
│ │ │ │ -
Iterator beforeBegin()
Definition bcrsmatrix.hh:695
│ │ │ │ -
B * a
Definition bcrsmatrix.hh:2040
│ │ │ │ -
BuildMode
we support two modes
Definition bcrsmatrix.hh:510
│ │ │ │ -
@ implicit
Build entries randomly with an educated guess for the number of entries per row.
Definition bcrsmatrix.hh:539
│ │ │ │ -
@ unknown
Build mode not set!
Definition bcrsmatrix.hh:543
│ │ │ │ -
@ random
Build entries randomly.
Definition bcrsmatrix.hh:530
│ │ │ │ -
@ row_wise
Build in a row-wise manner.
Definition bcrsmatrix.hh:521
│ │ │ │ -
BCRSMatrix(size_type _n, size_type _m, size_type _nnz, BuildMode bm)
matrix with known number of nonzeroes
Definition bcrsmatrix.hh:756
│ │ │ │ -
::Dune::CompressionStatistics< size_type > CompressionStatistics
The type for the statistics object returned by compress()
Definition bcrsmatrix.hh:503
│ │ │ │ -
BCRSMatrix & operator-=(const BCRSMatrix &b)
Subtract the entries of another matrix from this one.
Definition bcrsmatrix.hh:1567
│ │ │ │ -
BCRSMatrix(const BCRSMatrix &Mat)
copy constructor
Definition bcrsmatrix.hh:805
│ │ │ │ -
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:681
│ │ │ │ -
row_type * r
Definition bcrsmatrix.hh:2037
│ │ │ │ -
void setIndices(size_type row, It begin, It end)
Set all column indices for row from the given iterator range.
Definition bcrsmatrix.hh:1234
│ │ │ │ -
void addindex(size_type row, size_type col)
add index (row,col) to the matrix
Definition bcrsmatrix.hh:1191
│ │ │ │ -
std::map< std::pair< size_type, size_type >, B > OverflowType
Definition bcrsmatrix.hh:2049
│ │ │ │ -
row_type::Iterator ColIterator
Iterator for the entries of each row.
Definition bcrsmatrix.hh:704
│ │ │ │ -
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition bcrsmatrix.hh:1877
│ │ │ │ -
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ -
BCRSMatrix & operator/=(const field_type &k)
vector space division by scalar
Definition bcrsmatrix.hh:1512
│ │ │ │ -
OverflowType overflow
Definition bcrsmatrix.hh:2050
│ │ │ │ -
BCRSMatrix & operator+=(const BCRSMatrix &b)
Add the entries of another matrix to this one.
Definition bcrsmatrix.hh:1545
│ │ │ │ -
BCRSMatrix(size_type _n, size_type _m, size_type _avg, double compressionBufferSize, BuildMode bm)
construct matrix with a known average number of entries per row
Definition bcrsmatrix.hh:784
│ │ │ │ -
CreateIterator createend()
get create iterator pointing to one after the last block
Definition bcrsmatrix.hh:1103
│ │ │ │ -
FieldTraits< field_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition bcrsmatrix.hh:1860
│ │ │ │ -
Iterator beforeEnd()
Definition bcrsmatrix.hh:688
│ │ │ │ -
row_type::ConstIterator ConstColIterator
Const iterator to the entries of a row.
Definition bcrsmatrix.hh:741
│ │ │ │ -
void usmv(F &&alpha, const X &x, Y &y) const
y += alpha A x
Definition bcrsmatrix.hh:1684
│ │ │ │ -
size_type getrowsize(size_type i) const
get current number of indices in row i
Definition bcrsmatrix.hh:1128
│ │ │ │ -
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:1978
│ │ │ │ -
size_type n
Definition bcrsmatrix.hh:2030
│ │ │ │ -
Imp::CompressedBlockVectorWindow< B, A > row_type
implement row_type with compressed vector
Definition bcrsmatrix.hh:497
│ │ │ │ -
CreateIterator createbegin()
get initial create iterator
Definition bcrsmatrix.hh:1097
│ │ │ │ -
BuildStage
Definition bcrsmatrix.hh:469
│ │ │ │ -
@ rowSizesBuilt
The row sizes of the matrix are known.
Definition bcrsmatrix.hh:480
│ │ │ │ -
@ built
The matrix structure is fully built.
Definition bcrsmatrix.hh:482
│ │ │ │ -
@ notbuilt
Matrix is not built at all, no memory has been allocated, build mode and size can still be set.
Definition bcrsmatrix.hh:471
│ │ │ │ -
@ notAllocated
Matrix is not built at all, no memory has been allocated, build mode and size can still be set.
Definition bcrsmatrix.hh:473
│ │ │ │ -
@ building
Matrix is currently being built, some memory has been allocated, build mode and size are fixed.
Definition bcrsmatrix.hh:475
│ │ │ │ -
BuildMode buildMode() const
The currently selected build mode of the matrix.
Definition bcrsmatrix.hh:1999
│ │ │ │ -
void mmv(const X &x, Y &y) const
y -= A x
Definition bcrsmatrix.hh:1661
│ │ │ │ -
FieldTraits< ft >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition bcrsmatrix.hh:1885
│ │ │ │ -
void mv(const X &x, Y &y) const
y = A x
Definition bcrsmatrix.hh:1612
│ │ │ │ -
B block_type
export the type representing the components
Definition bcrsmatrix.hh:491
│ │ │ │ -
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition bcrsmatrix.hh:1745
│ │ │ │ -
size_type avg
Definition bcrsmatrix.hh:2046
│ │ │ │ -
void umv(const X &x, Y &y) const
y += A x
Definition bcrsmatrix.hh:1638
│ │ │ │ -
void implicit_allocate(size_type _n, size_type _m)
organizes allocation implicit mode calculates correct array size to be allocated and sets the the win...
Definition bcrsmatrix.hh:2265
│ │ │ │ -
void setImplicitBuildModeParameters(size_type _avg, double compressionBufferSize)
Set parameters needed for creation in implicit build mode.
Definition bcrsmatrix.hh:889
│ │ │ │ -
BCRSMatrix(size_type _n, size_type _m, BuildMode bm)
matrix with unknown number of nonzeroes
Definition bcrsmatrix.hh:765
│ │ │ │ -
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1248
│ │ │ │ -
CompressionStatistics compress()
Finishes the buildstage in implicit mode.
Definition bcrsmatrix.hh:1360
│ │ │ │ -
void setDataPointers()
Set data pointers for all rows.
Definition bcrsmatrix.hh:2103
│ │ │ │ -
std::allocator_traits< A >::template rebind_alloc< B > allocator_
Definition bcrsmatrix.hh:2023
│ │ │ │ -
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ -
void setBuildMode(BuildMode bm)
Sets the build mode of the matrix.
Definition bcrsmatrix.hh:833
│ │ │ │ -
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:861
│ │ │ │ -
std::shared_ptr< size_type > j_
Definition bcrsmatrix.hh:2043
│ │ │ │ -
void setWindowPointers(ConstRowIterator row)
Definition bcrsmatrix.hh:2052
│ │ │ │ -
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:911
│ │ │ │ -
void setColumnPointers(ConstRowIterator row)
Copy row sizes from iterator range starting at row and set column index pointers for all rows.
Definition bcrsmatrix.hh:2077
│ │ │ │ -
ConstIterator end() const
Get const iterator to one beyond last row.
Definition bcrsmatrix.hh:718
│ │ │ │ -
ConstIterator begin() const
Get const iterator to first row.
Definition bcrsmatrix.hh:712
│ │ │ │ -
A allocator_type
export the allocator type
Definition bcrsmatrix.hh:494
│ │ │ │ -
ConstIterator beforeEnd() const
Definition bcrsmatrix.hh:725
│ │ │ │ -
Iterator access to matrix rows
Definition bcrsmatrix.hh:579
│ │ │ │ -
RealRowIterator()
empty constructor, use with care!
Definition bcrsmatrix.hh:596
│ │ │ │ -
bool equals(const RealRowIterator< ValueType > &other) const
equality
Definition bcrsmatrix.hh:624
│ │ │ │ -
std::remove_const< T >::type ValueType
The unqualified value type.
Definition bcrsmatrix.hh:583
│ │ │ │ -
RealRowIterator(const RealRowIterator< ValueType > &it)
Definition bcrsmatrix.hh:600
│ │ │ │ -
bool equals(const RealRowIterator< const ValueType > &other) const
equality
Definition bcrsmatrix.hh:631
│ │ │ │ -
RealRowIterator(row_type *_p, size_type _i)
constructor
Definition bcrsmatrix.hh:591
│ │ │ │ -
std::ptrdiff_t distanceTo(const RealRowIterator< const ValueType > &other) const
Definition bcrsmatrix.hh:617
│ │ │ │ -
size_type index() const
return index
Definition bcrsmatrix.hh:606
│ │ │ │ -
std::ptrdiff_t distanceTo(const RealRowIterator< ValueType > &other) const
Definition bcrsmatrix.hh:611
│ │ │ │ -
Iterator class for sequential creation of blocks
Definition bcrsmatrix.hh:957
│ │ │ │ -
bool operator==(const CreateIterator &it) const
equality
Definition bcrsmatrix.hh:1052
│ │ │ │ -
CreateIterator & operator++()
prefix increment
Definition bcrsmatrix.hh:977
│ │ │ │ -
size_type index() const
The number of the row that the iterator currently points to.
Definition bcrsmatrix.hh:1058
│ │ │ │ -
bool operator!=(const CreateIterator &it) const
inequality
Definition bcrsmatrix.hh:1046
│ │ │ │ -
CreateIterator(BCRSMatrix &_Mat, size_type _i)
constructor
Definition bcrsmatrix.hh:960
│ │ │ │ -
void insert(size_type j)
put column index in row
Definition bcrsmatrix.hh:1064
│ │ │ │ -
bool contains(size_type j)
return true if column index is in row
Definition bcrsmatrix.hh:1070
│ │ │ │ -
size_type size() const
Get the current row size.
Definition bcrsmatrix.hh:1079
│ │ │ │ -
typename BCRSMatrix< B, A >::field_type field_type
Definition bcrsmatrix.hh:2299
│ │ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition bcrsmatrix.hh:2300
│ │ │ │ -
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
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ │ -
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ -
Definition matrixutils.hh:538
│ │ │ │ +
Definition matrixredistribute.hh:22
│ │ │ │ +
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:32
│ │ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ │ +
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition owneroverlapcopy.hh:538
│ │ │ │ +
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ │ +
Definition pinfo.hh:28
│ │ │ │ +
Definition transfer.hh:32
│ │ │ │ +
static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, const Vector &fine, T &comm)
│ │ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp)
│ │ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R())
│ │ │ │ +
V1 Vertex
Definition transfer.hh:35
│ │ │ │ +
V2 Vector
Definition transfer.hh:36
│ │ │ │ +
RedistributeInformation< SequentialInformation > Redist
Definition transfer.hh:56
│ │ │ │ + │ │ │ │ + │ │ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation &comm=SequentialInformation(), const Redist &redist=Redist())
│ │ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp, const SequentialInformation &comm=SequentialInformation())
│ │ │ │ + │ │ │ │ +
RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist
Definition transfer.hh:80
│ │ │ │ + │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,2387 +1,294 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -bcrsmatrix.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 (C) 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_BCRSMATRIX_HH │ │ │ │ │ -7#define DUNE_ISTL_BCRSMATRIX_HH │ │ │ │ │ -8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18 │ │ │ │ │ -19#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -20#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -21#include "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ │ -22#include │ │ │ │ │ -23#include │ │ │ │ │ -24#include │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27#include │ │ │ │ │ -28 │ │ │ │ │ -29#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -30 │ │ │ │ │ -35namespace _D_u_n_e { │ │ │ │ │ -36 │ │ │ │ │ -76 template │ │ │ │ │ -77 struct MatrixDimension; │ │ │ │ │ -78 │ │ │ │ │ -80 │ │ │ │ │ -86 template │ │ │ │ │ -_8_7 struct _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s │ │ │ │ │ -88 { │ │ │ │ │ -_9_0 double _a_v_g; │ │ │ │ │ -_9_2 size_type _m_a_x_i_m_u_m; │ │ │ │ │ -_9_4 size_type _o_v_e_r_f_l_o_w___t_o_t_a_l; │ │ │ │ │ -96 │ │ │ │ │ -_9_9 double _m_e_m___r_a_t_i_o; │ │ │ │ │ -100 }; │ │ │ │ │ -101 │ │ │ │ │ -103 │ │ │ │ │ -115 template │ │ │ │ │ -_1_1_6 class _I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ -117 { │ │ │ │ │ -118 │ │ │ │ │ -119 public: │ │ │ │ │ -120 │ │ │ │ │ -_1_2_2 typedef M_ _M_a_t_r_i_x; │ │ │ │ │ +5#ifndef DUNE_AMGTRANSFER_HH │ │ │ │ │ +6#define DUNE_AMGTRANSFER_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ +9#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_p_i_n_f_o_._h_h> │ │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ │ +13#include │ │ │ │ │ +14 │ │ │ │ │ +15namespace _D_u_n_e │ │ │ │ │ +16{ │ │ │ │ │ +17 namespace Amg │ │ │ │ │ +18 { │ │ │ │ │ +19 │ │ │ │ │ +30 template │ │ │ │ │ +_3_1 class _T_r_a_n_s_f_e_r │ │ │ │ │ +32 { │ │ │ │ │ +33 │ │ │ │ │ +34 public: │ │ │ │ │ +_3_5 typedef V1 _V_e_r_t_e_x; │ │ │ │ │ +_3_6 typedef V2 _V_e_c_t_o_r; │ │ │ │ │ +37 │ │ │ │ │ +38 template │ │ │ │ │ +_3_9 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +40 _V_e_c_t_o_r& fineRedist,T1 damp, R& redistributor=R()); │ │ │ │ │ +41 │ │ │ │ │ +42 template │ │ │ │ │ +_4_3 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +44 T1 damp); │ │ │ │ │ +45 │ │ │ │ │ +_4_6 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ │ +coarse, const _V_e_c_t_o_r& fine, │ │ │ │ │ +47 T& comm); │ │ │ │ │ +48 }; │ │ │ │ │ +49 │ │ │ │ │ +50 template │ │ │ │ │ +_5_1 class _T_r_a_n_s_f_e_r │ │ │ │ │ +52 { │ │ │ │ │ +53 public: │ │ │ │ │ +_5_4 typedef V _V_e_r_t_e_x; │ │ │ │ │ +_5_5 typedef V1 _V_e_c_t_o_r; │ │ │ │ │ +_5_6 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_> _R_e_d_i_s_t; │ │ │ │ │ +57 template │ │ │ │ │ +_5_8 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +59 _V_e_c_t_o_r& fineRedist, T1 damp, │ │ │ │ │ +60 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm=_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n(), │ │ │ │ │ +61 const _R_e_d_i_s_t& redist=_R_e_d_i_s_t()); │ │ │ │ │ +62 template │ │ │ │ │ +_6_3 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +64 T1 damp, │ │ │ │ │ +65 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm=_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ +66 │ │ │ │ │ +67 │ │ │ │ │ +68 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ │ +coarse, const _V_e_c_t_o_r& fine, │ │ │ │ │ +69 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm); │ │ │ │ │ +70 }; │ │ │ │ │ +71 │ │ │ │ │ +72#if HAVE_MPI │ │ │ │ │ +73 │ │ │ │ │ +74 template │ │ │ │ │ +_7_5 class _T_r_a_n_s_f_e_r > │ │ │ │ │ +76 { │ │ │ │ │ +77 public: │ │ │ │ │ +_7_8 typedef V _V_e_r_t_e_x; │ │ │ │ │ +_7_9 typedef V1 _V_e_c_t_o_r; │ │ │ │ │ +_8_0 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> > │ │ │ │ │ +_R_e_d_i_s_t; │ │ │ │ │ +81 template │ │ │ │ │ +82 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +83 _V_e_c_t_o_r& fineRedist, T3 damp, _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm, │ │ │ │ │ +84 const _R_e_d_i_s_t& redist); │ │ │ │ │ +85 template │ │ │ │ │ +86 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +87 T3 damp, _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm); │ │ │ │ │ +88 │ │ │ │ │ +89 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ │ +coarse, const _V_e_c_t_o_r& fine, │ │ │ │ │ +90 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm); │ │ │ │ │ +91 }; │ │ │ │ │ +92 │ │ │ │ │ +93#endif │ │ │ │ │ +94 │ │ │ │ │ +95 template │ │ │ │ │ +96 template │ │ │ │ │ +97 inline void │ │ │ │ │ +_9_8 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +99 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +100 [[maybe_unused]] _V_e_c_t_o_r& fineRedist, │ │ │ │ │ +101 T damp, │ │ │ │ │ +102 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm, │ │ │ │ │ +103 [[maybe_unused]] const _R_e_d_i_s_t& redist) │ │ │ │ │ +104 { │ │ │ │ │ +105 prolongateVector(aggregates, coarse, fine, damp); │ │ │ │ │ +106 } │ │ │ │ │ +107 template │ │ │ │ │ +108 template │ │ │ │ │ +109 inline void │ │ │ │ │ +_1_1_0 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +111 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +112 T damp, │ │ │ │ │ +113 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ │ +114 { │ │ │ │ │ +115 typedef typename Vector::iterator Iterator; │ │ │ │ │ +116 │ │ │ │ │ +117 Iterator end = coarse.end(); │ │ │ │ │ +118 Iterator begin= coarse.begin(); │ │ │ │ │ +119 for(; begin!=end; ++begin) │ │ │ │ │ +120 *begin*=damp; │ │ │ │ │ +121 end=fine.end(); │ │ │ │ │ +122 begin=fine.begin(); │ │ │ │ │ 123 │ │ │ │ │ -_1_2_5 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -126 │ │ │ │ │ -_1_2_8 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ │ -129 │ │ │ │ │ +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 │ │ │ │ │ -_1_3_6 class _r_o_w___o_b_j_e_c_t │ │ │ │ │ -137 { │ │ │ │ │ -138 │ │ │ │ │ -139 public: │ │ │ │ │ -140 │ │ │ │ │ -_1_4_2 _b_l_o_c_k___t_y_p_e& _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e j) const │ │ │ │ │ -143 { │ │ │ │ │ -144 return _m.entry(_i,j); │ │ │ │ │ -145 } │ │ │ │ │ -146 │ │ │ │ │ -147#ifndef DOXYGEN │ │ │ │ │ -148 │ │ │ │ │ -149 _r_o_w___o_b_j_e_c_t(_M_a_t_r_i_x& m, _s_i_z_e___t_y_p_e i) │ │ │ │ │ -150 : _m(m) │ │ │ │ │ -151 , _i(i) │ │ │ │ │ -152 {} │ │ │ │ │ -153 │ │ │ │ │ -154#endif │ │ │ │ │ -155 │ │ │ │ │ -156 private: │ │ │ │ │ -157 │ │ │ │ │ -158 _M_a_t_r_i_x& _m; │ │ │ │ │ -_1_5_9 _s_i_z_e___t_y_p_e _i; │ │ │ │ │ -160 │ │ │ │ │ -161 }; │ │ │ │ │ -162 │ │ │ │ │ -164 │ │ │ │ │ -_1_7_0 _I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r(_M_a_t_r_i_x& m) │ │ │ │ │ -171 : _m(m) │ │ │ │ │ -172 { │ │ │ │ │ -173 if (m.buildMode() != Matrix::implicit) │ │ │ │ │ -174 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only create an ImplicitBuilder for a │ │ │ │ │ -matrix in implicit build mode"); │ │ │ │ │ -175 if (m.buildStage() != Matrix::building) │ │ │ │ │ -176 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only create an ImplicitBuilder for a │ │ │ │ │ -matrix with set size that has not been compressed() yet"); │ │ │ │ │ -177 } │ │ │ │ │ -178 │ │ │ │ │ -180 │ │ │ │ │ -_1_9_4 _I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r(_M_a_t_r_i_x& m, _s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e cols, _s_i_z_e___t_y_p_e │ │ │ │ │ -avg_cols_per_row, double overflow_fraction) │ │ │ │ │ -195 : _m(m) │ │ │ │ │ -196 { │ │ │ │ │ -197 if (m.buildStage() != Matrix::notAllocated) │ │ │ │ │ -198 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only set up a matrix for this │ │ │ │ │ -ImplicitBuilder if it has no memory allocated yet"); │ │ │ │ │ -199 m.setBuildMode(Matrix::implicit); │ │ │ │ │ -200 m.setImplicitBuildModeParameters(avg_cols_per_row,overflow_fraction); │ │ │ │ │ -201 m.setSize(rows,cols); │ │ │ │ │ -202 } │ │ │ │ │ -203 │ │ │ │ │ -_2_0_5 _r_o_w___o_b_j_e_c_t _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -206 { │ │ │ │ │ -207 return _r_o_w___o_b_j_e_c_t(_m,i); │ │ │ │ │ -208 } │ │ │ │ │ -209 │ │ │ │ │ -_2_1_1 _s_i_z_e___t_y_p_e _N() const │ │ │ │ │ -212 { │ │ │ │ │ -213 return _m.N(); │ │ │ │ │ -214 } │ │ │ │ │ -215 │ │ │ │ │ -_2_1_7 _s_i_z_e___t_y_p_e _M() const │ │ │ │ │ -218 { │ │ │ │ │ -219 return _m.M(); │ │ │ │ │ -220 } │ │ │ │ │ -221 │ │ │ │ │ -222 private: │ │ │ │ │ -223 │ │ │ │ │ -224 _M_a_t_r_i_x& _m; │ │ │ │ │ -225 │ │ │ │ │ -226 }; │ │ │ │ │ -227 │ │ │ │ │ -464 template > │ │ │ │ │ -_4_6_5 class _B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -466 { │ │ │ │ │ -467 friend struct _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n<_B_C_R_S_M_a_t_r_i_x>; │ │ │ │ │ -468 public: │ │ │ │ │ -_4_6_9 enum _B_u_i_l_d_S_t_a_g_e { │ │ │ │ │ -_4_7_1 _n_o_t_b_u_i_l_t=0, │ │ │ │ │ -_4_7_3 _n_o_t_A_l_l_o_c_a_t_e_d=0, │ │ │ │ │ -_4_7_5 _b_u_i_l_d_i_n_g=1, │ │ │ │ │ -_4_8_0 _r_o_w_S_i_z_e_s_B_u_i_l_t=2, │ │ │ │ │ -482 _b_u_i_l_t=3 │ │ │ │ │ -_4_8_3 }; │ │ │ │ │ -484 │ │ │ │ │ -485 //===== type definitions and constants │ │ │ │ │ -486 │ │ │ │ │ -_4_8_8 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ -489 │ │ │ │ │ -_4_9_1 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -492 │ │ │ │ │ -_4_9_4 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ -495 │ │ │ │ │ -_4_9_7 typedef Imp::CompressedBlockVectorWindow _r_o_w___t_y_p_e; │ │ │ │ │ -498 │ │ │ │ │ -_5_0_0 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -501 │ │ │ │ │ -_5_0_3 typedef ::Dune::CompressionStatistics _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s; │ │ │ │ │ -504 │ │ │ │ │ -506 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ -2.8.")]] │ │ │ │ │ -_5_0_7 static constexpr unsigned int _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ -508 │ │ │ │ │ -_5_1_0 enum _B_u_i_l_d_M_o_d_e { │ │ │ │ │ -_5_2_1 _r_o_w___w_i_s_e, │ │ │ │ │ -_5_3_0 _r_a_n_d_o_m, │ │ │ │ │ -_5_3_9 _i_m_p_l_i_c_i_t, │ │ │ │ │ -543 _u_n_k_n_o_w_n │ │ │ │ │ -_5_4_4 }; │ │ │ │ │ -545 │ │ │ │ │ -546 //===== random access interface to rows of the matrix │ │ │ │ │ -547 │ │ │ │ │ -_5_4_9 _r_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) │ │ │ │ │ -550 { │ │ │ │ │ -551#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -552 if (_b_u_i_l_d___m_o_d_e == _i_m_p_l_i_c_i_t && _r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -553 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot use operator[] in implicit build │ │ │ │ │ -mode before calling compress()"); │ │ │ │ │ -554 if (_r==0) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row not initialized yet"); │ │ │ │ │ -555 if (i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -556#endif │ │ │ │ │ -557 return _r[i]; │ │ │ │ │ -558 } │ │ │ │ │ -559 │ │ │ │ │ -_5_6_1 const _r_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -562 { │ │ │ │ │ -563#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -564 if (_b_u_i_l_d___m_o_d_e == _i_m_p_l_i_c_i_t && _r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -565 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot use operator[] in implicit build │ │ │ │ │ -mode before calling compress()"); │ │ │ │ │ -566 if (_b_u_i_l_t!=_r_e_a_d_y) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row not initialized yet"); │ │ │ │ │ -567 if (i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -568#endif │ │ │ │ │ -569 return _r[i]; │ │ │ │ │ -570 } │ │ │ │ │ -571 │ │ │ │ │ -572 │ │ │ │ │ -573 //===== iterator interface to rows of the matrix │ │ │ │ │ -574 │ │ │ │ │ -576 template │ │ │ │ │ -_5_7_7 class _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -578 : public RandomAccessIteratorFacade, T> │ │ │ │ │ -579 { │ │ │ │ │ -580 │ │ │ │ │ -581 public: │ │ │ │ │ -_5_8_3 typedef typename std::remove_const::type _V_a_l_u_e_T_y_p_e; │ │ │ │ │ -584 │ │ │ │ │ -585 friend class RandomAccessIteratorFacade<_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r, │ │ │ │ │ -const _V_a_l_u_e_T_y_p_e>; │ │ │ │ │ -586 friend class RandomAccessIteratorFacade<_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r<_V_a_l_u_e_T_y_p_e>, │ │ │ │ │ -_V_a_l_u_e_T_y_p_e>; │ │ │ │ │ -587 friend class _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ -588 friend class _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r<_V_a_l_u_e_T_y_p_e>; │ │ │ │ │ -589 │ │ │ │ │ -_5_9_1 _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r (_r_o_w___t_y_p_e* _p, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ -592 : p(_p), i(_i) │ │ │ │ │ -593 {} │ │ │ │ │ -594 │ │ │ │ │ -_5_9_6 _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r () │ │ │ │ │ -597 : p(0), i(0) │ │ │ │ │ -598 {} │ │ │ │ │ -599 │ │ │ │ │ -_6_0_0 _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r(const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_V_a_l_u_e_T_y_p_e_>& it) │ │ │ │ │ -601 : p(it.p), i(it.i) │ │ │ │ │ -602 {} │ │ │ │ │ -603 │ │ │ │ │ -604 │ │ │ │ │ -_6_0_6 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ -607 { │ │ │ │ │ -608 return i; │ │ │ │ │ -609 } │ │ │ │ │ -610 │ │ │ │ │ -_6_1_1 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_V_a_l_u_e_T_y_p_e_>& other) const │ │ │ │ │ -612 { │ │ │ │ │ -613 assert(other.p==p); │ │ │ │ │ -614 return (other.i-i); │ │ │ │ │ -615 } │ │ │ │ │ -616 │ │ │ │ │ -_6_1_7 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _V_a_l_u_e_T_y_p_e_>& other) │ │ │ │ │ -const │ │ │ │ │ -618 { │ │ │ │ │ -619 assert(other.p==p); │ │ │ │ │ -620 return (other.i-i); │ │ │ │ │ -621 } │ │ │ │ │ -622 │ │ │ │ │ -_6_2_4 bool _e_q_u_a_l_s (const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_V_a_l_u_e_T_y_p_e_>& other) const │ │ │ │ │ -625 { │ │ │ │ │ -626 assert(other.p==p); │ │ │ │ │ -627 return i==other.i; │ │ │ │ │ -628 } │ │ │ │ │ -629 │ │ │ │ │ -_6_3_1 bool _e_q_u_a_l_s (const _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _V_a_l_u_e_T_y_p_e_>& other) const │ │ │ │ │ -632 { │ │ │ │ │ -633 assert(other.p==p); │ │ │ │ │ -634 return i==other.i; │ │ │ │ │ -635 } │ │ │ │ │ -636 │ │ │ │ │ -637 private: │ │ │ │ │ -639 void increment() │ │ │ │ │ -640 { │ │ │ │ │ -641 ++i; │ │ │ │ │ -642 } │ │ │ │ │ -643 │ │ │ │ │ -645 void decrement() │ │ │ │ │ -646 { │ │ │ │ │ -647 --i; │ │ │ │ │ -648 } │ │ │ │ │ -649 │ │ │ │ │ -650 void advance(std::ptrdiff_t diff) │ │ │ │ │ -651 { │ │ │ │ │ -652 i+=diff; │ │ │ │ │ -653 } │ │ │ │ │ -654 │ │ │ │ │ -655 T& elementAt(std::ptrdiff_t diff) const │ │ │ │ │ -656 { │ │ │ │ │ -657 return p[i+diff]; │ │ │ │ │ -658 } │ │ │ │ │ -659 │ │ │ │ │ -661 _r_o_w___t_y_p_e& dereference () const │ │ │ │ │ -662 { │ │ │ │ │ -663 return p[i]; │ │ │ │ │ -664 } │ │ │ │ │ -665 │ │ │ │ │ -666 _r_o_w___t_y_p_e* p; │ │ │ │ │ -667 _s_i_z_e___t_y_p_e i; │ │ │ │ │ -668 }; │ │ │ │ │ -669 │ │ │ │ │ -_6_7_1 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_r_o_w___t_y_p_e_> _i_t_e_r_a_t_o_r; │ │ │ │ │ -_6_7_2 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_r_o_w___t_y_p_e_> _I_t_e_r_a_t_o_r; │ │ │ │ │ -673 │ │ │ │ │ -_6_7_5 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ -676 { │ │ │ │ │ -677 return _I_t_e_r_a_t_o_r(_r,0); │ │ │ │ │ -678 } │ │ │ │ │ -679 │ │ │ │ │ -_6_8_1 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ -682 { │ │ │ │ │ -683 return _I_t_e_r_a_t_o_r(_r,_n); │ │ │ │ │ -684 } │ │ │ │ │ -685 │ │ │ │ │ -_6_8_8 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ -689 { │ │ │ │ │ -690 return _I_t_e_r_a_t_o_r(_r,_n-1); │ │ │ │ │ -691 } │ │ │ │ │ -692 │ │ │ │ │ -_6_9_5 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ -696 { │ │ │ │ │ -697 return _I_t_e_r_a_t_o_r(_r,-1); │ │ │ │ │ -698 } │ │ │ │ │ -699 │ │ │ │ │ -_7_0_1 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ -702 │ │ │ │ │ -_7_0_4 typedef typename row_type::Iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -705 │ │ │ │ │ -_7_0_7 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _r_o_w___t_y_p_e_> _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -_7_0_8 typedef _R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _r_o_w___t_y_p_e_> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -709 │ │ │ │ │ -710 │ │ │ │ │ -_7_1_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ -713 { │ │ │ │ │ -714 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,0); │ │ │ │ │ -715 } │ │ │ │ │ -716 │ │ │ │ │ -_7_1_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ -719 { │ │ │ │ │ -720 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,_n); │ │ │ │ │ -721 } │ │ │ │ │ -722 │ │ │ │ │ -_7_2_5 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ -726 { │ │ │ │ │ -727 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,_n-1); │ │ │ │ │ -728 } │ │ │ │ │ -729 │ │ │ │ │ -_7_3_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 │ │ │ │ │ -733 { │ │ │ │ │ -734 return _C_o_n_s_t_I_t_e_r_a_t_o_r(_r,-1); │ │ │ │ │ -735 } │ │ │ │ │ -736 │ │ │ │ │ -_7_3_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; │ │ │ │ │ -739 │ │ │ │ │ -_7_4_1 typedef typename row_type::ConstIterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -742 │ │ │ │ │ -743 //===== constructors & resizers │ │ │ │ │ -744 │ │ │ │ │ -745 // we use a negative compressionBufferSize to indicate that the implicit │ │ │ │ │ -746 // mode parameters have not been set yet │ │ │ │ │ -747 │ │ │ │ │ -_7_4_9 _B_C_R_S_M_a_t_r_i_x () │ │ │ │ │ -750 : _b_u_i_l_d___m_o_d_e(_u_n_k_n_o_w_n), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ -751 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ -752 _a_v_g(0), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(-1.0) │ │ │ │ │ -753 {} │ │ │ │ │ -754 │ │ │ │ │ -_7_5_6 _B_C_R_S_M_a_t_r_i_x (_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m, _s_i_z_e___t_y_p_e _nnz, _B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ -757 : _b_u_i_l_d___m_o_d_e(bm), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ -758 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ -759 _a_v_g(0), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(-1.0) │ │ │ │ │ -760 { │ │ │ │ │ -761 _a_l_l_o_c_a_t_e(_n, _m, _nnz,true,false); │ │ │ │ │ -762 } │ │ │ │ │ -763 │ │ │ │ │ -_7_6_5 _B_C_R_S_M_a_t_r_i_x (_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m, _B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ -766 : _b_u_i_l_d___m_o_d_e(bm), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ -767 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ -768 _a_v_g(0), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(-1.0) │ │ │ │ │ -769 { │ │ │ │ │ -770 _a_l_l_o_c_a_t_e(_n, _m,0,true,false); │ │ │ │ │ -771 } │ │ │ │ │ -772 │ │ │ │ │ -774 │ │ │ │ │ -_7_8_4 _B_C_R_S_M_a_t_r_i_x (_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m, _s_i_z_e___t_y_p_e _avg, double │ │ │ │ │ -compressionBufferSize, _B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ -785 : _b_u_i_l_d___m_o_d_e(bm), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ -786 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ -787 _a_v_g(_avg), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(compressionBufferSize) │ │ │ │ │ -788 { │ │ │ │ │ -789 if (bm != _i_m_p_l_i_c_i_t) │ │ │ │ │ -790 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"Only call this constructor when using the │ │ │ │ │ -implicit build mode"); │ │ │ │ │ -791 // Prevent user from setting a negative compression buffer size: │ │ │ │ │ -792 // 1) It doesn't make sense │ │ │ │ │ -793 // 2) We use a negative value to indicate that the parameters │ │ │ │ │ -794 // have not been set yet │ │ │ │ │ -795 if (_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ < 0.0) │ │ │ │ │ -796 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot set a negative overflow fraction"); │ │ │ │ │ -797 _i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e(_n,_m); │ │ │ │ │ -798 } │ │ │ │ │ -799 │ │ │ │ │ -_8_0_5 _B_C_R_S_M_a_t_r_i_x (const _B_C_R_S_M_a_t_r_i_x& Mat) │ │ │ │ │ -806 : _b_u_i_l_d___m_o_d_e(Mat._b_u_i_l_d___m_o_d_e), _r_e_a_d_y(_n_o_t_A_l_l_o_c_a_t_e_d), _n(0), _m(0), _n_n_z__(0), │ │ │ │ │ -807 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__(0), _r(0), _a(0), │ │ │ │ │ -808 _a_v_g(Mat._a_v_g), _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__(Mat._c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__) │ │ │ │ │ -809 { │ │ │ │ │ -810 if (!(Mat._r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d || Mat._r_e_a_d_y == _b_u_i_l_t)) │ │ │ │ │ -811 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copy-constructed │ │ │ │ │ -when source matrix is completely empty (size not set) or fully built)"); │ │ │ │ │ -812 │ │ │ │ │ -813 // deep copy in global array │ │ │ │ │ -814 _s_i_z_e___t_y_p_e _nnz = Mat._n_o_n_z_e_r_o_e_s(); │ │ │ │ │ -815 │ │ │ │ │ -816 _j__ = Mat._j__; // enable column index sharing, release array in case of row- │ │ │ │ │ -wise allocation │ │ │ │ │ -817 _a_l_l_o_c_a_t_e(Mat._n, Mat._m, _nnz, true, true); │ │ │ │ │ -818 │ │ │ │ │ -819 // build window structure │ │ │ │ │ -820 _c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e(Mat); │ │ │ │ │ -821 } │ │ │ │ │ -822 │ │ │ │ │ -_8_2_4 _~_B_C_R_S_M_a_t_r_i_x () │ │ │ │ │ -825 { │ │ │ │ │ -826 _d_e_a_l_l_o_c_a_t_e(); │ │ │ │ │ -827 } │ │ │ │ │ -828 │ │ │ │ │ -_8_3_3 void _s_e_t_B_u_i_l_d_M_o_d_e(_B_u_i_l_d_M_o_d_e bm) │ │ │ │ │ -834 { │ │ │ │ │ -835 if (_r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ -836 { │ │ │ │ │ -837 _b_u_i_l_d___m_o_d_e = bm; │ │ │ │ │ -838 return; │ │ │ │ │ -839 } │ │ │ │ │ -840 if (_r_e_a_d_y == _b_u_i_l_d_i_n_g && (_b_u_i_l_d___m_o_d_e == _u_n_k_n_o_w_n || _b_u_i_l_d___m_o_d_e == _r_a_n_d_o_m || │ │ │ │ │ -_b_u_i_l_d___m_o_d_e == _r_o_w___w_i_s_e) && (bm == _r_o_w___w_i_s_e || bm == _r_a_n_d_o_m)) │ │ │ │ │ -841 _b_u_i_l_d___m_o_d_e = bm; │ │ │ │ │ -842 else │ │ │ │ │ -843 DUNE_THROW(InvalidStateException, "Matrix structure cannot be changed at │ │ │ │ │ -this stage anymore (ready == "<<_r_e_a_d_y<<")."); │ │ │ │ │ -844 } │ │ │ │ │ -845 │ │ │ │ │ -_8_6_1 void _s_e_t_S_i_z_e(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e nnz=0) │ │ │ │ │ -862 { │ │ │ │ │ -863 // deallocate already setup memory │ │ │ │ │ -864 _d_e_a_l_l_o_c_a_t_e(); │ │ │ │ │ -865 │ │ │ │ │ -866 if (_b_u_i_l_d___m_o_d_e == _i_m_p_l_i_c_i_t) │ │ │ │ │ -867 { │ │ │ │ │ -868 if (nnz>0) │ │ │ │ │ -869 DUNE_THROW(_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"number of non-zeroes may not be set in │ │ │ │ │ -implicit mode, use setImplicitBuildModeParameters() instead"); │ │ │ │ │ -870 │ │ │ │ │ -871 // implicit allocates differently │ │ │ │ │ -872 _i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e(rows,columns); │ │ │ │ │ -873 } │ │ │ │ │ -874 else │ │ │ │ │ -875 { │ │ │ │ │ -876 // allocate matrix memory │ │ │ │ │ -877 _a_l_l_o_c_a_t_e(rows, columns, nnz, true, false); │ │ │ │ │ -878 } │ │ │ │ │ -879 } │ │ │ │ │ -880 │ │ │ │ │ -_8_8_9 void _s_e_t_I_m_p_l_i_c_i_t_B_u_i_l_d_M_o_d_e_P_a_r_a_m_e_t_e_r_s(_s_i_z_e___t_y_p_e _avg, double │ │ │ │ │ -compressionBufferSize) │ │ │ │ │ -890 { │ │ │ │ │ -891 // Prevent user from setting a negative compression buffer size: │ │ │ │ │ -892 // 1) It doesn't make sense │ │ │ │ │ -893 // 2) We use a negative value to indicate that the parameters │ │ │ │ │ -894 // have not been set yet │ │ │ │ │ -895 if (compressionBufferSize < 0.0) │ │ │ │ │ -896 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You cannot set a negative compressionBufferSize │ │ │ │ │ -value"); │ │ │ │ │ -897 │ │ │ │ │ -898 // make sure the parameters aren't changed after memory has been allocated │ │ │ │ │ -899 if (_r_e_a_d_y != _n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ -900 DUNE_THROW(InvalidStateException,"You cannot modify build mode parameters │ │ │ │ │ -at this stage anymore"); │ │ │ │ │ -901 _a_v_g = _avg; │ │ │ │ │ -902 _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ = compressionBufferSize; │ │ │ │ │ -903 } │ │ │ │ │ -904 │ │ │ │ │ -_9_1_1 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _B_C_R_S_M_a_t_r_i_x& Mat) │ │ │ │ │ -912 { │ │ │ │ │ -913 // return immediately when self-assignment │ │ │ │ │ -914 if (&Mat==this) return *this; │ │ │ │ │ -915 │ │ │ │ │ -916 if (!((_r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d || _r_e_a_d_y == _b_u_i_l_t) && (Mat._r_e_a_d_y == │ │ │ │ │ -_n_o_t_A_l_l_o_c_a_t_e_d || Mat._r_e_a_d_y == _b_u_i_l_t))) │ │ │ │ │ -917 DUNE_THROW(InvalidStateException,"BCRSMatrix can only be copied when both │ │ │ │ │ -target and source are empty or fully built)"); │ │ │ │ │ -918 │ │ │ │ │ -919 // make it simple: ALWAYS throw away memory for a and j_ │ │ │ │ │ -920 // and deallocate rows only if n != Mat.n │ │ │ │ │ -921 _d_e_a_l_l_o_c_a_t_e(_n!=Mat._n); │ │ │ │ │ -922 │ │ │ │ │ -923 // reallocate the rows if required │ │ │ │ │ -924 if (_n>0 && _n!=Mat._n) { │ │ │ │ │ -925 // free rows │ │ │ │ │ -926 for(_r_o_w___t_y_p_e *riter=_r+(_n-1), *rend=_r-1; riter!=rend; --riter) │ │ │ │ │ -927 std::allocator_traits::destroy(_r_o_w_A_l_l_o_c_a_t_o_r__, │ │ │ │ │ -riter); │ │ │ │ │ -928 _r_o_w_A_l_l_o_c_a_t_o_r__.deallocate(_r,_n); │ │ │ │ │ -929 } │ │ │ │ │ -930 │ │ │ │ │ -931 _n_n_z__ = Mat._n_o_n_z_e_r_o_e_s(); │ │ │ │ │ -932 │ │ │ │ │ -933 // allocate a, share j_ │ │ │ │ │ -934 _j__ = Mat._j__; │ │ │ │ │ -935 _a_l_l_o_c_a_t_e(Mat._n, Mat._m, _n_n_z__, _n!=Mat._n, true); │ │ │ │ │ -936 │ │ │ │ │ -937 // build window structure │ │ │ │ │ -938 _c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e(Mat); │ │ │ │ │ -939 return *this; │ │ │ │ │ -940 } │ │ │ │ │ -941 │ │ │ │ │ -_9_4_3 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ -944 { │ │ │ │ │ -945 │ │ │ │ │ -946 if (!(_r_e_a_d_y == _n_o_t_A_l_l_o_c_a_t_e_d || _r_e_a_d_y == _b_u_i_l_t)) │ │ │ │ │ -947 DUNE_THROW(InvalidStateException,"Scalar assignment only works on fully │ │ │ │ │ -built BCRSMatrix)"); │ │ │ │ │ -948 │ │ │ │ │ -949 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) _r[i] = k; │ │ │ │ │ -950 return *this; │ │ │ │ │ -951 } │ │ │ │ │ -952 │ │ │ │ │ -953 //===== row-wise creation interface │ │ │ │ │ -954 │ │ │ │ │ -_9_5_6 class _C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -957 { │ │ │ │ │ -958 public: │ │ │ │ │ -_9_6_0 _C_r_e_a_t_e_I_t_e_r_a_t_o_r (_B_C_R_S_M_a_t_r_i_x& _Mat, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ -961 : Mat(_Mat), i(_i), nnz(0), current_row(nullptr, Mat._j__._g_e_t(), 0) │ │ │ │ │ -962 { │ │ │ │ │ -963 if (Mat._b_u_i_l_d___m_o_d_e == _u_n_k_n_o_w_n && Mat._r_e_a_d_y == _b_u_i_l_d_i_n_g) │ │ │ │ │ -964 { │ │ │ │ │ -965 Mat._b_u_i_l_d___m_o_d_e = _r_o_w___w_i_s_e; │ │ │ │ │ -966 } │ │ │ │ │ -967 if (i==0 && Mat._r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ -968 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"creation only allowed for uninitialized │ │ │ │ │ -matrix"); │ │ │ │ │ -969 if(Mat._b_u_i_l_d___m_o_d_e!=_r_o_w___w_i_s_e) │ │ │ │ │ -970 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"creation only allowed if row wise allocation │ │ │ │ │ -was requested in the constructor"); │ │ │ │ │ -971 if(i==0 && _Mat._N()==0) │ │ │ │ │ -972 // empty Matrix is always built. │ │ │ │ │ -973 Mat._r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ -974 } │ │ │ │ │ -975 │ │ │ │ │ -_9_7_7 _C_r_e_a_t_e_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -978 { │ │ │ │ │ -979 // this should only be called if matrix is in creation │ │ │ │ │ -980 if (Mat._r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ -981 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix already built up"); │ │ │ │ │ -982 │ │ │ │ │ -983 // row i is defined through the pattern │ │ │ │ │ -984 // get memory for the row and initialize the j_ array │ │ │ │ │ -985 // this depends on the allocation mode │ │ │ │ │ -986 │ │ │ │ │ -987 // compute size of the row │ │ │ │ │ -988 _s_i_z_e___t_y_p_e s = pattern.size(); │ │ │ │ │ -989 │ │ │ │ │ -990 if(s>0) { │ │ │ │ │ -991 // update number of nonzeroes including this row │ │ │ │ │ -992 nnz += s; │ │ │ │ │ -993 │ │ │ │ │ -994 // alloc memory / set window │ │ │ │ │ -995 if (Mat._n_n_z__ > 0) │ │ │ │ │ -996 { │ │ │ │ │ -997 // memory is allocated in one long array │ │ │ │ │ -998 │ │ │ │ │ -999 // check if that memory is sufficient │ │ │ │ │ -1000 if (nnz > Mat._n_n_z__) │ │ │ │ │ -1001 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"allocated nnz too small"); │ │ │ │ │ -1002 │ │ │ │ │ -1003 // set row i │ │ │ │ │ -1004 Mat._r[i].set(s,nullptr,current_row.getindexptr()); │ │ │ │ │ -1005 current_row.setindexptr(current_row.getindexptr()+s); │ │ │ │ │ -1006 }else{ │ │ │ │ │ -1007 // memory is allocated individually per row │ │ │ │ │ -1008 // allocate and set row i │ │ │ │ │ -1009 B* b = Mat._a_l_l_o_c_a_t_o_r__.allocate(s); │ │ │ │ │ -1010 // use placement new to call constructor that allocates │ │ │ │ │ -1011 // additional memory. │ │ │ │ │ -1012 new (b) B[s]; │ │ │ │ │ -1013 _s_i_z_e___t_y_p_e* j = Mat._s_i_z_e_A_l_l_o_c_a_t_o_r__.allocate(s); │ │ │ │ │ -1014 Mat._r[i].set(s,b,j); │ │ │ │ │ -1015 } │ │ │ │ │ -1016 }else │ │ │ │ │ -1017 // setup empty row │ │ │ │ │ -1018 Mat._r[i].set(0,nullptr,nullptr); │ │ │ │ │ -1019 │ │ │ │ │ -1020 // initialize the j array for row i from pattern │ │ │ │ │ -1021 std::copy(pattern.cbegin(), pattern.cend(), Mat._r[i].getindexptr()); │ │ │ │ │ -1022 │ │ │ │ │ -1023 // now go to next row │ │ │ │ │ -1024 i++; │ │ │ │ │ -1025 pattern.clear(); │ │ │ │ │ -1026 │ │ │ │ │ -1027 // check if this was last row │ │ │ │ │ -1028 if (i==Mat._n) │ │ │ │ │ -1029 { │ │ │ │ │ -1030 Mat._r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ -1031 if(Mat._n_n_z__ > 0) │ │ │ │ │ -1032 { │ │ │ │ │ -1033 // Set nnz to the exact number of nonzero blocks inserted │ │ │ │ │ -1034 // as some methods rely on it │ │ │ │ │ -1035 Mat._n_n_z__ = nnz; │ │ │ │ │ -1036 // allocate data array │ │ │ │ │ -1037 Mat._a_l_l_o_c_a_t_e_D_a_t_a(); │ │ │ │ │ -1038 Mat._s_e_t_D_a_t_a_P_o_i_n_t_e_r_s(); │ │ │ │ │ -1039 } │ │ │ │ │ -1040 } │ │ │ │ │ -1041 // done │ │ │ │ │ -1042 return *this; │ │ │ │ │ -1043 } │ │ │ │ │ -1044 │ │ │ │ │ -_1_0_4_6 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 │ │ │ │ │ -1047 { │ │ │ │ │ -1048 return (i!=it.i) || (&Mat!=&it.Mat); │ │ │ │ │ -1049 } │ │ │ │ │ -1050 │ │ │ │ │ -_1_0_5_2 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 │ │ │ │ │ -1053 { │ │ │ │ │ -1054 return (i==it.i) && (&Mat==&it.Mat); │ │ │ │ │ -1055 } │ │ │ │ │ -1056 │ │ │ │ │ -_1_0_5_8 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ -1059 { │ │ │ │ │ -1060 return i; │ │ │ │ │ -1061 } │ │ │ │ │ -1062 │ │ │ │ │ -_1_0_6_4 void _i_n_s_e_r_t (_s_i_z_e___t_y_p_e j) │ │ │ │ │ -1065 { │ │ │ │ │ -1066 pattern.insert(j); │ │ │ │ │ -1067 } │ │ │ │ │ -1068 │ │ │ │ │ -_1_0_7_0 bool _c_o_n_t_a_i_n_s (_s_i_z_e___t_y_p_e j) │ │ │ │ │ -1071 { │ │ │ │ │ -1072 return pattern.find(j) != pattern.end(); │ │ │ │ │ -1073 } │ │ │ │ │ -_1_0_7_9 _s_i_z_e___t_y_p_e _s_i_z_e() const │ │ │ │ │ -1080 { │ │ │ │ │ -1081 return pattern.size(); │ │ │ │ │ -1082 } │ │ │ │ │ -1083 │ │ │ │ │ -1084 private: │ │ │ │ │ -1085 _B_C_R_S_M_a_t_r_i_x& Mat; // the matrix we are defining │ │ │ │ │ -1086 _s_i_z_e___t_y_p_e i; // current row to be defined │ │ │ │ │ -1087 _s_i_z_e___t_y_p_e nnz; // count total number of nonzeros │ │ │ │ │ -1088 typedef std::set > PatternType; │ │ │ │ │ -1089 PatternType pattern; // used to compile entries in a row │ │ │ │ │ -1090 _r_o_w___t_y_p_e current_row; // row pointing to the current row to setup │ │ │ │ │ -1091 }; │ │ │ │ │ -1092 │ │ │ │ │ -_1_0_9_4 friend class _C_r_e_a_t_e_I_t_e_r_a_t_o_r; │ │ │ │ │ -1095 │ │ │ │ │ -_1_0_9_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 () │ │ │ │ │ -1098 { │ │ │ │ │ -1099 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this,0); │ │ │ │ │ -1100 } │ │ │ │ │ -1101 │ │ │ │ │ -_1_1_0_3 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _c_r_e_a_t_e_e_n_d () │ │ │ │ │ -1104 { │ │ │ │ │ -1105 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this,_n); │ │ │ │ │ -1106 } │ │ │ │ │ -1107 │ │ │ │ │ -1108 │ │ │ │ │ -1109 //===== random creation interface │ │ │ │ │ -1110 │ │ │ │ │ -_1_1_1_7 void _s_e_t_r_o_w_s_i_z_e (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s) │ │ │ │ │ -1118 { │ │ │ │ │ -1119 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ -1120 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ -1121 if (_r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ -1122 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix row sizes already built up"); │ │ │ │ │ -1123 │ │ │ │ │ -1124 _r[i].setsize(s); │ │ │ │ │ -1125 } │ │ │ │ │ -1126 │ │ │ │ │ -_1_1_2_8 _s_i_z_e___t_y_p_e _g_e_t_r_o_w_s_i_z_e (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -1129 { │ │ │ │ │ -1130#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1131 if (_r==0) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row not initialized yet"); │ │ │ │ │ -1132 if (i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1133#endif │ │ │ │ │ -1134 return _r[i].getsize(); │ │ │ │ │ -1135 } │ │ │ │ │ -1136 │ │ │ │ │ -_1_1_3_8 void _i_n_c_r_e_m_e_n_t_r_o_w_s_i_z_e (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e s = 1) │ │ │ │ │ -1139 { │ │ │ │ │ -1140 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ -1141 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ -1142 if (_r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ -1143 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix row sizes already built up"); │ │ │ │ │ -1144 │ │ │ │ │ -1145 _r[i].setsize(_r[i].getsize()+s); │ │ │ │ │ -1146 } │ │ │ │ │ -1147 │ │ │ │ │ -_1_1_4_9 void _e_n_d_r_o_w_s_i_z_e_s () │ │ │ │ │ -1150 { │ │ │ │ │ -1151 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ -1152 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ -1153 if (_r_e_a_d_y != _b_u_i_l_d_i_n_g) │ │ │ │ │ -1154 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix row sizes already built up"); │ │ │ │ │ -1155 │ │ │ │ │ -1156 // compute total size, check positivity │ │ │ │ │ -1157 _s_i_z_e___t_y_p_e total=0; │ │ │ │ │ -1158 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ -1159 { │ │ │ │ │ -1160 total += _r[i].getsize(); │ │ │ │ │ -1161 } │ │ │ │ │ -1162 │ │ │ │ │ -1163 if(_n_n_z__ == 0) │ │ │ │ │ -1164 // allocate/check memory │ │ │ │ │ -1165 _a_l_l_o_c_a_t_e(_n,_m,total,false,false); │ │ │ │ │ -1166 else if(_n_n_z__ < total) │ │ │ │ │ -1167 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"Specified number of nonzeros ("<<_n_n_z__<<") not │ │ │ │ │ -" │ │ │ │ │ -1168 <<"sufficient for calculated nonzeros ("<= _m) │ │ │ │ │ -1203 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"column index exceeds matrix size"); │ │ │ │ │ -1204 │ │ │ │ │ -1205 // get row range │ │ │ │ │ -1206 _s_i_z_e___t_y_p_e* const first = _r[row].getindexptr(); │ │ │ │ │ -1207 _s_i_z_e___t_y_p_e* const last = first + _r[row].getsize(); │ │ │ │ │ -1208 │ │ │ │ │ -1209 // find correct insertion position for new column index │ │ │ │ │ -1210 _s_i_z_e___t_y_p_e* pos = std::lower_bound(first,last,_c_o_l); │ │ │ │ │ -1211 │ │ │ │ │ -1212 // check if index is already in row │ │ │ │ │ -1213 if (pos!=last && *pos == _c_o_l) return; │ │ │ │ │ -1214 │ │ │ │ │ -1215 // find end of already inserted column indices │ │ │ │ │ -1216 _s_i_z_e___t_y_p_e* _e_n_d = std::lower_bound(pos,last,_m); │ │ │ │ │ -1217 if (_e_n_d==last) │ │ │ │ │ -1218 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row is too small"); │ │ │ │ │ -1219 │ │ │ │ │ -1220 // insert new column index at correct position │ │ │ │ │ -1221 std::copy_backward(pos,_e_n_d,_e_n_d+1); │ │ │ │ │ -1222 *pos = _c_o_l; │ │ │ │ │ -1223 } │ │ │ │ │ -1224 │ │ │ │ │ -1226 │ │ │ │ │ -1233 template │ │ │ │ │ -_1_2_3_4 void _s_e_t_I_n_d_i_c_e_s(_s_i_z_e___t_y_p_e row, It _b_e_g_i_n, It _e_n_d) │ │ │ │ │ -1235 { │ │ │ │ │ -1236 _s_i_z_e___t_y_p_e row_size = _r[row].size(); │ │ │ │ │ -1237 _s_i_z_e___t_y_p_e* col_begin = _r[row].getindexptr(); │ │ │ │ │ -1238 _s_i_z_e___t_y_p_e* col_end; │ │ │ │ │ -1239 // consistency check between allocated row size and number of passed │ │ │ │ │ -column indices │ │ │ │ │ -1240 if ((col_end = std::copy(_b_e_g_i_n,_e_n_d,_r[row].getindexptr())) != col_begin + │ │ │ │ │ -row_size) │ │ │ │ │ -1241 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"Given size of row " << row │ │ │ │ │ -1242 << " (" << row_size │ │ │ │ │ -1243 << ") does not match number of passed entries (" << (col_end - col_begin) │ │ │ │ │ -<< ")"); │ │ │ │ │ -1244 std::sort(col_begin,col_end); │ │ │ │ │ -1245 } │ │ │ │ │ -1246 │ │ │ │ │ -_1_2_4_8 void _e_n_d_i_n_d_i_c_e_s () │ │ │ │ │ -1249 { │ │ │ │ │ -1250 if (_b_u_i_l_d___m_o_d_e!=_r_a_n_d_o_m) │ │ │ │ │ -1251 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires random build mode"); │ │ │ │ │ -1252 if (_r_e_a_d_y==_b_u_i_l_t) │ │ │ │ │ -1253 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix already built up"); │ │ │ │ │ -1254 if (_r_e_a_d_y==_b_u_i_l_d_i_n_g) │ │ │ │ │ -1255 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row sizes are not built up yet"); │ │ │ │ │ -1256 if (_r_e_a_d_y==_n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ -1257 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix size not set and no memory allocated │ │ │ │ │ -yet"); │ │ │ │ │ -1258 │ │ │ │ │ -1259 // check if there are undefined indices │ │ │ │ │ -1260 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1261 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1262 { │ │ │ │ │ -1263 _C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1264 for (_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) { │ │ │ │ │ -1265 if (j.index() >= _m) { │ │ │ │ │ -1266 dwarn << "WARNING: size of row "<< i.index()<<" is "<= _n) │ │ │ │ │ -1309 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row index exceeds matrix size"); │ │ │ │ │ -1310 if (_c_o_l >= _m) │ │ │ │ │ -1311 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"column index exceeds matrix size"); │ │ │ │ │ -1312#endif │ │ │ │ │ -1313 │ │ │ │ │ -1314 _s_i_z_e___t_y_p_e* _b_e_g_i_n = _r[row].getindexptr(); │ │ │ │ │ -1315 _s_i_z_e___t_y_p_e* _e_n_d = _b_e_g_i_n + _r[row].getsize(); │ │ │ │ │ -1316 │ │ │ │ │ -1317 _s_i_z_e___t_y_p_e* pos = std::find(_b_e_g_i_n, _e_n_d, _c_o_l); │ │ │ │ │ -1318 │ │ │ │ │ -1319 //treat the case that there was a match in the array │ │ │ │ │ -1320 if (pos != _e_n_d) │ │ │ │ │ -1321 if (*pos == _c_o_l) │ │ │ │ │ -1322 { │ │ │ │ │ -1323 std::ptrdiff_t offset = pos - _r[row].getindexptr(); │ │ │ │ │ -1324 B* aptr = _r[row].getptr() + offset; │ │ │ │ │ -1325 │ │ │ │ │ -1326 return *aptr; │ │ │ │ │ -1327 } │ │ │ │ │ -1328 │ │ │ │ │ -1329 //determine whether overflow has to be taken into account or not │ │ │ │ │ -1330 if (_r[row].getsize() == _a_v_g) │ │ │ │ │ -1331 return _o_v_e_r_f_l_o_w[std::make_pair(row,_c_o_l)]; │ │ │ │ │ -1332 else │ │ │ │ │ -1333 { │ │ │ │ │ -1334 //modify index array │ │ │ │ │ -1335 *_e_n_d = _c_o_l; │ │ │ │ │ -1336 │ │ │ │ │ -1337 //do simultaneous operations on data array a │ │ │ │ │ -1338 std::ptrdiff_t offset = _e_n_d - _r[row].getindexptr(); │ │ │ │ │ -1339 B* apos = _r[row].getptr() + offset; │ │ │ │ │ -1340 │ │ │ │ │ -1341 //increase rowsize │ │ │ │ │ -1342 _r[row].setsize(_r[row].getsize()+1); │ │ │ │ │ -1343 │ │ │ │ │ -1344 //return reference to the newly created entry │ │ │ │ │ -1345 return *apos; │ │ │ │ │ -1346 } │ │ │ │ │ -1347 } │ │ │ │ │ -1348 │ │ │ │ │ -1350 │ │ │ │ │ -_1_3_6_0 _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s _c_o_m_p_r_e_s_s() │ │ │ │ │ -1361 { │ │ │ │ │ -1362 if (_b_u_i_l_d___m_o_d_e!=_i_m_p_l_i_c_i_t) │ │ │ │ │ -1363 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"requires implicit build mode"); │ │ │ │ │ -1364 if (_r_e_a_d_y==_b_u_i_l_t) │ │ │ │ │ -1365 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix already built up, no more need for │ │ │ │ │ -compression"); │ │ │ │ │ -1366 if (_r_e_a_d_y==_n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ -1367 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"matrix size not set and no memory allocated │ │ │ │ │ -yet"); │ │ │ │ │ -1368 if (_r_e_a_d_y!=_b_u_i_l_d_i_n_g) │ │ │ │ │ -1369 DUNE_THROW(InvalidStateException,"You may only call compress() at the end │ │ │ │ │ -of the 'building' stage"); │ │ │ │ │ -1370 │ │ │ │ │ -1371 //calculate statistics │ │ │ │ │ -1372 _C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s stats; │ │ │ │ │ -1373 stats._o_v_e_r_f_l_o_w___t_o_t_a_l = _o_v_e_r_f_l_o_w.size(); │ │ │ │ │ -1374 stats._m_a_x_i_m_u_m = 0; │ │ │ │ │ -1375 │ │ │ │ │ -1376 //get insertion iterators pointing to one before start (for later use of │ │ │ │ │ -++it) │ │ │ │ │ -1377 _s_i_z_e___t_y_p_e* jiit = _j__.get(); │ │ │ │ │ -1378 B* aiit = _a; │ │ │ │ │ -1379 │ │ │ │ │ -1380 //get iterator to the smallest overflow element │ │ │ │ │ -1381 typename OverflowType::iterator oit = _o_v_e_r_f_l_o_w.begin(); │ │ │ │ │ -1382 │ │ │ │ │ -1383 //store a copy of index pointers on which to perform sorting │ │ │ │ │ -1384 std::vector perm; │ │ │ │ │ -1385 │ │ │ │ │ -1386 //iterate over all rows and copy elements into their position in the │ │ │ │ │ -compressed array │ │ │ │ │ -1387 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ -1388 { │ │ │ │ │ -1389 //get old pointers into a and j and size without overflow changes │ │ │ │ │ -1390 _s_i_z_e___t_y_p_e* _b_e_g_i_n = _r[i].getindexptr(); │ │ │ │ │ -1391 //B* apos = r[i].getptr(); │ │ │ │ │ -1392 _s_i_z_e___t_y_p_e size = _r[i].getsize(); │ │ │ │ │ -1393 │ │ │ │ │ -1394 perm.resize(size); │ │ │ │ │ -1395 │ │ │ │ │ -1396 typename std::vector::iterator it = perm.begin(); │ │ │ │ │ -1397 for (_s_i_z_e___t_y_p_e* iit = _b_e_g_i_n; iit < _b_e_g_i_n + size; ++iit, ++it) │ │ │ │ │ -1398 *it = iit; │ │ │ │ │ -1399 │ │ │ │ │ -1400 //sort permutation array │ │ │ │ │ -1401 std::sort(perm.begin(),perm.end(),_P_o_i_n_t_e_r_C_o_m_p_a_r_e_<_s_i_z_e___t_y_p_e_>()); │ │ │ │ │ -1402 │ │ │ │ │ -1403 //change row window pointer to their new positions │ │ │ │ │ -1404 _r[i].setindexptr(jiit); │ │ │ │ │ -1405 _r[i].setptr(aiit); │ │ │ │ │ -1406 │ │ │ │ │ -1407 for (it = perm.begin(); it != perm.end(); ++it) │ │ │ │ │ -1408 { │ │ │ │ │ -1409 //check whether there are elements in the overflow area which take │ │ │ │ │ -precedence │ │ │ │ │ -1410 while ((oit!=_o_v_e_r_f_l_o_w.end()) && (oit->first < std::make_pair(i,**it))) │ │ │ │ │ -1411 { │ │ │ │ │ -1412 //check whether there is enough memory to write to │ │ │ │ │ -1413 if (jiit > _b_e_g_i_n) │ │ │ │ │ -1414 DUNE_THROW(_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, │ │ │ │ │ -1415 "Allocated memory for BCRSMatrix exhausted during compress()!" │ │ │ │ │ -1416 "Please increase either the average number of entries per row or the │ │ │ │ │ -compressionBufferSize value." │ │ │ │ │ -1417 ); │ │ │ │ │ -1418 //copy an element from the overflow area to the insertion position in a │ │ │ │ │ -and j │ │ │ │ │ -1419 *jiit = oit->first.second; │ │ │ │ │ -1420 ++jiit; │ │ │ │ │ -1421 *aiit = oit->second; │ │ │ │ │ -1422 ++aiit; │ │ │ │ │ -1423 ++oit; │ │ │ │ │ -1424 _r[i].setsize(_r[i].getsize()+1); │ │ │ │ │ -1425 } │ │ │ │ │ -1426 │ │ │ │ │ -1427 //check whether there is enough memory to write to │ │ │ │ │ -1428 if (jiit > _b_e_g_i_n) │ │ │ │ │ -1429 DUNE_THROW(_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, │ │ │ │ │ -1430 "Allocated memory for BCRSMatrix exhausted during compress()!" │ │ │ │ │ -1431 "Please increase either the average number of entries per row or the │ │ │ │ │ -compressionBufferSize value." │ │ │ │ │ -1432 ); │ │ │ │ │ -1433 │ │ │ │ │ -1434 //copy element from array │ │ │ │ │ -1435 *jiit = **it; │ │ │ │ │ -1436 ++jiit; │ │ │ │ │ -1437 B* apos = *it - _j__.get() + _a; │ │ │ │ │ -1438 *aiit = *apos; │ │ │ │ │ -1439 ++aiit; │ │ │ │ │ -1440 } │ │ │ │ │ -1441 │ │ │ │ │ -1442 //copy remaining elements from the overflow area │ │ │ │ │ -1443 while ((oit!=_o_v_e_r_f_l_o_w.end()) && (oit->first.first == i)) │ │ │ │ │ -1444 { │ │ │ │ │ -1445 //check whether there is enough memory to write to │ │ │ │ │ -1446 if (jiit > _b_e_g_i_n) │ │ │ │ │ -1447 DUNE_THROW(_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, │ │ │ │ │ -1448 "Allocated memory for BCRSMatrix exhausted during compress()!" │ │ │ │ │ -1449 "Please increase either the average number of entries per row or the │ │ │ │ │ -compressionBufferSize value." │ │ │ │ │ -1450 ); │ │ │ │ │ -1451 │ │ │ │ │ -1452 //copy and element from the overflow area to the insertion position in a │ │ │ │ │ -and j │ │ │ │ │ -1453 *jiit = oit->first.second; │ │ │ │ │ -1454 ++jiit; │ │ │ │ │ -1455 *aiit = oit->second; │ │ │ │ │ -1456 ++aiit; │ │ │ │ │ -1457 ++oit; │ │ │ │ │ -1458 _r[i].setsize(_r[i].getsize()+1); │ │ │ │ │ -1459 } │ │ │ │ │ -1460 │ │ │ │ │ -1461 // update maximum row size │ │ │ │ │ -1462 if (_r[i].getsize()>stats._m_a_x_i_m_u_m) │ │ │ │ │ -1463 stats._m_a_x_i_m_u_m = _r[i].getsize(); │ │ │ │ │ -1464 } │ │ │ │ │ -1465 │ │ │ │ │ -1466 // overflow area may be cleared │ │ │ │ │ -1467 _o_v_e_r_f_l_o_w.clear(); │ │ │ │ │ -1468 │ │ │ │ │ -1469 //determine average number of entries and memory usage │ │ │ │ │ -1470 std::ptrdiff_t diff = (_r[_n-1].getindexptr() + _r[_n-1].getsize() - _j__.get │ │ │ │ │ -()); │ │ │ │ │ -1471 _n_n_z__ = diff; │ │ │ │ │ -1472 stats._a_v_g = (double) (_n_n_z__) / (double) _n; │ │ │ │ │ -1473 stats._m_e_m___r_a_t_i_o = (double) (_n_n_z__) / (double) _a_l_l_o_c_a_t_i_o_n_S_i_z_e__; │ │ │ │ │ -1474 │ │ │ │ │ -1475 //matrix is now built │ │ │ │ │ -1476 _r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ -1477 │ │ │ │ │ -1478 return stats; │ │ │ │ │ -1479 } │ │ │ │ │ -1480 │ │ │ │ │ -1481 //===== vector space arithmetic │ │ │ │ │ -1482 │ │ │ │ │ -_1_4_8_4 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ -1485 { │ │ │ │ │ -1486#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1487 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1488 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1489#endif │ │ │ │ │ -1490 │ │ │ │ │ -1491 if (_n_n_z__ > 0) │ │ │ │ │ -1492 { │ │ │ │ │ -1493 // process 1D array │ │ │ │ │ -1494 for (_s_i_z_e___t_y_p_e i=0; i<_n_n_z__; i++) │ │ │ │ │ -1495 _a[i] *= k; │ │ │ │ │ -1496 } │ │ │ │ │ -1497 else │ │ │ │ │ -1498 { │ │ │ │ │ -1499 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1500 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1501 { │ │ │ │ │ -1502 _C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1503 for (_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1504 (*j) *= k; │ │ │ │ │ -1505 } │ │ │ │ │ -1506 } │ │ │ │ │ -1507 │ │ │ │ │ -1508 return *this; │ │ │ │ │ -1509 } │ │ │ │ │ -1510 │ │ │ │ │ -_1_5_1_2 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_/_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ -1513 { │ │ │ │ │ -1514#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1515 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1516 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1517#endif │ │ │ │ │ -1518 │ │ │ │ │ -1519 if (_n_n_z__ > 0) │ │ │ │ │ -1520 { │ │ │ │ │ -1521 // process 1D array │ │ │ │ │ -1522 for (_s_i_z_e___t_y_p_e i=0; i<_n_n_z__; i++) │ │ │ │ │ -1523 _a[i] /= k; │ │ │ │ │ -1524 } │ │ │ │ │ -1525 else │ │ │ │ │ -1526 { │ │ │ │ │ -1527 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1528 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1529 { │ │ │ │ │ -1530 _C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1531 for (_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1532 (*j) /= k; │ │ │ │ │ -1533 } │ │ │ │ │ -1534 } │ │ │ │ │ -1535 │ │ │ │ │ -1536 return *this; │ │ │ │ │ -1537 } │ │ │ │ │ -1538 │ │ │ │ │ -1539 │ │ │ │ │ -_1_5_4_5 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _B_C_R_S_M_a_t_r_i_x& b) │ │ │ │ │ -1546 { │ │ │ │ │ -1547#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1548 if (_r_e_a_d_y != _b_u_i_l_t || b._r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1549 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1550 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ -1551 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ -1552#endif │ │ │ │ │ -1553 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1554 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r j=b._b_e_g_i_n(); │ │ │ │ │ -1555 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i, ++j) { │ │ │ │ │ -1556 i->operator+=(*j); │ │ │ │ │ -1557 } │ │ │ │ │ -1558 │ │ │ │ │ -1559 return *this; │ │ │ │ │ -1560 } │ │ │ │ │ -1561 │ │ │ │ │ -_1_5_6_7 _B_C_R_S_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _B_C_R_S_M_a_t_r_i_x& b) │ │ │ │ │ -1568 { │ │ │ │ │ -1569#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1570 if (_r_e_a_d_y != _b_u_i_l_t || b._r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1571 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1572 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ -1573 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ -1574#endif │ │ │ │ │ -1575 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1576 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r j=b._b_e_g_i_n(); │ │ │ │ │ -1577 for (_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i, ++j) { │ │ │ │ │ -1578 i->operator-=(*j); │ │ │ │ │ -1579 } │ │ │ │ │ -1580 │ │ │ │ │ -1581 return *this; │ │ │ │ │ -1582 } │ │ │ │ │ -1583 │ │ │ │ │ -_1_5_9_2 _B_C_R_S_M_a_t_r_i_x& _a_x_p_y(_f_i_e_l_d___t_y_p_e alpha, const _B_C_R_S_M_a_t_r_i_x& b) │ │ │ │ │ -1593 { │ │ │ │ │ -1594#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1595 if (_r_e_a_d_y != _b_u_i_l_t || b._r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1596 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1597 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ -1598 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ -1599#endif │ │ │ │ │ -1600 _R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1601 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r j=b._b_e_g_i_n(); │ │ │ │ │ -1602 for(_R_o_w_I_t_e_r_a_t_o_r i=_b_e_g_i_n(); i!=endi; ++i, ++j) │ │ │ │ │ -1603 i->axpy(alpha, *j); │ │ │ │ │ -1604 │ │ │ │ │ -1605 return *this; │ │ │ │ │ -1606 } │ │ │ │ │ -1607 │ │ │ │ │ -1608 //===== linear maps │ │ │ │ │ -1609 │ │ │ │ │ -1611 template │ │ │ │ │ -_1_6_1_2 void _m_v (const X& x, Y& y) const │ │ │ │ │ -1613 { │ │ │ │ │ -1614#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1615 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1616 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1617 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r, │ │ │ │ │ -1618 "Size mismatch: M: " << _N() << "x" << _M() << " x: " << x.N()); │ │ │ │ │ -1619 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r, │ │ │ │ │ -1620 "Size mismatch: M: " << _N() << "x" << _M() << " y: " << y.N()); │ │ │ │ │ -1621#endif │ │ │ │ │ -1622 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1623 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1624 { │ │ │ │ │ -1625 y[i.index()]=0; │ │ │ │ │ -1626 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1627 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1628 { │ │ │ │ │ -1629 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ -1630 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ -1631 Impl::asMatrix(*j).umv(xj, yi); │ │ │ │ │ -1632 } │ │ │ │ │ -1633 } │ │ │ │ │ -1634 } │ │ │ │ │ -1635 │ │ │ │ │ -1637 template │ │ │ │ │ -_1_6_3_8 void _u_m_v (const X& x, Y& y) const │ │ │ │ │ -1639 { │ │ │ │ │ -1640#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1641 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1642 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1643 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1644 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1645#endif │ │ │ │ │ -1646 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1647 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1648 { │ │ │ │ │ -1649 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1650 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1651 { │ │ │ │ │ -1652 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ -1653 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ -1654 Impl::asMatrix(*j).umv(xj,yi); │ │ │ │ │ -1655 } │ │ │ │ │ -1656 } │ │ │ │ │ -1657 } │ │ │ │ │ -1658 │ │ │ │ │ -1660 template │ │ │ │ │ -_1_6_6_1 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ -1662 { │ │ │ │ │ -1663#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1664 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1665 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1666 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1667 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1668#endif │ │ │ │ │ -1669 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1670 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1671 { │ │ │ │ │ -1672 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1673 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1674 { │ │ │ │ │ -1675 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ -1676 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ -1677 Impl::asMatrix(*j).mmv(xj,yi); │ │ │ │ │ -1678 } │ │ │ │ │ -1679 } │ │ │ │ │ -1680 } │ │ │ │ │ -1681 │ │ │ │ │ -1683 template │ │ │ │ │ -_1_6_8_4 void _u_s_m_v (F&& alpha, const X& x, Y& y) const │ │ │ │ │ -1685 { │ │ │ │ │ -1686#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1687 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1688 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1689 if (x.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1690 if (y.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1691#endif │ │ │ │ │ -1692 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1693 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1694 { │ │ │ │ │ -1695 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1696 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1697 { │ │ │ │ │ -1698 auto&& xj = Impl::asVector(x[j.index()]); │ │ │ │ │ -1699 auto&& yi = Impl::asVector(y[i.index()]); │ │ │ │ │ -1700 Impl::asMatrix(*j).usmv(alpha,xj,yi); │ │ │ │ │ -1701 } │ │ │ │ │ -1702 } │ │ │ │ │ -1703 } │ │ │ │ │ -1704 │ │ │ │ │ -1706 template │ │ │ │ │ -_1_7_0_7 void _m_t_v (const X& x, Y& y) const │ │ │ │ │ -1708 { │ │ │ │ │ -1709#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1710 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1711 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1712 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1713 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1714#endif │ │ │ │ │ -1715 for(_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_1_7_2_2 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ -1723 { │ │ │ │ │ -1724#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1725 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1726 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1727 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1728 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1729#endif │ │ │ │ │ -1730 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1731 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1732 { │ │ │ │ │ -1733 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1734 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1735 { │ │ │ │ │ -1736 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ -1737 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ -1738 Impl::asMatrix(*j).umtv(xi,yj); │ │ │ │ │ -1739 } │ │ │ │ │ -1740 } │ │ │ │ │ -1741 } │ │ │ │ │ -1742 │ │ │ │ │ -1744 template │ │ │ │ │ -_1_7_4_5 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ -1746 { │ │ │ │ │ -1747#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1748 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1749 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1750#endif │ │ │ │ │ -1751 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1752 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1753 { │ │ │ │ │ -1754 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1755 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1756 { │ │ │ │ │ -1757 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ -1758 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ -1759 Impl::asMatrix(*j).mmtv(xi,yj); │ │ │ │ │ -1760 } │ │ │ │ │ -1761 } │ │ │ │ │ -1762 } │ │ │ │ │ -1763 │ │ │ │ │ -1765 template │ │ │ │ │ -_1_7_6_6 void _u_s_m_t_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ -1767 { │ │ │ │ │ -1768#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1769 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1770 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1771 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1772 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1773#endif │ │ │ │ │ -1774 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1775 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1776 { │ │ │ │ │ -1777 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1778 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1779 { │ │ │ │ │ -1780 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ -1781 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ -1782 Impl::asMatrix(*j).usmtv(alpha,xi,yj); │ │ │ │ │ -1783 } │ │ │ │ │ -1784 } │ │ │ │ │ -1785 } │ │ │ │ │ -1786 │ │ │ │ │ -1788 template │ │ │ │ │ -_1_7_8_9 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ -1790 { │ │ │ │ │ -1791#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1792 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1793 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1794 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1795 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1796#endif │ │ │ │ │ -1797 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1798 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1799 { │ │ │ │ │ -1800 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1801 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1802 { │ │ │ │ │ -1803 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ -1804 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ -1805 Impl::asMatrix(*j).umhv(xi,yj); │ │ │ │ │ -1806 } │ │ │ │ │ -1807 } │ │ │ │ │ -1808 } │ │ │ │ │ -1809 │ │ │ │ │ -1811 template │ │ │ │ │ -_1_8_1_2 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ -1813 { │ │ │ │ │ -1814#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1815 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1816 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1817 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1818 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1819#endif │ │ │ │ │ -1820 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1821 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1822 { │ │ │ │ │ -1823 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1824 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1825 { │ │ │ │ │ -1826 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ -1827 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ -1828 Impl::asMatrix(*j).mmhv(xi,yj); │ │ │ │ │ -1829 } │ │ │ │ │ -1830 } │ │ │ │ │ -1831 } │ │ │ │ │ -1832 │ │ │ │ │ -1834 template │ │ │ │ │ -_1_8_3_5 void _u_s_m_h_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ -1836 { │ │ │ │ │ -1837#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1838 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1839 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1840 if (x.N()!=_N()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1841 if (y.N()!=_M()) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"index out of range"); │ │ │ │ │ -1842#endif │ │ │ │ │ -1843 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r endi=_e_n_d(); │ │ │ │ │ -1844 for (_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r i=this->_b_e_g_i_n(); i!=endi; ++i) │ │ │ │ │ -1845 { │ │ │ │ │ -1846 _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r endj = (*i).end(); │ │ │ │ │ -1847 for (_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r j=(*i).begin(); j!=endj; ++j) │ │ │ │ │ -1848 { │ │ │ │ │ -1849 auto&& xi = Impl::asVector(x[i.index()]); │ │ │ │ │ -1850 auto&& yj = Impl::asVector(y[j.index()]); │ │ │ │ │ -1851 Impl::asMatrix(*j).usmhv(alpha,xi,yj); │ │ │ │ │ -1852 } │ │ │ │ │ -1853 } │ │ │ │ │ -1854 } │ │ │ │ │ -1855 │ │ │ │ │ -1856 │ │ │ │ │ -1857 //===== norms │ │ │ │ │ -1858 │ │ │ │ │ -_1_8_6_0 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ -1861 { │ │ │ │ │ -1862#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1863 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1864 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1865#endif │ │ │ │ │ -1866 │ │ │ │ │ -1867 typename FieldTraits::real_type sum=0; │ │ │ │ │ -1868 │ │ │ │ │ -1869 for (auto&& row : (*this)) │ │ │ │ │ -1870 for (auto&& _e_n_t_r_y : row) │ │ │ │ │ -1871 sum += Impl::asMatrix(_e_n_t_r_y).frobenius_norm2(); │ │ │ │ │ -1872 │ │ │ │ │ -1873 return sum; │ │ │ │ │ -1874 } │ │ │ │ │ -1875 │ │ │ │ │ -_1_8_7_7 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ │ -1878 { │ │ │ │ │ -1879 return sqrt(_f_r_o_b_e_n_i_u_s___n_o_r_m_2()); │ │ │ │ │ -1880 } │ │ │ │ │ -1881 │ │ │ │ │ -1883 template ::value, int>::type = 0> │ │ │ │ │ -_1_8_8_5 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ -1886 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1887 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1888 │ │ │ │ │ -1889 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1890 using std::max; │ │ │ │ │ -1891 │ │ │ │ │ -1892 real_type norm = 0; │ │ │ │ │ -1893 for (auto const &x : *this) { │ │ │ │ │ -1894 real_type sum = 0; │ │ │ │ │ -1895 for (auto const &y : x) │ │ │ │ │ -1896 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ -1897 norm = max(sum, norm); │ │ │ │ │ -1898 } │ │ │ │ │ -1899 return norm; │ │ │ │ │ -1900 } │ │ │ │ │ -1901 │ │ │ │ │ -1903 template ::value, int>::type = 0> │ │ │ │ │ -_1_9_0_5 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ -1906 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1907 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1908 │ │ │ │ │ -1909 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1910 using std::max; │ │ │ │ │ -1911 │ │ │ │ │ -1912 real_type norm = 0; │ │ │ │ │ -1913 for (auto const &x : *this) { │ │ │ │ │ -1914 real_type sum = 0; │ │ │ │ │ -1915 for (auto const &y : x) │ │ │ │ │ -1916 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ -1917 norm = max(sum, norm); │ │ │ │ │ -1918 } │ │ │ │ │ -1919 return norm; │ │ │ │ │ -1920 } │ │ │ │ │ -1921 │ │ │ │ │ -1923 template ::value, int>::type = 0> │ │ │ │ │ -_1_9_2_5 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ -1926 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1927 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1928 │ │ │ │ │ -1929 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1930 using std::max; │ │ │ │ │ -1931 │ │ │ │ │ -1932 real_type norm = 0; │ │ │ │ │ -1933 real_type isNaN = 1; │ │ │ │ │ -1934 for (auto const &x : *this) { │ │ │ │ │ -1935 real_type sum = 0; │ │ │ │ │ -1936 for (auto const &y : x) │ │ │ │ │ -1937 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ -1938 norm = max(sum, norm); │ │ │ │ │ -1939 isNaN += sum; │ │ │ │ │ -1940 } │ │ │ │ │ -1941 │ │ │ │ │ -1942 return norm * (isNaN / isNaN); │ │ │ │ │ -1943 } │ │ │ │ │ -1944 │ │ │ │ │ -1946 template ::value, int>::type = 0> │ │ │ │ │ -_1_9_4_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ -1949 if (_r_e_a_d_y != _b_u_i_l_t) │ │ │ │ │ -1950 DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"You can only call arithmetic operations on │ │ │ │ │ -fully built BCRSMatrix instances"); │ │ │ │ │ -1951 │ │ │ │ │ -1952 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1953 using std::max; │ │ │ │ │ -1954 │ │ │ │ │ -1955 real_type norm = 0; │ │ │ │ │ -1956 real_type isNaN = 1; │ │ │ │ │ -1957 │ │ │ │ │ -1958 for (auto const &x : *this) { │ │ │ │ │ -1959 real_type sum = 0; │ │ │ │ │ -1960 for (auto const &y : x) │ │ │ │ │ -1961 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ -1962 norm = max(sum, norm); │ │ │ │ │ -1963 isNaN += sum; │ │ │ │ │ -1964 } │ │ │ │ │ -1965 │ │ │ │ │ -1966 return norm * (isNaN / isNaN); │ │ │ │ │ -1967 } │ │ │ │ │ -1968 │ │ │ │ │ -1969 //===== sizes │ │ │ │ │ -1970 │ │ │ │ │ -_1_9_7_2 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ -1973 { │ │ │ │ │ -1974 return _n; │ │ │ │ │ -1975 } │ │ │ │ │ -1976 │ │ │ │ │ -_1_9_7_8 _s_i_z_e___t_y_p_e _M () const │ │ │ │ │ -1979 { │ │ │ │ │ -1980 return _m; │ │ │ │ │ -1981 } │ │ │ │ │ -1982 │ │ │ │ │ -_1_9_8_4 _s_i_z_e___t_y_p_e _n_o_n_z_e_r_o_e_s () const │ │ │ │ │ -1985 { │ │ │ │ │ -1986 // in case of row-wise allocation │ │ │ │ │ -1987 if( _n_n_z__ <= 0 ) │ │ │ │ │ -1988 _n_n_z__ = std::accumulate( _b_e_g_i_n(), _e_n_d(), _s_i_z_e___t_y_p_e( 0 ), [] ( _s_i_z_e___t_y_p_e s, │ │ │ │ │ -const _r_o_w___t_y_p_e &row ) { return s+row.getsize(); } ); │ │ │ │ │ -1989 return _n_n_z__; │ │ │ │ │ -1990 } │ │ │ │ │ -1991 │ │ │ │ │ -_1_9_9_3 _B_u_i_l_d_S_t_a_g_e _b_u_i_l_d_S_t_a_g_e() const │ │ │ │ │ -1994 { │ │ │ │ │ -1995 return _r_e_a_d_y; │ │ │ │ │ -1996 } │ │ │ │ │ -1997 │ │ │ │ │ -_1_9_9_9 _B_u_i_l_d_M_o_d_e _b_u_i_l_d_M_o_d_e() const │ │ │ │ │ -2000 { │ │ │ │ │ -2001 return _b_u_i_l_d___m_o_d_e; │ │ │ │ │ -2002 } │ │ │ │ │ -2003 │ │ │ │ │ -2004 //===== query │ │ │ │ │ -2005 │ │ │ │ │ -_2_0_0_7 bool _e_x_i_s_t_s (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e j) const │ │ │ │ │ -2008 { │ │ │ │ │ -2009#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -2010 if (i<0 || i>=_n) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"row index out of range"); │ │ │ │ │ -2011 if (j<0 || j>=_m) DUNE_THROW(_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r,"column index out of range"); │ │ │ │ │ -2012#endif │ │ │ │ │ -2013 return (_r[i].size() && _r[i].find(j) != _r[i]._e_n_d()); │ │ │ │ │ -2014 } │ │ │ │ │ -2015 │ │ │ │ │ -2016 │ │ │ │ │ -2017 protected: │ │ │ │ │ -2018 // state information │ │ │ │ │ -_2_0_1_9 _B_u_i_l_d_M_o_d_e _b_u_i_l_d___m_o_d_e; // row wise or whole matrix │ │ │ │ │ -_2_0_2_0 _B_u_i_l_d_S_t_a_g_e _r_e_a_d_y; // indicate the stage the matrix building is in │ │ │ │ │ -2021 │ │ │ │ │ -2022 // The allocator used for memory management │ │ │ │ │ -_2_0_2_3 typename std::allocator_traits::template rebind_alloc _a_l_l_o_c_a_t_o_r__; │ │ │ │ │ -2024 │ │ │ │ │ -_2_0_2_5 typename std::allocator_traits::template rebind_alloc │ │ │ │ │ -_r_o_w_A_l_l_o_c_a_t_o_r__; │ │ │ │ │ -2026 │ │ │ │ │ -_2_0_2_7 typename std::allocator_traits::template rebind_alloc │ │ │ │ │ -_s_i_z_e_A_l_l_o_c_a_t_o_r__; │ │ │ │ │ -2028 │ │ │ │ │ -2029 // size of the matrix │ │ │ │ │ -_2_0_3_0 _s_i_z_e___t_y_p_e _n; // number of rows │ │ │ │ │ -_2_0_3_1 _s_i_z_e___t_y_p_e _m; // number of columns │ │ │ │ │ -_2_0_3_2 mutable _s_i_z_e___t_y_p_e _n_n_z__; // number of nonzeroes contained in the matrix │ │ │ │ │ -_2_0_3_3 _s_i_z_e___t_y_p_e _a_l_l_o_c_a_t_i_o_n_S_i_z_e__; //allocated size of a and j arrays, except in │ │ │ │ │ -implicit mode: nnz_==allocationsSize_ │ │ │ │ │ -2034 // zero means that memory is allocated separately for each row. │ │ │ │ │ -2035 │ │ │ │ │ -2036 // the rows are dynamically allocated │ │ │ │ │ -_2_0_3_7 _r_o_w___t_y_p_e* _r; // [n] the individual rows having pointers into a,j arrays │ │ │ │ │ -2038 │ │ │ │ │ -2039 // dynamically allocated memory │ │ │ │ │ -_2_0_4_0 B* _a; // [allocationSize] non-zero entries of the matrix in row-wise │ │ │ │ │ -ordering │ │ │ │ │ -2041 // If a single array of column indices is used, it can be shared │ │ │ │ │ -2042 // between different matrices with the same sparsity pattern │ │ │ │ │ -_2_0_4_3 std::shared_ptr _j__; // [allocationSize] column indices of │ │ │ │ │ -entries │ │ │ │ │ -2044 │ │ │ │ │ -2045 // additional data is needed in implicit buildmode │ │ │ │ │ -_2_0_4_6 _s_i_z_e___t_y_p_e _a_v_g; │ │ │ │ │ -_2_0_4_7 double _c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__; │ │ │ │ │ -2048 │ │ │ │ │ -_2_0_4_9 typedef std::map, B> _O_v_e_r_f_l_o_w_T_y_p_e; │ │ │ │ │ -_2_0_5_0 _O_v_e_r_f_l_o_w_T_y_p_e _o_v_e_r_f_l_o_w; │ │ │ │ │ -2051 │ │ │ │ │ -_2_0_5_2 void _s_e_t_W_i_n_d_o_w_P_o_i_n_t_e_r_s(_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r row) │ │ │ │ │ -2053 { │ │ │ │ │ -2054 _r_o_w___t_y_p_e current_row(_a,_j__.get(),0); // Pointers to current row data │ │ │ │ │ -2055 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++, ++row) { │ │ │ │ │ -2056 // set row i │ │ │ │ │ -2057 _s_i_z_e___t_y_p_e s = row->getsize(); │ │ │ │ │ -2058 │ │ │ │ │ -2059 if (s>0) { │ │ │ │ │ -2060 // setup pointers and size │ │ │ │ │ -2061 _r[i].set(s,current_row.getptr(), current_row.getindexptr()); │ │ │ │ │ -2062 // update pointer for next row │ │ │ │ │ -2063 current_row.setptr(current_row.getptr()+s); │ │ │ │ │ -2064 current_row.setindexptr(current_row.getindexptr()+s); │ │ │ │ │ -2065 } else{ │ │ │ │ │ -2066 // empty row │ │ │ │ │ -2067 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ -2068 } │ │ │ │ │ -2069 } │ │ │ │ │ -2070 } │ │ │ │ │ -2071 │ │ │ │ │ -2073 │ │ │ │ │ -_2_0_7_7 void _s_e_t_C_o_l_u_m_n_P_o_i_n_t_e_r_s(_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r row) │ │ │ │ │ -2078 { │ │ │ │ │ -2079 _s_i_z_e___t_y_p_e* jptr = _j__.get(); │ │ │ │ │ -2080 for (_s_i_z_e___t_y_p_e i=0; i<_n; ++i, ++row) { │ │ │ │ │ -2081 // set row i │ │ │ │ │ -2082 _s_i_z_e___t_y_p_e s = row->getsize(); │ │ │ │ │ -2083 │ │ │ │ │ -2084 if (s>0) { │ │ │ │ │ -2085 // setup pointers and size │ │ │ │ │ -2086 _r[i].setsize(s); │ │ │ │ │ -2087 _r[i].setindexptr(jptr); │ │ │ │ │ -2088 } else{ │ │ │ │ │ -2089 // empty row │ │ │ │ │ -2090 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ -2091 } │ │ │ │ │ -2092 │ │ │ │ │ -2093 // advance position in global array │ │ │ │ │ -2094 jptr += s; │ │ │ │ │ -2095 } │ │ │ │ │ -2096 } │ │ │ │ │ -2097 │ │ │ │ │ -2099 │ │ │ │ │ -_2_1_0_3 void _s_e_t_D_a_t_a_P_o_i_n_t_e_r_s() │ │ │ │ │ -2104 { │ │ │ │ │ -2105 B* aptr = _a; │ │ │ │ │ -2106 for (_s_i_z_e___t_y_p_e i=0; i<_n; ++i) { │ │ │ │ │ -2107 // set row i │ │ │ │ │ -2108 if (_r[i].getsize() > 0) { │ │ │ │ │ -2109 // setup pointers and size │ │ │ │ │ -2110 _r[i].setptr(aptr); │ │ │ │ │ -2111 } else{ │ │ │ │ │ -2112 // empty row │ │ │ │ │ -2113 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ -2114 } │ │ │ │ │ -2115 │ │ │ │ │ -2116 // advance position in global array │ │ │ │ │ -2117 aptr += _r[i].getsize(); │ │ │ │ │ -2118 } │ │ │ │ │ -2119 } │ │ │ │ │ -2120 │ │ │ │ │ -_2_1_2_2 void _c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e(const _B_C_R_S_M_a_t_r_i_x& Mat) │ │ │ │ │ -2123 { │ │ │ │ │ -2124 _s_e_t_W_i_n_d_o_w_P_o_i_n_t_e_r_s(Mat._b_e_g_i_n()); │ │ │ │ │ -2125 │ │ │ │ │ -2126 // copy data │ │ │ │ │ -2127 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) _r[i] = Mat._r[i]; │ │ │ │ │ -2128 │ │ │ │ │ -2129 // finish off │ │ │ │ │ -2130 _b_u_i_l_d___m_o_d_e = _r_o_w___w_i_s_e; // dummy │ │ │ │ │ -2131 _r_e_a_d_y = _b_u_i_l_t; │ │ │ │ │ -2132 } │ │ │ │ │ -2133 │ │ │ │ │ -_2_1_3_9 void _d_e_a_l_l_o_c_a_t_e(bool deallocateRows=true) │ │ │ │ │ -2140 { │ │ │ │ │ -2141 │ │ │ │ │ -2142 if (_n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ -2143 return; │ │ │ │ │ -2144 │ │ │ │ │ -2145 if (_a_l_l_o_c_a_t_i_o_n_S_i_z_e__>0) │ │ │ │ │ -2146 { │ │ │ │ │ -2147 // a,j_ have been allocated as one long vector │ │ │ │ │ -2148 _j__.reset(); │ │ │ │ │ -2149 if (_a) │ │ │ │ │ -2150 { │ │ │ │ │ -2151 for(B *aiter=_a+(_a_l_l_o_c_a_t_i_o_n_S_i_z_e__-1), *aend=_a-1; aiter!=aend; --aiter) │ │ │ │ │ -2152 std::allocator_traits::destroy(_a_l_l_o_c_a_t_o_r__, aiter); │ │ │ │ │ -2153 _a_l_l_o_c_a_t_o_r__.deallocate(_a,_a_l_l_o_c_a_t_i_o_n_S_i_z_e__); │ │ │ │ │ -2154 _a = nullptr; │ │ │ │ │ -2155 } │ │ │ │ │ -2156 } │ │ │ │ │ -2157 else if (_r) │ │ │ │ │ -2158 { │ │ │ │ │ -2159 // check if memory for rows have been allocated individually │ │ │ │ │ -2160 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ -2161 if (_r[i].getsize()>0) │ │ │ │ │ -2162 { │ │ │ │ │ -2163 for (B *_c_o_l=_r[i].getptr()+(_r[i].getsize()-1), │ │ │ │ │ -2164 *colend = _r[i].getptr()-1; _c_o_l!=colend; --_c_o_l) { │ │ │ │ │ -2165 std::allocator_traits::destroy(_a_l_l_o_c_a_t_o_r__, _c_o_l); │ │ │ │ │ -2166 } │ │ │ │ │ -2167 _s_i_z_e_A_l_l_o_c_a_t_o_r__.deallocate(_r[i].getindexptr(),1); │ │ │ │ │ -2168 _a_l_l_o_c_a_t_o_r__.deallocate(_r[i].getptr(),1); │ │ │ │ │ -2169 // clear out row data in case we don't want to deallocate the rows │ │ │ │ │ -2170 // otherwise we might run into a double free problem here later │ │ │ │ │ -2171 _r[i].set(0,nullptr,nullptr); │ │ │ │ │ -2172 } │ │ │ │ │ -2173 } │ │ │ │ │ -2174 │ │ │ │ │ -2175 // deallocate the rows │ │ │ │ │ -2176 if (_n>0 && deallocateRows && _r) { │ │ │ │ │ -2177 for(_r_o_w___t_y_p_e *riter=_r+(_n-1), *rend=_r-1; riter!=rend; --riter) │ │ │ │ │ -2178 std::allocator_traits::destroy(_r_o_w_A_l_l_o_c_a_t_o_r__, │ │ │ │ │ -riter); │ │ │ │ │ -2179 _r_o_w_A_l_l_o_c_a_t_o_r__.deallocate(_r,_n); │ │ │ │ │ -2180 _r = nullptr; │ │ │ │ │ -2181 } │ │ │ │ │ -2182 │ │ │ │ │ -2183 // Mark matrix as not built at all. │ │ │ │ │ -2184 _r_e_a_d_y=_n_o_t_A_l_l_o_c_a_t_e_d; │ │ │ │ │ -2185 │ │ │ │ │ -2186 } │ │ │ │ │ -2187 │ │ │ │ │ -_2_2_0_5 void _a_l_l_o_c_a_t_e(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e allocationSize, │ │ │ │ │ -bool allocateRows, bool allocate_data) │ │ │ │ │ -2206 { │ │ │ │ │ -2207 // Store size │ │ │ │ │ -2208 _n = rows; │ │ │ │ │ -2209 _m = columns; │ │ │ │ │ -2210 _n_n_z__ = allocationSize; │ │ │ │ │ -2211 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__ = allocationSize; │ │ │ │ │ -2212 │ │ │ │ │ -2213 // allocate rows │ │ │ │ │ -2214 if(allocateRows) { │ │ │ │ │ -2215 if (_n>0) { │ │ │ │ │ -2216 if (_r) │ │ │ │ │ -2217 DUNE_THROW(InvalidStateException,"Rows have already been allocated, cannot │ │ │ │ │ -allocate a second time"); │ │ │ │ │ -2218 _r = _r_o_w_A_l_l_o_c_a_t_o_r__.allocate(rows); │ │ │ │ │ -2219 // initialize row entries │ │ │ │ │ -2220 for(_r_o_w___t_y_p_e* ri=_r; ri!=_r+rows; ++ri) │ │ │ │ │ -2221 std::allocator_traits::construct(_r_o_w_A_l_l_o_c_a_t_o_r__, │ │ │ │ │ -ri, _r_o_w___t_y_p_e()); │ │ │ │ │ -2222 }else{ │ │ │ │ │ -2223 _r = 0; │ │ │ │ │ -2224 } │ │ │ │ │ -2225 } │ │ │ │ │ -2226 │ │ │ │ │ -2227 // allocate a and j_ array │ │ │ │ │ -2228 if (allocate_data) │ │ │ │ │ -2229 _a_l_l_o_c_a_t_e_D_a_t_a(); │ │ │ │ │ -2230 // allocate column indices only if not yet present (enable sharing) │ │ │ │ │ -2231 if (_a_l_l_o_c_a_t_i_o_n_S_i_z_e__>0) { │ │ │ │ │ -2232 // we copy allocator and size to the deleter since _j may outlive this │ │ │ │ │ -class │ │ │ │ │ -2233 if (!_j__.get()) │ │ │ │ │ -2234 _j__.reset(_s_i_z_e_A_l_l_o_c_a_t_o_r__.allocate(_a_l_l_o_c_a_t_i_o_n_S_i_z_e__), │ │ │ │ │ -2235 [alloc = _s_i_z_e_A_l_l_o_c_a_t_o_r__, size = _a_l_l_o_c_a_t_i_o_n_S_i_z_e__](auto ptr) mutable { │ │ │ │ │ -2236 alloc.deallocate(ptr, size); │ │ │ │ │ -2237 }); │ │ │ │ │ -2238 }else{ │ │ │ │ │ -2239 _j__.reset(); │ │ │ │ │ -2240 } │ │ │ │ │ -2241 │ │ │ │ │ -2242 // Mark the matrix as not built. │ │ │ │ │ -2243 _r_e_a_d_y = _b_u_i_l_d_i_n_g; │ │ │ │ │ -2244 } │ │ │ │ │ -2245 │ │ │ │ │ -_2_2_4_6 void _a_l_l_o_c_a_t_e_D_a_t_a() │ │ │ │ │ -2247 { │ │ │ │ │ -2248 if (_a) │ │ │ │ │ -2249 DUNE_THROW(InvalidStateException,"Cannot allocate data array (already │ │ │ │ │ -allocated)"); │ │ │ │ │ -2250 if (_a_l_l_o_c_a_t_i_o_n_S_i_z_e__>0) { │ │ │ │ │ -2251 _a = _a_l_l_o_c_a_t_o_r__.allocate(_a_l_l_o_c_a_t_i_o_n_S_i_z_e__); │ │ │ │ │ -2252 // use placement new to call constructor that allocates │ │ │ │ │ -2253 // additional memory. │ │ │ │ │ -2254 new (_a) B[_a_l_l_o_c_a_t_i_o_n_S_i_z_e__]; │ │ │ │ │ -2255 } else { │ │ │ │ │ -2256 _a = nullptr; │ │ │ │ │ -2257 } │ │ │ │ │ -2258 } │ │ │ │ │ -2259 │ │ │ │ │ -_2_2_6_5 void _i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e(_s_i_z_e___t_y_p_e _n, _s_i_z_e___t_y_p_e _m) │ │ │ │ │ -2266 { │ │ │ │ │ -2267 if (_b_u_i_l_d___m_o_d_e != _i_m_p_l_i_c_i_t) │ │ │ │ │ -2268 DUNE_THROW(InvalidStateException,"implicit_allocate() may only be called │ │ │ │ │ -in implicit build mode"); │ │ │ │ │ -2269 if (_r_e_a_d_y != _n_o_t_A_l_l_o_c_a_t_e_d) │ │ │ │ │ -2270 DUNE_THROW(InvalidStateException,"memory has already been allocated"); │ │ │ │ │ -2271 │ │ │ │ │ -2272 // check to make sure the user has actually set the parameters │ │ │ │ │ -2273 if (_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ < 0) │ │ │ │ │ -2274 DUNE_THROW(InvalidStateException,"You have to set the implicit build mode │ │ │ │ │ -parameters before starting to build the matrix"); │ │ │ │ │ -2275 //calculate size of overflow region, add buffer for row sort! │ │ │ │ │ -2276 _s_i_z_e___t_y_p_e osize = (_s_i_z_e___t_y_p_e) (_n*_a_v_g)*_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ + 4*_a_v_g; │ │ │ │ │ -2277 _a_l_l_o_c_a_t_i_o_n_S_i_z_e__ = _n*_a_v_g + osize; │ │ │ │ │ -2278 │ │ │ │ │ -2279 _a_l_l_o_c_a_t_e(_n, _m, _a_l_l_o_c_a_t_i_o_n_S_i_z_e__,true,true); │ │ │ │ │ -2280 │ │ │ │ │ -2281 //set row pointers correctly │ │ │ │ │ -2282 _s_i_z_e___t_y_p_e* jptr = _j__.get() + osize; │ │ │ │ │ -2283 B* aptr = _a + osize; │ │ │ │ │ -2284 for (_s_i_z_e___t_y_p_e i=0; i<_n; i++) │ │ │ │ │ -2285 { │ │ │ │ │ -2286 _r[i].set(0,aptr,jptr); │ │ │ │ │ -2287 jptr = jptr + _a_v_g; │ │ │ │ │ -2288 aptr = aptr + _a_v_g; │ │ │ │ │ -2289 } │ │ │ │ │ -2290 │ │ │ │ │ -2291 _r_e_a_d_y = _b_u_i_l_d_i_n_g; │ │ │ │ │ -2292 } │ │ │ │ │ -2293 }; │ │ │ │ │ -2294 │ │ │ │ │ -2295 │ │ │ │ │ -2296 template │ │ │ │ │ -_2_2_9_7 struct FieldTraits< _B_C_R_S_M_a_t_r_i_x > │ │ │ │ │ -2298 { │ │ │ │ │ -_2_2_9_9 using _f_i_e_l_d___t_y_p_e = typename _B_C_R_S_M_a_t_r_i_x_<_B_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_2_3_0_0 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ -2301 }; │ │ │ │ │ -2302 │ │ │ │ │ -2305} // end namespace │ │ │ │ │ -2306 │ │ │ │ │ -2307#endif │ │ │ │ │ +132 template │ │ │ │ │ +133 inline void │ │ │ │ │ +_1_3_4 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(const │ │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +135 _V_e_c_t_o_r& coarse, │ │ │ │ │ +136 const _V_e_c_t_o_r& fine, │ │ │ │ │ +137 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ │ +138 { │ │ │ │ │ +139 // Set coarse vector to zero │ │ │ │ │ +140 coarse=0; │ │ │ │ │ +141 │ │ │ │ │ +142 typedef typename Vector::const_iterator Iterator; │ │ │ │ │ +143 Iterator end = fine._e_n_d(); │ │ │ │ │ +144 Iterator begin=fine.begin(); │ │ │ │ │ +145 │ │ │ │ │ +146 for(Iterator block=begin; block != end; ++block) { │ │ │ │ │ +147 const _V_e_r_t_e_x& vertex = aggregates[block-begin]; │ │ │ │ │ +148 if(vertex != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ │ +149 coarse[vertex] += *block; │ │ │ │ │ +150 } │ │ │ │ │ +151 } │ │ │ │ │ +152 │ │ │ │ │ +153#if HAVE_MPI │ │ │ │ │ +154 template │ │ │ │ │ +155 template │ │ │ │ │ +_1_5_6 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ │ +prolongateVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +157 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ │ +158 _V_e_c_t_o_r& fineRedist, T3 damp, │ │ │ │ │ +159 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm, │ │ │ │ │ +160 const _R_e_d_i_s_t& redist) │ │ │ │ │ +161 { │ │ │ │ │ +162 if(fineRedist.size()>0) │ │ │ │ │ +163 // we operated on the coarse level │ │ │ │ │ +164 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ │ +fineRedist, damp); │ │ │ │ │ +165 │ │ │ │ │ +166 // TODO This could be accomplished with one communication, too! │ │ │ │ │ +167 redist._r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(fine, fineRedist); │ │ │ │ │ +168 comm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(fine,fine); │ │ │ │ │ +169 } │ │ │ │ │ +170 │ │ │ │ │ +171 template │ │ │ │ │ +172 template │ │ │ │ │ +_1_7_3 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ │ +prolongateVector( │ │ │ │ │ +174 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +175 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, T3 damp, │ │ │ │ │ +176 [[maybe_unused]] _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ │ +177 { │ │ │ │ │ +178 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ │ +fine, damp); │ │ │ │ │ +179 } │ │ │ │ │ +180 template │ │ │ │ │ +_1_8_1 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ │ +restrictVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ │ +182 _V_e_c_t_o_r& coarse, const _V_e_c_t_o_r& fine, │ │ │ │ │ +183 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ │ +184 { │ │ │ │ │ +185 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ │ +fine, _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ │ +186 // We need this here to avoid it in the smoothers on the coarse level. │ │ │ │ │ +187 // There (in the preconditioner d is const. │ │ │ │ │ +188 comm._p_r_o_j_e_c_t(coarse); │ │ │ │ │ +189 } │ │ │ │ │ +190#endif │ │ │ │ │ +192 } // namspace Amg │ │ │ │ │ +193} // namspace Dune │ │ │ │ │ +194#endif │ │ │ │ │ +_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. │ │ │ │ │ +_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... │ │ │ │ │ -_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ │ -_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 │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ │ +const_iterator end() const │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s │ │ │ │ │ -Statistics about compression achieved in implicit mode. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:88 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_o_v_e_r_f_l_o_w___t_o_t_a_l │ │ │ │ │ -size_type overflow_total │ │ │ │ │ -total number of elements written to the overflow area during construction. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_m_a_x_i_m_u_m │ │ │ │ │ -size_type maximum │ │ │ │ │ -maximum number of non-zeroes per row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_a_v_g │ │ │ │ │ -double avg │ │ │ │ │ -average number of non-zeroes per row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:90 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s_:_:_m_e_m___r_a_t_i_o │ │ │ │ │ -double mem_ratio │ │ │ │ │ -fraction of wasted memory resulting from non-used overflow area. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:99 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ -A wrapper for uniform access to the BCRSMatrix during and after the build stage │ │ │ │ │ -in implicit build mod... │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:117 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -Matrix::block_type block_type │ │ │ │ │ -The block_type of the underlying matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:125 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ -ImplicitMatrixBuilder(Matrix &m) │ │ │ │ │ -Creates an ImplicitMatrixBuilder for matrix m. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:170 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_M_a_t_r_i_x │ │ │ │ │ -M_ Matrix │ │ │ │ │ -The underlying matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:122 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r │ │ │ │ │ -ImplicitMatrixBuilder(Matrix &m, size_type rows, size_type cols, size_type │ │ │ │ │ -avg_cols_per_row, double overflow_fraction) │ │ │ │ │ -Sets up matrix m for implicit construction using the given parameters and │ │ │ │ │ -creates an ImplicitBmatrixu... │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_M │ │ │ │ │ -size_type M() const │ │ │ │ │ -The number of columns in the matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:217 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -Matrix::size_type size_type │ │ │ │ │ -The size_type of the underlying matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:128 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -row_object operator[](size_type i) const │ │ │ │ │ -Returns a proxy for entries in row i. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:205 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_N │ │ │ │ │ -size_type N() const │ │ │ │ │ -The number of rows in the matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:211 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_r_o_w___o_b_j_e_c_t │ │ │ │ │ -Proxy row object for entry access. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:137 │ │ │ │ │ -_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_a_t_r_i_x_B_u_i_l_d_e_r_:_:_r_o_w___o_b_j_e_c_t_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -block_type & operator[](size_type j) const │ │ │ │ │ -Returns entry in column j. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:488 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_o_w_A_l_l_o_c_a_t_o_r__ │ │ │ │ │ -std::allocator_traits< A >::template rebind_alloc< row_type > rowAllocator_ │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2025 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_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 pattern │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2007 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d_S_t_a_g_e │ │ │ │ │ -BuildStage buildStage() const │ │ │ │ │ -The current build stage of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1993 │ │ │ │ │ -_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:675 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_p_y_W_i_n_d_o_w_S_t_r_u_c_t_u_r_e │ │ │ │ │ -void copyWindowStructure(const BCRSMatrix &Mat) │ │ │ │ │ -Copy the window structure from another matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2122 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_t_r_y │ │ │ │ │ -B & entry(size_type row, size_type col) │ │ │ │ │ -Returns reference to entry (row,col) of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1296 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ -void mmhv(const X &x, Y &y) const │ │ │ │ │ -y -= A^H x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1812 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ -void usmhv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^H x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1835 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ -void umtv(const X &x, Y &y) const │ │ │ │ │ -y += A^T x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1722 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_S_i_z_e__ │ │ │ │ │ -double compressionBufferSize_ │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2047 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m │ │ │ │ │ -size_type m │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2031 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ │ -RealRowIterator< const row_type > const_iterator │ │ │ │ │ -The const iterator over the matrix rows. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:707 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ -static constexpr unsigned int blocklevel │ │ │ │ │ -increment block level counter │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:507 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_e │ │ │ │ │ -void allocate(size_type rows, size_type columns, size_type allocationSize, bool │ │ │ │ │ -allocateRows, bool allocate_data) │ │ │ │ │ -Allocate memory for the matrix structure. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2205 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_x_p_y │ │ │ │ │ -BCRSMatrix & axpy(field_type alpha, const BCRSMatrix &b) │ │ │ │ │ -Add the scaled entries of another matrix to this one. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1592 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ -FieldTraits< ft >::real_type infinity_norm_real() const │ │ │ │ │ -simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1905 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_~_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -~BCRSMatrix() │ │ │ │ │ -destructor │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:824 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_e_D_a_t_a │ │ │ │ │ -void allocateData() │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2246 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_d_e_a_l_l_o_c_a_t_e │ │ │ │ │ -void deallocate(bool deallocateRows=true) │ │ │ │ │ -deallocate memory of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2139 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_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 bcrsmatrix.hh:701 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -row_type & operator[](size_type i) │ │ │ │ │ -random access to the rows │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:549 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix() │ │ │ │ │ -an empty matrix │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:749 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_r_o_w_s_i_z_e_s │ │ │ │ │ -void endrowsizes() │ │ │ │ │ -indicate that size of all rows is defined │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1149 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_n_c_r_e_m_e_n_t_r_o_w_s_i_z_e │ │ │ │ │ -void incrementrowsize(size_type i, size_type s=1) │ │ │ │ │ -increment size of row i by s (1 by default) │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1138 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ -void mtv(const X &x, Y &y) const │ │ │ │ │ -y = A^T x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1707 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ -void umhv(const X &x, Y &y) const │ │ │ │ │ -y += A^H x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1789 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_o_n_z_e_r_o_e_s │ │ │ │ │ -size_type nonzeroes() const │ │ │ │ │ -number of blocks that are stored (the number of blocks that possibly are │ │ │ │ │ -nonzero) │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1984 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_i_o_n_S_i_z_e__ │ │ │ │ │ -size_type allocationSize_ │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2033 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_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 const row iterator for easier access │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:738 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_e_a_d_y │ │ │ │ │ -BuildStage ready │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2020 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d___m_o_d_e │ │ │ │ │ -BuildMode build_mode │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2019 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_r_o_w_s_i_z_e │ │ │ │ │ -void setrowsize(size_type i, size_type s) │ │ │ │ │ -Set number of indices in row i to s. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1117 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -RealRowIterator< row_type > Iterator │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:672 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_n_z__ │ │ │ │ │ -size_type nnz_ │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2032 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ -BCRSMatrix & operator*=(const field_type &k) │ │ │ │ │ -vector space multiplication with scalar │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1484 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e_A_l_l_o_c_a_t_o_r__ │ │ │ │ │ -std::allocator_traits< A >::template rebind_alloc< size_type > sizeAllocator_ │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2027 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_t_e_r_a_t_o_r │ │ │ │ │ -RealRowIterator< row_type > iterator │ │ │ │ │ -The iterator over the (mutable matrix rows. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:671 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ -void usmtv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^T x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1766 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -ConstIterator beforeBegin() const │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:732 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -RealRowIterator< const row_type > ConstIterator │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:708 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -Iterator beforeBegin() │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:695 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a │ │ │ │ │ -B * a │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2040 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_u_i_l_d_M_o_d_e │ │ │ │ │ -BuildMode │ │ │ │ │ -we support two modes │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:510 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_m_p_l_i_c_i_t │ │ │ │ │ -@ implicit │ │ │ │ │ -Build entries randomly with an educated guess for the number of entries per │ │ │ │ │ -row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:539 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_n_k_n_o_w_n │ │ │ │ │ -@ unknown │ │ │ │ │ -Build mode not set! │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:543 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_a_n_d_o_m │ │ │ │ │ -@ random │ │ │ │ │ -Build entries randomly. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:530 │ │ │ │ │ -_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:521 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix(size_type _n, size_type _m, size_type _nnz, BuildMode bm) │ │ │ │ │ -matrix with known number of nonzeroes │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:756 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_m_p_r_e_s_s_i_o_n_S_t_a_t_i_s_t_i_c_s │ │ │ │ │ -::Dune::CompressionStatistics< size_type > CompressionStatistics │ │ │ │ │ -The type for the statistics object returned by compress() │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:503 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ -BCRSMatrix & operator-=(const BCRSMatrix &b) │ │ │ │ │ -Subtract the entries of another matrix from this one. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1567 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix(const BCRSMatrix &Mat) │ │ │ │ │ -copy constructor │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:805 │ │ │ │ │ -_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:681 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r │ │ │ │ │ -row_type * r │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2037 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_I_n_d_i_c_e_s │ │ │ │ │ -void setIndices(size_type row, It begin, It end) │ │ │ │ │ -Set all column indices for row from the given iterator range. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1234 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_d_d_i_n_d_e_x │ │ │ │ │ -void addindex(size_type row, size_type col) │ │ │ │ │ -add index (row,col) to the matrix │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1191 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_O_v_e_r_f_l_o_w_T_y_p_e │ │ │ │ │ -std::map< std::pair< size_type, size_type >, B > OverflowType │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2049 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -row_type::Iterator ColIterator │ │ │ │ │ -Iterator for the entries of each row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:704 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ -frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1877 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -The type for the index access and the size. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ -BCRSMatrix & operator/=(const field_type &k) │ │ │ │ │ -vector space division by scalar │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1512 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_v_e_r_f_l_o_w │ │ │ │ │ -OverflowType overflow │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2050 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ -BCRSMatrix & operator+=(const BCRSMatrix &b) │ │ │ │ │ -Add the entries of another matrix to this one. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1545 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix(size_type _n, size_type _m, size_type _avg, double │ │ │ │ │ -compressionBufferSize, BuildMode bm) │ │ │ │ │ -construct matrix with a known average number of entries per row │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:784 │ │ │ │ │ -_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_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm2() const │ │ │ │ │ -square of frobenius norm, need for block recursion │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1860 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -Iterator beforeEnd() │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:688 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -row_type::ConstIterator ConstColIterator │ │ │ │ │ -Const iterator to the entries of a row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:741 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ -void usmv(F &&alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1684 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_g_e_t_r_o_w_s_i_z_e │ │ │ │ │ -size_type getrowsize(size_type i) const │ │ │ │ │ -get current number of indices in row i │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1128 │ │ │ │ │ -_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:1978 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n │ │ │ │ │ -size_type n │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2030 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ -Imp::CompressedBlockVectorWindow< B, A > row_type │ │ │ │ │ -implement row_type with compressed vector │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:497 │ │ │ │ │ -_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_:_:_B_u_i_l_d_S_t_a_g_e │ │ │ │ │ -BuildStage │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:469 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_o_w_S_i_z_e_s_B_u_i_l_t │ │ │ │ │ -@ rowSizesBuilt │ │ │ │ │ -The row sizes of the matrix are known. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:480 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_t │ │ │ │ │ -@ built │ │ │ │ │ -The matrix structure is fully built. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:482 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_o_t_b_u_i_l_t │ │ │ │ │ -@ notbuilt │ │ │ │ │ -Matrix is not built at all, no memory has been allocated, build mode and size │ │ │ │ │ -can still be set. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:471 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_n_o_t_A_l_l_o_c_a_t_e_d │ │ │ │ │ -@ notAllocated │ │ │ │ │ -Matrix is not built at all, no memory has been allocated, build mode and size │ │ │ │ │ -can still be set. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:473 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d_i_n_g │ │ │ │ │ -@ building │ │ │ │ │ -Matrix is currently being built, some memory has been allocated, build mode and │ │ │ │ │ -size are fixed. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:475 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_u_i_l_d_M_o_d_e │ │ │ │ │ -BuildMode buildMode() const │ │ │ │ │ -The currently selected build mode of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1999 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ -void mmv(const X &x, Y &y) const │ │ │ │ │ -y -= A x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1661 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ -FieldTraits< ft >::real_type infinity_norm() const │ │ │ │ │ -infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1885 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ -void mv(const X &x, Y &y) const │ │ │ │ │ -y = A x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1612 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -B block_type │ │ │ │ │ -export the type representing the components │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:491 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ -void mmtv(const X &x, Y &y) const │ │ │ │ │ -y -= A^T x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1745 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_v_g │ │ │ │ │ -size_type avg │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2046 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ -void umv(const X &x, Y &y) const │ │ │ │ │ -y += A x │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1638 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_i_m_p_l_i_c_i_t___a_l_l_o_c_a_t_e │ │ │ │ │ -void implicit_allocate(size_type _n, size_type _m) │ │ │ │ │ -organizes allocation implicit mode calculates correct array size to be │ │ │ │ │ -allocated and sets the the win... │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2265 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_I_m_p_l_i_c_i_t_B_u_i_l_d_M_o_d_e_P_a_r_a_m_e_t_e_r_s │ │ │ │ │ -void setImplicitBuildModeParameters(size_type _avg, double │ │ │ │ │ -compressionBufferSize) │ │ │ │ │ -Set parameters needed for creation in implicit build mode. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:889 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -BCRSMatrix(size_type _n, size_type _m, BuildMode bm) │ │ │ │ │ -matrix with unknown number of nonzeroes │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:765 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d_i_n_d_i_c_e_s │ │ │ │ │ -void endindices() │ │ │ │ │ -indicate that all indices are defined, check consistency │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1248 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_o_m_p_r_e_s_s │ │ │ │ │ -CompressionStatistics compress() │ │ │ │ │ -Finishes the buildstage in implicit mode. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1360 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_D_a_t_a_P_o_i_n_t_e_r_s │ │ │ │ │ -void setDataPointers() │ │ │ │ │ -Set data pointers for all rows. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2103 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r__ │ │ │ │ │ -std::allocator_traits< A >::template rebind_alloc< B > allocator_ │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2023 │ │ │ │ │ -_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:1972 │ │ │ │ │ -_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:833 │ │ │ │ │ -_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:861 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_j__ │ │ │ │ │ -std::shared_ptr< size_type > j_ │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2043 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_W_i_n_d_o_w_P_o_i_n_t_e_r_s │ │ │ │ │ -void setWindowPointers(ConstRowIterator row) │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2052 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -BCRSMatrix & operator=(const BCRSMatrix &Mat) │ │ │ │ │ -assignment │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:911 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_C_o_l_u_m_n_P_o_i_n_t_e_r_s │ │ │ │ │ -void setColumnPointers(ConstRowIterator row) │ │ │ │ │ -Copy row sizes from iterator range starting at row and set column index │ │ │ │ │ -pointers for all rows. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2077 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -ConstIterator end() const │ │ │ │ │ -Get const iterator to one beyond last row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:718 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ -ConstIterator begin() const │ │ │ │ │ -Get const iterator to first row. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:712 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ -A allocator_type │ │ │ │ │ -export the allocator type │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:494 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -ConstIterator beforeEnd() const │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:725 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator access to matrix rows │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:579 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -RealRowIterator() │ │ │ │ │ -empty constructor, use with care! │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:596 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const RealRowIterator< ValueType > &other) const │ │ │ │ │ -equality │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:624 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ │ -std::remove_const< T >::type ValueType │ │ │ │ │ -The unqualified value type. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:583 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -RealRowIterator(const RealRowIterator< ValueType > &it) │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:600 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const RealRowIterator< const ValueType > &other) const │ │ │ │ │ -equality │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:631 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -RealRowIterator(row_type *_p, size_type _i) │ │ │ │ │ -constructor │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:591 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -std::ptrdiff_t distanceTo(const RealRowIterator< const ValueType > &other) │ │ │ │ │ -const │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:617 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ -size_type index() const │ │ │ │ │ -return index │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:606 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_R_e_a_l_R_o_w_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -std::ptrdiff_t distanceTo(const RealRowIterator< ValueType > &other) const │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:611 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator class for sequential creation of blocks │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:957 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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 bcrsmatrix.hh:1052 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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 bcrsmatrix.hh:977 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ -size_type index() const │ │ │ │ │ -The number of the row that the iterator currently points to. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1058 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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 bcrsmatrix.hh:1046 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_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(BCRSMatrix &_Mat, size_type _i) │ │ │ │ │ -constructor │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:960 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_n_s_e_r_t │ │ │ │ │ -void insert(size_type j) │ │ │ │ │ -put column index in row │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1064 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ -bool contains(size_type j) │ │ │ │ │ -return true if column index is in row │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1070 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_s_i_z_e │ │ │ │ │ -size_type size() const │ │ │ │ │ -Get the current row size. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1079 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename BCRSMatrix< B, A >::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2299 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2300 │ │ │ │ │ -_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_:_:_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_:_:_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_:_:_P_o_i_n_t_e_r_C_o_m_p_a_r_e │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:538 │ │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_:_:_r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d │ │ │ │ │ +void redistributeBackward(D &from, const D &to) const │ │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ │ +owner/overlap/copy sema... │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ │ +void project(T1 &x) const │ │ │ │ │ +Set vector to zero at copy dofs. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:538 │ │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ │ +void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ │ +Communicate values from owner data points to all other data points. │ │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ │ +Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r │ │ │ │ │ +static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ +&coarse, const Vector &fine, T &comm) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ +&coarse, Vector &fine, T1 damp) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ +&coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R()) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_r_t_e_x │ │ │ │ │ +V1 Vertex │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_c_t_o_r │ │ │ │ │ +V2 Vector │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_R_e_d_i_s_t │ │ │ │ │ +RedistributeInformation< SequentialInformation > Redist │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_r_t_e_x │ │ │ │ │ +V Vertex │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_c_t_o_r │ │ │ │ │ +V1 Vector │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ +&coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation │ │ │ │ │ +&comm=SequentialInformation(), const Redist &redist=Redist()) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ │ +&coarse, Vector &fine, T1 damp, const SequentialInformation │ │ │ │ │ +&comm=SequentialInformation()) │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_r_t_e_x │ │ │ │ │ +V Vertex │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_R_e_d_i_s_t │ │ │ │ │ +RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_c_t_o_r │ │ │ │ │ +V1 Vector │ │ │ │ │ +DDeeffiinniittiioonn transfer.hh:79 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00182.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solver.hh File Reference │ │ │ │ +dune-istl: dependency.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,76 +65,69 @@ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ - │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <iomanip>
│ │ │ │ +
#include <bitset>
│ │ │ │ #include <ostream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <functional>
│ │ │ │ -#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/common/parametertree.hh>
│ │ │ │ -#include <dune/common/timer.hh>
│ │ │ │ -#include "solvertype.hh"
│ │ │ │ -#include "preconditioner.hh"
│ │ │ │ -#include "operators.hh"
│ │ │ │ -#include "scalarproducts.hh"
│ │ │ │ +#include "graph.hh"
│ │ │ │ +#include "properties.hh"
│ │ │ │ +#include <dune/common/propertymap.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::InverseOperatorResult
 Statistics about the application of an inverse operator. More...
class  Dune::Amg::EdgeProperties
 Class representing the properties of an ede in the matrix graph. More...
 
class  Dune::InverseOperator< X, Y >
 Abstract base class for all solvers. More...
class  Dune::Amg::VertexProperties
 Class representing a node in the matrix graph. More...
 
class  Dune::IterativeSolver< X, Y >
 Base class for all implementations of iterative solvers. More...
class  Dune::Amg::PropertyGraphVertexPropertyMap< G, i >
 
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...
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

│ │ │ │ -

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.

│ │ │ │ +

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

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,62 +1,56 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ + * _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 │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#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" │ │ │ │ │ +#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 │ │ │ │ │ -struct   _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ │ -  Statistics about the application of an inverse operator. _M_o_r_e_._._. │ │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +  Class representing the properties of an ede in the matrix graph. │ │ │ │ │ + _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_:_:_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_:_:_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_:_:_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_ _> │ │ │ │ │   │ │ │ │ │ - class   _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _Y_ _>_:_:_I_t_e_r_a_t_i_o_n_<_ _C_o_u_n_t_T_y_p_e_ _> │ │ │ │ │ -  Class for controlling iterative methods. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_<_ _I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_,_ _B_C_R_S_M_a_t_r_i_x_ _> │ │ │ │ │ - Helper class for notifying a DUNE-ISTL linear solver about a change of │ │ │ │ │ -  the iteration matrix object in a unified way, i.e. independent from │ │ │ │ │ - the solver's type (direct/iterative). _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_<_ _I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_,_ _B_C_R_S_M_a_t_r_i_x_ _>_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_< │ │ │ │ │ - _i_s___d_i_r_e_c_t___s_o_l_v_e_r_,_ _D_u_m_m_y_ _> │ │ │ │ │ -  _I_m_p_l_e_m_e_n_t_a_t_i_o_n that works together with iterative _I_S_T_L solvers, e.g. │ │ │ │ │ - _D_u_n_e_:_:_C_G_S_o_l_v_e_r or _D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_<_ _I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_,_ _B_C_R_S_M_a_t_r_i_x_ _>_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_< │ │ │ │ │ - _t_r_u_e_,_ _D_u_m_m_y_ _> │ │ │ │ │ -  _I_m_p_l_e_m_e_n_t_a_t_i_o_n that works together with direct _I_S_T_L solvers, e.g. │ │ │ │ │ - _D_u_n_e_:_:_S_u_p_e_r_L_U or _D_u_n_e_:_:_U_M_F_P_a_c_k. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_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 ********** │ │ │ │ │ -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. │ │ │ │ │ +Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00182_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solver.hh Source File │ │ │ │ +dune-istl: dependency.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,499 +70,490 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
solver.hh
│ │ │ │ +
dependency.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ +
5#ifndef DUNE_AMG_DEPENDENCY_HH
│ │ │ │ +
6#define DUNE_AMG_DEPENDENCY_HH
│ │ │ │ +
7
│ │ │ │
8
│ │ │ │ -
9#include <iomanip>
│ │ │ │ +
9#include <bitset>
│ │ │ │
10#include <ostream>
│ │ │ │ -
11#include <string>
│ │ │ │ -
12#include <functional>
│ │ │ │ -
13
│ │ │ │ -
14#include <dune/common/exceptions.hh>
│ │ │ │ -
15#include <dune/common/shared_ptr.hh>
│ │ │ │ -
16#include <dune/common/simd/io.hh>
│ │ │ │ -
17#include <dune/common/simd/simd.hh>
│ │ │ │ -
18#include <dune/common/parametertree.hh>
│ │ │ │ -
19#include <dune/common/timer.hh>
│ │ │ │ -
20
│ │ │ │ -
21#include "solvertype.hh"
│ │ │ │ -
22#include "preconditioner.hh"
│ │ │ │ -
23#include "operators.hh"
│ │ │ │ -
24#include "scalarproducts.hh"
│ │ │ │ -
25
│ │ │ │ -
26namespace Dune
│ │ │ │ -
27{
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
48 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
51 {
│ │ │ │ -
52 clear();
│ │ │ │ -
53 }
│ │ │ │ -
│ │ │ │ +
11
│ │ │ │ +
12#include "graph.hh"
│ │ │ │ +
13#include "properties.hh"
│ │ │ │ +
14#include <dune/common/propertymap.hh>
│ │ │ │ +
15
│ │ │ │ +
16
│ │ │ │ +
17namespace Dune
│ │ │ │ +
18{
│ │ │ │ +
19 namespace Amg
│ │ │ │ +
20 {
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
39 {
│ │ │ │ +
40 friend std::ostream& operator<<(std::ostream& os, const EdgeProperties& props);
│ │ │ │ +
41 public:
│ │ │ │ + │ │ │ │ +
44
│ │ │ │ +
45 private:
│ │ │ │ +
46
│ │ │ │ +
47 std::bitset<SIZE> flags_;
│ │ │ │ +
48 public:
│ │ │ │ + │ │ │ │ +
51
│ │ │ │ +
53 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ │
54
│ │ │ │ -
│ │ │ │ -
56 void clear ()
│ │ │ │ -
57 {
│ │ │ │ -
58 iterations = 0;
│ │ │ │ -
59 reduction = 0;
│ │ │ │ -
60 converged = false;
│ │ │ │ -
61 conv_rate = 1;
│ │ │ │ -
62 elapsed = 0;
│ │ │ │ - │ │ │ │ -
64 }
│ │ │ │ -
│ │ │ │ -
65
│ │ │ │ - │ │ │ │ -
68
│ │ │ │ -
70 double reduction;
│ │ │ │ -
71
│ │ │ │ - │ │ │ │ -
74
│ │ │ │ -
76 double conv_rate;
│ │ │ │ -
77
│ │ │ │ -
79 double condition_estimate = -1;
│ │ │ │ -
80
│ │ │ │ -
82 double elapsed;
│ │ │ │ -
83 };
│ │ │ │ -
│ │ │ │ -
84
│ │ │ │ -
85
│ │ │ │ -
86 //=====================================================================
│ │ │ │ -
98 template<class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
100 public:
│ │ │ │ -
102 typedef X domain_type;
│ │ │ │ +
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
│ │ │ │ -
105 typedef Y range_type;
│ │ │ │ -
106
│ │ │ │ -
108 typedef typename X::field_type field_type;
│ │ │ │ +
108 bool isStrong() const;
│ │ │ │
109
│ │ │ │ -
111 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ -
112
│ │ │ │ -
114 typedef Simd::Scalar<real_type> scalar_real_type;
│ │ │ │ -
115
│ │ │ │ -
128 virtual void apply (X& x, Y& b, InverseOperatorResult& res) = 0;
│ │ │ │ -
129
│ │ │ │ -
143 virtual void apply (X& x, Y& b, double reduction, InverseOperatorResult& res) = 0;
│ │ │ │ +
113 void reset();
│ │ │ │ +
114
│ │ │ │ +
118 void printFlags() const;
│ │ │ │ +
119 };
│ │ │ │ +
│ │ │ │ +
120
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
127 friend std::ostream& operator<<(std::ostream& os, const VertexProperties& props);
│ │ │ │ +
128 public:
│ │ │ │ + │ │ │ │ +
130 private:
│ │ │ │ +
131
│ │ │ │ +
133 std::bitset<SIZE> flags_;
│ │ │ │ +
134
│ │ │ │ +
135 public:
│ │ │ │ + │ │ │ │ +
138
│ │ │ │ +
140 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ │ +
141
│ │ │ │ +
143 bool operator[](std::size_t v) const;
│ │ │ │
144
│ │ │ │ - │ │ │ │ -
147#ifdef DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ │ -
148 {
│ │ │ │ -
149 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
│ │ │ │ -
150 }
│ │ │ │ -
151#else
│ │ │ │ -
152 = 0;
│ │ │ │ -
153#endif
│ │ │ │ -
154
│ │ │ │ -
156 virtual ~InverseOperator () {}
│ │ │ │ +
151 void setIsolated();
│ │ │ │ +
152
│ │ │ │ +
156 bool isolated() const;
│ │ │ │
157
│ │ │ │ -
158 protected:
│ │ │ │ -
159 // spacing values
│ │ │ │ -
160 enum { iterationSpacing = 5 , normSpacing = 16 };
│ │ │ │ -
161
│ │ │ │ -
│ │ │ │ -
163 void printHeader(std::ostream& s) const
│ │ │ │ -
164 {
│ │ │ │ -
165 s << std::setw(iterationSpacing) << " Iter";
│ │ │ │ -
166 s << std::setw(normSpacing) << "Defect";
│ │ │ │ -
167 s << std::setw(normSpacing) << "Rate" << std::endl;
│ │ │ │ -
168 }
│ │ │ │ -
│ │ │ │ -
169
│ │ │ │ -
171 template <typename CountType, typename DataType>
│ │ │ │ -
│ │ │ │ -
172 void printOutput(std::ostream& s,
│ │ │ │ -
173 const CountType& iter,
│ │ │ │ -
174 const DataType& norm,
│ │ │ │ -
175 const DataType& norm_old) const
│ │ │ │ -
176 {
│ │ │ │ -
177 const DataType rate = norm/norm_old;
│ │ │ │ -
178 s << std::setw(iterationSpacing) << iter << " ";
│ │ │ │ -
179 s << std::setw(normSpacing) << Simd::io(norm) << " ";
│ │ │ │ -
180 s << std::setw(normSpacing) << Simd::io(rate) << std::endl;
│ │ │ │ -
181 }
│ │ │ │ -
│ │ │ │ +
161 void resetIsolated();
│ │ │ │ +
162
│ │ │ │ +
166 void setVisited();
│ │ │ │ +
167
│ │ │ │ +
171 bool visited() const;
│ │ │ │ +
172
│ │ │ │ +
176 void resetVisited();
│ │ │ │ +
177
│ │ │ │ +
181 void setFront();
│ │ │ │
182
│ │ │ │ -
184 template <typename CountType, typename DataType>
│ │ │ │ -
│ │ │ │ -
185 void printOutput(std::ostream& s,
│ │ │ │ -
186 const CountType& iter,
│ │ │ │ -
187 const DataType& norm) const
│ │ │ │ -
188 {
│ │ │ │ -
189 s << std::setw(iterationSpacing) << iter << " ";
│ │ │ │ -
190 s << std::setw(normSpacing) << Simd::io(norm) << std::endl;
│ │ │ │ -
191 }
│ │ │ │ -
│ │ │ │ -
192 };
│ │ │ │ -
│ │ │ │ -
193
│ │ │ │ -
202 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
203 class IterativeSolver : public InverseOperator<X,Y>{
│ │ │ │ -
204 public:
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
208 using typename InverseOperator<X,Y>::real_type;
│ │ │ │ - │ │ │ │ -
210
│ │ │ │ -
│ │ │ │ -
230 IterativeSolver (const LinearOperator<X,Y>& op, Preconditioner<X,Y>& prec, scalar_real_type reduction, int maxit, int verbose) :
│ │ │ │ -
231 _op(stackobject_to_shared_ptr(op)),
│ │ │ │ -
232 _prec(stackobject_to_shared_ptr(prec)),
│ │ │ │ -
233 _sp(new SeqScalarProduct<X>),
│ │ │ │ -
234 _reduction(reduction), _maxit(maxit), _verbose(verbose), _category(SolverCategory::sequential)
│ │ │ │ -
235 {
│ │ │ │ - │ │ │ │ -
237 DUNE_THROW(InvalidSolverCategory, "LinearOperator has to be sequential!");
│ │ │ │ - │ │ │ │ -
239 DUNE_THROW(InvalidSolverCategory, "Preconditioner has to be sequential!");
│ │ │ │ -
240 }
│ │ │ │ -
│ │ │ │ -
241
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
263 scalar_real_type reduction, int maxit, int verbose) :
│ │ │ │ -
264 _op(stackobject_to_shared_ptr(op)),
│ │ │ │ -
265 _prec(stackobject_to_shared_ptr(prec)),
│ │ │ │ -
266 _sp(stackobject_to_shared_ptr(sp)),
│ │ │ │ -
267 _reduction(reduction), _maxit(maxit), _verbose(verbose), _category(SolverCategory::category(op))
│ │ │ │ -
268 {
│ │ │ │ - │ │ │ │ -
270 DUNE_THROW(InvalidSolverCategory, "LinearOperator and Preconditioner must have the same SolverCategory!");
│ │ │ │ - │ │ │ │ -
272 DUNE_THROW(InvalidSolverCategory, "LinearOperator and ScalarProduct must have the same SolverCategory!");
│ │ │ │ -
273 }
│ │ │ │ -
│ │ │ │ -
274
│ │ │ │ -
│ │ │ │ -
290 IterativeSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ │ -
291 IterativeSolver(op,std::make_shared<SeqScalarProduct<X>>(),prec,
│ │ │ │ -
292 configuration.get<real_type>("reduction"),
│ │ │ │ -
293 configuration.get<int>("maxit"),
│ │ │ │ -
294 configuration.get<int>("verbose"))
│ │ │ │ -
295 {}
│ │ │ │ -
│ │ │ │ -
296
│ │ │ │ -
│ │ │ │ -
313 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) :
│ │ │ │ -
314 IterativeSolver(op,sp,prec,
│ │ │ │ -
315 configuration.get<scalar_real_type>("reduction"),
│ │ │ │ -
316 configuration.get<int>("maxit"),
│ │ │ │ -
317 configuration.get<int>("verbose"))
│ │ │ │ -
318 {}
│ │ │ │ +
186 bool front() const;
│ │ │ │ +
187
│ │ │ │ +
191 void resetFront();
│ │ │ │ +
192
│ │ │ │ +
196 void setExcludedBorder();
│ │ │ │ +
197
│ │ │ │ +
202 bool excludedBorder() const;
│ │ │ │ +
203
│ │ │ │ +
207 void resetExcludedBorder();
│ │ │ │ +
208
│ │ │ │ +
212 void reset();
│ │ │ │ +
213
│ │ │ │ +
214 };
│ │ │ │ +
│ │ │ │ +
215
│ │ │ │ +
216 template<typename G, std::size_t i>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
218 : public RAPropertyMapHelper<typename std::bitset<VertexProperties::SIZE>::reference,
│ │ │ │ +
219 PropertyGraphVertexPropertyMap<G,i> >
│ │ │ │ +
220 {
│ │ │ │ +
221 public:
│ │ │ │ +
222
│ │ │ │ +
223 typedef ReadWritePropertyMapTag Category;
│ │ │ │ +
224
│ │ │ │ +
225 enum {
│ │ │ │ +
227 index = i
│ │ │ │ +
228 };
│ │ │ │ +
229
│ │ │ │ +
233 typedef G Graph;
│ │ │ │ +
234
│ │ │ │ +
238 typedef std::bitset<VertexProperties::SIZE> BitSet;
│ │ │ │ +
239
│ │ │ │ +
243 typedef typename BitSet::reference Reference;
│ │ │ │ +
244
│ │ │ │ +
248 typedef bool ValueType;
│ │ │ │ +
249
│ │ │ │ +
253 typedef typename G::VertexDescriptor Vertex;
│ │ │ │ +
254
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
260 : graph_(&g)
│ │ │ │ +
261 {}
│ │ │ │ +
│ │ │ │ +
262
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
267 : graph_(0)
│ │ │ │ +
268 {}
│ │ │ │ +
│ │ │ │ +
269
│ │ │ │ +
270
│ │ │ │ +
│ │ │ │ +
275 Reference operator[](const Vertex& vertex) const
│ │ │ │ +
276 {
│ │ │ │ +
277 return graph_->getVertexProperties(vertex)[index];
│ │ │ │ +
278 }
│ │ │ │ +
│ │ │ │ +
279 private:
│ │ │ │ +
280 Graph* graph_;
│ │ │ │ +
281 };
│ │ │ │ +
│ │ │ │ +
282
│ │ │ │ +
283 } // end namespace Amg
│ │ │ │ +
284
│ │ │ │ +
285 template<typename G, typename EP, typename VM, typename EM>
│ │ │ │ +
│ │ │ │ +
286 struct PropertyMapTypeSelector<Amg::VertexVisitedTag,Amg::PropertiesGraph<G,Amg::VertexProperties,EP,VM,EM> >
│ │ │ │ +
287 {
│ │ │ │ + │ │ │ │ +
289 };
│ │ │ │ +
│ │ │ │ +
290
│ │ │ │ +
291 template<typename G, typename EP, typename VM, typename EM>
│ │ │ │ +
292 typename PropertyMapTypeSelector<Amg::VertexVisitedTag,Amg::PropertiesGraph<G,Amg::VertexProperties,EP,VM,EM> >::Type
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
294 {
│ │ │ │ + │ │ │ │ +
296 }
│ │ │ │ +
│ │ │ │ +
297
│ │ │ │ +
298 namespace Amg
│ │ │ │ +
299 {
│ │ │ │ +
│ │ │ │ +
300 inline std::ostream& operator<<(std::ostream& os, const EdgeProperties& props)
│ │ │ │ +
301 {
│ │ │ │ +
302 return os << props.flags_;
│ │ │ │ +
303 }
│ │ │ │ +
│ │ │ │ +
304
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
306 : flags_()
│ │ │ │ +
307 {}
│ │ │ │ +
│ │ │ │ +
308
│ │ │ │ +
309 inline std::bitset<EdgeProperties::SIZE>::reference
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
311 {
│ │ │ │ +
312 return flags_[v];
│ │ │ │ +
313 }
│ │ │ │ +
│ │ │ │ +
314
│ │ │ │ +
│ │ │ │ +
315 inline bool EdgeProperties::operator[](std::size_t i) const
│ │ │ │ +
316 {
│ │ │ │ +
317 return flags_[i];
│ │ │ │ +
318 }
│ │ │ │
│ │ │ │
319
│ │ │ │ -
│ │ │ │ -
340 IterativeSolver (std::shared_ptr<const LinearOperator<X,Y>> op,
│ │ │ │ -
341 std::shared_ptr<const ScalarProduct<X>> sp,
│ │ │ │ -
342 std::shared_ptr<Preconditioner<X,Y>> prec,
│ │ │ │ -
343 scalar_real_type reduction, int maxit, int verbose) :
│ │ │ │ -
344 _op(op),
│ │ │ │ -
345 _prec(prec),
│ │ │ │ -
346 _sp(sp),
│ │ │ │ -
347 _reduction(reduction), _maxit(maxit), _verbose(verbose),
│ │ │ │ - │ │ │ │ -
349 {
│ │ │ │ - │ │ │ │ -
351 DUNE_THROW(InvalidSolverCategory, "LinearOperator and Preconditioner must have the same SolverCategory!");
│ │ │ │ - │ │ │ │ -
353 DUNE_THROW(InvalidSolverCategory, "LinearOperator and ScalarProduct must have the same SolverCategory!");
│ │ │ │ -
354 }
│ │ │ │ -
│ │ │ │ -
355
│ │ │ │ -
356 // #warning actually we want to have this as the default and just implement the second one
│ │ │ │ -
357 // //! \copydoc InverseOperator::apply(X&,Y&,InverseOperatorResult&)
│ │ │ │ -
358 // virtual void apply (X& x, Y& b, InverseOperatorResult& res)
│ │ │ │ -
359 // {
│ │ │ │ -
360 // apply(x,b,_reduction,res);
│ │ │ │ -
361 // }
│ │ │ │ -
362
│ │ │ │ -
363#ifndef DOXYGEN
│ │ │ │ -
364 // make sure the three-argument apply from the base class does not get shadowed
│ │ │ │ -
365 // by the redefined four-argument version below
│ │ │ │ -
366 using InverseOperator<X,Y>::apply;
│ │ │ │ -
367#endif
│ │ │ │ -
368
│ │ │ │ -
│ │ │ │ -
374 virtual void apply (X& x, X& b, double reduction, InverseOperatorResult& res)
│ │ │ │ -
375 {
│ │ │ │ -
376 scalar_real_type saved_reduction = _reduction;
│ │ │ │ -
377 _reduction = reduction;
│ │ │ │ -
378 this->apply(x,b,res);
│ │ │ │ -
379 _reduction = saved_reduction;
│ │ │ │ -
380 }
│ │ │ │ -
│ │ │ │ -
381
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
384 {
│ │ │ │ -
385 return _category;
│ │ │ │ -
386 }
│ │ │ │ -
│ │ │ │ -
387
│ │ │ │ -
│ │ │ │ -
388 std::string name() const{
│ │ │ │ -
389 std::string name = className(*this);
│ │ │ │ -
390 return name.substr(0, name.find("<"));
│ │ │ │ -
391 }
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
321 {
│ │ │ │ +
322 flags_.reset();
│ │ │ │ +
323 }
│ │ │ │ +
│ │ │ │ +
324
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
326 {
│ │ │ │ +
327 // Set the INFLUENCE bit
│ │ │ │ +
328 //flags_ |= (1<<INFLUENCE);
│ │ │ │ +
329 flags_.set(INFLUENCE);
│ │ │ │ +
330 }
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ -
410 template<class CountType = unsigned int>
│ │ │ │ -
│ │ │ │ -
411 class Iteration {
│ │ │ │ -
412 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
414 : _i(0)
│ │ │ │ -
415 , _res(res)
│ │ │ │ -
416 , _parent(parent)
│ │ │ │ -
417 , _valid(true)
│ │ │ │ -
418 {
│ │ │ │ -
419 res.clear();
│ │ │ │ -
420 if(_parent._verbose>0){
│ │ │ │ -
421 std::cout << "=== " << parent.name() << std::endl;
│ │ │ │ -
422 if(_parent._verbose > 1)
│ │ │ │ -
423 _parent.printHeader(std::cout);
│ │ │ │ -
424 }
│ │ │ │ -
425 }
│ │ │ │ -
│ │ │ │ -
426
│ │ │ │ -
427 Iteration(const Iteration&) = delete;
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
429 : _def0(other._def0)
│ │ │ │ -
430 , _def(other._def)
│ │ │ │ -
431 , _i(other._i)
│ │ │ │ -
432 , _watch(other._watch)
│ │ │ │ -
433 , _res(other._res)
│ │ │ │ -
434 , _parent(other._parent)
│ │ │ │ -
435 , _valid(other._valid)
│ │ │ │ -
436 {
│ │ │ │ -
437 other._valid = false;
│ │ │ │ -
438 }
│ │ │ │ +
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
│ │ │ │
│ │ │ │ - │ │ │ │ -
441 if(_valid)
│ │ │ │ -
442 finalize();
│ │ │ │ -
443 }
│ │ │ │ +
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
│ │ │ │
│ │ │ │ -
455 bool step(CountType i, real_type def){
│ │ │ │ -
456 if (!Simd::allTrue(isFinite(def))) // check for inf or NaN
│ │ │ │ -
457 {
│ │ │ │ -
458 if (_parent._verbose>0)
│ │ │ │ -
459 std::cout << "=== " << _parent.name() << ": abort due to infinite or NaN defect"
│ │ │ │ -
460 << std::endl;
│ │ │ │ -
461 DUNE_THROW(SolverAbort,
│ │ │ │ -
462 _parent.name() << ": defect=" << Simd::io(def)
│ │ │ │ -
463 << " is infinite or NaN");
│ │ │ │ -
464 }
│ │ │ │ -
465 if(i == 0)
│ │ │ │ -
466 _def0 = def;
│ │ │ │ -
467 if(_parent._verbose > 1){
│ │ │ │ -
468 if(i!=0)
│ │ │ │ -
469 _parent.printOutput(std::cout,i,def,_def);
│ │ │ │ -
470 else
│ │ │ │ -
471 _parent.printOutput(std::cout,i,def);
│ │ │ │ -
472 }
│ │ │ │ -
473 _def = def;
│ │ │ │ -
474 _i = i;
│ │ │ │ -
475 _res.converged = (Simd::allTrue(def<_def0*_parent._reduction || def<real_type(1E-30))); // convergence check
│ │ │ │ -
476 return _res.converged;
│ │ │ │ -
477 }
│ │ │ │ -
│ │ │ │ -
478
│ │ │ │ -
479 protected:
│ │ │ │ -
│ │ │ │ -
480 void finalize(){
│ │ │ │ -
481 _res.converged = (Simd::allTrue(_def<_def0*_parent._reduction || _def<real_type(1E-30)));
│ │ │ │ - │ │ │ │ -
483 _res.reduction = static_cast<double>(Simd::max(_def/_def0));
│ │ │ │ -
484 _res.conv_rate = pow(_res.reduction,1.0/_i);
│ │ │ │ -
485 _res.elapsed = _watch.elapsed();
│ │ │ │ -
486 if (_parent._verbose>0) // final print
│ │ │ │ -
487 {
│ │ │ │ -
488 std::cout << "=== rate=" << _res.conv_rate
│ │ │ │ -
489 << ", T=" << _res.elapsed
│ │ │ │ -
490 << ", TIT=" << _res.elapsed/_res.iterations
│ │ │ │ -
491 << ", IT=" << _res.iterations << std::endl;
│ │ │ │ -
492 }
│ │ │ │ -
493 }
│ │ │ │ -
│ │ │ │ -
494
│ │ │ │ -
495 real_type _def0 = 0.0, _def = 0.0;
│ │ │ │ -
496 CountType _i;
│ │ │ │ -
497 Timer _watch;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
500 bool _valid;
│ │ │ │ -
501 };
│ │ │ │ -
│ │ │ │ -
502
│ │ │ │ -
503 protected:
│ │ │ │ -
504 std::shared_ptr<const LinearOperator<X,Y>> _op;
│ │ │ │ -
505 std::shared_ptr<Preconditioner<X,Y>> _prec;
│ │ │ │ -
506 std::shared_ptr<const ScalarProduct<X>> _sp;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
511 };
│ │ │ │ -
│ │ │ │ -
512
│ │ │ │ -
520 template <typename ISTLLinearSolver, typename BCRSMatrix>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
522 {
│ │ │ │ -
523 public:
│ │ │ │ -
│ │ │ │ -
524 static void setMatrix (ISTLLinearSolver& solver,
│ │ │ │ -
525 const BCRSMatrix& matrix)
│ │ │ │ -
526 {
│ │ │ │ -
527 static const bool is_direct_solver
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
531 }
│ │ │ │ -
│ │ │ │ -
532
│ │ │ │ -
533 protected:
│ │ │ │ -
538 template <bool is_direct_solver, typename Dummy = void>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
540 {
│ │ │ │ -
│ │ │ │ -
541 static void setMatrix (ISTLLinearSolver&,
│ │ │ │ -
542 const BCRSMatrix&)
│ │ │ │ -
543 {}
│ │ │ │ -
│ │ │ │ -
544 };
│ │ │ │ -
│ │ │ │ -
545
│ │ │ │ -
550 template <typename Dummy>
│ │ │ │ -
│ │ │ │ -
551 struct Implementation<true,Dummy>
│ │ │ │ -
552 {
│ │ │ │ -
│ │ │ │ -
553 static void setMatrix (ISTLLinearSolver& solver,
│ │ │ │ -
554 const BCRSMatrix& matrix)
│ │ │ │ -
555 {
│ │ │ │ -
556 solver.setMatrix(matrix);
│ │ │ │ -
557 }
│ │ │ │ -
│ │ │ │ -
558 };
│ │ │ │ -
│ │ │ │ -
559 };
│ │ │ │ -
│ │ │ │ -
560
│ │ │ │ -
564}
│ │ │ │ -
565
│ │ │ │ -
566#endif
│ │ │ │ -
Define base class for scalar product and norm.
│ │ │ │ - │ │ │ │ -
Templates characterizing the type of a solver.
│ │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ -
STL namespace.
│ │ │ │ + │ │ │ │ +
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 building the matrix graph.
│ │ │ │ +
Provides classes for handling internal properties in a graph.
│ │ │ │ +
bool depends() const
Checks wether 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 wether 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 wether 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 wether 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 wether the node is marked as visited.
Definition dependency.hh:425
│ │ │ │ +
Reference operator[](const Vertex &vertex) const
Get the properties associated to a vertex.
Definition dependency.hh:275
│ │ │ │ +
void reset()
Reset all flags.
Definition dependency.hh:320
│ │ │ │ +
void resetDepends()
Resets the depends flag.
Definition dependency.hh:345
│ │ │ │ +
ReadWritePropertyMapTag Category
Definition dependency.hh:223
│ │ │ │ +
void resetIsolated()
Resets the isolated flag.
Definition dependency.hh:415
│ │ │ │ +
std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > &criterion)
Definition aggregates.hh:113
│ │ │ │ +
bool isStrong() const
Checks wether the edge is strong. I.e. the influence or depends flag is set.
Definition dependency.hh:377
│ │ │ │ +
bool front() const
Checks wether 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 wether the edge is one way. I.e. either the influence or the depends flag but is set.
Definition dependency.hh:364
│ │ │ │ +
@ index
the index to access in the bitset.
Definition dependency.hh:227
│ │ │ │ +
@ VISITED
Definition dependency.hh:129
│ │ │ │ +
@ ISOLATED
Definition dependency.hh:129
│ │ │ │ +
@ SIZE
Definition dependency.hh:129
│ │ │ │ +
@ BORDER
Definition dependency.hh:129
│ │ │ │ +
@ FRONT
Definition dependency.hh:129
│ │ │ │ +
@ DEPEND
Definition dependency.hh:43
│ │ │ │ +
@ SIZE
Definition dependency.hh:43
│ │ │ │ +
@ INFLUENCE
Definition dependency.hh:43
│ │ │ │
Definition allocator.hh:11
│ │ │ │
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
Thrown when a solver aborts due to some problem.
Definition istlexception.hh:46
│ │ │ │ -
A linear operator.
Definition operators.hh:67
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
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:48
│ │ │ │ -
InverseOperatorResult()
Default constructor.
Definition solver.hh:50
│ │ │ │ -
double condition_estimate
Estimate of condition number.
Definition solver.hh:79
│ │ │ │ -
double elapsed
Elapsed time in seconds.
Definition solver.hh:82
│ │ │ │ -
int iterations
Number of iterations.
Definition solver.hh:67
│ │ │ │ -
double reduction
Reduction achieved: .
Definition solver.hh:70
│ │ │ │ -
void clear()
Resets all data.
Definition solver.hh:56
│ │ │ │ -
double conv_rate
Convergence rate (average reduction per step)
Definition solver.hh:76
│ │ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
│ │ │ │ -
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ -
void printHeader(std::ostream &s) const
helper function for printing header of solver output
Definition solver.hh:163
│ │ │ │ -
virtual ~InverseOperator()
Destructor.
Definition solver.hh:156
│ │ │ │ -
void printOutput(std::ostream &s, const CountType &iter, const DataType &norm) const
helper function for printing solver output
Definition solver.hh:185
│ │ │ │ -
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:172
│ │ │ │ -
virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res)=0
apply inverse operator, with given convergence criteria.
│ │ │ │ -
Simd::Scalar< real_type > scalar_real_type
scalar type underlying the field_type
Definition solver.hh:114
│ │ │ │ -
Y range_type
Type of the range of the operator to be inverted.
Definition solver.hh:105
│ │ │ │ -
@ normSpacing
Definition solver.hh:160
│ │ │ │ -
@ iterationSpacing
Definition solver.hh:160
│ │ │ │ -
X domain_type
Type of the domain of the operator to be inverted.
Definition solver.hh:102
│ │ │ │ -
virtual void apply(X &x, Y &b, InverseOperatorResult &res)=0
Apply inverse operator,.
│ │ │ │ -
X::field_type field_type
The field type of the operator.
Definition solver.hh:108
│ │ │ │ -
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:111
│ │ │ │ -
virtual SolverCategory::Category category() const =0
Category of the solver (see SolverCategory::Category)
│ │ │ │ -
Base class for all implementations of iterative solvers.
Definition solver.hh:203
│ │ │ │ -
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:313
│ │ │ │ -
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solver.hh:290
│ │ │ │ -
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solver.hh:374
│ │ │ │ -
std::shared_ptr< const ScalarProduct< X > > _sp
Definition solver.hh:506
│ │ │ │ -
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:340
│ │ │ │ -
std::string name() const
Definition solver.hh:388
│ │ │ │ -
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:230
│ │ │ │ -
std::shared_ptr< const LinearOperator< X, Y > > _op
Definition solver.hh:504
│ │ │ │ -
int _maxit
Definition solver.hh:508
│ │ │ │ -
int _verbose
Definition solver.hh:509
│ │ │ │ -
scalar_real_type _reduction
Definition solver.hh:507
│ │ │ │ -
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:262
│ │ │ │ -
SolverCategory::Category _category
Definition solver.hh:510
│ │ │ │ -
std::shared_ptr< Preconditioner< X, Y > > _prec
Definition solver.hh:505
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition solver.hh:383
│ │ │ │ -
Class for controlling iterative methods.
Definition solver.hh:411
│ │ │ │ -
Iteration(const IterativeSolver &parent, InverseOperatorResult &res)
Definition solver.hh:413
│ │ │ │ -
Iteration(Iteration &&other)
Definition solver.hh:428
│ │ │ │ -
InverseOperatorResult & _res
Definition solver.hh:498
│ │ │ │ -
const IterativeSolver & _parent
Definition solver.hh:499
│ │ │ │ -
Timer _watch
Definition solver.hh:497
│ │ │ │ -
Iteration(const Iteration &)=delete
│ │ │ │ -
CountType _i
Definition solver.hh:496
│ │ │ │ -
real_type _def0
Definition solver.hh:495
│ │ │ │ -
bool step(CountType i, real_type def)
registers the iteration step, checks for invalid defect norm and convergence.
Definition solver.hh:455
│ │ │ │ -
void finalize()
Definition solver.hh:480
│ │ │ │ -
real_type _def
Definition solver.hh:495
│ │ │ │ -
~Iteration()
Definition solver.hh:440
│ │ │ │ -
bool _valid
Definition solver.hh:500
│ │ │ │ -
Helper class for notifying a DUNE-ISTL linear solver about a change of the iteration matrix object in...
Definition solver.hh:522
│ │ │ │ -
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:524
│ │ │ │ -
Implementation that works together with iterative ISTL solvers, e.g. Dune::CGSolver or Dune::BiCGSTAB...
Definition solver.hh:540
│ │ │ │ -
static void setMatrix(ISTLLinearSolver &, const BCRSMatrix &)
Definition solver.hh:541
│ │ │ │ -
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:553
│ │ │ │ -
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 solvertype.hh:16
│ │ │ │ +
Class representing the properties of an ede in the matrix graph.
Definition dependency.hh:39
│ │ │ │ +
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ │ +
Definition dependency.hh:220
│ │ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ │ +
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,642 +1,575 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -solver.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 (C) 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 │ │ │ │ │ +5#ifndef DUNE_AMG_DEPENDENCY_HH │ │ │ │ │ +6#define DUNE_AMG_DEPENDENCY_HH │ │ │ │ │ +7 │ │ │ │ │ 8 │ │ │ │ │ -9#include │ │ │ │ │ +9#include │ │ │ │ │ 10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20 │ │ │ │ │ -21#include "_s_o_l_v_e_r_t_y_p_e_._h_h" │ │ │ │ │ -22#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h" │ │ │ │ │ -23#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ │ -24#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ │ -25 │ │ │ │ │ -26namespace _D_u_n_e │ │ │ │ │ -27{ │ │ │ │ │ -_4_7 struct _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ │ -48 { │ │ │ │ │ -_5_0 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t () │ │ │ │ │ -51 { │ │ │ │ │ -52 _c_l_e_a_r(); │ │ │ │ │ -53 } │ │ │ │ │ +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 │ │ │ │ │ +17namespace _D_u_n_e │ │ │ │ │ +18{ │ │ │ │ │ +19 namespace Amg │ │ │ │ │ +20 { │ │ │ │ │ +_3_8 class _E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +39 { │ │ │ │ │ +40 friend std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& │ │ │ │ │ +props); │ │ │ │ │ +41 public: │ │ │ │ │ +_4_3 enum {_I_N_F_L_U_E_N_C_E, _D_E_P_E_N_D, _S_I_Z_E}; │ │ │ │ │ +44 │ │ │ │ │ +45 private: │ │ │ │ │ +46 │ │ │ │ │ +47 std::bitset flags_; │ │ │ │ │ +48 public: │ │ │ │ │ +50 _E_d_g_e_P_r_o_p_e_r_t_i_e_s(); │ │ │ │ │ +51 │ │ │ │ │ +53 std::bitset::reference _o_p_e_r_a_t_o_r_[_](std::size_t v); │ │ │ │ │ 54 │ │ │ │ │ -_5_6 void _c_l_e_a_r () │ │ │ │ │ -57 { │ │ │ │ │ -58 _i_t_e_r_a_t_i_o_n_s = 0; │ │ │ │ │ -59 _r_e_d_u_c_t_i_o_n = 0; │ │ │ │ │ -60 _c_o_n_v_e_r_g_e_d = false; │ │ │ │ │ -61 _c_o_n_v___r_a_t_e = 1; │ │ │ │ │ -62 _e_l_a_p_s_e_d = 0; │ │ │ │ │ -63 _c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e = -1; │ │ │ │ │ -64 } │ │ │ │ │ -65 │ │ │ │ │ -_6_7 int _i_t_e_r_a_t_i_o_n_s; │ │ │ │ │ -68 │ │ │ │ │ -_7_0 double _r_e_d_u_c_t_i_o_n; │ │ │ │ │ -71 │ │ │ │ │ -_7_3 bool _c_o_n_v_e_r_g_e_d; │ │ │ │ │ -74 │ │ │ │ │ -_7_6 double _c_o_n_v___r_a_t_e; │ │ │ │ │ -77 │ │ │ │ │ -_7_9 double _c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e = -1; │ │ │ │ │ -80 │ │ │ │ │ -_8_2 double _e_l_a_p_s_e_d; │ │ │ │ │ -83 }; │ │ │ │ │ -84 │ │ │ │ │ -85 │ │ │ │ │ -86 //===================================================================== │ │ │ │ │ -98 template │ │ │ │ │ -_9_9 class _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r { │ │ │ │ │ -100 public: │ │ │ │ │ -_1_0_2 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +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 │ │ │ │ │ -_1_0_5 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -106 │ │ │ │ │ -_1_0_8 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +108 bool _i_s_S_t_r_o_n_g() const; │ │ │ │ │ 109 │ │ │ │ │ -_1_1_1 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ -112 │ │ │ │ │ -_1_1_4 typedef Simd::Scalar _s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ │ -115 │ │ │ │ │ -_1_2_8 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; │ │ │ │ │ -129 │ │ │ │ │ -_1_4_3 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; │ │ │ │ │ +113 void _r_e_s_e_t(); │ │ │ │ │ +114 │ │ │ │ │ +_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 │ │ │ │ │ +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 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#ifdef DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ │ -148 { │ │ │ │ │ -149 DUNE_THROW(Dune::Exception,"It is necessary to implement the category │ │ │ │ │ -method in a derived classes, in the future this method will pure virtual."); │ │ │ │ │ -150 } │ │ │ │ │ -151#else │ │ │ │ │ -152 = 0; │ │ │ │ │ -153#endif │ │ │ │ │ -154 │ │ │ │ │ -_1_5_6 virtual _~_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r () {} │ │ │ │ │ +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 │ │ │ │ │ -158 protected: │ │ │ │ │ -159 // spacing values │ │ │ │ │ -_1_6_0 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 }; │ │ │ │ │ -161 │ │ │ │ │ -_1_6_3 void _p_r_i_n_t_H_e_a_d_e_r(std::ostream& s) const │ │ │ │ │ -164 { │ │ │ │ │ -165 s << std::setw(_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g) << " Iter"; │ │ │ │ │ -166 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << "Defect"; │ │ │ │ │ -167 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << "Rate" << std::endl; │ │ │ │ │ -168 } │ │ │ │ │ -169 │ │ │ │ │ -171 template │ │ │ │ │ -_1_7_2 void _p_r_i_n_t_O_u_t_p_u_t(std::ostream& s, │ │ │ │ │ -173 const CountType& iter, │ │ │ │ │ -174 const DataType& norm, │ │ │ │ │ -175 const DataType& norm_old) const │ │ │ │ │ -176 { │ │ │ │ │ -177 const DataType rate = norm/norm_old; │ │ │ │ │ -178 s << std::setw(_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g) << iter << " "; │ │ │ │ │ -179 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << Simd::io(norm) << " "; │ │ │ │ │ -180 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << Simd::io(rate) << std::endl; │ │ │ │ │ -181 } │ │ │ │ │ +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 │ │ │ │ │ -184 template │ │ │ │ │ -_1_8_5 void _p_r_i_n_t_O_u_t_p_u_t(std::ostream& s, │ │ │ │ │ -186 const CountType& iter, │ │ │ │ │ -187 const DataType& norm) const │ │ │ │ │ -188 { │ │ │ │ │ -189 s << std::setw(_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g) << iter << " "; │ │ │ │ │ -190 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << Simd::io(norm) << std::endl; │ │ │ │ │ -191 } │ │ │ │ │ -192 }; │ │ │ │ │ -193 │ │ │ │ │ -202 template │ │ │ │ │ -_2_0_3 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{ │ │ │ │ │ -204 public: │ │ │ │ │ -205 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; │ │ │ │ │ -206 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; │ │ │ │ │ -207 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; │ │ │ │ │ -208 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; │ │ │ │ │ -209 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; │ │ │ │ │ -210 │ │ │ │ │ -_2_3_0 _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) : │ │ │ │ │ -231 ___o_p(stackobject_to_shared_ptr(op)), │ │ │ │ │ -232 ___p_r_e_c(stackobject_to_shared_ptr(prec)), │ │ │ │ │ -233 ___s_p(new _S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t), │ │ │ │ │ -234 ___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) │ │ │ │ │ -235 { │ │ │ │ │ -236 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) │ │ │ │ │ -237 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!"); │ │ │ │ │ -238 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) │ │ │ │ │ -239 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!"); │ │ │ │ │ -240 } │ │ │ │ │ -241 │ │ │ │ │ -_2_6_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, 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, │ │ │ │ │ -263 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose) : │ │ │ │ │ -264 ___o_p(stackobject_to_shared_ptr(op)), │ │ │ │ │ -265 ___p_r_e_c(stackobject_to_shared_ptr(prec)), │ │ │ │ │ -266 ___s_p(stackobject_to_shared_ptr(sp)), │ │ │ │ │ -267 ___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)) │ │ │ │ │ -268 { │ │ │ │ │ -269 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)) │ │ │ │ │ -270 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!"); │ │ │ │ │ -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(sp)) │ │ │ │ │ -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 ScalarProduct must │ │ │ │ │ -have the same SolverCategory!"); │ │ │ │ │ -273 } │ │ │ │ │ -274 │ │ │ │ │ -_2_9_0 _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) : │ │ │ │ │ -291 _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, │ │ │ │ │ -292 configuration._g_e_t<_r_e_a_l___t_y_p_e>("reduction"), │ │ │ │ │ -293 configuration._g_e_t("maxit"), │ │ │ │ │ -294 configuration._g_e_t("verbose")) │ │ │ │ │ -295 {} │ │ │ │ │ -296 │ │ │ │ │ -_3_1_3 _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) : │ │ │ │ │ -314 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec, │ │ │ │ │ -315 configuration._g_e_t<_s_c_a_l_a_r___r_e_a_l___t_y_p_e>("reduction"), │ │ │ │ │ -316 configuration._g_e_t("maxit"), │ │ │ │ │ -317 configuration._g_e_t("verbose")) │ │ │ │ │ -318 {} │ │ │ │ │ +186 bool _f_r_o_n_t() const; │ │ │ │ │ +187 │ │ │ │ │ +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 │ │ │ │ │ +225 enum { │ │ │ │ │ +227 _i_n_d_e_x = i │ │ │ │ │ +_2_2_8 }; │ │ │ │ │ +229 │ │ │ │ │ +_2_3_3 typedef G _G_r_a_p_h; │ │ │ │ │ +234 │ │ │ │ │ +_2_3_8 typedef std::bitset _B_i_t_S_e_t; │ │ │ │ │ +239 │ │ │ │ │ +_2_4_3 typedef typename BitSet::reference _R_e_f_e_r_e_n_c_e; │ │ │ │ │ +244 │ │ │ │ │ +_2_4_8 typedef bool _V_a_l_u_e_T_y_p_e; │ │ │ │ │ +249 │ │ │ │ │ +_2_5_3 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ │ +254 │ │ │ │ │ +_2_5_9 _P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p(G& g) │ │ │ │ │ +260 : graph_(&g) │ │ │ │ │ +261 {} │ │ │ │ │ +262 │ │ │ │ │ +_2_6_6 _P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ │ +267 : graph_(0) │ │ │ │ │ +268 {} │ │ │ │ │ +269 │ │ │ │ │ +270 │ │ │ │ │ +_2_7_5 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x& vertex) const │ │ │ │ │ +276 { │ │ │ │ │ +277 return graph_->getVertexProperties(vertex)[_i_n_d_e_x]; │ │ │ │ │ +278 } │ │ │ │ │ +279 private: │ │ │ │ │ +280 _G_r_a_p_h* graph_; │ │ │ │ │ +281 }; │ │ │ │ │ +282 │ │ │ │ │ +283 } // end namespace Amg │ │ │ │ │ +284 │ │ │ │ │ +285 template │ │ │ │ │ +_2_8_6 struct PropertyMapTypeSelector > │ │ │ │ │ +287 { │ │ │ │ │ +_2_8_8 typedef _A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_: │ │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>, Amg::VertexProperties::VISITED> _T_y_p_e; │ │ │ │ │ +289 }; │ │ │ │ │ +290 │ │ │ │ │ +291 template │ │ │ │ │ +292 typename PropertyMapTypeSelector >::Type │ │ │ │ │ +_2_9_3 _g_e_t([[maybe_unused]] const _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g& tag, _A_m_g_:_: │ │ │ │ │ +_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>& graph) │ │ │ │ │ +294 { │ │ │ │ │ +295 return _A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_: │ │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>, _A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_I_S_I_T_E_D>(graph); │ │ │ │ │ +296 } │ │ │ │ │ +297 │ │ │ │ │ +298 namespace Amg │ │ │ │ │ +299 { │ │ │ │ │ +_3_0_0 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& │ │ │ │ │ +props) │ │ │ │ │ +301 { │ │ │ │ │ +302 return os << props.flags_; │ │ │ │ │ +303 } │ │ │ │ │ +304 │ │ │ │ │ +_3_0_5 inline _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s() │ │ │ │ │ +306 : flags_() │ │ │ │ │ +307 {} │ │ │ │ │ +308 │ │ │ │ │ +309 inline std::bitset::reference │ │ │ │ │ +_3_1_0 _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_](std::size_t v) │ │ │ │ │ +311 { │ │ │ │ │ +312 return flags_[v]; │ │ │ │ │ +313 } │ │ │ │ │ +314 │ │ │ │ │ +_3_1_5 inline bool _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_](std::size_t i) const │ │ │ │ │ +316 { │ │ │ │ │ +317 return flags_[i]; │ │ │ │ │ +318 } │ │ │ │ │ 319 │ │ │ │ │ -_3_4_0 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ │ -341 std::shared_ptr> sp, │ │ │ │ │ -342 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>> prec, │ │ │ │ │ -343 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose) : │ │ │ │ │ -344 ___o_p(op), │ │ │ │ │ -345 ___p_r_e_c(prec), │ │ │ │ │ -346 ___s_p(sp), │ │ │ │ │ -347 ___r_e_d_u_c_t_i_o_n(reduction), ___m_a_x_i_t(maxit), ___v_e_r_b_o_s_e(verbose), │ │ │ │ │ -348 ___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)) │ │ │ │ │ -349 { │ │ │ │ │ -350 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)) │ │ │ │ │ -351 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!"); │ │ │ │ │ -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(*sp)) │ │ │ │ │ -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 ScalarProduct must │ │ │ │ │ -have the same SolverCategory!"); │ │ │ │ │ -354 } │ │ │ │ │ -355 │ │ │ │ │ -356 // #warning actually we want to have this as the default and just implement │ │ │ │ │ -the second one │ │ │ │ │ -357 // //! \copydoc InverseOperator::apply(X&,Y&,InverseOperatorResult&) │ │ │ │ │ -358 // virtual void apply (X& x, Y& b, InverseOperatorResult& res) │ │ │ │ │ -359 // { │ │ │ │ │ -360 // apply(x,b,_reduction,res); │ │ │ │ │ -361 // } │ │ │ │ │ -362 │ │ │ │ │ -363#ifndef DOXYGEN │ │ │ │ │ -364 // make sure the three-argument apply from the base class does not get │ │ │ │ │ -shadowed │ │ │ │ │ -365 // by the redefined four-argument version below │ │ │ │ │ -366 using _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y; │ │ │ │ │ -367#endif │ │ │ │ │ -368 │ │ │ │ │ -_3_7_4 virtual void _a_p_p_l_y (X& x, X& b, double reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ │ -res) │ │ │ │ │ -375 { │ │ │ │ │ -376 _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; │ │ │ │ │ -377 ___r_e_d_u_c_t_i_o_n = reduction; │ │ │ │ │ -378 this->_a_p_p_l_y(x,b,res); │ │ │ │ │ -379 ___r_e_d_u_c_t_i_o_n = saved_reduction; │ │ │ │ │ -380 } │ │ │ │ │ -381 │ │ │ │ │ -_3_8_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -384 { │ │ │ │ │ -385 return ___c_a_t_e_g_o_r_y; │ │ │ │ │ -386 } │ │ │ │ │ -387 │ │ │ │ │ -_3_8_8 std::string _n_a_m_e() const{ │ │ │ │ │ -389 std::string _n_a_m_e = className(*this); │ │ │ │ │ -390 return _n_a_m_e.substr(0, _n_a_m_e.find("<")); │ │ │ │ │ -391 } │ │ │ │ │ +_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<((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 │ │ │ │ │ -410 template │ │ │ │ │ -_4_1_1 class _I_t_e_r_a_t_i_o_n { │ │ │ │ │ -412 public: │ │ │ │ │ -_4_1_3 _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) │ │ │ │ │ -414 : ___i(0) │ │ │ │ │ -415 , ___r_e_s(res) │ │ │ │ │ -416 , ___p_a_r_e_n_t(parent) │ │ │ │ │ -417 , ___v_a_l_i_d(true) │ │ │ │ │ -418 { │ │ │ │ │ -419 res._c_l_e_a_r(); │ │ │ │ │ -420 if(___p_a_r_e_n_t.___v_e_r_b_o_s_e>0){ │ │ │ │ │ -421 std::cout << "=== " << parent._n_a_m_e() << std::endl; │ │ │ │ │ -422 if(___p_a_r_e_n_t.___v_e_r_b_o_s_e > 1) │ │ │ │ │ -423 ___p_a_r_e_n_t._p_r_i_n_t_H_e_a_d_e_r(std::cout); │ │ │ │ │ -424 } │ │ │ │ │ -425 } │ │ │ │ │ -426 │ │ │ │ │ -_4_2_7 _I_t_e_r_a_t_i_o_n(const _I_t_e_r_a_t_i_o_n&) = delete; │ │ │ │ │ -_4_2_8 _I_t_e_r_a_t_i_o_n(_I_t_e_r_a_t_i_o_n&& other) │ │ │ │ │ -429 : ___d_e_f_0(other.___d_e_f_0) │ │ │ │ │ -430 , ___d_e_f(other.___d_e_f) │ │ │ │ │ -431 , ___i(other.___i) │ │ │ │ │ -432 , ___w_a_t_c_h(other.___w_a_t_c_h) │ │ │ │ │ -433 , ___r_e_s(other.___r_e_s) │ │ │ │ │ -434 , ___p_a_r_e_n_t(other.___p_a_r_e_n_t) │ │ │ │ │ -435 , ___v_a_l_i_d(other.___v_a_l_i_d) │ │ │ │ │ +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 other._valid = false; │ │ │ │ │ +437 flags_.set(_F_R_O_N_T); │ │ │ │ │ 438 } │ │ │ │ │ 439 │ │ │ │ │ -_4_4_0 _~_I_t_e_r_a_t_i_o_n(){ │ │ │ │ │ -441 if(___v_a_l_i_d) │ │ │ │ │ -442 _f_i_n_a_l_i_z_e(); │ │ │ │ │ +_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_5_5 bool _s_t_e_p(CountType i, _r_e_a_l___t_y_p_e def){ │ │ │ │ │ -456 if (!Simd::allTrue(isFinite(def))) // check for inf or NaN │ │ │ │ │ -457 { │ │ │ │ │ -458 if (___p_a_r_e_n_t.___v_e_r_b_o_s_e>0) │ │ │ │ │ -459 std::cout << "=== " << ___p_a_r_e_n_t._n_a_m_e() << ": abort due to infinite or NaN │ │ │ │ │ -defect" │ │ │ │ │ -460 << std::endl; │ │ │ │ │ -461 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t, │ │ │ │ │ -462 ___p_a_r_e_n_t._n_a_m_e() << ": defect=" << Simd::io(def) │ │ │ │ │ -463 << " is infinite or NaN"); │ │ │ │ │ -464 } │ │ │ │ │ -465 if(i == 0) │ │ │ │ │ -466 ___d_e_f_0 = def; │ │ │ │ │ -467 if(___p_a_r_e_n_t.___v_e_r_b_o_s_e > 1){ │ │ │ │ │ -468 if(i!=0) │ │ │ │ │ -469 ___p_a_r_e_n_t._p_r_i_n_t_O_u_t_p_u_t(std::cout,i,def,___d_e_f); │ │ │ │ │ -470 else │ │ │ │ │ -471 ___p_a_r_e_n_t._p_r_i_n_t_O_u_t_p_u_t(std::cout,i,def); │ │ │ │ │ -472 } │ │ │ │ │ -473 ___d_e_f = def; │ │ │ │ │ -474 ___i = i; │ │ │ │ │ -475 ___r_e_s._c_o_n_v_e_r_g_e_d = (Simd::allTrue(def<___d_e_f_0*___p_a_r_e_n_t.___r_e_d_u_c_t_i_o_n || │ │ │ │ │ -def<_r_e_a_l___t_y_p_e(1E-30))); // convergence check │ │ │ │ │ -476 return ___r_e_s._c_o_n_v_e_r_g_e_d; │ │ │ │ │ -477 } │ │ │ │ │ -478 │ │ │ │ │ -479 protected: │ │ │ │ │ -_4_8_0 void _f_i_n_a_l_i_z_e(){ │ │ │ │ │ -481 ___r_e_s._c_o_n_v_e_r_g_e_d = (Simd::allTrue(___d_e_f<___d_e_f_0*___p_a_r_e_n_t.___r_e_d_u_c_t_i_o_n || │ │ │ │ │ -___d_e_f<_r_e_a_l___t_y_p_e(1E-30))); │ │ │ │ │ -482 ___r_e_s._i_t_e_r_a_t_i_o_n_s = ___i; │ │ │ │ │ -483 ___r_e_s._r_e_d_u_c_t_i_o_n = static_cast(Simd::max(___d_e_f/___d_e_f_0)); │ │ │ │ │ -484 ___r_e_s._c_o_n_v___r_a_t_e = pow(___r_e_s._r_e_d_u_c_t_i_o_n,1.0/___i); │ │ │ │ │ -485 ___r_e_s._e_l_a_p_s_e_d = ___w_a_t_c_h.elapsed(); │ │ │ │ │ -486 if (___p_a_r_e_n_t.___v_e_r_b_o_s_e>0) // final print │ │ │ │ │ -487 { │ │ │ │ │ -488 std::cout << "=== rate=" << ___r_e_s._c_o_n_v___r_a_t_e │ │ │ │ │ -489 << ", T=" << ___r_e_s._e_l_a_p_s_e_d │ │ │ │ │ -490 << ", TIT=" << ___r_e_s._e_l_a_p_s_e_d/___r_e_s._i_t_e_r_a_t_i_o_n_s │ │ │ │ │ -491 << ", IT=" << ___r_e_s._i_t_e_r_a_t_i_o_n_s << std::endl; │ │ │ │ │ -492 } │ │ │ │ │ -493 } │ │ │ │ │ -494 │ │ │ │ │ -_4_9_5 _r_e_a_l___t_y_p_e ___d_e_f_0 = 0.0, ___d_e_f = 0.0; │ │ │ │ │ -_4_9_6 CountType ___i; │ │ │ │ │ -_4_9_7 Timer ___w_a_t_c_h; │ │ │ │ │ -_4_9_8 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& ___r_e_s; │ │ │ │ │ -_4_9_9 const _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r& ___p_a_r_e_n_t; │ │ │ │ │ -_5_0_0 bool ___v_a_l_i_d; │ │ │ │ │ -501 }; │ │ │ │ │ -502 │ │ │ │ │ -503 protected: │ │ │ │ │ -_5_0_4 std::shared_ptr> ___o_p; │ │ │ │ │ -_5_0_5 std::shared_ptr> ___p_r_e_c; │ │ │ │ │ -_5_0_6 std::shared_ptr> ___s_p; │ │ │ │ │ -_5_0_7 _s_c_a_l_a_r___r_e_a_l___t_y_p_e ___r_e_d_u_c_t_i_o_n; │ │ │ │ │ -_5_0_8 int ___m_a_x_i_t; │ │ │ │ │ -_5_0_9 int ___v_e_r_b_o_s_e; │ │ │ │ │ -_5_1_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; │ │ │ │ │ -511 }; │ │ │ │ │ -512 │ │ │ │ │ -520 template │ │ │ │ │ -_5_2_1 class _S_o_l_v_e_r_H_e_l_p_e_r │ │ │ │ │ -522 { │ │ │ │ │ -523 public: │ │ │ │ │ -_5_2_4 static void _s_e_t_M_a_t_r_i_x (ISTLLinearSolver& solver, │ │ │ │ │ -525 const _B_C_R_S_M_a_t_r_i_x& matrix) │ │ │ │ │ -526 { │ │ │ │ │ -527 static const bool is_direct_solver │ │ │ │ │ -528 = _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; │ │ │ │ │ -529 _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_>_:_: │ │ │ │ │ -530_ _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); │ │ │ │ │ -531 } │ │ │ │ │ -532 │ │ │ │ │ -533 protected: │ │ │ │ │ -538 template │ │ │ │ │ -_5_3_9 struct _I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ │ -540 { │ │ │ │ │ -_5_4_1 static void _s_e_t_M_a_t_r_i_x (ISTLLinearSolver&, │ │ │ │ │ -542 const _B_C_R_S_M_a_t_r_i_x&) │ │ │ │ │ -543 {} │ │ │ │ │ -544 }; │ │ │ │ │ -545 │ │ │ │ │ -550 template │ │ │ │ │ -_5_5_1 struct _I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ │ -552 { │ │ │ │ │ -_5_5_3 static void _s_e_t_M_a_t_r_i_x (ISTLLinearSolver& solver, │ │ │ │ │ -554 const _B_C_R_S_M_a_t_r_i_x& matrix) │ │ │ │ │ -555 { │ │ │ │ │ -556 solver.setMatrix(matrix); │ │ │ │ │ -557 } │ │ │ │ │ -558 }; │ │ │ │ │ -559 }; │ │ │ │ │ -560 │ │ │ │ │ -564} │ │ │ │ │ -565 │ │ │ │ │ -566#endif │ │ │ │ │ -_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 │ │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ │ -_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. │ │ │ │ │ +_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 │ │ │ │ │ +_g_r_a_p_h_._h_h │ │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ │ +_p_r_o_p_e_r_t_i_e_s_._h_h │ │ │ │ │ +Provides classes for handling internal properties in a 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 wether 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 wether 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 wether 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 wether 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 wether the node is marked as visited. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:425 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ +Reference operator[](const Vertex &vertex) const │ │ │ │ │ +Get the properties associated to a vertex. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t │ │ │ │ │ +void reset() │ │ │ │ │ +Reset all flags. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:320 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_D_e_p_e_n_d_s │ │ │ │ │ +void resetDepends() │ │ │ │ │ +Resets the depends flag. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:345 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ +ReadWritePropertyMapTag Category │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:223 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_I_s_o_l_a_t_e_d │ │ │ │ │ +void resetIsolated() │ │ │ │ │ +Resets the isolated flag. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:415 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > │ │ │ │ │ +&criterion) │ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:113 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_s_S_t_r_o_n_g │ │ │ │ │ +bool isStrong() const │ │ │ │ │ +Checks wether 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 wether 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 wether the edge is one way. I.e. either the influence or the depends │ │ │ │ │ +flag but is set. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:364 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_i_n_d_e_x │ │ │ │ │ +@ index │ │ │ │ │ +the index to access in the bitset. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:227 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_I_S_I_T_E_D │ │ │ │ │ +@ VISITED │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_I_S_O_L_A_T_E_D │ │ │ │ │ +@ ISOLATED │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_S_I_Z_E │ │ │ │ │ +@ SIZE │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_B_O_R_D_E_R │ │ │ │ │ +@ BORDER │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_F_R_O_N_T │ │ │ │ │ +@ FRONT │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_D_E_P_E_N_D │ │ │ │ │ +@ DEPEND │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_S_I_Z_E │ │ │ │ │ +@ SIZE │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_I_N_F_L_U_E_N_C_E │ │ │ │ │ +@ INFLUENCE │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ _D_u_n_e_:_:_g_e_t │ │ │ │ │ PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_A_b_o_r_t │ │ │ │ │ -Thrown when a solver aborts due to some problem. │ │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -A linear operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:67 │ │ │ │ │ -_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:32 │ │ │ │ │ -_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:48 │ │ │ │ │ -_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: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:79 │ │ │ │ │ -_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:82 │ │ │ │ │ -_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:67 │ │ │ │ │ -_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:70 │ │ │ │ │ -_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:56 │ │ │ │ │ -_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:76 │ │ │ │ │ -_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:73 │ │ │ │ │ -_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:99 │ │ │ │ │ -_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:163 │ │ │ │ │ -_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:156 │ │ │ │ │ -_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:185 │ │ │ │ │ -_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:172 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res)=0 │ │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e │ │ │ │ │ -Simd::Scalar< real_type > scalar_real_type │ │ │ │ │ -scalar type underlying the field_type │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:114 │ │ │ │ │ -_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:105 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_n_o_r_m_S_p_a_c_i_n_g │ │ │ │ │ -@ normSpacing │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:160 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g │ │ │ │ │ -@ iterationSpacing │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:160 │ │ │ │ │ -_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:102 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &x, Y &b, InverseOperatorResult &res)=0 │ │ │ │ │ -Apply inverse operator,. │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the operator. │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:108 │ │ │ │ │ -_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:111 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const =0 │ │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ │ -Base class for all implementations of iterative solvers. │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:203 │ │ │ │ │ -_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:313 │ │ │ │ │ -_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:290 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res) │ │ │ │ │ -Apply inverse operator with given reduction factor. │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:374 │ │ │ │ │ -_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:506 │ │ │ │ │ -_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:340 │ │ │ │ │ -_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:388 │ │ │ │ │ -_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:230 │ │ │ │ │ -_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:504 │ │ │ │ │ -_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:508 │ │ │ │ │ -_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:509 │ │ │ │ │ -_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: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_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:262 │ │ │ │ │ -_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:510 │ │ │ │ │ -_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:505 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:383 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ │ -Class for controlling iterative methods. │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:411 │ │ │ │ │ -_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:413 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ │ -Iteration(Iteration &&other) │ │ │ │ │ -DDeeffiinniittiioonn solver.hh:428 │ │ │ │ │ -_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: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_:_:___p_a_r_e_n_t │ │ │ │ │ -const IterativeSolver & _parent │ │ │ │ │ -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_:_:___w_a_t_c_h │ │ │ │ │ -Timer _watch │ │ │ │ │ -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(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:496 │ │ │ │ │ -_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:495 │ │ │ │ │ -_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:455 │ │ │ │ │ -_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:480 │ │ │ │ │ -_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:495 │ │ │ │ │ -_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:440 │ │ │ │ │ -_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:500 │ │ │ │ │ -_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:522 │ │ │ │ │ -_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:524 │ │ │ │ │ -_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:540 │ │ │ │ │ -_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:541 │ │ │ │ │ -_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:553 │ │ │ │ │ -_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_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ +_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 ede in the matrix graph. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ │ +Class representing a node in the matrix graph. │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:220 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ │ +Tag idnetifying the visited property of a vertex. │ │ │ │ │ +DDeeffiinniittiioonn properties.hh:29 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00185.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: vbvector.hh File Reference │ │ │ │ +dune-istl: bccsmatrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,53 +70,31 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces
│ │ │ │ -
vbvector.hh File Reference
│ │ │ │ +
bccsmatrix.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

??? │ │ │ │ -More...

│ │ │ │ -
#include <cmath>
│ │ │ │ -#include <complex>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <iterator>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <dune/common/iteratorfacades.hh>
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ -#include "bvector.hh"
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ +
#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/typetraits.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...
 
class  Dune::VariableBlockVector< B, A >::RealIterator< T, R >
 Iterator class for sequential access. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::ISTL
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

???

│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,36 +1,19 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 "_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> │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +bccsmatrix.hh File Reference │ │ │ │ │ +#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 │ │ │ │ │ -  Iterator class for sequential creation of blocks. _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_ _>_:_:_R_e_a_l_I_t_e_r_a_t_o_r_<_ _T_,_ _R_ _> │ │ │ │ │ -  Iterator class for sequential access. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -??? │ │ │ │ │ +namespace   _D_u_n_e_:_:_I_S_T_L │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00185_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: vbvector.hh Source File │ │ │ │ +dune-istl: bccsmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,853 +74,131 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
vbvector.hh
│ │ │ │ +
bccsmatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_BCCSMATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_BCCSMATRIX_HH
│ │ │ │
7
│ │ │ │ -
8#include <cmath>
│ │ │ │ -
9#include <complex>
│ │ │ │ -
10#include <iostream>
│ │ │ │ -
11#include <iterator>
│ │ │ │ -
12#include <memory>
│ │ │ │ -
13
│ │ │ │ -
14#include <dune/common/iteratorfacades.hh>
│ │ │ │ -
15#include "istlexception.hh"
│ │ │ │ -
16#include "bvector.hh"
│ │ │ │ -
17
│ │ │ │ - │ │ │ │ -
19
│ │ │ │ -
24namespace Dune {
│ │ │ │ -
25
│ │ │ │ -
41 template<class B, class A=std::allocator<B> >
│ │ │ │ -
│ │ │ │ -
42 class VariableBlockVector : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ -
43 // this derivation gives us all the blas level 1 and norms
│ │ │ │ -
44 // on the large array. However, access operators have to be
│ │ │ │ -
45 // overwritten.
│ │ │ │ -
46 {
│ │ │ │ -
47 // just a shorthand
│ │ │ │ -
48 typedef Imp::BlockVectorWindow<B,A> window_type;
│ │ │ │ -
49
│ │ │ │ -
50 public:
│ │ │ │ -
51
│ │ │ │ -
52 //===== type definitions and constants
│ │ │ │ +
8#include <dune/common/fmatrix.hh>
│ │ │ │ +
9#include <dune/common/fvector.hh>
│ │ │ │ +
10#include <dune/common/typetraits.hh>
│ │ │ │ +
11
│ │ │ │ +
│ │ │ │ +
12namespace Dune::ISTL::Impl
│ │ │ │ +
13{
│ │ │ │ +
27 template<class B, class I = typename std::allocator<B>::size_type>
│ │ │ │ +
28 class BCCSMatrix
│ │ │ │ +
29 {
│ │ │ │ +
30 public:
│ │ │ │ +
31 using Index = I;
│ │ │ │ +
32 using size_type = std::size_t;
│ │ │ │ +
33
│ │ │ │ +
36 BCCSMatrix()
│ │ │ │ +
37 : N_(0), M_(0), Nnz_(0), values(0), rowindex(0), colstart(0)
│ │ │ │ +
38 {}
│ │ │ │ +
39
│ │ │ │ +
41 ~BCCSMatrix()
│ │ │ │ +
42 {
│ │ │ │ +
43 if(N_+M_+Nnz_!=0)
│ │ │ │ +
44 free();
│ │ │ │ +
45 }
│ │ │ │ +
46
│ │ │ │ +
48 void setSize(size_type rows, size_type columns)
│ │ │ │ +
49 {
│ │ │ │ +
50 N_ = rows;
│ │ │ │ +
51 M_ = columns;
│ │ │ │ +
52 }
│ │ │ │
53
│ │ │ │ -
55 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
56
│ │ │ │ -
58 typedef A allocator_type;
│ │ │ │ -
59
│ │ │ │ -
64 typedef window_type& reference;
│ │ │ │ -
65
│ │ │ │ -
70 typedef const window_type& const_reference;
│ │ │ │ -
71
│ │ │ │ -
73 typedef typename A::size_type size_type;
│ │ │ │ -
74
│ │ │ │ - │ │ │ │ -
81
│ │ │ │ - │ │ │ │ -
85
│ │ │ │ -
89 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
90 static constexpr auto blocklevel = blockLevel<B>()+2;
│ │ │ │ -
91
│ │ │ │ -
92 //===== constructors and such
│ │ │ │ -
93
│ │ │ │ -
│ │ │ │ -
97 VariableBlockVector () : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ -
98 {
│ │ │ │ -
99 // nothing is known ...
│ │ │ │ -
100 nblocks = 0;
│ │ │ │ -
101 block = nullptr;
│ │ │ │ -
102 initialized = false;
│ │ │ │ -
103 }
│ │ │ │ -
│ │ │ │ -
104
│ │ │ │ -
│ │ │ │ -
108 explicit VariableBlockVector (size_type _nblocks) : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ -
109 {
│ │ │ │ -
110 // we can allocate the windows now
│ │ │ │ -
111 nblocks = _nblocks;
│ │ │ │ -
112 if (nblocks>0)
│ │ │ │ -
113 {
│ │ │ │ -
114 block = windowAllocator_.allocate(nblocks);
│ │ │ │ -
115 new (block) window_type[nblocks];
│ │ │ │ -
116 }
│ │ │ │ -
117 else
│ │ │ │ -
118 {
│ │ │ │ -
119 nblocks = 0;
│ │ │ │ -
120 block = nullptr;
│ │ │ │ -
121 }
│ │ │ │ -
122
│ │ │ │ -
123 // Note: memory in base class still not allocated
│ │ │ │ -
124 // the vector not usable
│ │ │ │ -
125 initialized = false;
│ │ │ │ -
126 }
│ │ │ │ -
│ │ │ │ -
127
│ │ │ │ -
│ │ │ │ -
134 VariableBlockVector (size_type _nblocks, size_type m) : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ -
135 {
│ │ │ │ -
136 // and we can allocate the big array in the base class
│ │ │ │ -
137 this->n = _nblocks*m;
│ │ │ │ -
138 if (this->n>0)
│ │ │ │ -
139 {
│ │ │ │ -
140 this->p = allocator_.allocate(this->n);
│ │ │ │ -
141 new (this->p)B[this->n];
│ │ │ │ -
142 }
│ │ │ │ -
143 else
│ │ │ │ -
144 {
│ │ │ │ -
145 this->n = 0;
│ │ │ │ -
146 this->p = nullptr;
│ │ │ │ -
147 }
│ │ │ │ +
58 size_type N() const
│ │ │ │ +
59 {
│ │ │ │ +
60 return N_;
│ │ │ │ +
61 }
│ │ │ │ +
62
│ │ │ │ +
64 size_type nonzeroes() const
│ │ │ │ +
65 {
│ │ │ │ +
66 return Nnz_;
│ │ │ │ +
67 }
│ │ │ │ +
68
│ │ │ │ +
73 size_type M() const
│ │ │ │ +
74 {
│ │ │ │ +
75 return M_;
│ │ │ │ +
76 }
│ │ │ │ +
77
│ │ │ │ +
84 B* getValues() const
│ │ │ │ +
85 {
│ │ │ │ +
86 return values;
│ │ │ │ +
87 }
│ │ │ │ +
88
│ │ │ │ +
95 Index* getRowIndex() const
│ │ │ │ +
96 {
│ │ │ │ +
97 return rowindex;
│ │ │ │ +
98 }
│ │ │ │ +
99
│ │ │ │ +
106 Index* getColStart() const
│ │ │ │ +
107 {
│ │ │ │ +
108 return colstart;
│ │ │ │ +
109 }
│ │ │ │ +
110
│ │ │ │ +
112 BCCSMatrix& operator=(const BCCSMatrix& mat)
│ │ │ │ +
113 {
│ │ │ │ +
114 if(N_+M_+Nnz_!=0)
│ │ │ │ +
115 free();
│ │ │ │ +
116 N_=mat.N_;
│ │ │ │ +
117 M_=mat.M_;
│ │ │ │ +
118 Nnz_= mat.Nnz_;
│ │ │ │ +
119 if(M_>0) {
│ │ │ │ +
120 colstart=new size_type[M_+1];
│ │ │ │ +
121 for(size_type i=0; i<=M_; ++i)
│ │ │ │ +
122 colstart[i]=mat.colstart[i];
│ │ │ │ +
123 }
│ │ │ │ +
124
│ │ │ │ +
125 if(Nnz_>0) {
│ │ │ │ +
126 values = new B[Nnz_];
│ │ │ │ +
127 rowindex = new size_type[Nnz_];
│ │ │ │ +
128
│ │ │ │ +
129 for(size_type i=0; i<Nnz_; ++i)
│ │ │ │ +
130 values[i]=mat.values[i];
│ │ │ │ +
131
│ │ │ │ +
132 for(size_type i=0; i<Nnz_; ++i)
│ │ │ │ +
133 rowindex[i]=mat.rowindex[i];
│ │ │ │ +
134 }
│ │ │ │ +
135 return *this;
│ │ │ │ +
136 }
│ │ │ │ +
137
│ │ │ │ +
139 virtual void free()
│ │ │ │ +
140 {
│ │ │ │ +
141 delete[] values;
│ │ │ │ +
142 delete[] rowindex;
│ │ │ │ +
143 delete[] colstart;
│ │ │ │ +
144 N_ = 0;
│ │ │ │ +
145 M_ = 0;
│ │ │ │ +
146 Nnz_ = 0;
│ │ │ │ +
147 }
│ │ │ │
148
│ │ │ │ -
149 // we can allocate the windows now
│ │ │ │ -
150 nblocks = _nblocks;
│ │ │ │ -
151 if (nblocks>0)
│ │ │ │ -
152 {
│ │ │ │ -
153 // allocate and construct the windows
│ │ │ │ -
154 block = windowAllocator_.allocate(nblocks);
│ │ │ │ -
155 new (block) window_type[nblocks];
│ │ │ │ -
156
│ │ │ │ -
157 // set the windows into the big array
│ │ │ │ -
158 for (size_type i=0; i<nblocks; ++i)
│ │ │ │ -
159 block[i].set(m,this->p+(i*m));
│ │ │ │ -
160 }
│ │ │ │ -
161 else
│ │ │ │ -
162 {
│ │ │ │ -
163 nblocks = 0;
│ │ │ │ -
164 block = nullptr;
│ │ │ │ -
165 }
│ │ │ │ -
166
│ │ │ │ -
167 // and the vector is usable
│ │ │ │ -
168 initialized = true;
│ │ │ │ -
169 }
│ │ │ │ -
│ │ │ │ -
170
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
173 {
│ │ │ │ -
174 // allocate the big array in the base class
│ │ │ │ -
175 this->n = a.n;
│ │ │ │ -
176 if (this->n>0)
│ │ │ │ -
177 {
│ │ │ │ -
178 // allocate and construct objects
│ │ │ │ -
179 this->p = allocator_.allocate(this->n);
│ │ │ │ -
180 new (this->p)B[this->n];
│ │ │ │ -
181
│ │ │ │ -
182 // copy data
│ │ │ │ -
183 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ -
184 }
│ │ │ │ -
185 else
│ │ │ │ -
186 {
│ │ │ │ -
187 this->n = 0;
│ │ │ │ -
188 this->p = nullptr;
│ │ │ │ -
189 }
│ │ │ │ -
190
│ │ │ │ -
191 // we can allocate the windows now
│ │ │ │ -
192 nblocks = a.nblocks;
│ │ │ │ -
193 if (nblocks>0)
│ │ │ │ -
194 {
│ │ │ │ -
195 // alloc
│ │ │ │ -
196 block = windowAllocator_.allocate(nblocks);
│ │ │ │ -
197 new (block) window_type[nblocks];
│ │ │ │ -
198
│ │ │ │ -
199 // and we must set the windows
│ │ │ │ -
200 block[0].set(a.block[0].getsize(),this->p); // first block
│ │ │ │ -
201 for (size_type i=1; i<nblocks; ++i) // and the rest
│ │ │ │ -
202 block[i].set(a.block[i].getsize(),block[i-1].getptr()+block[i-1].getsize());
│ │ │ │ -
203 }
│ │ │ │ -
204 else
│ │ │ │ -
205 {
│ │ │ │ -
206 nblocks = 0;
│ │ │ │ -
207 block = nullptr;
│ │ │ │ -
208 }
│ │ │ │ -
209
│ │ │ │ -
210 // and we have a usable vector
│ │ │ │ -
211 initialized = true;
│ │ │ │ -
212 }
│ │ │ │ -
│ │ │ │ -
213
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
216 {
│ │ │ │ -
217 if (this->n>0) {
│ │ │ │ -
218 size_type i=this->n;
│ │ │ │ -
219 while (i)
│ │ │ │ -
220 this->p[--i].~B();
│ │ │ │ -
221 allocator_.deallocate(this->p,this->n);
│ │ │ │ -
222 }
│ │ │ │ -
223 if (nblocks>0) {
│ │ │ │ -
224 size_type i=nblocks;
│ │ │ │ -
225 while (i)
│ │ │ │ -
226 block[--i].~window_type();
│ │ │ │ -
227 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ -
228 }
│ │ │ │ -
229
│ │ │ │ -
230 }
│ │ │ │ -
│ │ │ │ -
231
│ │ │ │ -
232
│ │ │ │ -
│ │ │ │ -
234 void resize (size_type _nblocks)
│ │ │ │ -
235 {
│ │ │ │ -
236 // deconstruct objects and deallocate memory if necessary
│ │ │ │ -
237 if (this->n>0) {
│ │ │ │ -
238 size_type i=this->n;
│ │ │ │ -
239 while (i)
│ │ │ │ -
240 this->p[--i].~B();
│ │ │ │ -
241 allocator_.deallocate(this->p,this->n);
│ │ │ │ -
242 }
│ │ │ │ -
243 if (nblocks>0) {
│ │ │ │ -
244 size_type i=nblocks;
│ │ │ │ -
245 while (i)
│ │ │ │ -
246 block[--i].~window_type();
│ │ │ │ -
247 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ -
248 }
│ │ │ │ -
249 this->n = 0;
│ │ │ │ -
250 this->p = nullptr;
│ │ │ │ -
251
│ │ │ │ -
252 // we can allocate the windows now
│ │ │ │ -
253 nblocks = _nblocks;
│ │ │ │ -
254 if (nblocks>0)
│ │ │ │ -
255 {
│ │ │ │ -
256 block = windowAllocator_.allocate(nblocks);
│ │ │ │ -
257 new (block) window_type[nblocks];
│ │ │ │ -
258 }
│ │ │ │ -
259 else
│ │ │ │ -
260 {
│ │ │ │ -
261 nblocks = 0;
│ │ │ │ -
262 block = nullptr;
│ │ │ │ -
263 }
│ │ │ │ -
264
│ │ │ │ -
265 // and the vector not fully usable
│ │ │ │ -
266 initialized = false;
│ │ │ │ -
267 }
│ │ │ │ -
│ │ │ │ -
268
│ │ │ │ -
│ │ │ │ -
270 void resize (size_type _nblocks, size_type m)
│ │ │ │ -
271 {
│ │ │ │ -
272 // deconstruct objects and deallocate memory if necessary
│ │ │ │ -
273 if (this->n>0) {
│ │ │ │ -
274 size_type i=this->n;
│ │ │ │ -
275 while (i)
│ │ │ │ -
276 this->p[--i].~B();
│ │ │ │ -
277 allocator_.deallocate(this->p,this->n);
│ │ │ │ -
278 }
│ │ │ │ -
279 if (nblocks>0) {
│ │ │ │ -
280 size_type i=nblocks;
│ │ │ │ -
281 while (i)
│ │ │ │ -
282 block[--i].~window_type();
│ │ │ │ -
283 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ -
284 }
│ │ │ │ -
285
│ │ │ │ -
286 // and we can allocate the big array in the base class
│ │ │ │ -
287 this->n = _nblocks*m;
│ │ │ │ -
288 if (this->n>0)
│ │ │ │ -
289 {
│ │ │ │ -
290 this->p = allocator_.allocate(this->n);
│ │ │ │ -
291 new (this->p)B[this->n];
│ │ │ │ -
292 }
│ │ │ │ -
293 else
│ │ │ │ -
294 {
│ │ │ │ -
295 this->n = 0;
│ │ │ │ -
296 this->p = nullptr;
│ │ │ │ -
297 }
│ │ │ │ -
298
│ │ │ │ -
299 // we can allocate the windows now
│ │ │ │ -
300 nblocks = _nblocks;
│ │ │ │ -
301 if (nblocks>0)
│ │ │ │ -
302 {
│ │ │ │ -
303 // allocate and construct objects
│ │ │ │ -
304 block = windowAllocator_.allocate(nblocks);
│ │ │ │ -
305 new (block) window_type[nblocks];
│ │ │ │ -
306
│ │ │ │ -
307 // set the windows into the big array
│ │ │ │ -
308 for (size_type i=0; i<nblocks; ++i)
│ │ │ │ -
309 block[i].set(m,this->p+(i*m));
│ │ │ │ -
310 }
│ │ │ │ -
311 else
│ │ │ │ -
312 {
│ │ │ │ -
313 nblocks = 0;
│ │ │ │ -
314 block = nullptr;
│ │ │ │ -
315 }
│ │ │ │ -
316
│ │ │ │ -
317 // and the vector is usable
│ │ │ │ -
318 initialized = true;
│ │ │ │ -
319 }
│ │ │ │ -
│ │ │ │ -
320
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
323 {
│ │ │ │ -
324 if (&a!=this) // check if this and a are different objects
│ │ │ │ -
325 {
│ │ │ │ -
326 // reallocate arrays if necessary
│ │ │ │ -
327 // Note: still the block sizes may vary !
│ │ │ │ -
328 if (this->n!=a.n || nblocks!=a.nblocks)
│ │ │ │ -
329 {
│ │ │ │ -
330 // deconstruct objects and deallocate memory if necessary
│ │ │ │ -
331 if (this->n>0) {
│ │ │ │ -
332 size_type i=this->n;
│ │ │ │ -
333 while (i)
│ │ │ │ -
334 this->p[--i].~B();
│ │ │ │ -
335 allocator_.deallocate(this->p,this->n);
│ │ │ │ -
336 }
│ │ │ │ -
337 if (nblocks>0) {
│ │ │ │ -
338 size_type i=nblocks;
│ │ │ │ -
339 while (i)
│ │ │ │ -
340 block[--i].~window_type();
│ │ │ │ -
341 windowAllocator_.deallocate(block,nblocks);
│ │ │ │ -
342 }
│ │ │ │ -
343
│ │ │ │ -
344 // allocate the big array in the base class
│ │ │ │ -
345 this->n = a.n;
│ │ │ │ -
346 if (this->n>0)
│ │ │ │ -
347 {
│ │ │ │ -
348 // allocate and construct objects
│ │ │ │ -
349 this->p = allocator_.allocate(this->n);
│ │ │ │ -
350 new (this->p)B[this->n];
│ │ │ │ -
351 }
│ │ │ │ -
352 else
│ │ │ │ -
353 {
│ │ │ │ -
354 this->n = 0;
│ │ │ │ -
355 this->p = nullptr;
│ │ │ │ -
356 }
│ │ │ │ -
357
│ │ │ │ -
358 // we can allocate the windows now
│ │ │ │ -
359 nblocks = a.nblocks;
│ │ │ │ -
360 if (nblocks>0)
│ │ │ │ -
361 {
│ │ │ │ -
362 // alloc
│ │ │ │ -
363 block = windowAllocator_.allocate(nblocks);
│ │ │ │ -
364 new (block) window_type[nblocks];
│ │ │ │ -
365 }
│ │ │ │ -
366 else
│ │ │ │ -
367 {
│ │ │ │ -
368 nblocks = 0;
│ │ │ │ -
369 block = nullptr;
│ │ │ │ -
370 }
│ │ │ │ -
371 }
│ │ │ │ -
372
│ │ │ │ -
373 // copy block structure, might be different although
│ │ │ │ -
374 // sizes are the same !
│ │ │ │ -
375 if (nblocks>0)
│ │ │ │ -
376 {
│ │ │ │ -
377 block[0].set(a.block[0].getsize(),this->p); // first block
│ │ │ │ -
378 for (size_type i=1; i<nblocks; ++i) // and the rest
│ │ │ │ -
379 block[i].set(a.block[i].getsize(),block[i-1].getptr()+block[i-1].getsize());
│ │ │ │ -
380 }
│ │ │ │ -
381
│ │ │ │ -
382 // and copy the data
│ │ │ │ -
383 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ -
384 }
│ │ │ │ -
385
│ │ │ │ -
386 // and we have a usable vector
│ │ │ │ -
387 initialized = true;
│ │ │ │ -
388
│ │ │ │ -
389 return *this; // Gebe Referenz zurueck damit a=b=c; klappt
│ │ │ │ -
390 }
│ │ │ │ -
│ │ │ │ -
391
│ │ │ │ -
392
│ │ │ │ -
393 //===== assignment from scalar
│ │ │ │ -
394
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
397 {
│ │ │ │ -
398 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ -
399 return *this;
│ │ │ │ -
400 }
│ │ │ │ -
│ │ │ │ -
401
│ │ │ │ -
402
│ │ │ │ -
403 //===== the creation interface
│ │ │ │ -
404
│ │ │ │ -
405 class CreateIterator;
│ │ │ │ -
406
│ │ │ │ -
407#ifndef DOXYGEN
│ │ │ │ -
408
│ │ │ │ -
409 // The window_type does not hand out a reference to its size,
│ │ │ │ -
410 // so in order to provide a valid iterator, we need a workaround
│ │ │ │ -
411 // to make assignment possible. This proxy enables just that by
│ │ │ │ -
412 // implicitly converting to the stored size for read access and
│ │ │ │ -
413 // tunneling assignment to the accessor method of the window.
│ │ │ │ -
414 struct SizeProxy
│ │ │ │ -
415 {
│ │ │ │ -
416
│ │ │ │ -
417 operator size_type() const
│ │ │ │ -
418 {
│ │ │ │ -
419 return target->getsize();
│ │ │ │ -
420 }
│ │ │ │ -
421
│ │ │ │ -
422 SizeProxy& operator=(size_type size)
│ │ │ │ -
423 {
│ │ │ │ -
424 target->setsize(size);
│ │ │ │ -
425 return *this;
│ │ │ │ -
426 }
│ │ │ │ -
427
│ │ │ │ -
428 private:
│ │ │ │ -
429
│ │ │ │ -
430 friend class CreateIterator;
│ │ │ │ -
431
│ │ │ │ -
432 SizeProxy(window_type& t)
│ │ │ │ -
433 : target(&t)
│ │ │ │ -
434 {}
│ │ │ │ -
435
│ │ │ │ -
436 window_type* target;
│ │ │ │ -
437 };
│ │ │ │ -
438
│ │ │ │ -
439#endif // DOXYGEN
│ │ │ │ -
440
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
443 {
│ │ │ │ -
444 public:
│ │ │ │ -
446 using iterator_category = std::output_iterator_tag;
│ │ │ │ -
447
│ │ │ │ - │ │ │ │ -
450
│ │ │ │ -
457 using difference_type = void;
│ │ │ │ -
458
│ │ │ │ - │ │ │ │ -
461
│ │ │ │ -
463 using reference = SizeProxy;
│ │ │ │ -
464
│ │ │ │ -
│ │ │ │ -
466 CreateIterator (VariableBlockVector& _v, int _i, bool _isEnd) :
│ │ │ │ -
467 v(_v),
│ │ │ │ -
468 i(_i),
│ │ │ │ -
469 isEnd(_isEnd) {}
│ │ │ │ -
│ │ │ │ -
470
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
472 // When the iterator gets destructed, we allocate the memory
│ │ │ │ -
473 // for the VariableBlockVector if
│ │ │ │ -
474 // 1. the current iterator was not created as enditerator
│ │ │ │ -
475 // 2. we're at the last block
│ │ │ │ -
476 // 3. the vector hasn't been initialized earlier
│ │ │ │ -
477 if (not isEnd && i==v.nblocks && not v.initialized)
│ │ │ │ -
478 v.allocate();
│ │ │ │ -
479 }
│ │ │ │ -
│ │ │ │ -
480
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
483 {
│ │ │ │ -
484 // go to next block
│ │ │ │ -
485 ++i;
│ │ │ │ -
486
│ │ │ │ -
487 return *this;
│ │ │ │ -
488 }
│ │ │ │ -
│ │ │ │ -
489
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
492 {
│ │ │ │ -
493 CreateIterator tmp(*this);
│ │ │ │ -
494 this->operator++();
│ │ │ │ -
495 return tmp;
│ │ │ │ -
496 }
│ │ │ │ -
│ │ │ │ -
497
│ │ │ │ -
│ │ │ │ -
499 bool operator!= (const CreateIterator& it) const
│ │ │ │ -
500 {
│ │ │ │ -
501 return (i!=it.i) || (&v!=&it.v);
│ │ │ │ -
502 }
│ │ │ │ -
│ │ │ │ -
503
│ │ │ │ -
│ │ │ │ -
505 bool operator== (const CreateIterator& it) const
│ │ │ │ -
506 {
│ │ │ │ -
507 return (i==it.i) && (&v==&it.v);
│ │ │ │ -
508 }
│ │ │ │ -
│ │ │ │ -
509
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
512 {
│ │ │ │ -
513 return i;
│ │ │ │ -
514 }
│ │ │ │ -
│ │ │ │ -
515
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
518 {
│ │ │ │ -
519 v.block[i].setsize(_k);
│ │ │ │ -
520 }
│ │ │ │ -
│ │ │ │ -
521
│ │ │ │ -
523#ifdef DOXYGEN
│ │ │ │ -
524 size_type&
│ │ │ │ -
525#else
│ │ │ │ -
526 SizeProxy
│ │ │ │ -
527#endif
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
529 {
│ │ │ │ -
530 return {v.block[i]};
│ │ │ │ -
531 }
│ │ │ │ -
│ │ │ │ -
532
│ │ │ │ -
533 private:
│ │ │ │ -
534 VariableBlockVector& v; // my vector
│ │ │ │ -
535 size_type i; // current block to be defined
│ │ │ │ -
536 const bool isEnd; // flag if this object was created as the end iterator.
│ │ │ │ -
537 };
│ │ │ │ -
│ │ │ │ -
538
│ │ │ │ -
539 // CreateIterator wants to set all the arrays ...
│ │ │ │ -
540 friend class CreateIterator;
│ │ │ │ -
541
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
544 {
│ │ │ │ -
545#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
546 if (initialized) DUNE_THROW(ISTLError,"no CreateIterator in initialized state");
│ │ │ │ -
547#endif
│ │ │ │ -
548 return CreateIterator(*this,0, false);
│ │ │ │ -
549 }
│ │ │ │ -
│ │ │ │ -
550
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
553 {
│ │ │ │ -
554 return CreateIterator(*this,nblocks, true);
│ │ │ │ -
555 }
│ │ │ │ -
│ │ │ │ -
556
│ │ │ │ -
557
│ │ │ │ -
558 //===== access to components
│ │ │ │ -
559 // has to be overwritten from base class because it must
│ │ │ │ -
560 // return access to the windows
│ │ │ │ -
561
│ │ │ │ -
│ │ │ │ -
563 window_type& operator[] (size_type i)
│ │ │ │ -
564 {
│ │ │ │ -
565#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
566 if (i>=nblocks) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
567#endif
│ │ │ │ -
568 return block[i];
│ │ │ │ -
569 }
│ │ │ │ -
│ │ │ │ -
570
│ │ │ │ -
│ │ │ │ -
572 const window_type& operator[] (size_type i) const
│ │ │ │ -
573 {
│ │ │ │ -
574#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
575 if (i<0 || i>=nblocks) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
576#endif
│ │ │ │ -
577 return block[i];
│ │ │ │ -
578 }
│ │ │ │ -
│ │ │ │ -
579
│ │ │ │ -
581 template <class T, class R>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
583 : public RandomAccessIteratorFacade<RealIterator<T,R>, T, R>
│ │ │ │ -
584 {
│ │ │ │ -
585 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
588 {
│ │ │ │ -
589 p = nullptr;
│ │ │ │ -
590 i = 0;
│ │ │ │ -
591 }
│ │ │ │ -
│ │ │ │ -
592
│ │ │ │ -
│ │ │ │ -
594 RealIterator (window_type* _p, size_type _i)
│ │ │ │ -
595 : p(_p), i(_i)
│ │ │ │ -
596 {}
│ │ │ │ -
│ │ │ │ -
597
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
600 {
│ │ │ │ -
601 ++i;
│ │ │ │ -
602 }
│ │ │ │ -
│ │ │ │ -
603
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
606 {
│ │ │ │ -
607 --i;
│ │ │ │ -
608 }
│ │ │ │ -
│ │ │ │ -
609
│ │ │ │ -
│ │ │ │ -
611 bool equals (const RealIterator& it) const
│ │ │ │ -
612 {
│ │ │ │ -
613 return (p+i)==(it.p+it.i);
│ │ │ │ -
614 }
│ │ │ │ -
│ │ │ │ -
615
│ │ │ │ -
│ │ │ │ -
617 window_type& dereference () const
│ │ │ │ -
618 {
│ │ │ │ -
619 return p[i];
│ │ │ │ -
620 }
│ │ │ │ -
│ │ │ │ -
621
│ │ │ │ -
│ │ │ │ -
622 void advance(std::ptrdiff_t d)
│ │ │ │ -
623 {
│ │ │ │ -
624 i+=d;
│ │ │ │ -
625 }
│ │ │ │ -
│ │ │ │ -
626
│ │ │ │ -
│ │ │ │ -
627 std::ptrdiff_t distanceTo(const RealIterator& o) const
│ │ │ │ -
628 {
│ │ │ │ -
629 return o.i-i;
│ │ │ │ -
630 }
│ │ │ │ -
│ │ │ │ -
631
│ │ │ │ -
632 // Needed for operator[] of the iterator
│ │ │ │ -
│ │ │ │ -
633 window_type& elementAt (std::ptrdiff_t offset) const
│ │ │ │ -
634 {
│ │ │ │ -
635 return p[i+offset];
│ │ │ │ -
636 }
│ │ │ │ -
│ │ │ │ -
637
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
640 {
│ │ │ │ -
641 return i;
│ │ │ │ -
642 }
│ │ │ │ -
│ │ │ │ -
643
│ │ │ │ -
644 private:
│ │ │ │ -
645 window_type* p;
│ │ │ │ -
646 size_type i;
│ │ │ │ -
647 };
│ │ │ │ -
│ │ │ │ -
648
│ │ │ │ - │ │ │ │ -
650
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
653 {
│ │ │ │ -
654 return Iterator(block,0);
│ │ │ │ -
655 }
│ │ │ │ -
│ │ │ │ -
656
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
659 {
│ │ │ │ -
660 return Iterator(block,nblocks);
│ │ │ │ -
661 }
│ │ │ │ -
│ │ │ │ -
662
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
666 {
│ │ │ │ -
667 return Iterator(block,nblocks-1);
│ │ │ │ -
668 }
│ │ │ │ -
│ │ │ │ -
669
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
673 {
│ │ │ │ -
674 return Iterator(block,-1);
│ │ │ │ -
675 }
│ │ │ │ -
│ │ │ │ -
676
│ │ │ │ - │ │ │ │ -
679
│ │ │ │ - │ │ │ │ -
682
│ │ │ │ - │ │ │ │ -
685
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
688 {
│ │ │ │ -
689 return ConstIterator(block,0);
│ │ │ │ -
690 }
│ │ │ │ -
│ │ │ │ -
691
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
694 {
│ │ │ │ -
695 return ConstIterator(block,nblocks);
│ │ │ │ -
696 }
│ │ │ │ -
│ │ │ │ -
697
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
701 {
│ │ │ │ -
702 return ConstIterator(block,nblocks-1);
│ │ │ │ -
703 }
│ │ │ │ -
│ │ │ │ -
704
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
707 {
│ │ │ │ -
708 return ConstIterator(block,-1);
│ │ │ │ -
709 }
│ │ │ │ -
│ │ │ │ -
710
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
713 {
│ │ │ │ -
714 return Iterator(block,std::min(i,nblocks));
│ │ │ │ -
715 }
│ │ │ │ -
│ │ │ │ -
716
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
719 {
│ │ │ │ -
720 return ConstIterator(block,std::min(i,nblocks));
│ │ │ │ -
721 }
│ │ │ │ -
│ │ │ │ -
722
│ │ │ │ -
723 //===== sizes
│ │ │ │ -
724
│ │ │ │ -
│ │ │ │ -
726 size_type N () const
│ │ │ │ -
727 {
│ │ │ │ -
728 return nblocks;
│ │ │ │ -
729 }
│ │ │ │ -
│ │ │ │ -
730
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
736 {
│ │ │ │ -
737 return nblocks;
│ │ │ │ -
738 }
│ │ │ │ -
│ │ │ │ -
739
│ │ │ │ -
740
│ │ │ │ -
741 private:
│ │ │ │ -
742
│ │ │ │ -
743 void allocate() {
│ │ │ │ -
744 if (this->initialized)
│ │ │ │ -
745 DUNE_THROW(ISTLError, "Attempt to re-allocate already initialized VariableBlockVector");
│ │ │ │ -
746
│ │ │ │ -
747 // calculate space needed:
│ │ │ │ -
748 this->n=0;
│ │ │ │ -
749 for(size_type i = 0; i < nblocks; i++) {
│ │ │ │ -
750 this->n += block[i].size();
│ │ │ │ -
751 }
│ │ │ │ -
752
│ │ │ │ -
753 // now we can allocate the big array in the base class of v
│ │ │ │ -
754 if (this->n>0)
│ │ │ │ -
755 {
│ │ │ │ -
756 // allocate and construct objects
│ │ │ │ -
757 this->p = allocator_.allocate(this->n);
│ │ │ │ -
758 new (this->p)B[this->n];
│ │ │ │ -
759 }
│ │ │ │ -
760 else
│ │ │ │ -
761 {
│ │ │ │ -
762 this->p = nullptr;
│ │ │ │ -
763 }
│ │ │ │ -
764
│ │ │ │ -
765 // and we set the window pointers
│ │ │ │ -
766 this->block[0].setptr(this->p); // pointer to first block
│ │ │ │ -
767 for (size_type j=1; j<nblocks; ++j) // and the rest
│ │ │ │ -
768 block[j].setptr(block[j-1].getptr()+block[j-1].getsize());
│ │ │ │ -
769
│ │ │ │ -
770 // and the vector is ready
│ │ │ │ -
771 this->initialized = true;
│ │ │ │ -
772 }
│ │ │ │ -
773
│ │ │ │ -
774 size_type nblocks; // number of blocks in vector
│ │ │ │ -
775 window_type* block; // array of blocks pointing to the array in the base class
│ │ │ │ -
776 bool initialized; // true if vector has been initialized
│ │ │ │ -
777
│ │ │ │ -
778 A allocator_;
│ │ │ │ -
779
│ │ │ │ -
780 typename std::allocator_traits<A>::template rebind_alloc<window_type> windowAllocator_;
│ │ │ │ -
781 };
│ │ │ │ +
149 public:
│ │ │ │ +
150 size_type N_, M_, Nnz_;
│ │ │ │ +
151 B* values;
│ │ │ │ +
152 Index* rowindex;
│ │ │ │ +
153 Index* colstart;
│ │ │ │ +
154 };
│ │ │ │ +
155
│ │ │ │ +
156}
│ │ │ │
│ │ │ │ -
782
│ │ │ │ -
783
│ │ │ │ -
784
│ │ │ │ -
787} // end namespace
│ │ │ │ -
788
│ │ │ │ -
789#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.
│ │ │ │ - │ │ │ │ -
Definition allocator.hh:11
│ │ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
A Vector of blocks with different blocksizes.
Definition vbvector.hh:46
│ │ │ │ -
RealIterator< value_type, window_type & > Iterator
Definition vbvector.hh:649
│ │ │ │ -
VariableBlockVector()
Definition vbvector.hh:97
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition vbvector.hh:55
│ │ │ │ -
A allocator_type
export the allocator type
Definition vbvector.hh:58
│ │ │ │ -
VariableBlockVector(size_type _nblocks, size_type m)
Definition vbvector.hh:134
│ │ │ │ -
size_type size() const
Definition vbvector.hh:735
│ │ │ │ -
size_type N() const
number of blocks in the vector (are of variable size here)
Definition vbvector.hh:726
│ │ │ │ -
VariableBlockVector(const VariableBlockVector &a)
copy constructor, has copy semantics
Definition vbvector.hh:172
│ │ │ │ -
VariableBlockVector(size_type _nblocks)
Definition vbvector.hh:108
│ │ │ │ -
~VariableBlockVector()
free dynamic memory
Definition vbvector.hh:215
│ │ │ │ -
window_type & operator[](size_type i)
random access to blocks
Definition vbvector.hh:563
│ │ │ │ -
CreateIterator createend()
get create iterator pointing to one after the last block
Definition vbvector.hh:552
│ │ │ │ -
Iterator beforeBegin() const
Definition vbvector.hh:672
│ │ │ │ -
CreateIterator createbegin()
get initial create iterator
Definition vbvector.hh:543
│ │ │ │ -
VariableBlockVector & operator=(const VariableBlockVector &a)
assignment
Definition vbvector.hh:322
│ │ │ │ -
static constexpr auto blocklevel
Definition vbvector.hh:90
│ │ │ │ -
ConstIterator rend() const
end ConstIterator
Definition vbvector.hh:706
│ │ │ │ -
A::size_type size_type
The size type for the index access.
Definition vbvector.hh:73
│ │ │ │ -
ConstIterator find(size_type i) const
random access returning iterator (end if not contained)
Definition vbvector.hh:718
│ │ │ │ -
ConstIterator beforeEnd() const
Definition vbvector.hh:700
│ │ │ │ -
Iterator find(size_type i)
random access returning iterator (end if not contained)
Definition vbvector.hh:712
│ │ │ │ -
const window_type & const_reference
Export type used for const references to container entries.
Definition vbvector.hh:70
│ │ │ │ -
RealIterator< const value_type, const window_type & > ConstIterator
Const iterator.
Definition vbvector.hh:681
│ │ │ │ -
Iterator end()
end Iterator
Definition vbvector.hh:658
│ │ │ │ -
ConstIterator begin() const
begin ConstIterator
Definition vbvector.hh:687
│ │ │ │ -
BlockVector< B, A > value_type
Type of the elements of the outer vector, i.e., dynamic vectors of B.
Definition vbvector.hh:80
│ │ │ │ -
ConstIterator end() const
end ConstIterator
Definition vbvector.hh:693
│ │ │ │ -
BlockVector< B, A > block_type
Same as value_type, here for historical reasons.
Definition vbvector.hh:84
│ │ │ │ -
void resize(size_type _nblocks, size_type m)
same effect as constructor with same argument
Definition vbvector.hh:270
│ │ │ │ -
window_type & reference
Export type used for references to container entries.
Definition vbvector.hh:64
│ │ │ │ -
void resize(size_type _nblocks)
same effect as constructor with same argument
Definition vbvector.hh:234
│ │ │ │ -
Iterator beforeEnd()
Definition vbvector.hh:665
│ │ │ │ -
Iterator begin()
begin Iterator
Definition vbvector.hh:652
│ │ │ │ -
Iterator class for sequential creation of blocks.
Definition vbvector.hh:443
│ │ │ │ -
bool operator==(const CreateIterator &it) const
equality
Definition vbvector.hh:505
│ │ │ │ -
size_type index() const
dereferencing
Definition vbvector.hh:511
│ │ │ │ -
SizeProxy reference
reference type
Definition vbvector.hh:463
│ │ │ │ -
size_type * pointer
pointer type
Definition vbvector.hh:460
│ │ │ │ -
bool operator!=(const CreateIterator &it) const
inequality
Definition vbvector.hh:499
│ │ │ │ -
~CreateIterator()
Definition vbvector.hh:471
│ │ │ │ -
size_type value_type
value type
Definition vbvector.hh:449
│ │ │ │ -
CreateIterator(VariableBlockVector &_v, int _i, bool _isEnd)
constructor
Definition vbvector.hh:466
│ │ │ │ -
void setblocksize(size_type _k)
set size of current block
Definition vbvector.hh:517
│ │ │ │ -
size_type & operator*()
Access size of current block.
Definition vbvector.hh:528
│ │ │ │ -
std::output_iterator_tag iterator_category
iterator category
Definition vbvector.hh:446
│ │ │ │ -
CreateIterator & operator++()
prefix increment
Definition vbvector.hh:482
│ │ │ │ -
void difference_type
difference type (unused)
Definition vbvector.hh:457
│ │ │ │ -
Iterator class for sequential access.
Definition vbvector.hh:584
│ │ │ │ -
RealIterator(window_type *_p, size_type _i)
constructor
Definition vbvector.hh:594
│ │ │ │ -
bool equals(const RealIterator &it) const
equality
Definition vbvector.hh:611
│ │ │ │ -
size_type index() const
Return the index of the entry this iterator is pointing to.
Definition vbvector.hh:639
│ │ │ │ -
window_type & elementAt(std::ptrdiff_t offset) const
Definition vbvector.hh:633
│ │ │ │ -
void decrement()
prefix decrement
Definition vbvector.hh:605
│ │ │ │ -
void advance(std::ptrdiff_t d)
Definition vbvector.hh:622
│ │ │ │ -
void increment()
prefix increment
Definition vbvector.hh:599
│ │ │ │ -
RealIterator()
constructor, no arguments
Definition vbvector.hh:587
│ │ │ │ -
std::ptrdiff_t distanceTo(const RealIterator &o) const
Definition vbvector.hh:627
│ │ │ │ -
window_type & dereference() const
dereferencing
Definition vbvector.hh:617
│ │ │ │ +
157#endif
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,930 +1,125 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -vbvector.hh │ │ │ │ │ +bccsmatrix.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 (C) 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_BCCSMATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_BCCSMATRIX_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14#include │ │ │ │ │ -15#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -16#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ │ -17 │ │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -19 │ │ │ │ │ -24namespace _D_u_n_e { │ │ │ │ │ -25 │ │ │ │ │ -41 template > │ │ │ │ │ -_4_2 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 │ │ │ │ │ -43 // this derivation gives us all the blas level 1 and norms │ │ │ │ │ -44 // on the large array. However, access operators have to be │ │ │ │ │ -45 // overwritten. │ │ │ │ │ -46 { │ │ │ │ │ -47 // just a shorthand │ │ │ │ │ -48 typedef Imp::BlockVectorWindow window_type; │ │ │ │ │ -49 │ │ │ │ │ -50 public: │ │ │ │ │ -51 │ │ │ │ │ -52 //===== type definitions and constants │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11 │ │ │ │ │ +_1_2namespace Dune::ISTL::Impl │ │ │ │ │ +13{ │ │ │ │ │ +27 template::size_type> │ │ │ │ │ +28 class BCCSMatrix │ │ │ │ │ +29 { │ │ │ │ │ +30 public: │ │ │ │ │ +31 using Index = I; │ │ │ │ │ +32 using size_type = std::size_t; │ │ │ │ │ +33 │ │ │ │ │ +36 BCCSMatrix() │ │ │ │ │ +37 : N_(0), M_(0), Nnz_(0), values(0), rowindex(0), colstart(0) │ │ │ │ │ +38 {} │ │ │ │ │ +39 │ │ │ │ │ +41 ~BCCSMatrix() │ │ │ │ │ +42 { │ │ │ │ │ +43 if(N_+M_+Nnz_!=0) │ │ │ │ │ +44 free(); │ │ │ │ │ +45 } │ │ │ │ │ +46 │ │ │ │ │ +48 void setSize(size_type rows, size_type columns) │ │ │ │ │ +49 { │ │ │ │ │ +50 N_ = rows; │ │ │ │ │ +51 M_ = columns; │ │ │ │ │ +52 } │ │ │ │ │ 53 │ │ │ │ │ -_5_5 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ -56 │ │ │ │ │ -_5_8 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ -59 │ │ │ │ │ -_6_4 typedef window_type& _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -65 │ │ │ │ │ -_7_0 typedef const window_type& _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -71 │ │ │ │ │ -_7_3 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -74 │ │ │ │ │ -_8_0 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -81 │ │ │ │ │ -_8_4 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -85 │ │ │ │ │ -89 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]] │ │ │ │ │ -_9_0 static constexpr auto _b_l_o_c_k_l_e_v_e_l = blockLevel()+2; │ │ │ │ │ -91 │ │ │ │ │ -92 //===== constructors and such │ │ │ │ │ -93 │ │ │ │ │ -_9_7 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r () : Imp::block_vector_unmanaged() │ │ │ │ │ -98 { │ │ │ │ │ -99 // nothing is known ... │ │ │ │ │ -100 nblocks = 0; │ │ │ │ │ -101 block = nullptr; │ │ │ │ │ -102 initialized = false; │ │ │ │ │ -103 } │ │ │ │ │ -104 │ │ │ │ │ -_1_0_8 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 _nblocks) : Imp:: │ │ │ │ │ -block_vector_unmanaged() │ │ │ │ │ -109 { │ │ │ │ │ -110 // we can allocate the windows now │ │ │ │ │ -111 nblocks = _nblocks; │ │ │ │ │ -112 if (nblocks>0) │ │ │ │ │ +58 size_type N() const │ │ │ │ │ +59 { │ │ │ │ │ +60 return N_; │ │ │ │ │ +61 } │ │ │ │ │ +62 │ │ │ │ │ +64 size_type nonzeroes() const │ │ │ │ │ +65 { │ │ │ │ │ +66 return Nnz_; │ │ │ │ │ +67 } │ │ │ │ │ +68 │ │ │ │ │ +73 size_type M() const │ │ │ │ │ +74 { │ │ │ │ │ +75 return M_; │ │ │ │ │ +76 } │ │ │ │ │ +77 │ │ │ │ │ +84 B* getValues() const │ │ │ │ │ +85 { │ │ │ │ │ +86 return values; │ │ │ │ │ +87 } │ │ │ │ │ +88 │ │ │ │ │ +95 Index* getRowIndex() const │ │ │ │ │ +96 { │ │ │ │ │ +97 return rowindex; │ │ │ │ │ +98 } │ │ │ │ │ +99 │ │ │ │ │ +106 Index* getColStart() const │ │ │ │ │ +107 { │ │ │ │ │ +108 return colstart; │ │ │ │ │ +109 } │ │ │ │ │ +110 │ │ │ │ │ +112 BCCSMatrix& operator=(const BCCSMatrix& _m_a_t) │ │ │ │ │ 113 { │ │ │ │ │ -114 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ -115 new (block) window_type[nblocks]; │ │ │ │ │ -116 } │ │ │ │ │ -117 else │ │ │ │ │ -118 { │ │ │ │ │ -119 nblocks = 0; │ │ │ │ │ -120 block = nullptr; │ │ │ │ │ -121 } │ │ │ │ │ -122 │ │ │ │ │ -123 // Note: memory in base class still not allocated │ │ │ │ │ -124 // the vector not usable │ │ │ │ │ -125 initialized = false; │ │ │ │ │ -126 } │ │ │ │ │ -127 │ │ │ │ │ -_1_3_4 _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 _nblocks, _s_i_z_e___t_y_p_e m) : Imp:: │ │ │ │ │ -block_vector_unmanaged() │ │ │ │ │ -135 { │ │ │ │ │ -136 // and we can allocate the big array in the base class │ │ │ │ │ -137 this->n = _nblocks*m; │ │ │ │ │ -138 if (this->n>0) │ │ │ │ │ -139 { │ │ │ │ │ -140 this->p = allocator_.allocate(this->n); │ │ │ │ │ -141 new (this->p)B[this->n]; │ │ │ │ │ -142 } │ │ │ │ │ -143 else │ │ │ │ │ -144 { │ │ │ │ │ -145 this->n = 0; │ │ │ │ │ -146 this->p = nullptr; │ │ │ │ │ +114 if(N_+M_+Nnz_!=0) │ │ │ │ │ +115 free(); │ │ │ │ │ +116 N_=_m_a_t.N_; │ │ │ │ │ +117 M_=_m_a_t.M_; │ │ │ │ │ +118 Nnz_= _m_a_t.Nnz_; │ │ │ │ │ +119 if(M_>0) { │ │ │ │ │ +120 colstart=new size_type[M_+1]; │ │ │ │ │ +121 for(size_type i=0; i<=M_; ++i) │ │ │ │ │ +122 colstart[i]=_m_a_t.colstart[i]; │ │ │ │ │ +123 } │ │ │ │ │ +124 │ │ │ │ │ +125 if(Nnz_>0) { │ │ │ │ │ +126 values = new B[Nnz_]; │ │ │ │ │ +127 rowindex = new size_type[Nnz_]; │ │ │ │ │ +128 │ │ │ │ │ +129 for(size_type i=0; i0) │ │ │ │ │ -152 { │ │ │ │ │ -153 // allocate and construct the windows │ │ │ │ │ -154 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ -155 new (block) window_type[nblocks]; │ │ │ │ │ -156 │ │ │ │ │ -157 // set the windows into the big array │ │ │ │ │ -158 for (_s_i_z_e___t_y_p_e i=0; ip+(i*m)); │ │ │ │ │ -160 } │ │ │ │ │ -161 else │ │ │ │ │ -162 { │ │ │ │ │ -163 nblocks = 0; │ │ │ │ │ -164 block = nullptr; │ │ │ │ │ -165 } │ │ │ │ │ -166 │ │ │ │ │ -167 // and the vector is usable │ │ │ │ │ -168 initialized = true; │ │ │ │ │ -169 } │ │ │ │ │ -170 │ │ │ │ │ -_1_7_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) │ │ │ │ │ -173 { │ │ │ │ │ -174 // allocate the big array in the base class │ │ │ │ │ -175 this->n = a.n; │ │ │ │ │ -176 if (this->n>0) │ │ │ │ │ -177 { │ │ │ │ │ -178 // allocate and construct objects │ │ │ │ │ -179 this->p = allocator_.allocate(this->n); │ │ │ │ │ -180 new (this->p)B[this->n]; │ │ │ │ │ -181 │ │ │ │ │ -182 // copy data │ │ │ │ │ -183 for (_s_i_z_e___t_y_p_e i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ │ -184 } │ │ │ │ │ -185 else │ │ │ │ │ -186 { │ │ │ │ │ -187 this->n = 0; │ │ │ │ │ -188 this->p = nullptr; │ │ │ │ │ -189 } │ │ │ │ │ -190 │ │ │ │ │ -191 // we can allocate the windows now │ │ │ │ │ -192 nblocks = a.nblocks; │ │ │ │ │ -193 if (nblocks>0) │ │ │ │ │ -194 { │ │ │ │ │ -195 // alloc │ │ │ │ │ -196 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ -197 new (block) window_type[nblocks]; │ │ │ │ │ -198 │ │ │ │ │ -199 // and we must set the windows │ │ │ │ │ -200 block[0].set(a.block[0].getsize(),this->p); // first block │ │ │ │ │ -201 for (_s_i_z_e___t_y_p_e i=1; in>0) { │ │ │ │ │ -218 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ -219 while (i) │ │ │ │ │ -220 this->p[--i].~B(); │ │ │ │ │ -221 allocator_.deallocate(this->p,this->n); │ │ │ │ │ -222 } │ │ │ │ │ -223 if (nblocks>0) { │ │ │ │ │ -224 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ -225 while (i) │ │ │ │ │ -226 block[--i].~window_type(); │ │ │ │ │ -227 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ -228 } │ │ │ │ │ -229 │ │ │ │ │ -230 } │ │ │ │ │ -231 │ │ │ │ │ -232 │ │ │ │ │ -_2_3_4 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e _nblocks) │ │ │ │ │ -235 { │ │ │ │ │ -236 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ -237 if (this->n>0) { │ │ │ │ │ -238 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ -239 while (i) │ │ │ │ │ -240 this->p[--i].~B(); │ │ │ │ │ -241 allocator_.deallocate(this->p,this->n); │ │ │ │ │ -242 } │ │ │ │ │ -243 if (nblocks>0) { │ │ │ │ │ -244 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ -245 while (i) │ │ │ │ │ -246 block[--i].~window_type(); │ │ │ │ │ -247 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ -248 } │ │ │ │ │ -249 this->n = 0; │ │ │ │ │ -250 this->p = nullptr; │ │ │ │ │ -251 │ │ │ │ │ -252 // we can allocate the windows now │ │ │ │ │ -253 nblocks = _nblocks; │ │ │ │ │ -254 if (nblocks>0) │ │ │ │ │ -255 { │ │ │ │ │ -256 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ -257 new (block) window_type[nblocks]; │ │ │ │ │ -258 } │ │ │ │ │ -259 else │ │ │ │ │ -260 { │ │ │ │ │ -261 nblocks = 0; │ │ │ │ │ -262 block = nullptr; │ │ │ │ │ -263 } │ │ │ │ │ -264 │ │ │ │ │ -265 // and the vector not fully usable │ │ │ │ │ -266 initialized = false; │ │ │ │ │ -267 } │ │ │ │ │ -268 │ │ │ │ │ -_2_7_0 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e _nblocks, _s_i_z_e___t_y_p_e m) │ │ │ │ │ -271 { │ │ │ │ │ -272 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ -273 if (this->n>0) { │ │ │ │ │ -274 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ -275 while (i) │ │ │ │ │ -276 this->p[--i].~B(); │ │ │ │ │ -277 allocator_.deallocate(this->p,this->n); │ │ │ │ │ -278 } │ │ │ │ │ -279 if (nblocks>0) { │ │ │ │ │ -280 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ -281 while (i) │ │ │ │ │ -282 block[--i].~window_type(); │ │ │ │ │ -283 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ -284 } │ │ │ │ │ -285 │ │ │ │ │ -286 // and we can allocate the big array in the base class │ │ │ │ │ -287 this->n = _nblocks*m; │ │ │ │ │ -288 if (this->n>0) │ │ │ │ │ -289 { │ │ │ │ │ -290 this->p = allocator_.allocate(this->n); │ │ │ │ │ -291 new (this->p)B[this->n]; │ │ │ │ │ -292 } │ │ │ │ │ -293 else │ │ │ │ │ -294 { │ │ │ │ │ -295 this->n = 0; │ │ │ │ │ -296 this->p = nullptr; │ │ │ │ │ -297 } │ │ │ │ │ -298 │ │ │ │ │ -299 // we can allocate the windows now │ │ │ │ │ -300 nblocks = _nblocks; │ │ │ │ │ -301 if (nblocks>0) │ │ │ │ │ -302 { │ │ │ │ │ -303 // allocate and construct objects │ │ │ │ │ -304 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ -305 new (block) window_type[nblocks]; │ │ │ │ │ -306 │ │ │ │ │ -307 // set the windows into the big array │ │ │ │ │ -308 for (_s_i_z_e___t_y_p_e i=0; ip+(i*m)); │ │ │ │ │ -310 } │ │ │ │ │ -311 else │ │ │ │ │ -312 { │ │ │ │ │ -313 nblocks = 0; │ │ │ │ │ -314 block = nullptr; │ │ │ │ │ -315 } │ │ │ │ │ -316 │ │ │ │ │ -317 // and the vector is usable │ │ │ │ │ -318 initialized = true; │ │ │ │ │ -319 } │ │ │ │ │ -320 │ │ │ │ │ -_3_2_2 _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 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& a) │ │ │ │ │ -323 { │ │ │ │ │ -324 if (&a!=this) // check if this and a are different objects │ │ │ │ │ -325 { │ │ │ │ │ -326 // reallocate arrays if necessary │ │ │ │ │ -327 // Note: still the block sizes may vary ! │ │ │ │ │ -328 if (this->n!=a.n || nblocks!=a.nblocks) │ │ │ │ │ -329 { │ │ │ │ │ -330 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ -331 if (this->n>0) { │ │ │ │ │ -332 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ -333 while (i) │ │ │ │ │ -334 this->p[--i].~B(); │ │ │ │ │ -335 allocator_.deallocate(this->p,this->n); │ │ │ │ │ -336 } │ │ │ │ │ -337 if (nblocks>0) { │ │ │ │ │ -338 _s_i_z_e___t_y_p_e i=nblocks; │ │ │ │ │ -339 while (i) │ │ │ │ │ -340 block[--i].~window_type(); │ │ │ │ │ -341 windowAllocator_.deallocate(block,nblocks); │ │ │ │ │ -342 } │ │ │ │ │ -343 │ │ │ │ │ -344 // allocate the big array in the base class │ │ │ │ │ -345 this->n = a.n; │ │ │ │ │ -346 if (this->n>0) │ │ │ │ │ -347 { │ │ │ │ │ -348 // allocate and construct objects │ │ │ │ │ -349 this->p = allocator_.allocate(this->n); │ │ │ │ │ -350 new (this->p)B[this->n]; │ │ │ │ │ -351 } │ │ │ │ │ -352 else │ │ │ │ │ -353 { │ │ │ │ │ -354 this->n = 0; │ │ │ │ │ -355 this->p = nullptr; │ │ │ │ │ -356 } │ │ │ │ │ -357 │ │ │ │ │ -358 // we can allocate the windows now │ │ │ │ │ -359 nblocks = a.nblocks; │ │ │ │ │ -360 if (nblocks>0) │ │ │ │ │ -361 { │ │ │ │ │ -362 // alloc │ │ │ │ │ -363 block = windowAllocator_.allocate(nblocks); │ │ │ │ │ -364 new (block) window_type[nblocks]; │ │ │ │ │ -365 } │ │ │ │ │ -366 else │ │ │ │ │ -367 { │ │ │ │ │ -368 nblocks = 0; │ │ │ │ │ -369 block = nullptr; │ │ │ │ │ -370 } │ │ │ │ │ -371 } │ │ │ │ │ -372 │ │ │ │ │ -373 // copy block structure, might be different although │ │ │ │ │ -374 // sizes are the same ! │ │ │ │ │ -375 if (nblocks>0) │ │ │ │ │ -376 { │ │ │ │ │ -377 block[0].set(a.block[0].getsize(),this->p); // first block │ │ │ │ │ -378 for (_s_i_z_e___t_y_p_e i=1; in; i++) this->p[i]=a.p[i]; │ │ │ │ │ -384 } │ │ │ │ │ -385 │ │ │ │ │ -386 // and we have a usable vector │ │ │ │ │ -387 initialized = true; │ │ │ │ │ -388 │ │ │ │ │ -389 return *this; // Gebe Referenz zurueck damit a=b=c; klappt │ │ │ │ │ -390 } │ │ │ │ │ -391 │ │ │ │ │ -392 │ │ │ │ │ -393 //===== assignment from scalar │ │ │ │ │ -394 │ │ │ │ │ -_3_9_6 _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) │ │ │ │ │ -397 { │ │ │ │ │ -398 (static_cast&>(*this)) = k; │ │ │ │ │ -399 return *this; │ │ │ │ │ -400 } │ │ │ │ │ -401 │ │ │ │ │ -402 │ │ │ │ │ -403 //===== the creation interface │ │ │ │ │ -404 │ │ │ │ │ -405 class CreateIterator; │ │ │ │ │ -406 │ │ │ │ │ -407#ifndef DOXYGEN │ │ │ │ │ -408 │ │ │ │ │ -409 // The window_type does not hand out a reference to its size, │ │ │ │ │ -410 // so in order to provide a valid iterator, we need a workaround │ │ │ │ │ -411 // to make assignment possible. This proxy enables just that by │ │ │ │ │ -412 // implicitly converting to the stored size for read access and │ │ │ │ │ -413 // tunneling assignment to the accessor method of the window. │ │ │ │ │ -414 struct SizeProxy │ │ │ │ │ -415 { │ │ │ │ │ -416 │ │ │ │ │ -417 operator size_type() const │ │ │ │ │ -418 { │ │ │ │ │ -419 return target->getsize(); │ │ │ │ │ -420 } │ │ │ │ │ -421 │ │ │ │ │ -422 SizeProxy& operator=(size_type size) │ │ │ │ │ -423 { │ │ │ │ │ -424 target->setsize(size); │ │ │ │ │ -425 return *this; │ │ │ │ │ -426 } │ │ │ │ │ -427 │ │ │ │ │ -428 private: │ │ │ │ │ -429 │ │ │ │ │ -430 friend class CreateIterator; │ │ │ │ │ -431 │ │ │ │ │ -432 SizeProxy(window_type& t) │ │ │ │ │ -433 : target(&t) │ │ │ │ │ -434 {} │ │ │ │ │ -435 │ │ │ │ │ -436 window_type* target; │ │ │ │ │ -437 }; │ │ │ │ │ -438 │ │ │ │ │ -439#endif // DOXYGEN │ │ │ │ │ -440 │ │ │ │ │ -_4_4_2 class _C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ │ -443 { │ │ │ │ │ -444 public: │ │ │ │ │ -_4_4_6 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::output_iterator_tag; │ │ │ │ │ -447 │ │ │ │ │ -_4_4_9 using _v_a_l_u_e___t_y_p_e = _s_i_z_e___t_y_p_e; │ │ │ │ │ -450 │ │ │ │ │ -_4_5_7 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = void; │ │ │ │ │ -458 │ │ │ │ │ -_4_6_0 using _p_o_i_n_t_e_r = _s_i_z_e___t_y_p_e*; │ │ │ │ │ -461 │ │ │ │ │ -_4_6_3 using _r_e_f_e_r_e_n_c_e = SizeProxy; │ │ │ │ │ -464 │ │ │ │ │ -_4_6_6 _C_r_e_a_t_e_I_t_e_r_a_t_o_r (_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& _v, int _i, bool _isEnd) : │ │ │ │ │ -467 v(_v), │ │ │ │ │ -468 i(_i), │ │ │ │ │ -469 isEnd(_isEnd) {} │ │ │ │ │ -470 │ │ │ │ │ -_4_7_1 _~_C_r_e_a_t_e_I_t_e_r_a_t_o_r() { │ │ │ │ │ -472 // When the iterator gets destructed, we allocate the memory │ │ │ │ │ -473 // for the VariableBlockVector if │ │ │ │ │ -474 // 1. the current iterator was not created as enditerator │ │ │ │ │ -475 // 2. we're at the last block │ │ │ │ │ -476 // 3. the vector hasn't been initialized earlier │ │ │ │ │ -477 if (not isEnd && i==v.nblocks && not v.initialized) │ │ │ │ │ -478 v.allocate(); │ │ │ │ │ -479 } │ │ │ │ │ -480 │ │ │ │ │ -_4_8_2 _C_r_e_a_t_e_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -483 { │ │ │ │ │ -484 // go to next block │ │ │ │ │ -485 ++i; │ │ │ │ │ -486 │ │ │ │ │ -487 return *this; │ │ │ │ │ -488 } │ │ │ │ │ -489 │ │ │ │ │ -_4_9_1 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_+_+_ (int) │ │ │ │ │ -492 { │ │ │ │ │ -493 _C_r_e_a_t_e_I_t_e_r_a_t_o_r tmp(*this); │ │ │ │ │ -494 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ │ -495 return tmp; │ │ │ │ │ -496 } │ │ │ │ │ -497 │ │ │ │ │ -_4_9_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 │ │ │ │ │ -500 { │ │ │ │ │ -501 return (i!=it.i) || (&v!=&it.v); │ │ │ │ │ -502 } │ │ │ │ │ -503 │ │ │ │ │ -_5_0_5 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 │ │ │ │ │ -506 { │ │ │ │ │ -507 return (i==it.i) && (&v==&it.v); │ │ │ │ │ -508 } │ │ │ │ │ -509 │ │ │ │ │ -_5_1_1 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ -512 { │ │ │ │ │ -513 return i; │ │ │ │ │ -514 } │ │ │ │ │ -515 │ │ │ │ │ -_5_1_7 void _s_e_t_b_l_o_c_k_s_i_z_e (_s_i_z_e___t_y_p_e _k) │ │ │ │ │ -518 { │ │ │ │ │ -519 v.block[i].setsize(_k); │ │ │ │ │ -520 } │ │ │ │ │ -521 │ │ │ │ │ -523#ifdef DOXYGEN │ │ │ │ │ -524 _s_i_z_e___t_y_p_e& │ │ │ │ │ -525#else │ │ │ │ │ -526 SizeProxy │ │ │ │ │ -527#endif │ │ │ │ │ -_5_2_8 _o_p_e_r_a_t_o_r_*() │ │ │ │ │ -529 { │ │ │ │ │ -530 return {v.block[i]}; │ │ │ │ │ -531 } │ │ │ │ │ -532 │ │ │ │ │ -533 private: │ │ │ │ │ -534 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& v; // my vector │ │ │ │ │ -535 _s_i_z_e___t_y_p_e i; // current block to be defined │ │ │ │ │ -536 const bool isEnd; // flag if this object was created as the end iterator. │ │ │ │ │ -537 }; │ │ │ │ │ -538 │ │ │ │ │ -539 // CreateIterator wants to set all the arrays ... │ │ │ │ │ -_5_4_0 friend class _C_r_e_a_t_e_I_t_e_r_a_t_o_r; │ │ │ │ │ -541 │ │ │ │ │ -_5_4_3 _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 () │ │ │ │ │ -544 { │ │ │ │ │ -545#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -546 if (initialized) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"no CreateIterator in initialized │ │ │ │ │ -state"); │ │ │ │ │ -547#endif │ │ │ │ │ -548 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this,0, false); │ │ │ │ │ -549 } │ │ │ │ │ -550 │ │ │ │ │ -_5_5_2 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _c_r_e_a_t_e_e_n_d () │ │ │ │ │ -553 { │ │ │ │ │ -554 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this,nblocks, true); │ │ │ │ │ -555 } │ │ │ │ │ -556 │ │ │ │ │ -557 │ │ │ │ │ -558 //===== access to components │ │ │ │ │ -559 // has to be overwritten from base class because it must │ │ │ │ │ -560 // return access to the windows │ │ │ │ │ -561 │ │ │ │ │ -_5_6_3 window_type& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) │ │ │ │ │ -564 { │ │ │ │ │ -565#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -566 if (i>=nblocks) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ -567#endif │ │ │ │ │ -568 return block[i]; │ │ │ │ │ -569 } │ │ │ │ │ -570 │ │ │ │ │ -_5_7_2 const window_type& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) const │ │ │ │ │ -573 { │ │ │ │ │ -574#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -575 if (i<0 || i>=nblocks) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ -576#endif │ │ │ │ │ -577 return block[i]; │ │ │ │ │ -578 } │ │ │ │ │ -579 │ │ │ │ │ -581 template │ │ │ │ │ -_5_8_2 class _R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ -583 : public RandomAccessIteratorFacade, T, R> │ │ │ │ │ -584 { │ │ │ │ │ -585 public: │ │ │ │ │ -_5_8_7 _R_e_a_l_I_t_e_r_a_t_o_r () │ │ │ │ │ -588 { │ │ │ │ │ -589 p = nullptr; │ │ │ │ │ -590 i = 0; │ │ │ │ │ -591 } │ │ │ │ │ -592 │ │ │ │ │ -_5_9_4 _R_e_a_l_I_t_e_r_a_t_o_r (window_type* _p, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ -595 : p(_p), i(_i) │ │ │ │ │ -596 {} │ │ │ │ │ -597 │ │ │ │ │ -_5_9_9 void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ -600 { │ │ │ │ │ -601 ++i; │ │ │ │ │ -602 } │ │ │ │ │ -603 │ │ │ │ │ -_6_0_5 void _d_e_c_r_e_m_e_n_t() │ │ │ │ │ -606 { │ │ │ │ │ -607 --i; │ │ │ │ │ -608 } │ │ │ │ │ -609 │ │ │ │ │ -_6_1_1 bool _e_q_u_a_l_s (const _R_e_a_l_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -612 { │ │ │ │ │ -613 return (p+i)==(it.p+it.i); │ │ │ │ │ -614 } │ │ │ │ │ -615 │ │ │ │ │ -_6_1_7 window_type& _d_e_r_e_f_e_r_e_n_c_e () const │ │ │ │ │ -618 { │ │ │ │ │ -619 return p[i]; │ │ │ │ │ -620 } │ │ │ │ │ -621 │ │ │ │ │ -_6_2_2 void _a_d_v_a_n_c_e(std::ptrdiff_t d) │ │ │ │ │ -623 { │ │ │ │ │ -624 i+=d; │ │ │ │ │ -625 } │ │ │ │ │ -626 │ │ │ │ │ -_6_2_7 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(const _R_e_a_l_I_t_e_r_a_t_o_r& o) const │ │ │ │ │ -628 { │ │ │ │ │ -629 return o.i-i; │ │ │ │ │ -630 } │ │ │ │ │ -631 │ │ │ │ │ -632 // Needed for operator[] of the iterator │ │ │ │ │ -_6_3_3 window_type& _e_l_e_m_e_n_t_A_t (std::ptrdiff_t offset) const │ │ │ │ │ -634 { │ │ │ │ │ -635 return p[i+offset]; │ │ │ │ │ -636 } │ │ │ │ │ -637 │ │ │ │ │ -_6_3_9 _s_i_z_e___t_y_p_e _i_n_d_e_x() const │ │ │ │ │ -640 { │ │ │ │ │ -641 return i; │ │ │ │ │ -642 } │ │ │ │ │ -643 │ │ │ │ │ -644 private: │ │ │ │ │ -645 window_type* p; │ │ │ │ │ -646 _s_i_z_e___t_y_p_e i; │ │ │ │ │ -647 }; │ │ │ │ │ -648 │ │ │ │ │ -_6_4_9 using _I_t_e_r_a_t_o_r = _R_e_a_l_I_t_e_r_a_t_o_r_<_v_a_l_u_e___t_y_p_e_,_w_i_n_d_o_w___t_y_p_e_&_>; │ │ │ │ │ -650 │ │ │ │ │ -_6_5_2 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ -653 { │ │ │ │ │ -654 return _I_t_e_r_a_t_o_r(block,0); │ │ │ │ │ -655 } │ │ │ │ │ -656 │ │ │ │ │ -_6_5_8 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ -659 { │ │ │ │ │ -660 return _I_t_e_r_a_t_o_r(block,nblocks); │ │ │ │ │ -661 } │ │ │ │ │ -662 │ │ │ │ │ -_6_6_5 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ -666 { │ │ │ │ │ -667 return _I_t_e_r_a_t_o_r(block,nblocks-1); │ │ │ │ │ -668 } │ │ │ │ │ -669 │ │ │ │ │ -_6_7_2 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ │ -673 { │ │ │ │ │ -674 return _I_t_e_r_a_t_o_r(block,-1); │ │ │ │ │ -675 } │ │ │ │ │ -676 │ │ │ │ │ -_6_7_8 using _i_t_e_r_a_t_o_r = _I_t_e_r_a_t_o_r; │ │ │ │ │ -679 │ │ │ │ │ -_6_8_1 using _C_o_n_s_t_I_t_e_r_a_t_o_r = _R_e_a_l_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _v_a_l_u_e___t_y_p_e_,_ _c_o_n_s_t_ _w_i_n_d_o_w___t_y_p_e_&_>; │ │ │ │ │ -682 │ │ │ │ │ -_6_8_4 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; │ │ │ │ │ -685 │ │ │ │ │ -_6_8_7 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ -688 { │ │ │ │ │ -689 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,0); │ │ │ │ │ -690 } │ │ │ │ │ -691 │ │ │ │ │ -_6_9_3 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ -694 { │ │ │ │ │ -695 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,nblocks); │ │ │ │ │ -696 } │ │ │ │ │ -697 │ │ │ │ │ -_7_0_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ -701 { │ │ │ │ │ -702 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,nblocks-1); │ │ │ │ │ -703 } │ │ │ │ │ -704 │ │ │ │ │ -_7_0_6 _C_o_n_s_t_I_t_e_r_a_t_o_r _r_e_n_d () const │ │ │ │ │ -707 { │ │ │ │ │ -708 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,-1); │ │ │ │ │ -709 } │ │ │ │ │ -710 │ │ │ │ │ -_7_1_2 _I_t_e_r_a_t_o_r _f_i_n_d (_s_i_z_e___t_y_p_e i) │ │ │ │ │ -713 { │ │ │ │ │ -714 return _I_t_e_r_a_t_o_r(block,std::min(i,nblocks)); │ │ │ │ │ -715 } │ │ │ │ │ -716 │ │ │ │ │ -_7_1_8 _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 │ │ │ │ │ -719 { │ │ │ │ │ -720 return _C_o_n_s_t_I_t_e_r_a_t_o_r(block,std::min(i,nblocks)); │ │ │ │ │ -721 } │ │ │ │ │ -722 │ │ │ │ │ -723 //===== sizes │ │ │ │ │ -724 │ │ │ │ │ -_7_2_6 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ -727 { │ │ │ │ │ -728 return nblocks; │ │ │ │ │ -729 } │ │ │ │ │ -730 │ │ │ │ │ -_7_3_5 _s_i_z_e___t_y_p_e _s_i_z_e () const │ │ │ │ │ -736 { │ │ │ │ │ -737 return nblocks; │ │ │ │ │ -738 } │ │ │ │ │ -739 │ │ │ │ │ -740 │ │ │ │ │ -741 private: │ │ │ │ │ -742 │ │ │ │ │ -743 void allocate() { │ │ │ │ │ -744 if (this->initialized) │ │ │ │ │ -745 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Attempt to re-allocate already initialized │ │ │ │ │ -VariableBlockVector"); │ │ │ │ │ -746 │ │ │ │ │ -747 // calculate space needed: │ │ │ │ │ -748 this->n=0; │ │ │ │ │ -749 for(_s_i_z_e___t_y_p_e i = 0; i < nblocks; i++) { │ │ │ │ │ -750 this->n += block[i].size(); │ │ │ │ │ -751 } │ │ │ │ │ -752 │ │ │ │ │ -753 // now we can allocate the big array in the base class of v │ │ │ │ │ -754 if (this->n>0) │ │ │ │ │ -755 { │ │ │ │ │ -756 // allocate and construct objects │ │ │ │ │ -757 this->p = allocator_.allocate(this->n); │ │ │ │ │ -758 new (this->p)B[this->n]; │ │ │ │ │ -759 } │ │ │ │ │ -760 else │ │ │ │ │ -761 { │ │ │ │ │ -762 this->p = nullptr; │ │ │ │ │ -763 } │ │ │ │ │ -764 │ │ │ │ │ -765 // and we set the window pointers │ │ │ │ │ -766 this->block[0].setptr(this->p); // pointer to first block │ │ │ │ │ -767 for (_s_i_z_e___t_y_p_e j=1; jinitialized = true; │ │ │ │ │ -772 } │ │ │ │ │ -773 │ │ │ │ │ -774 _s_i_z_e___t_y_p_e nblocks; // number of blocks in vector │ │ │ │ │ -775 window_type* block; // array of blocks pointing to the array in the base │ │ │ │ │ -class │ │ │ │ │ -776 bool initialized; // true if vector has been initialized │ │ │ │ │ -777 │ │ │ │ │ -778 A allocator_; │ │ │ │ │ -779 │ │ │ │ │ -780 typename std::allocator_traits::template rebind_alloc │ │ │ │ │ -windowAllocator_; │ │ │ │ │ -781 }; │ │ │ │ │ -782 │ │ │ │ │ -783 │ │ │ │ │ -784 │ │ │ │ │ -787} // end namespace │ │ │ │ │ -788 │ │ │ │ │ -789#endif │ │ │ │ │ -_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. │ │ │ │ │ -_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_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ │ -A vector of blocks with memory management. │ │ │ │ │ -DDeeffiinniittiioonn bvector.hh:395 │ │ │ │ │ -_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:46 │ │ │ │ │ -_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 │ │ │ │ │ -RealIterator< value_type, window_type & > Iterator │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:649 │ │ │ │ │ -_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() │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:97 │ │ │ │ │ -_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:55 │ │ │ │ │ -_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:58 │ │ │ │ │ -_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 _nblocks, size_type m) │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:134 │ │ │ │ │ -_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 │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:735 │ │ │ │ │ -_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 │ │ │ │ │ -number of blocks in the vector (are of variable size here) │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:726 │ │ │ │ │ -_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:172 │ │ │ │ │ -_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 _nblocks) │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:108 │ │ │ │ │ -_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() │ │ │ │ │ -free dynamic memory │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:215 │ │ │ │ │ -_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:563 │ │ │ │ │ -_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:552 │ │ │ │ │ -_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() const │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:672 │ │ │ │ │ -_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:543 │ │ │ │ │ -_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=(const VariableBlockVector &a) │ │ │ │ │ -assignment │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:322 │ │ │ │ │ -_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_l_e_v_e_l │ │ │ │ │ -static constexpr auto blocklevel │ │ │ │ │ -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_:_:_r_e_n_d │ │ │ │ │ -ConstIterator rend() const │ │ │ │ │ -end ConstIterator │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:706 │ │ │ │ │ -_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 │ │ │ │ │ -A::size_type size_type │ │ │ │ │ -The size type for the index access. │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:73 │ │ │ │ │ -_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:718 │ │ │ │ │ -_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:700 │ │ │ │ │ -_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:712 │ │ │ │ │ -_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:70 │ │ │ │ │ -_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 │ │ │ │ │ -RealIterator< const value_type, const window_type & > ConstIterator │ │ │ │ │ -Const iterator. │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:681 │ │ │ │ │ -_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:658 │ │ │ │ │ -_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:687 │ │ │ │ │ -_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:80 │ │ │ │ │ -_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:693 │ │ │ │ │ -_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:84 │ │ │ │ │ -_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 _nblocks, size_type m) │ │ │ │ │ -same effect as constructor with same argument │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:270 │ │ │ │ │ -_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:64 │ │ │ │ │ -_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 _nblocks) │ │ │ │ │ -same effect as constructor with same argument │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:234 │ │ │ │ │ -_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:665 │ │ │ │ │ -_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:652 │ │ │ │ │ -_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: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_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -bool operator==(const CreateIterator &it) const │ │ │ │ │ -equality │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:505 │ │ │ │ │ -_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:511 │ │ │ │ │ -_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:463 │ │ │ │ │ -_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:460 │ │ │ │ │ -_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:499 │ │ │ │ │ -_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:471 │ │ │ │ │ -_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:449 │ │ │ │ │ -_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:466 │ │ │ │ │ -_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:517 │ │ │ │ │ -_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:528 │ │ │ │ │ -_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:446 │ │ │ │ │ -_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:482 │ │ │ │ │ -_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:457 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:584 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ -RealIterator(window_type *_p, size_type _i) │ │ │ │ │ -constructor │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:594 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const RealIterator &it) const │ │ │ │ │ -equality │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:611 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ -size_type index() const │ │ │ │ │ -Return the index of the entry this iterator is pointing to. │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:639 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_e_l_e_m_e_n_t_A_t │ │ │ │ │ -window_type & elementAt(std::ptrdiff_t offset) const │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:633 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ │ -void decrement() │ │ │ │ │ -prefix decrement │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:605 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ │ -void advance(std::ptrdiff_t d) │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:622 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -prefix increment │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:599 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_R_e_a_l_I_t_e_r_a_t_o_r │ │ │ │ │ -RealIterator() │ │ │ │ │ -constructor, no arguments │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:587 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ │ -std::ptrdiff_t distanceTo(const RealIterator &o) const │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:627 │ │ │ │ │ -_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_a_l_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ -window_type & dereference() const │ │ │ │ │ -dereferencing │ │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:617 │ │ │ │ │ +149 public: │ │ │ │ │ +150 size_type N_, M_, Nnz_; │ │ │ │ │ +151 B* values; │ │ │ │ │ +152 Index* rowindex; │ │ │ │ │ +153 Index* colstart; │ │ │ │ │ +154 }; │ │ │ │ │ +155 │ │ │ │ │ +156} │ │ │ │ │ +157#endif │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00188.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: ilu.hh File Reference │ │ │ │ +dune-istl: io.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,77 +73,104 @@ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
ilu.hh File Reference
│ │ │ │ + │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

The incomplete LU factorization kernels. │ │ │ │ +

Some generic functions for pretty printing vectors and matrices. │ │ │ │ More...

│ │ │ │
#include <cmath>
│ │ │ │ #include <complex>
│ │ │ │ -#include <map>
│ │ │ │ -#include <vector>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <ios>
│ │ │ │ +#include <iomanip>
│ │ │ │ +#include <fstream>
│ │ │ │ +#include <string>
│ │ │ │ +#include "matrixutils.hh"
│ │ │ │ +#include "istlexception.hh"
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ #include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/scalarvectorview.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ │ +#include <dune/common/reservedvector.hh>
│ │ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::ILU::CRS< B, Alloc >
 a simple compressed row storage matrix class More...
struct  Dune::DefaultSVGMatrixOptions
 Default options class to write SVG matrices. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::ILU
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<class M >
void Dune::ILU::blockILU0Decomposition (M &A)
 compute ILU decomposition of A. A is overwritten by its decomposition
 
template<class M , class X , class Y >
void Dune::ILU::blockILUBacksolve (const M &A, X &v, const Y &d)
 LU backsolve with stored inverse.
 
template<class M >
M::field_type & Dune::ILU::firstMatrixElement (M &A, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
 
template<class K >
K & Dune::ILU::firstMatrixElement (K &A, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
 
template<class K , int n, int m>
K & Dune::ILU::firstMatrixElement (FieldMatrix< K, n, m > &A)
 
template<class M >
void Dune::ILU::blockILUDecomposition (const M &A, int n, M &ILU)
 
template<class M , class CRS , class InvVector >
void Dune::ILU::convertToCRS (const M &A, CRS &lower, CRS &upper, InvVector &inv)
 convert ILU decomposition into CRS format for lower and upper triangular and inverse.
 
template<class CRS , class InvVector , class X , class Y >
void Dune::ILU::blockILUBacksolve (const CRS &lower, const CRS &upper, const InvVector &inv, X &v, const Y &d)
 LU backsolve with stored inverse in CRS format for lower and upper triangular.
 
template<class V >
void Dune::recursive_printvector (std::ostream &s, const V &v, std::string rowtext, int &counter, int columns, int width)
 Recursively print a vector.
 
template<class V >
void Dune::printvector (std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
 Print an ISTL vector.
 
void Dune::fill_row (std::ostream &s, int m, int width, int precision)
 Print a row of zeros for a non-existing block.
 
template<class K >
void Dune::print_row (std::ostream &s, const K &value, typename FieldMatrix< K, 1, 1 >::size_type I, typename FieldMatrix< K, 1, 1 >::size_type J, typename FieldMatrix< K, 1, 1 >::size_type therow, int width, int precision, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
 Print one row of a matrix, specialization for number types.
 
template<class M >
void Dune::print_row (std::ostream &s, const M &A, typename M::size_type I, typename M::size_type J, typename M::size_type therow, int width, int precision, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
 Print one row of a matrix.
 
template<class M >
void Dune::printmatrix (std::ostream &s, const M &A, std::string title, std::string rowtext, int width=10, int precision=2)
 Print a generic block matrix.
 
template<class B , int n, int m, class A >
void Dune::printSparseMatrix (std::ostream &s, const BCRSMatrix< FieldMatrix< B, n, m >, A > &mat, std::string title, std::string rowtext, int width=3, int precision=2)
 Prints a BCRSMatrix with fixed sized blocks.
 
template<class FieldType >
void Dune::writeMatrixToMatlabHelper (const FieldType &value, int rowOffset, int colOffset, std::ostream &s, typename std::enable_if_t< Dune::IsNumber< FieldType >::value > *sfinae=nullptr)
 Helper method for the writeMatrixToMatlab routine.
 
template<class MatrixType >
void Dune::writeMatrixToMatlabHelper (const MatrixType &matrix, int externalRowOffset, int externalColOffset, std::ostream &s, typename std::enable_if_t<!Dune::IsNumber< MatrixType >::value > *sfinae=nullptr)
 Helper method for the writeMatrixToMatlab routine.
 
template<class MatrixType >
void Dune::writeMatrixToMatlab (const MatrixType &matrix, const std::string &filename, int outputPrecision=18)
 Writes sparse matrix in a Matlab-readable format.
 
template<class V >
void Dune::writeVectorToMatlabHelper (const V &v, std::ostream &stream)
 
template<class VectorType >
void Dune::writeVectorToMatlab (const VectorType &vector, const std::string &filename, int outputPrecision=18)
 Writes vectors in a Matlab-readable format.
 
template<class Mat , class SVGOptions = DefaultSVGMatrixOptions>
void Dune::writeSVGMatrix (const Mat &mat, std::ostream &out, SVGOptions opts={})
 Writes the visualization of matrix in the SVG format.
 
│ │ │ │

Detailed Description

│ │ │ │ -

The incomplete LU factorization kernels.

│ │ │ │ +

Some generic functions for pretty printing vectors and matrices.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,67 +1,108 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -ilu.hh File Reference │ │ │ │ │ -The incomplete LU factorization kernels. _M_o_r_e_._._. │ │ │ │ │ +io.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_. │ │ │ │ │ +Some generic functions for pretty printing vectors and matrices. _M_o_r_e_._._. │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ │ #include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +#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_l_o_c_k_l_e_v_e_l_._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_L_U_:_:_C_R_S_<_ _B_,_ _A_l_l_o_c_ _> │ │ │ │ │ -  a simple compressed row storage matrix class _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s │ │ │ │ │ +  Default options class to write SVG matrices. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_I_L_U │ │ │ │ │ -  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - void  _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 (M &A) │ │ │ │ │ -  compute _I_L_U decomposition of A. A is overwritten by its │ │ │ │ │ - decomposition │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const M &A, X &v, const Y &d) │ │ │ │ │ -  LU backsolve with stored inverse. │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r (std::ostream &s, const V &v, std::string │ │ │ │ │ + rowtext, int &counter, int columns, int width) │ │ │ │ │ +  Recursively print a vector. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r (std::ostream &s, const V &v, std::string title, std:: │ │ │ │ │ + string rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ +  Print an _I_S_T_L vector. │ │ │ │ │   │ │ │ │ │ -template │ │ │ │ │ -M::field_type &  _D_u_n_e_:_:_I_L_U_:_:_f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (M &A, typename std:: │ │ │ │ │ - enable_if_t::value > *sfinae=nullptr) │ │ │ │ │ +void  _D_u_n_e_:_:_f_i_l_l___r_o_w (std::ostream &s, int m, int width, int precision) │ │ │ │ │ +  Print a row of zeros for a non-existing block. │ │ │ │ │   │ │ │ │ │ template │ │ │ │ │ - K &  _D_u_n_e_:_:_I_L_U_:_:_f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (K &A, typename std:: │ │ │ │ │ - enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - K &  _D_u_n_e_:_:_I_L_U_:_:_f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (_F_i_e_l_d_M_a_t_r_i_x< K, n, m > &A) │ │ │ │ │ +void  _D_u_n_e_:_:_p_r_i_n_t___r_o_w (std::ostream &s, const K &value, typename _F_i_e_l_d_M_a_t_r_i_x< │ │ │ │ │ + K, 1, 1 >::size_type I, typename _F_i_e_l_d_M_a_t_r_i_x< K, 1, 1 >::size_type J, │ │ │ │ │ + typename _F_i_e_l_d_M_a_t_r_i_x< K, 1, 1 >::size_type therow, int width, int │ │ │ │ │ + precision, typename std::enable_if_t< Dune::IsNumber< K >::value > │ │ │ │ │ + *sfinae=nullptr) │ │ │ │ │ +  Print one row of a matrix, specialization for number types. │ │ │ │ │   │ │ │ │ │ template │ │ │ │ │ - void  _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 (const M &A, int n, M &ILU) │ │ │ │ │ +void  _D_u_n_e_:_:_p_r_i_n_t___r_o_w (std::ostream &s, const M &A, typename M::size_type I, │ │ │ │ │ + typename M::size_type J, typename M::size_type therow, int width, int │ │ │ │ │ + precision, typename std::enable_if_t::value > │ │ │ │ │ + *sfinae=nullptr) │ │ │ │ │ +  Print one row of a matrix. │ │ │ │ │   │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S (const M &A, _C_R_S &lower, _C_R_S &upper, │ │ │ │ │ - InvVector &inv) │ │ │ │ │ -  convert _I_L_U decomposition into _C_R_S format for lower and upper │ │ │ │ │ - triangular and inverse. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - void  _D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const _C_R_S &lower, const _C_R_S │ │ │ │ │ - &upper, const InvVector &inv, X &v, const Y &d) │ │ │ │ │ -  LU backsolve with stored inverse in _C_R_S format for lower and │ │ │ │ │ - upper triangular. │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_p_r_i_n_t_m_a_t_r_i_x (std::ostream &s, const M &A, std::string title, std:: │ │ │ │ │ + string rowtext, int width=10, int precision=2) │ │ │ │ │ +  Print a generic block matrix. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_p_r_i_n_t_S_p_a_r_s_e_M_a_t_r_i_x (std::ostream &s, const _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< │ │ │ │ │ + B, n, m >, A > &_m_a_t, std::string title, std::string rowtext, int width=3, │ │ │ │ │ + int precision=2) │ │ │ │ │ +  Prints a _B_C_R_S_M_a_t_r_i_x with fixed sized blocks. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const FieldType &value, int rowOffset, │ │ │ │ │ + int colOffset, std::ostream &s, typename std::enable_if_t< Dune:: │ │ │ │ │ + IsNumber< FieldType >::value > *sfinae=nullptr) │ │ │ │ │ +  Helper method for the writeMatrixToMatlab routine. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const MatrixType &matrix, int │ │ │ │ │ + externalRowOffset, int externalColOffset, std::ostream &s, typename std:: │ │ │ │ │ + enable_if_t::value > *sfinae=nullptr) │ │ │ │ │ +  Helper method for the writeMatrixToMatlab routine. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b (const MatrixType &matrix, const std::string │ │ │ │ │ + &filename, int outputPrecision=18) │ │ │ │ │ +  Writes sparse matrix in a Matlab-readable format. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const V &v, std::ostream &stream) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b (const VectorType &vector, const std::string │ │ │ │ │ + &filename, int outputPrecision=18) │ │ │ │ │ +  Writes vectors in a Matlab-readable format. │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_w_r_i_t_e_S_V_G_M_a_t_r_i_x (const Mat &_m_a_t, std::ostream &out, SVGOptions opts= │ │ │ │ │ + {}) │ │ │ │ │ +  Writes the visualization of matrix in the SVG format. │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -The incomplete LU factorization kernels. │ │ │ │ │ +Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00188_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: ilu.hh Source File │ │ │ │ +dune-istl: io.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,474 +74,709 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
ilu.hh
│ │ │ │ +
io.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ILU_HH
│ │ │ │ -
6#define DUNE_ISTL_ILU_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_IO_HH
│ │ │ │ +
6#define DUNE_ISTL_IO_HH
│ │ │ │
7
│ │ │ │
8#include <cmath>
│ │ │ │
9#include <complex>
│ │ │ │ -
10#include <map>
│ │ │ │ -
11#include <vector>
│ │ │ │ -
12
│ │ │ │ -
13#include <dune/common/fmatrix.hh>
│ │ │ │ -
14#include <dune/common/scalarvectorview.hh>
│ │ │ │ -
15#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
16
│ │ │ │ -
17#include "istlexception.hh"
│ │ │ │ -
18
│ │ │ │ -
23namespace Dune {
│ │ │ │ -
24
│ │ │ │ -
│ │ │ │ -
29 namespace ILU {
│ │ │ │ -
30
│ │ │ │ -
32 template<class M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
34 {
│ │ │ │ -
35 // iterator types
│ │ │ │ -
36 typedef typename M::RowIterator rowiterator;
│ │ │ │ -
37 typedef typename M::ColIterator coliterator;
│ │ │ │ -
38 typedef typename M::block_type block;
│ │ │ │ -
39
│ │ │ │ -
40 // implement left looking variant with stored inverse
│ │ │ │ -
41 rowiterator endi=A.end();
│ │ │ │ -
42 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
43 {
│ │ │ │ -
44 // coliterator is diagonal after the following loop
│ │ │ │ -
45 coliterator endij=(*i).end(); // end of row i
│ │ │ │ -
46 coliterator ij;
│ │ │ │ -
47
│ │ │ │ -
48 // eliminate entries left of diagonal; store L factor
│ │ │ │ -
49 for (ij=(*i).begin(); ij.index()<i.index(); ++ij)
│ │ │ │ -
50 {
│ │ │ │ -
51 // find A_jj which eliminates A_ij
│ │ │ │ -
52 coliterator jj = A[ij.index()].find(ij.index());
│ │ │ │ -
53
│ │ │ │ -
54 // compute L_ij = A_jj^-1 * A_ij
│ │ │ │ -
55 Impl::asMatrix(*ij).rightmultiply(Impl::asMatrix(*jj));
│ │ │ │ -
56
│ │ │ │ -
57 // modify row
│ │ │ │ -
58 coliterator endjk=A[ij.index()].end(); // end of row j
│ │ │ │ -
59 coliterator jk=jj; ++jk;
│ │ │ │ -
60 coliterator ik=ij; ++ik;
│ │ │ │ -
61 while (ik!=endij && jk!=endjk)
│ │ │ │ -
62 if (ik.index()==jk.index())
│ │ │ │ -
63 {
│ │ │ │ -
64 block B(*jk);
│ │ │ │ -
65 Impl::asMatrix(B).leftmultiply(Impl::asMatrix(*ij));
│ │ │ │ -
66 *ik -= B;
│ │ │ │ -
67 ++ik; ++jk;
│ │ │ │ -
68 }
│ │ │ │ -
69 else
│ │ │ │ -
70 {
│ │ │ │ -
71 if (ik.index()<jk.index())
│ │ │ │ -
72 ++ik;
│ │ │ │ -
73 else
│ │ │ │ -
74 ++jk;
│ │ │ │ -
75 }
│ │ │ │ -
76 }
│ │ │ │ -
77
│ │ │ │ -
78 // invert pivot and store it in A
│ │ │ │ -
79 if (ij.index()!=i.index())
│ │ │ │ -
80 DUNE_THROW(ISTLError,"diagonal entry missing");
│ │ │ │ -
81 try {
│ │ │ │ -
82 Impl::asMatrix(*ij).invert(); // compute inverse of diagonal block
│ │ │ │ -
83 }
│ │ │ │ -
84 catch (Dune::FMatrixError & e) {
│ │ │ │ -
85 DUNE_THROW(MatrixBlockError, "ILU failed to invert matrix block A["
│ │ │ │ -
86 << i.index() << "][" << ij.index() << "]" << e.what();
│ │ │ │ -
87 th__ex.r=i.index(); th__ex.c=ij.index(););
│ │ │ │ -
88 }
│ │ │ │ -
89 }
│ │ │ │ -
90 }
│ │ │ │ -
│ │ │ │ -
91
│ │ │ │ -
93 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
94 void blockILUBacksolve (const M& A, X& v, const Y& d)
│ │ │ │ -
95 {
│ │ │ │ -
96 // iterator types
│ │ │ │ -
97 typedef typename M::ConstRowIterator rowiterator;
│ │ │ │ -
98 typedef typename M::ConstColIterator coliterator;
│ │ │ │ -
99 typedef typename Y::block_type dblock;
│ │ │ │ -
100 typedef typename X::block_type vblock;
│ │ │ │ -
101
│ │ │ │ -
102 // lower triangular solve
│ │ │ │ -
103 rowiterator endi=A.end();
│ │ │ │ -
104 for (rowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
105 {
│ │ │ │ -
106 // We need to be careful here: Directly using
│ │ │ │ -
107 // auto rhs = Impl::asVector(d[ i.index() ]);
│ │ │ │ -
108 // is not OK in case this is a proxy. Hence
│ │ │ │ -
109 // we first have to copy the value. Notice that
│ │ │ │ -
110 // this is still not OK, if the vector type itself returns
│ │ │ │ -
111 // proxy references.
│ │ │ │ -
112 dblock rhsValue(d[i.index()]);
│ │ │ │ -
113 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ -
114 for (coliterator j=(*i).begin(); j.index()<i.index(); ++j)
│ │ │ │ -
115 Impl::asMatrix(*j).mmv(Impl::asVector(v[j.index()]),rhs);
│ │ │ │ -
116 Impl::asVector(v[i.index()]) = rhs; // Lii = I
│ │ │ │ -
117 }
│ │ │ │ -
118
│ │ │ │ -
119 // upper triangular solve
│ │ │ │ -
120 rowiterator rendi=A.beforeBegin();
│ │ │ │ -
121 for (rowiterator i=A.beforeEnd(); i!=rendi; --i)
│ │ │ │ -
122 {
│ │ │ │ -
123 // We need to be careful here: Directly using
│ │ │ │ -
124 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ │ -
125 // is not OK in case this is a proxy. Hence
│ │ │ │ -
126 // we first have to copy the value. Notice that
│ │ │ │ -
127 // this is still not OK, if the vector type itself returns
│ │ │ │ -
128 // proxy references.
│ │ │ │ -
129 vblock rhsValue(v[i.index()]);
│ │ │ │ -
130 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ -
131 coliterator j;
│ │ │ │ -
132 for (j=(*i).beforeEnd(); j.index()>i.index(); --j)
│ │ │ │ -
133 Impl::asMatrix(*j).mmv(Impl::asVector(v[j.index()]),rhs);
│ │ │ │ -
134 auto&& vi = Impl::asVector(v[i.index()]);
│ │ │ │ -
135 Impl::asMatrix(*j).mv(rhs,vi); // diagonal stores inverse!
│ │ │ │ -
136 }
│ │ │ │ -
137 }
│ │ │ │ -
│ │ │ │ -
138
│ │ │ │ -
139 // recursive function template to access first entry of a matrix
│ │ │ │ -
140 template<class M>
│ │ │ │ -
│ │ │ │ -
141 typename M::field_type& firstMatrixElement (M& A,
│ │ │ │ -
142 [[maybe_unused]] typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr)
│ │ │ │ -
143 {
│ │ │ │ -
144 return firstMatrixElement(*(A.begin()->begin()));
│ │ │ │ -
145 }
│ │ │ │ -
│ │ │ │ -
146
│ │ │ │ -
147 template<class K>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
149 [[maybe_unused]] typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr)
│ │ │ │ -
150 {
│ │ │ │ -
151 return A;
│ │ │ │ -
152 }
│ │ │ │ -
│ │ │ │ -
153
│ │ │ │ -
154 template<class K, int n, int m>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
156 {
│ │ │ │ -
157 return A[0][0];
│ │ │ │ -
158 }
│ │ │ │ -
│ │ │ │ -
159
│ │ │ │ -
166 template<class M>
│ │ │ │ -
│ │ │ │ -
167 void blockILUDecomposition (const M& A, int n, M& ILU)
│ │ │ │ -
168 {
│ │ │ │ -
169 // iterator types
│ │ │ │ -
170 typedef typename M::ColIterator coliterator;
│ │ │ │ -
171 typedef typename M::ConstRowIterator crowiterator;
│ │ │ │ -
172 typedef typename M::ConstColIterator ccoliterator;
│ │ │ │ -
173 typedef typename M::CreateIterator createiterator;
│ │ │ │ -
174 typedef typename M::field_type K;
│ │ │ │ -
175 typedef std::map<size_t, int> map;
│ │ │ │ -
176 typedef typename map::iterator mapiterator;
│ │ │ │ -
177
│ │ │ │ -
178 // symbolic factorization phase, store generation number in first matrix element
│ │ │ │ -
179 crowiterator endi=A.end();
│ │ │ │ -
180 createiterator ci=ILU.createbegin();
│ │ │ │ -
181 for (crowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
182 {
│ │ │ │ -
183 map rowpattern; // maps column index to generation
│ │ │ │ -
184
│ │ │ │ -
185 // initialize pattern with row of A
│ │ │ │ -
186 for (ccoliterator j=(*i).begin(); j!=(*i).end(); ++j)
│ │ │ │ -
187 rowpattern[j.index()] = 0;
│ │ │ │ +
10#include <limits>
│ │ │ │ +
11#include <ios>
│ │ │ │ +
12#include <iomanip>
│ │ │ │ +
13#include <fstream>
│ │ │ │ +
14#include <string>
│ │ │ │ +
15
│ │ │ │ +
16#include "matrixutils.hh"
│ │ │ │ +
17#include "istlexception.hh"
│ │ │ │ +
18#include <dune/common/fvector.hh>
│ │ │ │ +
19#include <dune/common/fmatrix.hh>
│ │ │ │ +
20#include <dune/common/hybridutilities.hh>
│ │ │ │ +
21#include <dune/common/reservedvector.hh>
│ │ │ │ +
22
│ │ │ │ + │ │ │ │ + │ │ │ │ +
25
│ │ │ │ +
26namespace Dune {
│ │ │ │ +
27
│ │ │ │ +
40 //
│ │ │ │ +
41 // pretty printing of vectors
│ │ │ │ +
42 //
│ │ │ │ +
43
│ │ │ │ +
51 template<class V>
│ │ │ │ +
│ │ │ │ +
52 void recursive_printvector (std::ostream& s, const V& v, std::string rowtext,
│ │ │ │ +
53 int& counter, int columns, int width)
│ │ │ │ +
54 {
│ │ │ │ +
55 if constexpr (IsNumber<V>())
│ │ │ │ +
56 {
│ │ │ │ +
57 // Print one number
│ │ │ │ +
58 if (counter%columns==0)
│ │ │ │ +
59 {
│ │ │ │ +
60 s << rowtext; // start a new row
│ │ │ │ +
61 s << " "; // space in front of each entry
│ │ │ │ +
62 s.width(4); // set width for counter
│ │ │ │ +
63 s << counter; // number of first entry in a line
│ │ │ │ +
64 }
│ │ │ │ +
65 s << " "; // space in front of each entry
│ │ │ │ +
66 s.width(width); // set width for each entry anew
│ │ │ │ +
67 s << v; // yeah, the number !
│ │ │ │ +
68 counter++; // increment the counter
│ │ │ │ +
69 if (counter%columns==0)
│ │ │ │ +
70 s << std::endl; // start a new line
│ │ │ │ +
71 }
│ │ │ │ +
72 else
│ │ │ │ +
73 {
│ │ │ │ +
74 // Recursively print a vector
│ │ │ │ +
75 for (const auto& entry : v)
│ │ │ │ +
76 recursive_printvector(s,entry,rowtext,counter,columns,width);
│ │ │ │ +
77 }
│ │ │ │ +
78 }
│ │ │ │ +
│ │ │ │ +
79
│ │ │ │ +
80
│ │ │ │ +
88 template<class V>
│ │ │ │ +
│ │ │ │ +
89 void printvector (std::ostream& s, const V& v, std::string title,
│ │ │ │ +
90 std::string rowtext, int columns=1, int width=10,
│ │ │ │ +
91 int precision=2)
│ │ │ │ +
92 {
│ │ │ │ +
93 // count the numbers printed to make columns
│ │ │ │ +
94 int counter=0;
│ │ │ │ +
95
│ │ │ │ +
96 // remember old flags
│ │ │ │ +
97 std::ios_base::fmtflags oldflags = s.flags();
│ │ │ │ +
98
│ │ │ │ +
99 // set the output format
│ │ │ │ +
100 s.setf(std::ios_base::scientific, std::ios_base::floatfield);
│ │ │ │ +
101 int oldprec = s.precision();
│ │ │ │ +
102 s.precision(precision);
│ │ │ │ +
103
│ │ │ │ +
104 // print title
│ │ │ │ +
105 s << title << " [blocks=" << v.N() << ",dimension=" << v.dim() << "]"
│ │ │ │ +
106 << std::endl;
│ │ │ │ +
107
│ │ │ │ +
108 // print data from all blocks
│ │ │ │ +
109 recursive_printvector(s,v,rowtext,counter,columns,width);
│ │ │ │ +
110
│ │ │ │ +
111 // check if new line is required
│ │ │ │ +
112 if (counter%columns!=0)
│ │ │ │ +
113 s << std::endl;
│ │ │ │ +
114
│ │ │ │ +
115 // reset the output format
│ │ │ │ +
116 s.flags(oldflags);
│ │ │ │ +
117 s.precision(oldprec);
│ │ │ │ +
118 }
│ │ │ │ +
│ │ │ │ +
119
│ │ │ │ +
120
│ │ │ │ +
122 //
│ │ │ │ +
123 // pretty printing of matrices
│ │ │ │ +
124 //
│ │ │ │ +
125
│ │ │ │ +
│ │ │ │ +
133 inline void fill_row (std::ostream& s, int m, int width, [[maybe_unused]] int precision)
│ │ │ │ +
134 {
│ │ │ │ +
135 for (int j=0; j<m; j++)
│ │ │ │ +
136 {
│ │ │ │ +
137 s << " "; // space in front of each entry
│ │ │ │ +
138 s.width(width); // set width for each entry anew
│ │ │ │ +
139 s << "."; // yeah, the number !
│ │ │ │ +
140 }
│ │ │ │ +
141 }
│ │ │ │ +
│ │ │ │ +
142
│ │ │ │ +
150 template<class K>
│ │ │ │ +
│ │ │ │ +
151 void print_row (std::ostream& s, const K& value,
│ │ │ │ +
152 [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type I,
│ │ │ │ +
153 [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type J,
│ │ │ │ +
154 [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type therow,
│ │ │ │ +
155 int width,
│ │ │ │ +
156 [[maybe_unused]] int precision,
│ │ │ │ +
157 typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr)
│ │ │ │ +
158 {
│ │ │ │ +
159 s << " "; // space in front of each entry
│ │ │ │ +
160 s.width(width); // set width for each entry anew
│ │ │ │ +
161 s << value;
│ │ │ │ +
162 }
│ │ │ │ +
│ │ │ │ +
163
│ │ │ │ +
171 template<class M>
│ │ │ │ +
│ │ │ │ +
172 void print_row (std::ostream& s, const M& A, typename M::size_type I,
│ │ │ │ +
173 typename M::size_type J, typename M::size_type therow,
│ │ │ │ +
174 int width, int precision,
│ │ │ │ +
175 typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr)
│ │ │ │ +
176 {
│ │ │ │ +
177 typename M::size_type i0=I;
│ │ │ │ +
178 for (typename M::size_type i=0; i<A.N(); i++)
│ │ │ │ +
179 {
│ │ │ │ +
180 if (therow>=i0 && therow<i0+MatrixDimension<M>::rowdim(A,i))
│ │ │ │ +
181 {
│ │ │ │ +
182 // the row is in this block row !
│ │ │ │ +
183 typename M::size_type j0=J;
│ │ │ │ +
184 for (typename M::size_type j=0; j<A.M(); j++)
│ │ │ │ +
185 {
│ │ │ │ +
186 // find this block
│ │ │ │ +
187 typename M::ConstColIterator it = A[i].find(j);
│ │ │ │
188
│ │ │ │ -
189 // eliminate entries in row which are to the left of the diagonal
│ │ │ │ -
190 for (mapiterator ik=rowpattern.begin(); (*ik).first<i.index(); ++ik)
│ │ │ │ -
191 {
│ │ │ │ -
192 if ((*ik).second<n)
│ │ │ │ -
193 {
│ │ │ │ -
194 coliterator endk = ILU[(*ik).first].end(); // end of row k
│ │ │ │ -
195 coliterator kj = ILU[(*ik).first].find((*ik).first); // diagonal in k
│ │ │ │ -
196 for (++kj; kj!=endk; ++kj) // row k eliminates in row i
│ │ │ │ -
197 {
│ │ │ │ -
198 // we misuse the storage to store an int. If the field_type is std::complex, we have to access the real/abs part
│ │ │ │ -
199 // starting from C++11, we can use std::abs to always return a real value, even if it is double/float
│ │ │ │ -
200 using std::abs;
│ │ │ │ -
201 int generation = (int) Simd::lane(0, abs( firstMatrixElement(*kj) ));
│ │ │ │ -
202 if (generation<n)
│ │ │ │ -
203 {
│ │ │ │ -
204 mapiterator ij = rowpattern.find(kj.index());
│ │ │ │ -
205 if (ij==rowpattern.end())
│ │ │ │ -
206 {
│ │ │ │ -
207 rowpattern[kj.index()] = generation+1;
│ │ │ │ -
208 }
│ │ │ │ -
209 }
│ │ │ │ -
210 }
│ │ │ │ -
211 }
│ │ │ │ -
212 }
│ │ │ │ -
213
│ │ │ │ -
214 // create row
│ │ │ │ -
215 for (mapiterator ik=rowpattern.begin(); ik!=rowpattern.end(); ++ik)
│ │ │ │ -
216 ci.insert((*ik).first);
│ │ │ │ -
217 ++ci; // now row i exist
│ │ │ │ -
218
│ │ │ │ -
219 // write generation index into entries
│ │ │ │ -
220 coliterator endILUij = ILU[i.index()].end();;
│ │ │ │ -
221 for (coliterator ILUij=ILU[i.index()].begin(); ILUij!=endILUij; ++ILUij)
│ │ │ │ -
222 Simd::lane(0, firstMatrixElement(*ILUij)) = (Simd::Scalar<K>) rowpattern[ILUij.index()];
│ │ │ │ -
223 }
│ │ │ │ +
189 // print row or filler
│ │ │ │ +
190 if (it!=A[i].end())
│ │ │ │ +
191 print_row(s,*it,i0,j0,therow,width,precision);
│ │ │ │ +
192 else
│ │ │ │ +
193 fill_row(s,MatrixDimension<M>::coldim(A,j),width,precision);
│ │ │ │ +
194
│ │ │ │ +
195 // advance columns
│ │ │ │ + │ │ │ │ +
197 }
│ │ │ │ +
198 }
│ │ │ │ +
199 // advance rows
│ │ │ │ + │ │ │ │ +
201 }
│ │ │ │ +
202 }
│ │ │ │ +
│ │ │ │ +
203
│ │ │ │ +
212 template<class M>
│ │ │ │ +
│ │ │ │ +
213 void printmatrix (std::ostream& s, const M& A, std::string title,
│ │ │ │ +
214 std::string rowtext, int width=10, int precision=2)
│ │ │ │ +
215 {
│ │ │ │ +
216
│ │ │ │ +
217 // remember old flags
│ │ │ │ +
218 std::ios_base::fmtflags oldflags = s.flags();
│ │ │ │ +
219
│ │ │ │ +
220 // set the output format
│ │ │ │ +
221 s.setf(std::ios_base::scientific, std::ios_base::floatfield);
│ │ │ │ +
222 int oldprec = s.precision();
│ │ │ │ +
223 s.precision(precision);
│ │ │ │
224
│ │ │ │ -
225 // copy entries of A
│ │ │ │ -
226 for (crowiterator i=A.begin(); i!=endi; ++i)
│ │ │ │ -
227 {
│ │ │ │ -
228 coliterator ILUij;
│ │ │ │ -
229 coliterator endILUij = ILU[i.index()].end();;
│ │ │ │ -
230 for (ILUij=ILU[i.index()].begin(); ILUij!=endILUij; ++ILUij)
│ │ │ │ -
231 (*ILUij) = 0; // clear row
│ │ │ │ -
232 ccoliterator Aij = (*i).begin();
│ │ │ │ -
233 ccoliterator endAij = (*i).end();
│ │ │ │ -
234 ILUij = ILU[i.index()].begin();
│ │ │ │ -
235 while (Aij!=endAij && ILUij!=endILUij)
│ │ │ │ -
236 {
│ │ │ │ -
237 if (Aij.index()==ILUij.index())
│ │ │ │ -
238 {
│ │ │ │ -
239 *ILUij = *Aij;
│ │ │ │ -
240 ++Aij; ++ILUij;
│ │ │ │ -
241 }
│ │ │ │ -
242 else
│ │ │ │ -
243 {
│ │ │ │ -
244 if (Aij.index()<ILUij.index())
│ │ │ │ -
245 ++Aij;
│ │ │ │ -
246 else
│ │ │ │ -
247 ++ILUij;
│ │ │ │ -
248 }
│ │ │ │ -
249 }
│ │ │ │ -
250 }
│ │ │ │ -
251
│ │ │ │ -
252 // call decomposition on pattern
│ │ │ │ - │ │ │ │ -
254 }
│ │ │ │ -
│ │ │ │ -
255
│ │ │ │ -
257 template <class B, class Alloc = std::allocator<B>>
│ │ │ │ -
│ │ │ │ -
258 struct CRS
│ │ │ │ -
259 {
│ │ │ │ -
260 typedef B block_type;
│ │ │ │ -
261 typedef size_t size_type;
│ │ │ │ -
262
│ │ │ │ -
263 CRS() : nRows_( 0 ) {}
│ │ │ │ -
264
│ │ │ │ -
265 size_type rows() const { return nRows_; }
│ │ │ │ -
266
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
268 {
│ │ │ │ -
269 assert( rows_[ rows() ] != size_type(-1) );
│ │ │ │ -
270 return rows_[ rows() ];
│ │ │ │ -
271 }
│ │ │ │ -
│ │ │ │ -
272
│ │ │ │ -
│ │ │ │ -
273 void resize( const size_type nRows )
│ │ │ │ -
274 {
│ │ │ │ -
275 if( nRows_ != nRows )
│ │ │ │ -
276 {
│ │ │ │ -
277 nRows_ = nRows ;
│ │ │ │ -
278 rows_.resize( nRows_+1, size_type(-1) );
│ │ │ │ -
279 }
│ │ │ │ -
280 }
│ │ │ │ -
│ │ │ │ -
281
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
283 {
│ │ │ │ -
284 const size_type needed = values_.size() + nonZeros ;
│ │ │ │ -
285 if( values_.capacity() < needed )
│ │ │ │ -
286 {
│ │ │ │ -
287 const size_type estimate = needed * 1.1;
│ │ │ │ -
288 values_.reserve( estimate );
│ │ │ │ -
289 cols_.reserve( estimate );
│ │ │ │ -
290 }
│ │ │ │ -
291 }
│ │ │ │ -
│ │ │ │ +
225 // print title
│ │ │ │ +
226 s << title
│ │ │ │ +
227 << " [n=" << A.N()
│ │ │ │ +
228 << ",m=" << A.M()
│ │ │ │ +
229 << ",rowdim=" << MatrixDimension<M>::rowdim(A)
│ │ │ │ +
230 << ",coldim=" << MatrixDimension<M>::coldim(A)
│ │ │ │ +
231 << "]" << std::endl;
│ │ │ │ +
232
│ │ │ │ +
233 // print all rows
│ │ │ │ +
234 for (typename M::size_type i=0; i<MatrixDimension<M>::rowdim(A); i++)
│ │ │ │ +
235 {
│ │ │ │ +
236 s << rowtext; // start a new row
│ │ │ │ +
237 s << " "; // space in front of each entry
│ │ │ │ +
238 s.width(4); // set width for counter
│ │ │ │ +
239 s << i; // number of first entry in a line
│ │ │ │ +
240 print_row(s,A,0,0,i,width,precision); // generic print
│ │ │ │ +
241 s << std::endl; // start a new line
│ │ │ │ +
242 }
│ │ │ │ +
243
│ │ │ │ +
244 // reset the output format
│ │ │ │ +
245 s.flags(oldflags);
│ │ │ │ +
246 s.precision(oldprec);
│ │ │ │ +
247 }
│ │ │ │ +
│ │ │ │ +
248
│ │ │ │ +
270 template<class B, int n, int m, class A>
│ │ │ │ +
│ │ │ │ +
271 void printSparseMatrix(std::ostream& s,
│ │ │ │ + │ │ │ │ +
273 std::string title, std::string rowtext,
│ │ │ │ +
274 int width=3, int precision=2)
│ │ │ │ +
275 {
│ │ │ │ + │ │ │ │ +
277 // remember old flags
│ │ │ │ +
278 std::ios_base::fmtflags oldflags = s.flags();
│ │ │ │ +
279 // set the output format
│ │ │ │ +
280 s.setf(std::ios_base::scientific, std::ios_base::floatfield);
│ │ │ │ +
281 int oldprec = s.precision();
│ │ │ │ +
282 s.precision(precision);
│ │ │ │ +
283 // print title
│ │ │ │ +
284 s << title
│ │ │ │ +
285 << " [n=" << mat.N()
│ │ │ │ +
286 << ",m=" << mat.M()
│ │ │ │ +
287 << ",rowdim=" << MatrixDimension<Matrix>::rowdim(mat)
│ │ │ │ +
288 << ",coldim=" << MatrixDimension<Matrix>::coldim(mat)
│ │ │ │ +
289 << "]" << std::endl;
│ │ │ │ +
290
│ │ │ │ +
291 typedef typename Matrix::ConstRowIterator Row;
│ │ │ │
292
│ │ │ │ -
│ │ │ │ -
293 void push_back( const block_type& value, const size_type index )
│ │ │ │ -
294 {
│ │ │ │ -
295 values_.push_back( value );
│ │ │ │ -
296 cols_.push_back( index );
│ │ │ │ -
297 }
│ │ │ │ -
│ │ │ │ -
298
│ │ │ │ -
299 std::vector< size_type > rows_;
│ │ │ │ -
300 std::vector< block_type, Alloc> values_;
│ │ │ │ -
301 std::vector< size_type > cols_;
│ │ │ │ - │ │ │ │ -
303 };
│ │ │ │ -
│ │ │ │ -
304
│ │ │ │ -
306 template<class M, class CRS, class InvVector>
│ │ │ │ -
│ │ │ │ -
307 void convertToCRS(const M& A, CRS& lower, CRS& upper, InvVector& inv )
│ │ │ │ -
308 {
│ │ │ │ -
309 typedef typename M :: size_type size_type;
│ │ │ │ -
310
│ │ │ │ -
311 lower.resize( A.N() );
│ │ │ │ -
312 upper.resize( A.N() );
│ │ │ │ -
313 inv.resize( A.N() );
│ │ │ │ -
314
│ │ │ │ -
315 // lower and upper triangular should store half of non zeros minus diagonal
│ │ │ │ -
316 const size_t memEstimate = (A.nonzeroes() - A.N())/2;
│ │ │ │ -
317
│ │ │ │ -
318 assert( A.nonzeroes() != 0 );
│ │ │ │ -
319 lower.reserveAdditional( memEstimate );
│ │ │ │ -
320 upper.reserveAdditional( memEstimate );
│ │ │ │ -
321
│ │ │ │ -
322 const auto endi = A.end();
│ │ │ │ -
323 size_type row = 0;
│ │ │ │ -
324 size_type colcount = 0;
│ │ │ │ -
325 lower.rows_[ 0 ] = colcount;
│ │ │ │ -
326 for (auto i=A.begin(); i!=endi; ++i, ++row)
│ │ │ │ -
327 {
│ │ │ │ -
328 const size_type iIndex = i.index();
│ │ │ │ -
329
│ │ │ │ -
330 // store entries left of diagonal
│ │ │ │ -
331 for (auto j=(*i).begin(); j.index() < iIndex; ++j )
│ │ │ │ -
332 {
│ │ │ │ -
333 lower.push_back( (*j), j.index() );
│ │ │ │ -
334 ++colcount;
│ │ │ │ +
293 for(Row row=mat.begin(); row != mat.end(); ++row) {
│ │ │ │ +
294 int skipcols=0;
│ │ │ │ +
295 bool reachedEnd=false;
│ │ │ │ +
296
│ │ │ │ +
297 while(!reachedEnd) {
│ │ │ │ +
298 for(int innerrow=0; innerrow<n; ++innerrow) {
│ │ │ │ +
299 int count=0;
│ │ │ │ +
300 typedef typename Matrix::ConstColIterator Col;
│ │ │ │ +
301 Col col=row->begin();
│ │ │ │ +
302 for(; col != row->end(); ++col,++count) {
│ │ │ │ +
303 if(count<skipcols)
│ │ │ │ +
304 continue;
│ │ │ │ +
305 if(count>=skipcols+width)
│ │ │ │ +
306 break;
│ │ │ │ +
307 if(innerrow==0) {
│ │ │ │ +
308 if(count==skipcols) {
│ │ │ │ +
309 s << rowtext; // start a new row
│ │ │ │ +
310 s << " "; // space in front of each entry
│ │ │ │ +
311 s.width(4); // set width for counter
│ │ │ │ +
312 s << row.index()<<": "; // number of first entry in a line
│ │ │ │ +
313 }
│ │ │ │ +
314 s.width(4);
│ │ │ │ +
315 s<<col.index()<<": |";
│ │ │ │ +
316 } else {
│ │ │ │ +
317 if(count==skipcols) {
│ │ │ │ +
318 for(typename std::string::size_type i=0; i < rowtext.length(); i++)
│ │ │ │ +
319 s<<" ";
│ │ │ │ +
320 s<<" ";
│ │ │ │ +
321 }
│ │ │ │ +
322 s<<" |";
│ │ │ │ +
323 }
│ │ │ │ +
324 for(int innercol=0; innercol < m; ++innercol) {
│ │ │ │ +
325 s.width(9);
│ │ │ │ +
326 s<<(*col)[innerrow][innercol]<<" ";
│ │ │ │ +
327 }
│ │ │ │ +
328
│ │ │ │ +
329 s<<"|";
│ │ │ │ +
330 }
│ │ │ │ +
331 if(innerrow==n-1 && col==row->end())
│ │ │ │ +
332 reachedEnd = true;
│ │ │ │ +
333 else
│ │ │ │ +
334 s << std::endl;
│ │ │ │
335 }
│ │ │ │ -
336 lower.rows_[ iIndex+1 ] = colcount;
│ │ │ │ -
337 }
│ │ │ │ -
338
│ │ │ │ -
339 const auto rendi = A.beforeBegin();
│ │ │ │ -
340 row = 0;
│ │ │ │ -
341 colcount = 0;
│ │ │ │ -
342 upper.rows_[ 0 ] = colcount ;
│ │ │ │ -
343
│ │ │ │ -
344 // NOTE: upper and inv store entries in reverse row and col order,
│ │ │ │ -
345 // reverse here relative to ILU
│ │ │ │ -
346 for (auto i=A.beforeEnd(); i!=rendi; --i, ++ row )
│ │ │ │ -
347 {
│ │ │ │ -
348 const auto endij=(*i).beforeBegin(); // end of row i
│ │ │ │ -
349
│ │ │ │ -
350 const size_type iIndex = i.index();
│ │ │ │ -
351
│ │ │ │ -
352 // store in reverse row order for faster access during backsolve
│ │ │ │ -
353 for (auto j=(*i).beforeEnd(); j != endij; --j )
│ │ │ │ -
354 {
│ │ │ │ -
355 const size_type jIndex = j.index();
│ │ │ │ -
356 if( j.index() == iIndex )
│ │ │ │ -
357 {
│ │ │ │ -
358 inv[ row ] = (*j);
│ │ │ │ -
359 break; // assuming consecutive ordering of A
│ │ │ │ -
360 }
│ │ │ │ -
361 else if ( j.index() >= i.index() )
│ │ │ │ -
362 {
│ │ │ │ -
363 upper.push_back( (*j), jIndex );
│ │ │ │ -
364 ++colcount ;
│ │ │ │ -
365 }
│ │ │ │ -
366 }
│ │ │ │ -
367 upper.rows_[ row+1 ] = colcount;
│ │ │ │ -
368 }
│ │ │ │ -
369 } // end convertToCRS
│ │ │ │ -
│ │ │ │ -
370
│ │ │ │ -
372 template<class CRS, class InvVector, class X, class Y>
│ │ │ │ -
│ │ │ │ -
373 void blockILUBacksolve (const CRS& lower,
│ │ │ │ -
374 const CRS& upper,
│ │ │ │ -
375 const InvVector& inv,
│ │ │ │ -
376 X& v, const Y& d)
│ │ │ │ -
377 {
│ │ │ │ -
378 // iterator types
│ │ │ │ -
379 typedef typename Y :: block_type dblock;
│ │ │ │ -
380 typedef typename X :: block_type vblock;
│ │ │ │ -
381 typedef typename X :: size_type size_type ;
│ │ │ │ -
382
│ │ │ │ -
383 const size_type iEnd = lower.rows();
│ │ │ │ -
384 const size_type lastRow = iEnd - 1;
│ │ │ │ -
385 if( iEnd != upper.rows() )
│ │ │ │ -
386 {
│ │ │ │ -
387 DUNE_THROW(ISTLError,"ILU::blockILUBacksolve: lower and upper rows must be the same");
│ │ │ │ -
388 }
│ │ │ │ -
389
│ │ │ │ -
390 // lower triangular solve
│ │ │ │ -
391 for( size_type i=0; i<iEnd; ++ i )
│ │ │ │ -
392 {
│ │ │ │ -
393 dblock rhsValue( d[ i ] );
│ │ │ │ -
394 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ -
395 const size_type rowI = lower.rows_[ i ];
│ │ │ │ -
396 const size_type rowINext = lower.rows_[ i+1 ];
│ │ │ │ -
397
│ │ │ │ -
398 for( size_type col = rowI; col < rowINext; ++ col )
│ │ │ │ -
399 Impl::asMatrix(lower.values_[ col ]).mmv( Impl::asVector(v[ lower.cols_[ col ] ] ), rhs );
│ │ │ │ -
400
│ │ │ │ -
401 Impl::asVector(v[ i ]) = rhs; // Lii = I
│ │ │ │ -
402 }
│ │ │ │ -
403
│ │ │ │ -
404 // upper triangular solve
│ │ │ │ -
405 for( size_type i=0; i<iEnd; ++ i )
│ │ │ │ -
406 {
│ │ │ │ -
407 auto&& vBlock = Impl::asVector(v[ lastRow - i ]);
│ │ │ │ -
408 vblock rhsValue ( v[ lastRow - i ] );
│ │ │ │ -
409 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ │ -
410 const size_type rowI = upper.rows_[ i ];
│ │ │ │ -
411 const size_type rowINext = upper.rows_[ i+1 ];
│ │ │ │ +
336 skipcols += width;
│ │ │ │ +
337 s << std::endl;
│ │ │ │ +
338 }
│ │ │ │ +
339 s << std::endl;
│ │ │ │ +
340 }
│ │ │ │ +
341
│ │ │ │ +
342 // reset the output format
│ │ │ │ +
343 s.flags(oldflags);
│ │ │ │ +
344 s.precision(oldprec);
│ │ │ │ +
345 }
│ │ │ │ +
│ │ │ │ +
346
│ │ │ │ +
347 namespace
│ │ │ │ +
348 {
│ │ │ │ +
349 template<typename T>
│ │ │ │ +
350 struct MatlabPODWriter
│ │ │ │ +
351 {
│ │ │ │ +
352 static std::ostream& write(const T& t, std::ostream& s)
│ │ │ │ +
353 {
│ │ │ │ +
354 s << t;
│ │ │ │ +
355 return s;
│ │ │ │ +
356 }
│ │ │ │ +
357 };
│ │ │ │ +
358 template<typename T>
│ │ │ │ +
359 struct MatlabPODWriter<std::complex<T> >
│ │ │ │ +
360 {
│ │ │ │ +
361 static std::ostream& write(const std::complex<T>& t, std::ostream& s)
│ │ │ │ +
362 {
│ │ │ │ +
363 s << t.real() << " " << t.imag();
│ │ │ │ +
364 return s;
│ │ │ │ +
365 }
│ │ │ │ +
366 };
│ │ │ │ +
367 } // anonymous namespace
│ │ │ │ +
368
│ │ │ │ +
378 template <class FieldType>
│ │ │ │ +
│ │ │ │ +
379 void writeMatrixToMatlabHelper(const FieldType& value,
│ │ │ │ +
380 int rowOffset, int colOffset,
│ │ │ │ +
381 std::ostream& s,
│ │ │ │ +
382 typename std::enable_if_t<Dune::IsNumber<FieldType>::value>* sfinae = nullptr)
│ │ │ │ +
383 {
│ │ │ │ +
384 //+1 for Matlab numbering
│ │ │ │ +
385 s << rowOffset + 1 << " " << colOffset + 1 << " ";
│ │ │ │ +
386 MatlabPODWriter<FieldType>::write(value, s)<< std::endl;
│ │ │ │ +
387 }
│ │ │ │ +
│ │ │ │ +
388
│ │ │ │ +
396 template <class MatrixType>
│ │ │ │ +
│ │ │ │ +
397 void writeMatrixToMatlabHelper(const MatrixType& matrix,
│ │ │ │ +
398 int externalRowOffset, int externalColOffset,
│ │ │ │ +
399 std::ostream& s,
│ │ │ │ +
400 typename std::enable_if_t<!Dune::IsNumber<MatrixType>::value>* sfinae = nullptr)
│ │ │ │ +
401 {
│ │ │ │ +
402 // Precompute the accumulated sizes of the columns
│ │ │ │ +
403 std::vector<typename MatrixType::size_type> colOffset(matrix.M());
│ │ │ │ +
404 if (colOffset.size() > 0)
│ │ │ │ +
405 colOffset[0] = 0;
│ │ │ │ +
406
│ │ │ │ +
407 for (typename MatrixType::size_type i=0; i<matrix.M()-1; i++)
│ │ │ │ +
408 colOffset[i+1] = colOffset[i] +
│ │ │ │ + │ │ │ │ +
410
│ │ │ │ +
411 typename MatrixType::size_type rowOffset = 0;
│ │ │ │
412
│ │ │ │ -
413 for( size_type col = rowI; col < rowINext; ++ col )
│ │ │ │ -
414 Impl::asMatrix(upper.values_[ col ]).mmv( Impl::asVector(v[ upper.cols_[ col ] ]), rhs );
│ │ │ │ -
415
│ │ │ │ -
416 // apply inverse and store result
│ │ │ │ -
417 Impl::asMatrix(inv[ i ]).mv(rhs, vBlock);
│ │ │ │ -
418 }
│ │ │ │ -
419 }
│ │ │ │ -
│ │ │ │ -
420
│ │ │ │ -
421 } // end namespace ILU
│ │ │ │ -
│ │ │ │ -
422
│ │ │ │ -
425} // end namespace
│ │ │ │ -
426
│ │ │ │ -
427#endif
│ │ │ │ - │ │ │ │ +
413 // Loop over all matrix rows
│ │ │ │ +
414 for (typename MatrixType::size_type rowIdx=0; rowIdx<matrix.N(); rowIdx++)
│ │ │ │ +
415 {
│ │ │ │ +
416 auto cIt = matrix[rowIdx].begin();
│ │ │ │ +
417 auto cEndIt = matrix[rowIdx].end();
│ │ │ │ +
418
│ │ │ │ +
419 // Loop over all columns in this row
│ │ │ │ +
420 for (; cIt!=cEndIt; ++cIt)
│ │ │ │ + │ │ │ │ +
422 externalRowOffset+rowOffset,
│ │ │ │ +
423 externalColOffset + colOffset[cIt.index()],
│ │ │ │ +
424 s);
│ │ │ │ +
425
│ │ │ │ +
426 rowOffset += MatrixDimension<MatrixType>::rowdim(matrix, rowIdx);
│ │ │ │ +
427 }
│ │ │ │ +
428
│ │ │ │ +
429 }
│ │ │ │ +
│ │ │ │ +
430
│ │ │ │ +
450 template <class MatrixType>
│ │ │ │ +
│ │ │ │ +
451 void writeMatrixToMatlab(const MatrixType& matrix,
│ │ │ │ +
452 const std::string& filename, int outputPrecision = 18)
│ │ │ │ +
453 {
│ │ │ │ +
454 std::ofstream outStream(filename.c_str());
│ │ │ │ +
455 int oldPrecision = outStream.precision();
│ │ │ │ +
456 outStream.precision(outputPrecision);
│ │ │ │ +
457
│ │ │ │ +
458 writeMatrixToMatlabHelper(matrix, 0, 0, outStream);
│ │ │ │ +
459 outStream.precision(oldPrecision);
│ │ │ │ +
460 }
│ │ │ │ +
│ │ │ │ +
461
│ │ │ │ +
462 // Recursively write vector entries to a stream
│ │ │ │ +
463 template<class V>
│ │ │ │ +
│ │ │ │ +
464 void writeVectorToMatlabHelper (const V& v, std::ostream& stream)
│ │ │ │ +
465 {
│ │ │ │ +
466 if constexpr (IsNumber<V>()) {
│ │ │ │ +
467 stream << v << std::endl;
│ │ │ │ +
468 } else {
│ │ │ │ +
469 for (const auto& entry : v)
│ │ │ │ +
470 writeVectorToMatlabHelper(entry, stream);
│ │ │ │ +
471 }
│ │ │ │ +
472 }
│ │ │ │ +
│ │ │ │ +
473
│ │ │ │ +
491 template <class VectorType>
│ │ │ │ +
│ │ │ │ +
492 void writeVectorToMatlab(const VectorType& vector,
│ │ │ │ +
493 const std::string& filename, int outputPrecision = 18)
│ │ │ │ +
494 {
│ │ │ │ +
495 std::ofstream outStream(filename.c_str());
│ │ │ │ +
496 int oldPrecision = outStream.precision();
│ │ │ │ +
497 outStream.precision(outputPrecision);
│ │ │ │ +
498
│ │ │ │ +
499 writeVectorToMatlabHelper(vector, outStream);
│ │ │ │ +
500 outStream.precision(oldPrecision);
│ │ │ │ +
501 }
│ │ │ │ +
│ │ │ │ +
502
│ │ │ │ +
503 namespace Impl {
│ │ │ │ +
504
│ │ │ │ +
506 struct NullStream {
│ │ │ │ +
507 template <class Any>
│ │ │ │ +
508 friend NullStream &operator<<(NullStream &dev0, Any &&) {
│ │ │ │ +
509 return dev0;
│ │ │ │ +
510 }
│ │ │ │ +
511 };
│ │ │ │ +
512
│ │ │ │ +
514 // svg shall be closed with a group and an svg. i.e. "</g></svg>"
│ │ │ │ +
515 template <class Stream, class SVGMatrixOptions>
│ │ │ │ +
516 void writeSVGMatrixHeader(Stream &out, const SVGMatrixOptions &opts,
│ │ │ │ +
517 std::pair<std::size_t, size_t> offsets) {
│ │ │ │ +
518 auto [col_offset, row_offset] = offsets;
│ │ │ │ +
519 double width = opts.width;
│ │ │ │ +
520 double height = opts.height;
│ │ │ │ +
521 // if empty, we try to figure out a sensible value of width and height
│ │ │ │ +
522 if (opts.width == 0 and opts.height == 0)
│ │ │ │ +
523 width = height = 500;
│ │ │ │ +
524 if (opts.width == 0)
│ │ │ │ +
525 width = opts.height * (double(col_offset) / row_offset);
│ │ │ │ +
526 if (opts.height == 0)
│ │ │ │ +
527 height = opts.width * (double(row_offset) / col_offset);
│ │ │ │ +
528
│ │ │ │ +
529 // scale group w.r.t final offsets
│ │ │ │ +
530 double scale_width = width / col_offset;
│ │ │ │ +
531 double scale_height = height / row_offset;
│ │ │ │ +
532
│ │ │ │ +
533 // write the header text
│ │ │ │ +
534 out << "<svg xmlns='http://www.w3.org/2000/svg' width='" << std::ceil(width)
│ │ │ │ +
535 << "' height='" << std::ceil(height) << "' version='1.1'>\n"
│ │ │ │ +
536 << "<style>\n"
│ │ │ │ +
537 << opts.style << "</style>\n"
│ │ │ │ +
538 << "<g transform='scale(" << scale_width << " " << scale_height
│ │ │ │ +
539 << ")'>\n";
│ │ │ │ +
540 }
│ │ │ │ +
541
│ │ │ │ +
543 template <class Mat, class Stream, class SVGMatrixOptions,
│ │ │ │ +
544 class RowPrefix, class ColPrefix>
│ │ │ │ +
545 std::pair<std::size_t, size_t>
│ │ │ │ +
546 writeSVGMatrix(const Mat &mat, Stream &out, SVGMatrixOptions opts,
│ │ │ │ +
547 RowPrefix row_prefix, ColPrefix col_prefix) {
│ │ │ │ +
548 // get values to fill the offests
│ │ │ │ +
549 const auto& block_size = opts.block_size;
│ │ │ │ +
550 const auto& interspace = opts.interspace;
│ │ │ │ +
551
│ │ │ │ +
552 const std::size_t rows = mat.N();
│ │ │ │ +
553 const std::size_t cols = mat.M();
│ │ │ │ +
554
│ │ │ │ +
555 // disable header write for recursive calls
│ │ │ │ +
556 const bool write_header = opts.write_header;
│ │ │ │ +
557 opts.write_header = false;
│ │ │ │ +
558
│ │ │ │ +
559 // counter of offsets for every block
│ │ │ │ +
560 std::size_t row_offset = interspace;
│ │ │ │ +
561 std::size_t col_offset = interspace;
│ │ │ │ +
562
│ │ │ │ +
563 // lambda helper: for-each value
│ │ │ │ +
564 auto for_each_entry = [&mat](const auto &call_back) {
│ │ │ │ +
565 for (auto row_it = mat.begin(); row_it != mat.end(); ++row_it) {
│ │ │ │ +
566 for (auto col_it = row_it->begin(); col_it != row_it->end(); ++col_it) {
│ │ │ │ +
567 call_back(row_it.index(), col_it.index(), *col_it);
│ │ │ │ +
568 }
│ │ │ │ +
569 }
│ │ │ │ +
570 };
│ │ │ │ +
571
│ │ │ │ +
572 // accumulate content in another stream so that we write in correct order
│ │ │ │ +
573 std::stringstream ss;
│ │ │ │ +
574
│ │ │ │ +
575 // we need to append current row and col values to the prefixes
│ │ │ │ +
576 row_prefix.push_back(0);
│ │ │ │ +
577 col_prefix.push_back(0);
│ │ │ │ +
578
│ │ │ │ +
579 // do we need to write nested matrix blocks?
│ │ │ │ +
580 if constexpr (Dune::blockLevel<typename Mat::block_type>() == 0) {
│ │ │ │ +
581 // simple case: write svg block content to stream for each value
│ │ │ │ +
582 for_each_entry([&](const auto &row, const auto &col, const auto &val) {
│ │ │ │ +
583 std::size_t x_off = interspace + col * (interspace + block_size);
│ │ │ │ +
584 std::size_t y_off = interspace + row * (interspace + block_size);
│ │ │ │ +
585 row_prefix.back() = row;
│ │ │ │ +
586 col_prefix.back() = col;
│ │ │ │ +
587 opts.writeSVGBlock(ss, row_prefix, col_prefix, val,
│ │ │ │ +
588 {x_off, y_off, block_size, block_size});
│ │ │ │ +
589 });
│ │ │ │ +
590 col_offset += cols * (block_size + interspace);
│ │ │ │ +
591 row_offset += rows * (block_size + interspace);
│ │ │ │ +
592 } else {
│ │ │ │ +
593 // before we write anything, we need to calculate the
│ │ │ │ +
594 // offset for every {row,col} index
│ │ │ │ +
595 const auto null_offset = std::numeric_limits<std::size_t>::max();
│ │ │ │ +
596 std::vector<std::size_t> col_offsets(cols + 1, null_offset);
│ │ │ │ +
597 std::vector<std::size_t> row_offsets(rows + 1, null_offset);
│ │ │ │ +
598 for_each_entry([&](const auto &row, const auto &col, const auto &val) {
│ │ │ │ +
599 NullStream dev0;
│ │ │ │ +
600 // get size of sub-block
│ │ │ │ +
601 auto sub_size =
│ │ │ │ +
602 writeSVGMatrix(val, dev0, opts, row_prefix, col_prefix);
│ │ │ │ +
603
│ │ │ │ +
604 // if we didn't see col size before
│ │ │ │ +
605 if (col_offsets[col + 1] == null_offset) // write it in the offset vector
│ │ │ │ +
606 col_offsets[col + 1] = sub_size.first;
│ │ │ │ +
607
│ │ │ │ +
608 // repeat proces for row sizes
│ │ │ │ +
609 if (row_offsets[row + 1] == null_offset)
│ │ │ │ +
610 row_offsets[row + 1] = sub_size.second;
│ │ │ │ +
611 });
│ │ │ │ +
612
│ │ │ │ +
613 // if some rows/cols were not visited, make an educated guess with the minimum offset
│ │ │ │ +
614 auto min_row_offset = *std::min_element(begin(row_offsets), end(row_offsets));
│ │ │ │ +
615 std::replace(begin(row_offsets), end(row_offsets), null_offset, min_row_offset);
│ │ │ │ +
616 auto min_col_offset = *std::min_element(begin(col_offsets), end(col_offsets));
│ │ │ │ +
617 std::replace(begin(col_offsets), end(col_offsets), null_offset, min_col_offset);
│ │ │ │ +
618
│ │ │ │ +
619 // we have sizes for every block: to get offsets we make a partial sum
│ │ │ │ +
620 col_offsets[0] = interspace;
│ │ │ │ +
621 row_offsets[0] = interspace;
│ │ │ │ +
622 for (std::size_t i = 1; i < col_offsets.size(); i++)
│ │ │ │ +
623 col_offsets[i] += col_offsets[i - 1] + interspace;
│ │ │ │ +
624 for (std::size_t i = 1; i < row_offsets.size(); i++)
│ │ │ │ +
625 row_offsets[i] += row_offsets[i - 1] + interspace;
│ │ │ │ +
626
│ │ │ │ +
627 for_each_entry([&](const auto &row, const auto &col, const auto &val) {
│ │ │ │ +
628 // calculate svg view from offsets
│ │ │ │ +
629 std::size_t width =
│ │ │ │ +
630 col_offsets[col + 1] - col_offsets[col] - interspace;
│ │ │ │ +
631 std::size_t height =
│ │ │ │ +
632 row_offsets[row + 1] - row_offsets[row] - interspace;
│ │ │ │ +
633 row_prefix.back() = row;
│ │ │ │ +
634 col_prefix.back() = col;
│ │ │ │ +
635 // content of the sub-block has origin at {0,0}: shift it to the correct place
│ │ │ │ +
636 ss << "<svg x='" << col_offsets[col] << "' y='" << row_offsets[row]
│ │ │ │ +
637 << "' width='" << width << "' height='" << height << "'>\n";
│ │ │ │ +
638 // write a nested svg with the contents of the sub-block
│ │ │ │ +
639 writeSVGMatrix(val, ss, opts, row_prefix, col_prefix);
│ │ │ │ +
640 ss << "</svg>\n";
│ │ │ │ +
641 });
│ │ │ │ +
642 col_offset = col_offsets.back();
│ │ │ │ +
643 row_offset = row_offsets.back();
│ │ │ │ +
644 }
│ │ │ │ +
645
│ │ │ │ +
646 // write content in order!
│ │ │ │ +
647 // (i) if required, first header
│ │ │ │ +
648 if (write_header)
│ │ │ │ +
649 writeSVGMatrixHeader(out, opts, {col_offset, row_offset});
│ │ │ │ +
650
│ │ │ │ +
651 col_prefix.pop_back();
│ │ │ │ +
652 row_prefix.pop_back();
│ │ │ │ +
653 // (ii) an svg block for this level
│ │ │ │ +
654 opts.writeSVGBlock(out, row_prefix, col_prefix, mat,
│ │ │ │ +
655 {0, 0, col_offset, row_offset});
│ │ │ │ +
656 // (iii) the content of the matrix
│ │ │ │ +
657 out << ss.str();
│ │ │ │ +
658 // (iv) if required, close the header
│ │ │ │ +
659 if (write_header)
│ │ │ │ +
660 out << "</g>\n</svg>\n";
│ │ │ │ +
661
│ │ │ │ +
662 // return the total required for this block
│ │ │ │ +
663 return {col_offset, row_offset};
│ │ │ │ +
664 }
│ │ │ │ +
665 } // namespace Impl
│ │ │ │ +
666
│ │ │ │ +
667
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
676 std::size_t block_size = 10;
│ │ │ │ +
678 std::size_t interspace = 5;
│ │ │ │ +
680 std::size_t width = 500;
│ │ │ │ +
682 std::size_t height = 0;
│ │ │ │ +
684 bool write_header = true;
│ │ │ │ +
686 std::string style = " .matrix-block {\n"
│ │ │ │ +
687 " fill: cornflowerblue;\n"
│ │ │ │ +
688 " fill-opacity: 0.4;\n"
│ │ │ │ +
689 " stroke-width: 2;\n"
│ │ │ │ +
690 " stroke: black;\n"
│ │ │ │ +
691 " stroke-opacity: 0.5;\n"
│ │ │ │ +
692 " }\n"
│ │ │ │ +
693 " .matrix-block:hover {\n"
│ │ │ │ +
694 " fill: lightcoral;\n"
│ │ │ │ +
695 " fill-opacity: 0.4;\n"
│ │ │ │ +
696 " stroke-opacity: 1;\n"
│ │ │ │ +
697 " }\n";
│ │ │ │ +
698
│ │ │ │ +
710 std::function<std::string(const double&)> color_fill;
│ │ │ │ +
711
│ │ │ │ +
717 template <class RowPrefix, class ColPrefix>
│ │ │ │ +
│ │ │ │ +
718 std::string blockStyleClass(const RowPrefix &row_prefix,
│ │ │ │ +
719 const ColPrefix &col_prefix) const {
│ │ │ │ +
720 // here, you can potentially give a different style to each block
│ │ │ │ +
721 return "matrix-block";
│ │ │ │ +
722 }
│ │ │ │ +
│ │ │ │ +
723
│ │ │ │ +
725 bool write_block_title = true;
│ │ │ │ +
726
│ │ │ │ +
732 template <class Stream, class RowPrefix, class ColPrefix, class Block>
│ │ │ │ +
│ │ │ │ +
733 void writeBlockTitle(Stream& out, const RowPrefix &row_prefix,
│ │ │ │ +
734 const ColPrefix &col_prefix,
│ │ │ │ +
735 const Block &block) const {
│ │ │ │ +
736 if (this->write_block_title) {
│ │ │ │ +
737 out << "<title>";
│ │ │ │ +
738 assert(row_prefix.size() == col_prefix.size());
│ │ │ │ +
739 for (std::size_t i = 0; i < row_prefix.size(); ++i)
│ │ │ │ +
740 out << "[" << row_prefix[i] << ", "<< col_prefix[i] << "]";
│ │ │ │ +
741 if constexpr (Dune::blockLevel<Block>() == 0)
│ │ │ │ +
742 out << ": " << block;
│ │ │ │ +
743 out << "</title>\n";
│ │ │ │ +
744 }
│ │ │ │ +
745 }
│ │ │ │ +
│ │ │ │ +
746
│ │ │ │ +
768 template <class Stream, class RowPrefix, class ColPrefix, class Block>
│ │ │ │ +
│ │ │ │ +
769 void writeSVGBlock(Stream &out,
│ │ │ │ +
770 const RowPrefix &row_prefix,
│ │ │ │ +
771 const ColPrefix &col_prefix, const Block block,
│ │ │ │ +
772 const std::array<std::size_t, 4> &svg_box) const {
│ │ │ │ +
773 // get bounding box values
│ │ │ │ +
774 auto &[x_off, y_off, width, height] = svg_box;
│ │ │ │ +
775 // get style class
│ │ │ │ +
776 std::string block_class = this->blockStyleClass(row_prefix, col_prefix);
│ │ │ │ +
777 // write a rectangle on the bounding box
│ │ │ │ +
778 out << "<rect class='" << block_class << "' x='" << x_off << "' y='"
│ │ │ │ +
779 << y_off << "' width='" << width << "' height='" << height << "'";
│ │ │ │ +
780 if constexpr (Dune::blockLevel<Block>() == 0 and std::is_convertible<Block,double>{})
│ │ │ │ +
781 if (color_fill)
│ │ │ │ +
782 out << " style='fill-opacity: 1;fill:" << color_fill(double(block)) << "'";
│ │ │ │ +
783
│ │ │ │ +
784 out << ">\n";
│ │ │ │ +
785 // give the rectangle a title (in html this shows info about the block)
│ │ │ │ +
786 this->writeBlockTitle(out,row_prefix, col_prefix, block);
│ │ │ │ +
787 // close rectangle
│ │ │ │ +
788 out << "</rect>\n";
│ │ │ │ +
789 }
│ │ │ │ +
│ │ │ │ +
790 };
│ │ │ │ +
│ │ │ │ +
791
│ │ │ │ +
806 template <class Mat, class SVGOptions = DefaultSVGMatrixOptions>
│ │ │ │ +
│ │ │ │ +
807 void writeSVGMatrix(const Mat &mat, std::ostream &out,
│ │ │ │ +
808 SVGOptions opts = {}) {
│ │ │ │ +
809 // We need a vector that can fit all the multi-indices for rows and colums
│ │ │ │ +
810 using IndexPrefix = Dune::ReservedVector<std::size_t, blockLevel<Mat>()>;
│ │ │ │ +
811 // Call overload for Mat type
│ │ │ │ +
812 Impl::writeSVGMatrix(mat, out, opts, IndexPrefix{}, IndexPrefix{});
│ │ │ │ +
813 }
│ │ │ │ +
│ │ │ │ +
814
│ │ │ │ +
817} // namespace Dune
│ │ │ │ +
818
│ │ │ │ +
819#endif
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ +
Some handy generic functions for ISTL matrices.
│ │ │ │ + │ │ │ │
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
void writeSVGMatrix(const Mat &mat, std::ostream &out, SVGOptions opts={})
Writes the visualization of matrix in the SVG format.
Definition io.hh:807
│ │ │ │ +
void writeMatrixToMatlab(const MatrixType &matrix, const std::string &filename, int outputPrecision=18)
Writes sparse matrix in a Matlab-readable format.
Definition io.hh:451
│ │ │ │ +
void print_row(std::ostream &s, const K &value, typename FieldMatrix< K, 1, 1 >::size_type I, typename FieldMatrix< K, 1, 1 >::size_type J, typename FieldMatrix< K, 1, 1 >::size_type therow, int width, int precision, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
Print one row of a matrix, specialization for number types.
Definition io.hh:151
│ │ │ │ +
void printmatrix(std::ostream &s, const M &A, std::string title, std::string rowtext, int width=10, int precision=2)
Print a generic block matrix.
Definition io.hh:213
│ │ │ │ +
void printvector(std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
Print an ISTL vector.
Definition io.hh:89
│ │ │ │ +
void writeMatrixToMatlabHelper(const FieldType &value, int rowOffset, int colOffset, std::ostream &s, typename std::enable_if_t< Dune::IsNumber< FieldType >::value > *sfinae=nullptr)
Helper method for the writeMatrixToMatlab routine.
Definition io.hh:379
│ │ │ │ +
void writeVectorToMatlabHelper(const V &v, std::ostream &stream)
Definition io.hh:464
│ │ │ │ +
void writeVectorToMatlab(const VectorType &vector, const std::string &filename, int outputPrecision=18)
Writes vectors in a Matlab-readable format.
Definition io.hh:492
│ │ │ │ +
void recursive_printvector(std::ostream &s, const V &v, std::string rowtext, int &counter, int columns, int width)
Recursively print a vector.
Definition io.hh:52
│ │ │ │ +
void printSparseMatrix(std::ostream &s, const BCRSMatrix< FieldMatrix< B, n, m >, A > &mat, std::string title, std::string rowtext, int width=3, int precision=2)
Prints a BCRSMatrix with fixed sized blocks.
Definition io.hh:271
│ │ │ │ +
void fill_row(std::ostream &s, int m, int width, int precision)
Print a row of zeros for a non-existing block.
Definition io.hh:133
│ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv)
convert ILU decomposition into CRS format for lower and upper triangular and inverse.
Definition ilu.hh:307
│ │ │ │ -
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ │ -
M::field_type & firstMatrixElement(M &A, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
Definition ilu.hh:141
│ │ │ │ -
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ │ -
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ │ -
a simple compressed row storage matrix class
Definition ilu.hh:259
│ │ │ │ -
std::vector< size_type > cols_
Definition ilu.hh:301
│ │ │ │ -
size_type nonZeros() const
Definition ilu.hh:267
│ │ │ │ -
void resize(const size_type nRows)
Definition ilu.hh:273
│ │ │ │ -
size_type rows() const
Definition ilu.hh:265
│ │ │ │ -
CRS()
Definition ilu.hh:263
│ │ │ │ -
void reserveAdditional(const size_type nonZeros)
Definition ilu.hh:282
│ │ │ │ -
B block_type
Definition ilu.hh:260
│ │ │ │ -
std::vector< block_type, Alloc > values_
Definition ilu.hh:300
│ │ │ │ -
size_type nRows_
Definition ilu.hh:302
│ │ │ │ -
size_t size_type
Definition ilu.hh:261
│ │ │ │ -
std::vector< size_type > rows_
Definition ilu.hh:299
│ │ │ │ -
void push_back(const block_type &value, const size_type index)
Definition ilu.hh:293
│ │ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │ │ +
Definition matrixutils.hh:211
│ │ │ │ +
static auto coldim(const M &A)
Definition matrixutils.hh:219
│ │ │ │ +
static auto rowdim(const M &A)
Definition matrixutils.hh:214
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
Default options class to write SVG matrices.
Definition io.hh:674
│ │ │ │ +
std::string style
CSS style block to write in header.
Definition io.hh:686
│ │ │ │ +
std::size_t width
Final width size (pixels) of the SVG header. If 0, size is automatic.
Definition io.hh:680
│ │ │ │ +
std::function< std::string(const double &)> color_fill
Color fill for default options.
Definition io.hh:710
│ │ │ │ +
std::size_t block_size
size (pixels) of the deepst block/value of the matrix
Definition io.hh:676
│ │ │ │ +
void writeSVGBlock(Stream &out, const RowPrefix &row_prefix, const ColPrefix &col_prefix, const Block block, const std::array< std::size_t, 4 > &svg_box) const
Write an SVG object for a given block/value in the matrix.
Definition io.hh:769
│ │ │ │ +
void writeBlockTitle(Stream &out, const RowPrefix &row_prefix, const ColPrefix &col_prefix, const Block &block) const
Helper function writes a title for a given block and prefix.
Definition io.hh:733
│ │ │ │ +
std::size_t interspace
size (pixels) of the interspace between blocks
Definition io.hh:678
│ │ │ │ +
bool write_block_title
(Helper) Whether to write a title on the rectangle value
Definition io.hh:725
│ │ │ │ +
std::size_t height
Final height size (pixels) of the SVG header. If 0, size is automatic.
Definition io.hh:682
│ │ │ │ +
bool write_header
Whether to write the SVG header.
Definition io.hh:684
│ │ │ │ +
std::string blockStyleClass(const RowPrefix &row_prefix, const ColPrefix &col_prefix) const
Helper function that returns an style class for a given prefix.
Definition io.hh:718
│ │ │ │ +
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ +
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:614
│ │ │ │ +
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ │ +
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ +
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │
Definition matrixutils.hh:27
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,499 +1,801 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -ilu.hh │ │ │ │ │ +io.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 (C) 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_ILU_HH │ │ │ │ │ -6#define DUNE_ISTL_ILU_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_IO_HH │ │ │ │ │ +6#define DUNE_ISTL_IO_HH │ │ │ │ │ 7 │ │ │ │ │ 8#include │ │ │ │ │ 9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12 │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16 │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#include "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ │ 17#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -18 │ │ │ │ │ -23namespace _D_u_n_e { │ │ │ │ │ -24 │ │ │ │ │ -_2_9 namespace ILU { │ │ │ │ │ -30 │ │ │ │ │ -32 template │ │ │ │ │ -_3_3 void _b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n (M& A) │ │ │ │ │ -34 { │ │ │ │ │ -35 // iterator types │ │ │ │ │ -36 typedef typename M::RowIterator rowiterator; │ │ │ │ │ -37 typedef typename M::ColIterator coliterator; │ │ │ │ │ -38 typedef typename M::block_type block; │ │ │ │ │ -39 │ │ │ │ │ -40 // implement left looking variant with stored inverse │ │ │ │ │ -41 rowiterator endi=A.end(); │ │ │ │ │ -42 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -43 { │ │ │ │ │ -44 // coliterator is diagonal after the following loop │ │ │ │ │ -45 coliterator endij=(*i).end(); // end of row i │ │ │ │ │ -46 coliterator ij; │ │ │ │ │ -47 │ │ │ │ │ -48 // eliminate entries left of diagonal; store L factor │ │ │ │ │ -49 for (ij=(*i).begin(); ij.index() │ │ │ │ │ -_9_4 void _b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const M& A, X& v, const Y& d) │ │ │ │ │ -95 { │ │ │ │ │ -96 // iterator types │ │ │ │ │ -97 typedef typename M::ConstRowIterator rowiterator; │ │ │ │ │ -98 typedef typename M::ConstColIterator coliterator; │ │ │ │ │ -99 typedef typename Y::block_type dblock; │ │ │ │ │ -100 typedef typename X::block_type vblock; │ │ │ │ │ -101 │ │ │ │ │ -102 // lower triangular solve │ │ │ │ │ -103 rowiterator endi=A.end(); │ │ │ │ │ -104 for (rowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -105 { │ │ │ │ │ -106 // We need to be careful here: Directly using │ │ │ │ │ -107 // auto rhs = Impl::asVector(d[ i.index() ]); │ │ │ │ │ -108 // is not OK in case this is a proxy. Hence │ │ │ │ │ -109 // we first have to copy the value. Notice that │ │ │ │ │ -110 // this is still not OK, if the vector type itself returns │ │ │ │ │ -111 // proxy references. │ │ │ │ │ -112 dblock rhsValue(d[i.index()]); │ │ │ │ │ -113 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ │ -114 for (coliterator j=(*i).begin(); j.index()i.index(); --j) │ │ │ │ │ -133 Impl::asMatrix(*j).mmv(Impl::asVector(v[j.index()]),rhs); │ │ │ │ │ -134 auto&& vi = Impl::asVector(v[i.index()]); │ │ │ │ │ -135 Impl::asMatrix(*j).mv(rhs,vi); // diagonal stores inverse! │ │ │ │ │ -136 } │ │ │ │ │ -137 } │ │ │ │ │ -138 │ │ │ │ │ -139 // recursive function template to access first entry of a matrix │ │ │ │ │ -140 template │ │ │ │ │ -_1_4_1 typename M::field_type& _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (M& A, │ │ │ │ │ -142 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ -sfinae = nullptr) │ │ │ │ │ -143 { │ │ │ │ │ -144 return _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t(*(A.begin()->begin())); │ │ │ │ │ -145 } │ │ │ │ │ -146 │ │ │ │ │ -147 template │ │ │ │ │ -_1_4_8 K& _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (K& A, │ │ │ │ │ -149 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ │ -sfinae = nullptr) │ │ │ │ │ -150 { │ │ │ │ │ -151 return A; │ │ │ │ │ -152 } │ │ │ │ │ -153 │ │ │ │ │ -154 template │ │ │ │ │ -_1_5_5 K& _f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t (_F_i_e_l_d_M_a_t_r_i_x_<_K_,_n_,_m_>& A) │ │ │ │ │ -156 { │ │ │ │ │ -157 return A[0][0]; │ │ │ │ │ -158 } │ │ │ │ │ -159 │ │ │ │ │ -166 template │ │ │ │ │ -_1_6_7 void _b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n (const M& A, int n, M& ILU) │ │ │ │ │ -168 { │ │ │ │ │ -169 // iterator types │ │ │ │ │ -170 typedef typename M::ColIterator coliterator; │ │ │ │ │ -171 typedef typename M::ConstRowIterator crowiterator; │ │ │ │ │ -172 typedef typename M::ConstColIterator ccoliterator; │ │ │ │ │ -173 typedef typename M::CreateIterator createiterator; │ │ │ │ │ -174 typedef typename M::field_type K; │ │ │ │ │ -175 typedef std::map map; │ │ │ │ │ -176 typedef typename map::iterator mapiterator; │ │ │ │ │ -177 │ │ │ │ │ -178 // symbolic factorization phase, store generation number in first matrix │ │ │ │ │ -element │ │ │ │ │ -179 crowiterator endi=A.end(); │ │ │ │ │ -180 createiterator ci=ILU.createbegin(); │ │ │ │ │ -181 for (crowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -182 { │ │ │ │ │ -183 map rowpattern; // maps column index to generation │ │ │ │ │ -184 │ │ │ │ │ -185 // initialize pattern with row of A │ │ │ │ │ -186 for (ccoliterator j=(*i).begin(); j!=(*i).end(); ++j) │ │ │ │ │ -187 rowpattern[j.index()] = 0; │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22 │ │ │ │ │ +23#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ +24#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +25 │ │ │ │ │ +26namespace _D_u_n_e { │ │ │ │ │ +27 │ │ │ │ │ +40 // │ │ │ │ │ +41 // pretty printing of vectors │ │ │ │ │ +42 // │ │ │ │ │ +43 │ │ │ │ │ +51 template │ │ │ │ │ +_5_2 void _r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r (std::ostream& s, const V& v, std::string │ │ │ │ │ +rowtext, │ │ │ │ │ +53 int& counter, int columns, int width) │ │ │ │ │ +54 { │ │ │ │ │ +55 if constexpr (IsNumber()) │ │ │ │ │ +56 { │ │ │ │ │ +57 // Print one number │ │ │ │ │ +58 if (counter%columns==0) │ │ │ │ │ +59 { │ │ │ │ │ +60 s << rowtext; // start a new row │ │ │ │ │ +61 s << " "; // space in front of each entry │ │ │ │ │ +62 s.width(4); // set width for counter │ │ │ │ │ +63 s << counter; // number of first entry in a line │ │ │ │ │ +64 } │ │ │ │ │ +65 s << " "; // space in front of each entry │ │ │ │ │ +66 s.width(width); // set width for each entry anew │ │ │ │ │ +67 s << v; // yeah, the number ! │ │ │ │ │ +68 counter++; // increment the counter │ │ │ │ │ +69 if (counter%columns==0) │ │ │ │ │ +70 s << std::endl; // start a new line │ │ │ │ │ +71 } │ │ │ │ │ +72 else │ │ │ │ │ +73 { │ │ │ │ │ +74 // Recursively print a vector │ │ │ │ │ +75 for (const auto& entry : v) │ │ │ │ │ +76 _r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r(s,entry,rowtext,counter,columns,width); │ │ │ │ │ +77 } │ │ │ │ │ +78 } │ │ │ │ │ +79 │ │ │ │ │ +80 │ │ │ │ │ +88 template │ │ │ │ │ +_8_9 void _p_r_i_n_t_v_e_c_t_o_r (std::ostream& s, const V& v, std::string title, │ │ │ │ │ +90 std::string rowtext, int columns=1, int width=10, │ │ │ │ │ +91 int precision=2) │ │ │ │ │ +92 { │ │ │ │ │ +93 // count the numbers printed to make columns │ │ │ │ │ +94 int counter=0; │ │ │ │ │ +95 │ │ │ │ │ +96 // remember old flags │ │ │ │ │ +97 std::ios_base::fmtflags oldflags = s.flags(); │ │ │ │ │ +98 │ │ │ │ │ +99 // set the output format │ │ │ │ │ +100 s.setf(std::ios_base::scientific, std::ios_base::floatfield); │ │ │ │ │ +101 int oldprec = s.precision(); │ │ │ │ │ +102 s.precision(precision); │ │ │ │ │ +103 │ │ │ │ │ +104 // print title │ │ │ │ │ +105 s << title << " [blocks=" << v.N() << ",dimension=" << v.dim() << "]" │ │ │ │ │ +106 << std::endl; │ │ │ │ │ +107 │ │ │ │ │ +108 // print data from all blocks │ │ │ │ │ +109 _r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r(s,v,rowtext,counter,columns,width); │ │ │ │ │ +110 │ │ │ │ │ +111 // check if new line is required │ │ │ │ │ +112 if (counter%columns!=0) │ │ │ │ │ +113 s << std::endl; │ │ │ │ │ +114 │ │ │ │ │ +115 // reset the output format │ │ │ │ │ +116 s.flags(oldflags); │ │ │ │ │ +117 s.precision(oldprec); │ │ │ │ │ +118 } │ │ │ │ │ +119 │ │ │ │ │ +120 │ │ │ │ │ +122 // │ │ │ │ │ +123 // pretty printing of matrices │ │ │ │ │ +124 // │ │ │ │ │ +125 │ │ │ │ │ +_1_3_3 inline void _f_i_l_l___r_o_w (std::ostream& s, int m, int width, [[maybe_unused]] │ │ │ │ │ +int precision) │ │ │ │ │ +134 { │ │ │ │ │ +135 for (int j=0; j │ │ │ │ │ +_1_5_1 void _p_r_i_n_t___r_o_w (std::ostream& s, const K& value, │ │ │ │ │ +152 [[maybe_unused]] typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_>_:_:_s_i_z_e___t_y_p_e I, │ │ │ │ │ +153 [[maybe_unused]] typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_>_:_:_s_i_z_e___t_y_p_e J, │ │ │ │ │ +154 [[maybe_unused]] typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_>_:_:_s_i_z_e___t_y_p_e therow, │ │ │ │ │ +155 int width, │ │ │ │ │ +156 [[maybe_unused]] int precision, │ │ │ │ │ +157 typename std::enable_if_t::value>* sfinae = nullptr) │ │ │ │ │ +158 { │ │ │ │ │ +159 s << " "; // space in front of each entry │ │ │ │ │ +160 s.width(width); // set width for each entry anew │ │ │ │ │ +161 s << value; │ │ │ │ │ +162 } │ │ │ │ │ +163 │ │ │ │ │ +171 template │ │ │ │ │ +_1_7_2 void _p_r_i_n_t___r_o_w (std::ostream& s, const M& A, typename M::size_type I, │ │ │ │ │ +173 typename M::size_type J, typename M::size_type therow, │ │ │ │ │ +174 int width, int precision, │ │ │ │ │ +175 typename std::enable_if_t::value>* sfinae = nullptr) │ │ │ │ │ +176 { │ │ │ │ │ +177 typename M::size_type i0=I; │ │ │ │ │ +178 for (typename M::size_type i=0; i=i0 && therow_:_:_r_o_w_d_i_m(A,i)) │ │ │ │ │ +181 { │ │ │ │ │ +182 // the row is in this block row ! │ │ │ │ │ +183 typename M::size_type j0=J; │ │ │ │ │ +184 for (typename M::size_type j=0; j) rowpattern │ │ │ │ │ -[ILUij.index()]; │ │ │ │ │ -223 } │ │ │ │ │ +189 // print row or filler │ │ │ │ │ +190 if (it!=A[i].end()) │ │ │ │ │ +191 _p_r_i_n_t___r_o_w(s,*it,i0,j0,therow,width,precision); │ │ │ │ │ +192 else │ │ │ │ │ +193 _f_i_l_l___r_o_w(s,_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_c_o_l_d_i_m(A,j),width,precision); │ │ │ │ │ +194 │ │ │ │ │ +195 // advance columns │ │ │ │ │ +196 j0 += _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_c_o_l_d_i_m(A,j); │ │ │ │ │ +197 } │ │ │ │ │ +198 } │ │ │ │ │ +199 // advance rows │ │ │ │ │ +200 i0 += _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_r_o_w_d_i_m(A,i); │ │ │ │ │ +201 } │ │ │ │ │ +202 } │ │ │ │ │ +203 │ │ │ │ │ +212 template │ │ │ │ │ +_2_1_3 void _p_r_i_n_t_m_a_t_r_i_x (std::ostream& s, const M& A, std::string title, │ │ │ │ │ +214 std::string rowtext, int width=10, int precision=2) │ │ │ │ │ +215 { │ │ │ │ │ +216 │ │ │ │ │ +217 // remember old flags │ │ │ │ │ +218 std::ios_base::fmtflags oldflags = s.flags(); │ │ │ │ │ +219 │ │ │ │ │ +220 // set the output format │ │ │ │ │ +221 s.setf(std::ios_base::scientific, std::ios_base::floatfield); │ │ │ │ │ +222 int oldprec = s.precision(); │ │ │ │ │ +223 s.precision(precision); │ │ │ │ │ 224 │ │ │ │ │ -225 // copy entries of A │ │ │ │ │ -226 for (crowiterator i=A.begin(); i!=endi; ++i) │ │ │ │ │ -227 { │ │ │ │ │ -228 coliterator ILUij; │ │ │ │ │ -229 coliterator endILUij = ILU[i.index()].end();; │ │ │ │ │ -230 for (ILUij=ILU[i.index()].begin(); ILUij!=endILUij; ++ILUij) │ │ │ │ │ -231 (*ILUij) = 0; // clear row │ │ │ │ │ -232 ccoliterator Aij = (*i).begin(); │ │ │ │ │ -233 ccoliterator endAij = (*i).end(); │ │ │ │ │ -234 ILUij = ILU[i.index()].begin(); │ │ │ │ │ -235 while (Aij!=endAij && ILUij!=endILUij) │ │ │ │ │ -236 { │ │ │ │ │ -237 if (Aij.index()==ILUij.index()) │ │ │ │ │ -238 { │ │ │ │ │ -239 *ILUij = *Aij; │ │ │ │ │ -240 ++Aij; ++ILUij; │ │ │ │ │ -241 } │ │ │ │ │ -242 else │ │ │ │ │ -243 { │ │ │ │ │ -244 if (Aij.index()> │ │ │ │ │ -_2_5_8 struct _C_R_S │ │ │ │ │ -259 { │ │ │ │ │ -_2_6_0 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -_2_6_1 typedef size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -262 │ │ │ │ │ -_2_6_3 _C_R_S() : _n_R_o_w_s__( 0 ) {} │ │ │ │ │ -264 │ │ │ │ │ -_2_6_5 _s_i_z_e___t_y_p_e _r_o_w_s() const { return _n_R_o_w_s__; } │ │ │ │ │ -266 │ │ │ │ │ -_2_6_7 _s_i_z_e___t_y_p_e _n_o_n_Z_e_r_o_s() const │ │ │ │ │ -268 { │ │ │ │ │ -269 assert( _r_o_w_s__[ _r_o_w_s() ] != _s_i_z_e___t_y_p_e(-1) ); │ │ │ │ │ -270 return _r_o_w_s__[ _r_o_w_s() ]; │ │ │ │ │ -271 } │ │ │ │ │ -272 │ │ │ │ │ -_2_7_3 void _r_e_s_i_z_e( const _s_i_z_e___t_y_p_e nRows ) │ │ │ │ │ -274 { │ │ │ │ │ -275 if( _n_R_o_w_s__ != nRows ) │ │ │ │ │ -276 { │ │ │ │ │ -277 _n_R_o_w_s__ = nRows ; │ │ │ │ │ -278 _r_o_w_s__.resize( _n_R_o_w_s__+1, _s_i_z_e___t_y_p_e(-1) ); │ │ │ │ │ -279 } │ │ │ │ │ -280 } │ │ │ │ │ -281 │ │ │ │ │ -_2_8_2 void _r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l( const _s_i_z_e___t_y_p_e _n_o_n_Z_e_r_o_s ) │ │ │ │ │ -283 { │ │ │ │ │ -284 const _s_i_z_e___t_y_p_e needed = _v_a_l_u_e_s__.size() + _n_o_n_Z_e_r_o_s ; │ │ │ │ │ -285 if( _v_a_l_u_e_s__.capacity() < needed ) │ │ │ │ │ -286 { │ │ │ │ │ -287 const _s_i_z_e___t_y_p_e estimate = needed * 1.1; │ │ │ │ │ -288 _v_a_l_u_e_s__.reserve( estimate ); │ │ │ │ │ -289 _c_o_l_s__.reserve( estimate ); │ │ │ │ │ -290 } │ │ │ │ │ -291 } │ │ │ │ │ +225 // print title │ │ │ │ │ +226 s << title │ │ │ │ │ +227 << " [n=" << A._N() │ │ │ │ │ +228 << ",m=" << A._M() │ │ │ │ │ +229 << ",rowdim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_r_o_w_d_i_m(A) │ │ │ │ │ +230 << ",coldim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_c_o_l_d_i_m(A) │ │ │ │ │ +231 << "]" << std::endl; │ │ │ │ │ +232 │ │ │ │ │ +233 // print all rows │ │ │ │ │ +234 for (typename M::size_type i=0; i::rowdim(A); i++) │ │ │ │ │ +235 { │ │ │ │ │ +236 s << rowtext; // start a new row │ │ │ │ │ +237 s << " "; // space in front of each entry │ │ │ │ │ +238 s.width(4); // set width for counter │ │ │ │ │ +239 s << i; // number of first entry in a line │ │ │ │ │ +240 _p_r_i_n_t___r_o_w(s,A,0,0,i,width,precision); // generic print │ │ │ │ │ +241 s << std::endl; // start a new line │ │ │ │ │ +242 } │ │ │ │ │ +243 │ │ │ │ │ +244 // reset the output format │ │ │ │ │ +245 s.flags(oldflags); │ │ │ │ │ +246 s.precision(oldprec); │ │ │ │ │ +247 } │ │ │ │ │ +248 │ │ │ │ │ +270 template │ │ │ │ │ +_2_7_1 void _p_r_i_n_t_S_p_a_r_s_e_M_a_t_r_i_x(std::ostream& s, │ │ │ │ │ +272 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_B_,_n_,_m_>,A>& _m_a_t, │ │ │ │ │ +273 std::string title, std::string rowtext, │ │ │ │ │ +274 int width=3, int precision=2) │ │ │ │ │ +275 { │ │ │ │ │ +276 typedef _B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_B_,_n_,_m_>,A> _M_a_t_r_i_x; │ │ │ │ │ +277 // remember old flags │ │ │ │ │ +278 std::ios_base::fmtflags oldflags = s.flags(); │ │ │ │ │ +279 // set the output format │ │ │ │ │ +280 s.setf(std::ios_base::scientific, std::ios_base::floatfield); │ │ │ │ │ +281 int oldprec = s.precision(); │ │ │ │ │ +282 s.precision(precision); │ │ │ │ │ +283 // print title │ │ │ │ │ +284 s << title │ │ │ │ │ +285 << " [n=" << _m_a_t._N() │ │ │ │ │ +286 << ",m=" << _m_a_t._M() │ │ │ │ │ +287 << ",rowdim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t) │ │ │ │ │ +288 << ",coldim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t) │ │ │ │ │ +289 << "]" << std::endl; │ │ │ │ │ +290 │ │ │ │ │ +291 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r Row; │ │ │ │ │ 292 │ │ │ │ │ -_2_9_3 void _p_u_s_h___b_a_c_k( const _b_l_o_c_k___t_y_p_e& value, const _s_i_z_e___t_y_p_e index ) │ │ │ │ │ -294 { │ │ │ │ │ -295 _v_a_l_u_e_s__.push_back( value ); │ │ │ │ │ -296 _c_o_l_s__.push_back( index ); │ │ │ │ │ -297 } │ │ │ │ │ -298 │ │ │ │ │ -_2_9_9 std::vector< size_type > _r_o_w_s__; │ │ │ │ │ -_3_0_0 std::vector< block_type, Alloc> _v_a_l_u_e_s__; │ │ │ │ │ -_3_0_1 std::vector< size_type > _c_o_l_s__; │ │ │ │ │ -_3_0_2 _s_i_z_e___t_y_p_e _n_R_o_w_s__; │ │ │ │ │ -303 }; │ │ │ │ │ -304 │ │ │ │ │ -306 template │ │ │ │ │ -_3_0_7 void _c_o_n_v_e_r_t_T_o_C_R_S(const M& A, _C_R_S& lower, _C_R_S& upper, InvVector& inv ) │ │ │ │ │ -308 { │ │ │ │ │ -309 typedef typename M :: size_type size_type; │ │ │ │ │ -310 │ │ │ │ │ -311 lower._r_e_s_i_z_e( A.N() ); │ │ │ │ │ -312 upper._r_e_s_i_z_e( A.N() ); │ │ │ │ │ -313 inv.resize( A.N() ); │ │ │ │ │ -314 │ │ │ │ │ -315 // lower and upper triangular should store half of non zeros minus diagonal │ │ │ │ │ -316 const size_t memEstimate = (A.nonzeroes() - A.N())/2; │ │ │ │ │ -317 │ │ │ │ │ -318 assert( A.nonzeroes() != 0 ); │ │ │ │ │ -319 lower._r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l( memEstimate ); │ │ │ │ │ -320 upper._r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l( memEstimate ); │ │ │ │ │ -321 │ │ │ │ │ -322 const auto endi = A.end(); │ │ │ │ │ -323 size_type row = 0; │ │ │ │ │ -324 size_type colcount = 0; │ │ │ │ │ -325 lower._r_o_w_s__[ 0 ] = colcount; │ │ │ │ │ -326 for (auto i=A.begin(); i!=endi; ++i, ++row) │ │ │ │ │ -327 { │ │ │ │ │ -328 const size_type iIndex = i.index(); │ │ │ │ │ -329 │ │ │ │ │ -330 // store entries left of diagonal │ │ │ │ │ -331 for (auto j=(*i).begin(); j.index() < iIndex; ++j ) │ │ │ │ │ -332 { │ │ │ │ │ -333 lower._p_u_s_h___b_a_c_k( (*j), j.index() ); │ │ │ │ │ -334 ++colcount; │ │ │ │ │ +293 for(Row row=_m_a_t._b_e_g_i_n(); row != _m_a_t._e_n_d(); ++row) { │ │ │ │ │ +294 int skipcols=0; │ │ │ │ │ +295 bool reachedEnd=false; │ │ │ │ │ +296 │ │ │ │ │ +297 while(!reachedEnd) { │ │ │ │ │ +298 for(int innerrow=0; innerrowbegin(); │ │ │ │ │ +302 for(; _c_o_l != row->end(); ++_c_o_l,++count) { │ │ │ │ │ +303 if(count=skipcols+width) │ │ │ │ │ +306 break; │ │ │ │ │ +307 if(innerrow==0) { │ │ │ │ │ +308 if(count==skipcols) { │ │ │ │ │ +309 s << rowtext; // start a new row │ │ │ │ │ +310 s << " "; // space in front of each entry │ │ │ │ │ +311 s.width(4); // set width for counter │ │ │ │ │ +312 s << row.index()<<": "; // number of first entry in a line │ │ │ │ │ +313 } │ │ │ │ │ +314 s.width(4); │ │ │ │ │ +315 s<<_c_o_l.index()<<": |"; │ │ │ │ │ +316 } else { │ │ │ │ │ +317 if(count==skipcols) { │ │ │ │ │ +318 for(typename std::string::size_type i=0; i < rowtext.length(); i++) │ │ │ │ │ +319 s<<" "; │ │ │ │ │ +320 s<<" "; │ │ │ │ │ +321 } │ │ │ │ │ +322 s<<" |"; │ │ │ │ │ +323 } │ │ │ │ │ +324 for(int innercol=0; innercol < m; ++innercol) { │ │ │ │ │ +325 s.width(9); │ │ │ │ │ +326 s<<(*col)[innerrow][innercol]<<" "; │ │ │ │ │ +327 } │ │ │ │ │ +328 │ │ │ │ │ +329 s<<"|"; │ │ │ │ │ +330 } │ │ │ │ │ +331 if(innerrow==n-1 && _c_o_l==row->end()) │ │ │ │ │ +332 reachedEnd = true; │ │ │ │ │ +333 else │ │ │ │ │ +334 s << std::endl; │ │ │ │ │ 335 } │ │ │ │ │ -336 lower._r_o_w_s__[ iIndex+1 ] = colcount; │ │ │ │ │ -337 } │ │ │ │ │ -338 │ │ │ │ │ -339 const auto rendi = A.beforeBegin(); │ │ │ │ │ -340 row = 0; │ │ │ │ │ -341 colcount = 0; │ │ │ │ │ -342 upper._r_o_w_s__[ 0 ] = colcount ; │ │ │ │ │ -343 │ │ │ │ │ -344 // NOTE: upper and inv store entries in reverse row and col order, │ │ │ │ │ -345 // reverse here relative to ILU │ │ │ │ │ -346 for (auto i=A.beforeEnd(); i!=rendi; --i, ++ row ) │ │ │ │ │ -347 { │ │ │ │ │ -348 const auto endij=(*i).beforeBegin(); // end of row i │ │ │ │ │ -349 │ │ │ │ │ -350 const size_type iIndex = i.index(); │ │ │ │ │ -351 │ │ │ │ │ -352 // store in reverse row order for faster access during backsolve │ │ │ │ │ -353 for (auto j=(*i).beforeEnd(); j != endij; --j ) │ │ │ │ │ -354 { │ │ │ │ │ -355 const size_type jIndex = j.index(); │ │ │ │ │ -356 if( j.index() == iIndex ) │ │ │ │ │ -357 { │ │ │ │ │ -358 inv[ row ] = (*j); │ │ │ │ │ -359 break; // assuming consecutive ordering of A │ │ │ │ │ -360 } │ │ │ │ │ -361 else if ( j.index() >= i.index() ) │ │ │ │ │ +336 skipcols += width; │ │ │ │ │ +337 s << std::endl; │ │ │ │ │ +338 } │ │ │ │ │ +339 s << std::endl; │ │ │ │ │ +340 } │ │ │ │ │ +341 │ │ │ │ │ +342 // reset the output format │ │ │ │ │ +343 s.flags(oldflags); │ │ │ │ │ +344 s.precision(oldprec); │ │ │ │ │ +345 } │ │ │ │ │ +346 │ │ │ │ │ +347 namespace │ │ │ │ │ +348 { │ │ │ │ │ +349 template │ │ │ │ │ +350 struct MatlabPODWriter │ │ │ │ │ +351 { │ │ │ │ │ +352 static std::ostream& write(const T& t, std::ostream& s) │ │ │ │ │ +353 { │ │ │ │ │ +354 s << t; │ │ │ │ │ +355 return s; │ │ │ │ │ +356 } │ │ │ │ │ +357 }; │ │ │ │ │ +358 template │ │ │ │ │ +359 struct MatlabPODWriter<_s_t_d::complex > │ │ │ │ │ +360 { │ │ │ │ │ +361 static std::ostream& write(const std::complex& t, std::ostream& s) │ │ │ │ │ 362 { │ │ │ │ │ -363 upper._p_u_s_h___b_a_c_k( (*j), jIndex ); │ │ │ │ │ -364 ++colcount ; │ │ │ │ │ +363 s << t.real() << " " << t.imag(); │ │ │ │ │ +364 return s; │ │ │ │ │ 365 } │ │ │ │ │ -366 } │ │ │ │ │ -367 upper._r_o_w_s__[ row+1 ] = colcount; │ │ │ │ │ -368 } │ │ │ │ │ -369 } // end convertToCRS │ │ │ │ │ -370 │ │ │ │ │ -372 template │ │ │ │ │ -_3_7_3 void _b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e (const _C_R_S& lower, │ │ │ │ │ -374 const _C_R_S& upper, │ │ │ │ │ -375 const InvVector& inv, │ │ │ │ │ -376 X& v, const Y& d) │ │ │ │ │ -377 { │ │ │ │ │ -378 // iterator types │ │ │ │ │ -379 typedef typename Y :: block_type dblock; │ │ │ │ │ -380 typedef typename X :: block_type vblock; │ │ │ │ │ -381 typedef typename X :: size_type size_type ; │ │ │ │ │ -382 │ │ │ │ │ -383 const size_type iEnd = lower._r_o_w_s(); │ │ │ │ │ -384 const size_type lastRow = iEnd - 1; │ │ │ │ │ -385 if( iEnd != upper._r_o_w_s() ) │ │ │ │ │ -386 { │ │ │ │ │ -387 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"ILU::blockILUBacksolve: lower and upper rows must be │ │ │ │ │ -the same"); │ │ │ │ │ -388 } │ │ │ │ │ -389 │ │ │ │ │ -390 // lower triangular solve │ │ │ │ │ -391 for( size_type i=0; i │ │ │ │ │ +_3_7_9 void _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r(const FieldType& value, │ │ │ │ │ +380 int rowOffset, int colOffset, │ │ │ │ │ +381 std::ostream& s, │ │ │ │ │ +382 typename std::enable_if_t::value>* sfinae = │ │ │ │ │ +nullptr) │ │ │ │ │ +383 { │ │ │ │ │ +384 //+1 for Matlab numbering │ │ │ │ │ +385 s << rowOffset + 1 << " " << colOffset + 1 << " "; │ │ │ │ │ +386 MatlabPODWriter::write(value, s)<< std::endl; │ │ │ │ │ +387 } │ │ │ │ │ +388 │ │ │ │ │ +396 template │ │ │ │ │ +_3_9_7 void _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r(const MatrixType& matrix, │ │ │ │ │ +398 int externalRowOffset, int externalColOffset, │ │ │ │ │ +399 std::ostream& s, │ │ │ │ │ +400 typename std::enable_if_t::value>* sfinae = │ │ │ │ │ +nullptr) │ │ │ │ │ +401 { │ │ │ │ │ +402 // Precompute the accumulated sizes of the columns │ │ │ │ │ +403 std::vector colOffset(matrix.M()); │ │ │ │ │ +404 if (colOffset.size() > 0) │ │ │ │ │ +405 colOffset[0] = 0; │ │ │ │ │ +406 │ │ │ │ │ +407 for (typename MatrixType::size_type i=0; i_:_:_c_o_l_d_i_m(matrix,i); │ │ │ │ │ +410 │ │ │ │ │ +411 typename MatrixType::size_type rowOffset = 0; │ │ │ │ │ 412 │ │ │ │ │ -413 for( size_type _c_o_l = rowI; _c_o_l < rowINext; ++ _c_o_l ) │ │ │ │ │ -414 Impl::asMatrix(upper._v_a_l_u_e_s__[ _c_o_l ]).mmv( Impl::asVector(v[ upper._c_o_l_s__ │ │ │ │ │ -[ _c_o_l ] ]), rhs ); │ │ │ │ │ -415 │ │ │ │ │ -416 // apply inverse and store result │ │ │ │ │ -417 Impl::asMatrix(inv[ i ]).mv(rhs, vBlock); │ │ │ │ │ -418 } │ │ │ │ │ -419 } │ │ │ │ │ -420 │ │ │ │ │ -421 } // end namespace ILU │ │ │ │ │ -422 │ │ │ │ │ -425} // end namespace │ │ │ │ │ -426 │ │ │ │ │ -427#endif │ │ │ │ │ +413 // Loop over all matrix rows │ │ │ │ │ +414 for (typename MatrixType::size_type rowIdx=0; rowIdx_:_:_r_o_w_d_i_m(matrix, rowIdx); │ │ │ │ │ +427 } │ │ │ │ │ +428 │ │ │ │ │ +429 } │ │ │ │ │ +430 │ │ │ │ │ +450 template │ │ │ │ │ +_4_5_1 void _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b(const MatrixType& matrix, │ │ │ │ │ +452 const std::string& filename, int outputPrecision = 18) │ │ │ │ │ +453 { │ │ │ │ │ +454 std::ofstream outStream(filename.c_str()); │ │ │ │ │ +455 int oldPrecision = outStream.precision(); │ │ │ │ │ +456 outStream.precision(outputPrecision); │ │ │ │ │ +457 │ │ │ │ │ +458 _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r(matrix, 0, 0, outStream); │ │ │ │ │ +459 outStream.precision(oldPrecision); │ │ │ │ │ +460 } │ │ │ │ │ +461 │ │ │ │ │ +462 // Recursively write vector entries to a stream │ │ │ │ │ +463 template │ │ │ │ │ +_4_6_4 void _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const V& v, std::ostream& stream) │ │ │ │ │ +465 { │ │ │ │ │ +466 if constexpr (IsNumber()) { │ │ │ │ │ +467 stream << v << std::endl; │ │ │ │ │ +468 } else { │ │ │ │ │ +469 for (const auto& entry : v) │ │ │ │ │ +470 _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r(entry, stream); │ │ │ │ │ +471 } │ │ │ │ │ +472 } │ │ │ │ │ +473 │ │ │ │ │ +491 template │ │ │ │ │ +_4_9_2 void _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b(const VectorType& vector, │ │ │ │ │ +493 const std::string& filename, int outputPrecision = 18) │ │ │ │ │ +494 { │ │ │ │ │ +495 std::ofstream outStream(filename.c_str()); │ │ │ │ │ +496 int oldPrecision = outStream.precision(); │ │ │ │ │ +497 outStream.precision(outputPrecision); │ │ │ │ │ +498 │ │ │ │ │ +499 _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r(vector, outStream); │ │ │ │ │ +500 outStream.precision(oldPrecision); │ │ │ │ │ +501 } │ │ │ │ │ +502 │ │ │ │ │ +503 namespace Impl { │ │ │ │ │ +504 │ │ │ │ │ +506 struct NullStream { │ │ │ │ │ +507 template │ │ │ │ │ +508 friend NullStream &operator<<(NullStream &dev0, Any &&) { │ │ │ │ │ +509 return dev0; │ │ │ │ │ +510 } │ │ │ │ │ +511 }; │ │ │ │ │ +512 │ │ │ │ │ +514 // svg shall be closed with a group and an svg. i.e. "" │ │ │ │ │ +515 template │ │ │ │ │ +516 void writeSVGMatrixHeader(Stream &out, const SVGMatrixOptions &opts, │ │ │ │ │ +517 std::pair offsets) { │ │ │ │ │ +518 auto [col_offset, row_offset] = offsets; │ │ │ │ │ +519 double width = opts.width; │ │ │ │ │ +520 double height = opts.height; │ │ │ │ │ +521 // if empty, we try to figure out a sensible value of width and height │ │ │ │ │ +522 if (opts.width == 0 and opts.height == 0) │ │ │ │ │ +523 width = height = 500; │ │ │ │ │ +524 if (opts.width == 0) │ │ │ │ │ +525 width = opts.height * (double(col_offset) / row_offset); │ │ │ │ │ +526 if (opts.height == 0) │ │ │ │ │ +527 height = opts.width * (double(row_offset) / col_offset); │ │ │ │ │ +528 │ │ │ │ │ +529 // scale group w.r.t final offsets │ │ │ │ │ +530 double scale_width = width / col_offset; │ │ │ │ │ +531 double scale_height = height / row_offset; │ │ │ │ │ +532 │ │ │ │ │ +533 // write the header text │ │ │ │ │ +534 out << "\n" │ │ │ │ │ +536 << "\n" │ │ │ │ │ +538 << "\n"; │ │ │ │ │ +540 } │ │ │ │ │ +541 │ │ │ │ │ +543 template │ │ │ │ │ +545 std::pair │ │ │ │ │ +546 writeSVGMatrix(const Mat &_m_a_t, Stream &out, SVGMatrixOptions opts, │ │ │ │ │ +547 RowPrefix row_prefix, ColPrefix col_prefix) { │ │ │ │ │ +548 // get values to fill the offests │ │ │ │ │ +549 const auto& block_size = opts.block_size; │ │ │ │ │ +550 const auto& interspace = opts.interspace; │ │ │ │ │ +551 │ │ │ │ │ +552 const std::size_t rows = _m_a_t.N(); │ │ │ │ │ +553 const std::size_t cols = _m_a_t.M(); │ │ │ │ │ +554 │ │ │ │ │ +555 // disable header write for recursive calls │ │ │ │ │ +556 const bool write_header = opts.write_header; │ │ │ │ │ +557 opts.write_header = false; │ │ │ │ │ +558 │ │ │ │ │ +559 // counter of offsets for every block │ │ │ │ │ +560 std::size_t row_offset = interspace; │ │ │ │ │ +561 std::size_t col_offset = interspace; │ │ │ │ │ +562 │ │ │ │ │ +563 // lambda helper: for-each value │ │ │ │ │ +564 auto for_each_entry = [&_m_a_t](const auto &call_back) { │ │ │ │ │ +565 for (auto row_it = _m_a_t.begin(); row_it != _m_a_t.end(); ++row_it) { │ │ │ │ │ +566 for (auto col_it = row_it->begin(); col_it != row_it->end(); ++col_it) { │ │ │ │ │ +567 call_back(row_it.index(), col_it.index(), *col_it); │ │ │ │ │ +568 } │ │ │ │ │ +569 } │ │ │ │ │ +570 }; │ │ │ │ │ +571 │ │ │ │ │ +572 // accumulate content in another stream so that we write in correct order │ │ │ │ │ +573 std::stringstream ss; │ │ │ │ │ +574 │ │ │ │ │ +575 // we need to append current row and col values to the prefixes │ │ │ │ │ +576 row_prefix.push_back(0); │ │ │ │ │ +577 col_prefix.push_back(0); │ │ │ │ │ +578 │ │ │ │ │ +579 // do we need to write nested matrix blocks? │ │ │ │ │ +580 if constexpr (Dune::blockLevel() == 0) { │ │ │ │ │ +581 // simple case: write svg block content to stream for each value │ │ │ │ │ +582 for_each_entry([&](const auto &row, const auto &_c_o_l, const auto &val) { │ │ │ │ │ +583 std::size_t x_off = interspace + _c_o_l * (interspace + block_size); │ │ │ │ │ +584 std::size_t y_off = interspace + row * (interspace + block_size); │ │ │ │ │ +585 row_prefix.back() = row; │ │ │ │ │ +586 col_prefix.back() = _c_o_l; │ │ │ │ │ +587 opts.writeSVGBlock(ss, row_prefix, col_prefix, val, │ │ │ │ │ +588 {x_off, y_off, block_size, block_size}); │ │ │ │ │ +589 }); │ │ │ │ │ +590 col_offset += cols * (block_size + interspace); │ │ │ │ │ +591 row_offset += rows * (block_size + interspace); │ │ │ │ │ +592 } else { │ │ │ │ │ +593 // before we write anything, we need to calculate the │ │ │ │ │ +594 // offset for every {row,col} index │ │ │ │ │ +595 const auto null_offset = std::numeric_limits::max(); │ │ │ │ │ +596 std::vector col_offsets(cols + 1, null_offset); │ │ │ │ │ +597 std::vector row_offsets(rows + 1, null_offset); │ │ │ │ │ +598 for_each_entry([&](const auto &row, const auto &_c_o_l, const auto &val) { │ │ │ │ │ +599 NullStream dev0; │ │ │ │ │ +600 // get size of sub-block │ │ │ │ │ +601 auto sub_size = │ │ │ │ │ +602 writeSVGMatrix(val, dev0, opts, row_prefix, col_prefix); │ │ │ │ │ +603 │ │ │ │ │ +604 // if we didn't see col size before │ │ │ │ │ +605 if (col_offsets[_c_o_l + 1] == null_offset) // write it in the offset vector │ │ │ │ │ +606 col_offsets[_c_o_l + 1] = sub_size.first; │ │ │ │ │ +607 │ │ │ │ │ +608 // repeat proces for row sizes │ │ │ │ │ +609 if (row_offsets[row + 1] == null_offset) │ │ │ │ │ +610 row_offsets[row + 1] = sub_size.second; │ │ │ │ │ +611 }); │ │ │ │ │ +612 │ │ │ │ │ +613 // if some rows/cols were not visited, make an educated guess with the │ │ │ │ │ +minimum offset │ │ │ │ │ +614 auto min_row_offset = *std::min_element(begin(row_offsets), end │ │ │ │ │ +(row_offsets)); │ │ │ │ │ +615 std::replace(begin(row_offsets), end(row_offsets), null_offset, │ │ │ │ │ +min_row_offset); │ │ │ │ │ +616 auto min_col_offset = *std::min_element(begin(col_offsets), end │ │ │ │ │ +(col_offsets)); │ │ │ │ │ +617 std::replace(begin(col_offsets), end(col_offsets), null_offset, │ │ │ │ │ +min_col_offset); │ │ │ │ │ +618 │ │ │ │ │ +619 // we have sizes for every block: to get offsets we make a partial sum │ │ │ │ │ +620 col_offsets[0] = interspace; │ │ │ │ │ +621 row_offsets[0] = interspace; │ │ │ │ │ +622 for (std::size_t i = 1; i < col_offsets.size(); i++) │ │ │ │ │ +623 col_offsets[i] += col_offsets[i - 1] + interspace; │ │ │ │ │ +624 for (std::size_t i = 1; i < row_offsets.size(); i++) │ │ │ │ │ +625 row_offsets[i] += row_offsets[i - 1] + interspace; │ │ │ │ │ +626 │ │ │ │ │ +627 for_each_entry([&](const auto &row, const auto &_c_o_l, const auto &val) { │ │ │ │ │ +628 // calculate svg view from offsets │ │ │ │ │ +629 std::size_t width = │ │ │ │ │ +630 col_offsets[_c_o_l + 1] - col_offsets[_c_o_l] - interspace; │ │ │ │ │ +631 std::size_t height = │ │ │ │ │ +632 row_offsets[row + 1] - row_offsets[row] - interspace; │ │ │ │ │ +633 row_prefix.back() = row; │ │ │ │ │ +634 col_prefix.back() = _c_o_l; │ │ │ │ │ +635 // content of the sub-block has origin at {0,0}: shift it to the correct │ │ │ │ │ +place │ │ │ │ │ +636 ss << "\n"; │ │ │ │ │ +638 // write a nested svg with the contents of the sub-block │ │ │ │ │ +639 writeSVGMatrix(val, ss, opts, row_prefix, col_prefix); │ │ │ │ │ +640 ss << "\n"; │ │ │ │ │ +641 }); │ │ │ │ │ +642 col_offset = col_offsets.back(); │ │ │ │ │ +643 row_offset = row_offsets.back(); │ │ │ │ │ +644 } │ │ │ │ │ +645 │ │ │ │ │ +646 // write content in order! │ │ │ │ │ +647 // (i) if required, first header │ │ │ │ │ +648 if (write_header) │ │ │ │ │ +649 writeSVGMatrixHeader(out, opts, {col_offset, row_offset}); │ │ │ │ │ +650 │ │ │ │ │ +651 col_prefix.pop_back(); │ │ │ │ │ +652 row_prefix.pop_back(); │ │ │ │ │ +653 // (ii) an svg block for this level │ │ │ │ │ +654 opts.writeSVGBlock(out, row_prefix, col_prefix, _m_a_t, │ │ │ │ │ +655 {0, 0, col_offset, row_offset}); │ │ │ │ │ +656 // (iii) the content of the matrix │ │ │ │ │ +657 out << ss.str(); │ │ │ │ │ +658 // (iv) if required, close the header │ │ │ │ │ +659 if (write_header) │ │ │ │ │ +660 out << "\n\n"; │ │ │ │ │ +661 │ │ │ │ │ +662 // return the total required for this block │ │ │ │ │ +663 return {col_offset, row_offset}; │ │ │ │ │ +664 } │ │ │ │ │ +665 } // namespace Impl │ │ │ │ │ +666 │ │ │ │ │ +667 │ │ │ │ │ +_6_7_4 struct _D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s { │ │ │ │ │ +_6_7_6 std::size_t _b_l_o_c_k___s_i_z_e = 10; │ │ │ │ │ +_6_7_8 std::size_t _i_n_t_e_r_s_p_a_c_e = 5; │ │ │ │ │ +_6_8_0 std::size_t _w_i_d_t_h = 500; │ │ │ │ │ +_6_8_2 std::size_t _h_e_i_g_h_t = 0; │ │ │ │ │ +_6_8_4 bool _w_r_i_t_e___h_e_a_d_e_r = true; │ │ │ │ │ +_6_8_6 std::string _s_t_y_l_e = " .matrix-block {\n" │ │ │ │ │ +687 " fill: cornflowerblue;\n" │ │ │ │ │ +688 " fill-opacity: 0.4;\n" │ │ │ │ │ +689 " stroke-width: 2;\n" │ │ │ │ │ +690 " stroke: black;\n" │ │ │ │ │ +691 " stroke-opacity: 0.5;\n" │ │ │ │ │ +692 " }\n" │ │ │ │ │ +693 " .matrix-block:hover {\n" │ │ │ │ │ +694 " fill: lightcoral;\n" │ │ │ │ │ +695 " fill-opacity: 0.4;\n" │ │ │ │ │ +696 " stroke-opacity: 1;\n" │ │ │ │ │ +697 " }\n"; │ │ │ │ │ +698 │ │ │ │ │ +_7_1_0 std::function _c_o_l_o_r___f_i_l_l; │ │ │ │ │ +711 │ │ │ │ │ +717 template │ │ │ │ │ +_7_1_8 std::string _b_l_o_c_k_S_t_y_l_e_C_l_a_s_s(const RowPrefix &row_prefix, │ │ │ │ │ +719 const ColPrefix &col_prefix) const { │ │ │ │ │ +720 // here, you can potentially give a different style to each block │ │ │ │ │ +721 return "matrix-block"; │ │ │ │ │ +722 } │ │ │ │ │ +723 │ │ │ │ │ +_7_2_5 bool _w_r_i_t_e___b_l_o_c_k___t_i_t_l_e = true; │ │ │ │ │ +726 │ │ │ │ │ +732 template │ │ │ │ │ +_7_3_3 void _w_r_i_t_e_B_l_o_c_k_T_i_t_l_e(Stream& out, const RowPrefix &row_prefix, │ │ │ │ │ +734 const ColPrefix &col_prefix, │ │ │ │ │ +735 const Block &block) const { │ │ │ │ │ +736 if (this->write_block_title) { │ │ │ │ │ +737 out << ""; │ │ │ │ │ +738 assert(row_prefix.size() == col_prefix.size()); │ │ │ │ │ +739 for (std::size_t i = 0; i < row_prefix.size(); ++i) │ │ │ │ │ +740 out << "[" << row_prefix[i] << ", "<< col_prefix[i] << "]"; │ │ │ │ │ +741 if constexpr (Dune::blockLevel<Block>() == 0) │ │ │ │ │ +742 out << ": " << block; │ │ │ │ │ +743 out << "\n"; │ │ │ │ │ +744 } │ │ │ │ │ +745 } │ │ │ │ │ +746 │ │ │ │ │ +768 template │ │ │ │ │ +_7_6_9 void _w_r_i_t_e_S_V_G_B_l_o_c_k(Stream &out, │ │ │ │ │ +770 const RowPrefix &row_prefix, │ │ │ │ │ +771 const ColPrefix &col_prefix, const Block block, │ │ │ │ │ +772 const std::array &svg_box) const { │ │ │ │ │ +773 // get bounding box values │ │ │ │ │ +774 auto &[x_off, y_off, _w_i_d_t_h, _h_e_i_g_h_t] = svg_box; │ │ │ │ │ +775 // get style class │ │ │ │ │ +776 std::string block_class = this->_b_l_o_c_k_S_t_y_l_e_C_l_a_s_s(row_prefix, col_prefix); │ │ │ │ │ +777 // write a rectangle on the bounding box │ │ │ │ │ +778 out << "() == 0 and std:: │ │ │ │ │ +is_convertible{}) │ │ │ │ │ +781 if (_c_o_l_o_r___f_i_l_l) │ │ │ │ │ +782 out << " style='fill-opacity: 1;fill:" << _c_o_l_o_r___f_i_l_l(double(block)) << "'"; │ │ │ │ │ +783 │ │ │ │ │ +784 out << ">\n"; │ │ │ │ │ +785 // give the rectangle a title (in html this shows info about the block) │ │ │ │ │ +786 this->_w_r_i_t_e_B_l_o_c_k_T_i_t_l_e(out,row_prefix, col_prefix, block); │ │ │ │ │ +787 // close rectangle │ │ │ │ │ +788 out << "\n"; │ │ │ │ │ +789 } │ │ │ │ │ +790 }; │ │ │ │ │ +791 │ │ │ │ │ +806 template │ │ │ │ │ +_8_0_7 void _w_r_i_t_e_S_V_G_M_a_t_r_i_x(const Mat &_m_a_t, std::ostream &out, │ │ │ │ │ +808 SVGOptions opts = {}) { │ │ │ │ │ +809 // We need a vector that can fit all the multi-indices for rows and colums │ │ │ │ │ +810 using IndexPrefix = Dune::ReservedVector()>; │ │ │ │ │ +811 // Call overload for Mat type │ │ │ │ │ +812 Impl::writeSVGMatrix(_m_a_t, out, opts, IndexPrefix{}, IndexPrefix{}); │ │ │ │ │ +813 } │ │ │ │ │ +814 │ │ │ │ │ +817} // namespace Dune │ │ │ │ │ +818 │ │ │ │ │ +819#endif │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ +_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 │ │ │ │ │ _c_o_l │ │ │ │ │ Col col │ │ │ │ │ DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_D_u_n_e_:_:_w_r_i_t_e_S_V_G_M_a_t_r_i_x │ │ │ │ │ +void writeSVGMatrix(const Mat &mat, std::ostream &out, SVGOptions opts={}) │ │ │ │ │ +Writes the visualization of matrix in the SVG format. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:807 │ │ │ │ │ +_D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b │ │ │ │ │ +void writeMatrixToMatlab(const MatrixType &matrix, const std::string &filename, │ │ │ │ │ +int outputPrecision=18) │ │ │ │ │ +Writes sparse matrix in a Matlab-readable format. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:451 │ │ │ │ │ +_D_u_n_e_:_:_p_r_i_n_t___r_o_w │ │ │ │ │ +void print_row(std::ostream &s, const K &value, typename FieldMatrix< K, 1, 1 │ │ │ │ │ +>::size_type I, typename FieldMatrix< K, 1, 1 >::size_type J, typename │ │ │ │ │ +FieldMatrix< K, 1, 1 >::size_type therow, int width, int precision, typename │ │ │ │ │ +std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr) │ │ │ │ │ +Print one row of a matrix, specialization for number types. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_p_r_i_n_t_m_a_t_r_i_x │ │ │ │ │ +void printmatrix(std::ostream &s, const M &A, std::string title, std::string │ │ │ │ │ +rowtext, int width=10, int precision=2) │ │ │ │ │ +Print a generic block matrix. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:213 │ │ │ │ │ +_D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ +void printvector(std::ostream &s, const V &v, std::string title, std::string │ │ │ │ │ +rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ +Print an ISTL vector. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r │ │ │ │ │ +void writeMatrixToMatlabHelper(const FieldType &value, int rowOffset, int │ │ │ │ │ +colOffset, std::ostream &s, typename std::enable_if_t< Dune::IsNumber< │ │ │ │ │ +FieldType >::value > *sfinae=nullptr) │ │ │ │ │ +Helper method for the writeMatrixToMatlab routine. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:379 │ │ │ │ │ +_D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r │ │ │ │ │ +void writeVectorToMatlabHelper(const V &v, std::ostream &stream) │ │ │ │ │ +DDeeffiinniittiioonn io.hh:464 │ │ │ │ │ +_D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b │ │ │ │ │ +void writeVectorToMatlab(const VectorType &vector, const std::string &filename, │ │ │ │ │ +int outputPrecision=18) │ │ │ │ │ +Writes vectors in a Matlab-readable format. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:492 │ │ │ │ │ +_D_u_n_e_:_:_r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ +void recursive_printvector(std::ostream &s, const V &v, std::string rowtext, │ │ │ │ │ +int &counter, int columns, int width) │ │ │ │ │ +Recursively print a vector. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_p_r_i_n_t_S_p_a_r_s_e_M_a_t_r_i_x │ │ │ │ │ +void printSparseMatrix(std::ostream &s, const BCRSMatrix< FieldMatrix< B, n, m │ │ │ │ │ +>, A > &mat, std::string title, std::string rowtext, int width=3, int │ │ │ │ │ +precision=2) │ │ │ │ │ +Prints a BCRSMatrix with fixed sized blocks. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_f_i_l_l___r_o_w │ │ │ │ │ +void fill_row(std::ostream &s, int m, int width, int precision) │ │ │ │ │ +Print a row of zeros for a non-existing block. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:133 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S │ │ │ │ │ -void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv) │ │ │ │ │ -convert ILU decomposition into CRS format for lower and upper triangular and │ │ │ │ │ -inverse. │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:307 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ │ -void blockILUBacksolve(const M &A, X &v, const Y &d) │ │ │ │ │ -LU backsolve with stored inverse. │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_f_i_r_s_t_M_a_t_r_i_x_E_l_e_m_e_n_t │ │ │ │ │ -M::field_type & firstMatrixElement(M &A, typename std::enable_if_t::value > *sfinae=nullptr) │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ -void blockILU0Decomposition(M &A) │ │ │ │ │ -compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ -void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S │ │ │ │ │ -a simple compressed row storage matrix class │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_c_o_l_s__ │ │ │ │ │ -std::vector< size_type > cols_ │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:301 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_n_o_n_Z_e_r_o_s │ │ │ │ │ -size_type nonZeros() const │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_e_s_i_z_e │ │ │ │ │ -void resize(const size_type nRows) │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:273 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_o_w_s │ │ │ │ │ -size_type rows() const │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_C_R_S │ │ │ │ │ -CRS() │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_e_s_e_r_v_e_A_d_d_i_t_i_o_n_a_l │ │ │ │ │ -void reserveAdditional(const size_type nonZeros) │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -B block_type │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:260 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_v_a_l_u_e_s__ │ │ │ │ │ -std::vector< block_type, Alloc > values_ │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_n_R_o_w_s__ │ │ │ │ │ -size_type nRows_ │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:302 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -size_t size_type │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_r_o_w_s__ │ │ │ │ │ -std::vector< size_type > rows_ │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:299 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S_:_:_p_u_s_h___b_a_c_k │ │ │ │ │ -void push_back(const block_type &value, const size_type index) │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ -derive error class from the base class in common │ │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_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_D_i_m_e_n_s_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_c_o_l_d_i_m │ │ │ │ │ +static auto coldim(const M &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_r_o_w_d_i_m │ │ │ │ │ +static auto rowdim(const M &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:214 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s │ │ │ │ │ +Default options class to write SVG matrices. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:674 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_s_t_y_l_e │ │ │ │ │ +std::string style │ │ │ │ │ +CSS style block to write in header. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:686 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_i_d_t_h │ │ │ │ │ +std::size_t width │ │ │ │ │ +Final width size (pixels) of the SVG header. If 0, size is automatic. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:680 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_c_o_l_o_r___f_i_l_l │ │ │ │ │ +std::function< std::string(const double &)> color_fill │ │ │ │ │ +Color fill for default options. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:710 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_b_l_o_c_k___s_i_z_e │ │ │ │ │ +std::size_t block_size │ │ │ │ │ +size (pixels) of the deepst block/value of the matrix │ │ │ │ │ +DDeeffiinniittiioonn io.hh:676 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e_S_V_G_B_l_o_c_k │ │ │ │ │ +void writeSVGBlock(Stream &out, const RowPrefix &row_prefix, const ColPrefix │ │ │ │ │ +&col_prefix, const Block block, const std::array< std::size_t, 4 > &svg_box) │ │ │ │ │ +const │ │ │ │ │ +Write an SVG object for a given block/value in the matrix. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:769 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e_B_l_o_c_k_T_i_t_l_e │ │ │ │ │ +void writeBlockTitle(Stream &out, const RowPrefix &row_prefix, const ColPrefix │ │ │ │ │ +&col_prefix, const Block &block) const │ │ │ │ │ +Helper function writes a title for a given block and prefix. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:733 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_i_n_t_e_r_s_p_a_c_e │ │ │ │ │ +std::size_t interspace │ │ │ │ │ +size (pixels) of the interspace between blocks │ │ │ │ │ +DDeeffiinniittiioonn io.hh:678 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e___b_l_o_c_k___t_i_t_l_e │ │ │ │ │ +bool write_block_title │ │ │ │ │ +(Helper) Whether to write a title on the rectangle value │ │ │ │ │ +DDeeffiinniittiioonn io.hh:725 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_h_e_i_g_h_t │ │ │ │ │ +std::size_t height │ │ │ │ │ +Final height size (pixels) of the SVG header. If 0, size is automatic. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:682 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e___h_e_a_d_e_r │ │ │ │ │ +bool write_header │ │ │ │ │ +Whether to write the SVG header. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:684 │ │ │ │ │ +_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_b_l_o_c_k_S_t_y_l_e_C_l_a_s_s │ │ │ │ │ +std::string blockStyleClass(const RowPrefix &row_prefix, const ColPrefix │ │ │ │ │ +&col_prefix) const │ │ │ │ │ +Helper function that returns an style class for a given prefix. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:718 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +RowIterator end() │ │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:620 │ │ │ │ │ +_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:614 │ │ │ │ │ +_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_:_:_M │ │ │ │ │ +size_type M() const │ │ │ │ │ +Return the number of columns. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:700 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ +size_type N() const │ │ │ │ │ +Return the number of rows. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ _D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00191.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: ilusubdomainsolver.hh File Reference │ │ │ │ +dune-istl: umfpack.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,49 +71,71 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
ilusubdomainsolver.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <map>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/istl/preconditioners.hh>
│ │ │ │ -#include "matrix.hh"
│ │ │ │ -#include <cmath>
│ │ │ │ -#include <cstdlib>
│ │ │ │ +
#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/solvers.hh>
│ │ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ │ +#include <dune/istl/solverfactory.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

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

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

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

Detailed Description

│ │ │ │ -

Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.

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

Classes for using UMFPack with ISTL matrices.

│ │ │ │ +
Author
Dominic Kempf
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,35 +1,56 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ +_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_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ -  base class encapsulating common algorithms of _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r and │ │ │ │ │ - _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ -class   _D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ -  Exact subdomain solver using _I_L_U_(_p_) with appropriate p. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_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_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_U_M_F_P_a_c_k_<_ _M_ _> │ │ │ │ │ +  The UMFPack direct sparse solver. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _U_M_F_P_a_c_k_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _> │ │ │ │ │ + _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_<_ _U_M_F_P_a_c_k_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_,_ _c_l_a_s_s_ _> │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _B_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_< │ │ │ │ │ + _t_y_p_e_n_a_m_e_ _F_i_e_l_d_T_r_a_i_t_s_<_ _B_ _>_:_:_r_e_a_l___t_y_p_e_,_ _d_o_u_b_l_e_ _>_:_:_v_a_l_u_e_ _>_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("umfpack", _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r()) │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ │ │ +Classes for using UMFPack with ISTL matrices. │ │ │ │ │ Author │ │ │ │ │ - Markus Blatt │ │ │ │ │ + Dominic Kempf │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00191_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: ilusubdomainsolver.hh Source File │ │ │ │ +dune-istl: umfpack.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,235 +74,711 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
ilusubdomainsolver.hh
│ │ │ │ +
umfpack.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ILUSUBDOMAINSOLVER_HH
│ │ │ │ -
6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_UMFPACK_HH
│ │ │ │ +
6#define DUNE_ISTL_UMFPACK_HH
│ │ │ │
7
│ │ │ │ -
8#include <map>
│ │ │ │ -
9#include <dune/common/typetraits.hh>
│ │ │ │ - │ │ │ │ -
11#include "matrix.hh"
│ │ │ │ -
12#include <cmath>
│ │ │ │ -
13#include <cstdlib>
│ │ │ │ +
8#if HAVE_SUITESPARSE_UMFPACK || defined DOXYGEN
│ │ │ │ +
9
│ │ │ │ +
10#include<complex>
│ │ │ │ +
11#include<type_traits>
│ │ │ │ +
12
│ │ │ │ +
13#include<umfpack.h>
│ │ │ │
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;
│ │ │ │ +
15#include<dune/common/exceptions.hh>
│ │ │ │ +
16#include<dune/common/fmatrix.hh>
│ │ │ │ +
17#include<dune/common/fvector.hh>
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
23
│ │ │ │ +
24
│ │ │ │ +
25
│ │ │ │ +
26namespace Dune {
│ │ │ │ +
38 // FORWARD DECLARATIONS
│ │ │ │ +
39 template<class M, class T, class TM, class TD, class TA>
│ │ │ │ +
40 class SeqOverlappingSchwarz;
│ │ │ │ +
41
│ │ │ │ +
42 template<class T, bool tag>
│ │ │ │ +
43 struct SeqOverlappingSchwarzAssemblerHelper;
│ │ │ │
44
│ │ │ │ -
51 virtual void apply (X& v, const Y& d) =0;
│ │ │ │ +
45 // wrapper class for C-Function Calls in the backend. Choose the right function namespace
│ │ │ │ +
46 // depending on the template parameter used.
│ │ │ │ +
47 template<typename T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
49 {
│ │ │ │ +
50 static constexpr bool valid = false ;
│ │ │ │ +
51 };
│ │ │ │ +
│ │ │ │
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 ILU::blockILUBacksolve(this->ILU,v,d);
│ │ │ │ -
96 }
│ │ │ │ -
│ │ │ │ -
104 template<class S>
│ │ │ │ -
105 void setSubMatrix(const M& A, S& rowset);
│ │ │ │ -
106
│ │ │ │ -
107 };
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
109 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
111 : public ILUSubdomainSolver<M,X,Y>{
│ │ │ │ -
112 public:
│ │ │ │ -
114 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ │ -
115 typedef typename std::remove_const<M>::type rilu_type;
│ │ │ │ -
117 typedef X domain_type;
│ │ │ │ -
119 typedef Y range_type;
│ │ │ │ -
120
│ │ │ │ -
│ │ │ │ -
125 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>
│ │ │ │ +
53 template<>
│ │ │ │ +
│ │ │ │ +
54 struct UMFPackMethodChooser<double>
│ │ │ │ +
55 {
│ │ │ │ +
56 static constexpr bool valid = true ;
│ │ │ │ +
57
│ │ │ │ +
58 template<typename... A>
│ │ │ │ +
│ │ │ │ +
59 static void defaults(A... args)
│ │ │ │ +
60 {
│ │ │ │ +
61 umfpack_dl_defaults(args...);
│ │ │ │ +
62 }
│ │ │ │ +
│ │ │ │ +
63 template<typename... A>
│ │ │ │ +
│ │ │ │ +
64 static void free_numeric(A... args)
│ │ │ │ +
65 {
│ │ │ │ +
66 umfpack_dl_free_numeric(args...);
│ │ │ │ +
67 }
│ │ │ │ +
│ │ │ │ +
68 template<typename... A>
│ │ │ │ +
│ │ │ │ +
69 static void free_symbolic(A... args)
│ │ │ │ +
70 {
│ │ │ │ +
71 umfpack_dl_free_symbolic(args...);
│ │ │ │ +
72 }
│ │ │ │ +
│ │ │ │ +
73 template<typename... A>
│ │ │ │ +
│ │ │ │ +
74 static int load_numeric(A... args)
│ │ │ │ +
75 {
│ │ │ │ +
76 return umfpack_dl_load_numeric(args...);
│ │ │ │ +
77 }
│ │ │ │ +
│ │ │ │ +
78 template<typename... A>
│ │ │ │ +
│ │ │ │ +
79 static void numeric(A... args)
│ │ │ │ +
80 {
│ │ │ │ +
81 umfpack_dl_numeric(args...);
│ │ │ │ +
82 }
│ │ │ │ +
│ │ │ │ +
83 template<typename... A>
│ │ │ │ +
│ │ │ │ +
84 static void report_info(A... args)
│ │ │ │ +
85 {
│ │ │ │ +
86 umfpack_dl_report_info(args...);
│ │ │ │ +
87 }
│ │ │ │ +
│ │ │ │ +
88 template<typename... A>
│ │ │ │ +
│ │ │ │ +
89 static void report_status(A... args)
│ │ │ │ +
90 {
│ │ │ │ +
91 umfpack_dl_report_status(args...);
│ │ │ │ +
92 }
│ │ │ │ +
│ │ │ │ +
93 template<typename... A>
│ │ │ │ +
│ │ │ │ +
94 static int save_numeric(A... args)
│ │ │ │ +
95 {
│ │ │ │ +
96 return umfpack_dl_save_numeric(args...);
│ │ │ │ +
97 }
│ │ │ │ +
│ │ │ │ +
98 template<typename... A>
│ │ │ │ +
│ │ │ │ +
99 static void solve(A... args)
│ │ │ │ +
100 {
│ │ │ │ +
101 umfpack_dl_solve(args...);
│ │ │ │ +
102 }
│ │ │ │ +
│ │ │ │ +
103 template<typename... A>
│ │ │ │ +
│ │ │ │ +
104 static void symbolic(A... args)
│ │ │ │ +
105 {
│ │ │ │ +
106 umfpack_dl_symbolic(args...);
│ │ │ │ +
107 }
│ │ │ │ +
│ │ │ │ +
108 };
│ │ │ │ +
│ │ │ │ +
109
│ │ │ │ +
110 template<>
│ │ │ │ +
│ │ │ │ +
111 struct UMFPackMethodChooser<std::complex<double> >
│ │ │ │ +
112 {
│ │ │ │ +
113 static constexpr bool valid = true ;
│ │ │ │ +
114
│ │ │ │ +
115 template<typename... A>
│ │ │ │ +
│ │ │ │ +
116 static void defaults(A... args)
│ │ │ │ +
117 {
│ │ │ │ +
118 umfpack_zl_defaults(args...);
│ │ │ │ +
119 }
│ │ │ │ +
│ │ │ │ +
120 template<typename... A>
│ │ │ │ +
│ │ │ │ +
121 static void free_numeric(A... args)
│ │ │ │ +
122 {
│ │ │ │ +
123 umfpack_zl_free_numeric(args...);
│ │ │ │ +
124 }
│ │ │ │ +
│ │ │ │ +
125 template<typename... A>
│ │ │ │ +
│ │ │ │ +
126 static void free_symbolic(A... args)
│ │ │ │ +
127 {
│ │ │ │ +
128 umfpack_zl_free_symbolic(args...);
│ │ │ │ +
129 }
│ │ │ │ +
│ │ │ │ +
130 template<typename... A>
│ │ │ │ +
│ │ │ │ +
131 static int load_numeric(A... args)
│ │ │ │ +
132 {
│ │ │ │ +
133 return umfpack_zl_load_numeric(args...);
│ │ │ │ +
134 }
│ │ │ │ +
│ │ │ │ +
135 template<typename... A>
│ │ │ │ +
│ │ │ │ +
136 static void numeric(const long int* cs, const long int* ri, const double* val, A... args)
│ │ │ │ +
137 {
│ │ │ │ +
138 umfpack_zl_numeric(cs,ri,val,NULL,args...);
│ │ │ │ +
139 }
│ │ │ │ +
│ │ │ │ +
140 template<typename... A>
│ │ │ │ +
│ │ │ │ +
141 static void report_info(A... args)
│ │ │ │ +
142 {
│ │ │ │ +
143 umfpack_zl_report_info(args...);
│ │ │ │ +
144 }
│ │ │ │ +
│ │ │ │ +
145 template<typename... A>
│ │ │ │ +
│ │ │ │ +
146 static void report_status(A... args)
│ │ │ │ +
147 {
│ │ │ │ +
148 umfpack_zl_report_status(args...);
│ │ │ │ +
149 }
│ │ │ │ +
│ │ │ │ +
150 template<typename... A>
│ │ │ │
│ │ │ │ -
151 std::size_t ILUSubdomainSolver<M,X,Y>::copyToLocalMatrix(const M& A, S& rowSet)
│ │ │ │ -
152 {
│ │ │ │ -
153 // Calculate consecutive indices for local problem
│ │ │ │ -
154 // while perserving the ordering
│ │ │ │ -
155 typedef typename M::size_type size_type;
│ │ │ │ -
156 typedef std::map<typename S::value_type,size_type> IndexMap;
│ │ │ │ -
157 typedef typename IndexMap::iterator IMIter;
│ │ │ │ -
158 IndexMap indexMap;
│ │ │ │ -
159 IMIter guess = indexMap.begin();
│ │ │ │ -
160 size_type localIndex=0;
│ │ │ │ -
161
│ │ │ │ -
162 typedef typename S::const_iterator SIter;
│ │ │ │ -
163 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ │ -
164 rowIdx!= rowEnd; ++rowIdx, ++localIndex)
│ │ │ │ -
165 guess = indexMap.insert(guess,
│ │ │ │ -
166 std::make_pair(*rowIdx,localIndex));
│ │ │ │ -
167
│ │ │ │ -
168
│ │ │ │ -
169 // Build Matrix for local subproblem
│ │ │ │ -
170 ILU.setSize(rowSet.size(),rowSet.size());
│ │ │ │ -
171 ILU.setBuildMode(matrix_type::row_wise);
│ │ │ │ -
172
│ │ │ │ -
173 // Create sparsity pattern
│ │ │ │ -
174 typedef typename matrix_type::CreateIterator CIter;
│ │ │ │ -
175 CIter rowCreator = ILU.createbegin();
│ │ │ │ -
176 std::size_t offset=0;
│ │ │ │ -
177 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ │ -
178 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) {
│ │ │ │ -
179 // See which row entries are in our subset and add them to
│ │ │ │ -
180 // the sparsity pattern
│ │ │ │ -
181 guess = indexMap.begin();
│ │ │ │ -
182
│ │ │ │ -
183 for(typename matrix_type::ConstColIterator col=A[*rowIdx].begin(),
│ │ │ │ -
184 endcol=A[*rowIdx].end(); col != endcol; ++col) {
│ │ │ │ -
185 // search for the entry in the row set
│ │ │ │ -
186 guess = indexMap.find(col.index());
│ │ │ │ -
187 if(guess!=indexMap.end()) {
│ │ │ │ -
188 // add local index to row
│ │ │ │ -
189 rowCreator.insert(guess->second);
│ │ │ │ -
190 offset=std::max(offset,(std::size_t)std::abs((int)(guess->second-rowCreator.index())));
│ │ │ │ -
191 }
│ │ │ │ -
192 }
│ │ │ │ -
193
│ │ │ │ -
194 }
│ │ │ │ -
195
│ │ │ │ -
196 // Insert the matrix values for the local problem
│ │ │ │ -
197 typename matrix_type::iterator iluRow=ILU.begin();
│ │ │ │ -
198
│ │ │ │ -
199 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ │ -
200 rowIdx!= rowEnd; ++rowIdx, ++iluRow) {
│ │ │ │ -
201 // See which row entries are in our subset and add them to
│ │ │ │ -
202 // the sparsity pattern
│ │ │ │ -
203 typename matrix_type::ColIterator localCol=iluRow->begin();
│ │ │ │ -
204 for(typename matrix_type::ConstColIterator col=A[*rowIdx].begin(),
│ │ │ │ -
205 endcol=A[*rowIdx].end(); col != endcol; ++col) {
│ │ │ │ -
206 // search for the entry in the row set
│ │ │ │ -
207 guess = indexMap.find(col.index());
│ │ │ │ -
208 if(guess!=indexMap.end()) {
│ │ │ │ -
209 // set local value
│ │ │ │ -
210 (*localCol)=(*col);
│ │ │ │ -
211 ++localCol;
│ │ │ │ -
212 }
│ │ │ │ -
213 }
│ │ │ │ -
214 }
│ │ │ │ -
215 return offset;
│ │ │ │ -
216 }
│ │ │ │ +
151 static int save_numeric(A... args)
│ │ │ │ +
152 {
│ │ │ │ +
153 return umfpack_zl_save_numeric(args...);
│ │ │ │ +
154 }
│ │ │ │ +
│ │ │ │ +
155 template<typename... A>
│ │ │ │ +
│ │ │ │ +
156 static void solve(long int m, const long int* cs, const long int* ri, std::complex<double>* val, double* x, const double* b,A... args)
│ │ │ │ +
157 {
│ │ │ │ +
158 const double* cval = reinterpret_cast<const double*>(val);
│ │ │ │ +
159 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...);
│ │ │ │ +
160 }
│ │ │ │ +
│ │ │ │ +
161 template<typename... A>
│ │ │ │ +
│ │ │ │ +
162 static void symbolic(long int m, long int n, const long int* cs, const long int* ri, const double* val, A... args)
│ │ │ │ +
163 {
│ │ │ │ +
164 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...);
│ │ │ │ +
165 }
│ │ │ │
│ │ │ │ +
166 };
│ │ │ │ +
│ │ │ │ +
167
│ │ │ │ +
168 namespace Impl
│ │ │ │ +
169 {
│ │ │ │ +
170 template<class M>
│ │ │ │ +
171 struct UMFPackVectorChooser
│ │ │ │ +
172 {};
│ │ │ │ +
173
│ │ │ │ +
174 template<typename T, typename A, int n, int m>
│ │ │ │ +
175 struct UMFPackVectorChooser<BCRSMatrix<FieldMatrix<T,n,m>,A > >
│ │ │ │ +
176 {
│ │ │ │ +
178 using domain_type = BlockVector<
│ │ │ │ +
179 FieldVector<T,m>,
│ │ │ │ +
180 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > >;
│ │ │ │ +
182 using range_type = BlockVector<
│ │ │ │ +
183 FieldVector<T,n>,
│ │ │ │ +
184 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > >;
│ │ │ │ +
185 };
│ │ │ │ +
186
│ │ │ │ +
187 template<typename T, typename A>
│ │ │ │ +
188 struct UMFPackVectorChooser<BCRSMatrix<T,A> >
│ │ │ │ +
189 {
│ │ │ │ +
191 using domain_type = BlockVector<T, A>;
│ │ │ │ +
193 using range_type = BlockVector<T, A>;
│ │ │ │ +
194 };
│ │ │ │ +
195 }
│ │ │ │ +
196
│ │ │ │ +
210 template<typename M>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
212 : public InverseOperator<
│ │ │ │ +
213 typename Impl::UMFPackVectorChooser<M>::domain_type,
│ │ │ │ +
214 typename Impl::UMFPackVectorChooser<M>::range_type >
│ │ │ │ +
215 {
│ │ │ │ +
216 using T = typename M::field_type;
│ │ │ │
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 }
│ │ │ │ +
218 public:
│ │ │ │ +
220 using Matrix = M;
│ │ │ │ +
221 using matrix_type = M;
│ │ │ │ +
223 typedef ISTL::Impl::BCCSMatrix<typename Matrix::field_type, long int> UMFPackMatrix;
│ │ │ │ +
225 typedef ISTL::Impl::BCCSMatrixInitializer<M, long int> MatrixInitializer;
│ │ │ │ +
227 using domain_type = typename Impl::UMFPackVectorChooser<M>::domain_type;
│ │ │ │ +
229 using range_type = typename Impl::UMFPackVectorChooser<M>::range_type;
│ │ │ │ +
230
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
233 {
│ │ │ │ + │ │ │ │ +
235 }
│ │ │ │
│ │ │ │
236
│ │ │ │ -
238} // end name space DUNE
│ │ │ │ -
239
│ │ │ │ -
240
│ │ │ │ -
241#endif
│ │ │ │ -
A dynamic dense block matrix class.
│ │ │ │ -
Define general preconditioner interface.
│ │ │ │ -
std::size_t copyToLocalMatrix(const M &A, S &rowset)
Copy the local part of the global matrix to ILU.
Definition ilusubdomainsolver.hh:151
│ │ │ │ -
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition ilusubdomainsolver.hh:229
│ │ │ │ -
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition ilusubdomainsolver.hh:221
│ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ +
│ │ │ │ +
245 UMFPack(const Matrix& matrix, int verbose=0) : matrixIsLoaded_(false)
│ │ │ │ +
246 {
│ │ │ │ +
247 //check whether T is a supported type
│ │ │ │ +
248 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ +
249 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ +
250 Caller::defaults(UMF_Control);
│ │ │ │ +
251 setVerbosity(verbose);
│ │ │ │ +
252 setMatrix(matrix);
│ │ │ │ +
253 }
│ │ │ │ +
│ │ │ │ +
254
│ │ │ │ +
│ │ │ │ +
263 UMFPack(const Matrix& matrix, int verbose, bool) : matrixIsLoaded_(false)
│ │ │ │ +
264 {
│ │ │ │ +
265 //check whether T is a supported type
│ │ │ │ +
266 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ +
267 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ +
268 Caller::defaults(UMF_Control);
│ │ │ │ +
269 setVerbosity(verbose);
│ │ │ │ +
270 setMatrix(matrix);
│ │ │ │ +
271 }
│ │ │ │ +
│ │ │ │ +
272
│ │ │ │ +
│ │ │ │ +
282 UMFPack(const Matrix& mat_, const ParameterTree& config)
│ │ │ │ +
283 : UMFPack(mat_, config.get<int>("verbose", 0))
│ │ │ │ +
284 {}
│ │ │ │ +
│ │ │ │ +
285
│ │ │ │ +
│ │ │ │ +
288 UMFPack() : matrixIsLoaded_(false), verbosity_(0)
│ │ │ │ +
289 {
│ │ │ │ +
290 //check whether T is a supported type
│ │ │ │ +
291 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ +
292 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ +
293 Caller::defaults(UMF_Control);
│ │ │ │ +
294 }
│ │ │ │ +
│ │ │ │ +
295
│ │ │ │ +
│ │ │ │ +
306 UMFPack(const Matrix& mat_, const char* file, int verbose=0)
│ │ │ │ +
307 {
│ │ │ │ +
308 //check whether T is a supported type
│ │ │ │ +
309 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ +
310 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ +
311 Caller::defaults(UMF_Control);
│ │ │ │ +
312 setVerbosity(verbose);
│ │ │ │ +
313 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ │ +
314 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == UMFPACK_ERROR_file_IO))
│ │ │ │ +
315 {
│ │ │ │ +
316 matrixIsLoaded_ = false;
│ │ │ │ +
317 setMatrix(mat_);
│ │ │ │ +
318 saveDecomposition(file);
│ │ │ │ +
319 }
│ │ │ │ +
320 else
│ │ │ │ +
321 {
│ │ │ │ +
322 matrixIsLoaded_ = true;
│ │ │ │ +
323 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ │ +
324 }
│ │ │ │ +
325 }
│ │ │ │ +
│ │ │ │ +
326
│ │ │ │ +
│ │ │ │ +
333 UMFPack(const char* file, int verbose=0)
│ │ │ │ +
334 {
│ │ │ │ +
335 //check whether T is a supported type
│ │ │ │ +
336 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ +
337 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ +
338 Caller::defaults(UMF_Control);
│ │ │ │ +
339 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ │ +
340 if (errcode == UMFPACK_ERROR_out_of_memory)
│ │ │ │ +
341 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack decomposition");
│ │ │ │ +
342 if (errcode == UMFPACK_ERROR_file_IO)
│ │ │ │ +
343 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack decomposition");
│ │ │ │ +
344 matrixIsLoaded_ = true;
│ │ │ │ +
345 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ │ +
346 setVerbosity(verbose);
│ │ │ │ +
347 }
│ │ │ │ +
│ │ │ │ +
348
│ │ │ │ +
│ │ │ │ +
349 virtual ~UMFPack()
│ │ │ │ +
350 {
│ │ │ │ +
351 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ │ +
352 free();
│ │ │ │ +
353 }
│ │ │ │ +
│ │ │ │ +
354
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
359 {
│ │ │ │ +
360 if (umfpackMatrix_.N() != b.dim())
│ │ │ │ +
361 DUNE_THROW(Dune::ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
│ │ │ │ +
362 if (umfpackMatrix_.M() != x.dim())
│ │ │ │ +
363 DUNE_THROW(Dune::ISTLError, "Size of solution vector x does not match the number of matrix columns!");
│ │ │ │ +
364 if (b.size() == 0)
│ │ │ │ +
365 return;
│ │ │ │ +
366
│ │ │ │ +
367 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ │ +
368 Caller::solve(UMFPACK_A,
│ │ │ │ +
369 umfpackMatrix_.getColStart(),
│ │ │ │ +
370 umfpackMatrix_.getRowIndex(),
│ │ │ │ +
371 umfpackMatrix_.getValues(),
│ │ │ │ +
372 reinterpret_cast<double*>(&x[0]),
│ │ │ │ +
373 reinterpret_cast<double*>(&b[0]),
│ │ │ │ +
374 UMF_Numeric,
│ │ │ │ +
375 UMF_Control,
│ │ │ │ +
376 UMF_Apply_Info);
│ │ │ │ +
377
│ │ │ │ +
378 //this is a direct solver
│ │ │ │ +
379 res.iterations = 1;
│ │ │ │ +
380 res.converged = true;
│ │ │ │ +
381 res.elapsed = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME];
│ │ │ │ +
382
│ │ │ │ +
383 printOnApply(UMF_Apply_Info);
│ │ │ │ +
384 }
│ │ │ │ +
│ │ │ │ +
385
│ │ │ │ +
│ │ │ │ +
389 virtual void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ │ +
390 {
│ │ │ │ +
391 apply(x,b,res);
│ │ │ │ +
392 }
│ │ │ │ +
│ │ │ │ +
393
│ │ │ │ +
│ │ │ │ +
399 void apply(T* x, T* b)
│ │ │ │ +
400 {
│ │ │ │ +
401 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ │ +
402 Caller::solve(UMFPACK_A,
│ │ │ │ +
403 umfpackMatrix_.getColStart(),
│ │ │ │ +
404 umfpackMatrix_.getRowIndex(),
│ │ │ │ +
405 umfpackMatrix_.getValues(),
│ │ │ │ +
406 x,
│ │ │ │ +
407 b,
│ │ │ │ +
408 UMF_Numeric,
│ │ │ │ +
409 UMF_Control,
│ │ │ │ +
410 UMF_Apply_Info);
│ │ │ │ +
411 printOnApply(UMF_Apply_Info);
│ │ │ │ +
412 }
│ │ │ │ +
│ │ │ │ +
413
│ │ │ │ +
│ │ │ │ +
425 void setOption(unsigned int option, double value)
│ │ │ │ +
426 {
│ │ │ │ +
427 if (option >= UMFPACK_CONTROL)
│ │ │ │ +
428 DUNE_THROW(RangeError, "Requested non-existing UMFPack option");
│ │ │ │ +
429
│ │ │ │ +
430 UMF_Control[option] = value;
│ │ │ │ +
431 }
│ │ │ │ +
│ │ │ │ +
432
│ │ │ │ +
│ │ │ │ +
436 void saveDecomposition(const char* file)
│ │ │ │ +
437 {
│ │ │ │ +
438 int errcode = Caller::save_numeric(UMF_Numeric, const_cast<char*>(file));
│ │ │ │ +
439 if (errcode != UMFPACK_OK)
│ │ │ │ +
440 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack decomposition");
│ │ │ │ +
441 }
│ │ │ │ +
│ │ │ │ +
442
│ │ │ │ +
│ │ │ │ +
444 void setMatrix(const Matrix& matrix)
│ │ │ │ +
445 {
│ │ │ │ +
446 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ │ +
447 free();
│ │ │ │ +
448 if (matrix.N() == 0 or matrix.M() == 0)
│ │ │ │ +
449 return;
│ │ │ │ +
450
│ │ │ │ +
451 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ │ +
452 umfpackMatrix_.free();
│ │ │ │ +
453 umfpackMatrix_.setSize(MatrixDimension<Matrix>::rowdim(matrix),
│ │ │ │ + │ │ │ │ +
455 ISTL::Impl::BCCSMatrixInitializer<Matrix, long int> initializer(umfpackMatrix_);
│ │ │ │ +
456
│ │ │ │ +
457 copyToBCCSMatrix(initializer, matrix);
│ │ │ │ +
458
│ │ │ │ +
459 decompose();
│ │ │ │ +
460 }
│ │ │ │ +
│ │ │ │ +
461
│ │ │ │ +
462 template<class S>
│ │ │ │ +
│ │ │ │ +
463 void setSubMatrix(const Matrix& _mat, const S& rowIndexSet)
│ │ │ │ +
464 {
│ │ │ │ +
465 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ │ +
466 free();
│ │ │ │ +
467
│ │ │ │ +
468 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ │ +
469 umfpackMatrix_.free();
│ │ │ │ +
470
│ │ │ │ +
471 umfpackMatrix_.setSize(rowIndexSet.size()*MatrixDimension<Matrix>::rowdim(_mat) / _mat.N(),
│ │ │ │ +
472 rowIndexSet.size()*MatrixDimension<Matrix>::coldim(_mat) / _mat.M());
│ │ │ │ +
473 ISTL::Impl::BCCSMatrixInitializer<Matrix, long int> initializer(umfpackMatrix_);
│ │ │ │ +
474
│ │ │ │ +
475 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(_mat,rowIndexSet));
│ │ │ │ +
476
│ │ │ │ +
477 decompose();
│ │ │ │ +
478 }
│ │ │ │ +
│ │ │ │ +
479
│ │ │ │ +
│ │ │ │ +
487 void setVerbosity(int v)
│ │ │ │ +
488 {
│ │ │ │ +
489 verbosity_ = v;
│ │ │ │ +
490 // set the verbosity level in UMFPack
│ │ │ │ +
491 if (verbosity_ == 0)
│ │ │ │ +
492 UMF_Control[UMFPACK_PRL] = 1;
│ │ │ │ +
493 if (verbosity_ == 1)
│ │ │ │ +
494 UMF_Control[UMFPACK_PRL] = 2;
│ │ │ │ +
495 if (verbosity_ == 2)
│ │ │ │ +
496 UMF_Control[UMFPACK_PRL] = 4;
│ │ │ │ +
497 }
│ │ │ │ +
│ │ │ │ +
498
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
504 {
│ │ │ │ +
505 return UMF_Numeric;
│ │ │ │ +
506 }
│ │ │ │ +
│ │ │ │ +
507
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
513 {
│ │ │ │ +
514 return umfpackMatrix_;
│ │ │ │ +
515 }
│ │ │ │ +
│ │ │ │ +
516
│ │ │ │ +
│ │ │ │ +
521 void free()
│ │ │ │ +
522 {
│ │ │ │ +
523 if (!matrixIsLoaded_)
│ │ │ │ +
524 {
│ │ │ │ +
525 Caller::free_symbolic(&UMF_Symbolic);
│ │ │ │ +
526 umfpackMatrix_.free();
│ │ │ │ +
527 }
│ │ │ │ +
528 Caller::free_numeric(&UMF_Numeric);
│ │ │ │ +
529 matrixIsLoaded_ = false;
│ │ │ │ +
530 }
│ │ │ │ +
│ │ │ │ +
531
│ │ │ │ +
532 const char* name() { return "UMFPACK"; }
│ │ │ │ +
533
│ │ │ │ +
534 private:
│ │ │ │ +
535 typedef typename Dune::UMFPackMethodChooser<T> Caller;
│ │ │ │ +
536
│ │ │ │ +
537 template<class Mat,class X, class TM, class TD, class T1>
│ │ │ │ + │ │ │ │ + │ │ │ │ +
540
│ │ │ │ +
542 void decompose()
│ │ │ │ +
543 {
│ │ │ │ +
544 double UMF_Decomposition_Info[UMFPACK_INFO];
│ │ │ │ +
545 Caller::symbolic(static_cast<int>(umfpackMatrix_.N()),
│ │ │ │ +
546 static_cast<int>(umfpackMatrix_.N()),
│ │ │ │ +
547 umfpackMatrix_.getColStart(),
│ │ │ │ +
548 umfpackMatrix_.getRowIndex(),
│ │ │ │ +
549 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ │ +
550 &UMF_Symbolic,
│ │ │ │ +
551 UMF_Control,
│ │ │ │ +
552 UMF_Decomposition_Info);
│ │ │ │ +
553 Caller::numeric(umfpackMatrix_.getColStart(),
│ │ │ │ +
554 umfpackMatrix_.getRowIndex(),
│ │ │ │ +
555 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ │ +
556 UMF_Symbolic,
│ │ │ │ +
557 &UMF_Numeric,
│ │ │ │ +
558 UMF_Control,
│ │ │ │ +
559 UMF_Decomposition_Info);
│ │ │ │ +
560 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]);
│ │ │ │ +
561 if (verbosity_ == 1)
│ │ │ │ +
562 {
│ │ │ │ +
563 std::cout << "[UMFPack Decomposition]" << std::endl;
│ │ │ │ +
564 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_TIME] << ")" << std::endl;
│ │ │ │ +
565 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << std::endl;
│ │ │ │ +
566 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" << std::endl;
│ │ │ │ +
567 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info[UMFPACK_RCOND] << std::endl;
│ │ │ │ +
568 std::cout << "Numbers of non-zeroes in decomposition: L: " << UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info[UMFPACK_UNZ] << std::endl;
│ │ │ │ +
569 }
│ │ │ │ +
570 if (verbosity_ == 2)
│ │ │ │ +
571 {
│ │ │ │ +
572 Caller::report_info(UMF_Control,UMF_Decomposition_Info);
│ │ │ │ +
573 }
│ │ │ │ +
574 }
│ │ │ │ +
575
│ │ │ │ +
576 void printOnApply(double* UMF_Info)
│ │ │ │ +
577 {
│ │ │ │ +
578 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]);
│ │ │ │ +
579 if (verbosity_ > 0)
│ │ │ │ +
580 {
│ │ │ │ +
581 std::cout << "[UMFPack Solve]" << std::endl;
│ │ │ │ +
582 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " (CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl;
│ │ │ │ +
583 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl;
│ │ │ │ +
584 std::cout << "Iterative Refinement steps taken: " << UMF_Info[UMFPACK_IR_TAKEN] << std::endl;
│ │ │ │ +
585 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << UMF_Info[UMFPACK_OMEGA2] << std::endl;
│ │ │ │ +
586 }
│ │ │ │ +
587 }
│ │ │ │ +
588
│ │ │ │ +
589 UMFPackMatrix umfpackMatrix_;
│ │ │ │ +
590 bool matrixIsLoaded_;
│ │ │ │ +
591 int verbosity_;
│ │ │ │ +
592 void *UMF_Symbolic;
│ │ │ │ +
593 void *UMF_Numeric;
│ │ │ │ +
594 double UMF_Control[UMFPACK_CONTROL];
│ │ │ │ +
595 };
│ │ │ │ +
│ │ │ │ +
596
│ │ │ │ +
597 template<typename T, typename A, int n, int m>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
599 {
│ │ │ │ +
600 enum { value=true};
│ │ │ │ +
601 };
│ │ │ │ +
│ │ │ │ +
602
│ │ │ │ +
603 template<typename T, typename A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
605 {
│ │ │ │ +
606 enum { value = true };
│ │ │ │ +
607 };
│ │ │ │ +
│ │ │ │ +
608
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
610 template<class F,class=void> struct isValidBlock : std::false_type{};
│ │ │ │ +
611 template<class B> struct isValidBlock<B, std::enable_if_t<std::is_same<typename FieldTraits<B>::real_type,double>::value>> : std::true_type {};
│ │ │ │ +
612
│ │ │ │ +
613 template<typename TL, typename M>
│ │ │ │ +
614 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ +
615 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ +
│ │ │ │ +
616 operator() (TL /*tl*/, const M& mat, const Dune::ParameterTree& config,
│ │ │ │ +
617 std::enable_if_t<
│ │ │ │ +
618 isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ +
619 {
│ │ │ │ +
620 int verbose = config.get("verbose", 0);
│ │ │ │ +
621 return std::make_shared<Dune::UMFPack<M>>(mat,verbose);
│ │ │ │ +
622 }
│ │ │ │ +
│ │ │ │ +
623
│ │ │ │ +
624 // second version with SFINAE to validate the template parameters of UMFPack
│ │ │ │ +
625 template<typename TL, typename M>
│ │ │ │ +
626 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ +
627 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ +
│ │ │ │ +
628 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ │ +
629 std::enable_if_t<
│ │ │ │ +
630 !isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ +
631 {
│ │ │ │ +
632 DUNE_THROW(UnsupportedType,
│ │ │ │ +
633 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ +
634 }
│ │ │ │ +
│ │ │ │ +
635 };
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
637} // end namespace Dune
│ │ │ │ +
638
│ │ │ │ +
639#endif // HAVE_SUITESPARSE_UMFPACK
│ │ │ │ +
640
│ │ │ │ +
641#endif //DUNE_ISTL_UMFPACK_HH
│ │ │ │ + │ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
Implementations of the inverse operator interface.
│ │ │ │ +
Templates characterizing the type of a solver.
│ │ │ │ + │ │ │ │ +
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ │ +
void free()
free allocated space.
Definition umfpack.hh:521
│ │ │ │ +
virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition umfpack.hh:358
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition umfpack.hh:232
│ │ │ │ +
M matrix_type
Definition umfpack.hh:221
│ │ │ │ +
static void solve(long int m, const long int *cs, const long int *ri, std::complex< double > *val, double *x, const double *b, A... args)
Definition umfpack.hh:156
│ │ │ │ +
void setMatrix(const Matrix &matrix)
Initialize data from given matrix.
Definition umfpack.hh:444
│ │ │ │ +
static void report_info(A... args)
Definition umfpack.hh:141
│ │ │ │ +
UMFPack(const Matrix &mat_, const ParameterTree &config)
Construct a solver object from a matrix.
Definition umfpack.hh:282
│ │ │ │ +
static int load_numeric(A... args)
Definition umfpack.hh:131
│ │ │ │ +
static int load_numeric(A... args)
Definition umfpack.hh:74
│ │ │ │ +
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
Definition umfpack.hh:616
│ │ │ │ +
ISTL::Impl::BCCSMatrix< typename Matrix::field_type, long int > UMFPackMatrix
The corresponding UMFPack matrix type.
Definition umfpack.hh:223
│ │ │ │ +
static void report_status(A... args)
Definition umfpack.hh:89
│ │ │ │ +
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:306
│ │ │ │ +
typename Impl::UMFPackVectorChooser< M >::range_type range_type
The type of the range of the solver.
Definition umfpack.hh:229
│ │ │ │ +
UMFPack()
default constructor
Definition umfpack.hh:288
│ │ │ │ +
static void symbolic(A... args)
Definition umfpack.hh:104
│ │ │ │ +
static void report_info(A... args)
Definition umfpack.hh:84
│ │ │ │ +
static void symbolic(long int m, long int n, const long int *cs, const long int *ri, const double *val, A... args)
Definition umfpack.hh:162
│ │ │ │ +
static void free_symbolic(A... args)
Definition umfpack.hh:69
│ │ │ │ +
static int save_numeric(A... args)
Definition umfpack.hh:151
│ │ │ │ +
static void free_numeric(A... args)
Definition umfpack.hh:121
│ │ │ │ +
void setSubMatrix(const Matrix &_mat, const S &rowIndexSet)
Definition umfpack.hh:463
│ │ │ │ +
static int save_numeric(A... args)
Definition umfpack.hh:94
│ │ │ │ +
static void report_status(A... args)
Definition umfpack.hh:146
│ │ │ │ +
ISTL::Impl::BCCSMatrixInitializer< M, long int > MatrixInitializer
Type of an associated initializer class.
Definition umfpack.hh:225
│ │ │ │ +
void apply(T *x, T *b)
additional apply method with c-arrays in analogy to superlu
Definition umfpack.hh:399
│ │ │ │ +
static void defaults(A... args)
Definition umfpack.hh:116
│ │ │ │ +
static void free_numeric(A... args)
Definition umfpack.hh:64
│ │ │ │ +
void setVerbosity(int v)
sets the verbosity level for the UMFPack solver
Definition umfpack.hh:487
│ │ │ │ +
UMFPack(const char *file, int verbose=0)
try loading a decomposition from file
Definition umfpack.hh:333
│ │ │ │ +
static void numeric(A... args)
Definition umfpack.hh:79
│ │ │ │ +
static constexpr bool valid
Definition umfpack.hh:50
│ │ │ │ +
virtual ~UMFPack()
Definition umfpack.hh:349
│ │ │ │ +
const char * name()
Definition umfpack.hh:532
│ │ │ │ +
void saveDecomposition(const char *file)
saves a decomposition to a file
Definition umfpack.hh:436
│ │ │ │ +
UMFPackMatrix & getInternalMatrix()
Return the column compress matrix from UMFPack.
Definition umfpack.hh:512
│ │ │ │ +
typename Impl::UMFPackVectorChooser< M >::domain_type domain_type
The type of the domain of the solver.
Definition umfpack.hh:227
│ │ │ │ +
UMFPack(const Matrix &matrix, int verbose=0)
Construct a solver object from a matrix.
Definition umfpack.hh:245
│ │ │ │ +
virtual void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition umfpack.hh:389
│ │ │ │ +
void setOption(unsigned int option, double value)
Set UMFPack-specific options.
Definition umfpack.hh:425
│ │ │ │ +
static void free_symbolic(A... args)
Definition umfpack.hh:126
│ │ │ │ +
M Matrix
The matrix type.
Definition umfpack.hh:220
│ │ │ │ +
static void numeric(const long int *cs, const long int *ri, const double *val, A... args)
Definition umfpack.hh:136
│ │ │ │ +
static void defaults(A... args)
Definition umfpack.hh:59
│ │ │ │ +
static void solve(A... args)
Definition umfpack.hh:99
│ │ │ │ +
UMFPack(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition umfpack.hh:263
│ │ │ │ +
void * getFactorization()
Return the matrix factorization.
Definition umfpack.hh:503
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ │ -
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ │ -
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ │ -
base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver.
Definition ilusubdomainsolver.hh:36
│ │ │ │ -
matrix_type ILU
The ILU0 decomposition of the matrix, or the local matrix.
Definition ilusubdomainsolver.hh:67
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:41
│ │ │ │ -
virtual ~ILUSubdomainSolver()
Definition ilusubdomainsolver.hh:53
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:43
│ │ │ │ -
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:39
│ │ │ │ -
virtual void apply(X &v, const Y &d)=0
Apply the subdomain solver.
│ │ │ │ -
Exact subdomain solver using ILU(p) with appropriate p.
Definition ilusubdomainsolver.hh:78
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:84
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:86
│ │ │ │ -
std::remove_const< M >::type rilu_type
Definition ilusubdomainsolver.hh:82
│ │ │ │ -
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:81
│ │ │ │ -
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition ilusubdomainsolver.hh:93
│ │ │ │ -
Definition ilusubdomainsolver.hh:111
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:117
│ │ │ │ -
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:114
│ │ │ │ -
std::remove_const< M >::type rilu_type
Definition ilusubdomainsolver.hh:115
│ │ │ │ -
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition ilusubdomainsolver.hh:125
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:119
│ │ │ │ -
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │ +
Definition matrixutils.hh:211
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ +
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ │ +
Definition overlappingschwarz.hh:694
│ │ │ │ +
Definition matrixutils.hh:27
│ │ │ │ +
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ +
double elapsed
Elapsed time in seconds.
Definition solver.hh:82
│ │ │ │ +
int iterations
Number of iterations.
Definition solver.hh:67
│ │ │ │ +
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
│ │ │ │ +
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ +
Definition solverregistry.hh:77
│ │ │ │ +
Definition solvertype.hh:16
│ │ │ │ +
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ │ +
Definition solvertype.hh:30
│ │ │ │ +
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │ │ +
Definition umfpack.hh:49
│ │ │ │ +
The UMFPack direct sparse solver.
Definition umfpack.hh:215
│ │ │ │ +
Definition umfpack.hh:609
│ │ │ │ +
Definition umfpack.hh:610
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,288 +1,842 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -ilusubdomainsolver.hh │ │ │ │ │ +umfpack.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 (C) 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_ILUSUBDOMAINSOLVER_HH │ │ │ │ │ -6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_UMFPACK_HH │ │ │ │ │ +6#define DUNE_ISTL_UMFPACK_HH │ │ │ │ │ 7 │ │ │ │ │ -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 │ │ │ │ │ +8#if HAVE_SUITESPARSE_UMFPACK || defined DOXYGEN │ │ │ │ │ +9 │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +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; │ │ │ │ │ +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_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ +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 │ │ │ │ │ +24 │ │ │ │ │ +25 │ │ │ │ │ +26namespace _D_u_n_e { │ │ │ │ │ +38 // FORWARD DECLARATIONS │ │ │ │ │ +39 template │ │ │ │ │ +40 class SeqOverlappingSchwarz; │ │ │ │ │ +41 │ │ │ │ │ +42 template │ │ │ │ │ +43 struct SeqOverlappingSchwarzAssemblerHelper; │ │ │ │ │ 44 │ │ │ │ │ -_5_1 virtual void _a_p_p_l_y (X& v, const Y& d) =0; │ │ │ │ │ +45 // wrapper class for C-Function Calls in the backend. Choose the right │ │ │ │ │ +function namespace │ │ │ │ │ +46 // depending on the template parameter used. │ │ │ │ │ +47 template │ │ │ │ │ +_4_8 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ +49 { │ │ │ │ │ +_5_0 static constexpr bool _v_a_l_i_d = false ; │ │ │ │ │ +51 }; │ │ │ │ │ 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 │ │ │ │ │ -76 template │ │ │ │ │ -_7_7 class _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -78 : public _I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r{ │ │ │ │ │ -79 public: │ │ │ │ │ -_8_1 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_8_2 typedef typename std::remove_const::type _r_i_l_u___t_y_p_e; │ │ │ │ │ -_8_4 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_8_6 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -87 │ │ │ │ │ -88 │ │ │ │ │ -_9_3 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -94 { │ │ │ │ │ -95 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e(this->_I_L_U,v,d); │ │ │ │ │ -96 } │ │ │ │ │ -104 template │ │ │ │ │ -105 void _s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowset); │ │ │ │ │ -106 │ │ │ │ │ -107 }; │ │ │ │ │ -108 │ │ │ │ │ -109 template │ │ │ │ │ -_1_1_0 class _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -111 : public _I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r{ │ │ │ │ │ -112 public: │ │ │ │ │ -_1_1_4 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_1_1_5 typedef typename std::remove_const::type _r_i_l_u___t_y_p_e; │ │ │ │ │ -_1_1_7 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_1_1_9 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -120 │ │ │ │ │ -_1_2_5 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -126 { │ │ │ │ │ -127 _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) │ │ │ │ │ +53 template<> │ │ │ │ │ +_5_4 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ +55 { │ │ │ │ │ +_5_6 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ │ +57 │ │ │ │ │ +58 template │ │ │ │ │ +_5_9 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ │ +60 { │ │ │ │ │ +61 umfpack_dl_defaults(args...); │ │ │ │ │ +62 } │ │ │ │ │ +63 template │ │ │ │ │ +_6_4 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ +65 { │ │ │ │ │ +66 umfpack_dl_free_numeric(args...); │ │ │ │ │ +67 } │ │ │ │ │ +68 template │ │ │ │ │ +_6_9 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ │ +70 { │ │ │ │ │ +71 umfpack_dl_free_symbolic(args...); │ │ │ │ │ +72 } │ │ │ │ │ +73 template │ │ │ │ │ +_7_4 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ │ +75 { │ │ │ │ │ +76 return umfpack_dl_load_numeric(args...); │ │ │ │ │ +77 } │ │ │ │ │ +78 template │ │ │ │ │ +_7_9 static void _n_u_m_e_r_i_c(A... args) │ │ │ │ │ +80 { │ │ │ │ │ +81 umfpack_dl_numeric(args...); │ │ │ │ │ +82 } │ │ │ │ │ +83 template │ │ │ │ │ +_8_4 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ │ +85 { │ │ │ │ │ +86 umfpack_dl_report_info(args...); │ │ │ │ │ +87 } │ │ │ │ │ +88 template │ │ │ │ │ +_8_9 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ │ +90 { │ │ │ │ │ +91 umfpack_dl_report_status(args...); │ │ │ │ │ +92 } │ │ │ │ │ +93 template │ │ │ │ │ +_9_4 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ +95 { │ │ │ │ │ +96 return umfpack_dl_save_numeric(args...); │ │ │ │ │ +97 } │ │ │ │ │ +98 template │ │ │ │ │ +_9_9 static void _s_o_l_v_e(A... args) │ │ │ │ │ +100 { │ │ │ │ │ +101 umfpack_dl_solve(args...); │ │ │ │ │ +102 } │ │ │ │ │ +103 template │ │ │ │ │ +_1_0_4 static void _s_y_m_b_o_l_i_c(A... args) │ │ │ │ │ +105 { │ │ │ │ │ +106 umfpack_dl_symbolic(args...); │ │ │ │ │ +107 } │ │ │ │ │ +108 }; │ │ │ │ │ +109 │ │ │ │ │ +110 template<> │ │ │ │ │ +_1_1_1 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 > │ │ │ │ │ +112 { │ │ │ │ │ +_1_1_3 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ │ +114 │ │ │ │ │ +115 template │ │ │ │ │ +_1_1_6 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ │ +117 { │ │ │ │ │ +118 umfpack_zl_defaults(args...); │ │ │ │ │ +119 } │ │ │ │ │ +120 template │ │ │ │ │ +_1_2_1 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ +122 { │ │ │ │ │ +123 umfpack_zl_free_numeric(args...); │ │ │ │ │ +124 } │ │ │ │ │ +125 template │ │ │ │ │ +_1_2_6 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ │ +127 { │ │ │ │ │ +128 umfpack_zl_free_symbolic(args...); │ │ │ │ │ +129 } │ │ │ │ │ +130 template │ │ │ │ │ +_1_3_1 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ │ +132 { │ │ │ │ │ +133 return umfpack_zl_load_numeric(args...); │ │ │ │ │ +134 } │ │ │ │ │ +135 template │ │ │ │ │ +_1_3_6 static void _n_u_m_e_r_i_c(const long int* cs, const long int* ri, const double* │ │ │ │ │ +val, A... args) │ │ │ │ │ +137 { │ │ │ │ │ +138 umfpack_zl_numeric(cs,ri,val,NULL,args...); │ │ │ │ │ +139 } │ │ │ │ │ +140 template │ │ │ │ │ +_1_4_1 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ │ +142 { │ │ │ │ │ +143 umfpack_zl_report_info(args...); │ │ │ │ │ +144 } │ │ │ │ │ +145 template │ │ │ │ │ +_1_4_6 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ │ +147 { │ │ │ │ │ +148 umfpack_zl_report_status(args...); │ │ │ │ │ +149 } │ │ │ │ │ +150 template │ │ │ │ │ +_1_5_1 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ 152 { │ │ │ │ │ -153 // Calculate consecutive indices for local problem │ │ │ │ │ -154 // while perserving the ordering │ │ │ │ │ -155 typedef typename M::size_type size_type; │ │ │ │ │ -156 typedef std::map IndexMap; │ │ │ │ │ -157 typedef typename IndexMap::iterator IMIter; │ │ │ │ │ -158 IndexMap indexMap; │ │ │ │ │ -159 IMIter guess = indexMap.begin(); │ │ │ │ │ -160 size_type localIndex=0; │ │ │ │ │ -161 │ │ │ │ │ -162 typedef typename S::const_iterator SIter; │ │ │ │ │ -163 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ │ -164 rowIdx!= rowEnd; ++rowIdx, ++localIndex) │ │ │ │ │ -165 guess = indexMap.insert(guess, │ │ │ │ │ -166 std::make_pair(*rowIdx,localIndex)); │ │ │ │ │ +153 return umfpack_zl_save_numeric(args...); │ │ │ │ │ +154 } │ │ │ │ │ +155 template │ │ │ │ │ +_1_5_6 static void _s_o_l_v_e(long int m, const long int* cs, const long int* ri, std:: │ │ │ │ │ +complex* val, double* x, const double* b,A... args) │ │ │ │ │ +157 { │ │ │ │ │ +158 const double* cval = reinterpret_cast(val); │ │ │ │ │ +159 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...); │ │ │ │ │ +160 } │ │ │ │ │ +161 template │ │ │ │ │ +_1_6_2 static void _s_y_m_b_o_l_i_c(long int m, long int n, const long int* cs, const long │ │ │ │ │ +int* ri, const double* val, A... args) │ │ │ │ │ +163 { │ │ │ │ │ +164 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...); │ │ │ │ │ +165 } │ │ │ │ │ +166 }; │ │ │ │ │ 167 │ │ │ │ │ -168 │ │ │ │ │ -169 // Build Matrix for local subproblem │ │ │ │ │ -170 ILU.setSize(rowSet.size(),rowSet.size()); │ │ │ │ │ -171 ILU.setBuildMode(matrix_type::row_wise); │ │ │ │ │ -172 │ │ │ │ │ -173 // Create sparsity pattern │ │ │ │ │ -174 typedef typename matrix_type::CreateIterator CIter; │ │ │ │ │ -175 CIter rowCreator = ILU.createbegin(); │ │ │ │ │ -176 std::size_t offset=0; │ │ │ │ │ -177 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ │ -178 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) { │ │ │ │ │ -179 // See which row entries are in our subset and add them to │ │ │ │ │ -180 // the sparsity pattern │ │ │ │ │ -181 guess = indexMap.begin(); │ │ │ │ │ -182 │ │ │ │ │ -183 for(typename matrix_type::ConstColIterator _c_o_l=A[*rowIdx].begin(), │ │ │ │ │ -184 endcol=A[*rowIdx]._e_n_d(); _c_o_l != endcol; ++_c_o_l) { │ │ │ │ │ -185 // search for the entry in the row set │ │ │ │ │ -186 guess = indexMap.find(_c_o_l.index()); │ │ │ │ │ -187 if(guess!=indexMap.end()) { │ │ │ │ │ -188 // add local index to row │ │ │ │ │ -189 rowCreator.insert(guess->second); │ │ │ │ │ -190 offset=std::max(offset,(std::size_t)std::abs((int)(guess->second- │ │ │ │ │ -rowCreator.index()))); │ │ │ │ │ -191 } │ │ │ │ │ -192 } │ │ │ │ │ -193 │ │ │ │ │ -194 } │ │ │ │ │ -195 │ │ │ │ │ -196 // Insert the matrix values for the local problem │ │ │ │ │ -197 typename matrix_type::iterator iluRow=ILU.begin(); │ │ │ │ │ -198 │ │ │ │ │ -199 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ │ -200 rowIdx!= rowEnd; ++rowIdx, ++iluRow) { │ │ │ │ │ -201 // See which row entries are in our subset and add them to │ │ │ │ │ -202 // the sparsity pattern │ │ │ │ │ -203 typename matrix_type::ColIterator localCol=iluRow->begin(); │ │ │ │ │ -204 for(typename matrix_type::ConstColIterator _c_o_l=A[*rowIdx].begin(), │ │ │ │ │ -205 endcol=A[*rowIdx]._e_n_d(); _c_o_l != endcol; ++_c_o_l) { │ │ │ │ │ -206 // search for the entry in the row set │ │ │ │ │ -207 guess = indexMap.find(_c_o_l.index()); │ │ │ │ │ -208 if(guess!=indexMap.end()) { │ │ │ │ │ -209 // set local value │ │ │ │ │ -210 (*localCol)=(*col); │ │ │ │ │ -211 ++localCol; │ │ │ │ │ -212 } │ │ │ │ │ -213 } │ │ │ │ │ -214 } │ │ │ │ │ -215 return offset; │ │ │ │ │ -216 } │ │ │ │ │ +168 namespace Impl │ │ │ │ │ +169 { │ │ │ │ │ +170 template │ │ │ │ │ +171 struct UMFPackVectorChooser │ │ │ │ │ +172 {}; │ │ │ │ │ +173 │ │ │ │ │ +174 template │ │ │ │ │ +175 struct UMFPackVectorChooser,A > > │ │ │ │ │ +176 { │ │ │ │ │ +178 using domain_type = BlockVector< │ │ │ │ │ +179 FieldVector, │ │ │ │ │ +180 typename std::allocator_traits::template rebind_alloc > │ │ │ │ │ +>; │ │ │ │ │ +182 using range_type = BlockVector< │ │ │ │ │ +183 FieldVector, │ │ │ │ │ +184 typename std::allocator_traits::template rebind_alloc > │ │ │ │ │ +>; │ │ │ │ │ +185 }; │ │ │ │ │ +186 │ │ │ │ │ +187 template │ │ │ │ │ +188 struct UMFPackVectorChooser > │ │ │ │ │ +189 { │ │ │ │ │ +191 using domain_type = BlockVector; │ │ │ │ │ +193 using range_type = BlockVector; │ │ │ │ │ +194 }; │ │ │ │ │ +195 } │ │ │ │ │ +196 │ │ │ │ │ +210 template │ │ │ │ │ +_2_1_1 class _U_M_F_P_a_c_k │ │ │ │ │ +212 : public _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< │ │ │ │ │ +213 typename Impl::UMFPackVectorChooser::domain_type, │ │ │ │ │ +214 typename Impl::UMFPackVectorChooser::range_type > │ │ │ │ │ +215 { │ │ │ │ │ +216 using T = typename M::field_type; │ │ │ │ │ 217 │ │ │ │ │ -218 │ │ │ │ │ -219 template │ │ │ │ │ -220 template │ │ │ │ │ -_2_2_1 void _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_M_,_X_,_Y_>_:_:_s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowSet) │ │ │ │ │ -222 { │ │ │ │ │ -223 this->copyToLocalMatrix(A,rowSet); │ │ │ │ │ -224 _I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n(this->ILU); │ │ │ │ │ -225 } │ │ │ │ │ -226 │ │ │ │ │ -227 template │ │ │ │ │ -228 template │ │ │ │ │ -_2_2_9 void _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_M_,_X_,_Y_>_:_:_s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowSet) │ │ │ │ │ -230 { │ │ │ │ │ -231 std::size_t offset=copyToLocalMatrix(A,rowSet); │ │ │ │ │ -232 RILU.setSize(rowSet.size(),rowSet.size(), (1+2*offset)*rowSet.size()); │ │ │ │ │ -233 RILU.setBuildMode(matrix_type::row_wise); │ │ │ │ │ -234 _I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n(this->ILU, (offset+1)/2, RILU); │ │ │ │ │ +218 public: │ │ │ │ │ +_2_2_0 using _M_a_t_r_i_x = M; │ │ │ │ │ +_2_2_1 using _m_a_t_r_i_x___t_y_p_e = M; │ │ │ │ │ +_2_2_3 typedef ISTL::Impl::BCCSMatrix │ │ │ │ │ +_U_M_F_P_a_c_k_M_a_t_r_i_x; │ │ │ │ │ +_2_2_5 typedef ISTL::Impl::BCCSMatrixInitializer _M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ │ +_2_2_7 using _d_o_m_a_i_n___t_y_p_e = typename Impl::UMFPackVectorChooser::domain_type; │ │ │ │ │ +_2_2_9 using _r_a_n_g_e___t_y_p_e = typename Impl::UMFPackVectorChooser::range_type; │ │ │ │ │ +230 │ │ │ │ │ +_2_3_2 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +233 { │ │ │ │ │ +234 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; │ │ │ │ │ 235 } │ │ │ │ │ 236 │ │ │ │ │ -238} // end name space DUNE │ │ │ │ │ -239 │ │ │ │ │ -240 │ │ │ │ │ -241#endif │ │ │ │ │ -_m_a_t_r_i_x_._h_h │ │ │ │ │ -A dynamic dense block matrix class. │ │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ -Define general preconditioner interface. │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_c_o_p_y_T_o_L_o_c_a_l_M_a_t_r_i_x │ │ │ │ │ -std::size_t copyToLocalMatrix(const M &A, S &rowset) │ │ │ │ │ -Copy the local part of the global matrix to ILU. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:151 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ -void setSubMatrix(const M &A, S &rowset) │ │ │ │ │ -Set the data of the local problem. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:229 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ -void setSubMatrix(const M &A, S &rowset) │ │ │ │ │ -Set the data of the local problem. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:221 │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ +_2_4_5 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose=0) : matrixIsLoaded_(false) │ │ │ │ │ +246 { │ │ │ │ │ +247 //check whether T is a supported type │ │ │ │ │ +248 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ +249 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ +supported)"); │ │ │ │ │ +250 Caller::defaults(UMF_Control); │ │ │ │ │ +251 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ +252 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ │ +253 } │ │ │ │ │ +254 │ │ │ │ │ +_2_6_3 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose, bool) : matrixIsLoaded_(false) │ │ │ │ │ +264 { │ │ │ │ │ +265 //check whether T is a supported type │ │ │ │ │ +266 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ +267 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ +supported)"); │ │ │ │ │ +268 Caller::defaults(UMF_Control); │ │ │ │ │ +269 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ +270 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ │ +271 } │ │ │ │ │ +272 │ │ │ │ │ +_2_8_2 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const ParameterTree& config) │ │ │ │ │ +283 : _U_M_F_P_a_c_k(mat_, config._g_e_t("verbose", 0)) │ │ │ │ │ +284 {} │ │ │ │ │ +285 │ │ │ │ │ +_2_8_8 _U_M_F_P_a_c_k() : matrixIsLoaded_(false), verbosity_(0) │ │ │ │ │ +289 { │ │ │ │ │ +290 //check whether T is a supported type │ │ │ │ │ +291 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ +292 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ +supported)"); │ │ │ │ │ +293 Caller::defaults(UMF_Control); │ │ │ │ │ +294 } │ │ │ │ │ +295 │ │ │ │ │ +_3_0_6 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const char* file, int verbose=0) │ │ │ │ │ +307 { │ │ │ │ │ +308 //check whether T is a supported type │ │ │ │ │ +309 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ +310 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ +supported)"); │ │ │ │ │ +311 Caller::defaults(UMF_Control); │ │ │ │ │ +312 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ +313 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ │ +314 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == │ │ │ │ │ +UMFPACK_ERROR_file_IO)) │ │ │ │ │ +315 { │ │ │ │ │ +316 matrixIsLoaded_ = false; │ │ │ │ │ +317 _s_e_t_M_a_t_r_i_x(mat_); │ │ │ │ │ +318 _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(file); │ │ │ │ │ +319 } │ │ │ │ │ +320 else │ │ │ │ │ +321 { │ │ │ │ │ +322 matrixIsLoaded_ = true; │ │ │ │ │ +323 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ │ +std::endl; │ │ │ │ │ +324 } │ │ │ │ │ +325 } │ │ │ │ │ +326 │ │ │ │ │ +_3_3_3 _U_M_F_P_a_c_k(const char* file, int verbose=0) │ │ │ │ │ +334 { │ │ │ │ │ +335 //check whether T is a supported type │ │ │ │ │ +336 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ +337 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ +supported)"); │ │ │ │ │ +338 Caller::defaults(UMF_Control); │ │ │ │ │ +339 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ │ +340 if (errcode == UMFPACK_ERROR_out_of_memory) │ │ │ │ │ +341 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack │ │ │ │ │ +decomposition"); │ │ │ │ │ +342 if (errcode == UMFPACK_ERROR_file_IO) │ │ │ │ │ +343 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack │ │ │ │ │ +decomposition"); │ │ │ │ │ +344 matrixIsLoaded_ = true; │ │ │ │ │ +345 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ │ +std::endl; │ │ │ │ │ +346 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ +347 } │ │ │ │ │ +348 │ │ │ │ │ +_3_4_9 virtual _~_U_M_F_P_a_c_k() │ │ │ │ │ +350 { │ │ │ │ │ +351 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ │ +352 _f_r_e_e(); │ │ │ │ │ +353 } │ │ │ │ │ +354 │ │ │ │ │ +_3_5_8 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ │ +res) │ │ │ │ │ +359 { │ │ │ │ │ +360 if (umfpackMatrix_.N() != b.dim()) │ │ │ │ │ +361 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!"); │ │ │ │ │ +362 if (umfpackMatrix_.M() != x.dim()) │ │ │ │ │ +363 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!"); │ │ │ │ │ +364 if (b.size() == 0) │ │ │ │ │ +365 return; │ │ │ │ │ +366 │ │ │ │ │ +367 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ │ +368 Caller::solve(UMFPACK_A, │ │ │ │ │ +369 umfpackMatrix_.getColStart(), │ │ │ │ │ +370 umfpackMatrix_.getRowIndex(), │ │ │ │ │ +371 umfpackMatrix_.getValues(), │ │ │ │ │ +372 reinterpret_cast(&x[0]), │ │ │ │ │ +373 reinterpret_cast(&b[0]), │ │ │ │ │ +374 UMF_Numeric, │ │ │ │ │ +375 UMF_Control, │ │ │ │ │ +376 UMF_Apply_Info); │ │ │ │ │ +377 │ │ │ │ │ +378 //this is a direct solver │ │ │ │ │ +379 res._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ │ +380 res._c_o_n_v_e_r_g_e_d = true; │ │ │ │ │ +381 res._e_l_a_p_s_e_d = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME]; │ │ │ │ │ +382 │ │ │ │ │ +383 printOnApply(UMF_Apply_Info); │ │ │ │ │ +384 } │ │ │ │ │ +385 │ │ │ │ │ +_3_8_9 virtual void _a_p_p_l_y (_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, [[maybe_unused]] double │ │ │ │ │ +reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ │ +390 { │ │ │ │ │ +391 _a_p_p_l_y(x,b,res); │ │ │ │ │ +392 } │ │ │ │ │ +393 │ │ │ │ │ +_3_9_9 void _a_p_p_l_y(T* x, T* b) │ │ │ │ │ +400 { │ │ │ │ │ +401 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ │ +402 Caller::solve(UMFPACK_A, │ │ │ │ │ +403 umfpackMatrix_.getColStart(), │ │ │ │ │ +404 umfpackMatrix_.getRowIndex(), │ │ │ │ │ +405 umfpackMatrix_.getValues(), │ │ │ │ │ +406 x, │ │ │ │ │ +407 b, │ │ │ │ │ +408 UMF_Numeric, │ │ │ │ │ +409 UMF_Control, │ │ │ │ │ +410 UMF_Apply_Info); │ │ │ │ │ +411 printOnApply(UMF_Apply_Info); │ │ │ │ │ +412 } │ │ │ │ │ +413 │ │ │ │ │ +_4_2_5 void _s_e_t_O_p_t_i_o_n(unsigned int option, double value) │ │ │ │ │ +426 { │ │ │ │ │ +427 if (option >= UMFPACK_CONTROL) │ │ │ │ │ +428 DUNE_THROW(RangeError, "Requested non-existing UMFPack option"); │ │ │ │ │ +429 │ │ │ │ │ +430 UMF_Control[option] = value; │ │ │ │ │ +431 } │ │ │ │ │ +432 │ │ │ │ │ +_4_3_6 void _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(const char* file) │ │ │ │ │ +437 { │ │ │ │ │ +438 int errcode = Caller::save_numeric(UMF_Numeric, const_cast(file)); │ │ │ │ │ +439 if (errcode != UMFPACK_OK) │ │ │ │ │ +440 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack │ │ │ │ │ +decomposition"); │ │ │ │ │ +441 } │ │ │ │ │ +442 │ │ │ │ │ +_4_4_4 void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& matrix) │ │ │ │ │ +445 { │ │ │ │ │ +446 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ │ +447 _f_r_e_e(); │ │ │ │ │ +448 if (matrix.N() == 0 or matrix.M() == 0) │ │ │ │ │ +449 return; │ │ │ │ │ +450 │ │ │ │ │ +451 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ │ +0) │ │ │ │ │ +452 umfpackMatrix_.free(); │ │ │ │ │ +453 umfpackMatrix_.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), │ │ │ │ │ +454 _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)); │ │ │ │ │ +455 ISTL::Impl::BCCSMatrixInitializer initializer │ │ │ │ │ +(umfpackMatrix_); │ │ │ │ │ +456 │ │ │ │ │ +457 copyToBCCSMatrix(initializer, matrix); │ │ │ │ │ +458 │ │ │ │ │ +459 decompose(); │ │ │ │ │ +460 } │ │ │ │ │ +461 │ │ │ │ │ +462 template │ │ │ │ │ +_4_6_3 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& _mat, const S& rowIndexSet) │ │ │ │ │ +464 { │ │ │ │ │ +465 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ │ +466 _f_r_e_e(); │ │ │ │ │ +467 │ │ │ │ │ +468 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ │ +0) │ │ │ │ │ +469 umfpackMatrix_.free(); │ │ │ │ │ +470 │ │ │ │ │ +471 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(), │ │ │ │ │ +472 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()); │ │ │ │ │ +473 ISTL::Impl::BCCSMatrixInitializer initializer │ │ │ │ │ +(umfpackMatrix_); │ │ │ │ │ +474 │ │ │ │ │ +475 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ │ +set >(_mat,rowIndexSet)); │ │ │ │ │ +476 │ │ │ │ │ +477 decompose(); │ │ │ │ │ +478 } │ │ │ │ │ +479 │ │ │ │ │ +_4_8_7 void _s_e_t_V_e_r_b_o_s_i_t_y(int v) │ │ │ │ │ +488 { │ │ │ │ │ +489 verbosity_ = v; │ │ │ │ │ +490 // set the verbosity level in UMFPack │ │ │ │ │ +491 if (verbosity_ == 0) │ │ │ │ │ +492 UMF_Control[UMFPACK_PRL] = 1; │ │ │ │ │ +493 if (verbosity_ == 1) │ │ │ │ │ +494 UMF_Control[UMFPACK_PRL] = 2; │ │ │ │ │ +495 if (verbosity_ == 2) │ │ │ │ │ +496 UMF_Control[UMFPACK_PRL] = 4; │ │ │ │ │ +497 } │ │ │ │ │ +498 │ │ │ │ │ +_5_0_3 void* _g_e_t_F_a_c_t_o_r_i_z_a_t_i_o_n() │ │ │ │ │ +504 { │ │ │ │ │ +505 return UMF_Numeric; │ │ │ │ │ +506 } │ │ │ │ │ +507 │ │ │ │ │ +_5_1_2 _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() │ │ │ │ │ +513 { │ │ │ │ │ +514 return umfpackMatrix_; │ │ │ │ │ +515 } │ │ │ │ │ +516 │ │ │ │ │ +_5_2_1 void _f_r_e_e() │ │ │ │ │ +522 { │ │ │ │ │ +523 if (!matrixIsLoaded_) │ │ │ │ │ +524 { │ │ │ │ │ +525 Caller::free_symbolic(&UMF_Symbolic); │ │ │ │ │ +526 umfpackMatrix_.free(); │ │ │ │ │ +527 } │ │ │ │ │ +528 Caller::free_numeric(&UMF_Numeric); │ │ │ │ │ +529 matrixIsLoaded_ = false; │ │ │ │ │ +530 } │ │ │ │ │ +531 │ │ │ │ │ +_5_3_2 const char* _n_a_m_e() { return "UMFPACK"; } │ │ │ │ │ +533 │ │ │ │ │ +534 private: │ │ │ │ │ +535 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; │ │ │ │ │ +536 │ │ │ │ │ +537 template │ │ │ │ │ +_5_3_8 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ │ +539 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>; │ │ │ │ │ +540 │ │ │ │ │ +542 void decompose() │ │ │ │ │ +543 { │ │ │ │ │ +544 double UMF_Decomposition_Info[UMFPACK_INFO]; │ │ │ │ │ +545 Caller::symbolic(static_cast(umfpackMatrix_.N()), │ │ │ │ │ +546 static_cast(umfpackMatrix_.N()), │ │ │ │ │ +547 umfpackMatrix_.getColStart(), │ │ │ │ │ +548 umfpackMatrix_.getRowIndex(), │ │ │ │ │ +549 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ │ +550 &UMF_Symbolic, │ │ │ │ │ +551 UMF_Control, │ │ │ │ │ +552 UMF_Decomposition_Info); │ │ │ │ │ +553 Caller::numeric(umfpackMatrix_.getColStart(), │ │ │ │ │ +554 umfpackMatrix_.getRowIndex(), │ │ │ │ │ +555 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ │ +556 UMF_Symbolic, │ │ │ │ │ +557 &UMF_Numeric, │ │ │ │ │ +558 UMF_Control, │ │ │ │ │ +559 UMF_Decomposition_Info); │ │ │ │ │ +560 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]); │ │ │ │ │ +561 if (verbosity_ == 1) │ │ │ │ │ +562 { │ │ │ │ │ +563 std::cout << "[UMFPack Decomposition]" << std::endl; │ │ │ │ │ +564 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info │ │ │ │ │ +[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info │ │ │ │ │ +[UMFPACK_NUMERIC_TIME] << ")" << std::endl; │ │ │ │ │ +565 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << │ │ │ │ │ +std::endl; │ │ │ │ │ +566 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info │ │ │ │ │ +[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" │ │ │ │ │ +<< std::endl; │ │ │ │ │ +567 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info │ │ │ │ │ +[UMFPACK_RCOND] << std::endl; │ │ │ │ │ +568 std::cout << "Numbers of non-zeroes in decomposition: L: " << │ │ │ │ │ +UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info │ │ │ │ │ +[UMFPACK_UNZ] << std::endl; │ │ │ │ │ +569 } │ │ │ │ │ +570 if (verbosity_ == 2) │ │ │ │ │ +571 { │ │ │ │ │ +572 Caller::report_info(UMF_Control,UMF_Decomposition_Info); │ │ │ │ │ +573 } │ │ │ │ │ +574 } │ │ │ │ │ +575 │ │ │ │ │ +576 void printOnApply(double* UMF_Info) │ │ │ │ │ +577 { │ │ │ │ │ +578 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]); │ │ │ │ │ +579 if (verbosity_ > 0) │ │ │ │ │ +580 { │ │ │ │ │ +581 std::cout << "[UMFPack Solve]" << std::endl; │ │ │ │ │ +582 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " │ │ │ │ │ +(CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl; │ │ │ │ │ +583 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl; │ │ │ │ │ +584 std::cout << "Iterative Refinement steps taken: " << UMF_Info │ │ │ │ │ +[UMFPACK_IR_TAKEN] << std::endl; │ │ │ │ │ +585 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << │ │ │ │ │ +UMF_Info[UMFPACK_OMEGA2] << std::endl; │ │ │ │ │ +586 } │ │ │ │ │ +587 } │ │ │ │ │ +588 │ │ │ │ │ +589 _U_M_F_P_a_c_k_M_a_t_r_i_x umfpackMatrix_; │ │ │ │ │ +590 bool matrixIsLoaded_; │ │ │ │ │ +591 int verbosity_; │ │ │ │ │ +592 void *UMF_Symbolic; │ │ │ │ │ +593 void *UMF_Numeric; │ │ │ │ │ +594 double UMF_Control[UMFPACK_CONTROL]; │ │ │ │ │ +595 }; │ │ │ │ │ +596 │ │ │ │ │ +597 template │ │ │ │ │ +_5_9_8 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r<_U_M_F_P_a_c_k<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A> > > │ │ │ │ │ +599 { │ │ │ │ │ +_6_0_0 enum { _v_a_l_u_e=true}; │ │ │ │ │ +601 }; │ │ │ │ │ +602 │ │ │ │ │ +603 template │ │ │ │ │ +_6_0_4 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 > > │ │ │ │ │ +605 { │ │ │ │ │ +_6_0_6 enum { _v_a_l_u_e = true }; │ │ │ │ │ +607 }; │ │ │ │ │ +608 │ │ │ │ │ +_6_0_9 struct _U_M_F_P_a_c_k_C_r_e_a_t_o_r { │ │ │ │ │ +_6_1_0 template struct _i_s_V_a_l_i_d_B_l_o_c_k : std::false_type{}; │ │ │ │ │ +_6_1_1 template struct _i_s_V_a_l_i_d_B_l_o_c_k::real_type,double>::value>> : std::true_type │ │ │ │ │ +{}; │ │ │ │ │ +612 │ │ │ │ │ +613 template │ │ │ │ │ +614 std::shared_ptr::type, │ │ │ │ │ +615 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ +_6_1_6 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& config, │ │ │ │ │ +617 std::enable_if_t< │ │ │ │ │ +618 _i_s_V_a_l_i_d_B_l_o_c_k::type::block_type>:: │ │ │ │ │ +value,int> = 0) const │ │ │ │ │ +619 { │ │ │ │ │ +620 int verbose = config.get("verbose", 0); │ │ │ │ │ +621 return std::make_shared>(_m_a_t,verbose); │ │ │ │ │ +622 } │ │ │ │ │ +623 │ │ │ │ │ +624 // second version with SFINAE to validate the template parameters of │ │ │ │ │ +UMFPack │ │ │ │ │ +625 template │ │ │ │ │ +626 std::shared_ptr::type, │ │ │ │ │ +627 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ +_6_2_8 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& / │ │ │ │ │ +*config*/, │ │ │ │ │ +629 std::enable_if_t< │ │ │ │ │ +630 !_i_s_V_a_l_i_d_B_l_o_c_k::type::block_type>:: │ │ │ │ │ +value,int> = 0) const │ │ │ │ │ +631 { │ │ │ │ │ +632 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ │ +633 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ +supported)"); │ │ │ │ │ +634 } │ │ │ │ │ +635 }; │ │ │ │ │ +_6_3_6 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("umfpack",_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r()); │ │ │ │ │ +637} // end namespace Dune │ │ │ │ │ +638 │ │ │ │ │ +639#endif // HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ +640 │ │ │ │ │ +641#endif //DUNE_ISTL_UMFPACK_HH │ │ │ │ │ +_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_s_o_l_v_e_r_s_._h_h │ │ │ │ │ +Implementations of the inverse operator interface. │ │ │ │ │ +_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_f_a_c_t_o_r_y_._h_h │ │ │ │ │ +_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ │ +#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_f_r_e_e │ │ │ │ │ +void free() │ │ │ │ │ +free allocated space. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:521 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res) │ │ │ │ │ +Apply inverse operator,. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:358 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the solver (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:232 │ │ │ │ │ +_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:221 │ │ │ │ │ +_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(long int m, const long int *cs, const long int *ri, std:: │ │ │ │ │ +complex< double > *val, double *x, const double *b, A... args) │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:156 │ │ │ │ │ +_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) │ │ │ │ │ +Initialize data from given matrix. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:444 │ │ │ │ │ +_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:141 │ │ │ │ │ +_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:282 │ │ │ │ │ +_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:131 │ │ │ │ │ +_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:74 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ +std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL │ │ │ │ │ +>::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const │ │ │ │ │ +M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< │ │ │ │ │ +typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) │ │ │ │ │ +const │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:616 │ │ │ │ │ +_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, long int > UMFPackMatrix │ │ │ │ │ +The corresponding UMFPack matrix type. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:223 │ │ │ │ │ +_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:89 │ │ │ │ │ +_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:306 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +typename Impl::UMFPackVectorChooser< M >::range_type range_type │ │ │ │ │ +The type of the range of the solver. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ │ +UMFPack() │ │ │ │ │ +default constructor │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:288 │ │ │ │ │ +_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:104 │ │ │ │ │ +_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:84 │ │ │ │ │ +_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(long int m, long int n, const long int *cs, const long int │ │ │ │ │ +*ri, const double *val, A... args) │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:162 │ │ │ │ │ +_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:69 │ │ │ │ │ +_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:151 │ │ │ │ │ +_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:121 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ +void setSubMatrix(const Matrix &_mat, const S &rowIndexSet) │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:463 │ │ │ │ │ +_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:94 │ │ │ │ │ +_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:146 │ │ │ │ │ +_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, long int > MatrixInitializer │ │ │ │ │ +Type of an associated initializer class. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:225 │ │ │ │ │ +_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:399 │ │ │ │ │ +_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:116 │ │ │ │ │ +_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:64 │ │ │ │ │ +_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:487 │ │ │ │ │ +_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:333 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_n_u_m_e_r_i_c │ │ │ │ │ +static void numeric(A... args) │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:79 │ │ │ │ │ +_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:50 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_~_U_M_F_P_a_c_k │ │ │ │ │ +virtual ~UMFPack() │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:349 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_n_a_m_e │ │ │ │ │ +const char * name() │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:532 │ │ │ │ │ +_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:436 │ │ │ │ │ +_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:512 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +typename Impl::UMFPackVectorChooser< M >::domain_type domain_type │ │ │ │ │ +The type of the domain of the solver. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:227 │ │ │ │ │ +_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:245 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ │ +InverseOperatorResult &res) │ │ │ │ │ +apply inverse operator, with given convergence criteria. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:389 │ │ │ │ │ +_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:425 │ │ │ │ │ +_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:126 │ │ │ │ │ +_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:220 │ │ │ │ │ +_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 long int *cs, const long int *ri, const double *val, │ │ │ │ │ +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_ _>_:_:_d_e_f_a_u_l_t_s │ │ │ │ │ +static void defaults(A... args) │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:59 │ │ │ │ │ +_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:99 │ │ │ │ │ +_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:263 │ │ │ │ │ +_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:503 │ │ │ │ │ +_m_a_t │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ │ -void blockILUBacksolve(const M &A, X &v, const Y &d) │ │ │ │ │ -LU backsolve with stored inverse. │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ -void blockILU0Decomposition(M &A) │ │ │ │ │ -compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ -void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -base class encapsulating common algorithms of ILU0SubdomainSolver and │ │ │ │ │ -ILUNSubdomainSolver. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_I_L_U │ │ │ │ │ -matrix_type ILU │ │ │ │ │ -The ILU0 decomposition of the matrix, or the local matrix. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_~_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -virtual ~ILUSubdomainSolver() │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -std::remove_const< M >::type matrix_type │ │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:39 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d)=0 │ │ │ │ │ -Apply the subdomain solver. │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -Exact subdomain solver using ILU(p) with appropriate p. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_i_l_u___t_y_p_e │ │ │ │ │ -std::remove_const< M >::type rilu_type │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -std::remove_const< M >::type matrix_type │ │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ │ -void apply(X &v, const Y &d) │ │ │ │ │ -Apply the subdomain solver. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:111 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:117 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -std::remove_const< M >::type matrix_type │ │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:114 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_i_l_u___t_y_p_e │ │ │ │ │ -std::remove_const< M >::type rilu_type │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ │ -void apply(X &v, const Y &d) │ │ │ │ │ -Apply the subdomain solver. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:125 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn ilusubdomainsolver.hh:119 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -RowIterator end() │ │ │ │ │ -Get iterator to one beyond last row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:620 │ │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ │ +PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ +VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ +Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ +DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ +derive error class from the base class in common │ │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ +Sequential overlapping Schwarz preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ │ +Statistics about the application of an inverse operator. │ │ │ │ │ +DDeeffiinniittiioonn solver.hh:48 │ │ │ │ │ +_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:82 │ │ │ │ │ +_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:67 │ │ │ │ │ +_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:73 │ │ │ │ │ +_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:99 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ +Category │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ │ +@ sequential │ │ │ │ │ +Category for sequential solvers. │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ │ +@ value │ │ │ │ │ +Whether this is a direct solver. │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ │ +@ value │ │ │ │ │ +whether the solver internally uses column compressed storage │ │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ │ +The UMFPack direct sparse solver. │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:215 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:609 │ │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k │ │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:610 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00194.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: scaledidmatrix.hh File Reference │ │ │ │ +dune-istl: matrixindexset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,48 +72,33 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
scaledidmatrix.hh File Reference
│ │ │ │ +
matrixindexset.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

This file implements a quadratic matrix of fixed size which is a multiple of the identity. │ │ │ │ -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 <vector>
│ │ │ │ +#include <set>
│ │ │ │
│ │ │ │

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::MatrixIndexSet
 Stores the nonzero entries in a sparse matrix. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

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

│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,36 +1,20 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ +matrixindexset.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ - class   _D_u_n_e_:_:_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_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ │ +  Stores the nonzero entries in a sparse matrix. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -This file implements a quadratic matrix of fixed size which is a multiple of │ │ │ │ │ -the identity. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00194_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: scaledidmatrix.hh Source File │ │ │ │ +dune-istl: matrixindexset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,626 +74,148 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
scaledidmatrix.hh
│ │ │ │ +
matrixindexset.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ISTL_MATRIXINDEXSET_HH
│ │ │ │ +
6#define DUNE_ISTL_MATRIXINDEXSET_HH
│ │ │ │
7
│ │ │ │ -
14#include <cmath>
│ │ │ │ -
15#include <cstddef>
│ │ │ │ -
16#include <complex>
│ │ │ │ -
17#include <iostream>
│ │ │ │ -
18#include <dune/common/exceptions.hh>
│ │ │ │ -
19#include <dune/common/fmatrix.hh>
│ │ │ │ -
20#include <dune/common/diagonalmatrix.hh>
│ │ │ │ -
21#include <dune/common/ftraits.hh>
│ │ │ │ -
22
│ │ │ │ -
23namespace Dune {
│ │ │ │ +
8#include <vector>
│ │ │ │ +
9#include <set>
│ │ │ │ +
10
│ │ │ │ +
11namespace Dune {
│ │ │ │ +
12
│ │ │ │ +
13
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
16 {
│ │ │ │ +
17
│ │ │ │ +
18 public:
│ │ │ │ +
19 typedef std::size_t size_type;
│ │ │ │ +
20
│ │ │ │ +
│ │ │ │ +
22 MatrixIndexSet() : rows_(0), cols_(0)
│ │ │ │ +
23 {}
│ │ │ │ +
│ │ │ │
24
│ │ │ │ -
28 template<class K, int n>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
30 {
│ │ │ │ -
31 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix<K,n> > WrapperType;
│ │ │ │ -
32
│ │ │ │ -
33 public:
│ │ │ │ -
34 //===== type definitions and constants
│ │ │ │ -
35
│ │ │ │ -
37 typedef K field_type;
│ │ │ │ -
38
│ │ │ │ -
40 typedef K block_type;
│ │ │ │ +
│ │ │ │ +
26 MatrixIndexSet(size_type rows, size_type cols) : rows_(rows), cols_(cols) {
│ │ │ │ +
27 indices_.resize(rows_);
│ │ │ │ +
28 }
│ │ │ │ +
│ │ │ │ +
29
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
32 rows_ = rows;
│ │ │ │ +
33 cols_ = cols;
│ │ │ │ +
34 indices_.resize(rows_);
│ │ │ │ +
35 }
│ │ │ │ +
│ │ │ │ +
36
│ │ │ │ +
│ │ │ │ +
38 void add(size_type i, size_type j) {
│ │ │ │ +
39 indices_[i].insert(j);
│ │ │ │ +
40 }
│ │ │ │ +
│ │ │ │
41
│ │ │ │ -
43 typedef std::size_t size_type;
│ │ │ │ -
44
│ │ │ │ -
46 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
47 static constexpr std::size_t blocklevel = 1;
│ │ │ │ -
48
│ │ │ │ -
50 typedef DiagonalRowVector<K,n> row_type;
│ │ │ │ - │ │ │ │ -
52 typedef DiagonalRowVectorConst<K,n> const_row_type;
│ │ │ │ - │ │ │ │ +
│ │ │ │ +
43 size_type size() const {
│ │ │ │ +
44 size_type entries = 0;
│ │ │ │ +
45 for (size_type i=0; i<rows_; i++)
│ │ │ │ +
46 entries += indices_[i].size();
│ │ │ │ +
47
│ │ │ │ +
48 return entries;
│ │ │ │ +
49 }
│ │ │ │ +
│ │ │ │ +
50
│ │ │ │ +
52 size_type rows() const {return rows_;}
│ │ │ │ +
53
│ │ │ │
54
│ │ │ │ -
56 enum {
│ │ │ │ -
58 rows = n,
│ │ │ │ -
60 cols = n
│ │ │ │ -
61 };
│ │ │ │ -
62
│ │ │ │ -
63 //===== constructors
│ │ │ │ - │ │ │ │ -
67
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
71 : p_(k)
│ │ │ │ -
72 {}
│ │ │ │ -
│ │ │ │ +
56 size_type rowsize(size_type row) const {return indices_[row].size();}
│ │ │ │ +
57
│ │ │ │ +
64 template <class MatrixType>
│ │ │ │ +
│ │ │ │ +
65 void import(const MatrixType& m, size_type rowOffset=0, size_type colOffset=0) {
│ │ │ │ +
66
│ │ │ │ +
67 typedef typename MatrixType::row_type RowType;
│ │ │ │ +
68 typedef typename RowType::ConstIterator ColumnIterator;
│ │ │ │ +
69
│ │ │ │ +
70 for (size_type rowIdx=0; rowIdx<m.N(); rowIdx++) {
│ │ │ │ +
71
│ │ │ │ +
72 const RowType& row = m[rowIdx];
│ │ │ │
73
│ │ │ │ -
74 //===== assignment from scalar
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
76 {
│ │ │ │ -
77 p_ = k;
│ │ │ │ -
78 return *this;
│ │ │ │ -
79 }
│ │ │ │ -
│ │ │ │ -
80
│ │ │ │ -
81 // check if matrix is identical to other matrix (not only identical values)
│ │ │ │ -
│ │ │ │ -
82 bool identical(const ScaledIdentityMatrix<K,n>& other) const
│ │ │ │ -
83 {
│ │ │ │ -
84 return (this==&other);
│ │ │ │ -
85 }
│ │ │ │ -
│ │ │ │ -
86
│ │ │ │ -
87 //===== iterator interface to rows of the matrix
│ │ │ │ -
89 typedef ContainerWrapperIterator<const WrapperType, reference, reference> Iterator;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
95 typedef typename row_type::Iterator ColIterator;
│ │ │ │ -
96
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
99 {
│ │ │ │ -
100 return Iterator(WrapperType(this),0);
│ │ │ │ -
101 }
│ │ │ │ -
│ │ │ │ -
102
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
105 {
│ │ │ │ -
106 return Iterator(WrapperType(this),n);
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
112 {
│ │ │ │ -
113 return Iterator(WrapperType(this),n-1);
│ │ │ │ -
114 }
│ │ │ │ -
│ │ │ │ +
74 ColumnIterator cIt = row.begin();
│ │ │ │ +
75 ColumnIterator cEndIt = row.end();
│ │ │ │ +
76
│ │ │ │ +
77 for(; cIt!=cEndIt; ++cIt)
│ │ │ │ +
78 add(rowIdx+rowOffset, cIt.index()+colOffset);
│ │ │ │ +
79
│ │ │ │ +
80 }
│ │ │ │ +
81
│ │ │ │ +
82 }
│ │ │ │ +
│ │ │ │ +
83
│ │ │ │ +
89 template <class MatrixType>
│ │ │ │ +
│ │ │ │ +
90 void exportIdx(MatrixType& matrix) const {
│ │ │ │ +
91
│ │ │ │ +
92 matrix.setSize(rows_, cols_);
│ │ │ │ +
93 matrix.setBuildMode(MatrixType::random);
│ │ │ │ +
94
│ │ │ │ +
95 for (size_type i=0; i<rows_; i++)
│ │ │ │ +
96 matrix.setrowsize(i, indices_[i].size());
│ │ │ │ +
97
│ │ │ │ +
98 matrix.endrowsizes();
│ │ │ │ +
99
│ │ │ │ +
100 for (size_type i=0; i<rows_; i++) {
│ │ │ │ +
101
│ │ │ │ +
102 typename std::set<size_type>::iterator it = indices_[i].begin();
│ │ │ │ +
103 for (; it!=indices_[i].end(); ++it)
│ │ │ │ +
104 matrix.addindex(i, *it);
│ │ │ │ +
105
│ │ │ │ +
106 }
│ │ │ │ +
107
│ │ │ │ +
108 matrix.endindices();
│ │ │ │ +
109
│ │ │ │ +
110 }
│ │ │ │ +
│ │ │ │ +
111
│ │ │ │ +
112 private:
│ │ │ │ +
113
│ │ │ │ +
114 std::vector<std::set<size_type> > indices_;
│ │ │ │
115
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
119 {
│ │ │ │ -
120 return Iterator(WrapperType(this),-1);
│ │ │ │ -
121 }
│ │ │ │ -
│ │ │ │ +
116 size_type rows_, cols_;
│ │ │ │ +
117
│ │ │ │ +
118 };
│ │ │ │ +
│ │ │ │ +
119
│ │ │ │ +
120
│ │ │ │ +
121} // end namespace Dune
│ │ │ │
122
│ │ │ │ -
123
│ │ │ │ -
125 typedef ContainerWrapperIterator<const WrapperType, const_reference, const_reference> ConstIterator;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
131 typedef typename const_row_type::ConstIterator ConstColIterator;
│ │ │ │ -
132
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
135 {
│ │ │ │ -
136 return ConstIterator(WrapperType(this),0);
│ │ │ │ -
137 }
│ │ │ │ -
│ │ │ │ -
138
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
141 {
│ │ │ │ -
142 return ConstIterator(WrapperType(this),n);
│ │ │ │ -
143 }
│ │ │ │ -
│ │ │ │ -
144
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
148 {
│ │ │ │ -
149 return ConstIterator(WrapperType(this),n-1);
│ │ │ │ -
150 }
│ │ │ │ -
│ │ │ │ -
151
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
155 {
│ │ │ │ -
156 return ConstIterator(WrapperType(this),-1);
│ │ │ │ -
157 }
│ │ │ │ -
│ │ │ │ -
158
│ │ │ │ -
159 //===== vector space arithmetic
│ │ │ │ -
160
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
163 {
│ │ │ │ -
164 p_ += y.p_;
│ │ │ │ -
165 return *this;
│ │ │ │ -
166 }
│ │ │ │ -
│ │ │ │ -
167
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
170 {
│ │ │ │ -
171 p_ -= y.p_;
│ │ │ │ -
172 return *this;
│ │ │ │ -
173 }
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
177 {
│ │ │ │ -
178 p_ += k;
│ │ │ │ -
179 return *this;
│ │ │ │ -
180 }
│ │ │ │ -
│ │ │ │ -
181
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
184 {
│ │ │ │ -
185 p_ -= k;
│ │ │ │ -
186 return *this;
│ │ │ │ -
187 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
190 {
│ │ │ │ -
191 p_ *= k;
│ │ │ │ -
192 return *this;
│ │ │ │ -
193 }
│ │ │ │ -
│ │ │ │ -
194
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
197 {
│ │ │ │ -
198 p_ /= k;
│ │ │ │ -
199 return *this;
│ │ │ │ -
200 }
│ │ │ │ -
│ │ │ │ -
201
│ │ │ │ -
202 //===== binary operators
│ │ │ │ -
203
│ │ │ │ -
205 template <class Scalar,
│ │ │ │ -
206 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ │ -
│ │ │ │ -
207 friend auto operator* ( const ScaledIdentityMatrix& matrix, Scalar scalar)
│ │ │ │ -
208 {
│ │ │ │ - │ │ │ │ -
210 }
│ │ │ │ -
│ │ │ │ -
211
│ │ │ │ -
213 template <class Scalar,
│ │ │ │ -
214 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ │ -
│ │ │ │ -
215 friend auto operator* (Scalar scalar, const ScaledIdentityMatrix& matrix)
│ │ │ │ -
216 {
│ │ │ │ - │ │ │ │ -
218 }
│ │ │ │ -
│ │ │ │ -
219
│ │ │ │ -
220 //===== comparison ops
│ │ │ │ -
221
│ │ │ │ -
│ │ │ │ -
223 bool operator==(const ScaledIdentityMatrix& other) const
│ │ │ │ -
224 {
│ │ │ │ -
225 return p_==other.scalar();
│ │ │ │ -
226 }
│ │ │ │ -
│ │ │ │ -
227
│ │ │ │ -
│ │ │ │ -
229 bool operator!=(const ScaledIdentityMatrix& other) const
│ │ │ │ -
230 {
│ │ │ │ -
231 return p_!=other.scalar();
│ │ │ │ -
232 }
│ │ │ │ -
│ │ │ │ -
233
│ │ │ │ -
234 //===== linear maps
│ │ │ │ -
235
│ │ │ │ -
237 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
238 void mv (const X& x, Y& y) const
│ │ │ │ -
239 {
│ │ │ │ -
240#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
241 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
242 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
243#endif
│ │ │ │ -
244 for (size_type i=0; i<n; ++i)
│ │ │ │ -
245 y[i] = p_ * x[i];
│ │ │ │ -
246 }
│ │ │ │ -
│ │ │ │ -
247
│ │ │ │ -
249 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
250 void mtv (const X& x, Y& y) const
│ │ │ │ -
251 {
│ │ │ │ -
252 mv(x, y);
│ │ │ │ -
253 }
│ │ │ │ -
│ │ │ │ -
254
│ │ │ │ -
256 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
257 void umv (const X& x, Y& y) const
│ │ │ │ -
258 {
│ │ │ │ -
259#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
260 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
261 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
262#endif
│ │ │ │ -
263 for (size_type i=0; i<n; ++i)
│ │ │ │ -
264 y[i] += p_ * x[i];
│ │ │ │ -
265 }
│ │ │ │ -
│ │ │ │ -
266
│ │ │ │ -
268 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
269 void umtv (const X& x, Y& y) const
│ │ │ │ -
270 {
│ │ │ │ -
271#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
272 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
273 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
274#endif
│ │ │ │ -
275 for (size_type i=0; i<n; ++i)
│ │ │ │ -
276 y[i] += p_ * x[i];
│ │ │ │ -
277 }
│ │ │ │ -
│ │ │ │ -
278
│ │ │ │ -
280 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
281 void umhv (const X& x, Y& y) const
│ │ │ │ -
282 {
│ │ │ │ -
283#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
284 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
285 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
286#endif
│ │ │ │ -
287 for (size_type i=0; i<n; i++)
│ │ │ │ -
288 y[i] += conjugateComplex(p_)*x[i];
│ │ │ │ -
289 }
│ │ │ │ -
│ │ │ │ -
290
│ │ │ │ -
292 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
293 void mmv (const X& x, Y& y) const
│ │ │ │ -
294 {
│ │ │ │ -
295#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
296 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
297 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
298#endif
│ │ │ │ -
299 for (size_type i=0; i<n; ++i)
│ │ │ │ -
300 y[i] -= p_ * x[i];
│ │ │ │ -
301 }
│ │ │ │ -
│ │ │ │ -
302
│ │ │ │ -
304 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
305 void mmtv (const X& x, Y& y) const
│ │ │ │ -
306 {
│ │ │ │ -
307#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
308 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
309 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
310#endif
│ │ │ │ -
311 for (size_type i=0; i<n; ++i)
│ │ │ │ -
312 y[i] -= p_ * x[i];
│ │ │ │ -
313 }
│ │ │ │ -
│ │ │ │ -
314
│ │ │ │ -
316 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
317 void mmhv (const X& x, Y& y) const
│ │ │ │ -
318 {
│ │ │ │ -
319#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
320 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
321 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
322#endif
│ │ │ │ -
323 for (size_type i=0; i<n; i++)
│ │ │ │ -
324 y[i] -= conjugateComplex(p_)*x[i];
│ │ │ │ -
325 }
│ │ │ │ -
│ │ │ │ -
326
│ │ │ │ -
328 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
329 void usmv (const K& alpha, const X& x, Y& y) const
│ │ │ │ -
330 {
│ │ │ │ -
331#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
332 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
333 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
334#endif
│ │ │ │ -
335 for (size_type i=0; i<n; i++)
│ │ │ │ -
336 y[i] += alpha * p_ * x[i];
│ │ │ │ -
337 }
│ │ │ │ -
│ │ │ │ -
338
│ │ │ │ -
340 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
341 void usmtv (const K& alpha, const X& x, Y& y) const
│ │ │ │ -
342 {
│ │ │ │ -
343#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
344 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
345 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
346#endif
│ │ │ │ -
347 for (size_type i=0; i<n; i++)
│ │ │ │ -
348 y[i] += alpha * p_ * x[i];
│ │ │ │ -
349 }
│ │ │ │ -
│ │ │ │ -
350
│ │ │ │ -
352 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
353 void usmhv (const K& alpha, const X& x, Y& y) const
│ │ │ │ -
354 {
│ │ │ │ -
355#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
356 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
357 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ -
358#endif
│ │ │ │ -
359 for (size_type i=0; i<n; i++)
│ │ │ │ -
360 y[i] += alpha * conjugateComplex(p_) * x[i];
│ │ │ │ -
361 }
│ │ │ │ -
│ │ │ │ -
362
│ │ │ │ -
363 //===== norms
│ │ │ │ -
364
│ │ │ │ -
│ │ │ │ -
366 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ -
367 {
│ │ │ │ -
368 return fvmeta::sqrt(n*p_*p_);
│ │ │ │ -
369 }
│ │ │ │ -
│ │ │ │ -
370
│ │ │ │ -
│ │ │ │ -
372 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ │ -
373 {
│ │ │ │ -
374 return n*p_*p_;
│ │ │ │ -
375 }
│ │ │ │ -
│ │ │ │ -
376
│ │ │ │ -
│ │ │ │ -
378 typename FieldTraits<field_type>::real_type infinity_norm () const
│ │ │ │ -
379 {
│ │ │ │ -
380 return std::abs(p_);
│ │ │ │ -
381 }
│ │ │ │ -
│ │ │ │ -
382
│ │ │ │ -
│ │ │ │ -
384 typename FieldTraits<field_type>::real_type infinity_norm_real () const
│ │ │ │ -
385 {
│ │ │ │ -
386 return fvmeta::absreal(p_);
│ │ │ │ -
387 }
│ │ │ │ -
│ │ │ │ -
388
│ │ │ │ -
389 //===== solve
│ │ │ │ -
390
│ │ │ │ -
393 template<class V>
│ │ │ │ -
│ │ │ │ -
394 void solve (V& x, const V& b) const
│ │ │ │ -
395 {
│ │ │ │ -
396 for (int i=0; i<n; i++)
│ │ │ │ -
397 x[i] = b[i]/p_;
│ │ │ │ -
398 }
│ │ │ │ -
│ │ │ │ -
399
│ │ │ │ -
│ │ │ │ -
402 void invert()
│ │ │ │ -
403 {
│ │ │ │ -
404 p_ = 1/p_;
│ │ │ │ -
405 }
│ │ │ │ -
│ │ │ │ -
406
│ │ │ │ -
│ │ │ │ -
408 K determinant () const {
│ │ │ │ -
409 return std::pow(p_,n);
│ │ │ │ -
410 }
│ │ │ │ -
│ │ │ │ -
411
│ │ │ │ -
412 //===== sizes
│ │ │ │ -
413
│ │ │ │ -
│ │ │ │ -
415 size_type N () const
│ │ │ │ -
416 {
│ │ │ │ -
417 return n;
│ │ │ │ -
418 }
│ │ │ │ -
│ │ │ │ -
419
│ │ │ │ -
│ │ │ │ -
421 size_type M () const
│ │ │ │ -
422 {
│ │ │ │ -
423 return n;
│ │ │ │ -
424 }
│ │ │ │ -
│ │ │ │ -
425
│ │ │ │ -
426 //===== query
│ │ │ │ -
427
│ │ │ │ -
│ │ │ │ -
429 bool exists (size_type i, size_type j) const
│ │ │ │ -
430 {
│ │ │ │ -
431#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ -
432 if (i<0 || i>=n) DUNE_THROW(FMatrixError,"row index out of range");
│ │ │ │ -
433 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range");
│ │ │ │ -
434#endif
│ │ │ │ -
435 return i==j;
│ │ │ │ -
436 }
│ │ │ │ -
│ │ │ │ -
437
│ │ │ │ -
438 //===== conversion operator
│ │ │ │ -
439
│ │ │ │ -
│ │ │ │ -
441 friend std::ostream& operator<< (std::ostream& s, const ScaledIdentityMatrix<K,n>& a)
│ │ │ │ -
442 {
│ │ │ │ -
443 for (size_type i=0; i<n; i++) {
│ │ │ │ -
444 for (size_type j=0; j<n; j++)
│ │ │ │ -
445 s << ((i==j) ? a.p_ : 0) << " ";
│ │ │ │ -
446 s << std::endl;
│ │ │ │ -
447 }
│ │ │ │ -
448 return s;
│ │ │ │ -
449 }
│ │ │ │ -
│ │ │ │ -
450
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
453 {
│ │ │ │ -
454 return reference(const_cast<K*>(&p_), i);
│ │ │ │ -
455 }
│ │ │ │ -
│ │ │ │ -
456
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
459 {
│ │ │ │ -
460 return const_reference(const_cast<K*>(&p_), i);
│ │ │ │ -
461 }
│ │ │ │ -
│ │ │ │ -
462
│ │ │ │ -
│ │ │ │ -
464 const K& diagonal(size_type /*i*/) const
│ │ │ │ -
465 {
│ │ │ │ -
466 return p_;
│ │ │ │ -
467 }
│ │ │ │ -
│ │ │ │ -
468
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
471 {
│ │ │ │ -
472 return p_;
│ │ │ │ -
473 }
│ │ │ │ -
│ │ │ │ -
474
│ │ │ │ -
│ │ │ │ -
477 const K& scalar() const
│ │ │ │ -
478 {
│ │ │ │ -
479 return p_;
│ │ │ │ -
480 }
│ │ │ │ -
│ │ │ │ -
481
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
485 {
│ │ │ │ -
486 return p_;
│ │ │ │ -
487 }
│ │ │ │ -
│ │ │ │ -
488
│ │ │ │ -
489 private:
│ │ │ │ -
490 // the data, very simply a single number
│ │ │ │ -
491 K p_;
│ │ │ │ -
492
│ │ │ │ -
493 };
│ │ │ │ -
│ │ │ │ -
494
│ │ │ │ -
495 template <class DenseMatrix, class field, int N>
│ │ │ │ -
│ │ │ │ -
496 struct DenseMatrixAssigner<DenseMatrix, ScaledIdentityMatrix<field, N>> {
│ │ │ │ -
│ │ │ │ -
497 static void apply(DenseMatrix& denseMatrix,
│ │ │ │ - │ │ │ │ -
499 assert(denseMatrix.M() == N);
│ │ │ │ -
500 assert(denseMatrix.N() == N);
│ │ │ │ -
501 denseMatrix = field(0);
│ │ │ │ -
502 for (int i = 0; i < N; ++i)
│ │ │ │ -
503 denseMatrix[i][i] = rhs.scalar();
│ │ │ │ -
504 }
│ │ │ │ -
│ │ │ │ -
505 };
│ │ │ │ -
│ │ │ │ -
506
│ │ │ │ -
507 template<class K, int n>
│ │ │ │ -
│ │ │ │ -
508 struct FieldTraits< ScaledIdentityMatrix<K, n> >
│ │ │ │ -
509 {
│ │ │ │ - │ │ │ │ -
511 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
512 };
│ │ │ │ -
│ │ │ │ -
513
│ │ │ │ -
514} // end namespace
│ │ │ │ -
515
│ │ │ │ -
516#endif
│ │ │ │ +
123#endif
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A multiple of the identity matrix of static size.
Definition scaledidmatrix.hh:30
│ │ │ │ -
void usmhv(const K &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition scaledidmatrix.hh:353
│ │ │ │ -
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition scaledidmatrix.hh:305
│ │ │ │ -
ScaledIdentityMatrix & operator-=(const ScaledIdentityMatrix &y)
vector space subtraction
Definition scaledidmatrix.hh:169
│ │ │ │ -
const_row_type::ConstIterator ConstColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:131
│ │ │ │ -
ConstIterator end() const
end iterator
Definition scaledidmatrix.hh:140
│ │ │ │ -
Iterator beforeBegin()
Definition scaledidmatrix.hh:118
│ │ │ │ -
bool operator!=(const ScaledIdentityMatrix &other) const
incomparison operator
Definition scaledidmatrix.hh:229
│ │ │ │ -
void mmv(const X &x, Y &y) const
y -= A x
Definition scaledidmatrix.hh:293
│ │ │ │ -
std::size_t size_type
The type used for the index access and size operations.
Definition scaledidmatrix.hh:43
│ │ │ │ -
void usmv(const K &alpha, const X &x, Y &y) const
y += alpha A x
Definition scaledidmatrix.hh:329
│ │ │ │ -
row_type::Iterator ColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:95
│ │ │ │ -
const_row_type const_reference
Definition scaledidmatrix.hh:53
│ │ │ │ -
void mv(const X &x, Y &y) const
y = A x
Definition scaledidmatrix.hh:238
│ │ │ │ -
void umtv(const X &x, Y &y) const
y += A^T x
Definition scaledidmatrix.hh:269
│ │ │ │ -
void umhv(const X &x, Y &y) const
y += A^H x
Definition scaledidmatrix.hh:281
│ │ │ │ -
DiagonalRowVector< K, n > row_type
Each row is implemented by a field vector.
Definition scaledidmatrix.hh:50
│ │ │ │ -
ContainerWrapperIterator< const WrapperType, reference, reference > Iterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:89
│ │ │ │ -
Iterator beforeEnd()
Definition scaledidmatrix.hh:111
│ │ │ │ -
K determinant() const
calculates the determinant of this matrix
Definition scaledidmatrix.hh:408
│ │ │ │ -
K field_type
export the type representing the field
Definition scaledidmatrix.hh:37
│ │ │ │ -
void usmtv(const K &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition scaledidmatrix.hh:341
│ │ │ │ -
Iterator end()
end iterator
Definition scaledidmatrix.hh:104
│ │ │ │ -
Iterator iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:91
│ │ │ │ -
const K & scalar() const
Get const reference to the scalar diagonal value.
Definition scaledidmatrix.hh:477
│ │ │ │ -
void umv(const X &x, Y &y) const
y += A x
Definition scaledidmatrix.hh:257
│ │ │ │ -
static constexpr std::size_t blocklevel
We are at the leaf of the block recursion.
Definition scaledidmatrix.hh:47
│ │ │ │ -
const K & diagonal(size_type) const
Get const reference to diagonal entry.
Definition scaledidmatrix.hh:464
│ │ │ │ -
@ rows
The number of rows.
Definition scaledidmatrix.hh:58
│ │ │ │ -
@ cols
The number of columns.
Definition scaledidmatrix.hh:60
│ │ │ │ -
ScaledIdentityMatrix & operator=(const K &k)
Definition scaledidmatrix.hh:75
│ │ │ │ -
ContainerWrapperIterator< const WrapperType, const_reference, const_reference > ConstIterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:125
│ │ │ │ -
K & diagonal(size_type)
Get reference to diagonal entry.
Definition scaledidmatrix.hh:470
│ │ │ │ -
void solve(V &x, const V &b) const
Solve system A x = b.
Definition scaledidmatrix.hh:394
│ │ │ │ -
bool exists(size_type i, size_type j) const
return true when (i,j) is in pattern
Definition scaledidmatrix.hh:429
│ │ │ │ -
Iterator RowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:93
│ │ │ │ -
ConstIterator const_iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:127
│ │ │ │ -
ScaledIdentityMatrix()
Default constructor.
Definition scaledidmatrix.hh:66
│ │ │ │ -
bool operator==(const ScaledIdentityMatrix &other) const
comparison operator
Definition scaledidmatrix.hh:223
│ │ │ │ -
ConstIterator beforeBegin() const
Definition scaledidmatrix.hh:154
│ │ │ │ -
ScaledIdentityMatrix & operator/=(const K &k)
vector space division by scalar
Definition scaledidmatrix.hh:196
│ │ │ │ -
friend std::ostream & operator<<(std::ostream &s, const ScaledIdentityMatrix< K, n > &a)
Sends the matrix to an output stream.
Definition scaledidmatrix.hh:441
│ │ │ │ -
FieldTraits< field_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition scaledidmatrix.hh:372
│ │ │ │ -
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition scaledidmatrix.hh:366
│ │ │ │ -
FieldTraits< field_type >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition scaledidmatrix.hh:378
│ │ │ │ -
ConstIterator ConstRowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:129
│ │ │ │ -
ConstIterator beforeEnd() const
Definition scaledidmatrix.hh:147
│ │ │ │ -
size_type M() const
number of blocks in column direction
Definition scaledidmatrix.hh:421
│ │ │ │ -
const_reference operator[](size_type i) const
Return const_reference object as row replacement.
Definition scaledidmatrix.hh:458
│ │ │ │ -
ScaledIdentityMatrix(const K &k)
Constructor initializing the whole matrix with a scalar.
Definition scaledidmatrix.hh:70
│ │ │ │ -
friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar)
vector space multiplication with scalar
Definition scaledidmatrix.hh:207
│ │ │ │ -
FieldTraits< field_type >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition scaledidmatrix.hh:384
│ │ │ │ -
ScaledIdentityMatrix & operator*=(const K &k)
vector space multiplication with scalar
Definition scaledidmatrix.hh:189
│ │ │ │ -
bool identical(const ScaledIdentityMatrix< K, n > &other) const
Definition scaledidmatrix.hh:82
│ │ │ │ -
void invert()
Compute inverse.
Definition scaledidmatrix.hh:402
│ │ │ │ -
Iterator begin()
begin iterator
Definition scaledidmatrix.hh:98
│ │ │ │ -
K & scalar()
Get reference to the scalar diagonal value.
Definition scaledidmatrix.hh:484
│ │ │ │ -
row_type reference
Definition scaledidmatrix.hh:51
│ │ │ │ -
K block_type
export the type representing the components
Definition scaledidmatrix.hh:40
│ │ │ │ -
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition scaledidmatrix.hh:317
│ │ │ │ -
ScaledIdentityMatrix & operator+=(const ScaledIdentityMatrix &y)
vector space addition
Definition scaledidmatrix.hh:162
│ │ │ │ -
DiagonalRowVectorConst< K, n > const_row_type
Definition scaledidmatrix.hh:52
│ │ │ │ -
void mtv(const X &x, Y &y) const
y = A^T x
Definition scaledidmatrix.hh:250
│ │ │ │ -
reference operator[](size_type i)
Return reference object as row replacement.
Definition scaledidmatrix.hh:452
│ │ │ │ -
ConstIterator begin() const
begin iterator
Definition scaledidmatrix.hh:134
│ │ │ │ -
size_type N() const
number of blocks in row direction
Definition scaledidmatrix.hh:415
│ │ │ │ -
static void apply(DenseMatrix &denseMatrix, ScaledIdentityMatrix< field, N > const &rhs)
Definition scaledidmatrix.hh:497
│ │ │ │ -
typename ScaledIdentityMatrix< K, n >::field_type field_type
Definition scaledidmatrix.hh:510
│ │ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition scaledidmatrix.hh:511
│ │ │ │ +
Stores the nonzero entries in a sparse matrix.
Definition matrixindexset.hh:16
│ │ │ │ +
void resize(size_type rows, size_type cols)
Reset the size of an index set.
Definition matrixindexset.hh:31
│ │ │ │ +
MatrixIndexSet()
Default constructor.
Definition matrixindexset.hh:22
│ │ │ │ +
void add(size_type i, size_type j)
Add an index to the index set.
Definition matrixindexset.hh:38
│ │ │ │ +
size_type rows() const
Return the number of rows.
Definition matrixindexset.hh:52
│ │ │ │ +
std::size_t size_type
Definition matrixindexset.hh:19
│ │ │ │ +
void exportIdx(MatrixType &matrix) const
Initializes a BCRSMatrix with the indices contained in this MatrixIndexSet.
Definition matrixindexset.hh:90
│ │ │ │ +
MatrixIndexSet(size_type rows, size_type cols)
Constructor setting the matrix size.
Definition matrixindexset.hh:26
│ │ │ │ +
size_type rowsize(size_type row) const
Return the number of entries in a given row.
Definition matrixindexset.hh:56
│ │ │ │ +
size_type size() const
Return the number of entries.
Definition matrixindexset.hh:43
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,718 +1,156 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -scaledidmatrix.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 (C) 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_ISTL_MATRIXINDEXSET_HH │ │ │ │ │ +6#define DUNE_ISTL_MATRIXINDEXSET_HH │ │ │ │ │ 7 │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22 │ │ │ │ │ -23namespace _D_u_n_e { │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e { │ │ │ │ │ +12 │ │ │ │ │ +13 │ │ │ │ │ +_1_5 class _M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ │ +16 { │ │ │ │ │ +17 │ │ │ │ │ +18 public: │ │ │ │ │ +_1_9 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +20 │ │ │ │ │ +_2_2 _M_a_t_r_i_x_I_n_d_e_x_S_e_t() : rows_(0), cols_(0) │ │ │ │ │ +23 {} │ │ │ │ │ 24 │ │ │ │ │ -28 template │ │ │ │ │ -_2_9 class _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ │ -30 { │ │ │ │ │ -31 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix > WrapperType; │ │ │ │ │ -32 │ │ │ │ │ -33 public: │ │ │ │ │ -34 //===== type definitions and constants │ │ │ │ │ -35 │ │ │ │ │ -_3_7 typedef K _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -38 │ │ │ │ │ -_4_0 typedef K _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +_2_6 _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 cols) : rows_(_r_o_w_s), cols_(cols) { │ │ │ │ │ +27 indices_.resize(rows_); │ │ │ │ │ +28 } │ │ │ │ │ +29 │ │ │ │ │ +_3_1 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 cols) { │ │ │ │ │ +32 rows_ = _r_o_w_s; │ │ │ │ │ +33 cols_ = cols; │ │ │ │ │ +34 indices_.resize(rows_); │ │ │ │ │ +35 } │ │ │ │ │ +36 │ │ │ │ │ +_3_8 void _a_d_d(_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e j) { │ │ │ │ │ +39 indices_[i].insert(j); │ │ │ │ │ +40 } │ │ │ │ │ 41 │ │ │ │ │ -_4_3 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ -44 │ │ │ │ │ -46 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]] │ │ │ │ │ -_4_7 static constexpr std::size_t _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ -48 │ │ │ │ │ -_5_0 typedef DiagonalRowVector _r_o_w___t_y_p_e; │ │ │ │ │ -_5_1 typedef _r_o_w___t_y_p_e _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -_5_2 typedef DiagonalRowVectorConst _c_o_n_s_t___r_o_w___t_y_p_e; │ │ │ │ │ -_5_3 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; │ │ │ │ │ +_4_3 _s_i_z_e___t_y_p_e _s_i_z_e() const { │ │ │ │ │ +44 _s_i_z_e___t_y_p_e entries = 0; │ │ │ │ │ +45 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_6_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) { │ │ │ │ │ +66 │ │ │ │ │ +67 typedef typename MatrixType::row_type RowType; │ │ │ │ │ +68 typedef typename RowType::ConstIterator ColumnIterator; │ │ │ │ │ +69 │ │ │ │ │ +70 for (_s_i_z_e___t_y_p_e rowIdx=0; rowIdx& other) const │ │ │ │ │ -83 { │ │ │ │ │ -84 return (this==&other); │ │ │ │ │ -85 } │ │ │ │ │ -86 │ │ │ │ │ -87 //===== iterator interface to rows of the matrix │ │ │ │ │ -_8_9 typedef ContainerWrapperIterator │ │ │ │ │ -_I_t_e_r_a_t_o_r; │ │ │ │ │ -_9_1 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ │ -_9_3 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ -_9_5 typedef typename row_type::Iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -96 │ │ │ │ │ -_9_8 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ -99 { │ │ │ │ │ -100 return _I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ │ -101 } │ │ │ │ │ -102 │ │ │ │ │ -_1_0_4 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ -105 { │ │ │ │ │ -106 return _I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ │ -107 } │ │ │ │ │ -108 │ │ │ │ │ -_1_1_1 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ -112 { │ │ │ │ │ -113 return _I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ │ -114 } │ │ │ │ │ +74 ColumnIterator cIt = row.begin(); │ │ │ │ │ +75 ColumnIterator cEndIt = row.end(); │ │ │ │ │ +76 │ │ │ │ │ +77 for(; cIt!=cEndIt; ++cIt) │ │ │ │ │ +78 _a_d_d(rowIdx+rowOffset, cIt.index()+colOffset); │ │ │ │ │ +79 │ │ │ │ │ +80 } │ │ │ │ │ +81 │ │ │ │ │ +82 } │ │ │ │ │ +83 │ │ │ │ │ +89 template │ │ │ │ │ +_9_0 void _e_x_p_o_r_t_I_d_x(MatrixType& matrix) const { │ │ │ │ │ +91 │ │ │ │ │ +92 matrix.setSize(rows_, cols_); │ │ │ │ │ +93 matrix.setBuildMode(MatrixType::random); │ │ │ │ │ +94 │ │ │ │ │ +95 for (_s_i_z_e___t_y_p_e i=0; i::iterator it = indices_[i].begin(); │ │ │ │ │ +103 for (; it!=indices_[i].end(); ++it) │ │ │ │ │ +104 matrix.addindex(i, *it); │ │ │ │ │ +105 │ │ │ │ │ +106 } │ │ │ │ │ +107 │ │ │ │ │ +108 matrix.endindices(); │ │ │ │ │ +109 │ │ │ │ │ +110 } │ │ │ │ │ +111 │ │ │ │ │ +112 private: │ │ │ │ │ +113 │ │ │ │ │ +114 std::vector > indices_; │ │ │ │ │ 115 │ │ │ │ │ -_1_1_8 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ -119 { │ │ │ │ │ -120 return _I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ │ -121 } │ │ │ │ │ +116 _s_i_z_e___t_y_p_e rows_, cols_; │ │ │ │ │ +117 │ │ │ │ │ +118 }; │ │ │ │ │ +119 │ │ │ │ │ +120 │ │ │ │ │ +121} // end namespace Dune │ │ │ │ │ 122 │ │ │ │ │ -123 │ │ │ │ │ -_1_2_5 typedef ContainerWrapperIterator _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -_1_2_7 typedef _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ -_1_2_9 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_3_1 typedef typename const_row_type::ConstIterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -132 │ │ │ │ │ -_1_3_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ -135 { │ │ │ │ │ -136 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ │ -137 } │ │ │ │ │ -138 │ │ │ │ │ -_1_4_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ -141 { │ │ │ │ │ -142 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ │ -143 } │ │ │ │ │ -144 │ │ │ │ │ -_1_4_7 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ -148 { │ │ │ │ │ -149 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ │ -150 } │ │ │ │ │ -151 │ │ │ │ │ -_1_5_4 _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 │ │ │ │ │ -155 { │ │ │ │ │ -156 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ │ -157 } │ │ │ │ │ -158 │ │ │ │ │ -159 //===== vector space arithmetic │ │ │ │ │ -160 │ │ │ │ │ -_1_6_2 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& y) │ │ │ │ │ -163 { │ │ │ │ │ -164 p_ += y.p_; │ │ │ │ │ -165 return *this; │ │ │ │ │ -166 } │ │ │ │ │ -167 │ │ │ │ │ -_1_6_9 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& y) │ │ │ │ │ -170 { │ │ │ │ │ -171 p_ -= y.p_; │ │ │ │ │ -172 return *this; │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -_1_7_6 _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) │ │ │ │ │ -177 { │ │ │ │ │ -178 p_ += k; │ │ │ │ │ -179 return *this; │ │ │ │ │ -180 } │ │ │ │ │ -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 K& k) │ │ │ │ │ -184 { │ │ │ │ │ -185 p_ -= k; │ │ │ │ │ -186 return *this; │ │ │ │ │ -187 } │ │ │ │ │ -_1_8_9 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const K& k) │ │ │ │ │ -190 { │ │ │ │ │ -191 p_ *= k; │ │ │ │ │ -192 return *this; │ │ │ │ │ -193 } │ │ │ │ │ -194 │ │ │ │ │ -_1_9_6 _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) │ │ │ │ │ -197 { │ │ │ │ │ -198 p_ /= k; │ │ │ │ │ -199 return *this; │ │ │ │ │ -200 } │ │ │ │ │ -201 │ │ │ │ │ -202 //===== binary operators │ │ │ │ │ -203 │ │ │ │ │ -205 template ::value, int> = 0> │ │ │ │ │ -_2_0_7 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) │ │ │ │ │ -208 { │ │ │ │ │ -209 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}; │ │ │ │ │ -210 } │ │ │ │ │ -211 │ │ │ │ │ -213 template ::value, int> = 0> │ │ │ │ │ -_2_1_5 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) │ │ │ │ │ -216 { │ │ │ │ │ -217 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()}; │ │ │ │ │ -218 } │ │ │ │ │ -219 │ │ │ │ │ -220 //===== comparison ops │ │ │ │ │ -221 │ │ │ │ │ -_2_2_3 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 │ │ │ │ │ -224 { │ │ │ │ │ -225 return p_==other._s_c_a_l_a_r(); │ │ │ │ │ -226 } │ │ │ │ │ -227 │ │ │ │ │ -_2_2_9 bool _o_p_e_r_a_t_o_r_!_=(const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& other) const │ │ │ │ │ -230 { │ │ │ │ │ -231 return p_!=other._s_c_a_l_a_r(); │ │ │ │ │ -232 } │ │ │ │ │ -233 │ │ │ │ │ -234 //===== linear maps │ │ │ │ │ -235 │ │ │ │ │ -237 template │ │ │ │ │ -_2_3_8 void _m_v (const X& x, Y& y) const │ │ │ │ │ -239 { │ │ │ │ │ -240#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -241 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -242 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -243#endif │ │ │ │ │ -244 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_2_5_0 void _m_t_v (const X& x, Y& y) const │ │ │ │ │ -251 { │ │ │ │ │ -252 _m_v(x, y); │ │ │ │ │ -253 } │ │ │ │ │ -254 │ │ │ │ │ -256 template │ │ │ │ │ -_2_5_7 void _u_m_v (const X& x, Y& y) const │ │ │ │ │ -258 { │ │ │ │ │ -259#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -260 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -261 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -262#endif │ │ │ │ │ -263 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_2_6_9 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ -270 { │ │ │ │ │ -271#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -272 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -273 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -274#endif │ │ │ │ │ -275 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_2_8_1 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ -282 { │ │ │ │ │ -283#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -284 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -285 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -286#endif │ │ │ │ │ -287 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_2_9_3 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ -294 { │ │ │ │ │ -295#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -296 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -297 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -298#endif │ │ │ │ │ -299 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_0_5 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ -306 { │ │ │ │ │ -307#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -308 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -309 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -310#endif │ │ │ │ │ -311 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_1_7 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ -318 { │ │ │ │ │ -319#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -320 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -321 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -322#endif │ │ │ │ │ -323 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_2_9 void _u_s_m_v (const K& alpha, const X& x, Y& y) const │ │ │ │ │ -330 { │ │ │ │ │ -331#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -332 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -333 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -334#endif │ │ │ │ │ -335 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_4_1 void _u_s_m_t_v (const K& alpha, const X& x, Y& y) const │ │ │ │ │ -342 { │ │ │ │ │ -343#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -344 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -345 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -346#endif │ │ │ │ │ -347 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_3_5_3 void _u_s_m_h_v (const K& alpha, const X& x, Y& y) const │ │ │ │ │ -354 { │ │ │ │ │ -355#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ -356 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -357 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ -358#endif │ │ │ │ │ -359 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 │ │ │ │ │ -367 { │ │ │ │ │ -368 return fvmeta::sqrt(n*p_*p_); │ │ │ │ │ -369 } │ │ │ │ │ -370 │ │ │ │ │ -_3_7_2 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ -373 { │ │ │ │ │ -374 return n*p_*p_; │ │ │ │ │ -375 } │ │ │ │ │ -376 │ │ │ │ │ -_3_7_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m () const │ │ │ │ │ -379 { │ │ │ │ │ -380 return std::abs(p_); │ │ │ │ │ -381 } │ │ │ │ │ -382 │ │ │ │ │ -_3_8_4 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l () const │ │ │ │ │ -385 { │ │ │ │ │ -386 return fvmeta::absreal(p_); │ │ │ │ │ -387 } │ │ │ │ │ -388 │ │ │ │ │ -389 //===== solve │ │ │ │ │ -390 │ │ │ │ │ -393 template │ │ │ │ │ -_3_9_4 void _s_o_l_v_e (V& x, const V& b) const │ │ │ │ │ -395 { │ │ │ │ │ -396 for (int i=0; i=n) DUNE_THROW(FMatrixError,"row index out of range"); │ │ │ │ │ -433 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range"); │ │ │ │ │ -434#endif │ │ │ │ │ -435 return i==j; │ │ │ │ │ -436 } │ │ │ │ │ -437 │ │ │ │ │ -438 //===== conversion operator │ │ │ │ │ -439 │ │ │ │ │ -_4_4_1 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) │ │ │ │ │ -442 { │ │ │ │ │ -443 for (_s_i_z_e___t_y_p_e i=0; i(&p_), i); │ │ │ │ │ -455 } │ │ │ │ │ -456 │ │ │ │ │ -_4_5_8 _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 │ │ │ │ │ -459 { │ │ │ │ │ -460 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(const_cast(&p_), i); │ │ │ │ │ -461 } │ │ │ │ │ -462 │ │ │ │ │ -_4_6_4 const K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) const │ │ │ │ │ -465 { │ │ │ │ │ -466 return p_; │ │ │ │ │ -467 } │ │ │ │ │ -468 │ │ │ │ │ -_4_7_0 K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) │ │ │ │ │ -471 { │ │ │ │ │ -472 return p_; │ │ │ │ │ -473 } │ │ │ │ │ -474 │ │ │ │ │ -_4_7_7 const K& _s_c_a_l_a_r() const │ │ │ │ │ -478 { │ │ │ │ │ -479 return p_; │ │ │ │ │ -480 } │ │ │ │ │ -481 │ │ │ │ │ -_4_8_4 K& _s_c_a_l_a_r() │ │ │ │ │ -485 { │ │ │ │ │ -486 return p_; │ │ │ │ │ -487 } │ │ │ │ │ -488 │ │ │ │ │ -489 private: │ │ │ │ │ -490 // the data, very simply a single number │ │ │ │ │ -491 K p_; │ │ │ │ │ -492 │ │ │ │ │ -493 }; │ │ │ │ │ -494 │ │ │ │ │ -495 template │ │ │ │ │ -_4_9_6 struct DenseMatrixAssigner> { │ │ │ │ │ -_4_9_7 static void _a_p_p_l_y(DenseMatrix& denseMatrix, │ │ │ │ │ -498 _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) { │ │ │ │ │ -499 assert(denseMatrix.M() == N); │ │ │ │ │ -500 assert(denseMatrix.N() == N); │ │ │ │ │ -501 denseMatrix = field(0); │ │ │ │ │ -502 for (int i = 0; i < N; ++i) │ │ │ │ │ -503 denseMatrix[i][i] = rhs._s_c_a_l_a_r(); │ │ │ │ │ -504 } │ │ │ │ │ -505 }; │ │ │ │ │ -506 │ │ │ │ │ -507 template │ │ │ │ │ -_5_0_8 struct FieldTraits< _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x > │ │ │ │ │ -509 { │ │ │ │ │ -_5_1_0 using _f_i_e_l_d___t_y_p_e = typename _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_K_,_ _n_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_5_1_1 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ -512 }; │ │ │ │ │ -513 │ │ │ │ │ -514} // end namespace │ │ │ │ │ -515 │ │ │ │ │ -516#endif │ │ │ │ │ +123#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ │ -A multiple of the identity matrix of static size. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ -void usmhv(const K &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^H x │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:353 │ │ │ │ │ -_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:305 │ │ │ │ │ -_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:169 │ │ │ │ │ -_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:131 │ │ │ │ │ -_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:140 │ │ │ │ │ -_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:118 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -bool operator!=(const ScaledIdentityMatrix &other) const │ │ │ │ │ -incomparison operator │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:229 │ │ │ │ │ -_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:293 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ -std::size_t size_type │ │ │ │ │ -The type used for the index access and size operations. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:43 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ -void usmv(const K &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A x │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:329 │ │ │ │ │ -_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:95 │ │ │ │ │ -_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:53 │ │ │ │ │ -_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:238 │ │ │ │ │ -_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:269 │ │ │ │ │ -_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:281 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ -DiagonalRowVector< K, n > row_type │ │ │ │ │ -Each row is implemented by a field vector. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:50 │ │ │ │ │ -_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:89 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -Iterator beforeEnd() │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:111 │ │ │ │ │ -_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:408 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -K field_type │ │ │ │ │ -export the type representing the field │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ -void usmtv(const K &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^T x │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:341 │ │ │ │ │ -_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:104 │ │ │ │ │ -_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: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_:_:_s_c_a_l_a_r │ │ │ │ │ -const K & scalar() const │ │ │ │ │ -Get const reference to the scalar diagonal value. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:477 │ │ │ │ │ -_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:257 │ │ │ │ │ -_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_l_e_v_e_l │ │ │ │ │ -static constexpr std::size_t blocklevel │ │ │ │ │ -We are at the leaf of the block recursion. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ -const K & diagonal(size_type) const │ │ │ │ │ -Get const reference to diagonal entry. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:464 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_r_o_w_s │ │ │ │ │ -@ rows │ │ │ │ │ -The number of rows. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_l_s │ │ │ │ │ -@ cols │ │ │ │ │ -The number of columns. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -ScaledIdentityMatrix & operator=(const K &k) │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:75 │ │ │ │ │ -_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:125 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ -K & diagonal(size_type) │ │ │ │ │ -Get reference to diagonal entry. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:470 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ │ -void solve(V &x, const V &b) const │ │ │ │ │ -Solve system A x = b. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:394 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_e_x_i_s_t_s │ │ │ │ │ -bool exists(size_type i, size_type j) const │ │ │ │ │ -return true when (i,j) is in pattern │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:429 │ │ │ │ │ -_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:93 │ │ │ │ │ -_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:127 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ │ -ScaledIdentityMatrix() │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ │ +Stores the nonzero entries in a sparse matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:16 │ │ │ │ │ +_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:31 │ │ │ │ │ +_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() │ │ │ │ │ Default constructor. │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -bool operator==(const ScaledIdentityMatrix &other) const │ │ │ │ │ -comparison operator │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:223 │ │ │ │ │ -_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:154 │ │ │ │ │ -_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:196 │ │ │ │ │ -_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:441 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm2() const │ │ │ │ │ -square of frobenius norm, need for block recursion │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:372 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ -frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:366 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ -FieldTraits< field_type >::real_type infinity_norm() const │ │ │ │ │ -infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:378 │ │ │ │ │ -_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:129 │ │ │ │ │ -_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:147 │ │ │ │ │ -_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:421 │ │ │ │ │ -_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:458 │ │ │ │ │ -_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: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_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar) │ │ │ │ │ -vector space multiplication with scalar │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:207 │ │ │ │ │ -_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:384 │ │ │ │ │ -_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:189 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_d_e_n_t_i_c_a_l │ │ │ │ │ -bool identical(const ScaledIdentityMatrix< K, n > &other) const │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:82 │ │ │ │ │ -_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:402 │ │ │ │ │ -_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:98 │ │ │ │ │ -_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:484 │ │ │ │ │ -_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:51 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -K block_type │ │ │ │ │ -export the type representing the components │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ -void mmhv(const X &x, Y &y) const │ │ │ │ │ -y -= A^H x │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:317 │ │ │ │ │ -_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:162 │ │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_n_s_t___r_o_w___t_y_p_e │ │ │ │ │ -DiagonalRowVectorConst< K, n > const_row_type │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh: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_t_v │ │ │ │ │ -void mtv(const X &x, Y &y) const │ │ │ │ │ -y = A^T x │ │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:250 │ │ │ │ │ -_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:452 │ │ │ │ │ -_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:134 │ │ │ │ │ -_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:415 │ │ │ │ │ -_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:497 │ │ │ │ │ -_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:510 │ │ │ │ │ -_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:511 │ │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:22 │ │ │ │ │ +_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 i, size_type j) │ │ │ │ │ +Add an index to the index set. │ │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:38 │ │ │ │ │ +_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:52 │ │ │ │ │ +_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 │ │ │ │ │ +std::size_t size_type │ │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:19 │ │ │ │ │ +_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:90 │ │ │ │ │ +_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) │ │ │ │ │ +Constructor setting the matrix size. │ │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:26 │ │ │ │ │ +_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:56 │ │ │ │ │ +_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:43 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00197.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverfactory.hh File Reference │ │ │ │ +dune-istl: foreach.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,89 +70,57 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ -Typedefs | │ │ │ │ Functions
│ │ │ │ -
solverfactory.hh File Reference
│ │ │ │ +
foreach.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <unordered_map>
│ │ │ │ -#include <functional>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <dune/common/parametertree.hh>
│ │ │ │ -#include <dune/common/singleton.hh>
│ │ │ │ -#include "solverregistry.hh"
│ │ │ │ -#include <dune/istl/solver.hh>
│ │ │ │ -#include <dune/istl/schwarz.hh>
│ │ │ │ -#include <dune/istl/novlpschwarz.hh>
│ │ │ │ +
#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

class  Dune::SolverFactory< Operator >
 Factory to assembly solvers configured by a ParameterTree. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Typedefs

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

│ │ │ │ Functions

template<class O , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const O &)
 
template<class M , class X , class Y , class C , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y , class C , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< MatrixAdapter< M, X, Y > > &)
 
template<class M , class X , class Y , class C >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y , class C >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class Operator >
std::shared_ptr< InverseOperator< typename Operator::domain_type, typename Operator::range_type > > Dune::getSolverFromFactory (std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > prec=nullptr)
 Instantiates an InverseOperator from an Operator and a configuration given as a ParameterTree.
 
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.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,101 +1,51 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -solverfactory.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h" │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ +_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 │ │ │ │ │ -class   _D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_<_ _O_p_e_r_a_t_o_r_ _> │ │ │ │ │ -  Factory to assembly solvers configured by a ParameterTree. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y > > │ │ │ │ │ - (const M &, const ParameterTree &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ │ - _D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ │ - >(const std::shared_ptr< M > &, const ParameterTree &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ │ - _P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y │ │ │ │ │ - > >(const std::shared_ptr< _L_i_n_e_a_r_O_p_e_r_a_t_o_r< X, Y > > &, const std:: │ │ │ │ │ - shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > > &, const std::shared_ptr< │ │ │ │ │ - _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > >, const ParameterTree &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ │ - _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< X, Y > > > │ │ │ │ │ +namespace   _D_u_n_e_:_:_F_o_r_E_a_c_h │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ │ - const O &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ │ - const std::shared_ptr< │ │ │ │ │ - _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, C > │ │ │ │ │ - > &op) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ │ - const std::shared_ptr< │ │ │ │ │ - _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ │ - C > > &op) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ │ - shared_ptr< _M_a_t_r_i_x_A_d_a_p_t_e_r< M, X, Y > > │ │ │ │ │ - &) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ │ - shared_ptr< _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< │ │ │ │ │ - M, X, Y, C > > &op) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ │ - shared_ptr< │ │ │ │ │ - _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ │ - C > > &op) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ - std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< _D_u_n_e_:_:_g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y (std:: │ │ │ │ │ - typename Operator::domain_type, shared_ptr< Operator > op, const │ │ │ │ │ - typename Operator::range_type > >  ParameterTree &config, std::shared_ptr< │ │ │ │ │ - _P_r_e_c_o_n_d_i_t_i_o_n_e_r< typename Operator:: │ │ │ │ │ - domain_type, typename Operator:: │ │ │ │ │ - range_type > > prec=nullptr) │ │ │ │ │ - Instantiates an _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r from an │ │ │ │ │ -  Operator and a configuration given as a │ │ │ │ │ - ParameterTree. │ │ │ │ │ +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.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00197_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverfactory.hh Source File │ │ │ │ +dune-istl: foreach.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,245 +74,201 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
solverfactory.hh
│ │ │ │ +
foreach.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ +
3#pragma once
│ │ │ │ +
4
│ │ │ │ +
5#include<type_traits>
│ │ │ │ +
6#include<utility>
│ │ │ │ +
7#include<cassert>
│ │ │ │
8
│ │ │ │ -
9#include <unordered_map>
│ │ │ │ -
10#include <functional>
│ │ │ │ -
11#include <memory>
│ │ │ │ -
12
│ │ │ │ -
13#include <dune/common/parametertree.hh>
│ │ │ │ -
14#include <dune/common/singleton.hh>
│ │ │ │ -
15
│ │ │ │ -
16#include "solverregistry.hh"
│ │ │ │ -
17#include <dune/istl/solver.hh>
│ │ │ │ -
18#include <dune/istl/schwarz.hh>
│ │ │ │ - │ │ │ │ +
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
│ │ │ │ -
21namespace Dune{
│ │ │ │ -
26 // Direct solver factory:
│ │ │ │ -
27 template<class M, class X, class Y>
│ │ │ │ -
28 using DirectSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const M&, const ParameterTree&);
│ │ │ │ -
29 template<class M, class X, class Y>
│ │ │ │ -
30 using DirectSolverFactory = Singleton<ParameterizedObjectFactory<DirectSolverSignature<M,X,Y>>>;
│ │ │ │ -
31
│ │ │ │ -
32 // Preconditioner factory:
│ │ │ │ -
33 template<class M, class X, class Y>
│ │ │ │ -
34 using PreconditionerSignature = std::shared_ptr<Preconditioner<X,Y>>(const std::shared_ptr<M>&, const ParameterTree&);
│ │ │ │ -
35 template<class M, class X, class Y>
│ │ │ │ -
36 using PreconditionerFactory = Singleton<ParameterizedObjectFactory<PreconditionerSignature<M,X,Y>>>;
│ │ │ │ +
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 // Iterative solver factory
│ │ │ │ -
39 template<class X, class Y>
│ │ │ │ -
40 using IterativeSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const std::shared_ptr<LinearOperator<X,Y>>&, const std::shared_ptr<ScalarProduct<X>>&, const std::shared_ptr<Preconditioner<X,Y>>, const ParameterTree&);
│ │ │ │ -
41 template<class X, class Y>
│ │ │ │ -
42 using IterativeSolverFactory = Singleton<ParameterizedObjectFactory<IterativeSolverSignature<X,Y>>>;
│ │ │ │ +
38 template <class K, int n>
│ │ │ │ +
39 struct IsRowMajorSparse<DiagonalMatrix<K,n>> : std::true_type {};
│ │ │ │ +
40
│ │ │ │ +
41 template <class K, int n>
│ │ │ │ +
42 struct IsRowMajorSparse<ScaledIdentityMatrix<K,n>> : std::true_type {};
│ │ │ │
43
│ │ │ │ -
44 // initSolverFactories differs in different compilation units, so we have it
│ │ │ │ -
45 // in an anonymous namespace
│ │ │ │ -
46 namespace {
│ │ │ │ +
44
│ │ │ │ +
45 template <class Matrix>
│ │ │ │ +
46 auto rows(Matrix const& /*matrix*/, PriorityTag<2>) -> std::integral_constant<std::size_t, Matrix::N()> { return {}; }
│ │ │ │
47
│ │ │ │ -
53 template<class O>
│ │ │ │ -
54 int initSolverFactories(){
│ │ │ │ -
55 using M = typename O::matrix_type;
│ │ │ │ -
56 using X = typename O::range_type;
│ │ │ │ -
57 using Y = typename O::domain_type;
│ │ │ │ -
58 using TL = Dune::TypeList<M,X,Y>;
│ │ │ │ - │ │ │ │ -
60 addRegistryToFactory<TL>(dsfac, DirectSolverTag{});
│ │ │ │ - │ │ │ │ -
62 addRegistryToFactory<TL>(pfac, PreconditionerTag{});
│ │ │ │ -
63 using TLS = Dune::TypeList<X,Y>;
│ │ │ │ - │ │ │ │ -
65 return addRegistryToFactory<TLS>(isfac, IterativeSolverTag{});
│ │ │ │ -
66 }
│ │ │ │ -
77 template<class O, class X, class Y>
│ │ │ │ -
78 [[deprecated("Use method 'initSolverFactories<O>' instead")]]
│ │ │ │ -
79 int initSolverFactories() {
│ │ │ │ -
80 return initSolverFactories<O>();
│ │ │ │ -
81 }
│ │ │ │ -
82 } // end anonymous namespace
│ │ │ │ -
83
│ │ │ │ -
84
│ │ │ │ -
85 template<class O, class Preconditioner>
│ │ │ │ -
│ │ │ │ -
86 std::shared_ptr<Preconditioner> wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ │ -
87 const O&)
│ │ │ │ -
88 {
│ │ │ │ -
89 return prec;
│ │ │ │ -
90 }
│ │ │ │ -
│ │ │ │ -
91
│ │ │ │ -
92 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ │ -
93 std::shared_ptr<Preconditioner>
│ │ │ │ -
│ │ │ │ -
94 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ │ -
95 const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ -
96 {
│ │ │ │ -
97 return std::make_shared<BlockPreconditioner<X,Y,C,Preconditioner> >(prec, op->getCommunication());
│ │ │ │ -
98 }
│ │ │ │ -
│ │ │ │ -
99
│ │ │ │ -
100 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ │ -
101 std::shared_ptr<Preconditioner>
│ │ │ │ -
│ │ │ │ -
102 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ │ -
103 const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ +
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 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 return std::make_shared<NonoverlappingBlockPreconditioner<C,Preconditioner> >(prec, op->getCommunication());
│ │ │ │ -
106 }
│ │ │ │ -
│ │ │ │ -
107
│ │ │ │ -
108 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ -
109 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<MatrixAdapter<M,X,Y> >&)
│ │ │ │ -
110 {
│ │ │ │ -
111 return std::make_shared<SeqScalarProduct<X>>();
│ │ │ │ -
112 }
│ │ │ │ -
│ │ │ │ -
113 template<class M, class X, class Y, class C>
│ │ │ │ -
│ │ │ │ -
114 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ -
115 {
│ │ │ │ -
116 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ │ -
117 }
│ │ │ │ -
│ │ │ │ -
118
│ │ │ │ -
119 template<class M, class X, class Y, class C>
│ │ │ │ -
│ │ │ │ -
120 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ │ -
121 {
│ │ │ │ -
122 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ │ -
123 }
│ │ │ │ -
│ │ │ │ -
124
│ │ │ │ -
144 template<class Operator>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
146 using Domain = typename Operator::domain_type;
│ │ │ │ -
147 using Range = typename Operator::range_type;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
150
│ │ │ │ -
151 template<class O>
│ │ │ │ -
152 using _matrix_type = typename O::matrix_type;
│ │ │ │ -
153 using matrix_type = Std::detected_or_t<int, _matrix_type, Operator>;
│ │ │ │ -
154 static constexpr bool isAssembled = !std::is_same<matrix_type, int>::value;
│ │ │ │ +
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 // 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 static const matrix_type* getmat(std::shared_ptr<Operator> op){
│ │ │ │ -
157 std::shared_ptr<AssembledLinearOperator<matrix_type, Domain, Range>> aop
│ │ │ │ -
158 = std::dynamic_pointer_cast<AssembledLinearOperator<matrix_type, Domain, Range>>(op);
│ │ │ │ -
159 if(aop)
│ │ │ │ -
160 return &aop->getmat();
│ │ │ │ -
161 return nullptr;
│ │ │ │ -
162 }
│ │ │ │ -
163
│ │ │ │ -
164 public:
│ │ │ │ -
165
│ │ │ │ -
│ │ │ │ -
168 static std::shared_ptr<Solver> get(std::shared_ptr<Operator> op,
│ │ │ │ -
169 const ParameterTree& config,
│ │ │ │ -
170 std::shared_ptr<Preconditioner> prec = nullptr){
│ │ │ │ -
171 std::string type = config.get<std::string>("type");
│ │ │ │ -
172 std::shared_ptr<Solver> result;
│ │ │ │ -
173 const matrix_type* mat = getmat(op);
│ │ │ │ -
174 if(mat){
│ │ │ │ - │ │ │ │ -
176 if(op->category()!=SolverCategory::sequential){
│ │ │ │ -
177 DUNE_THROW(NotImplemented, "The solver factory does not support parallel direct solvers!");
│ │ │ │ -
178 }
│ │ │ │ -
179 result = DirectSolverFactory<matrix_type, Domain, Range>::instance().create(type, *mat, config);
│ │ │ │ -
180 return result;
│ │ │ │ -
181 }
│ │ │ │ -
182 }
│ │ │ │ -
183 // if no direct solver is found it might be an iterative solver
│ │ │ │ - │ │ │ │ -
185 DUNE_THROW(Dune::InvalidStateException, "Solver not found in the factory.");
│ │ │ │ -
186 }
│ │ │ │ -
187 if(!prec){
│ │ │ │ -
188 const ParameterTree& precConfig = config.sub("preconditioner");
│ │ │ │ -
189 std::string prec_type = precConfig.get<std::string>("type");
│ │ │ │ -
190 prec = PreconditionerFactory<Operator, Domain, Range>::instance().create(prec_type, op, precConfig);
│ │ │ │ -
191 if (prec->category() != op->category() && prec->category() == SolverCategory::sequential)
│ │ │ │ -
192 // try to wrap to a parallel preconditioner
│ │ │ │ -
193 prec = wrapPreconditioner4Parallel(prec, op);
│ │ │ │ -
194 }
│ │ │ │ -
195 std::shared_ptr<ScalarProduct<Domain>> sp = createScalarProduct(op);
│ │ │ │ -
196 result = IterativeSolverFactory<Domain, Range>::instance().create(type, op, sp, prec, config);
│ │ │ │ -
197 return result;
│ │ │ │ -
198 }
│ │ │ │ -
│ │ │ │ -
199
│ │ │ │ -
│ │ │ │ -
203 static std::shared_ptr<Preconditioner> getPreconditioner(std::shared_ptr<Operator> op,
│ │ │ │ -
204 const ParameterTree& config){
│ │ │ │ -
205 const matrix_type* mat = getmat(op);
│ │ │ │ -
206 if(mat){
│ │ │ │ -
207 std::string prec_type = config.get<std::string>("type");
│ │ │ │ -
208 return PreconditionerFactory<Operator, Domain, Range>::instance().create(prec_type, op, config);
│ │ │ │ -
209 }else{
│ │ │ │ -
210 DUNE_THROW(InvalidStateException, "Could not obtain matrix from operator. Please pass in an AssembledLinearOperator.");
│ │ │ │ -
211 }
│ │ │ │ -
212 }
│ │ │ │ -
│ │ │ │ -
213 };
│ │ │ │ -
│ │ │ │ -
214
│ │ │ │ -
225 template<class Operator>
│ │ │ │ -
226 std::shared_ptr<InverseOperator<typename Operator::domain_type,
│ │ │ │ -
│ │ │ │ -
227 typename Operator::range_type>> getSolverFromFactory(std::shared_ptr<Operator> op,
│ │ │ │ -
228 const ParameterTree& config,
│ │ │ │ -
229 std::shared_ptr<Preconditioner<typename Operator::domain_type,
│ │ │ │ -
230 typename Operator::range_type>> prec = nullptr){
│ │ │ │ -
231 return SolverFactory<Operator>::get(op, config, prec);
│ │ │ │ -
232 }
│ │ │ │ -
│ │ │ │ -
233
│ │ │ │ -
237} // end namespace Dune
│ │ │ │ -
238
│ │ │ │ -
239
│ │ │ │ -
240#endif
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > > PreconditionerFactory
Definition solverfactory.hh:36
│ │ │ │ -
Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > > DirectSolverFactory
Definition solverfactory.hh:30
│ │ │ │ -
std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &) IterativeSolverSignature
Definition solverfactory.hh:40
│ │ │ │ -
std::shared_ptr< Preconditioner > wrapPreconditioner4Parallel(const std::shared_ptr< Preconditioner > &prec, const O &)
Definition solverfactory.hh:86
│ │ │ │ -
std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &) DirectSolverSignature
Definition solverfactory.hh:28
│ │ │ │ -
std::shared_ptr< InverseOperator< typename Operator::domain_type, typename Operator::range_type > > getSolverFromFactory(std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > prec=nullptr)
Instantiates an InverseOperator from an Operator and a configuration given as a ParameterTree.
Definition solverfactory.hh:227
│ │ │ │ -
Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > > IterativeSolverFactory
Definition solverfactory.hh:42
│ │ │ │ -
std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const ParameterTree &) PreconditionerSignature
Definition solverfactory.hh:34
│ │ │ │ +
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 auto [ dummyRows, dummyCols ] = flatMatrixForEach(entry, f, rowOffset + rowIdx*blockRows, colOffset + colIdx*blockCols);
│ │ │ │ +
171 assert( dummyRows == blockRows and dummyCols == blockCols and "we need the same size of each block in this matrix type");
│ │ │ │ +
172 }
│ │ │ │ +
173 }
│ │ │ │ +
174
│ │ │ │ +
175 return { matrix.N()*blockRows, matrix.M()*blockCols };
│ │ │ │ +
176 }
│ │ │ │ +
177 // all other matrix types are accessed index-wise with dynamic flat row/col counting
│ │ │ │ +
178 else
│ │ │ │ +
179 {
│ │ │ │ +
180 std::size_t r = 0, c = 0;
│ │ │ │ +
181 std::size_t nRows, nCols;
│ │ │ │ +
182
│ │ │ │ +
183 Hybrid::forEach(Dune::range(ForEach::rows(matrix)), [&](auto i) {
│ │ │ │ +
184 c = 0;
│ │ │ │ +
185 Hybrid::forEach(Dune::range(ForEach::cols(matrix)), [&](auto j) {
│ │ │ │ +
186 std::tie(nRows,nCols) = flatMatrixForEach(matrix[i][j], f, rowOffset + r, colOffset + c);
│ │ │ │ +
187 c += nCols;
│ │ │ │ +
188 });
│ │ │ │ +
189 r += nRows;
│ │ │ │ +
190 });
│ │ │ │ +
191 return {r,c};
│ │ │ │ +
192 }
│ │ │ │ +
193 }
│ │ │ │ +
194}
│ │ │ │ +
│ │ │ │ +
195
│ │ │ │ +
196} // 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
│ │ │ │ -
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
│ │ │ │ -
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ │ -
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ -
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ - │ │ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ -
Factory to assembly solvers configured by a ParameterTree.
Definition solverfactory.hh:145
│ │ │ │ -
static std::shared_ptr< Solver > get(std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner > prec=nullptr)
get a solver from the factory
Definition solverfactory.hh:168
│ │ │ │ -
static std::shared_ptr< Preconditioner > getPreconditioner(std::shared_ptr< Operator > op, const ParameterTree &config)
Construct a Preconditioner for a given Operator.
Definition solverfactory.hh:203
│ │ │ │ +
std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, std::size_t rowOffset=0, std::size_t colOffset=0)
Traverse a blocked matrix and call a functor at each scalar entry.
Definition foreach.hh:132
│ │ │ │ +
std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0)
Traverse a blocked vector and call a functor at each scalar entry.
Definition foreach.hh:95
│ │ │ │ +
auto rows(Matrix const &matrix)
Definition foreach.hh:69
│ │ │ │ +
auto cols(Matrix const &matrix)
Definition foreach.hh:72
│ │ │ │ +
auto size(Vector const &vector)
Definition foreach.hh:75
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ +
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,303 +1,233 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -solverfactory.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 (C) 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 │ │ │ │ │ +3#pragma once │ │ │ │ │ +4 │ │ │ │ │ +5#include │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ 8 │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12 │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include "_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h" │ │ │ │ │ -17#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ │ +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 │ │ │ │ │ -21namespace _D_u_n_e{ │ │ │ │ │ -26 // Direct solver factory: │ │ │ │ │ -27 template │ │ │ │ │ -_2_8 using _D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ │ -M&, const ParameterTree&); │ │ │ │ │ -29 template │ │ │ │ │ -_3_0 using _D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ │ -Singleton>>; │ │ │ │ │ -31 │ │ │ │ │ -32 // Preconditioner factory: │ │ │ │ │ -33 template │ │ │ │ │ -_3_4 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ │ -std::shared_ptr&, const ParameterTree&); │ │ │ │ │ -35 template │ │ │ │ │ -_3_6 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = │ │ │ │ │ -Singleton>>; │ │ │ │ │ +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 // Iterative solver factory │ │ │ │ │ -39 template │ │ │ │ │ -_4_0 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ │ -std::shared_ptr>&, const std:: │ │ │ │ │ -shared_ptr>&, const std::shared_ptr>, │ │ │ │ │ -const ParameterTree&); │ │ │ │ │ -41 template │ │ │ │ │ -_4_2 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ │ -Singleton>>; │ │ │ │ │ +38 template │ │ │ │ │ +39 struct IsRowMajorSparse> : std::true_type {}; │ │ │ │ │ +40 │ │ │ │ │ +41 template │ │ │ │ │ +42 struct IsRowMajorSparse> : std::true_type {}; │ │ │ │ │ 43 │ │ │ │ │ -44 // initSolverFactories differs in different compilation units, so we have it │ │ │ │ │ -45 // in an anonymous namespace │ │ │ │ │ -46 namespace { │ │ │ │ │ +44 │ │ │ │ │ +45 template │ │ │ │ │ +46 auto rows(Matrix const& /*matrix*/, PriorityTag<2>) -> std:: │ │ │ │ │ +integral_constant { return {}; } │ │ │ │ │ 47 │ │ │ │ │ -53 template │ │ │ │ │ -54 int initSolverFactories(){ │ │ │ │ │ -55 using M = typename O::matrix_type; │ │ │ │ │ -56 using X = typename O::range_type; │ │ │ │ │ -57 using Y = typename O::domain_type; │ │ │ │ │ -58 using TL = Dune::TypeList; │ │ │ │ │ -59 auto& dsfac=_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_M_,_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ │ -60 addRegistryToFactory(dsfac, DirectSolverTag{}); │ │ │ │ │ -61 auto& pfac=_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_,_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ │ -62 addRegistryToFactory(pfac, PreconditionerTag{}); │ │ │ │ │ -63 using TLS = Dune::TypeList; │ │ │ │ │ -64 auto& isfac=_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ │ -65 return addRegistryToFactory(isfac, IterativeSolverTag{}); │ │ │ │ │ -66 } │ │ │ │ │ -77 template │ │ │ │ │ -78 [[deprecated("Use method 'initSolverFactories' instead")]] │ │ │ │ │ -79 int initSolverFactories() { │ │ │ │ │ -80 return initSolverFactories(); │ │ │ │ │ -81 } │ │ │ │ │ -82 } // end anonymous namespace │ │ │ │ │ -83 │ │ │ │ │ -84 │ │ │ │ │ -85 template │ │ │ │ │ -_8_6 std::shared_ptr _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std:: │ │ │ │ │ -shared_ptr& prec, │ │ │ │ │ -87 const O&) │ │ │ │ │ -88 { │ │ │ │ │ -89 return prec; │ │ │ │ │ -90 } │ │ │ │ │ -91 │ │ │ │ │ -92 template │ │ │ │ │ -93 std::shared_ptr │ │ │ │ │ -_9_4 _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std::shared_ptr& prec, │ │ │ │ │ -95 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) │ │ │ │ │ -96 { │ │ │ │ │ -97 return std::make_shared >(prec, │ │ │ │ │ -op->getCommunication()); │ │ │ │ │ -98 } │ │ │ │ │ -99 │ │ │ │ │ -100 template │ │ │ │ │ -101 std::shared_ptr │ │ │ │ │ -_1_0_2 _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std::shared_ptr& prec, │ │ │ │ │ -103 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) │ │ │ │ │ +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 │ │ │ │ │ +60 template │ │ │ │ │ +61 auto size(Vector const& vector, PriorityTag<1>) -> decltype(vector.size()) │ │ │ │ │ +{ return vector.size(); } │ │ │ │ │ +62 │ │ │ │ │ +63 │ │ │ │ │ +64 } // end namespace Impl │ │ │ │ │ +65 │ │ │ │ │ +_6_6namespace ForEach{ │ │ │ │ │ +67 │ │ │ │ │ +68 template │ │ │ │ │ +_6_9 auto _r_o_w_s(_M_a_t_r_i_x const& matrix) { return Impl::rows(matrix, PriorityTag<5> │ │ │ │ │ +{}); } │ │ │ │ │ +70 │ │ │ │ │ +71 template │ │ │ │ │ +_7_2 auto _c_o_l_s(_M_a_t_r_i_x const& matrix) { return Impl::cols(matrix, PriorityTag<5> │ │ │ │ │ +{}); } │ │ │ │ │ +73 │ │ │ │ │ +74 template │ │ │ │ │ +_7_5 auto _s_i_z_e(Vector const& vector) { return Impl::size(vector, PriorityTag<5> │ │ │ │ │ +{}); } │ │ │ │ │ +76 │ │ │ │ │ +77} // namespace ForEach │ │ │ │ │ +78 │ │ │ │ │ +79 │ │ │ │ │ +80 │ │ │ │ │ +81 │ │ │ │ │ +94template │ │ │ │ │ +_9_5std::size_t _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(Vector&& vector, F&& f, std::size_t offset = 0) │ │ │ │ │ +96{ │ │ │ │ │ +97 using V = std::decay_t; │ │ │ │ │ +98 if constexpr( Impl::IsScalar::value ) │ │ │ │ │ +99 { │ │ │ │ │ +100 f(vector, offset); │ │ │ │ │ +101 return 1; │ │ │ │ │ +102 } │ │ │ │ │ +103 else │ │ │ │ │ 104 { │ │ │ │ │ -105 return std::make_shared │ │ │ │ │ ->(prec, op->getCommunication()); │ │ │ │ │ -106 } │ │ │ │ │ -107 │ │ │ │ │ -108 template │ │ │ │ │ -_1_0_9 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ │ -shared_ptr<_M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_> >&) │ │ │ │ │ -110 { │ │ │ │ │ -111 return std::make_shared>(); │ │ │ │ │ -112 } │ │ │ │ │ -113 template │ │ │ │ │ -_1_1_4 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ │ -shared_ptr<_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) │ │ │ │ │ -115 { │ │ │ │ │ -116 return createScalarProduct(op->getCommunication(), op->category()); │ │ │ │ │ -117 } │ │ │ │ │ -118 │ │ │ │ │ -119 template │ │ │ │ │ -_1_2_0 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ │ -shared_ptr<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_> >& op) │ │ │ │ │ -121 { │ │ │ │ │ -122 return createScalarProduct(op->getCommunication(), op->category()); │ │ │ │ │ -123 } │ │ │ │ │ -124 │ │ │ │ │ -144 template │ │ │ │ │ -_1_4_5 class _S_o_l_v_e_r_F_a_c_t_o_r_y { │ │ │ │ │ -146 using Domain = typename Operator::domain_type; │ │ │ │ │ -147 using Range = typename Operator::range_type; │ │ │ │ │ -148 using _S_o_l_v_e_r = _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_>; │ │ │ │ │ -149 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r = _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>; │ │ │ │ │ -150 │ │ │ │ │ -151 template │ │ │ │ │ -152 using _matrix_type = typename O::matrix_type; │ │ │ │ │ -153 using matrix_type = Std::detected_or_t; │ │ │ │ │ -154 static constexpr bool isAssembled = !std::is_same::value; │ │ │ │ │ +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 // 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 static const matrix_type* getmat(std::shared_ptr op){ │ │ │ │ │ -157 std::shared_ptr> aop │ │ │ │ │ -158 = std::dynamic_pointer_cast>(op); │ │ │ │ │ -159 if(aop) │ │ │ │ │ -160 return &aop->getmat(); │ │ │ │ │ -161 return nullptr; │ │ │ │ │ -162 } │ │ │ │ │ -163 │ │ │ │ │ -164 public: │ │ │ │ │ -165 │ │ │ │ │ -_1_6_8 static std::shared_ptr _g_e_t(std::shared_ptr op, │ │ │ │ │ -169 const ParameterTree& config, │ │ │ │ │ -170 std::shared_ptr prec = nullptr){ │ │ │ │ │ -171 std::string type = config.get("type"); │ │ │ │ │ -172 std::shared_ptr result; │ │ │ │ │ -173 const matrix_type* _m_a_t = getmat(op); │ │ │ │ │ -174 if(_m_a_t){ │ │ │ │ │ -175 if (_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_m_a_t_r_i_x___t_y_p_e_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().contains │ │ │ │ │ -(type)) { │ │ │ │ │ -176 if(op->category()!=_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l){ │ │ │ │ │ -177 DUNE_THROW(NotImplemented, "The solver factory does not support parallel │ │ │ │ │ -direct solvers!"); │ │ │ │ │ -178 } │ │ │ │ │ -179 result = _D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_m_a_t_r_i_x___t_y_p_e_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ │ -(type, *_m_a_t, config); │ │ │ │ │ -180 return result; │ │ │ │ │ -181 } │ │ │ │ │ -182 } │ │ │ │ │ -183 // if no direct solver is found it might be an iterative solver │ │ │ │ │ -184 if (!_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().contains(type)) { │ │ │ │ │ -185 DUNE_THROW(Dune::InvalidStateException, "Solver not found in the │ │ │ │ │ -factory."); │ │ │ │ │ -186 } │ │ │ │ │ -187 if(!prec){ │ │ │ │ │ -188 const ParameterTree& precConfig = config.sub("preconditioner"); │ │ │ │ │ -189 std::string prec_type = precConfig.get("type"); │ │ │ │ │ -190 prec = _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ │ -(prec_type, op, precConfig); │ │ │ │ │ -191 if (prec->category() != op->category() && prec->category() == │ │ │ │ │ -_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l) │ │ │ │ │ -192 // try to wrap to a parallel preconditioner │ │ │ │ │ -193 prec = _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(prec, op); │ │ │ │ │ -194 } │ │ │ │ │ -195 std::shared_ptr> sp = _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(op); │ │ │ │ │ -196 result = _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create(type, op, │ │ │ │ │ -sp, prec, config); │ │ │ │ │ -197 return result; │ │ │ │ │ -198 } │ │ │ │ │ -199 │ │ │ │ │ -_2_0_3 static std::shared_ptr _g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r(std:: │ │ │ │ │ -shared_ptr op, │ │ │ │ │ -204 const ParameterTree& config){ │ │ │ │ │ -205 const matrix_type* _m_a_t = getmat(op); │ │ │ │ │ -206 if(_m_a_t){ │ │ │ │ │ -207 std::string prec_type = config.get("type"); │ │ │ │ │ -208 return _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ │ -(prec_type, op, config); │ │ │ │ │ -209 }else{ │ │ │ │ │ -210 DUNE_THROW(InvalidStateException, "Could not obtain matrix from operator. │ │ │ │ │ -Please pass in an AssembledLinearOperator."); │ │ │ │ │ -211 } │ │ │ │ │ -212 } │ │ │ │ │ -213 }; │ │ │ │ │ -214 │ │ │ │ │ -225 template │ │ │ │ │ -226 std::shared_ptr> _g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y(std:: │ │ │ │ │ -shared_ptr op, │ │ │ │ │ -228 const ParameterTree& config, │ │ │ │ │ -229 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r> prec = nullptr){ │ │ │ │ │ -231 return _S_o_l_v_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_>_:_:_g_e_t(op, config, prec); │ │ │ │ │ -232 } │ │ │ │ │ -233 │ │ │ │ │ -237} // end namespace Dune │ │ │ │ │ -238 │ │ │ │ │ -239 │ │ │ │ │ -240#endif │ │ │ │ │ -_s_c_h_w_a_r_z_._h_h │ │ │ │ │ -_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h │ │ │ │ │ -_n_o_v_l_p_s_c_h_w_a_r_z_._h_h │ │ │ │ │ -_s_o_l_v_e_r_._h_h │ │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y │ │ │ │ │ -Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > > │ │ │ │ │ -PreconditionerFactory │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ │ -Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > > │ │ │ │ │ -DirectSolverFactory │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ │ -std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< │ │ │ │ │ -LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, │ │ │ │ │ -const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &) │ │ │ │ │ -IterativeSolverSignature │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l │ │ │ │ │ -std::shared_ptr< Preconditioner > wrapPreconditioner4Parallel(const std:: │ │ │ │ │ -shared_ptr< Preconditioner > &prec, const O &) │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ │ -std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &) │ │ │ │ │ -DirectSolverSignature │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y │ │ │ │ │ -std::shared_ptr< InverseOperator< typename Operator::domain_type, typename │ │ │ │ │ -Operator::range_type > > getSolverFromFactory(std::shared_ptr< Operator > op, │ │ │ │ │ -const ParameterTree &config, std::shared_ptr< Preconditioner< typename │ │ │ │ │ -Operator::domain_type, typename Operator::range_type > > prec=nullptr) │ │ │ │ │ -Instantiates an InverseOperator from an Operator and a configuration given as a │ │ │ │ │ -ParameterTree. │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:227 │ │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ │ -Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > > │ │ │ │ │ -IterativeSolverFactory │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:42 │ │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ │ -std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const │ │ │ │ │ -ParameterTree &) PreconditionerSignature │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:34 │ │ │ │ │ +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 auto [ dummyRows, dummyCols ] = _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); │ │ │ │ │ +171 assert( dummyRows == blockRows and dummyCols == blockCols and "we need the │ │ │ │ │ +same size of each block in this matrix type"); │ │ │ │ │ +172 } │ │ │ │ │ +173 } │ │ │ │ │ +174 │ │ │ │ │ +175 return { matrix.N()*blockRows, matrix.M()*blockCols }; │ │ │ │ │ +176 } │ │ │ │ │ +177 // all other matrix types are accessed index-wise with dynamic flat row/col │ │ │ │ │ +counting │ │ │ │ │ +178 else │ │ │ │ │ +179 { │ │ │ │ │ +180 std::size_t r = 0, c = 0; │ │ │ │ │ +181 std::size_t nRows, nCols; │ │ │ │ │ +182 │ │ │ │ │ +183 Hybrid::forEach(Dune::range(_F_o_r_E_a_c_h_:_:_r_o_w_s(matrix)), [&](auto i) { │ │ │ │ │ +184 c = 0; │ │ │ │ │ +185 Hybrid::forEach(Dune::range(_F_o_r_E_a_c_h_:_:_c_o_l_s(matrix)), [&](auto j) { │ │ │ │ │ +186 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); │ │ │ │ │ +187 c += nCols; │ │ │ │ │ +188 }); │ │ │ │ │ +189 r += nRows; │ │ │ │ │ +190 }); │ │ │ │ │ +191 return {r,c}; │ │ │ │ │ +192 } │ │ │ │ │ +193 } │ │ │ │ │ +194} │ │ │ │ │ +195 │ │ │ │ │ +196} // 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_:_:_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_:_:_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:137 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ │ -An overlapping Schwarz operator. │ │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:32 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_ _D_o_m_a_i_n_,_ _R_a_n_g_e_ _> │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ │ -@ sequential │ │ │ │ │ -Category for sequential solvers. │ │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ │ -Factory to assembly solvers configured by a ParameterTree. │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:145 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_:_:_g_e_t │ │ │ │ │ -static std::shared_ptr< Solver > get(std::shared_ptr< Operator > op, const │ │ │ │ │ -ParameterTree &config, std::shared_ptr< Preconditioner > prec=nullptr) │ │ │ │ │ -get a solver from the factory │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:168 │ │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_:_:_g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -static std::shared_ptr< Preconditioner > getPreconditioner(std::shared_ptr< │ │ │ │ │ -Operator > op, const ParameterTree &config) │ │ │ │ │ -Construct a Preconditioner for a given Operator. │ │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:203 │ │ │ │ │ +_D_u_n_e_:_:_f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h │ │ │ │ │ +std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, │ │ │ │ │ +std::size_t rowOffset=0, std::size_t colOffset=0) │ │ │ │ │ +Traverse a blocked matrix and call a functor at each scalar entry. │ │ │ │ │ +DDeeffiinniittiioonn foreach.hh:132 │ │ │ │ │ +_D_u_n_e_:_:_f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h │ │ │ │ │ +std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0) │ │ │ │ │ +Traverse a blocked vector and call a functor at each scalar entry. │ │ │ │ │ +DDeeffiinniittiioonn foreach.hh:95 │ │ │ │ │ +_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_r_o_w_s │ │ │ │ │ +auto rows(Matrix const &matrix) │ │ │ │ │ +DDeeffiinniittiioonn foreach.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_c_o_l_s │ │ │ │ │ +auto cols(Matrix const &matrix) │ │ │ │ │ +DDeeffiinniittiioonn foreach.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_s_i_z_e │ │ │ │ │ +auto size(Vector const &vector) │ │ │ │ │ +DDeeffiinniittiioonn foreach.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M │ │ │ │ │ +size_type M() const │ │ │ │ │ +Return the number of columns. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:700 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ +size_type N() const │ │ │ │ │ +Return the number of rows. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00200.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvers.hh File Reference │ │ │ │ +dune-istl: solver.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,111 +71,70 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ + │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Implementations of the inverse operator interface. │ │ │ │ +

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

│ │ │ │ -
#include <array>
│ │ │ │ -#include <cmath>
│ │ │ │ -#include <complex>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <vector>
│ │ │ │ +
#include <iomanip>
│ │ │ │ +#include <ostream>
│ │ │ │ +#include <string>
│ │ │ │ +#include <functional>
│ │ │ │ #include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/math.hh>
│ │ │ │ +#include <dune/common/shared_ptr.hh>
│ │ │ │ #include <dune/common/simd/io.hh>
│ │ │ │ #include <dune/common/simd/simd.hh>
│ │ │ │ -#include <dune/common/std/type_traits.hh>
│ │ │ │ +#include <dune/common/parametertree.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 "solvertype.hh"
│ │ │ │ +#include "preconditioner.hh"
│ │ │ │ +#include "operators.hh"
│ │ │ │ +#include "scalarproducts.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::LoopSolver< X >
 Preconditioned loop solver. More...
struct  Dune::InverseOperatorResult
 Statistics about the application of an inverse operator. More...
 
class  Dune::GradientSolver< X >
 gradient method More...
class  Dune::InverseOperator< X, Y >
 Abstract base class for all solvers. More...
 
class  Dune::CGSolver< X >
 conjugate gradient method More...
class  Dune::IterativeSolver< X, Y >
 Base class for all implementations of iterative solvers. More...
 
class  Dune::BiCGSTABSolver< X >
 Bi-conjugate Gradient Stabilized (BiCG-STAB) More...
class  Dune::IterativeSolver< X, Y >::Iteration< CountType >
 Class for controlling iterative methods. More...
 
class  Dune::MINRESSolver< X >
 Minimal Residual Method (MINRES) 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...
 
class  Dune::RestartedGMResSolver< X, Y, F >
 implements the Generalized Minimal Residual (GMRes) method 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...
 
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::SolverHelper< ISTLLinearSolver, BCRSMatrix >::Implementation< true, Dummy >
 Implementation that works together with direct ISTL solvers, e.g. Dune::SuperLU or Dune::UMFPack. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

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

Detailed Description

│ │ │ │ -

Implementations of the inverse operator interface.

│ │ │ │ -

This file provides various preconditioned Krylov methods.

│ │ │ │ +

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.

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

Some generic functions for pretty printing vectors and matrices. │ │ │ │ +

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

│ │ │ │
#include <cmath>
│ │ │ │ #include <complex>
│ │ │ │ -#include <limits>
│ │ │ │ -#include <ios>
│ │ │ │ +#include <iostream>
│ │ │ │ #include <iomanip>
│ │ │ │ -#include <fstream>
│ │ │ │ #include <string>
│ │ │ │ -#include "matrixutils.hh"
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/hybridutilities.hh>
│ │ │ │ -#include <dune/common/reservedvector.hh>
│ │ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/shared_ptr.hh>
│ │ │ │ +#include "bvector.hh"
│ │ │ │ +#include "solvercategory.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::DefaultSVGMatrixOptions
 Default options class to write SVG matrices. More...
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...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Functions

template<class V >
void Dune::recursive_printvector (std::ostream &s, const V &v, std::string rowtext, int &counter, int columns, int width)
 Recursively print a vector.
 
template<class V >
void Dune::printvector (std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
 Print an ISTL vector.
 
void Dune::fill_row (std::ostream &s, int m, int width, int precision)
 Print a row of zeros for a non-existing block.
 
template<class K >
void Dune::print_row (std::ostream &s, const K &value, typename FieldMatrix< K, 1, 1 >::size_type I, typename FieldMatrix< K, 1, 1 >::size_type J, typename FieldMatrix< K, 1, 1 >::size_type therow, int width, int precision, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
 Print one row of a matrix, specialization for number types.
 
template<class M >
void Dune::print_row (std::ostream &s, const M &A, typename M::size_type I, typename M::size_type J, typename M::size_type therow, int width, int precision, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr)
 Print one row of a matrix.
 
template<class M >
void Dune::printmatrix (std::ostream &s, const M &A, std::string title, std::string rowtext, int width=10, int precision=2)
 Print a generic block matrix.
 
template<class B , int n, int m, class A >
void Dune::printSparseMatrix (std::ostream &s, const BCRSMatrix< FieldMatrix< B, n, m >, A > &mat, std::string title, std::string rowtext, int width=3, int precision=2)
 Prints a BCRSMatrix with fixed sized blocks.
 
template<class FieldType >
void Dune::writeMatrixToMatlabHelper (const FieldType &value, int rowOffset, int colOffset, std::ostream &s, typename std::enable_if_t< Dune::IsNumber< FieldType >::value > *sfinae=nullptr)
 Helper method for the writeMatrixToMatlab routine.
 
template<class MatrixType >
void Dune::writeMatrixToMatlabHelper (const MatrixType &matrix, int externalRowOffset, int externalColOffset, std::ostream &s, typename std::enable_if_t<!Dune::IsNumber< MatrixType >::value > *sfinae=nullptr)
 Helper method for the writeMatrixToMatlab routine.
 
template<class MatrixType >
void Dune::writeMatrixToMatlab (const MatrixType &matrix, const std::string &filename, int outputPrecision=18)
 Writes sparse matrix in a Matlab-readable format.
 
template<class V >
void Dune::writeVectorToMatlabHelper (const V &v, std::ostream &stream)
 
template<class VectorType >
void Dune::writeVectorToMatlab (const VectorType &vector, const std::string &filename, int outputPrecision=18)
 Writes vectors in a Matlab-readable format.
 
template<class Mat , class SVGOptions = DefaultSVGMatrixOptions>
void Dune::writeSVGMatrix (const Mat &mat, std::ostream &out, SVGOptions opts={})
 Writes the visualization of matrix in the SVG format.
 
template<class X , class Comm >
std::shared_ptr< ScalarProduct< X > > Dune::makeScalarProduct (std::shared_ptr< const Comm > comm, SolverCategory::Category category)
 Choose the approriate scalar product for a solver category.
 
template<class X , class Comm >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const Comm &comm, SolverCategory::Category category)
 
│ │ │ │

Detailed Description

│ │ │ │ -

Some generic functions for pretty printing vectors and matrices.

│ │ │ │ +

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,108 +1,60 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -io.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_. │ │ │ │ │ -Some generic functions for pretty printing vectors and matrices. _M_o_r_e_._._. │ │ │ │ │ +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 "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ │ -#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -#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_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +#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" │ │ │ │ │ _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_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s │ │ │ │ │ -  Default options class to write SVG matrices. _M_o_r_e_._._. │ │ │ │ │ +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_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r (std::ostream &s, const V &v, std::string │ │ │ │ │ - rowtext, int &counter, int columns, int width) │ │ │ │ │ -  Recursively print a vector. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r (std::ostream &s, const V &v, std::string title, std:: │ │ │ │ │ - string rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ -  Print an _I_S_T_L vector. │ │ │ │ │ -  │ │ │ │ │ -void  _D_u_n_e_:_:_f_i_l_l___r_o_w (std::ostream &s, int m, int width, int precision) │ │ │ │ │ -  Print a row of zeros for a non-existing block. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_p_r_i_n_t___r_o_w (std::ostream &s, const K &value, typename _F_i_e_l_d_M_a_t_r_i_x< │ │ │ │ │ - K, 1, 1 >::size_type I, typename _F_i_e_l_d_M_a_t_r_i_x< K, 1, 1 >::size_type J, │ │ │ │ │ - typename _F_i_e_l_d_M_a_t_r_i_x< K, 1, 1 >::size_type therow, int width, int │ │ │ │ │ - precision, typename std::enable_if_t< Dune::IsNumber< K >::value > │ │ │ │ │ - *sfinae=nullptr) │ │ │ │ │ -  Print one row of a matrix, specialization for number types. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_p_r_i_n_t___r_o_w (std::ostream &s, const M &A, typename M::size_type I, │ │ │ │ │ - typename M::size_type J, typename M::size_type therow, int width, int │ │ │ │ │ - precision, typename std::enable_if_t::value > │ │ │ │ │ - *sfinae=nullptr) │ │ │ │ │ -  Print one row of a matrix. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_p_r_i_n_t_m_a_t_r_i_x (std::ostream &s, const M &A, std::string title, std:: │ │ │ │ │ - string rowtext, int width=10, int precision=2) │ │ │ │ │ -  Print a generic block matrix. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_p_r_i_n_t_S_p_a_r_s_e_M_a_t_r_i_x (std::ostream &s, const _B_C_R_S_M_a_t_r_i_x< _F_i_e_l_d_M_a_t_r_i_x< │ │ │ │ │ - B, n, m >, A > &_m_a_t, std::string title, std::string rowtext, int width=3, │ │ │ │ │ - int precision=2) │ │ │ │ │ -  Prints a _B_C_R_S_M_a_t_r_i_x with fixed sized blocks. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const FieldType &value, int rowOffset, │ │ │ │ │ - int colOffset, std::ostream &s, typename std::enable_if_t< Dune:: │ │ │ │ │ - IsNumber< FieldType >::value > *sfinae=nullptr) │ │ │ │ │ -  Helper method for the writeMatrixToMatlab routine. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const MatrixType &matrix, int │ │ │ │ │ - externalRowOffset, int externalColOffset, std::ostream &s, typename std:: │ │ │ │ │ - enable_if_t::value > *sfinae=nullptr) │ │ │ │ │ -  Helper method for the writeMatrixToMatlab routine. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b (const MatrixType &matrix, const std::string │ │ │ │ │ - &filename, int outputPrecision=18) │ │ │ │ │ -  Writes sparse matrix in a Matlab-readable format. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const V &v, std::ostream &stream) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b (const VectorType &vector, const std::string │ │ │ │ │ - &filename, int outputPrecision=18) │ │ │ │ │ -  Writes vectors in a Matlab-readable format. │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_w_r_i_t_e_S_V_G_M_a_t_r_i_x (const Mat &_m_a_t, std::ostream &out, SVGOptions opts= │ │ │ │ │ - {}) │ │ │ │ │ -  Writes the visualization of matrix in the SVG format. │ │ │ │ │ +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 approriate 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 ********** │ │ │ │ │ -Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ +Define base class for scalar product and norm. │ │ │ │ │ +These classes have to be implemented differently for different data │ │ │ │ │ +partitioning strategies. Default implementations for the sequential case are │ │ │ │ │ +provided. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00203_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: io.hh Source File │ │ │ │ +dune-istl: scalarproducts.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,710 +74,224 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
io.hh
│ │ │ │ +
scalarproducts.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_IO_HH
│ │ │ │ -
6#define DUNE_ISTL_IO_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_SCALARPRODUCTS_HH
│ │ │ │ +
6#define DUNE_ISTL_SCALARPRODUCTS_HH
│ │ │ │
7
│ │ │ │
8#include <cmath>
│ │ │ │
9#include <complex>
│ │ │ │ -
10#include <limits>
│ │ │ │ -
11#include <ios>
│ │ │ │ -
12#include <iomanip>
│ │ │ │ -
13#include <fstream>
│ │ │ │ -
14#include <string>
│ │ │ │ -
15
│ │ │ │ -
16#include "matrixutils.hh"
│ │ │ │ -
17#include "istlexception.hh"
│ │ │ │ -
18#include <dune/common/fvector.hh>
│ │ │ │ -
19#include <dune/common/fmatrix.hh>
│ │ │ │ -
20#include <dune/common/hybridutilities.hh>
│ │ │ │ -
21#include <dune/common/reservedvector.hh>
│ │ │ │ -
22
│ │ │ │ - │ │ │ │ - │ │ │ │ -
25
│ │ │ │ -
26namespace Dune {
│ │ │ │ -
27
│ │ │ │ -
40 //
│ │ │ │ -
41 // pretty printing of vectors
│ │ │ │ -
42 //
│ │ │ │ -
43
│ │ │ │ -
51 template<class V>
│ │ │ │ -
│ │ │ │ -
52 void recursive_printvector (std::ostream& s, const V& v, std::string rowtext,
│ │ │ │ -
53 int& counter, int columns, int width)
│ │ │ │ -
54 {
│ │ │ │ -
55 if constexpr (IsNumber<V>())
│ │ │ │ -
56 {
│ │ │ │ -
57 // Print one number
│ │ │ │ -
58 if (counter%columns==0)
│ │ │ │ -
59 {
│ │ │ │ -
60 s << rowtext; // start a new row
│ │ │ │ -
61 s << " "; // space in front of each entry
│ │ │ │ -
62 s.width(4); // set width for counter
│ │ │ │ -
63 s << counter; // number of first entry in a line
│ │ │ │ -
64 }
│ │ │ │ -
65 s << " "; // space in front of each entry
│ │ │ │ -
66 s.width(width); // set width for each entry anew
│ │ │ │ -
67 s << v; // yeah, the number !
│ │ │ │ -
68 counter++; // increment the counter
│ │ │ │ -
69 if (counter%columns==0)
│ │ │ │ -
70 s << std::endl; // start a new line
│ │ │ │ -
71 }
│ │ │ │ -
72 else
│ │ │ │ -
73 {
│ │ │ │ -
74 // Recursively print a vector
│ │ │ │ -
75 for (const auto& entry : v)
│ │ │ │ -
76 recursive_printvector(s,entry,rowtext,counter,columns,width);
│ │ │ │ -
77 }
│ │ │ │ -
78 }
│ │ │ │ -
│ │ │ │ -
79
│ │ │ │ -
80
│ │ │ │ -
88 template<class V>
│ │ │ │ -
│ │ │ │ -
89 void printvector (std::ostream& s, const V& v, std::string title,
│ │ │ │ -
90 std::string rowtext, int columns=1, int width=10,
│ │ │ │ -
91 int precision=2)
│ │ │ │ -
92 {
│ │ │ │ -
93 // count the numbers printed to make columns
│ │ │ │ -
94 int counter=0;
│ │ │ │ -
95
│ │ │ │ -
96 // remember old flags
│ │ │ │ -
97 std::ios_base::fmtflags oldflags = s.flags();
│ │ │ │ -
98
│ │ │ │ -
99 // set the output format
│ │ │ │ -
100 s.setf(std::ios_base::scientific, std::ios_base::floatfield);
│ │ │ │ -
101 int oldprec = s.precision();
│ │ │ │ -
102 s.precision(precision);
│ │ │ │ -
103
│ │ │ │ -
104 // print title
│ │ │ │ -
105 s << title << " [blocks=" << v.N() << ",dimension=" << v.dim() << "]"
│ │ │ │ -
106 << std::endl;
│ │ │ │ -
107
│ │ │ │ -
108 // print data from all blocks
│ │ │ │ -
109 recursive_printvector(s,v,rowtext,counter,columns,width);
│ │ │ │ -
110
│ │ │ │ -
111 // check if new line is required
│ │ │ │ -
112 if (counter%columns!=0)
│ │ │ │ -
113 s << std::endl;
│ │ │ │ +
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"
│ │ │ │ +
20
│ │ │ │ +
21
│ │ │ │ +
22namespace Dune {
│ │ │ │ +
51 template<class X>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
53 public:
│ │ │ │ +
55 typedef X domain_type;
│ │ │ │ +
56 typedef typename X::field_type field_type;
│ │ │ │ +
57 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ +
58
│ │ │ │ +
│ │ │ │ +
63 virtual field_type dot (const X& x, const X& y) const
│ │ │ │ +
64 {
│ │ │ │ +
65 return x.dot(y);
│ │ │ │ +
66 }
│ │ │ │ +
│ │ │ │ +
67
│ │ │ │ +
│ │ │ │ +
71 virtual real_type norm (const X& x) const
│ │ │ │ +
72 {
│ │ │ │ +
73 return x.two_norm();
│ │ │ │ +
74 }
│ │ │ │ +
│ │ │ │ +
75
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
78 {
│ │ │ │ + │ │ │ │ +
80 }
│ │ │ │ +
│ │ │ │ +
81
│ │ │ │ +
83 virtual ~ScalarProduct () {}
│ │ │ │ +
84 };
│ │ │ │ +
│ │ │ │ +
85
│ │ │ │ +
97 template<class X, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
99 {
│ │ │ │ +
100 public:
│ │ │ │ +
105 typedef X domain_type;
│ │ │ │ +
107 typedef typename X::field_type field_type;
│ │ │ │ +
108 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ │ + │ │ │ │
114
│ │ │ │ -
115 // reset the output format
│ │ │ │ -
116 s.flags(oldflags);
│ │ │ │ -
117 s.precision(oldprec);
│ │ │ │ -
118 }
│ │ │ │ -
│ │ │ │ -
119
│ │ │ │ -
120
│ │ │ │ -
122 //
│ │ │ │ -
123 // pretty printing of matrices
│ │ │ │ -
124 //
│ │ │ │ -
125
│ │ │ │ -
│ │ │ │ -
133 inline void fill_row (std::ostream& s, int m, int width, [[maybe_unused]] int precision)
│ │ │ │ -
134 {
│ │ │ │ -
135 for (int j=0; j<m; j++)
│ │ │ │ -
136 {
│ │ │ │ -
137 s << " "; // space in front of each entry
│ │ │ │ -
138 s.width(width); // set width for each entry anew
│ │ │ │ -
139 s << "."; // yeah, the number !
│ │ │ │ -
140 }
│ │ │ │ -
141 }
│ │ │ │ -
│ │ │ │ -
142
│ │ │ │ -
150 template<class K>
│ │ │ │ -
│ │ │ │ -
151 void print_row (std::ostream& s, const K& value,
│ │ │ │ -
152 [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type I,
│ │ │ │ -
153 [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type J,
│ │ │ │ -
154 [[maybe_unused]] typename FieldMatrix<K,1,1>::size_type therow,
│ │ │ │ -
155 int width,
│ │ │ │ -
156 [[maybe_unused]] int precision,
│ │ │ │ -
157 typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr)
│ │ │ │ -
158 {
│ │ │ │ -
159 s << " "; // space in front of each entry
│ │ │ │ -
160 s.width(width); // set width for each entry anew
│ │ │ │ -
161 s << value;
│ │ │ │ -
162 }
│ │ │ │ -
│ │ │ │ -
163
│ │ │ │ -
171 template<class M>
│ │ │ │ -
│ │ │ │ -
172 void print_row (std::ostream& s, const M& A, typename M::size_type I,
│ │ │ │ -
173 typename M::size_type J, typename M::size_type therow,
│ │ │ │ -
174 int width, int precision,
│ │ │ │ -
175 typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr)
│ │ │ │ -
176 {
│ │ │ │ -
177 typename M::size_type i0=I;
│ │ │ │ -
178 for (typename M::size_type i=0; i<A.N(); i++)
│ │ │ │ -
179 {
│ │ │ │ -
180 if (therow>=i0 && therow<i0+MatrixDimension<M>::rowdim(A,i))
│ │ │ │ -
181 {
│ │ │ │ -
182 // the row is in this block row !
│ │ │ │ -
183 typename M::size_type j0=J;
│ │ │ │ -
184 for (typename M::size_type j=0; j<A.M(); j++)
│ │ │ │ -
185 {
│ │ │ │ -
186 // find this block
│ │ │ │ -
187 typename M::ConstColIterator it = A[i].find(j);
│ │ │ │ -
188
│ │ │ │ -
189 // print row or filler
│ │ │ │ -
190 if (it!=A[i].end())
│ │ │ │ -
191 print_row(s,*it,i0,j0,therow,width,precision);
│ │ │ │ -
192 else
│ │ │ │ -
193 fill_row(s,MatrixDimension<M>::coldim(A,j),width,precision);
│ │ │ │ -
194
│ │ │ │ -
195 // advance columns
│ │ │ │ - │ │ │ │ -
197 }
│ │ │ │ -
198 }
│ │ │ │ -
199 // advance rows
│ │ │ │ - │ │ │ │ -
201 }
│ │ │ │ -
202 }
│ │ │ │ -
│ │ │ │ -
203
│ │ │ │ -
212 template<class M>
│ │ │ │ -
│ │ │ │ -
213 void printmatrix (std::ostream& s, const M& A, std::string title,
│ │ │ │ -
214 std::string rowtext, int width=10, int precision=2)
│ │ │ │ -
215 {
│ │ │ │ -
216
│ │ │ │ -
217 // remember old flags
│ │ │ │ -
218 std::ios_base::fmtflags oldflags = s.flags();
│ │ │ │ -
219
│ │ │ │ -
220 // set the output format
│ │ │ │ -
221 s.setf(std::ios_base::scientific, std::ios_base::floatfield);
│ │ │ │ -
222 int oldprec = s.precision();
│ │ │ │ -
223 s.precision(precision);
│ │ │ │ -
224
│ │ │ │ -
225 // print title
│ │ │ │ -
226 s << title
│ │ │ │ -
227 << " [n=" << A.N()
│ │ │ │ -
228 << ",m=" << A.M()
│ │ │ │ -
229 << ",rowdim=" << MatrixDimension<M>::rowdim(A)
│ │ │ │ -
230 << ",coldim=" << MatrixDimension<M>::coldim(A)
│ │ │ │ -
231 << "]" << std::endl;
│ │ │ │ -
232
│ │ │ │ -
233 // print all rows
│ │ │ │ -
234 for (typename M::size_type i=0; i<MatrixDimension<M>::rowdim(A); i++)
│ │ │ │ -
235 {
│ │ │ │ -
236 s << rowtext; // start a new row
│ │ │ │ -
237 s << " "; // space in front of each entry
│ │ │ │ -
238 s.width(4); // set width for counter
│ │ │ │ -
239 s << i; // number of first entry in a line
│ │ │ │ -
240 print_row(s,A,0,0,i,width,precision); // generic print
│ │ │ │ -
241 s << std::endl; // start a new line
│ │ │ │ -
242 }
│ │ │ │ -
243
│ │ │ │ -
244 // reset the output format
│ │ │ │ -
245 s.flags(oldflags);
│ │ │ │ -
246 s.precision(oldprec);
│ │ │ │ -
247 }
│ │ │ │ -
│ │ │ │ -
248
│ │ │ │ -
270 template<class B, int n, int m, class A>
│ │ │ │ -
│ │ │ │ -
271 void printSparseMatrix(std::ostream& s,
│ │ │ │ - │ │ │ │ -
273 std::string title, std::string rowtext,
│ │ │ │ -
274 int width=3, int precision=2)
│ │ │ │ -
275 {
│ │ │ │ - │ │ │ │ -
277 // remember old flags
│ │ │ │ -
278 std::ios_base::fmtflags oldflags = s.flags();
│ │ │ │ -
279 // set the output format
│ │ │ │ -
280 s.setf(std::ios_base::scientific, std::ios_base::floatfield);
│ │ │ │ -
281 int oldprec = s.precision();
│ │ │ │ -
282 s.precision(precision);
│ │ │ │ -
283 // print title
│ │ │ │ -
284 s << title
│ │ │ │ -
285 << " [n=" << mat.N()
│ │ │ │ -
286 << ",m=" << mat.M()
│ │ │ │ -
287 << ",rowdim=" << MatrixDimension<Matrix>::rowdim(mat)
│ │ │ │ -
288 << ",coldim=" << MatrixDimension<Matrix>::coldim(mat)
│ │ │ │ -
289 << "]" << std::endl;
│ │ │ │ -
290
│ │ │ │ -
291 typedef typename Matrix::ConstRowIterator Row;
│ │ │ │ -
292
│ │ │ │ -
293 for(Row row=mat.begin(); row != mat.end(); ++row) {
│ │ │ │ -
294 int skipcols=0;
│ │ │ │ -
295 bool reachedEnd=false;
│ │ │ │ -
296
│ │ │ │ -
297 while(!reachedEnd) {
│ │ │ │ -
298 for(int innerrow=0; innerrow<n; ++innerrow) {
│ │ │ │ -
299 int count=0;
│ │ │ │ -
300 typedef typename Matrix::ConstColIterator Col;
│ │ │ │ -
301 Col col=row->begin();
│ │ │ │ -
302 for(; col != row->end(); ++col,++count) {
│ │ │ │ -
303 if(count<skipcols)
│ │ │ │ -
304 continue;
│ │ │ │ -
305 if(count>=skipcols+width)
│ │ │ │ -
306 break;
│ │ │ │ -
307 if(innerrow==0) {
│ │ │ │ -
308 if(count==skipcols) {
│ │ │ │ -
309 s << rowtext; // start a new row
│ │ │ │ -
310 s << " "; // space in front of each entry
│ │ │ │ -
311 s.width(4); // set width for counter
│ │ │ │ -
312 s << row.index()<<": "; // number of first entry in a line
│ │ │ │ -
313 }
│ │ │ │ -
314 s.width(4);
│ │ │ │ -
315 s<<col.index()<<": |";
│ │ │ │ -
316 } else {
│ │ │ │ -
317 if(count==skipcols) {
│ │ │ │ -
318 for(typename std::string::size_type i=0; i < rowtext.length(); i++)
│ │ │ │ -
319 s<<" ";
│ │ │ │ -
320 s<<" ";
│ │ │ │ -
321 }
│ │ │ │ -
322 s<<" |";
│ │ │ │ -
323 }
│ │ │ │ -
324 for(int innercol=0; innercol < m; ++innercol) {
│ │ │ │ -
325 s.width(9);
│ │ │ │ -
326 s<<(*col)[innerrow][innercol]<<" ";
│ │ │ │ -
327 }
│ │ │ │ -
328
│ │ │ │ -
329 s<<"|";
│ │ │ │ -
330 }
│ │ │ │ -
331 if(innerrow==n-1 && col==row->end())
│ │ │ │ -
332 reachedEnd = true;
│ │ │ │ -
333 else
│ │ │ │ -
334 s << std::endl;
│ │ │ │ -
335 }
│ │ │ │ -
336 skipcols += width;
│ │ │ │ -
337 s << std::endl;
│ │ │ │ -
338 }
│ │ │ │ -
339 s << std::endl;
│ │ │ │ -
340 }
│ │ │ │ -
341
│ │ │ │ -
342 // reset the output format
│ │ │ │ -
343 s.flags(oldflags);
│ │ │ │ -
344 s.precision(oldprec);
│ │ │ │ -
345 }
│ │ │ │ -
│ │ │ │ -
346
│ │ │ │ -
347 namespace
│ │ │ │ -
348 {
│ │ │ │ -
349 template<typename T>
│ │ │ │ -
350 struct MatlabPODWriter
│ │ │ │ -
351 {
│ │ │ │ -
352 static std::ostream& write(const T& t, std::ostream& s)
│ │ │ │ -
353 {
│ │ │ │ -
354 s << t;
│ │ │ │ -
355 return s;
│ │ │ │ -
356 }
│ │ │ │ -
357 };
│ │ │ │ -
358 template<typename T>
│ │ │ │ -
359 struct MatlabPODWriter<std::complex<T> >
│ │ │ │ -
360 {
│ │ │ │ -
361 static std::ostream& write(const std::complex<T>& t, std::ostream& s)
│ │ │ │ -
362 {
│ │ │ │ -
363 s << t.real() << " " << t.imag();
│ │ │ │ -
364 return s;
│ │ │ │ -
365 }
│ │ │ │ -
366 };
│ │ │ │ -
367 } // anonymous namespace
│ │ │ │ -
368
│ │ │ │ -
378 template <class FieldType>
│ │ │ │ -
│ │ │ │ -
379 void writeMatrixToMatlabHelper(const FieldType& value,
│ │ │ │ -
380 int rowOffset, int colOffset,
│ │ │ │ -
381 std::ostream& s,
│ │ │ │ -
382 typename std::enable_if_t<Dune::IsNumber<FieldType>::value>* sfinae = nullptr)
│ │ │ │ -
383 {
│ │ │ │ -
384 //+1 for Matlab numbering
│ │ │ │ -
385 s << rowOffset + 1 << " " << colOffset + 1 << " ";
│ │ │ │ -
386 MatlabPODWriter<FieldType>::write(value, s)<< std::endl;
│ │ │ │ -
387 }
│ │ │ │ -
│ │ │ │ -
388
│ │ │ │ -
396 template <class MatrixType>
│ │ │ │ -
│ │ │ │ -
397 void writeMatrixToMatlabHelper(const MatrixType& matrix,
│ │ │ │ -
398 int externalRowOffset, int externalColOffset,
│ │ │ │ -
399 std::ostream& s,
│ │ │ │ -
400 typename std::enable_if_t<!Dune::IsNumber<MatrixType>::value>* sfinae = nullptr)
│ │ │ │ -
401 {
│ │ │ │ -
402 // Precompute the accumulated sizes of the columns
│ │ │ │ -
403 std::vector<typename MatrixType::size_type> colOffset(matrix.M());
│ │ │ │ -
404 if (colOffset.size() > 0)
│ │ │ │ -
405 colOffset[0] = 0;
│ │ │ │ -
406
│ │ │ │ -
407 for (typename MatrixType::size_type i=0; i<matrix.M()-1; i++)
│ │ │ │ -
408 colOffset[i+1] = colOffset[i] +
│ │ │ │ - │ │ │ │ -
410
│ │ │ │ -
411 typename MatrixType::size_type rowOffset = 0;
│ │ │ │ -
412
│ │ │ │ -
413 // Loop over all matrix rows
│ │ │ │ -
414 for (typename MatrixType::size_type rowIdx=0; rowIdx<matrix.N(); rowIdx++)
│ │ │ │ -
415 {
│ │ │ │ -
416 auto cIt = matrix[rowIdx].begin();
│ │ │ │ -
417 auto cEndIt = matrix[rowIdx].end();
│ │ │ │ -
418
│ │ │ │ -
419 // Loop over all columns in this row
│ │ │ │ -
420 for (; cIt!=cEndIt; ++cIt)
│ │ │ │ - │ │ │ │ -
422 externalRowOffset+rowOffset,
│ │ │ │ -
423 externalColOffset + colOffset[cIt.index()],
│ │ │ │ -
424 s);
│ │ │ │ -
425
│ │ │ │ -
426 rowOffset += MatrixDimension<MatrixType>::rowdim(matrix, rowIdx);
│ │ │ │ -
427 }
│ │ │ │ -
428
│ │ │ │ -
429 }
│ │ │ │ -
│ │ │ │ -
430
│ │ │ │ -
450 template <class MatrixType>
│ │ │ │ -
│ │ │ │ -
451 void writeMatrixToMatlab(const MatrixType& matrix,
│ │ │ │ -
452 const std::string& filename, int outputPrecision = 18)
│ │ │ │ -
453 {
│ │ │ │ -
454 std::ofstream outStream(filename.c_str());
│ │ │ │ -
455 int oldPrecision = outStream.precision();
│ │ │ │ -
456 outStream.precision(outputPrecision);
│ │ │ │ -
457
│ │ │ │ -
458 writeMatrixToMatlabHelper(matrix, 0, 0, outStream);
│ │ │ │ -
459 outStream.precision(oldPrecision);
│ │ │ │ -
460 }
│ │ │ │ -
│ │ │ │ -
461
│ │ │ │ -
462 // Recursively write vector entries to a stream
│ │ │ │ -
463 template<class V>
│ │ │ │ -
│ │ │ │ -
464 void writeVectorToMatlabHelper (const V& v, std::ostream& stream)
│ │ │ │ -
465 {
│ │ │ │ -
466 if constexpr (IsNumber<V>()) {
│ │ │ │ -
467 stream << v << std::endl;
│ │ │ │ -
468 } else {
│ │ │ │ -
469 for (const auto& entry : v)
│ │ │ │ -
470 writeVectorToMatlabHelper(entry, stream);
│ │ │ │ -
471 }
│ │ │ │ -
472 }
│ │ │ │ -
│ │ │ │ -
473
│ │ │ │ -
491 template <class VectorType>
│ │ │ │ -
│ │ │ │ -
492 void writeVectorToMatlab(const VectorType& vector,
│ │ │ │ -
493 const std::string& filename, int outputPrecision = 18)
│ │ │ │ -
494 {
│ │ │ │ -
495 std::ofstream outStream(filename.c_str());
│ │ │ │ -
496 int oldPrecision = outStream.precision();
│ │ │ │ -
497 outStream.precision(outputPrecision);
│ │ │ │ -
498
│ │ │ │ -
499 writeVectorToMatlabHelper(vector, outStream);
│ │ │ │ -
500 outStream.precision(oldPrecision);
│ │ │ │ -
501 }
│ │ │ │ -
│ │ │ │ -
502
│ │ │ │ -
503 namespace Impl {
│ │ │ │ -
504
│ │ │ │ -
506 struct NullStream {
│ │ │ │ -
507 template <class Any>
│ │ │ │ -
508 friend NullStream &operator<<(NullStream &dev0, Any &&) {
│ │ │ │ -
509 return dev0;
│ │ │ │ -
510 }
│ │ │ │ -
511 };
│ │ │ │ -
512
│ │ │ │ -
514 // svg shall be closed with a group and an svg. i.e. "</g></svg>"
│ │ │ │ -
515 template <class Stream, class SVGMatrixOptions>
│ │ │ │ -
516 void writeSVGMatrixHeader(Stream &out, const SVGMatrixOptions &opts,
│ │ │ │ -
517 std::pair<std::size_t, size_t> offsets) {
│ │ │ │ -
518 auto [col_offset, row_offset] = offsets;
│ │ │ │ -
519 double width = opts.width;
│ │ │ │ -
520 double height = opts.height;
│ │ │ │ -
521 // if empty, we try to figure out a sensible value of width and height
│ │ │ │ -
522 if (opts.width == 0 and opts.height == 0)
│ │ │ │ -
523 width = height = 500;
│ │ │ │ -
524 if (opts.width == 0)
│ │ │ │ -
525 width = opts.height * (double(col_offset) / row_offset);
│ │ │ │ -
526 if (opts.height == 0)
│ │ │ │ -
527 height = opts.width * (double(row_offset) / col_offset);
│ │ │ │ -
528
│ │ │ │ -
529 // scale group w.r.t final offsets
│ │ │ │ -
530 double scale_width = width / col_offset;
│ │ │ │ -
531 double scale_height = height / row_offset;
│ │ │ │ -
532
│ │ │ │ -
533 // write the header text
│ │ │ │ -
534 out << "<svg xmlns='http://www.w3.org/2000/svg' width='" << std::ceil(width)
│ │ │ │ -
535 << "' height='" << std::ceil(height) << "' version='1.1'>\n"
│ │ │ │ -
536 << "<style>\n"
│ │ │ │ -
537 << opts.style << "</style>\n"
│ │ │ │ -
538 << "<g transform='scale(" << scale_width << " " << scale_height
│ │ │ │ -
539 << ")'>\n";
│ │ │ │ -
540 }
│ │ │ │ -
541
│ │ │ │ -
543 template <class Mat, class Stream, class SVGMatrixOptions,
│ │ │ │ -
544 class RowPrefix, class ColPrefix>
│ │ │ │ -
545 std::pair<std::size_t, size_t>
│ │ │ │ -
546 writeSVGMatrix(const Mat &mat, Stream &out, SVGMatrixOptions opts,
│ │ │ │ -
547 RowPrefix row_prefix, ColPrefix col_prefix) {
│ │ │ │ -
548 // get values to fill the offests
│ │ │ │ -
549 const auto& block_size = opts.block_size;
│ │ │ │ -
550 const auto& interspace = opts.interspace;
│ │ │ │ -
551
│ │ │ │ -
552 const std::size_t rows = mat.N();
│ │ │ │ -
553 const std::size_t cols = mat.M();
│ │ │ │ -
554
│ │ │ │ -
555 // disable header write for recursive calls
│ │ │ │ -
556 const bool write_header = opts.write_header;
│ │ │ │ -
557 opts.write_header = false;
│ │ │ │ -
558
│ │ │ │ -
559 // counter of offsets for every block
│ │ │ │ -
560 std::size_t row_offset = interspace;
│ │ │ │ -
561 std::size_t col_offset = interspace;
│ │ │ │ -
562
│ │ │ │ -
563 // lambda helper: for-each value
│ │ │ │ -
564 auto for_each_entry = [&mat](const auto &call_back) {
│ │ │ │ -
565 for (auto row_it = mat.begin(); row_it != mat.end(); ++row_it) {
│ │ │ │ -
566 for (auto col_it = row_it->begin(); col_it != row_it->end(); ++col_it) {
│ │ │ │ -
567 call_back(row_it.index(), col_it.index(), *col_it);
│ │ │ │ -
568 }
│ │ │ │ -
569 }
│ │ │ │ -
570 };
│ │ │ │ -
571
│ │ │ │ -
572 // accumulate content in another stream so that we write in correct order
│ │ │ │ -
573 std::stringstream ss;
│ │ │ │ -
574
│ │ │ │ -
575 // we need to append current row and col values to the prefixes
│ │ │ │ -
576 row_prefix.push_back(0);
│ │ │ │ -
577 col_prefix.push_back(0);
│ │ │ │ -
578
│ │ │ │ -
579 // do we need to write nested matrix blocks?
│ │ │ │ -
580 if constexpr (Dune::blockLevel<typename Mat::block_type>() == 0) {
│ │ │ │ -
581 // simple case: write svg block content to stream for each value
│ │ │ │ -
582 for_each_entry([&](const auto &row, const auto &col, const auto &val) {
│ │ │ │ -
583 std::size_t x_off = interspace + col * (interspace + block_size);
│ │ │ │ -
584 std::size_t y_off = interspace + row * (interspace + block_size);
│ │ │ │ -
585 row_prefix.back() = row;
│ │ │ │ -
586 col_prefix.back() = col;
│ │ │ │ -
587 opts.writeSVGBlock(ss, row_prefix, col_prefix, val,
│ │ │ │ -
588 {x_off, y_off, block_size, block_size});
│ │ │ │ -
589 });
│ │ │ │ -
590 col_offset += cols * (block_size + interspace);
│ │ │ │ -
591 row_offset += rows * (block_size + interspace);
│ │ │ │ -
592 } else {
│ │ │ │ -
593 // before we write anything, we need to calculate the
│ │ │ │ -
594 // offset for every {row,col} index
│ │ │ │ -
595 const auto null_offset = std::numeric_limits<std::size_t>::max();
│ │ │ │ -
596 std::vector<std::size_t> col_offsets(cols + 1, null_offset);
│ │ │ │ -
597 std::vector<std::size_t> row_offsets(rows + 1, null_offset);
│ │ │ │ -
598 for_each_entry([&](const auto &row, const auto &col, const auto &val) {
│ │ │ │ -
599 NullStream dev0;
│ │ │ │ -
600 // get size of sub-block
│ │ │ │ -
601 auto sub_size =
│ │ │ │ -
602 writeSVGMatrix(val, dev0, opts, row_prefix, col_prefix);
│ │ │ │ -
603
│ │ │ │ -
604 // if we didn't see col size before
│ │ │ │ -
605 if (col_offsets[col + 1] == null_offset) // write it in the offset vector
│ │ │ │ -
606 col_offsets[col + 1] = sub_size.first;
│ │ │ │ -
607
│ │ │ │ -
608 // repeat proces for row sizes
│ │ │ │ -
609 if (row_offsets[row + 1] == null_offset)
│ │ │ │ -
610 row_offsets[row + 1] = sub_size.second;
│ │ │ │ -
611 });
│ │ │ │ -
612
│ │ │ │ -
613 // if some rows/cols were not visited, make an educated guess with the minimum offset
│ │ │ │ -
614 auto min_row_offset = *std::min_element(begin(row_offsets), end(row_offsets));
│ │ │ │ -
615 std::replace(begin(row_offsets), end(row_offsets), null_offset, min_row_offset);
│ │ │ │ -
616 auto min_col_offset = *std::min_element(begin(col_offsets), end(col_offsets));
│ │ │ │ -
617 std::replace(begin(col_offsets), end(col_offsets), null_offset, min_col_offset);
│ │ │ │ -
618
│ │ │ │ -
619 // we have sizes for every block: to get offsets we make a partial sum
│ │ │ │ -
620 col_offsets[0] = interspace;
│ │ │ │ -
621 row_offsets[0] = interspace;
│ │ │ │ -
622 for (std::size_t i = 1; i < col_offsets.size(); i++)
│ │ │ │ -
623 col_offsets[i] += col_offsets[i - 1] + interspace;
│ │ │ │ -
624 for (std::size_t i = 1; i < row_offsets.size(); i++)
│ │ │ │ -
625 row_offsets[i] += row_offsets[i - 1] + interspace;
│ │ │ │ -
626
│ │ │ │ -
627 for_each_entry([&](const auto &row, const auto &col, const auto &val) {
│ │ │ │ -
628 // calculate svg view from offsets
│ │ │ │ -
629 std::size_t width =
│ │ │ │ -
630 col_offsets[col + 1] - col_offsets[col] - interspace;
│ │ │ │ -
631 std::size_t height =
│ │ │ │ -
632 row_offsets[row + 1] - row_offsets[row] - interspace;
│ │ │ │ -
633 row_prefix.back() = row;
│ │ │ │ -
634 col_prefix.back() = col;
│ │ │ │ -
635 // content of the sub-block has origin at {0,0}: shift it to the correct place
│ │ │ │ -
636 ss << "<svg x='" << col_offsets[col] << "' y='" << row_offsets[row]
│ │ │ │ -
637 << "' width='" << width << "' height='" << height << "'>\n";
│ │ │ │ -
638 // write a nested svg with the contents of the sub-block
│ │ │ │ -
639 writeSVGMatrix(val, ss, opts, row_prefix, col_prefix);
│ │ │ │ -
640 ss << "</svg>\n";
│ │ │ │ -
641 });
│ │ │ │ -
642 col_offset = col_offsets.back();
│ │ │ │ -
643 row_offset = row_offsets.back();
│ │ │ │ -
644 }
│ │ │ │ -
645
│ │ │ │ -
646 // write content in order!
│ │ │ │ -
647 // (i) if required, first header
│ │ │ │ -
648 if (write_header)
│ │ │ │ -
649 writeSVGMatrixHeader(out, opts, {col_offset, row_offset});
│ │ │ │ -
650
│ │ │ │ -
651 col_prefix.pop_back();
│ │ │ │ -
652 row_prefix.pop_back();
│ │ │ │ -
653 // (ii) an svg block for this level
│ │ │ │ -
654 opts.writeSVGBlock(out, row_prefix, col_prefix, mat,
│ │ │ │ -
655 {0, 0, col_offset, row_offset});
│ │ │ │ -
656 // (iii) the content of the matrix
│ │ │ │ -
657 out << ss.str();
│ │ │ │ -
658 // (iv) if required, close the header
│ │ │ │ -
659 if (write_header)
│ │ │ │ -
660 out << "</g>\n</svg>\n";
│ │ │ │ -
661
│ │ │ │ -
662 // return the total required for this block
│ │ │ │ -
663 return {col_offset, row_offset};
│ │ │ │ -
664 }
│ │ │ │ -
665 } // namespace Impl
│ │ │ │ -
666
│ │ │ │ -
667
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
676 std::size_t block_size = 10;
│ │ │ │ -
678 std::size_t interspace = 5;
│ │ │ │ -
680 std::size_t width = 500;
│ │ │ │ -
682 std::size_t height = 0;
│ │ │ │ -
684 bool write_header = true;
│ │ │ │ -
686 std::string style = " .matrix-block {\n"
│ │ │ │ -
687 " fill: cornflowerblue;\n"
│ │ │ │ -
688 " fill-opacity: 0.4;\n"
│ │ │ │ -
689 " stroke-width: 2;\n"
│ │ │ │ -
690 " stroke: black;\n"
│ │ │ │ -
691 " stroke-opacity: 0.5;\n"
│ │ │ │ -
692 " }\n"
│ │ │ │ -
693 " .matrix-block:hover {\n"
│ │ │ │ -
694 " fill: lightcoral;\n"
│ │ │ │ -
695 " fill-opacity: 0.4;\n"
│ │ │ │ -
696 " stroke-opacity: 1;\n"
│ │ │ │ -
697 " }\n";
│ │ │ │ -
698
│ │ │ │ -
710 std::function<std::string(const double&)> color_fill;
│ │ │ │ -
711
│ │ │ │ -
717 template <class RowPrefix, class ColPrefix>
│ │ │ │ -
│ │ │ │ -
718 std::string blockStyleClass(const RowPrefix &row_prefix,
│ │ │ │ -
719 const ColPrefix &col_prefix) const {
│ │ │ │ -
720 // here, you can potentially give a different style to each block
│ │ │ │ -
721 return "matrix-block";
│ │ │ │ -
722 }
│ │ │ │ -
│ │ │ │ -
723
│ │ │ │ -
725 bool write_block_title = true;
│ │ │ │ -
726
│ │ │ │ -
732 template <class Stream, class RowPrefix, class ColPrefix, class Block>
│ │ │ │ -
│ │ │ │ -
733 void writeBlockTitle(Stream& out, const RowPrefix &row_prefix,
│ │ │ │ -
734 const ColPrefix &col_prefix,
│ │ │ │ -
735 const Block &block) const {
│ │ │ │ -
736 if (this->write_block_title) {
│ │ │ │ -
737 out << "<title>";
│ │ │ │ -
738 assert(row_prefix.size() == col_prefix.size());
│ │ │ │ -
739 for (std::size_t i = 0; i < row_prefix.size(); ++i)
│ │ │ │ -
740 out << "[" << row_prefix[i] << ", "<< col_prefix[i] << "]";
│ │ │ │ -
741 if constexpr (Dune::blockLevel<Block>() == 0)
│ │ │ │ -
742 out << ": " << block;
│ │ │ │ -
743 out << "</title>\n";
│ │ │ │ -
744 }
│ │ │ │ -
745 }
│ │ │ │ -
│ │ │ │ -
746
│ │ │ │ -
768 template <class Stream, class RowPrefix, class ColPrefix, class Block>
│ │ │ │ -
│ │ │ │ -
769 void writeSVGBlock(Stream &out,
│ │ │ │ -
770 const RowPrefix &row_prefix,
│ │ │ │ -
771 const ColPrefix &col_prefix, const Block block,
│ │ │ │ -
772 const std::array<std::size_t, 4> &svg_box) const {
│ │ │ │ -
773 // get bounding box values
│ │ │ │ -
774 auto &[x_off, y_off, width, height] = svg_box;
│ │ │ │ -
775 // get style class
│ │ │ │ -
776 std::string block_class = this->blockStyleClass(row_prefix, col_prefix);
│ │ │ │ -
777 // write a rectangle on the bounding box
│ │ │ │ -
778 out << "<rect class='" << block_class << "' x='" << x_off << "' y='"
│ │ │ │ -
779 << y_off << "' width='" << width << "' height='" << height << "'";
│ │ │ │ -
780 if constexpr (Dune::blockLevel<Block>() == 0 and std::is_convertible<Block,double>{})
│ │ │ │ -
781 if (color_fill)
│ │ │ │ -
782 out << " style='fill-opacity: 1;fill:" << color_fill(double(block)) << "'";
│ │ │ │ -
783
│ │ │ │ -
784 out << ">\n";
│ │ │ │ -
785 // give the rectangle a title (in html this shows info about the block)
│ │ │ │ -
786 this->writeBlockTitle(out,row_prefix, col_prefix, block);
│ │ │ │ -
787 // close rectangle
│ │ │ │ -
788 out << "</rect>\n";
│ │ │ │ -
789 }
│ │ │ │ -
│ │ │ │ -
790 };
│ │ │ │ -
│ │ │ │ -
791
│ │ │ │ -
806 template <class Mat, class SVGOptions = DefaultSVGMatrixOptions>
│ │ │ │ -
│ │ │ │ -
807 void writeSVGMatrix(const Mat &mat, std::ostream &out,
│ │ │ │ -
808 SVGOptions opts = {}) {
│ │ │ │ -
809 // We need a vector that can fit all the multi-indices for rows and colums
│ │ │ │ -
810 using IndexPrefix = Dune::ReservedVector<std::size_t, blockLevel<Mat>()>;
│ │ │ │ -
811 // Call overload for Mat type
│ │ │ │ -
812 Impl::writeSVGMatrix(mat, out, opts, IndexPrefix{}, IndexPrefix{});
│ │ │ │ -
813 }
│ │ │ │ -
│ │ │ │ -
814
│ │ │ │ -
817} // namespace Dune
│ │ │ │ -
818
│ │ │ │ -
819#endif
│ │ │ │ -
Helper functions for determining the vector/matrix block level.
│ │ │ │ -
Some handy generic functions for ISTL matrices.
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ - │ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
void writeSVGMatrix(const Mat &mat, std::ostream &out, SVGOptions opts={})
Writes the visualization of matrix in the SVG format.
Definition io.hh:807
│ │ │ │ -
void writeMatrixToMatlab(const MatrixType &matrix, const std::string &filename, int outputPrecision=18)
Writes sparse matrix in a Matlab-readable format.
Definition io.hh:451
│ │ │ │ -
void print_row(std::ostream &s, const K &value, typename FieldMatrix< K, 1, 1 >::size_type I, typename FieldMatrix< K, 1, 1 >::size_type J, typename FieldMatrix< K, 1, 1 >::size_type therow, int width, int precision, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
Print one row of a matrix, specialization for number types.
Definition io.hh:151
│ │ │ │ -
void printmatrix(std::ostream &s, const M &A, std::string title, std::string rowtext, int width=10, int precision=2)
Print a generic block matrix.
Definition io.hh:213
│ │ │ │ -
void printvector(std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
Print an ISTL vector.
Definition io.hh:89
│ │ │ │ -
void writeMatrixToMatlabHelper(const FieldType &value, int rowOffset, int colOffset, std::ostream &s, typename std::enable_if_t< Dune::IsNumber< FieldType >::value > *sfinae=nullptr)
Helper method for the writeMatrixToMatlab routine.
Definition io.hh:379
│ │ │ │ -
void writeVectorToMatlabHelper(const V &v, std::ostream &stream)
Definition io.hh:464
│ │ │ │ -
void writeVectorToMatlab(const VectorType &vector, const std::string &filename, int outputPrecision=18)
Writes vectors in a Matlab-readable format.
Definition io.hh:492
│ │ │ │ -
void recursive_printvector(std::ostream &s, const V &v, std::string rowtext, int &counter, int columns, int width)
Recursively print a vector.
Definition io.hh:52
│ │ │ │ -
void printSparseMatrix(std::ostream &s, const BCRSMatrix< FieldMatrix< B, n, m >, A > &mat, std::string title, std::string rowtext, int width=3, int precision=2)
Prints a BCRSMatrix with fixed sized blocks.
Definition io.hh:271
│ │ │ │ -
void fill_row(std::ostream &s, int m, int width, int precision)
Print a row of zeros for a non-existing block.
Definition io.hh:133
│ │ │ │ -
STL namespace.
│ │ │ │ +
│ │ │ │ +
120 ParallelScalarProduct (std::shared_ptr<const communication_type> com, SolverCategory::Category cat)
│ │ │ │ +
121 : _communication(com), _category(cat)
│ │ │ │ +
122 {}
│ │ │ │ +
│ │ │ │ +
123
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
131 : ParallelScalarProduct(stackobject_to_shared_ptr(com), cat)
│ │ │ │ +
132 {}
│ │ │ │ +
│ │ │ │ +
133
│ │ │ │ +
134
│ │ │ │ +
│ │ │ │ +
139 virtual field_type dot (const X& x, const X& y) const override
│ │ │ │ +
140 {
│ │ │ │ +
141 field_type result(0);
│ │ │ │ +
142 _communication->dot(x,y,result); // explicitly loop and apply masking
│ │ │ │ +
143 return result;
│ │ │ │ +
144 }
│ │ │ │ +
│ │ │ │ +
145
│ │ │ │ +
│ │ │ │ +
149 virtual real_type norm (const X& x) const override
│ │ │ │ +
150 {
│ │ │ │ +
151 return _communication->norm(x);
│ │ │ │ +
152 }
│ │ │ │ +
│ │ │ │ +
153
│ │ │ │ +
│ │ │ │ +
155 virtual SolverCategory::Category category() const override
│ │ │ │ +
156 {
│ │ │ │ +
157 return _category;
│ │ │ │ +
158 }
│ │ │ │ +
│ │ │ │ +
159
│ │ │ │ +
160 private:
│ │ │ │ +
161 std::shared_ptr<const communication_type> _communication;
│ │ │ │ +
162 SolverCategory::Category _category;
│ │ │ │ +
163 };
│ │ │ │ +
│ │ │ │ +
164
│ │ │ │ +
166 template<class X>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
168 {
│ │ │ │ +
169 using ScalarProduct<X>::ScalarProduct;
│ │ │ │ +
170 };
│ │ │ │ +
│ │ │ │ +
171
│ │ │ │ +
177 template<class X, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
179 {
│ │ │ │ +
180 public:
│ │ │ │ +
│ │ │ │ +
181 NonoverlappingSchwarzScalarProduct (std::shared_ptr<const C> comm) :
│ │ │ │ +
182 ParallelScalarProduct<X,C>(comm,SolverCategory::nonoverlapping) {}
│ │ │ │ +
│ │ │ │ +
183
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
185 ParallelScalarProduct<X,C>(comm,SolverCategory::nonoverlapping) {}
│ │ │ │ +
│ │ │ │ +
186 };
│ │ │ │ +
│ │ │ │ +
187
│ │ │ │ +
199 template<class X, class C>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
201 {
│ │ │ │ +
202 public:
│ │ │ │ +
│ │ │ │ +
203 OverlappingSchwarzScalarProduct (std::shared_ptr<const C> comm) :
│ │ │ │ +
204 ParallelScalarProduct<X,C>(comm, SolverCategory::overlapping) {}
│ │ │ │ +
│ │ │ │ +
205
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
207 ParallelScalarProduct<X,C>(comm,SolverCategory::overlapping) {}
│ │ │ │ +
│ │ │ │ +
208 };
│ │ │ │ +
│ │ │ │ +
209
│ │ │ │ +
223 template<class X, class Comm>
│ │ │ │ +
│ │ │ │ +
224 std::shared_ptr<ScalarProduct<X>> makeScalarProduct(std::shared_ptr<const Comm> comm, SolverCategory::Category category)
│ │ │ │ +
225 {
│ │ │ │ +
226 switch(category)
│ │ │ │ +
227 {
│ │ │ │ + │ │ │ │ +
229 return
│ │ │ │ +
230 std::make_shared<ScalarProduct<X>>();
│ │ │ │ +
231 default:
│ │ │ │ +
232 return
│ │ │ │ +
233 std::make_shared<ParallelScalarProduct<X,Comm>>(comm,category);
│ │ │ │ +
234 }
│ │ │ │ +
235 }
│ │ │ │ +
│ │ │ │ +
236
│ │ │ │ +
241 template<class X, class Comm>
│ │ │ │ +
│ │ │ │ +
242 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const Comm& comm, SolverCategory::Category category)
│ │ │ │ +
243 { return makeScalarProduct<X>(stackobject_to_shared_ptr(comm), category); }
│ │ │ │ +
│ │ │ │ +
244
│ │ │ │ +
245} // end namespace Dune
│ │ │ │ +
246
│ │ │ │ +
247#endif
│ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ + │ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Definition matrixutils.hh:211
│ │ │ │ -
static auto coldim(const M &A)
Definition matrixutils.hh:219
│ │ │ │ -
static auto rowdim(const M &A)
Definition matrixutils.hh:214
│ │ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ -
Default options class to write SVG matrices.
Definition io.hh:674
│ │ │ │ -
std::string style
CSS style block to write in header.
Definition io.hh:686
│ │ │ │ -
std::size_t width
Final width size (pixels) of the SVG header. If 0, size is automatic.
Definition io.hh:680
│ │ │ │ -
std::function< std::string(const double &)> color_fill
Color fill for default options.
Definition io.hh:710
│ │ │ │ -
std::size_t block_size
size (pixels) of the deepst block/value of the matrix
Definition io.hh:676
│ │ │ │ -
void writeSVGBlock(Stream &out, const RowPrefix &row_prefix, const ColPrefix &col_prefix, const Block block, const std::array< std::size_t, 4 > &svg_box) const
Write an SVG object for a given block/value in the matrix.
Definition io.hh:769
│ │ │ │ -
void writeBlockTitle(Stream &out, const RowPrefix &row_prefix, const ColPrefix &col_prefix, const Block &block) const
Helper function writes a title for a given block and prefix.
Definition io.hh:733
│ │ │ │ -
std::size_t interspace
size (pixels) of the interspace between blocks
Definition io.hh:678
│ │ │ │ -
bool write_block_title
(Helper) Whether to write a title on the rectangle value
Definition io.hh:725
│ │ │ │ -
std::size_t height
Final height size (pixels) of the SVG header. If 0, size is automatic.
Definition io.hh:682
│ │ │ │ -
bool write_header
Whether to write the SVG header.
Definition io.hh:684
│ │ │ │ -
std::string blockStyleClass(const RowPrefix &row_prefix, const ColPrefix &col_prefix) const
Helper function that returns an style class for a given prefix.
Definition io.hh:718
│ │ │ │ -
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ -
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:614
│ │ │ │ -
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ │ -
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ -
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │ -
Definition matrixutils.hh:27
│ │ │ │ +
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 approriate scalar product for a solver category.
Definition scalarproducts.hh:224
│ │ │ │ +
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ │ +
virtual field_type dot(const X &x, const X &y) const
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition scalarproducts.hh:63
│ │ │ │ +
virtual SolverCategory::Category category() const
Category of the scalar product (see SolverCategory::Category)
Definition scalarproducts.hh:77
│ │ │ │ +
X::field_type field_type
Definition scalarproducts.hh:56
│ │ │ │ +
X domain_type
export types, they come from the derived class
Definition scalarproducts.hh:55
│ │ │ │ +
virtual ~ScalarProduct()
every abstract base class has a virtual destructor
Definition scalarproducts.hh:83
│ │ │ │ +
FieldTraits< field_type >::real_type real_type
Definition scalarproducts.hh:57
│ │ │ │ +
virtual real_type norm(const X &x) const
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.
Definition scalarproducts.hh:71
│ │ │ │ +
Scalar product for overlapping Schwarz methods.
Definition scalarproducts.hh:99
│ │ │ │ +
virtual field_type dot(const X &x, const X &y) const override
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition scalarproducts.hh:139
│ │ │ │ +
virtual SolverCategory::Category category() const override
Category of the scalar product (see SolverCategory::Category)
Definition scalarproducts.hh:155
│ │ │ │ +
FieldTraits< field_type >::real_type real_type
Definition scalarproducts.hh:108
│ │ │ │ +
C communication_type
The type of the communication object.
Definition scalarproducts.hh:113
│ │ │ │ +
ParallelScalarProduct(const communication_type &com, SolverCategory::Category cat)
Definition scalarproducts.hh:130
│ │ │ │ +
X domain_type
The type of the vector to compute the scalar product on.
Definition scalarproducts.hh:105
│ │ │ │ +
ParallelScalarProduct(std::shared_ptr< const communication_type > com, SolverCategory::Category cat)
Definition scalarproducts.hh:120
│ │ │ │ +
X::field_type field_type
The field type used by the vector type domain_type.
Definition scalarproducts.hh:107
│ │ │ │ +
virtual real_type norm(const X &x) const override
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.
Definition scalarproducts.hh:149
│ │ │ │ +
Default implementation for the scalar case.
Definition scalarproducts.hh:168
│ │ │ │ +
Nonoverlapping Scalar Product with communication object.
Definition scalarproducts.hh:179
│ │ │ │ +
NonoverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm)
Definition scalarproducts.hh:181
│ │ │ │ +
NonoverlappingSchwarzScalarProduct(const C &comm)
Definition scalarproducts.hh:184
│ │ │ │ +
Scalar product for overlapping Schwarz methods.
Definition scalarproducts.hh:201
│ │ │ │ +
OverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm)
Definition scalarproducts.hh:203
│ │ │ │ +
OverlappingSchwarzScalarProduct(const C &comm)
Definition scalarproducts.hh:206
│ │ │ │ +
Categories for the solvers.
Definition solvercategory.hh:22
│ │ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,801 +1,269 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -io.hh │ │ │ │ │ +scalarproducts.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 (C) 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_IO_HH │ │ │ │ │ -6#define DUNE_ISTL_IO_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_SCALARPRODUCTS_HH │ │ │ │ │ +6#define DUNE_ISTL_SCALARPRODUCTS_HH │ │ │ │ │ 7 │ │ │ │ │ 8#include │ │ │ │ │ 9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include "_m_a_t_r_i_x_u_t_i_l_s_._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 │ │ │ │ │ -22 │ │ │ │ │ -23#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ -24#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -25 │ │ │ │ │ -26namespace _D_u_n_e { │ │ │ │ │ -27 │ │ │ │ │ -40 // │ │ │ │ │ -41 // pretty printing of vectors │ │ │ │ │ -42 // │ │ │ │ │ -43 │ │ │ │ │ -51 template │ │ │ │ │ -_5_2 void _r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r (std::ostream& s, const V& v, std::string │ │ │ │ │ -rowtext, │ │ │ │ │ -53 int& counter, int columns, int width) │ │ │ │ │ -54 { │ │ │ │ │ -55 if constexpr (IsNumber()) │ │ │ │ │ -56 { │ │ │ │ │ -57 // Print one number │ │ │ │ │ -58 if (counter%columns==0) │ │ │ │ │ -59 { │ │ │ │ │ -60 s << rowtext; // start a new row │ │ │ │ │ -61 s << " "; // space in front of each entry │ │ │ │ │ -62 s.width(4); // set width for counter │ │ │ │ │ -63 s << counter; // number of first entry in a line │ │ │ │ │ -64 } │ │ │ │ │ -65 s << " "; // space in front of each entry │ │ │ │ │ -66 s.width(width); // set width for each entry anew │ │ │ │ │ -67 s << v; // yeah, the number ! │ │ │ │ │ -68 counter++; // increment the counter │ │ │ │ │ -69 if (counter%columns==0) │ │ │ │ │ -70 s << std::endl; // start a new line │ │ │ │ │ -71 } │ │ │ │ │ -72 else │ │ │ │ │ -73 { │ │ │ │ │ -74 // Recursively print a vector │ │ │ │ │ -75 for (const auto& entry : v) │ │ │ │ │ -76 _r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r(s,entry,rowtext,counter,columns,width); │ │ │ │ │ -77 } │ │ │ │ │ -78 } │ │ │ │ │ -79 │ │ │ │ │ -80 │ │ │ │ │ -88 template │ │ │ │ │ -_8_9 void _p_r_i_n_t_v_e_c_t_o_r (std::ostream& s, const V& v, std::string title, │ │ │ │ │ -90 std::string rowtext, int columns=1, int width=10, │ │ │ │ │ -91 int precision=2) │ │ │ │ │ -92 { │ │ │ │ │ -93 // count the numbers printed to make columns │ │ │ │ │ -94 int counter=0; │ │ │ │ │ -95 │ │ │ │ │ -96 // remember old flags │ │ │ │ │ -97 std::ios_base::fmtflags oldflags = s.flags(); │ │ │ │ │ -98 │ │ │ │ │ -99 // set the output format │ │ │ │ │ -100 s.setf(std::ios_base::scientific, std::ios_base::floatfield); │ │ │ │ │ -101 int oldprec = s.precision(); │ │ │ │ │ -102 s.precision(precision); │ │ │ │ │ -103 │ │ │ │ │ -104 // print title │ │ │ │ │ -105 s << title << " [blocks=" << v.N() << ",dimension=" << v.dim() << "]" │ │ │ │ │ -106 << std::endl; │ │ │ │ │ -107 │ │ │ │ │ -108 // print data from all blocks │ │ │ │ │ -109 _r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r(s,v,rowtext,counter,columns,width); │ │ │ │ │ -110 │ │ │ │ │ -111 // check if new line is required │ │ │ │ │ -112 if (counter%columns!=0) │ │ │ │ │ -113 s << std::endl; │ │ │ │ │ +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" │ │ │ │ │ +20 │ │ │ │ │ +21 │ │ │ │ │ +22namespace _D_u_n_e { │ │ │ │ │ +51 template │ │ │ │ │ +_5_2 class _S_c_a_l_a_r_P_r_o_d_u_c_t { │ │ │ │ │ +53 public: │ │ │ │ │ +_5_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_5_6 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_5_7 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ +58 │ │ │ │ │ +_6_3 virtual _f_i_e_l_d___t_y_p_e _d_o_t (const X& x, const X& y) const │ │ │ │ │ +64 { │ │ │ │ │ +65 return x.dot(y); │ │ │ │ │ +66 } │ │ │ │ │ +67 │ │ │ │ │ +_7_1 virtual _r_e_a_l___t_y_p_e _n_o_r_m (const X& x) const │ │ │ │ │ +72 { │ │ │ │ │ +73 return x.two_norm(); │ │ │ │ │ +74 } │ │ │ │ │ +75 │ │ │ │ │ +_7_7 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ +78 { │ │ │ │ │ +79 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ │ +80 } │ │ │ │ │ +81 │ │ │ │ │ +_8_3 virtual _~_S_c_a_l_a_r_P_r_o_d_u_c_t () {} │ │ │ │ │ +84 }; │ │ │ │ │ +85 │ │ │ │ │ +97 template │ │ │ │ │ +_9_8 class _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t : public _S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +99 { │ │ │ │ │ +100 public: │ │ │ │ │ +_1_0_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_1_0_7 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_1_0_8 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ +_1_1_3 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ │ 114 │ │ │ │ │ -115 // reset the output format │ │ │ │ │ -116 s.flags(oldflags); │ │ │ │ │ -117 s.precision(oldprec); │ │ │ │ │ -118 } │ │ │ │ │ -119 │ │ │ │ │ -120 │ │ │ │ │ -122 // │ │ │ │ │ -123 // pretty printing of matrices │ │ │ │ │ -124 // │ │ │ │ │ -125 │ │ │ │ │ -_1_3_3 inline void _f_i_l_l___r_o_w (std::ostream& s, int m, int width, [[maybe_unused]] │ │ │ │ │ -int precision) │ │ │ │ │ -134 { │ │ │ │ │ -135 for (int j=0; j │ │ │ │ │ -_1_5_1 void _p_r_i_n_t___r_o_w (std::ostream& s, const K& value, │ │ │ │ │ -152 [[maybe_unused]] typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_>_:_:_s_i_z_e___t_y_p_e I, │ │ │ │ │ -153 [[maybe_unused]] typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_>_:_:_s_i_z_e___t_y_p_e J, │ │ │ │ │ -154 [[maybe_unused]] typename _F_i_e_l_d_M_a_t_r_i_x_<_K_,_1_,_1_>_:_:_s_i_z_e___t_y_p_e therow, │ │ │ │ │ -155 int width, │ │ │ │ │ -156 [[maybe_unused]] int precision, │ │ │ │ │ -157 typename std::enable_if_t::value>* sfinae = nullptr) │ │ │ │ │ -158 { │ │ │ │ │ -159 s << " "; // space in front of each entry │ │ │ │ │ -160 s.width(width); // set width for each entry anew │ │ │ │ │ -161 s << value; │ │ │ │ │ -162 } │ │ │ │ │ -163 │ │ │ │ │ -171 template │ │ │ │ │ -_1_7_2 void _p_r_i_n_t___r_o_w (std::ostream& s, const M& A, typename M::size_type I, │ │ │ │ │ -173 typename M::size_type J, typename M::size_type therow, │ │ │ │ │ -174 int width, int precision, │ │ │ │ │ -175 typename std::enable_if_t::value>* sfinae = nullptr) │ │ │ │ │ -176 { │ │ │ │ │ -177 typename M::size_type i0=I; │ │ │ │ │ -178 for (typename M::size_type i=0; i com, │ │ │ │ │ +_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y cat) │ │ │ │ │ +121 : _communication(com), _category(cat) │ │ │ │ │ +122 {} │ │ │ │ │ +123 │ │ │ │ │ +_1_3_0 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t (const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& com, _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ │ +_C_a_t_e_g_o_r_y cat) │ │ │ │ │ +131 : _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(stackobject_to_shared_ptr(com), cat) │ │ │ │ │ +132 {} │ │ │ │ │ +133 │ │ │ │ │ +134 │ │ │ │ │ +_1_3_9 virtual _f_i_e_l_d___t_y_p_e _d_o_t (const X& x, const X& y) const override │ │ │ │ │ +140 { │ │ │ │ │ +141 _f_i_e_l_d___t_y_p_e result(0); │ │ │ │ │ +142 _communication->dot(x,y,result); // explicitly loop and apply masking │ │ │ │ │ +143 return result; │ │ │ │ │ +144 } │ │ │ │ │ +145 │ │ │ │ │ +_1_4_9 virtual _r_e_a_l___t_y_p_e _n_o_r_m (const X& x) const override │ │ │ │ │ +150 { │ │ │ │ │ +151 return _communication->norm(x); │ │ │ │ │ +152 } │ │ │ │ │ +153 │ │ │ │ │ +_1_5_5 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const override │ │ │ │ │ +156 { │ │ │ │ │ +157 return _category; │ │ │ │ │ +158 } │ │ │ │ │ +159 │ │ │ │ │ +160 private: │ │ │ │ │ +161 std::shared_ptr _communication; │ │ │ │ │ +162 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _category; │ │ │ │ │ +163 }; │ │ │ │ │ +164 │ │ │ │ │ +166 template │ │ │ │ │ +_1_6_7 class _S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t : public _S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +168 { │ │ │ │ │ +169 using _S_c_a_l_a_r_P_r_o_d_u_c_t::ScalarProduct; │ │ │ │ │ +170 }; │ │ │ │ │ +171 │ │ │ │ │ +177 template │ │ │ │ │ +_1_7_8 class _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t : public │ │ │ │ │ +_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ 179 { │ │ │ │ │ -180 if (therow>=i0 && therow_:_:_r_o_w_d_i_m(A,i)) │ │ │ │ │ -181 { │ │ │ │ │ -182 // the row is in this block row ! │ │ │ │ │ -183 typename M::size_type j0=J; │ │ │ │ │ -184 for (typename M::size_type j=0; j_:_:_c_o_l_d_i_m(A,j),width,precision); │ │ │ │ │ -194 │ │ │ │ │ -195 // advance columns │ │ │ │ │ -196 j0 += _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_c_o_l_d_i_m(A,j); │ │ │ │ │ -197 } │ │ │ │ │ -198 } │ │ │ │ │ -199 // advance rows │ │ │ │ │ -200 i0 += _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_r_o_w_d_i_m(A,i); │ │ │ │ │ -201 } │ │ │ │ │ -202 } │ │ │ │ │ -203 │ │ │ │ │ -212 template │ │ │ │ │ -_2_1_3 void _p_r_i_n_t_m_a_t_r_i_x (std::ostream& s, const M& A, std::string title, │ │ │ │ │ -214 std::string rowtext, int width=10, int precision=2) │ │ │ │ │ -215 { │ │ │ │ │ -216 │ │ │ │ │ -217 // remember old flags │ │ │ │ │ -218 std::ios_base::fmtflags oldflags = s.flags(); │ │ │ │ │ -219 │ │ │ │ │ -220 // set the output format │ │ │ │ │ -221 s.setf(std::ios_base::scientific, std::ios_base::floatfield); │ │ │ │ │ -222 int oldprec = s.precision(); │ │ │ │ │ -223 s.precision(precision); │ │ │ │ │ -224 │ │ │ │ │ -225 // print title │ │ │ │ │ -226 s << title │ │ │ │ │ -227 << " [n=" << A._N() │ │ │ │ │ -228 << ",m=" << A._M() │ │ │ │ │ -229 << ",rowdim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_r_o_w_d_i_m(A) │ │ │ │ │ -230 << ",coldim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_>_:_:_c_o_l_d_i_m(A) │ │ │ │ │ -231 << "]" << std::endl; │ │ │ │ │ -232 │ │ │ │ │ -233 // print all rows │ │ │ │ │ -234 for (typename M::size_type i=0; i::rowdim(A); i++) │ │ │ │ │ -235 { │ │ │ │ │ -236 s << rowtext; // start a new row │ │ │ │ │ -237 s << " "; // space in front of each entry │ │ │ │ │ -238 s.width(4); // set width for counter │ │ │ │ │ -239 s << i; // number of first entry in a line │ │ │ │ │ -240 _p_r_i_n_t___r_o_w(s,A,0,0,i,width,precision); // generic print │ │ │ │ │ -241 s << std::endl; // start a new line │ │ │ │ │ -242 } │ │ │ │ │ -243 │ │ │ │ │ -244 // reset the output format │ │ │ │ │ -245 s.flags(oldflags); │ │ │ │ │ -246 s.precision(oldprec); │ │ │ │ │ -247 } │ │ │ │ │ -248 │ │ │ │ │ -270 template │ │ │ │ │ -_2_7_1 void _p_r_i_n_t_S_p_a_r_s_e_M_a_t_r_i_x(std::ostream& s, │ │ │ │ │ -272 const _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_B_,_n_,_m_>,A>& _m_a_t, │ │ │ │ │ -273 std::string title, std::string rowtext, │ │ │ │ │ -274 int width=3, int precision=2) │ │ │ │ │ -275 { │ │ │ │ │ -276 typedef _B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_B_,_n_,_m_>,A> _M_a_t_r_i_x; │ │ │ │ │ -277 // remember old flags │ │ │ │ │ -278 std::ios_base::fmtflags oldflags = s.flags(); │ │ │ │ │ -279 // set the output format │ │ │ │ │ -280 s.setf(std::ios_base::scientific, std::ios_base::floatfield); │ │ │ │ │ -281 int oldprec = s.precision(); │ │ │ │ │ -282 s.precision(precision); │ │ │ │ │ -283 // print title │ │ │ │ │ -284 s << title │ │ │ │ │ -285 << " [n=" << _m_a_t._N() │ │ │ │ │ -286 << ",m=" << _m_a_t._M() │ │ │ │ │ -287 << ",rowdim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t) │ │ │ │ │ -288 << ",coldim=" << _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t) │ │ │ │ │ -289 << "]" << std::endl; │ │ │ │ │ -290 │ │ │ │ │ -291 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r Row; │ │ │ │ │ -292 │ │ │ │ │ -293 for(Row row=_m_a_t._b_e_g_i_n(); row != _m_a_t._e_n_d(); ++row) { │ │ │ │ │ -294 int skipcols=0; │ │ │ │ │ -295 bool reachedEnd=false; │ │ │ │ │ -296 │ │ │ │ │ -297 while(!reachedEnd) { │ │ │ │ │ -298 for(int innerrow=0; innerrowbegin(); │ │ │ │ │ -302 for(; _c_o_l != row->end(); ++_c_o_l,++count) { │ │ │ │ │ -303 if(count=skipcols+width) │ │ │ │ │ -306 break; │ │ │ │ │ -307 if(innerrow==0) { │ │ │ │ │ -308 if(count==skipcols) { │ │ │ │ │ -309 s << rowtext; // start a new row │ │ │ │ │ -310 s << " "; // space in front of each entry │ │ │ │ │ -311 s.width(4); // set width for counter │ │ │ │ │ -312 s << row.index()<<": "; // number of first entry in a line │ │ │ │ │ -313 } │ │ │ │ │ -314 s.width(4); │ │ │ │ │ -315 s<<_c_o_l.index()<<": |"; │ │ │ │ │ -316 } else { │ │ │ │ │ -317 if(count==skipcols) { │ │ │ │ │ -318 for(typename std::string::size_type i=0; i < rowtext.length(); i++) │ │ │ │ │ -319 s<<" "; │ │ │ │ │ -320 s<<" "; │ │ │ │ │ -321 } │ │ │ │ │ -322 s<<" |"; │ │ │ │ │ -323 } │ │ │ │ │ -324 for(int innercol=0; innercol < m; ++innercol) { │ │ │ │ │ -325 s.width(9); │ │ │ │ │ -326 s<<(*col)[innerrow][innercol]<<" "; │ │ │ │ │ -327 } │ │ │ │ │ -328 │ │ │ │ │ -329 s<<"|"; │ │ │ │ │ -330 } │ │ │ │ │ -331 if(innerrow==n-1 && _c_o_l==row->end()) │ │ │ │ │ -332 reachedEnd = true; │ │ │ │ │ -333 else │ │ │ │ │ -334 s << std::endl; │ │ │ │ │ -335 } │ │ │ │ │ -336 skipcols += width; │ │ │ │ │ -337 s << std::endl; │ │ │ │ │ -338 } │ │ │ │ │ -339 s << std::endl; │ │ │ │ │ -340 } │ │ │ │ │ -341 │ │ │ │ │ -342 // reset the output format │ │ │ │ │ -343 s.flags(oldflags); │ │ │ │ │ -344 s.precision(oldprec); │ │ │ │ │ -345 } │ │ │ │ │ -346 │ │ │ │ │ -347 namespace │ │ │ │ │ -348 { │ │ │ │ │ -349 template │ │ │ │ │ -350 struct MatlabPODWriter │ │ │ │ │ -351 { │ │ │ │ │ -352 static std::ostream& write(const T& t, std::ostream& s) │ │ │ │ │ -353 { │ │ │ │ │ -354 s << t; │ │ │ │ │ -355 return s; │ │ │ │ │ -356 } │ │ │ │ │ -357 }; │ │ │ │ │ -358 template │ │ │ │ │ -359 struct MatlabPODWriter<_s_t_d::complex > │ │ │ │ │ -360 { │ │ │ │ │ -361 static std::ostream& write(const std::complex& t, std::ostream& s) │ │ │ │ │ -362 { │ │ │ │ │ -363 s << t.real() << " " << t.imag(); │ │ │ │ │ -364 return s; │ │ │ │ │ -365 } │ │ │ │ │ -366 }; │ │ │ │ │ -367 } // anonymous namespace │ │ │ │ │ -368 │ │ │ │ │ -378 template │ │ │ │ │ -_3_7_9 void _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r(const FieldType& value, │ │ │ │ │ -380 int rowOffset, int colOffset, │ │ │ │ │ -381 std::ostream& s, │ │ │ │ │ -382 typename std::enable_if_t::value>* sfinae = │ │ │ │ │ -nullptr) │ │ │ │ │ -383 { │ │ │ │ │ -384 //+1 for Matlab numbering │ │ │ │ │ -385 s << rowOffset + 1 << " " << colOffset + 1 << " "; │ │ │ │ │ -386 MatlabPODWriter::write(value, s)<< std::endl; │ │ │ │ │ -387 } │ │ │ │ │ -388 │ │ │ │ │ -396 template │ │ │ │ │ -_3_9_7 void _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r(const MatrixType& matrix, │ │ │ │ │ -398 int externalRowOffset, int externalColOffset, │ │ │ │ │ -399 std::ostream& s, │ │ │ │ │ -400 typename std::enable_if_t::value>* sfinae = │ │ │ │ │ -nullptr) │ │ │ │ │ -401 { │ │ │ │ │ -402 // Precompute the accumulated sizes of the columns │ │ │ │ │ -403 std::vector colOffset(matrix.M()); │ │ │ │ │ -404 if (colOffset.size() > 0) │ │ │ │ │ -405 colOffset[0] = 0; │ │ │ │ │ -406 │ │ │ │ │ -407 for (typename MatrixType::size_type i=0; i_:_:_c_o_l_d_i_m(matrix,i); │ │ │ │ │ -410 │ │ │ │ │ -411 typename MatrixType::size_type rowOffset = 0; │ │ │ │ │ -412 │ │ │ │ │ -413 // Loop over all matrix rows │ │ │ │ │ -414 for (typename MatrixType::size_type rowIdx=0; rowIdx_:_:_r_o_w_d_i_m(matrix, rowIdx); │ │ │ │ │ -427 } │ │ │ │ │ -428 │ │ │ │ │ -429 } │ │ │ │ │ -430 │ │ │ │ │ -450 template │ │ │ │ │ -_4_5_1 void _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b(const MatrixType& matrix, │ │ │ │ │ -452 const std::string& filename, int outputPrecision = 18) │ │ │ │ │ -453 { │ │ │ │ │ -454 std::ofstream outStream(filename.c_str()); │ │ │ │ │ -455 int oldPrecision = outStream.precision(); │ │ │ │ │ -456 outStream.precision(outputPrecision); │ │ │ │ │ -457 │ │ │ │ │ -458 _w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r(matrix, 0, 0, outStream); │ │ │ │ │ -459 outStream.precision(oldPrecision); │ │ │ │ │ -460 } │ │ │ │ │ -461 │ │ │ │ │ -462 // Recursively write vector entries to a stream │ │ │ │ │ -463 template │ │ │ │ │ -_4_6_4 void _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r (const V& v, std::ostream& stream) │ │ │ │ │ -465 { │ │ │ │ │ -466 if constexpr (IsNumber()) { │ │ │ │ │ -467 stream << v << std::endl; │ │ │ │ │ -468 } else { │ │ │ │ │ -469 for (const auto& entry : v) │ │ │ │ │ -470 _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r(entry, stream); │ │ │ │ │ -471 } │ │ │ │ │ -472 } │ │ │ │ │ -473 │ │ │ │ │ -491 template │ │ │ │ │ -_4_9_2 void _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b(const VectorType& vector, │ │ │ │ │ -493 const std::string& filename, int outputPrecision = 18) │ │ │ │ │ -494 { │ │ │ │ │ -495 std::ofstream outStream(filename.c_str()); │ │ │ │ │ -496 int oldPrecision = outStream.precision(); │ │ │ │ │ -497 outStream.precision(outputPrecision); │ │ │ │ │ -498 │ │ │ │ │ -499 _w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r(vector, outStream); │ │ │ │ │ -500 outStream.precision(oldPrecision); │ │ │ │ │ -501 } │ │ │ │ │ -502 │ │ │ │ │ -503 namespace Impl { │ │ │ │ │ -504 │ │ │ │ │ -506 struct NullStream { │ │ │ │ │ -507 template │ │ │ │ │ -508 friend NullStream &operator<<(NullStream &dev0, Any &&) { │ │ │ │ │ -509 return dev0; │ │ │ │ │ -510 } │ │ │ │ │ -511 }; │ │ │ │ │ -512 │ │ │ │ │ -514 // svg shall be closed with a group and an svg. i.e. "" │ │ │ │ │ -515 template │ │ │ │ │ -516 void writeSVGMatrixHeader(Stream &out, const SVGMatrixOptions &opts, │ │ │ │ │ -517 std::pair offsets) { │ │ │ │ │ -518 auto [col_offset, row_offset] = offsets; │ │ │ │ │ -519 double width = opts.width; │ │ │ │ │ -520 double height = opts.height; │ │ │ │ │ -521 // if empty, we try to figure out a sensible value of width and height │ │ │ │ │ -522 if (opts.width == 0 and opts.height == 0) │ │ │ │ │ -523 width = height = 500; │ │ │ │ │ -524 if (opts.width == 0) │ │ │ │ │ -525 width = opts.height * (double(col_offset) / row_offset); │ │ │ │ │ -526 if (opts.height == 0) │ │ │ │ │ -527 height = opts.width * (double(row_offset) / col_offset); │ │ │ │ │ -528 │ │ │ │ │ -529 // scale group w.r.t final offsets │ │ │ │ │ -530 double scale_width = width / col_offset; │ │ │ │ │ -531 double scale_height = height / row_offset; │ │ │ │ │ -532 │ │ │ │ │ -533 // write the header text │ │ │ │ │ -534 out << "\n" │ │ │ │ │ -536 << "\n" │ │ │ │ │ -538 << "\n"; │ │ │ │ │ -540 } │ │ │ │ │ -541 │ │ │ │ │ -543 template │ │ │ │ │ -545 std::pair │ │ │ │ │ -546 writeSVGMatrix(const Mat &_m_a_t, Stream &out, SVGMatrixOptions opts, │ │ │ │ │ -547 RowPrefix row_prefix, ColPrefix col_prefix) { │ │ │ │ │ -548 // get values to fill the offests │ │ │ │ │ -549 const auto& block_size = opts.block_size; │ │ │ │ │ -550 const auto& interspace = opts.interspace; │ │ │ │ │ -551 │ │ │ │ │ -552 const std::size_t rows = _m_a_t.N(); │ │ │ │ │ -553 const std::size_t cols = _m_a_t.M(); │ │ │ │ │ -554 │ │ │ │ │ -555 // disable header write for recursive calls │ │ │ │ │ -556 const bool write_header = opts.write_header; │ │ │ │ │ -557 opts.write_header = false; │ │ │ │ │ -558 │ │ │ │ │ -559 // counter of offsets for every block │ │ │ │ │ -560 std::size_t row_offset = interspace; │ │ │ │ │ -561 std::size_t col_offset = interspace; │ │ │ │ │ -562 │ │ │ │ │ -563 // lambda helper: for-each value │ │ │ │ │ -564 auto for_each_entry = [&_m_a_t](const auto &call_back) { │ │ │ │ │ -565 for (auto row_it = _m_a_t.begin(); row_it != _m_a_t.end(); ++row_it) { │ │ │ │ │ -566 for (auto col_it = row_it->begin(); col_it != row_it->end(); ++col_it) { │ │ │ │ │ -567 call_back(row_it.index(), col_it.index(), *col_it); │ │ │ │ │ -568 } │ │ │ │ │ -569 } │ │ │ │ │ -570 }; │ │ │ │ │ -571 │ │ │ │ │ -572 // accumulate content in another stream so that we write in correct order │ │ │ │ │ -573 std::stringstream ss; │ │ │ │ │ -574 │ │ │ │ │ -575 // we need to append current row and col values to the prefixes │ │ │ │ │ -576 row_prefix.push_back(0); │ │ │ │ │ -577 col_prefix.push_back(0); │ │ │ │ │ -578 │ │ │ │ │ -579 // do we need to write nested matrix blocks? │ │ │ │ │ -580 if constexpr (Dune::blockLevel() == 0) { │ │ │ │ │ -581 // simple case: write svg block content to stream for each value │ │ │ │ │ -582 for_each_entry([&](const auto &row, const auto &_c_o_l, const auto &val) { │ │ │ │ │ -583 std::size_t x_off = interspace + _c_o_l * (interspace + block_size); │ │ │ │ │ -584 std::size_t y_off = interspace + row * (interspace + block_size); │ │ │ │ │ -585 row_prefix.back() = row; │ │ │ │ │ -586 col_prefix.back() = _c_o_l; │ │ │ │ │ -587 opts.writeSVGBlock(ss, row_prefix, col_prefix, val, │ │ │ │ │ -588 {x_off, y_off, block_size, block_size}); │ │ │ │ │ -589 }); │ │ │ │ │ -590 col_offset += cols * (block_size + interspace); │ │ │ │ │ -591 row_offset += rows * (block_size + interspace); │ │ │ │ │ -592 } else { │ │ │ │ │ -593 // before we write anything, we need to calculate the │ │ │ │ │ -594 // offset for every {row,col} index │ │ │ │ │ -595 const auto null_offset = std::numeric_limits::max(); │ │ │ │ │ -596 std::vector col_offsets(cols + 1, null_offset); │ │ │ │ │ -597 std::vector row_offsets(rows + 1, null_offset); │ │ │ │ │ -598 for_each_entry([&](const auto &row, const auto &_c_o_l, const auto &val) { │ │ │ │ │ -599 NullStream dev0; │ │ │ │ │ -600 // get size of sub-block │ │ │ │ │ -601 auto sub_size = │ │ │ │ │ -602 writeSVGMatrix(val, dev0, opts, row_prefix, col_prefix); │ │ │ │ │ -603 │ │ │ │ │ -604 // if we didn't see col size before │ │ │ │ │ -605 if (col_offsets[_c_o_l + 1] == null_offset) // write it in the offset vector │ │ │ │ │ -606 col_offsets[_c_o_l + 1] = sub_size.first; │ │ │ │ │ -607 │ │ │ │ │ -608 // repeat proces for row sizes │ │ │ │ │ -609 if (row_offsets[row + 1] == null_offset) │ │ │ │ │ -610 row_offsets[row + 1] = sub_size.second; │ │ │ │ │ -611 }); │ │ │ │ │ -612 │ │ │ │ │ -613 // if some rows/cols were not visited, make an educated guess with the │ │ │ │ │ -minimum offset │ │ │ │ │ -614 auto min_row_offset = *std::min_element(begin(row_offsets), end │ │ │ │ │ -(row_offsets)); │ │ │ │ │ -615 std::replace(begin(row_offsets), end(row_offsets), null_offset, │ │ │ │ │ -min_row_offset); │ │ │ │ │ -616 auto min_col_offset = *std::min_element(begin(col_offsets), end │ │ │ │ │ -(col_offsets)); │ │ │ │ │ -617 std::replace(begin(col_offsets), end(col_offsets), null_offset, │ │ │ │ │ -min_col_offset); │ │ │ │ │ -618 │ │ │ │ │ -619 // we have sizes for every block: to get offsets we make a partial sum │ │ │ │ │ -620 col_offsets[0] = interspace; │ │ │ │ │ -621 row_offsets[0] = interspace; │ │ │ │ │ -622 for (std::size_t i = 1; i < col_offsets.size(); i++) │ │ │ │ │ -623 col_offsets[i] += col_offsets[i - 1] + interspace; │ │ │ │ │ -624 for (std::size_t i = 1; i < row_offsets.size(); i++) │ │ │ │ │ -625 row_offsets[i] += row_offsets[i - 1] + interspace; │ │ │ │ │ -626 │ │ │ │ │ -627 for_each_entry([&](const auto &row, const auto &_c_o_l, const auto &val) { │ │ │ │ │ -628 // calculate svg view from offsets │ │ │ │ │ -629 std::size_t width = │ │ │ │ │ -630 col_offsets[_c_o_l + 1] - col_offsets[_c_o_l] - interspace; │ │ │ │ │ -631 std::size_t height = │ │ │ │ │ -632 row_offsets[row + 1] - row_offsets[row] - interspace; │ │ │ │ │ -633 row_prefix.back() = row; │ │ │ │ │ -634 col_prefix.back() = _c_o_l; │ │ │ │ │ -635 // content of the sub-block has origin at {0,0}: shift it to the correct │ │ │ │ │ -place │ │ │ │ │ -636 ss << "\n"; │ │ │ │ │ -638 // write a nested svg with the contents of the sub-block │ │ │ │ │ -639 writeSVGMatrix(val, ss, opts, row_prefix, col_prefix); │ │ │ │ │ -640 ss << "\n"; │ │ │ │ │ -641 }); │ │ │ │ │ -642 col_offset = col_offsets.back(); │ │ │ │ │ -643 row_offset = row_offsets.back(); │ │ │ │ │ -644 } │ │ │ │ │ -645 │ │ │ │ │ -646 // write content in order! │ │ │ │ │ -647 // (i) if required, first header │ │ │ │ │ -648 if (write_header) │ │ │ │ │ -649 writeSVGMatrixHeader(out, opts, {col_offset, row_offset}); │ │ │ │ │ -650 │ │ │ │ │ -651 col_prefix.pop_back(); │ │ │ │ │ -652 row_prefix.pop_back(); │ │ │ │ │ -653 // (ii) an svg block for this level │ │ │ │ │ -654 opts.writeSVGBlock(out, row_prefix, col_prefix, _m_a_t, │ │ │ │ │ -655 {0, 0, col_offset, row_offset}); │ │ │ │ │ -656 // (iii) the content of the matrix │ │ │ │ │ -657 out << ss.str(); │ │ │ │ │ -658 // (iv) if required, close the header │ │ │ │ │ -659 if (write_header) │ │ │ │ │ -660 out << "\n\n"; │ │ │ │ │ -661 │ │ │ │ │ -662 // return the total required for this block │ │ │ │ │ -663 return {col_offset, row_offset}; │ │ │ │ │ -664 } │ │ │ │ │ -665 } // namespace Impl │ │ │ │ │ -666 │ │ │ │ │ -667 │ │ │ │ │ -_6_7_4 struct _D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s { │ │ │ │ │ -_6_7_6 std::size_t _b_l_o_c_k___s_i_z_e = 10; │ │ │ │ │ -_6_7_8 std::size_t _i_n_t_e_r_s_p_a_c_e = 5; │ │ │ │ │ -_6_8_0 std::size_t _w_i_d_t_h = 500; │ │ │ │ │ -_6_8_2 std::size_t _h_e_i_g_h_t = 0; │ │ │ │ │ -_6_8_4 bool _w_r_i_t_e___h_e_a_d_e_r = true; │ │ │ │ │ -_6_8_6 std::string _s_t_y_l_e = " .matrix-block {\n" │ │ │ │ │ -687 " fill: cornflowerblue;\n" │ │ │ │ │ -688 " fill-opacity: 0.4;\n" │ │ │ │ │ -689 " stroke-width: 2;\n" │ │ │ │ │ -690 " stroke: black;\n" │ │ │ │ │ -691 " stroke-opacity: 0.5;\n" │ │ │ │ │ -692 " }\n" │ │ │ │ │ -693 " .matrix-block:hover {\n" │ │ │ │ │ -694 " fill: lightcoral;\n" │ │ │ │ │ -695 " fill-opacity: 0.4;\n" │ │ │ │ │ -696 " stroke-opacity: 1;\n" │ │ │ │ │ -697 " }\n"; │ │ │ │ │ -698 │ │ │ │ │ -_7_1_0 std::function _c_o_l_o_r___f_i_l_l; │ │ │ │ │ -711 │ │ │ │ │ -717 template │ │ │ │ │ -_7_1_8 std::string _b_l_o_c_k_S_t_y_l_e_C_l_a_s_s(const RowPrefix &row_prefix, │ │ │ │ │ -719 const ColPrefix &col_prefix) const { │ │ │ │ │ -720 // here, you can potentially give a different style to each block │ │ │ │ │ -721 return "matrix-block"; │ │ │ │ │ -722 } │ │ │ │ │ -723 │ │ │ │ │ -_7_2_5 bool _w_r_i_t_e___b_l_o_c_k___t_i_t_l_e = true; │ │ │ │ │ -726 │ │ │ │ │ -732 template │ │ │ │ │ -_7_3_3 void _w_r_i_t_e_B_l_o_c_k_T_i_t_l_e(Stream& out, const RowPrefix &row_prefix, │ │ │ │ │ -734 const ColPrefix &col_prefix, │ │ │ │ │ -735 const Block &block) const { │ │ │ │ │ -736 if (this->write_block_title) { │ │ │ │ │ -737 out << ""; │ │ │ │ │ -738 assert(row_prefix.size() == col_prefix.size()); │ │ │ │ │ -739 for (std::size_t i = 0; i < row_prefix.size(); ++i) │ │ │ │ │ -740 out << "[" << row_prefix[i] << ", "<< col_prefix[i] << "]"; │ │ │ │ │ -741 if constexpr (Dune::blockLevel<Block>() == 0) │ │ │ │ │ -742 out << ": " << block; │ │ │ │ │ -743 out << "\n"; │ │ │ │ │ -744 } │ │ │ │ │ -745 } │ │ │ │ │ -746 │ │ │ │ │ -768 template │ │ │ │ │ -_7_6_9 void _w_r_i_t_e_S_V_G_B_l_o_c_k(Stream &out, │ │ │ │ │ -770 const RowPrefix &row_prefix, │ │ │ │ │ -771 const ColPrefix &col_prefix, const Block block, │ │ │ │ │ -772 const std::array &svg_box) const { │ │ │ │ │ -773 // get bounding box values │ │ │ │ │ -774 auto &[x_off, y_off, _w_i_d_t_h, _h_e_i_g_h_t] = svg_box; │ │ │ │ │ -775 // get style class │ │ │ │ │ -776 std::string block_class = this->_b_l_o_c_k_S_t_y_l_e_C_l_a_s_s(row_prefix, col_prefix); │ │ │ │ │ -777 // write a rectangle on the bounding box │ │ │ │ │ -778 out << "() == 0 and std:: │ │ │ │ │ -is_convertible{}) │ │ │ │ │ -781 if (_c_o_l_o_r___f_i_l_l) │ │ │ │ │ -782 out << " style='fill-opacity: 1;fill:" << _c_o_l_o_r___f_i_l_l(double(block)) << "'"; │ │ │ │ │ -783 │ │ │ │ │ -784 out << ">\n"; │ │ │ │ │ -785 // give the rectangle a title (in html this shows info about the block) │ │ │ │ │ -786 this->_w_r_i_t_e_B_l_o_c_k_T_i_t_l_e(out,row_prefix, col_prefix, block); │ │ │ │ │ -787 // close rectangle │ │ │ │ │ -788 out << "\n"; │ │ │ │ │ -789 } │ │ │ │ │ -790 }; │ │ │ │ │ -791 │ │ │ │ │ -806 template │ │ │ │ │ -_8_0_7 void _w_r_i_t_e_S_V_G_M_a_t_r_i_x(const Mat &_m_a_t, std::ostream &out, │ │ │ │ │ -808 SVGOptions opts = {}) { │ │ │ │ │ -809 // We need a vector that can fit all the multi-indices for rows and colums │ │ │ │ │ -810 using IndexPrefix = Dune::ReservedVector()>; │ │ │ │ │ -811 // Call overload for Mat type │ │ │ │ │ -812 Impl::writeSVGMatrix(_m_a_t, out, opts, IndexPrefix{}, IndexPrefix{}); │ │ │ │ │ -813 } │ │ │ │ │ -814 │ │ │ │ │ -817} // namespace Dune │ │ │ │ │ -818 │ │ │ │ │ -819#endif │ │ │ │ │ -_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ │ -_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. │ │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_w_r_i_t_e_S_V_G_M_a_t_r_i_x │ │ │ │ │ -void writeSVGMatrix(const Mat &mat, std::ostream &out, SVGOptions opts={}) │ │ │ │ │ -Writes the visualization of matrix in the SVG format. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:807 │ │ │ │ │ -_D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b │ │ │ │ │ -void writeMatrixToMatlab(const MatrixType &matrix, const std::string &filename, │ │ │ │ │ -int outputPrecision=18) │ │ │ │ │ -Writes sparse matrix in a Matlab-readable format. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:451 │ │ │ │ │ -_D_u_n_e_:_:_p_r_i_n_t___r_o_w │ │ │ │ │ -void print_row(std::ostream &s, const K &value, typename FieldMatrix< K, 1, 1 │ │ │ │ │ ->::size_type I, typename FieldMatrix< K, 1, 1 >::size_type J, typename │ │ │ │ │ -FieldMatrix< K, 1, 1 >::size_type therow, int width, int precision, typename │ │ │ │ │ -std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr) │ │ │ │ │ -Print one row of a matrix, specialization for number types. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:151 │ │ │ │ │ -_D_u_n_e_:_:_p_r_i_n_t_m_a_t_r_i_x │ │ │ │ │ -void printmatrix(std::ostream &s, const M &A, std::string title, std::string │ │ │ │ │ -rowtext, int width=10, int precision=2) │ │ │ │ │ -Print a generic block matrix. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:213 │ │ │ │ │ -_D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ -void printvector(std::ostream &s, const V &v, std::string title, std::string │ │ │ │ │ -rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ -Print an ISTL vector. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_T_o_M_a_t_l_a_b_H_e_l_p_e_r │ │ │ │ │ -void writeMatrixToMatlabHelper(const FieldType &value, int rowOffset, int │ │ │ │ │ -colOffset, std::ostream &s, typename std::enable_if_t< Dune::IsNumber< │ │ │ │ │ -FieldType >::value > *sfinae=nullptr) │ │ │ │ │ -Helper method for the writeMatrixToMatlab routine. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:379 │ │ │ │ │ -_D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b_H_e_l_p_e_r │ │ │ │ │ -void writeVectorToMatlabHelper(const V &v, std::ostream &stream) │ │ │ │ │ -DDeeffiinniittiioonn io.hh:464 │ │ │ │ │ -_D_u_n_e_:_:_w_r_i_t_e_V_e_c_t_o_r_T_o_M_a_t_l_a_b │ │ │ │ │ -void writeVectorToMatlab(const VectorType &vector, const std::string &filename, │ │ │ │ │ -int outputPrecision=18) │ │ │ │ │ -Writes vectors in a Matlab-readable format. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:492 │ │ │ │ │ -_D_u_n_e_:_:_r_e_c_u_r_s_i_v_e___p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ -void recursive_printvector(std::ostream &s, const V &v, std::string rowtext, │ │ │ │ │ -int &counter, int columns, int width) │ │ │ │ │ -Recursively print a vector. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_p_r_i_n_t_S_p_a_r_s_e_M_a_t_r_i_x │ │ │ │ │ -void printSparseMatrix(std::ostream &s, const BCRSMatrix< FieldMatrix< B, n, m │ │ │ │ │ ->, A > &mat, std::string title, std::string rowtext, int width=3, int │ │ │ │ │ -precision=2) │ │ │ │ │ -Prints a BCRSMatrix with fixed sized blocks. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_f_i_l_l___r_o_w │ │ │ │ │ -void fill_row(std::ostream &s, int m, int width, int precision) │ │ │ │ │ -Print a row of zeros for a non-existing block. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:133 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +180 public: │ │ │ │ │ +_1_8_1 _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (std::shared_ptr comm) : │ │ │ │ │ +182 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm,_S_o_l_v_e_r_C_a_t_e_g_o_r_y::nonoverlapping) {} │ │ │ │ │ +183 │ │ │ │ │ +_1_8_4 _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (const C& comm) : │ │ │ │ │ +185 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm,_S_o_l_v_e_r_C_a_t_e_g_o_r_y::nonoverlapping) {} │ │ │ │ │ +186 }; │ │ │ │ │ +187 │ │ │ │ │ +199 template │ │ │ │ │ +_2_0_0 class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t : public _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +201 { │ │ │ │ │ +202 public: │ │ │ │ │ +_2_0_3 _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (std::shared_ptr comm) : │ │ │ │ │ +204 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm, _S_o_l_v_e_r_C_a_t_e_g_o_r_y::overlapping) {} │ │ │ │ │ +205 │ │ │ │ │ +_2_0_6 _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (const C& comm) : │ │ │ │ │ +207 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm,_S_o_l_v_e_r_C_a_t_e_g_o_r_y::overlapping) {} │ │ │ │ │ +208 }; │ │ │ │ │ +209 │ │ │ │ │ +223 template │ │ │ │ │ +_2_2_4 std::shared_ptr> _m_a_k_e_S_c_a_l_a_r_P_r_o_d_u_c_t(std::shared_ptr comm, _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category) │ │ │ │ │ +225 { │ │ │ │ │ +226 switch(category) │ │ │ │ │ +227 { │ │ │ │ │ +228 case _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l: │ │ │ │ │ +229 return │ │ │ │ │ +230 std::make_shared>(); │ │ │ │ │ +231 default: │ │ │ │ │ +232 return │ │ │ │ │ +233 std::make_shared>(comm,category); │ │ │ │ │ +234 } │ │ │ │ │ +235 } │ │ │ │ │ +236 │ │ │ │ │ +241 template │ │ │ │ │ +_2_4_2 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const Comm& comm, │ │ │ │ │ +_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category) │ │ │ │ │ +243 { return makeScalarProduct(stackobject_to_shared_ptr(comm), category); } │ │ │ │ │ +244 │ │ │ │ │ +245} // end namespace Dune │ │ │ │ │ +246 │ │ │ │ │ +247#endif │ │ │ │ │ +_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 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_c_o_l_d_i_m │ │ │ │ │ -static auto coldim(const M &A) │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:219 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_r_o_w_d_i_m │ │ │ │ │ -static auto rowdim(const M &A) │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:214 │ │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s │ │ │ │ │ -Default options class to write SVG matrices. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:674 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_s_t_y_l_e │ │ │ │ │ -std::string style │ │ │ │ │ -CSS style block to write in header. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:686 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_i_d_t_h │ │ │ │ │ -std::size_t width │ │ │ │ │ -Final width size (pixels) of the SVG header. If 0, size is automatic. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:680 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_c_o_l_o_r___f_i_l_l │ │ │ │ │ -std::function< std::string(const double &)> color_fill │ │ │ │ │ -Color fill for default options. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:710 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_b_l_o_c_k___s_i_z_e │ │ │ │ │ -std::size_t block_size │ │ │ │ │ -size (pixels) of the deepst block/value of the matrix │ │ │ │ │ -DDeeffiinniittiioonn io.hh:676 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e_S_V_G_B_l_o_c_k │ │ │ │ │ -void writeSVGBlock(Stream &out, const RowPrefix &row_prefix, const ColPrefix │ │ │ │ │ -&col_prefix, const Block block, const std::array< std::size_t, 4 > &svg_box) │ │ │ │ │ -const │ │ │ │ │ -Write an SVG object for a given block/value in the matrix. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:769 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e_B_l_o_c_k_T_i_t_l_e │ │ │ │ │ -void writeBlockTitle(Stream &out, const RowPrefix &row_prefix, const ColPrefix │ │ │ │ │ -&col_prefix, const Block &block) const │ │ │ │ │ -Helper function writes a title for a given block and prefix. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:733 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_i_n_t_e_r_s_p_a_c_e │ │ │ │ │ -std::size_t interspace │ │ │ │ │ -size (pixels) of the interspace between blocks │ │ │ │ │ -DDeeffiinniittiioonn io.hh:678 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e___b_l_o_c_k___t_i_t_l_e │ │ │ │ │ -bool write_block_title │ │ │ │ │ -(Helper) Whether to write a title on the rectangle value │ │ │ │ │ -DDeeffiinniittiioonn io.hh:725 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_h_e_i_g_h_t │ │ │ │ │ -std::size_t height │ │ │ │ │ -Final height size (pixels) of the SVG header. If 0, size is automatic. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:682 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_w_r_i_t_e___h_e_a_d_e_r │ │ │ │ │ -bool write_header │ │ │ │ │ -Whether to write the SVG header. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:684 │ │ │ │ │ -_D_u_n_e_:_:_D_e_f_a_u_l_t_S_V_G_M_a_t_r_i_x_O_p_t_i_o_n_s_:_:_b_l_o_c_k_S_t_y_l_e_C_l_a_s_s │ │ │ │ │ -std::string blockStyleClass(const RowPrefix &row_prefix, const ColPrefix │ │ │ │ │ -&col_prefix) const │ │ │ │ │ -Helper function that returns an style class for a given prefix. │ │ │ │ │ -DDeeffiinniittiioonn io.hh:718 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -RowIterator end() │ │ │ │ │ -Get iterator to one beyond last row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:620 │ │ │ │ │ -_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:614 │ │ │ │ │ -_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_:_:_M │ │ │ │ │ -size_type M() const │ │ │ │ │ -Return the number of columns. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:700 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ -size_type N() const │ │ │ │ │ -Return the number of rows. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ +_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 approriate scalar product for a solver category. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:224 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +Base class for scalar product and norm computation. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_t │ │ │ │ │ +virtual field_type dot(const X &x, const X &y) const │ │ │ │ │ +Dot product of two vectors. It is assumed that the vectors are consistent on │ │ │ │ │ +the interior+border part... │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ │ +Category of the scalar product (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +export types, they come from the derived class │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_~_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +virtual ~ScalarProduct() │ │ │ │ │ +every abstract base class has a virtual destructor │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:83 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:57 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_n_o_r_m │ │ │ │ │ +virtual real_type norm(const X &x) const │ │ │ │ │ +Norm of a right-hand side vector. The vector must be consistent on the │ │ │ │ │ +interior+border partition. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +Scalar product for overlapping Schwarz methods. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_t │ │ │ │ │ +virtual field_type dot(const X &x, const X &y) const override │ │ │ │ │ +Dot product of two vectors. It is assumed that the vectors are consistent on │ │ │ │ │ +the interior+border part... │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:139 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ +virtual SolverCategory::Category category() const override │ │ │ │ │ +Category of the scalar product (see SolverCategory::Category) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:108 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ │ +C communication_type │ │ │ │ │ +The type of the communication object. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:113 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +ParallelScalarProduct(const communication_type &com, SolverCategory::Category │ │ │ │ │ +cat) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:130 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +X domain_type │ │ │ │ │ +The type of the vector to compute the scalar product on. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:105 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +ParallelScalarProduct(std::shared_ptr< const communication_type > com, │ │ │ │ │ +SolverCategory::Category cat) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +X::field_type field_type │ │ │ │ │ +The field type used by the vector type domain_type. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:107 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_n_o_r_m │ │ │ │ │ +virtual real_type norm(const X &x) const override │ │ │ │ │ +Norm of a right-hand side vector. The vector must be consistent on the │ │ │ │ │ +interior+border partition. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:149 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +Default implementation for the scalar case. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:168 │ │ │ │ │ +_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +Nonoverlapping Scalar Product with communication object. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:179 │ │ │ │ │ +_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +NonoverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:181 │ │ │ │ │ +_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +NonoverlappingSchwarzScalarProduct(const C &comm) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:184 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +Scalar product for overlapping Schwarz methods. │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:201 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +OverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:203 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ │ +OverlappingSchwarzScalarProduct(const C &comm) │ │ │ │ │ +DDeeffiinniittiioonn scalarproducts.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ │ +Categories for the solvers. │ │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:22 │ │ │ │ │ +_D_u_n_e_:_:_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.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00206.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrix.hh File Reference │ │ │ │ +dune-istl: arpackpp.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,65 +65,48 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
matrix.hh File Reference
│ │ │ │ +
arpackpp.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

A dynamic dense block matrix class. │ │ │ │ -More...

│ │ │ │
#include <cmath>
│ │ │ │ -#include <memory>
│ │ │ │ -#include <dune/common/ftraits.hh>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/scalarvectorview.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <dune/istl/bvector.hh>
│ │ │ │ -#include <dune/istl/istlexception.hh>
│ │ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <string>
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │ +#include <dune/istl/bvector.hh>
│ │ │ │ +#include <dune/istl/istlexception.hh>
│ │ │ │ +#include <dune/istl/io.hh>
│ │ │ │ +#include "arssym.h"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::MatrixImp::DenseMatrixBase< B, A >
 A Vector of blocks with different blocksizes. More...
 
class  Dune::MatrixImp::DenseMatrixBase< B, A >::Iterator
 Iterator class for sequential access. More...
 
class  Dune::MatrixImp::DenseMatrixBase< B, A >::ConstIterator
 ConstIterator class for sequential access. More...
 
class  Dune::Matrix< T, A >
 A generic dynamic dense matrix. More...
 
struct  Dune::FieldTraits< Matrix< T, A > >
class  Dune::ArPackPlusPlus_Algorithms< BCRSMatrix, BlockVector >
 Wrapper to use a range of ARPACK++ eigenvalue solvers. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::MatrixImp
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

A dynamic dense block matrix class.

│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,43 +1,29 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ + * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -matrix.hh File Reference │ │ │ │ │ -A dynamic dense block matrix class. _M_o_r_e_._._. │ │ │ │ │ +arpackpp.hh File Reference │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._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_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ │ +#include "arssym.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_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_ _B_,_ _A_ _> │ │ │ │ │ -  A Vector of blocks with different blocksizes. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_ _B_,_ _A_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -  _I_t_e_r_a_t_o_r class for sequential access. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_ _B_,_ _A_ _>_:_:_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 class for sequential access. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_M_a_t_r_i_x_<_ _T_,_ _A_ _> │ │ │ │ │ -  A generic dynamic dense matrix. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _> │ │ │ │ │ +class   _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_<_ _B_C_R_S_M_a_t_r_i_x_,_ _B_l_o_c_k_V_e_c_t_o_r_ _> │ │ │ │ │ +  Wrapper to use a range of ARPACK++ eigenvalue solvers. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_M_a_t_r_i_x_I_m_p │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -A dynamic dense block matrix class. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00206_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrix.hh Source File │ │ │ │ +dune-istl: arpackpp.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1262 +70,881 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
matrix.hh
│ │ │ │ +
arpackpp.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_MATRIX_HH
│ │ │ │ -
6#define DUNE_ISTL_MATRIX_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_EIGENVALUE_ARPACKPP_HH
│ │ │ │ +
6#define DUNE_ISTL_EIGENVALUE_ARPACKPP_HH
│ │ │ │
7
│ │ │ │ -
12#include <cmath>
│ │ │ │ -
13#include <memory>
│ │ │ │ +
8#if HAVE_ARPACKPP || defined DOXYGEN
│ │ │ │ +
9
│ │ │ │ +
10#include <cmath> // provides std::abs, std::pow, std::sqrt
│ │ │ │ +
11
│ │ │ │ +
12#include <iostream> // provides std::cout, std::endl
│ │ │ │ +
13#include <string> // provides std::string
│ │ │ │
14
│ │ │ │ -
15#include <dune/common/ftraits.hh>
│ │ │ │ -
16#include <dune/common/typetraits.hh>
│ │ │ │ -
17#include <dune/common/scalarvectorview.hh>
│ │ │ │ -
18#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
19
│ │ │ │ -
20#include <dune/istl/bvector.hh>
│ │ │ │ - │ │ │ │ - │ │ │ │ -
23
│ │ │ │ -
24namespace Dune {
│ │ │ │ -
25
│ │ │ │ -
│ │ │ │ -
26namespace MatrixImp
│ │ │ │ -
27{
│ │ │ │ -
39 template<class B, class A=std::allocator<B> >
│ │ │ │ -
│ │ │ │ -
40 class DenseMatrixBase : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ -
41 // this derivation gives us all the blas level 1 and norms
│ │ │ │ -
42 // on the large array. However, access operators have to be
│ │ │ │ -
43 // overwritten.
│ │ │ │ -
44 {
│ │ │ │ -
45 public:
│ │ │ │ -
46
│ │ │ │ -
47 //===== type definitions and constants
│ │ │ │ -
48
│ │ │ │ -
50 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ -
51
│ │ │ │ -
53 typedef A allocator_type;
│ │ │ │ -
54
│ │ │ │ -
56 typedef typename A::size_type size_type;
│ │ │ │ -
57
│ │ │ │ - │ │ │ │ -
64
│ │ │ │ - │ │ │ │ -
68
│ │ │ │ -
69 // just a shorthand
│ │ │ │ -
70 typedef Imp::BlockVectorWindow<B,A> window_type;
│ │ │ │ -
71
│ │ │ │ - │ │ │ │ -
73
│ │ │ │ - │ │ │ │ -
75
│ │ │ │ -
76
│ │ │ │ -
77 //===== constructors and such
│ │ │ │ +
15#include <dune/common/fvector.hh> // provides Dune::FieldVector
│ │ │ │ +
16#include <dune/common/exceptions.hh> // provides DUNE_THROW(...)
│ │ │ │ +
17
│ │ │ │ +
18#include <dune/istl/blocklevel.hh> // provides Dune::blockLevel
│ │ │ │ +
19#include <dune/istl/bvector.hh> // provides Dune::BlockVector
│ │ │ │ +
20#include <dune/istl/istlexception.hh> // provides Dune::ISTLError
│ │ │ │ +
21#include <dune/istl/io.hh> // provides Dune::printvector(...)
│ │ │ │ +
22
│ │ │ │ +
23#ifdef Status
│ │ │ │ +
24#undef Status // prevent preprocessor from damaging the ARPACK++
│ │ │ │ +
25 // code when "X11/Xlib.h" is included (the latter
│ │ │ │ +
26 // defines Status as "#define Status int" and
│ │ │ │ +
27 // ARPACK++ provides a class with a method called
│ │ │ │ +
28 // Status)
│ │ │ │ +
29#endif
│ │ │ │ +
30#include "arssym.h" // provides ARSymStdEig
│ │ │ │ +
31
│ │ │ │ +
32namespace Dune
│ │ │ │ +
33{
│ │ │ │ +
34
│ │ │ │ +
39 namespace Impl {
│ │ │ │ +
55 template <class BCRSMatrix>
│ │ │ │ +
56 class ArPackPlusPlus_BCRSMatrixWrapper
│ │ │ │ +
57 {
│ │ │ │ +
58 public:
│ │ │ │ +
60 typedef typename BCRSMatrix::field_type Real;
│ │ │ │ +
61
│ │ │ │ +
62 public:
│ │ │ │ +
64 ArPackPlusPlus_BCRSMatrixWrapper (const BCRSMatrix& A)
│ │ │ │ +
65 : A_(A),
│ │ │ │ +
66 m_(A_.M() * mBlock), n_(A_.N() * nBlock)
│ │ │ │ +
67 {
│ │ │ │ +
68 // assert that BCRSMatrix type has blocklevel 2
│ │ │ │ +
69 static_assert
│ │ │ │ +
70 (blockLevel<BCRSMatrix>() == 2,
│ │ │ │ +
71 "Only BCRSMatrices with blocklevel 2 are supported.");
│ │ │ │ +
72
│ │ │ │ +
73 // allocate memory for auxiliary block vector objects
│ │ │ │ +
74 // which are compatible to matrix rows / columns
│ │ │ │ +
75 domainBlockVector.resize(A_.N());
│ │ │ │ +
76 rangeBlockVector.resize(A_.M());
│ │ │ │ +
77 }
│ │ │ │
78
│ │ │ │ -
│ │ │ │ -
82 DenseMatrixBase () : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ -
83 {
│ │ │ │ -
84 // nothing is known ...
│ │ │ │ -
85 rows_ = 0;
│ │ │ │ -
86 columns_ = 0;
│ │ │ │ -
87 }
│ │ │ │ -
│ │ │ │ -
88
│ │ │ │ -
│ │ │ │ -
95 DenseMatrixBase (size_type rows, size_type columns) : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ -
96 {
│ │ │ │ -
97 // and we can allocate the big array in the base class
│ │ │ │ -
98 this->n = rows*columns;
│ │ │ │ -
99 columns_ = columns;
│ │ │ │ -
100 if (this->n>0)
│ │ │ │ -
101 {
│ │ │ │ -
102 this->p = allocator_.allocate(this->n);
│ │ │ │ -
103 new (this->p)B[this->n];
│ │ │ │ -
104 }
│ │ │ │ -
105 else
│ │ │ │ -
106 {
│ │ │ │ -
107 this->n = 0;
│ │ │ │ -
108 this->p = 0;
│ │ │ │ -
109 }
│ │ │ │ -
110
│ │ │ │ -
111 // we can allocate the windows now
│ │ │ │ -
112 rows_ = rows;
│ │ │ │ -
113 }
│ │ │ │ -
│ │ │ │ -
114
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
117 {
│ │ │ │ -
118 // allocate the big array in the base class
│ │ │ │ -
119 this->n = a.n;
│ │ │ │ -
120 columns_ = a.columns_;
│ │ │ │ -
121 if (this->n>0)
│ │ │ │ -
122 {
│ │ │ │ -
123 // allocate and construct objects
│ │ │ │ -
124 this->p = allocator_.allocate(this->n);
│ │ │ │ -
125 new (this->p)B[this->n];
│ │ │ │ -
126
│ │ │ │ -
127 // copy data
│ │ │ │ -
128 for (size_type i=0; i<this->n; i++)
│ │ │ │ -
129 this->p[i]=a.p[i];
│ │ │ │ -
130 }
│ │ │ │ -
131 else
│ │ │ │ -
132 {
│ │ │ │ -
133 this->n = 0;
│ │ │ │ -
134 this->p = nullptr;
│ │ │ │ -
135 }
│ │ │ │ +
80 inline void multMv (Real* v, Real* w)
│ │ │ │ +
81 {
│ │ │ │ +
82 // get vector v as an object of appropriate type
│ │ │ │ +
83 arrayToDomainBlockVector(v,domainBlockVector);
│ │ │ │ +
84
│ │ │ │ +
85 // perform matrix-vector product
│ │ │ │ +
86 A_.mv(domainBlockVector,rangeBlockVector);
│ │ │ │ +
87
│ │ │ │ +
88 // get vector w from object of appropriate type
│ │ │ │ +
89 rangeBlockVectorToArray(rangeBlockVector,w);
│ │ │ │ +
90 };
│ │ │ │ +
91
│ │ │ │ +
93 inline void multMtMv (Real* v, Real* w)
│ │ │ │ +
94 {
│ │ │ │ +
95 // get vector v as an object of appropriate type
│ │ │ │ +
96 arrayToDomainBlockVector(v,domainBlockVector);
│ │ │ │ +
97
│ │ │ │ +
98 // perform matrix-vector product
│ │ │ │ +
99 A_.mv(domainBlockVector,rangeBlockVector);
│ │ │ │ +
100 A_.mtv(rangeBlockVector,domainBlockVector);
│ │ │ │ +
101
│ │ │ │ +
102 // get vector w from object of appropriate type
│ │ │ │ +
103 domainBlockVectorToArray(domainBlockVector,w);
│ │ │ │ +
104 };
│ │ │ │ +
105
│ │ │ │ +
107 inline void multMMtv (Real* v, Real* w)
│ │ │ │ +
108 {
│ │ │ │ +
109 // get vector v as an object of appropriate type
│ │ │ │ +
110 arrayToRangeBlockVector(v,rangeBlockVector);
│ │ │ │ +
111
│ │ │ │ +
112 // perform matrix-vector product
│ │ │ │ +
113 A_.mtv(rangeBlockVector,domainBlockVector);
│ │ │ │ +
114 A_.mv(domainBlockVector,rangeBlockVector);
│ │ │ │ +
115
│ │ │ │ +
116 // get vector w from object of appropriate type
│ │ │ │ +
117 rangeBlockVectorToArray(rangeBlockVector,w);
│ │ │ │ +
118 };
│ │ │ │ +
119
│ │ │ │ +
121 inline int nrows () const { return m_; }
│ │ │ │ +
122
│ │ │ │ +
124 inline int ncols () const { return n_; }
│ │ │ │ +
125
│ │ │ │ +
126 protected:
│ │ │ │ +
127 // Number of rows and columns in each block of the matrix
│ │ │ │ +
128 constexpr static int mBlock = BCRSMatrix::block_type::rows;
│ │ │ │ +
129 constexpr static int nBlock = BCRSMatrix::block_type::cols;
│ │ │ │ +
130
│ │ │ │ +
131 // Type of vectors in the domain of the linear map associated with
│ │ │ │ +
132 // the matrix, i.e. block vectors compatible to matrix rows
│ │ │ │ +
133 constexpr static int dbvBlockSize = nBlock;
│ │ │ │ +
134 typedef Dune::FieldVector<Real,dbvBlockSize> DomainBlockVectorBlock;
│ │ │ │ +
135 typedef Dune::BlockVector<DomainBlockVectorBlock> DomainBlockVector;
│ │ │ │
136
│ │ │ │ -
137 // we can allocate the windows now
│ │ │ │ -
138 rows_ = a.rows_;
│ │ │ │ -
139 }
│ │ │ │ -
│ │ │ │ -
140
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
143 {
│ │ │ │ -
144 if (this->n>0) {
│ │ │ │ -
145 size_type i=this->n;
│ │ │ │ -
146 while (i)
│ │ │ │ -
147 this->p[--i].~B();
│ │ │ │ -
148 allocator_.deallocate(this->p,this->n);
│ │ │ │ -
149 }
│ │ │ │ -
150 }
│ │ │ │ -
│ │ │ │ -
151
│ │ │ │ -
│ │ │ │ -
153 void resize (size_type rows, size_type columns)
│ │ │ │ -
154 {
│ │ │ │ -
155 // deconstruct objects and deallocate memory if necessary
│ │ │ │ -
156 if (this->n>0) {
│ │ │ │ -
157 size_type i=this->n;
│ │ │ │ -
158 while (i)
│ │ │ │ -
159 this->p[--i].~B();
│ │ │ │ -
160 allocator_.deallocate(this->p,this->n);
│ │ │ │ -
161 }
│ │ │ │ -
162
│ │ │ │ -
163 // and we can allocate the big array in the base class
│ │ │ │ -
164 this->n = rows*columns;
│ │ │ │ -
165 if (this->n>0)
│ │ │ │ -
166 {
│ │ │ │ -
167 this->p = allocator_.allocate(this->n);
│ │ │ │ -
168 new (this->p)B[this->n];
│ │ │ │ -
169 }
│ │ │ │ -
170 else
│ │ │ │ -
171 {
│ │ │ │ -
172 this->n = 0;
│ │ │ │ -
173 this->p = nullptr;
│ │ │ │ -
174 }
│ │ │ │ -
175
│ │ │ │ -
176 // we can allocate the windows now
│ │ │ │ -
177 rows_ = rows;
│ │ │ │ -
178 columns_ = columns;
│ │ │ │ -
179 }
│ │ │ │ -
│ │ │ │ -
180
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
183 {
│ │ │ │ -
184 if (&a!=this) // check if this and a are different objects
│ │ │ │ -
185 {
│ │ │ │ -
186 columns_ = a.columns_;
│ │ │ │ -
187 // reallocate arrays if necessary
│ │ │ │ -
188 // Note: still the block sizes may vary !
│ │ │ │ -
189 if (this->n!=a.n || rows_!=a.rows_)
│ │ │ │ -
190 {
│ │ │ │ -
191 // deconstruct objects and deallocate memory if necessary
│ │ │ │ -
192 if (this->n>0) {
│ │ │ │ -
193 size_type i=this->n;
│ │ │ │ -
194 while (i)
│ │ │ │ -
195 this->p[--i].~B();
│ │ │ │ -
196 allocator_.deallocate(this->p,this->n);
│ │ │ │ -
197 }
│ │ │ │ -
198
│ │ │ │ -
199 // allocate the big array in the base class
│ │ │ │ -
200 this->n = a.n;
│ │ │ │ -
201 if (this->n>0)
│ │ │ │ -
202 {
│ │ │ │ -
203 // allocate and construct objects
│ │ │ │ -
204 this->p = allocator_.allocate(this->n);
│ │ │ │ -
205 new (this->p)B[this->n];
│ │ │ │ -
206 }
│ │ │ │ -
207 else
│ │ │ │ -
208 {
│ │ │ │ -
209 this->n = 0;
│ │ │ │ -
210 this->p = nullptr;
│ │ │ │ -
211 }
│ │ │ │ -
212
│ │ │ │ -
213 // Copy number of rows
│ │ │ │ -
214 rows_ = a.rows_;
│ │ │ │ -
215 }
│ │ │ │ -
216
│ │ │ │ -
217 // and copy the data
│ │ │ │ -
218 for (size_type i=0; i<this->n; i++)
│ │ │ │ -
219 this->p[i]=a.p[i];
│ │ │ │ -
220 }
│ │ │ │ -
221
│ │ │ │ -
222 return *this;
│ │ │ │ -
223 }
│ │ │ │ -
│ │ │ │ -
224
│ │ │ │ -
225
│ │ │ │ -
226 //===== assignment from scalar
│ │ │ │ -
227
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
230 {
│ │ │ │ -
231 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ -
232 return *this;
│ │ │ │ -
233 }
│ │ │ │ -
│ │ │ │ -
234
│ │ │ │ -
235
│ │ │ │ -
236 //===== access to components
│ │ │ │ -
237 // has to be overwritten from base class because it must
│ │ │ │ -
238 // return access to the windows
│ │ │ │ -
239
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
242 {
│ │ │ │ -
243#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
244 if (i>=rows_) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
245#endif
│ │ │ │ -
246 return window_type(this->p + i*columns_, columns_);
│ │ │ │ -
247 }
│ │ │ │ -
│ │ │ │ +
137 // Type of vectors in the range of the linear map associated with
│ │ │ │ +
138 // the matrix, i.e. block vectors compatible to matrix columns
│ │ │ │ +
139 constexpr static int rbvBlockSize = mBlock;
│ │ │ │ +
140 typedef Dune::FieldVector<Real,rbvBlockSize> RangeBlockVectorBlock;
│ │ │ │ +
141 typedef Dune::BlockVector<RangeBlockVectorBlock> RangeBlockVector;
│ │ │ │ +
142
│ │ │ │ +
143 // Types for vector index access
│ │ │ │ +
144 typedef typename DomainBlockVector::size_type dbv_size_type;
│ │ │ │ +
145 typedef typename RangeBlockVector::size_type rbv_size_type;
│ │ │ │ +
146 typedef typename DomainBlockVectorBlock::size_type dbvb_size_type;
│ │ │ │ +
147 typedef typename RangeBlockVectorBlock::size_type rbvb_size_type;
│ │ │ │ +
148
│ │ │ │ +
149 // Get vector v from a block vector object which is compatible to
│ │ │ │ +
150 // matrix rows
│ │ │ │ +
151 static inline void
│ │ │ │ +
152 domainBlockVectorToArray (const DomainBlockVector& dbv, Real* v)
│ │ │ │ +
153 {
│ │ │ │ +
154 for (dbv_size_type block = 0; block < dbv.N(); ++block)
│ │ │ │ +
155 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock)
│ │ │ │ +
156 v[block*dbvBlockSize + iBlock] = dbv[block][iBlock];
│ │ │ │ +
157 }
│ │ │ │ +
158
│ │ │ │ +
159 // Get vector v from a block vector object which is compatible to
│ │ │ │ +
160 // matrix columns
│ │ │ │ +
161 static inline void
│ │ │ │ +
162 rangeBlockVectorToArray (const RangeBlockVector& rbv, Real* v)
│ │ │ │ +
163 {
│ │ │ │ +
164 for (rbv_size_type block = 0; block < rbv.N(); ++block)
│ │ │ │ +
165 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock)
│ │ │ │ +
166 v[block*rbvBlockSize + iBlock] = rbv[block][iBlock];
│ │ │ │ +
167 }
│ │ │ │ +
168
│ │ │ │ +
169 public:
│ │ │ │ +
172 static inline void arrayToDomainBlockVector (const Real* v,
│ │ │ │ +
173 DomainBlockVector& dbv)
│ │ │ │ +
174 {
│ │ │ │ +
175 for (dbv_size_type block = 0; block < dbv.N(); ++block)
│ │ │ │ +
176 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock)
│ │ │ │ +
177 dbv[block][iBlock] = v[block*dbvBlockSize + iBlock];
│ │ │ │ +
178 }
│ │ │ │ +
179
│ │ │ │ +
182 static inline void arrayToRangeBlockVector (const Real* v,
│ │ │ │ +
183 RangeBlockVector& rbv)
│ │ │ │ +
184 {
│ │ │ │ +
185 for (rbv_size_type block = 0; block < rbv.N(); ++block)
│ │ │ │ +
186 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock)
│ │ │ │ +
187 rbv[block][iBlock] = v[block*rbvBlockSize + iBlock];
│ │ │ │ +
188 }
│ │ │ │ +
189
│ │ │ │ +
190 protected:
│ │ │ │ +
191 // The DUNE-ISTL BCRSMatrix
│ │ │ │ +
192 const BCRSMatrix& A_;
│ │ │ │ +
193
│ │ │ │ +
194 // Number of rows and columns in the matrix
│ │ │ │ +
195 const int m_, n_;
│ │ │ │ +
196
│ │ │ │ +
197 // Auxiliary block vector objects which are
│ │ │ │ +
198 // compatible to matrix rows / columns
│ │ │ │ +
199 mutable DomainBlockVector domainBlockVector;
│ │ │ │ +
200 mutable RangeBlockVector rangeBlockVector;
│ │ │ │ +
201 };
│ │ │ │ +
202 } // end namespace Impl
│ │ │ │ +
203
│ │ │ │ +
243 template <typename BCRSMatrix, typename BlockVector>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
245 {
│ │ │ │ +
246 public:
│ │ │ │ + │ │ │ │
248
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
251 {
│ │ │ │ -
252#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
253 if (i<0 || i>=rows_) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
254#endif
│ │ │ │ -
255 return window_type(this->p + i*columns_, columns_);
│ │ │ │ -
256 }
│ │ │ │ -
│ │ │ │ -
257
│ │ │ │ -
258 // forward declaration
│ │ │ │ -
259 class ConstIterator;
│ │ │ │ -
260
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
263 {
│ │ │ │ -
264 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
267 : window_(nullptr,0)
│ │ │ │ -
268 {
│ │ │ │ -
269 i = 0;
│ │ │ │ -
270 }
│ │ │ │ -
│ │ │ │ -
271
│ │ │ │ -
272 Iterator (Iterator& other) = default;
│ │ │ │ -
273 Iterator (Iterator&& other) = default;
│ │ │ │ -
274
│ │ │ │ -
│ │ │ │ -
276 Iterator (B* data, size_type columns, size_type _i)
│ │ │ │ -
277 : i(_i),
│ │ │ │ -
278 window_(data + _i*columns, columns)
│ │ │ │ -
279 {}
│ │ │ │ -
│ │ │ │ -
280
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
283 {
│ │ │ │ -
284 i = other.i;
│ │ │ │ -
285 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ -
286 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ -
287 return *this;
│ │ │ │ -
288 }
│ │ │ │ -
│ │ │ │ -
289
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
292 {
│ │ │ │ -
293 i = other.i;
│ │ │ │ -
294 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ -
295 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ -
296 return *this;
│ │ │ │ -
297 }
│ │ │ │ -
│ │ │ │ -
298
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
301 {
│ │ │ │ -
302 ++i;
│ │ │ │ -
303 window_.setptr(window_.getptr()+window_.getsize());
│ │ │ │ -
304 return *this;
│ │ │ │ -
305 }
│ │ │ │ -
│ │ │ │ +
249 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
269 const unsigned int nIterationsMax = 100000,
│ │ │ │ +
270 const unsigned int verbosity_level = 0)
│ │ │ │ +
271 : m_(m), nIterationsMax_(nIterationsMax),
│ │ │ │ +
272 verbosity_level_(verbosity_level),
│ │ │ │ +
273 nIterations_(0),
│ │ │ │ +
274 title_(" ArPackPlusPlus_Algorithms: "),
│ │ │ │ +
275 blank_(title_.length(),' ')
│ │ │ │ +
276 {}
│ │ │ │ +
│ │ │ │ +
277
│ │ │ │ +
│ │ │ │ +
289 inline void computeSymMaxMagnitude (const Real& epsilon,
│ │ │ │ +
290 BlockVector& x, Real& lambda) const
│ │ │ │ +
291 {
│ │ │ │ +
292 // print verbosity information
│ │ │ │ +
293 if (verbosity_level_ > 0)
│ │ │ │ +
294 std::cout << title_ << "Computing an approximation of "
│ │ │ │ +
295 << "the dominant eigenvalue of a matrix which "
│ │ │ │ +
296 << "is assumed to be symmetric." << std::endl;
│ │ │ │ +
297
│ │ │ │ +
298 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ +
299 // and to perform the product A*v (LU decomposition is not used)
│ │ │ │ +
300 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ +
301 WrappedMatrix A(m_);
│ │ │ │ +
302
│ │ │ │ +
303 // get number of rows and columns in A
│ │ │ │ +
304 const int nrows = A.nrows();
│ │ │ │ +
305 const int ncols = A.ncols();
│ │ │ │
306
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
309 {
│ │ │ │ -
310 --i;
│ │ │ │ -
311 window_.setptr(window_.getptr()-window_.getsize());
│ │ │ │ -
312 return *this;
│ │ │ │ -
313 }
│ │ │ │ -
│ │ │ │ -
314
│ │ │ │ -
│ │ │ │ -
316 bool operator== (const Iterator& it) const
│ │ │ │ -
317 {
│ │ │ │ -
318 return window_.getptr() == it.window_.getptr();
│ │ │ │ -
319 }
│ │ │ │ -
│ │ │ │ +
307 // assert that A is square
│ │ │ │ +
308 if (nrows != ncols)
│ │ │ │ +
309 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ +
310 << nrows << "x" << ncols << ").");
│ │ │ │ +
311
│ │ │ │ +
312 // allocate memory for variables, set parameters
│ │ │ │ +
313 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ +
314 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ +
315 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ +
316 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ +
317 Real* ev = new Real[nev]; // Computed eigenvalues of A
│ │ │ │ +
318 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ +
319 int nconv; // Number of converged eigenvalues
│ │ │ │
320
│ │ │ │ -
│ │ │ │ -
322 bool operator!= (const Iterator& it) const
│ │ │ │ -
323 {
│ │ │ │ -
324 return window_.getptr() != it.window_.getptr();
│ │ │ │ -
325 }
│ │ │ │ -
│ │ │ │ -
326
│ │ │ │ -
│ │ │ │ -
328 bool operator== (const ConstIterator& it) const
│ │ │ │ -
329 {
│ │ │ │ -
330 return window_.getptr() == it.window_.getptr();
│ │ │ │ -
331 }
│ │ │ │ -
│ │ │ │ -
332
│ │ │ │ -
│ │ │ │ -
334 bool operator!= (const ConstIterator& it) const
│ │ │ │ -
335 {
│ │ │ │ -
336 return window_.getptr() != it.window_.getptr();
│ │ │ │ -
337 }
│ │ │ │ -
│ │ │ │ +
321 // define what we need: eigenvalues with largest magnitude
│ │ │ │ +
322 char which[] = "LM";
│ │ │ │ +
323 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ +
324 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit);
│ │ │ │ +
325
│ │ │ │ +
326 // set ARPACK verbosity mode if requested
│ │ │ │ +
327 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ +
328
│ │ │ │ +
329 // find eigenvalues and eigenvectors of A, obtain the eigenvalues
│ │ │ │ +
330 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ +
331
│ │ │ │ +
332 // obtain approximated dominant eigenvalue of A
│ │ │ │ +
333 lambda = ev[nev-1];
│ │ │ │ +
334
│ │ │ │ +
335 // obtain associated approximated eigenvector of A
│ │ │ │ +
336 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ +
337 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │
338
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
341 {
│ │ │ │ -
342 return window_;
│ │ │ │ -
343 }
│ │ │ │ -
│ │ │ │ -
344
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
347 {
│ │ │ │ -
348 return &window_;
│ │ │ │ -
349 }
│ │ │ │ -
│ │ │ │ -
350
│ │ │ │ -
351 // return index corresponding to pointer
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
353 {
│ │ │ │ -
354 return i;
│ │ │ │ -
355 }
│ │ │ │ -
│ │ │ │ -
356
│ │ │ │ -
357 friend class ConstIterator;
│ │ │ │ -
358
│ │ │ │ -
359 private:
│ │ │ │ -
360 size_type i;
│ │ │ │ -
361 mutable window_type window_;
│ │ │ │ -
362 };
│ │ │ │ -
│ │ │ │ -
363
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
366 {
│ │ │ │ -
367 return Iterator(this->p, columns_, 0);
│ │ │ │ -
368 }
│ │ │ │ +
339 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ +
340 nIterations_ = dprob.GetIter();
│ │ │ │ +
341
│ │ │ │ +
342 // compute residual norm
│ │ │ │ +
343 BlockVector r(x);
│ │ │ │ +
344 Real* Ax_raw = new Real[nrows];
│ │ │ │ +
345 A.multMv(x_raw,Ax_raw);
│ │ │ │ +
346 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r);
│ │ │ │ +
347 r.axpy(-lambda,x);
│ │ │ │ +
348 const Real r_norm = r.two_norm();
│ │ │ │ +
349
│ │ │ │ +
350 // print verbosity information
│ │ │ │ +
351 if (verbosity_level_ > 0)
│ │ │ │ +
352 {
│ │ │ │ +
353 if (verbosity_level_ > 1)
│ │ │ │ +
354 {
│ │ │ │ +
355 // print some information about the problem
│ │ │ │ +
356 std::cout << blank_ << "Obtained eigenvalues of A by solving "
│ │ │ │ +
357 << "A*x = λ*x using the ARPACK++ class ARSym"
│ │ │ │ +
358 << "StdEig:" << std::endl;
│ │ │ │ +
359 std::cout << blank_ << " converged eigenvalues of A: "
│ │ │ │ +
360 << nconv << " / " << nev << std::endl;
│ │ │ │ +
361 std::cout << blank_ << " dominant eigenvalue of A: "
│ │ │ │ +
362 << lambda << std::endl;
│ │ │ │ +
363 }
│ │ │ │ +
364 std::cout << blank_ << "Result ("
│ │ │ │ +
365 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
366 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
367 << "λ = " << lambda << std::endl;
│ │ │ │ +
368 if (verbosity_level_ > 2)
│ │ │ │ +
369 {
│ │ │ │ +
370 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ +
371 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
372 }
│ │ │ │ +
373 }
│ │ │ │ +
374
│ │ │ │ +
375 // free dynamically allocated memory
│ │ │ │ +
376 delete[] Ax_raw;
│ │ │ │ +
377 delete[] ev;
│ │ │ │ +
378 }
│ │ │ │
│ │ │ │ -
369
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
372 {
│ │ │ │ -
373 return Iterator(this->p, columns_, rows_);
│ │ │ │ -
374 }
│ │ │ │ -
│ │ │ │ -
375
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
379 {
│ │ │ │ -
380 return Iterator(this->p, columns_, rows_-1);
│ │ │ │ -
381 }
│ │ │ │ -
│ │ │ │ -
382
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
386 {
│ │ │ │ -
387 return Iterator(this->p, columns_, -1);
│ │ │ │ -
388 }
│ │ │ │ -
│ │ │ │ -
389
│ │ │ │ +
379
│ │ │ │
│ │ │ │ - │ │ │ │ -
392 {
│ │ │ │ -
393 return Iterator(this->p, columns_, std::min(i,rows_));
│ │ │ │ -
394 }
│ │ │ │ -
│ │ │ │ -
395
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
398 {
│ │ │ │ -
399 return ConstIterator(this->p, columns_, std::min(i,rows_));
│ │ │ │ -
400 }
│ │ │ │ -
│ │ │ │ -
401
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
404 {
│ │ │ │ -
405 public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
408 : window_(nullptr,0)
│ │ │ │ -
409 {
│ │ │ │ -
410 i = 0;
│ │ │ │ -
411 }
│ │ │ │ -
│ │ │ │ -
412
│ │ │ │ -
│ │ │ │ -
414 ConstIterator (const B* data, size_type columns, size_type _i)
│ │ │ │ -
415 : i(_i),
│ │ │ │ -
416 window_(const_cast<B*>(data + _i * columns), columns)
│ │ │ │ -
417 {}
│ │ │ │ -
│ │ │ │ -
418
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
421 : i(it.i), window_(it.window_.getptr(),it.window_.getsize())
│ │ │ │ -
422 {}
│ │ │ │ -
│ │ │ │ -
423
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
425 {
│ │ │ │ -
426 i = other.i;
│ │ │ │ -
427 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ -
428 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ -
429 return *this;
│ │ │ │ -
430 }
│ │ │ │ -
│ │ │ │ -
431
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
433 {
│ │ │ │ -
434 i = other.i;
│ │ │ │ -
435 // Do NOT use window_.operator=, because that copies the window content, not just the window!
│ │ │ │ -
436 window_.set(other.window_.getsize(),other.window_.getptr());
│ │ │ │ -
437 return *this;
│ │ │ │ -
438 }
│ │ │ │ -
│ │ │ │ -
439
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
442 {
│ │ │ │ -
443 ++i;
│ │ │ │ -
444 window_.setptr(window_.getptr()+window_.getsize());
│ │ │ │ -
445 return *this;
│ │ │ │ -
446 }
│ │ │ │ -
│ │ │ │ -
447
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
450 {
│ │ │ │ -
451 --i;
│ │ │ │ -
452 window_.setptr(window_.getptr()-window_.getsize());
│ │ │ │ -
453 return *this;
│ │ │ │ -
454 }
│ │ │ │ -
│ │ │ │ -
455
│ │ │ │ -
│ │ │ │ -
457 bool operator== (const ConstIterator& it) const
│ │ │ │ -
458 {
│ │ │ │ -
459 return window_.getptr() == it.window_.getptr();
│ │ │ │ -
460 }
│ │ │ │ +
391 inline void computeSymMinMagnitude (const Real& epsilon,
│ │ │ │ +
392 BlockVector& x, Real& lambda) const
│ │ │ │ +
393 {
│ │ │ │ +
394 // print verbosity information
│ │ │ │ +
395 if (verbosity_level_ > 0)
│ │ │ │ +
396 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ +
397 << "least dominant eigenvalue of a matrix which "
│ │ │ │ +
398 << "is assumed to be symmetric." << std::endl;
│ │ │ │ +
399
│ │ │ │ +
400 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ +
401 // and to perform the product A*v (LU decomposition is not used)
│ │ │ │ +
402 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ +
403 WrappedMatrix A(m_);
│ │ │ │ +
404
│ │ │ │ +
405 // get number of rows and columns in A
│ │ │ │ +
406 const int nrows = A.nrows();
│ │ │ │ +
407 const int ncols = A.ncols();
│ │ │ │ +
408
│ │ │ │ +
409 // assert that A is square
│ │ │ │ +
410 if (nrows != ncols)
│ │ │ │ +
411 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ +
412 << nrows << "x" << ncols << ").");
│ │ │ │ +
413
│ │ │ │ +
414 // allocate memory for variables, set parameters
│ │ │ │ +
415 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ +
416 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ +
417 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ +
418 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ +
419 Real* ev = new Real[nev]; // Computed eigenvalues of A
│ │ │ │ +
420 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ +
421 int nconv; // Number of converged eigenvalues
│ │ │ │ +
422
│ │ │ │ +
423 // define what we need: eigenvalues with smallest magnitude
│ │ │ │ +
424 char which[] = "SM";
│ │ │ │ +
425 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ +
426 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit);
│ │ │ │ +
427
│ │ │ │ +
428 // set ARPACK verbosity mode if requested
│ │ │ │ +
429 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ +
430
│ │ │ │ +
431 // find eigenvalues and eigenvectors of A, obtain the eigenvalues
│ │ │ │ +
432 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ +
433
│ │ │ │ +
434 // obtain approximated least dominant eigenvalue of A
│ │ │ │ +
435 lambda = ev[nev-1];
│ │ │ │ +
436
│ │ │ │ +
437 // obtain associated approximated eigenvector of A
│ │ │ │ +
438 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ +
439 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │ +
440
│ │ │ │ +
441 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ +
442 nIterations_ = dprob.GetIter();
│ │ │ │ +
443
│ │ │ │ +
444 // compute residual norm
│ │ │ │ +
445 BlockVector r(x);
│ │ │ │ +
446 Real* Ax_raw = new Real[nrows];
│ │ │ │ +
447 A.multMv(x_raw,Ax_raw);
│ │ │ │ +
448 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r);
│ │ │ │ +
449 r.axpy(-lambda,x);
│ │ │ │ +
450 const Real r_norm = r.two_norm();
│ │ │ │ +
451
│ │ │ │ +
452 // print verbosity information
│ │ │ │ +
453 if (verbosity_level_ > 0)
│ │ │ │ +
454 {
│ │ │ │ +
455 if (verbosity_level_ > 1)
│ │ │ │ +
456 {
│ │ │ │ +
457 // print some information about the problem
│ │ │ │ +
458 std::cout << blank_ << "Obtained eigenvalues of A by solving "
│ │ │ │ +
459 << "A*x = λ*x using the ARPACK++ class ARSym"
│ │ │ │ +
460 << "StdEig:" << std::endl;
│ │ │ │ +
461 std::cout << blank_ << " converged eigenvalues of A: "
│ │ │ │ +
462 << nconv << " / " << nev << std::endl;
│ │ │ │ +
463 std::cout << blank_ << " least dominant eigenvalue of A: "
│ │ │ │ +
464 << lambda << std::endl;
│ │ │ │ +
465 }
│ │ │ │ +
466 std::cout << blank_ << "Result ("
│ │ │ │ +
467 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
468 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
469 << "λ = " << lambda << std::endl;
│ │ │ │ +
470 if (verbosity_level_ > 2)
│ │ │ │ +
471 {
│ │ │ │ +
472 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ +
473 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
474 }
│ │ │ │ +
475 }
│ │ │ │ +
476
│ │ │ │ +
477 // free dynamically allocated memory
│ │ │ │ +
478 delete[] Ax_raw;
│ │ │ │ +
479 delete[] ev;
│ │ │ │ +
480 }
│ │ │ │
│ │ │ │ -
461
│ │ │ │ -
│ │ │ │ -
463 bool operator!= (const ConstIterator& it) const
│ │ │ │ -
464 {
│ │ │ │ -
465 return window_.getptr() != it.window_.getptr();
│ │ │ │ -
466 }
│ │ │ │ -
│ │ │ │ -
467
│ │ │ │ -
│ │ │ │ -
469 bool operator== (const Iterator& it) const
│ │ │ │ -
470 {
│ │ │ │ -
471 return window_.getptr() == it.window_.getptr();
│ │ │ │ -
472 }
│ │ │ │ -
│ │ │ │ -
473
│ │ │ │ -
│ │ │ │ -
475 bool operator!= (const Iterator& it) const
│ │ │ │ -
476 {
│ │ │ │ -
477 return window_.getptr() != it.window_.getptr();
│ │ │ │ -
478 }
│ │ │ │ -
│ │ │ │ -
479
│ │ │ │ -
│ │ │ │ -
481 const window_type& operator* () const
│ │ │ │ -
482 {
│ │ │ │ -
483 return window_;
│ │ │ │ -
484 }
│ │ │ │ -
│ │ │ │ -
485
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
488 {
│ │ │ │ -
489 return &window_;
│ │ │ │ -
490 }
│ │ │ │ -
│ │ │ │ -
491
│ │ │ │ -
492 // return index corresponding to pointer
│ │ │ │ +
481
│ │ │ │
│ │ │ │ - │ │ │ │ -
494 {
│ │ │ │ -
495 return i;
│ │ │ │ -
496 }
│ │ │ │ -
│ │ │ │ -
497
│ │ │ │ -
498 friend class Iterator;
│ │ │ │ -
499
│ │ │ │ -
500 private:
│ │ │ │ -
501 size_type i;
│ │ │ │ -
502 mutable window_type window_;
│ │ │ │ -
503 };
│ │ │ │ -
│ │ │ │ -
504
│ │ │ │ - │ │ │ │ -
507
│ │ │ │ - │ │ │ │ -
510
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
513 {
│ │ │ │ -
514 return ConstIterator(this->p, columns_, 0);
│ │ │ │ -
515 }
│ │ │ │ -
│ │ │ │ -
516
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
519 {
│ │ │ │ -
520 return ConstIterator(this->p, columns_, rows_);
│ │ │ │ -
521 }
│ │ │ │ -
│ │ │ │ -
522
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
526 {
│ │ │ │ -
527 return ConstIterator(this->p, columns_, rows_-1);
│ │ │ │ -
528 }
│ │ │ │ -
│ │ │ │ -
529
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
532 {
│ │ │ │ -
533 return ConstIterator(this->p, columns_, -1);
│ │ │ │ -
534 }
│ │ │ │ -
│ │ │ │ -
535
│ │ │ │ -
536 //===== sizes
│ │ │ │ -
537
│ │ │ │ -
│ │ │ │ -
539 size_type N () const
│ │ │ │ -
540 {
│ │ │ │ -
541 return rows_;
│ │ │ │ -
542 }
│ │ │ │ -
│ │ │ │ -
543
│ │ │ │ -
544
│ │ │ │ -
545 private:
│ │ │ │ -
546 size_type rows_; // number of matrix rows
│ │ │ │ -
547 size_type columns_; // number of matrix columns
│ │ │ │ +
493 inline void computeSymCond2 (const Real& epsilon, Real& cond_2) const
│ │ │ │ +
494 {
│ │ │ │ +
495 // print verbosity information
│ │ │ │ +
496 if (verbosity_level_ > 0)
│ │ │ │ +
497 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ +
498 << "spectral condition number of a matrix which "
│ │ │ │ +
499 << "is assumed to be symmetric." << std::endl;
│ │ │ │ +
500
│ │ │ │ +
501 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ +
502 // and to perform the product A*v (LU decomposition is not used)
│ │ │ │ +
503 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ +
504 WrappedMatrix A(m_);
│ │ │ │ +
505
│ │ │ │ +
506 // get number of rows and columns in A
│ │ │ │ +
507 const int nrows = A.nrows();
│ │ │ │ +
508 const int ncols = A.ncols();
│ │ │ │ +
509
│ │ │ │ +
510 // assert that A is square
│ │ │ │ +
511 if (nrows != ncols)
│ │ │ │ +
512 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ +
513 << nrows << "x" << ncols << ").");
│ │ │ │ +
514
│ │ │ │ +
515 // allocate memory for variables, set parameters
│ │ │ │ +
516 const int nev = 2; // Number of eigenvalues to compute
│ │ │ │ +
517 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ +
518 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ +
519 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ +
520 Real* ev = new Real[nev]; // Computed eigenvalues of A
│ │ │ │ +
521 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ +
522 int nconv; // Number of converged eigenvalues
│ │ │ │ +
523
│ │ │ │ +
524 // define what we need: eigenvalues from both ends of the spectrum
│ │ │ │ +
525 char which[] = "BE";
│ │ │ │ +
526 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ +
527 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit);
│ │ │ │ +
528
│ │ │ │ +
529 // set ARPACK verbosity mode if requested
│ │ │ │ +
530 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ +
531
│ │ │ │ +
532 // find eigenvalues and eigenvectors of A, obtain the eigenvalues
│ │ │ │ +
533 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ +
534
│ │ │ │ +
535 // obtain approximated dominant and least dominant eigenvalue of A
│ │ │ │ +
536 const Real& lambda_max = ev[nev-1];
│ │ │ │ +
537 const Real& lambda_min = ev[0];
│ │ │ │ +
538
│ │ │ │ +
539 // obtain associated approximated eigenvectors of A
│ │ │ │ +
540 Real* x_max_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ +
541 Real* x_min_raw = dprob.RawEigenvector(0);
│ │ │ │ +
542
│ │ │ │ +
543 // obtain approximated spectral condition number of A
│ │ │ │ +
544 cond_2 = std::abs(lambda_max / lambda_min);
│ │ │ │ +
545
│ │ │ │ +
546 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ +
547 nIterations_ = dprob.GetIter();
│ │ │ │
548
│ │ │ │ -
549 A allocator_;
│ │ │ │ -
550 };
│ │ │ │ -
│ │ │ │ -
551
│ │ │ │ -
552} // namespace MatrixImp
│ │ │ │ -
│ │ │ │ -
553
│ │ │ │ -
559 template<class T, class A=std::allocator<T> >
│ │ │ │ -
│ │ │ │ -
560 class Matrix
│ │ │ │ -
561 {
│ │ │ │ -
562 public:
│ │ │ │ +
549 // compute each residual norm
│ │ │ │ +
550 Real* Ax_max_raw = new Real[nrows];
│ │ │ │ +
551 Real* Ax_min_raw = new Real[nrows];
│ │ │ │ +
552 A.multMv(x_max_raw,Ax_max_raw);
│ │ │ │ +
553 A.multMv(x_min_raw,Ax_min_raw);
│ │ │ │ +
554 Real r_max_norm = 0.0;
│ │ │ │ +
555 Real r_min_norm = 0.0;
│ │ │ │ +
556 for (int i = 0; i < nrows; ++i)
│ │ │ │ +
557 {
│ │ │ │ +
558 r_max_norm += std::pow(Ax_max_raw[i] - lambda_max * x_max_raw[i],2);
│ │ │ │ +
559 r_min_norm += std::pow(Ax_min_raw[i] - lambda_min * x_min_raw[i],2);
│ │ │ │ +
560 }
│ │ │ │ +
561 r_max_norm = std::sqrt(r_max_norm);
│ │ │ │ +
562 r_min_norm = std::sqrt(r_min_norm);
│ │ │ │
563
│ │ │ │ -
565 using field_type = typename Imp::BlockTraits<T>::field_type;
│ │ │ │ -
566
│ │ │ │ -
568 typedef T block_type;
│ │ │ │ -
569
│ │ │ │ -
571 typedef A allocator_type;
│ │ │ │ -
572
│ │ │ │ - │ │ │ │ -
575
│ │ │ │ -
577 typedef typename A::size_type size_type;
│ │ │ │ -
578
│ │ │ │ - │ │ │ │ -
581
│ │ │ │ -
583 typedef typename row_type::iterator ColIterator;
│ │ │ │ -
584
│ │ │ │ - │ │ │ │ -
587
│ │ │ │ -
589 typedef typename row_type::const_iterator ConstColIterator;
│ │ │ │ -
590
│ │ │ │ -
592 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ -
593 static constexpr auto blocklevel = blockLevel<T>()+1;
│ │ │ │ -
594
│ │ │ │ -
│ │ │ │ -
596 Matrix() : data_(0,0), cols_(0)
│ │ │ │ -
597 {}
│ │ │ │ -
│ │ │ │ -
598
│ │ │ │ -
│ │ │ │ -
601 Matrix(size_type rows, size_type cols) : data_(rows,cols), cols_(cols)
│ │ │ │ -
602 {}
│ │ │ │ -
│ │ │ │ -
603
│ │ │ │ -
│ │ │ │ -
608 void setSize(size_type rows, size_type cols) {
│ │ │ │ -
609 data_.resize(rows,cols);
│ │ │ │ -
610 cols_ = cols;
│ │ │ │ -
611 }
│ │ │ │ -
│ │ │ │ -
612
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
615 {
│ │ │ │ -
616 return data_.begin();
│ │ │ │ -
617 }
│ │ │ │ -
│ │ │ │ -
618
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
621 {
│ │ │ │ -
622 return data_.end();
│ │ │ │ -
623 }
│ │ │ │ -
│ │ │ │ -
624
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
628 {
│ │ │ │ -
629 return data_.beforeEnd();
│ │ │ │ -
630 }
│ │ │ │ -
│ │ │ │ -
631
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
635 {
│ │ │ │ -
636 return data_.beforeBegin();
│ │ │ │ -
637 }
│ │ │ │ -
│ │ │ │ -
638
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
641 {
│ │ │ │ -
642 return data_.begin();
│ │ │ │ -
643 }
│ │ │ │ -
│ │ │ │ -
644
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
647 {
│ │ │ │ -
648 return data_.end();
│ │ │ │ -
649 }
│ │ │ │ -
│ │ │ │ -
650
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
654 {
│ │ │ │ -
655 return data_.beforeEnd();
│ │ │ │ -
656 }
│ │ │ │ +
564 // print verbosity information
│ │ │ │ +
565 if (verbosity_level_ > 0)
│ │ │ │ +
566 {
│ │ │ │ +
567 if (verbosity_level_ > 1)
│ │ │ │ +
568 {
│ │ │ │ +
569 // print some information about the problem
│ │ │ │ +
570 std::cout << blank_ << "Obtained eigenvalues of A by solving "
│ │ │ │ +
571 << "A*x = λ*x using the ARPACK++ class ARSym"
│ │ │ │ +
572 << "StdEig:" << std::endl;
│ │ │ │ +
573 std::cout << blank_ << " converged eigenvalues of A: "
│ │ │ │ +
574 << nconv << " / " << nev << std::endl;
│ │ │ │ +
575 std::cout << blank_ << " dominant eigenvalue of A: "
│ │ │ │ +
576 << lambda_max << std::endl;
│ │ │ │ +
577 std::cout << blank_ << " least dominant eigenvalue of A: "
│ │ │ │ +
578 << lambda_min << std::endl;
│ │ │ │ +
579 std::cout << blank_ << " spectral condition number of A: "
│ │ │ │ +
580 << cond_2 << std::endl;
│ │ │ │ +
581 }
│ │ │ │ +
582 std::cout << blank_ << "Result ("
│ │ │ │ +
583 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
584 << "║residual║_2 = {" << r_max_norm << ","
│ │ │ │ +
585 << r_min_norm << "}, " << "λ = {"
│ │ │ │ +
586 << lambda_max << "," << lambda_min
│ │ │ │ +
587 << "}): cond_2 = " << cond_2 << std::endl;
│ │ │ │ +
588 }
│ │ │ │ +
589
│ │ │ │ +
590 // free dynamically allocated memory
│ │ │ │ +
591 delete[] Ax_min_raw;
│ │ │ │ +
592 delete[] Ax_max_raw;
│ │ │ │ +
593 delete[] ev;
│ │ │ │ +
594 }
│ │ │ │ +
│ │ │ │ +
595
│ │ │ │ +
│ │ │ │ +
609 inline void computeNonSymMax (const Real& epsilon,
│ │ │ │ +
610 BlockVector& x, Real& sigma) const
│ │ │ │ +
611 {
│ │ │ │ +
612 // print verbosity information
│ │ │ │ +
613 if (verbosity_level_ > 0)
│ │ │ │ +
614 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ +
615 << "largest singular value of a matrix which "
│ │ │ │ +
616 << "is assumed to be nonsymmetric." << std::endl;
│ │ │ │ +
617
│ │ │ │ +
618 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ +
619 // and to perform the product A^T*A*v (LU decomposition is not used)
│ │ │ │ +
620 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ +
621 WrappedMatrix A(m_);
│ │ │ │ +
622
│ │ │ │ +
623 // get number of rows and columns in A
│ │ │ │ +
624 const int nrows = A.nrows();
│ │ │ │ +
625 const int ncols = A.ncols();
│ │ │ │ +
626
│ │ │ │ +
627 // assert that A has more rows than columns (extend code later to the opposite case!)
│ │ │ │ +
628 if (nrows < ncols)
│ │ │ │ +
629 DUNE_THROW(Dune::ISTLError,"Matrix has less rows than "
│ │ │ │ +
630 << "columns (" << nrows << "x" << ncols << ")."
│ │ │ │ +
631 << " This case is not implemented, yet.");
│ │ │ │ +
632
│ │ │ │ +
633 // allocate memory for variables, set parameters
│ │ │ │ +
634 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ +
635 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ +
636 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ +
637 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ +
638 Real* ev = new Real[nev]; // Computed eigenvalues of A^T*A
│ │ │ │ +
639 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ +
640 int nconv; // Number of converged eigenvalues
│ │ │ │ +
641
│ │ │ │ +
642 // define what we need: eigenvalues with largest algebraic value
│ │ │ │ +
643 char which[] = "LA";
│ │ │ │ +
644 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ +
645 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit);
│ │ │ │ +
646
│ │ │ │ +
647 // set ARPACK verbosity mode if requested
│ │ │ │ +
648 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ +
649
│ │ │ │ +
650 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues
│ │ │ │ +
651 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ +
652
│ │ │ │ +
653 // obtain approximated largest eigenvalue of A^T*A
│ │ │ │ +
654 const Real& lambda = ev[nev-1];
│ │ │ │ +
655
│ │ │ │ +
656 // obtain associated approximated eigenvector of A^T*A
│ │ │ │ +
657 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ +
658 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │ +
659
│ │ │ │ +
660 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ +
661 nIterations_ = dprob.GetIter();
│ │ │ │ +
662
│ │ │ │ +
663 // compute residual norm
│ │ │ │ +
664 BlockVector r(x);
│ │ │ │ +
665 Real* AtAx_raw = new Real[ncols];
│ │ │ │ +
666 A.multMtMv(x_raw,AtAx_raw);
│ │ │ │ +
667 WrappedMatrix::arrayToDomainBlockVector(AtAx_raw,r);
│ │ │ │ +
668 r.axpy(-lambda,x);
│ │ │ │ +
669 const Real r_norm = r.two_norm();
│ │ │ │ +
670
│ │ │ │ +
671 // calculate largest singular value of A (note that
│ │ │ │ +
672 // x is right-singular / left-singular vector of A)
│ │ │ │ +
673 sigma = std::sqrt(lambda);
│ │ │ │ +
674
│ │ │ │ +
675 // print verbosity information
│ │ │ │ +
676 if (verbosity_level_ > 0)
│ │ │ │ +
677 {
│ │ │ │ +
678 if (verbosity_level_ > 1)
│ │ │ │ +
679 {
│ │ │ │ +
680 // print some information about the problem
│ │ │ │ +
681 std::cout << blank_ << "Obtained singular values of A by sol"
│ │ │ │ +
682 << "ving (A^T*A)*x = σ²*x using the ARPACK++ "
│ │ │ │ +
683 << "class ARSymStdEig:" << std::endl;
│ │ │ │ +
684 std::cout << blank_ << " converged eigenvalues of A^T*A: "
│ │ │ │ +
685 << nconv << " / " << nev << std::endl;
│ │ │ │ +
686 std::cout << blank_ << " largest eigenvalue of A^T*A: "
│ │ │ │ +
687 << lambda << std::endl;
│ │ │ │ +
688 std::cout << blank_ << " => largest singular value of A: "
│ │ │ │ +
689 << sigma << std::endl;
│ │ │ │ +
690 }
│ │ │ │ +
691 std::cout << blank_ << "Result ("
│ │ │ │ +
692 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
693 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
694 << "σ = " << sigma << std::endl;
│ │ │ │ +
695 if (verbosity_level_ > 2)
│ │ │ │ +
696 {
│ │ │ │ +
697 // print approximated right-singular / left-singular vector
│ │ │ │ +
698 // via DUNE-ISTL I/O methods
│ │ │ │ +
699 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
700 }
│ │ │ │ +
701 }
│ │ │ │ +
702
│ │ │ │ +
703 // free dynamically allocated memory
│ │ │ │ +
704 delete[] AtAx_raw;
│ │ │ │ +
705 delete[] ev;
│ │ │ │ +
706 }
│ │ │ │
│ │ │ │ -
657
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
661 {
│ │ │ │ -
662 return data_.beforeBegin();
│ │ │ │ -
663 }
│ │ │ │ -
│ │ │ │ -
664
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
667 {
│ │ │ │ -
668 data_ = t;
│ │ │ │ -
669 return *this;
│ │ │ │ -
670 }
│ │ │ │ -
│ │ │ │ -
671
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
674#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
675 if (row<0)
│ │ │ │ -
676 DUNE_THROW(ISTLError, "Can't access negative rows!");
│ │ │ │ -
677 if (row>=N())
│ │ │ │ -
678 DUNE_THROW(ISTLError, "Row index out of range!");
│ │ │ │ -
679#endif
│ │ │ │ -
680 return data_[row];
│ │ │ │ -
681 }
│ │ │ │ -
│ │ │ │ -
682
│ │ │ │ -
│ │ │ │ -
684 const row_type operator[](size_type row) const {
│ │ │ │ -
685#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
686 if (row<0)
│ │ │ │ -
687 DUNE_THROW(ISTLError, "Can't access negative rows!");
│ │ │ │ -
688 if (row>=N())
│ │ │ │ -
689 DUNE_THROW(ISTLError, "Row index out of range!");
│ │ │ │ -
690#endif
│ │ │ │ -
691 return data_[row];
│ │ │ │ -
692 }
│ │ │ │ -
│ │ │ │ -
693
│ │ │ │ -
│ │ │ │ -
695 size_type N() const {
│ │ │ │ -
696 return data_.N();
│ │ │ │ -
697 }
│ │ │ │ -
│ │ │ │ -
698
│ │ │ │ -
│ │ │ │ -
700 size_type M() const {
│ │ │ │ -
701 return cols_;
│ │ │ │ -
702 }
│ │ │ │ -
│ │ │ │ -
703
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
706 data_ *= scalar;
│ │ │ │ -
707 return (*this);
│ │ │ │ -
708 }
│ │ │ │ -
│ │ │ │ -
709
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
712 data_ /= scalar;
│ │ │ │ -
713 return (*this);
│ │ │ │ -
714 }
│ │ │ │ -
│ │ │ │ -
715
│ │ │ │ +
707
│ │ │ │
│ │ │ │ - │ │ │ │ -
722#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
723 if(N()!=b.N() || M() != b.M())
│ │ │ │ -
724 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ -
725#endif
│ │ │ │ -
726 data_ += b.data_;
│ │ │ │ -
727 return (*this);
│ │ │ │ -
728 }
│ │ │ │ -
│ │ │ │ +
721 inline void computeNonSymMin (const Real& epsilon,
│ │ │ │ +
722 BlockVector& x, Real& sigma) const
│ │ │ │ +
723 {
│ │ │ │ +
724 // print verbosity information
│ │ │ │ +
725 if (verbosity_level_ > 0)
│ │ │ │ +
726 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ +
727 << "smallest singular value of a matrix which "
│ │ │ │ +
728 << "is assumed to be nonsymmetric." << std::endl;
│ │ │ │
729
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
736#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
737 if(N()!=b.N() || M() != b.M())
│ │ │ │ -
738 DUNE_THROW(RangeError, "Matrix sizes do not match!");
│ │ │ │ -
739#endif
│ │ │ │ -
740 data_ -= b.data_;
│ │ │ │ -
741 return (*this);
│ │ │ │ -
742 }
│ │ │ │ -
│ │ │ │ -
743
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
746 Matrix out(M(), N());
│ │ │ │ -
747 for (size_type i=0; i<N(); i++)
│ │ │ │ -
748 for (size_type j=0; j<M(); j++)
│ │ │ │ -
749 out[j][i] = (*this)[i][j];
│ │ │ │ -
750
│ │ │ │ -
751 return out;
│ │ │ │ -
752 }
│ │ │ │ -
│ │ │ │ +
730 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ +
731 // and to perform the product A^T*A*v (LU decomposition is not used)
│ │ │ │ +
732 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ +
733 WrappedMatrix A(m_);
│ │ │ │ +
734
│ │ │ │ +
735 // get number of rows and columns in A
│ │ │ │ +
736 const int nrows = A.nrows();
│ │ │ │ +
737 const int ncols = A.ncols();
│ │ │ │ +
738
│ │ │ │ +
739 // assert that A has more rows than columns (extend code later to the opposite case!)
│ │ │ │ +
740 if (nrows < ncols)
│ │ │ │ +
741 DUNE_THROW(Dune::ISTLError,"Matrix has less rows than "
│ │ │ │ +
742 << "columns (" << nrows << "x" << ncols << ")."
│ │ │ │ +
743 << " This case is not implemented, yet.");
│ │ │ │ +
744
│ │ │ │ +
745 // allocate memory for variables, set parameters
│ │ │ │ +
746 const int nev = 1; // Number of eigenvalues to compute
│ │ │ │ +
747 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ +
748 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ +
749 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ +
750 Real* ev = new Real[nev]; // Computed eigenvalues of A^T*A
│ │ │ │ +
751 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ +
752 int nconv; // Number of converged eigenvalues
│ │ │ │
753
│ │ │ │ -
│ │ │ │ -
755 friend Matrix<T> operator*(const Matrix<T>& m1, const Matrix<T>& m2) {
│ │ │ │ -
756 Matrix<T> out(m1.N(), m2.M());
│ │ │ │ -
757 out = 0;
│ │ │ │ +
754 // define what we need: eigenvalues with smallest algebraic value
│ │ │ │ +
755 char which[] = "SA";
│ │ │ │ +
756 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ +
757 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit);
│ │ │ │
758
│ │ │ │ -
759 for (size_type i=0; i<out.N(); i++ ) {
│ │ │ │ -
760 for ( size_type j=0; j<out.M(); j++ )
│ │ │ │ -
761 for (size_type k=0; k<m1.M(); k++)
│ │ │ │ -
762 out[i][j] += m1[i][k]*m2[k][j];
│ │ │ │ -
763 }
│ │ │ │ +
759 // set ARPACK verbosity mode if requested
│ │ │ │ +
760 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ +
761
│ │ │ │ +
762 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues
│ │ │ │ +
763 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │
764
│ │ │ │ -
765 return out;
│ │ │ │ -
766 }
│ │ │ │ -
│ │ │ │ +
765 // obtain approximated smallest eigenvalue of A^T*A
│ │ │ │ +
766 const Real& lambda = ev[nev-1];
│ │ │ │
767
│ │ │ │ -
769 template <class X, class Y>
│ │ │ │ -
│ │ │ │ -
770 friend Y operator*(const Matrix<T>& m, const X& vec) {
│ │ │ │ -
771#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
772 if (m.M()!=vec.size())
│ │ │ │ -
773 DUNE_THROW(ISTLError, "Vector size doesn't match the number of matrix columns!");
│ │ │ │ -
774#endif
│ │ │ │ -
775 Y out(m.N());
│ │ │ │ -
776 out = 0;
│ │ │ │ -
777
│ │ │ │ -
778 for (size_type i=0; i<out.size(); i++ ) {
│ │ │ │ -
779 for ( size_type j=0; j<vec.size(); j++ )
│ │ │ │ -
780 out[i] += m[i][j]*vec[j];
│ │ │ │ -
781 }
│ │ │ │ +
768 // obtain associated approximated eigenvector of A^T*A
│ │ │ │ +
769 Real* x_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ +
770 WrappedMatrix::arrayToDomainBlockVector(x_raw,x);
│ │ │ │ +
771
│ │ │ │ +
772 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ +
773 nIterations_ = dprob.GetIter();
│ │ │ │ +
774
│ │ │ │ +
775 // compute residual norm
│ │ │ │ +
776 BlockVector r(x);
│ │ │ │ +
777 Real* AtAx_raw = new Real[ncols];
│ │ │ │ +
778 A.multMtMv(x_raw,AtAx_raw);
│ │ │ │ +
779 WrappedMatrix::arrayToDomainBlockVector(AtAx_raw,r);
│ │ │ │ +
780 r.axpy(-lambda,x);
│ │ │ │ +
781 const Real r_norm = r.two_norm();
│ │ │ │
782
│ │ │ │ -
783 return out;
│ │ │ │ -
784 }
│ │ │ │ -
│ │ │ │ -
785
│ │ │ │ -
787 template <class X, class Y>
│ │ │ │ -
│ │ │ │ -
788 void mv(const X& x, Y& y) const
│ │ │ │ -
789 {
│ │ │ │ -
790#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
791 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
792 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
793#endif
│ │ │ │ -
794 for (size_type i=0; i<data_.N(); i++) {
│ │ │ │ -
795 y[i]=0;
│ │ │ │ -
796 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
797 {
│ │ │ │ -
798 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ -
799 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ -
800 Impl::asMatrix((*this)[i][j]).umv(xj, yi);
│ │ │ │ -
801 }
│ │ │ │ -
802 }
│ │ │ │ -
803 }
│ │ │ │ -
│ │ │ │ -
804
│ │ │ │ -
806 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
807 void mtv (const X& x, Y& y) const
│ │ │ │ -
808 {
│ │ │ │ -
809#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
810 if (x.N()!=N()) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
811 if (y.N()!=M()) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
812#endif
│ │ │ │ -
813 for(size_type i=0; i<y.N(); ++i)
│ │ │ │ -
814 y[i]=0;
│ │ │ │ -
815 umtv(x,y);
│ │ │ │ -
816 }
│ │ │ │ -
│ │ │ │ -
817
│ │ │ │ -
819 template <class X, class Y>
│ │ │ │ -
│ │ │ │ -
820 void umv(const X& x, Y& y) const
│ │ │ │ -
821 {
│ │ │ │ -
822#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
823 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
824 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
825#endif
│ │ │ │ -
826 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
827 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
828 {
│ │ │ │ -
829 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ -
830 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ -
831 Impl::asMatrix((*this)[i][j]).umv(xj, yi);
│ │ │ │ -
832 }
│ │ │ │ -
833 }
│ │ │ │ -
│ │ │ │ -
834
│ │ │ │ -
836 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
837 void mmv (const X& x, Y& y) const
│ │ │ │ -
838 {
│ │ │ │ -
839#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
840 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
841 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
842#endif
│ │ │ │ -
843 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
844 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
845 {
│ │ │ │ -
846 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ -
847 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ -
848 Impl::asMatrix((*this)[i][j]).mmv(xj, yi);
│ │ │ │ -
849 }
│ │ │ │ -
850 }
│ │ │ │ -
│ │ │ │ -
851
│ │ │ │ -
853 template <class X, class Y>
│ │ │ │ -
│ │ │ │ -
854 void usmv(const field_type& alpha, const X& x, Y& y) const
│ │ │ │ -
855 {
│ │ │ │ -
856#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
857 if (x.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
858 if (y.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
859#endif
│ │ │ │ -
860 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
861 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
862 {
│ │ │ │ -
863 auto&& xj = Impl::asVector(x[j]);
│ │ │ │ -
864 auto&& yi = Impl::asVector(y[i]);
│ │ │ │ -
865 Impl::asMatrix((*this)[i][j]).usmv(alpha, xj, yi);
│ │ │ │ -
866 }
│ │ │ │ -
867 }
│ │ │ │ -
│ │ │ │ -
868
│ │ │ │ -
870 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
871 void umtv (const X& x, Y& y) const
│ │ │ │ -
872 {
│ │ │ │ -
873#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
874 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
875 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
876#endif
│ │ │ │ -
877 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
878 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
879 {
│ │ │ │ -
880 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ -
881 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ -
882 Impl::asMatrix((*this)[i][j]).umtv(xi, yj);
│ │ │ │ -
883 }
│ │ │ │ -
884 }
│ │ │ │ -
│ │ │ │ -
885
│ │ │ │ -
887 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
888 void mmtv (const X& x, Y& y) const
│ │ │ │ -
889 {
│ │ │ │ -
890#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
891 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
892 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
893#endif
│ │ │ │ -
894 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
895 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
896 {
│ │ │ │ -
897 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ -
898 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ -
899 Impl::asMatrix((*this)[i][j]).mmtv(xi, yj);
│ │ │ │ -
900 }
│ │ │ │ -
901 }
│ │ │ │ -
│ │ │ │ +
783 // calculate smallest singular value of A (note that
│ │ │ │ +
784 // x is right-singular / left-singular vector of A)
│ │ │ │ +
785 sigma = std::sqrt(lambda);
│ │ │ │ +
786
│ │ │ │ +
787 // print verbosity information
│ │ │ │ +
788 if (verbosity_level_ > 0)
│ │ │ │ +
789 {
│ │ │ │ +
790 if (verbosity_level_ > 1)
│ │ │ │ +
791 {
│ │ │ │ +
792 // print some information about the problem
│ │ │ │ +
793 std::cout << blank_ << "Obtained singular values of A by sol"
│ │ │ │ +
794 << "ving (A^T*A)*x = σ²*x using the ARPACK++ "
│ │ │ │ +
795 << "class ARSymStdEig:" << std::endl;
│ │ │ │ +
796 std::cout << blank_ << " converged eigenvalues of A^T*A: "
│ │ │ │ +
797 << nconv << " / " << nev << std::endl;
│ │ │ │ +
798 std::cout << blank_ << " smallest eigenvalue of A^T*A: "
│ │ │ │ +
799 << lambda << std::endl;
│ │ │ │ +
800 std::cout << blank_ << " => smallest singular value of A: "
│ │ │ │ +
801 << sigma << std::endl;
│ │ │ │ +
802 }
│ │ │ │ +
803 std::cout << blank_ << "Result ("
│ │ │ │ +
804 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
805 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
806 << "σ = " << sigma << std::endl;
│ │ │ │ +
807 if (verbosity_level_ > 2)
│ │ │ │ +
808 {
│ │ │ │ +
809 // print approximated right-singular / left-singular vector
│ │ │ │ +
810 // via DUNE-ISTL I/O methods
│ │ │ │ +
811 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
812 }
│ │ │ │ +
813 }
│ │ │ │ +
814
│ │ │ │ +
815 // free dynamically allocated memory
│ │ │ │ +
816 delete[] AtAx_raw;
│ │ │ │ +
817 delete[] ev;
│ │ │ │ +
818 }
│ │ │ │ +
│ │ │ │ +
819
│ │ │ │ +
│ │ │ │ +
830 inline void computeNonSymCond2 (const Real& epsilon, Real& cond_2) const
│ │ │ │ +
831 {
│ │ │ │ +
832 // print verbosity information
│ │ │ │ +
833 if (verbosity_level_ > 0)
│ │ │ │ +
834 std::cout << title_ << "Computing an approximation of the "
│ │ │ │ +
835 << "spectral condition number of a matrix which "
│ │ │ │ +
836 << "is assumed to be nonsymmetric." << std::endl;
│ │ │ │ +
837
│ │ │ │ +
838 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information
│ │ │ │ +
839 // and to perform the product A^T*A*v (LU decomposition is not used)
│ │ │ │ +
840 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper<BCRSMatrix> WrappedMatrix;
│ │ │ │ +
841 WrappedMatrix A(m_);
│ │ │ │ +
842
│ │ │ │ +
843 // get number of rows and columns in A
│ │ │ │ +
844 const int nrows = A.nrows();
│ │ │ │ +
845 const int ncols = A.ncols();
│ │ │ │ +
846
│ │ │ │ +
847 // assert that A has more rows than columns (extend code later to the opposite case!)
│ │ │ │ +
848 if (nrows < ncols)
│ │ │ │ +
849 DUNE_THROW(Dune::ISTLError,"Matrix has less rows than "
│ │ │ │ +
850 << "columns (" << nrows << "x" << ncols << ")."
│ │ │ │ +
851 << " This case is not implemented, yet.");
│ │ │ │ +
852
│ │ │ │ +
853 // allocate memory for variables, set parameters
│ │ │ │ +
854 const int nev = 2; // Number of eigenvalues to compute
│ │ │ │ +
855 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at each iteration (0 == auto)
│ │ │ │ +
856 const Real tol = epsilon; // Stopping tolerance (relative accuracy of Ritz values) (0 == machine precision)
│ │ │ │ +
857 const int maxit = nIterationsMax_*nev; // Maximum number of Arnoldi update iterations allowed (0 == 100*nev)
│ │ │ │ +
858 Real* ev = new Real[nev]; // Computed eigenvalues of A^T*A
│ │ │ │ +
859 const bool ivec = true; // Flag deciding if eigenvectors shall be determined
│ │ │ │ +
860 int nconv; // Number of converged eigenvalues
│ │ │ │ +
861
│ │ │ │ +
862 // define what we need: eigenvalues from both ends of the spectrum
│ │ │ │ +
863 char which[] = "BE";
│ │ │ │ +
864 ARSymStdEig<Real,WrappedMatrix>
│ │ │ │ +
865 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit);
│ │ │ │ +
866
│ │ │ │ +
867 // set ARPACK verbosity mode if requested
│ │ │ │ +
868 if (verbosity_level_ > 3) dprob.Trace();
│ │ │ │ +
869
│ │ │ │ +
870 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues
│ │ │ │ +
871 nconv = dprob.Eigenvalues(ev,ivec);
│ │ │ │ +
872
│ │ │ │ +
873 // obtain approximated largest and smallest eigenvalue of A^T*A
│ │ │ │ +
874 const Real& lambda_max = ev[nev-1];
│ │ │ │ +
875 const Real& lambda_min = ev[0];
│ │ │ │ +
876
│ │ │ │ +
877 // obtain associated approximated eigenvectors of A^T*A
│ │ │ │ +
878 Real* x_max_raw = dprob.RawEigenvector(nev-1);
│ │ │ │ +
879 Real* x_min_raw = dprob.RawEigenvector(0);
│ │ │ │ +
880
│ │ │ │ +
881 // obtain number of Arnoldi update iterations actually taken
│ │ │ │ +
882 nIterations_ = dprob.GetIter();
│ │ │ │ +
883
│ │ │ │ +
884 // compute each residual norm
│ │ │ │ +
885 Real* AtAx_max_raw = new Real[ncols];
│ │ │ │ +
886 Real* AtAx_min_raw = new Real[ncols];
│ │ │ │ +
887 A.multMtMv(x_max_raw,AtAx_max_raw);
│ │ │ │ +
888 A.multMtMv(x_min_raw,AtAx_min_raw);
│ │ │ │ +
889 Real r_max_norm = 0.0;
│ │ │ │ +
890 Real r_min_norm = 0.0;
│ │ │ │ +
891 for (int i = 0; i < ncols; ++i)
│ │ │ │ +
892 {
│ │ │ │ +
893 r_max_norm += std::pow(AtAx_max_raw[i] - lambda_max * x_max_raw[i],2);
│ │ │ │ +
894 r_min_norm += std::pow(AtAx_min_raw[i] - lambda_min * x_min_raw[i],2);
│ │ │ │ +
895 }
│ │ │ │ +
896 r_max_norm = std::sqrt(r_max_norm);
│ │ │ │ +
897 r_min_norm = std::sqrt(r_min_norm);
│ │ │ │ +
898
│ │ │ │ +
899 // calculate largest and smallest singular value of A
│ │ │ │ +
900 const Real sigma_max = std::sqrt(lambda_max);
│ │ │ │ +
901 const Real sigma_min = std::sqrt(lambda_min);
│ │ │ │
902
│ │ │ │ -
904 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
905 void usmtv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ -
906 {
│ │ │ │ -
907#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
908 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
909 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
910#endif
│ │ │ │ -
911 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
912 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
913 {
│ │ │ │ -
914 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ -
915 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ -
916 Impl::asMatrix((*this)[i][j]).usmtv(alpha, xi, yj);
│ │ │ │ -
917 }
│ │ │ │ -
918 }
│ │ │ │ -
│ │ │ │ -
919
│ │ │ │ -
921 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
922 void umhv (const X& x, Y& y) const
│ │ │ │ -
923 {
│ │ │ │ -
924#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
925 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
926 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
927#endif
│ │ │ │ -
928 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
929 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
930 {
│ │ │ │ -
931 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ -
932 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ -
933 Impl::asMatrix((*this)[i][j]).umhv(xi,yj);
│ │ │ │ -
934 }
│ │ │ │ -
935 }
│ │ │ │ -
│ │ │ │ -
936
│ │ │ │ -
938 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
939 void mmhv (const X& x, Y& y) const
│ │ │ │ -
940 {
│ │ │ │ -
941#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
942 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
943 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
944#endif
│ │ │ │ -
945 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
946 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
947 {
│ │ │ │ -
948 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ -
949 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ -
950 Impl::asMatrix((*this)[i][j]).mmhv(xi,yj);
│ │ │ │ -
951 }
│ │ │ │ -
952 }
│ │ │ │ -
│ │ │ │ -
953
│ │ │ │ -
955 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
956 void usmhv (const field_type& alpha, const X& x, Y& y) const
│ │ │ │ -
957 {
│ │ │ │ -
958#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
959 if (x.N()!=N()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
960 if (y.N()!=M()) DUNE_THROW(ISTLError,"vector/matrix size mismatch!");
│ │ │ │ -
961#endif
│ │ │ │ -
962 for (size_type i=0; i<data_.N(); i++)
│ │ │ │ -
963 for (size_type j=0; j<cols_; j++)
│ │ │ │ -
964 {
│ │ │ │ -
965 auto&& xi = Impl::asVector(x[i]);
│ │ │ │ -
966 auto&& yj = Impl::asVector(y[j]);
│ │ │ │ -
967 Impl::asMatrix((*this)[i][j]).usmhv(alpha,xi,yj);
│ │ │ │ -
968 }
│ │ │ │ -
969 }
│ │ │ │ -
│ │ │ │ -
970
│ │ │ │ -
971 //===== norms
│ │ │ │ -
972
│ │ │ │ -
│ │ │ │ -
974 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ -
975 {
│ │ │ │ -
976 return std::sqrt(frobenius_norm2());
│ │ │ │ -
977 }
│ │ │ │ -
│ │ │ │ -
978
│ │ │ │ -
│ │ │ │ -
980 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ │ -
981 {
│ │ │ │ -
982 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ -
983 for (size_type i=0; i<this->N(); i++)
│ │ │ │ -
984 for (size_type j=0; j<this->M(); j++)
│ │ │ │ -
985 sum += Impl::asMatrix(data_[i][j]).frobenius_norm2();
│ │ │ │ -
986 return sum;
│ │ │ │ -
987 }
│ │ │ │ -
│ │ │ │ -
988
│ │ │ │ -
990 template <typename ft = field_type,
│ │ │ │ -
991 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
992 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
993 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
994 using std::max;
│ │ │ │ -
995
│ │ │ │ -
996 real_type norm = 0;
│ │ │ │ -
997 for (auto const &x : *this) {
│ │ │ │ -
998 real_type sum = 0;
│ │ │ │ -
999 for (auto const &y : x)
│ │ │ │ -
1000 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ -
1001 norm = max(sum, norm);
│ │ │ │ -
1002 isNaN += sum;
│ │ │ │ -
1003 }
│ │ │ │ -
1004
│ │ │ │ -
1005 return norm;
│ │ │ │ -
1006 }
│ │ │ │ -
│ │ │ │ -
1007
│ │ │ │ -
1009 template <typename ft = field_type,
│ │ │ │ -
1010 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
1011 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
1012 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
1013 using std::max;
│ │ │ │ -
1014
│ │ │ │ -
1015 real_type norm = 0;
│ │ │ │ -
1016 for (auto const &x : *this) {
│ │ │ │ -
1017 real_type sum = 0;
│ │ │ │ -
1018 for (auto const &y : x)
│ │ │ │ -
1019 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ -
1020 norm = max(sum, norm);
│ │ │ │ -
1021 }
│ │ │ │ -
1022 return norm;
│ │ │ │ -
1023 }
│ │ │ │ -
│ │ │ │ -
1024
│ │ │ │ -
1026 template <typename ft = field_type,
│ │ │ │ -
1027 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
1028 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ -
1029 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
1030 using std::max;
│ │ │ │ -
1031
│ │ │ │ -
1032 real_type norm = 0;
│ │ │ │ -
1033 real_type isNaN = 1;
│ │ │ │ -
1034 for (auto const &x : *this) {
│ │ │ │ -
1035 real_type sum = 0;
│ │ │ │ -
1036 for (auto const &y : x)
│ │ │ │ -
1037 sum += Impl::asMatrix(y).infinity_norm();
│ │ │ │ -
1038 norm = max(sum, norm);
│ │ │ │ -
1039 isNaN += sum;
│ │ │ │ -
1040 }
│ │ │ │ -
1041
│ │ │ │ -
1042 return norm * (isNaN / isNaN);
│ │ │ │ -
1043 }
│ │ │ │ -
│ │ │ │ -
1044
│ │ │ │ -
1046 template <typename ft = field_type,
│ │ │ │ -
1047 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
1048 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ -
1049 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ -
1050 using std::max;
│ │ │ │ -
1051
│ │ │ │ -
1052 real_type norm = 0;
│ │ │ │ -
1053 real_type isNaN = 1;
│ │ │ │ -
1054 for (auto const &x : *this) {
│ │ │ │ -
1055 real_type sum = 0;
│ │ │ │ -
1056 for (auto const &y : x)
│ │ │ │ -
1057 sum += Impl::asMatrix(y).infinity_norm_real();
│ │ │ │ -
1058 norm = max(sum, norm);
│ │ │ │ -
1059 isNaN += sum;
│ │ │ │ -
1060 }
│ │ │ │ -
1061
│ │ │ │ -
1062 return norm * (isNaN / isNaN);
│ │ │ │ -
1063 }
│ │ │ │ -
│ │ │ │ -
1064
│ │ │ │ -
1065 //===== query
│ │ │ │ -
1066
│ │ │ │ -
│ │ │ │ -
1068 bool exists ([[maybe_unused]] size_type i, [[maybe_unused]] size_type j) const
│ │ │ │ -
1069 {
│ │ │ │ -
1070#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
1071 if (i<0 || i>=N()) DUNE_THROW(ISTLError,"row index out of range");
│ │ │ │ -
1072 if (j<0 || i>=M()) DUNE_THROW(ISTLError,"column index out of range");
│ │ │ │ -
1073#endif
│ │ │ │ -
1074 return true;
│ │ │ │ -
1075 }
│ │ │ │ -
│ │ │ │ -
1076
│ │ │ │ -
1077 protected:
│ │ │ │ -
1078
│ │ │ │ - │ │ │ │ -
1082
│ │ │ │ - │ │ │ │ -
1089 };
│ │ │ │ -
│ │ │ │ -
1090
│ │ │ │ -
1091 template<class T, class A>
│ │ │ │ -
│ │ │ │ -
1092 struct FieldTraits< Matrix<T, A> >
│ │ │ │ -
1093 {
│ │ │ │ - │ │ │ │ -
1095 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ -
1096 };
│ │ │ │ -
│ │ │ │ -
1097
│ │ │ │ -
1099} // end namespace Dune
│ │ │ │ -
1100
│ │ │ │ -
1101#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.
│ │ │ │ - │ │ │ │ +
903 // obtain approximated spectral condition number of A
│ │ │ │ +
904 cond_2 = sigma_max / sigma_min;
│ │ │ │ +
905
│ │ │ │ +
906 // print verbosity information
│ │ │ │ +
907 if (verbosity_level_ > 0)
│ │ │ │ +
908 {
│ │ │ │ +
909 if (verbosity_level_ > 1)
│ │ │ │ +
910 {
│ │ │ │ +
911 // print some information about the problem
│ │ │ │ +
912 std::cout << blank_ << "Obtained singular values of A by sol"
│ │ │ │ +
913 << "ving (A^T*A)*x = σ²*x using the ARPACK++ "
│ │ │ │ +
914 << "class ARSymStdEig:" << std::endl;
│ │ │ │ +
915 std::cout << blank_ << " converged eigenvalues of A^T*A: "
│ │ │ │ +
916 << nconv << " / " << nev << std::endl;
│ │ │ │ +
917 std::cout << blank_ << " largest eigenvalue of A^T*A: "
│ │ │ │ +
918 << lambda_max << std::endl;
│ │ │ │ +
919 std::cout << blank_ << " smallest eigenvalue of A^T*A: "
│ │ │ │ +
920 << lambda_min << std::endl;
│ │ │ │ +
921 std::cout << blank_ << " => largest singular value of A: "
│ │ │ │ +
922 << sigma_max << std::endl;
│ │ │ │ +
923 std::cout << blank_ << " => smallest singular value of A: "
│ │ │ │ +
924 << sigma_min << std::endl;
│ │ │ │ +
925 }
│ │ │ │ +
926 std::cout << blank_ << "Result ("
│ │ │ │ +
927 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
928 << "║residual║_2 = {" << r_max_norm << ","
│ │ │ │ +
929 << r_min_norm << "}, " << "σ = {"
│ │ │ │ +
930 << sigma_max << "," << sigma_min
│ │ │ │ +
931 << "}): cond_2 = " << cond_2 << std::endl;
│ │ │ │ +
932 }
│ │ │ │ +
933
│ │ │ │ +
934 // free dynamically allocated memory
│ │ │ │ +
935 delete[] AtAx_min_raw;
│ │ │ │ +
936 delete[] AtAx_max_raw;
│ │ │ │ +
937 delete[] ev;
│ │ │ │ +
938 }
│ │ │ │ +
│ │ │ │ +
939
│ │ │ │ +
│ │ │ │ +
944 inline unsigned int getIterationCount () const
│ │ │ │ +
945 {
│ │ │ │ +
946 if (nIterations_ == 0)
│ │ │ │ +
947 DUNE_THROW(Dune::ISTLError,"No algorithm applied, yet.");
│ │ │ │ +
948
│ │ │ │ +
949 return nIterations_;
│ │ │ │ +
950 }
│ │ │ │ +
│ │ │ │ +
951
│ │ │ │ +
952 protected:
│ │ │ │ +
953 // parameters related to iterative eigenvalue algorithms
│ │ │ │ + │ │ │ │ +
955 const unsigned int nIterationsMax_;
│ │ │ │ +
956
│ │ │ │ +
957 // verbosity setting
│ │ │ │ +
958 const unsigned int verbosity_level_;
│ │ │ │ +
959
│ │ │ │ +
960 // memory for storing temporary variables (mutable as they shall
│ │ │ │ +
961 // just be effectless auxiliary variables of the const apply*(...)
│ │ │ │ +
962 // methods)
│ │ │ │ +
963 mutable unsigned int nIterations_;
│ │ │ │ +
964
│ │ │ │ +
965 // constants for printing verbosity information
│ │ │ │ +
966 const std::string title_;
│ │ │ │ +
967 const std::string blank_;
│ │ │ │ +
968 };
│ │ │ │ +
│ │ │ │ +
969
│ │ │ │ +
972} // namespace Dune
│ │ │ │ +
973
│ │ │ │ +
974#endif // HAVE_ARPACKPP
│ │ │ │ +
975
│ │ │ │ +
976#endif // DUNE_ISTL_EIGENVALUE_ARPACKPP_HH
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ + │ │ │ │ +
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ +
void printvector(std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
Print an ISTL vector.
Definition io.hh:89
│ │ │ │
Definition allocator.hh:11
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bcrsmatrix.hh:488
│ │ │ │
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:401
│ │ │ │ +
A::size_type size_type
The type for the index access.
Definition bvector.hh:410
│ │ │ │ +
Wrapper to use a range of ARPACK++ eigenvalue solvers.
Definition arpackpp.hh:245
│ │ │ │ +
const unsigned int verbosity_level_
Definition arpackpp.hh:958
│ │ │ │ +
unsigned int getIterationCount() const
Return the number of iterations in last application of an algorithm.
Definition arpackpp.hh:944
│ │ │ │ +
const std::string title_
Definition arpackpp.hh:966
│ │ │ │ +
BlockVector::field_type Real
Definition arpackpp.hh:247
│ │ │ │ +
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
│ │ │ │ +
const BCRSMatrix & m_
Definition arpackpp.hh:954
│ │ │ │ +
const unsigned int nIterationsMax_
Definition arpackpp.hh:955
│ │ │ │ +
const std::string blank_
Definition arpackpp.hh:967
│ │ │ │ +
ArPackPlusPlus_Algorithms(const BCRSMatrix &m, const unsigned int nIterationsMax=100000, const unsigned int verbosity_level=0)
Construct from required parameters.
Definition arpackpp.hh:268
│ │ │ │ +
void computeSymCond2(const Real &epsilon, Real &cond_2) const
Assume the matrix to be square, symmetric and perform IRLM to compute an approximation of its spectra...
Definition arpackpp.hh:493
│ │ │ │ +
unsigned int nIterations_
Definition arpackpp.hh:963
│ │ │ │ +
void computeNonSymMin(const Real &epsilon, BlockVector &x, Real &sigma) const
Assume the matrix to be nonsymmetric and perform IRLM to compute an approximation sigma of its smalle...
Definition arpackpp.hh:721
│ │ │ │ +
void computeNonSymCond2(const Real &epsilon, Real &cond_2) const
Assume the matrix to be nonsymmetric and perform IRLM to compute an approximation of its spectral con...
Definition arpackpp.hh:830
│ │ │ │ +
void computeNonSymMax(const Real &epsilon, BlockVector &x, Real &sigma) const
Assume the matrix to be nonsymmetric and perform IRLM to compute an approximation sigma of its larges...
Definition arpackpp.hh:609
│ │ │ │
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
A Vector of blocks with different blocksizes.
Definition matrix.hh:44
│ │ │ │ -
Imp::BlockVectorWindow< B, A > window_type
Definition matrix.hh:70
│ │ │ │ -
BlockVector< B, A > block_type
Same as value_type, here for historical reasons.
Definition matrix.hh:67
│ │ │ │ -
DenseMatrixBase & operator=(const DenseMatrixBase &a)
assignment
Definition matrix.hh:182
│ │ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition matrix.hh:50
│ │ │ │ -
Iterator beforeBegin() const
Definition matrix.hh:385
│ │ │ │ -
void resize(size_type rows, size_type columns)
same effect as constructor with same argument
Definition matrix.hh:153
│ │ │ │ -
const window_type const_reference
Definition matrix.hh:74
│ │ │ │ -
DenseMatrixBase(size_type rows, size_type columns)
Definition matrix.hh:95
│ │ │ │ -
Iterator end()
end Iterator
Definition matrix.hh:371
│ │ │ │ -
reference operator[](size_type i)
random access to blocks
Definition matrix.hh:241
│ │ │ │ -
BlockVector< B, A > value_type
Type of the elements of the outer vector, i.e., dynamic vectors of B.
Definition matrix.hh:63
│ │ │ │ -
Iterator find(size_type i)
random access returning iterator (end if not contained)
Definition matrix.hh:391
│ │ │ │ -
size_type N() const
number of blocks in the vector (are of variable size here)
Definition matrix.hh:539
│ │ │ │ -
ConstIterator beforeEnd() const
Definition matrix.hh:525
│ │ │ │ -
ConstIterator end() const
end ConstIterator
Definition matrix.hh:518
│ │ │ │ -
window_type reference
Definition matrix.hh:72
│ │ │ │ -
ConstIterator rend() const
end ConstIterator
Definition matrix.hh:531
│ │ │ │ -
Iterator beforeEnd()
Definition matrix.hh:378
│ │ │ │ -
ConstIterator begin() const
begin ConstIterator
Definition matrix.hh:512
│ │ │ │ -
A allocator_type
export the allocator type
Definition matrix.hh:53
│ │ │ │ -
DenseMatrixBase()
Definition matrix.hh:82
│ │ │ │ -
ConstIterator find(size_type i) const
random access returning iterator (end if not contained)
Definition matrix.hh:397
│ │ │ │ -
A::size_type size_type
The size type for the index access.
Definition matrix.hh:56
│ │ │ │ -
~DenseMatrixBase()
free dynamic memory
Definition matrix.hh:142
│ │ │ │ -
Iterator begin()
begin Iterator
Definition matrix.hh:365
│ │ │ │ -
DenseMatrixBase(const DenseMatrixBase &a)
copy constructor, has copy semantics
Definition matrix.hh:116
│ │ │ │ -
Iterator class for sequential access.
Definition matrix.hh:263
│ │ │ │ -
Iterator & operator--()
prefix decrement
Definition matrix.hh:308
│ │ │ │ -
size_type index() const
Definition matrix.hh:352
│ │ │ │ - │ │ │ │ - │ │ │ │ -
bool operator!=(const Iterator &it) const
inequality
Definition matrix.hh:322
│ │ │ │ -
Iterator & operator=(Iterator &&other)
Move assignment.
Definition matrix.hh:282
│ │ │ │ -
Iterator & operator++()
prefix increment
Definition matrix.hh:300
│ │ │ │ -
Iterator()
constructor, no arguments
Definition matrix.hh:266
│ │ │ │ -
window_type & operator*() const
dereferencing
Definition matrix.hh:340
│ │ │ │ -
bool operator==(const Iterator &it) const
equality
Definition matrix.hh:316
│ │ │ │ -
Iterator & operator=(Iterator &other)
Copy assignment.
Definition matrix.hh:291
│ │ │ │ -
Iterator(B *data, size_type columns, size_type _i)
constructor
Definition matrix.hh:276
│ │ │ │ -
window_type * operator->() const
arrow
Definition matrix.hh:346
│ │ │ │ -
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ │ -
const window_type * operator->() const
arrow
Definition matrix.hh:487
│ │ │ │ -
const window_type & operator*() const
dereferencing
Definition matrix.hh:481
│ │ │ │ -
ConstIterator & operator++()
prefix increment
Definition matrix.hh:441
│ │ │ │ -
ConstIterator(const B *data, size_type columns, size_type _i)
constructor from pointer
Definition matrix.hh:414
│ │ │ │ -
ConstIterator & operator--()
prefix decrement
Definition matrix.hh:449
│ │ │ │ -
ConstIterator(const Iterator &it)
constructor from non_const iterator
Definition matrix.hh:420
│ │ │ │ -
bool operator!=(const ConstIterator &it) const
inequality
Definition matrix.hh:463
│ │ │ │ -
ConstIterator()
constructor
Definition matrix.hh:407
│ │ │ │ -
bool operator==(const ConstIterator &it) const
equality
Definition matrix.hh:457
│ │ │ │ -
size_type index() const
Definition matrix.hh:493
│ │ │ │ -
ConstIterator & operator=(Iterator &&other)
Definition matrix.hh:424
│ │ │ │ -
ConstIterator & operator=(Iterator &other)
Definition matrix.hh:432
│ │ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ -
size_type cols_
Number of columns of the matrix.
Definition matrix.hh:1088
│ │ │ │ -
FieldTraits< ft >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition matrix.hh:992
│ │ │ │ -
A allocator_type
Export the allocator.
Definition matrix.hh:571
│ │ │ │ -
FieldTraits< ft >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition matrix.hh:1011
│ │ │ │ -
void usmhv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition matrix.hh:956
│ │ │ │ -
void usmv(const field_type &alpha, const X &x, Y &y) const
Definition matrix.hh:854
│ │ │ │ -
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ │ -
MatrixImp::DenseMatrixBase< T, A > data_
Abuse DenseMatrixBase as an engine for a 2d array ISTL-style.
Definition matrix.hh:1081
│ │ │ │ -
Matrix transpose() const
Return the transpose of the matrix.
Definition matrix.hh:745
│ │ │ │ -
void mtv(const X &x, Y &y) const
y = A^T x
Definition matrix.hh:807
│ │ │ │ -
void umv(const X &x, Y &y) const
y += A x
Definition matrix.hh:820
│ │ │ │ -
void mv(const X &x, Y &y) const
y = A x
Definition matrix.hh:788
│ │ │ │ -
MatrixImp::DenseMatrixBase< T, A >::ConstIterator ConstRowIterator
Const iterator over the matrix rows.
Definition matrix.hh:586
│ │ │ │ -
void setSize(size_type rows, size_type cols)
Change the matrix size.
Definition matrix.hh:608
│ │ │ │ -
RowIterator beforeBegin()
Definition matrix.hh:634
│ │ │ │ -
RowIterator beforeEnd()
Definition matrix.hh:627
│ │ │ │ -
Matrix()
Create empty matrix.
Definition matrix.hh:596
│ │ │ │ -
Matrix & operator-=(const Matrix &b)
Subtract the entries of another matrix from this one.
Definition matrix.hh:735
│ │ │ │ -
FieldTraits< field_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition matrix.hh:980
│ │ │ │ -
row_type::iterator ColIterator
Iterator for the entries of each row.
Definition matrix.hh:583
│ │ │ │ -
ConstRowIterator beforeEnd() const
Definition matrix.hh:653
│ │ │ │ -
Matrix & operator=(const field_type &t)
Assignment from scalar.
Definition matrix.hh:666
│ │ │ │ -
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │ -
const row_type operator[](size_type row) const
The const index operator.
Definition matrix.hh:684
│ │ │ │ -
ConstRowIterator end() const
Get const iterator to one beyond last row.
Definition matrix.hh:646
│ │ │ │ -
friend Y operator*(const Matrix< T > &m, const X &vec)
Generic matrix-vector multiplication.
Definition matrix.hh:770
│ │ │ │ -
Matrix< T > & operator*=(const field_type &scalar)
Multiplication with a scalar.
Definition matrix.hh:705
│ │ │ │ -
row_type operator[](size_type row)
The index operator.
Definition matrix.hh:673
│ │ │ │ -
void mmv(const X &x, Y &y) const
y -= A x
Definition matrix.hh:837
│ │ │ │ -
Matrix & operator+=(const Matrix &b)
Add the entries of another matrix to this one.
Definition matrix.hh:721
│ │ │ │ -
ConstRowIterator begin() const
Get const iterator to first row.
Definition matrix.hh:640
│ │ │ │ -
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition matrix.hh:939
│ │ │ │ -
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:614
│ │ │ │ -
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
│ │ │ │ -
static constexpr auto blocklevel
The number of nesting levels the matrix contains.
Definition matrix.hh:593
│ │ │ │ -
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ -
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ │ -
bool exists(size_type i, size_type j) const
return true if (i,j) is in pattern
Definition matrix.hh:1068
│ │ │ │ -
Matrix< T > & operator/=(const field_type &scalar)
Division by a scalar.
Definition matrix.hh:711
│ │ │ │ -
friend Matrix< T > operator*(const Matrix< T > &m1, const Matrix< T > &m2)
Generic matrix multiplication.
Definition matrix.hh:755
│ │ │ │ -
void umtv(const X &x, Y &y) const
y += A^T x
Definition matrix.hh:871
│ │ │ │ -
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition matrix.hh:888
│ │ │ │ -
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ │ -
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition matrix.hh:974
│ │ │ │ -
void usmtv(const field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition matrix.hh:905
│ │ │ │ -
void umhv(const X &x, Y &y) const
y += A^H x
Definition matrix.hh:922
│ │ │ │ -
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │ -
ConstRowIterator beforeBegin() const
Definition matrix.hh:660
│ │ │ │ -
Matrix(size_type rows, size_type cols)
Create uninitialized matrix of size rows x cols.
Definition matrix.hh:601
│ │ │ │ -
MatrixImp::DenseMatrixBase< T, A >::Iterator RowIterator
Iterator over the matrix rows.
Definition matrix.hh:580
│ │ │ │ -
typename Matrix< T, A >::field_type field_type
Definition matrix.hh:1094
│ │ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition matrix.hh:1095
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1378 +1,954 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -matrix.hh │ │ │ │ │ + * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ +arpackpp.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 (C) 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_MATRIX_HH │ │ │ │ │ -6#define DUNE_ISTL_MATRIX_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_EIGENVALUE_ARPACKPP_HH │ │ │ │ │ +6#define DUNE_ISTL_EIGENVALUE_ARPACKPP_HH │ │ │ │ │ 7 │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ +8#if HAVE_ARPACKPP || defined DOXYGEN │ │ │ │ │ +9 │ │ │ │ │ +10#include // provides std::abs, std::pow, std::sqrt │ │ │ │ │ +11 │ │ │ │ │ +12#include // provides std::cout, std::endl │ │ │ │ │ +13#include // provides std::string │ │ │ │ │ 14 │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ │ -22#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ -23 │ │ │ │ │ -24namespace _D_u_n_e { │ │ │ │ │ -25 │ │ │ │ │ -_2_6namespace MatrixImp │ │ │ │ │ -27{ │ │ │ │ │ -39 template > │ │ │ │ │ -_4_0 class _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e : public Imp::block_vector_unmanaged │ │ │ │ │ -41 // this derivation gives us all the blas level 1 and norms │ │ │ │ │ -42 // on the large array. However, access operators have to be │ │ │ │ │ -43 // overwritten. │ │ │ │ │ -44 { │ │ │ │ │ -45 public: │ │ │ │ │ -46 │ │ │ │ │ -47 //===== type definitions and constants │ │ │ │ │ -48 │ │ │ │ │ -_5_0 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ -51 │ │ │ │ │ -_5_3 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ -54 │ │ │ │ │ -_5_6 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -57 │ │ │ │ │ -_6_3 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -64 │ │ │ │ │ -_6_7 typedef _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_> _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -68 │ │ │ │ │ -69 // just a shorthand │ │ │ │ │ -_7_0 typedef Imp::BlockVectorWindow _w_i_n_d_o_w___t_y_p_e; │ │ │ │ │ -71 │ │ │ │ │ -_7_2 typedef _w_i_n_d_o_w___t_y_p_e _r_e_f_e_r_e_n_c_e; │ │ │ │ │ -73 │ │ │ │ │ -_7_4 typedef const _w_i_n_d_o_w___t_y_p_e _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ │ -75 │ │ │ │ │ -76 │ │ │ │ │ -77 //===== constructors and such │ │ │ │ │ +15#include // provides Dune::FieldVector │ │ │ │ │ +16#include // provides DUNE_THROW(...) │ │ │ │ │ +17 │ │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> // provides Dune::blockLevel │ │ │ │ │ +19#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> // provides Dune::BlockVector │ │ │ │ │ +20#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> // provides Dune::ISTLError │ │ │ │ │ +21#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> // provides Dune::printvector(...) │ │ │ │ │ +22 │ │ │ │ │ +23#ifdef Status │ │ │ │ │ +24#undef Status // prevent preprocessor from damaging the ARPACK++ │ │ │ │ │ +25 // code when "X11/Xlib.h" is included (the latter │ │ │ │ │ +26 // defines Status as "#define Status int" and │ │ │ │ │ +27 // ARPACK++ provides a class with a method called │ │ │ │ │ +28 // Status) │ │ │ │ │ +29#endif │ │ │ │ │ +30#include "arssym.h" // provides ARSymStdEig │ │ │ │ │ +31 │ │ │ │ │ +32namespace _D_u_n_e │ │ │ │ │ +33{ │ │ │ │ │ +34 │ │ │ │ │ +39 namespace Impl { │ │ │ │ │ +55 template │ │ │ │ │ +56 class ArPackPlusPlus_BCRSMatrixWrapper │ │ │ │ │ +57 { │ │ │ │ │ +58 public: │ │ │ │ │ +60 typedef typename _B_C_R_S_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e Real; │ │ │ │ │ +61 │ │ │ │ │ +62 public: │ │ │ │ │ +64 ArPackPlusPlus_BCRSMatrixWrapper (const BCRSMatrix& A) │ │ │ │ │ +65 : A_(A), │ │ │ │ │ +66 m_(A_.M() * mBlock), n_(A_.N() * nBlock) │ │ │ │ │ +67 { │ │ │ │ │ +68 // assert that BCRSMatrix type has blocklevel 2 │ │ │ │ │ +69 static_assert │ │ │ │ │ +70 (blockLevel() == 2, │ │ │ │ │ +71 "Only BCRSMatrices with blocklevel 2 are supported."); │ │ │ │ │ +72 │ │ │ │ │ +73 // allocate memory for auxiliary block vector objects │ │ │ │ │ +74 // which are compatible to matrix rows / columns │ │ │ │ │ +75 domainBlockVector.resize(A_.N()); │ │ │ │ │ +76 rangeBlockVector.resize(A_.M()); │ │ │ │ │ +77 } │ │ │ │ │ 78 │ │ │ │ │ -_8_2 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e () : Imp::block_vector_unmanaged() │ │ │ │ │ -83 { │ │ │ │ │ -84 // nothing is known ... │ │ │ │ │ -85 rows_ = 0; │ │ │ │ │ -86 columns_ = 0; │ │ │ │ │ -87 } │ │ │ │ │ -88 │ │ │ │ │ -_9_5 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e (_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns) : Imp:: │ │ │ │ │ -block_vector_unmanaged() │ │ │ │ │ -96 { │ │ │ │ │ -97 // and we can allocate the big array in the base class │ │ │ │ │ -98 this->n = rows*columns; │ │ │ │ │ -99 columns_ = columns; │ │ │ │ │ -100 if (this->n>0) │ │ │ │ │ -101 { │ │ │ │ │ -102 this->p = allocator_.allocate(this->n); │ │ │ │ │ -103 new (this->p)B[this->n]; │ │ │ │ │ -104 } │ │ │ │ │ -105 else │ │ │ │ │ -106 { │ │ │ │ │ -107 this->n = 0; │ │ │ │ │ -108 this->p = 0; │ │ │ │ │ -109 } │ │ │ │ │ -110 │ │ │ │ │ -111 // we can allocate the windows now │ │ │ │ │ -112 rows_ = rows; │ │ │ │ │ -113 } │ │ │ │ │ -114 │ │ │ │ │ -_1_1_6 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e (const _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& a) │ │ │ │ │ -117 { │ │ │ │ │ -118 // allocate the big array in the base class │ │ │ │ │ -119 this->n = a.n; │ │ │ │ │ -120 columns_ = a.columns_; │ │ │ │ │ -121 if (this->n>0) │ │ │ │ │ -122 { │ │ │ │ │ -123 // allocate and construct objects │ │ │ │ │ -124 this->p = allocator_.allocate(this->n); │ │ │ │ │ -125 new (this->p)B[this->n]; │ │ │ │ │ -126 │ │ │ │ │ -127 // copy data │ │ │ │ │ -128 for (_s_i_z_e___t_y_p_e i=0; in; i++) │ │ │ │ │ -129 this->p[i]=a.p[i]; │ │ │ │ │ -130 } │ │ │ │ │ -131 else │ │ │ │ │ -132 { │ │ │ │ │ -133 this->n = 0; │ │ │ │ │ -134 this->p = nullptr; │ │ │ │ │ -135 } │ │ │ │ │ +80 inline void multMv (Real* v, Real* w) │ │ │ │ │ +81 { │ │ │ │ │ +82 // get vector v as an object of appropriate type │ │ │ │ │ +83 arrayToDomainBlockVector(v,domainBlockVector); │ │ │ │ │ +84 │ │ │ │ │ +85 // perform matrix-vector product │ │ │ │ │ +86 A_.mv(domainBlockVector,rangeBlockVector); │ │ │ │ │ +87 │ │ │ │ │ +88 // get vector w from object of appropriate type │ │ │ │ │ +89 rangeBlockVectorToArray(rangeBlockVector,w); │ │ │ │ │ +90 }; │ │ │ │ │ +91 │ │ │ │ │ +93 inline void multMtMv (Real* v, Real* w) │ │ │ │ │ +94 { │ │ │ │ │ +95 // get vector v as an object of appropriate type │ │ │ │ │ +96 arrayToDomainBlockVector(v,domainBlockVector); │ │ │ │ │ +97 │ │ │ │ │ +98 // perform matrix-vector product │ │ │ │ │ +99 A_.mv(domainBlockVector,rangeBlockVector); │ │ │ │ │ +100 A_.mtv(rangeBlockVector,domainBlockVector); │ │ │ │ │ +101 │ │ │ │ │ +102 // get vector w from object of appropriate type │ │ │ │ │ +103 domainBlockVectorToArray(domainBlockVector,w); │ │ │ │ │ +104 }; │ │ │ │ │ +105 │ │ │ │ │ +107 inline void multMMtv (Real* v, Real* w) │ │ │ │ │ +108 { │ │ │ │ │ +109 // get vector v as an object of appropriate type │ │ │ │ │ +110 arrayToRangeBlockVector(v,rangeBlockVector); │ │ │ │ │ +111 │ │ │ │ │ +112 // perform matrix-vector product │ │ │ │ │ +113 A_.mtv(rangeBlockVector,domainBlockVector); │ │ │ │ │ +114 A_.mv(domainBlockVector,rangeBlockVector); │ │ │ │ │ +115 │ │ │ │ │ +116 // get vector w from object of appropriate type │ │ │ │ │ +117 rangeBlockVectorToArray(rangeBlockVector,w); │ │ │ │ │ +118 }; │ │ │ │ │ +119 │ │ │ │ │ +121 inline int nrows () const { return m_; } │ │ │ │ │ +122 │ │ │ │ │ +124 inline int ncols () const { return n_; } │ │ │ │ │ +125 │ │ │ │ │ +126 protected: │ │ │ │ │ +127 // Number of rows and columns in each block of the matrix │ │ │ │ │ +128 constexpr static int mBlock = BCRSMatrix::block_type::rows; │ │ │ │ │ +129 constexpr static int nBlock = BCRSMatrix::block_type::cols; │ │ │ │ │ +130 │ │ │ │ │ +131 // Type of vectors in the domain of the linear map associated with │ │ │ │ │ +132 // the matrix, i.e. block vectors compatible to matrix rows │ │ │ │ │ +133 constexpr static int dbvBlockSize = nBlock; │ │ │ │ │ +134 typedef Dune::FieldVector DomainBlockVectorBlock; │ │ │ │ │ +135 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_D_o_m_a_i_n_B_l_o_c_k_V_e_c_t_o_r_B_l_o_c_k_> DomainBlockVector; │ │ │ │ │ 136 │ │ │ │ │ -137 // we can allocate the windows now │ │ │ │ │ -138 rows_ = a.rows_; │ │ │ │ │ -139 } │ │ │ │ │ -140 │ │ │ │ │ -_1_4_2 _~_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e () │ │ │ │ │ -143 { │ │ │ │ │ -144 if (this->n>0) { │ │ │ │ │ -145 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ -146 while (i) │ │ │ │ │ -147 this->p[--i].~B(); │ │ │ │ │ -148 allocator_.deallocate(this->p,this->n); │ │ │ │ │ -149 } │ │ │ │ │ -150 } │ │ │ │ │ -151 │ │ │ │ │ -_1_5_3 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e columns) │ │ │ │ │ -154 { │ │ │ │ │ -155 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ -156 if (this->n>0) { │ │ │ │ │ -157 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ -158 while (i) │ │ │ │ │ -159 this->p[--i].~B(); │ │ │ │ │ -160 allocator_.deallocate(this->p,this->n); │ │ │ │ │ -161 } │ │ │ │ │ -162 │ │ │ │ │ -163 // and we can allocate the big array in the base class │ │ │ │ │ -164 this->n = rows*columns; │ │ │ │ │ -165 if (this->n>0) │ │ │ │ │ -166 { │ │ │ │ │ -167 this->p = allocator_.allocate(this->n); │ │ │ │ │ -168 new (this->p)B[this->n]; │ │ │ │ │ -169 } │ │ │ │ │ -170 else │ │ │ │ │ -171 { │ │ │ │ │ -172 this->n = 0; │ │ │ │ │ -173 this->p = nullptr; │ │ │ │ │ -174 } │ │ │ │ │ -175 │ │ │ │ │ -176 // we can allocate the windows now │ │ │ │ │ -177 rows_ = rows; │ │ │ │ │ -178 columns_ = columns; │ │ │ │ │ -179 } │ │ │ │ │ -180 │ │ │ │ │ -_1_8_2 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& _o_p_e_r_a_t_o_r_=_ (const _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& a) │ │ │ │ │ -183 { │ │ │ │ │ -184 if (&a!=this) // check if this and a are different objects │ │ │ │ │ -185 { │ │ │ │ │ -186 columns_ = a.columns_; │ │ │ │ │ -187 // reallocate arrays if necessary │ │ │ │ │ -188 // Note: still the block sizes may vary ! │ │ │ │ │ -189 if (this->n!=a.n || rows_!=a.rows_) │ │ │ │ │ -190 { │ │ │ │ │ -191 // deconstruct objects and deallocate memory if necessary │ │ │ │ │ -192 if (this->n>0) { │ │ │ │ │ -193 _s_i_z_e___t_y_p_e i=this->n; │ │ │ │ │ -194 while (i) │ │ │ │ │ -195 this->p[--i].~B(); │ │ │ │ │ -196 allocator_.deallocate(this->p,this->n); │ │ │ │ │ -197 } │ │ │ │ │ -198 │ │ │ │ │ -199 // allocate the big array in the base class │ │ │ │ │ -200 this->n = a.n; │ │ │ │ │ -201 if (this->n>0) │ │ │ │ │ -202 { │ │ │ │ │ -203 // allocate and construct objects │ │ │ │ │ -204 this->p = allocator_.allocate(this->n); │ │ │ │ │ -205 new (this->p)B[this->n]; │ │ │ │ │ -206 } │ │ │ │ │ -207 else │ │ │ │ │ -208 { │ │ │ │ │ -209 this->n = 0; │ │ │ │ │ -210 this->p = nullptr; │ │ │ │ │ -211 } │ │ │ │ │ -212 │ │ │ │ │ -213 // Copy number of rows │ │ │ │ │ -214 rows_ = a.rows_; │ │ │ │ │ -215 } │ │ │ │ │ -216 │ │ │ │ │ -217 // and copy the data │ │ │ │ │ -218 for (_s_i_z_e___t_y_p_e i=0; in; i++) │ │ │ │ │ -219 this->p[i]=a.p[i]; │ │ │ │ │ -220 } │ │ │ │ │ -221 │ │ │ │ │ -222 return *this; │ │ │ │ │ -223 } │ │ │ │ │ -224 │ │ │ │ │ -225 │ │ │ │ │ -226 //===== assignment from scalar │ │ │ │ │ -227 │ │ │ │ │ -_2_2_9 _D_e_n_s_e_M_a_t_r_i_x_B_a_s_e& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ │ -230 { │ │ │ │ │ -231 (static_cast&>(*this)) = k; │ │ │ │ │ -232 return *this; │ │ │ │ │ -233 } │ │ │ │ │ -234 │ │ │ │ │ -235 │ │ │ │ │ -236 //===== access to components │ │ │ │ │ -237 // has to be overwritten from base class because it must │ │ │ │ │ -238 // return access to the windows │ │ │ │ │ -239 │ │ │ │ │ -_2_4_1 _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) │ │ │ │ │ -242 { │ │ │ │ │ -243#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -244 if (i>=rows_) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ -245#endif │ │ │ │ │ -246 return _w_i_n_d_o_w___t_y_p_e(this->p + i*columns_, columns_); │ │ │ │ │ -247 } │ │ │ │ │ +137 // Type of vectors in the range of the linear map associated with │ │ │ │ │ +138 // the matrix, i.e. block vectors compatible to matrix columns │ │ │ │ │ +139 constexpr static int rbvBlockSize = mBlock; │ │ │ │ │ +140 typedef Dune::FieldVector RangeBlockVectorBlock; │ │ │ │ │ +141 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_R_a_n_g_e_B_l_o_c_k_V_e_c_t_o_r_B_l_o_c_k_> RangeBlockVector; │ │ │ │ │ +142 │ │ │ │ │ +143 // Types for vector index access │ │ │ │ │ +144 typedef typename _D_o_m_a_i_n_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e dbv_size_type; │ │ │ │ │ +145 typedef typename _R_a_n_g_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e rbv_size_type; │ │ │ │ │ +146 typedef typename DomainBlockVectorBlock::size_type dbvb_size_type; │ │ │ │ │ +147 typedef typename RangeBlockVectorBlock::size_type rbvb_size_type; │ │ │ │ │ +148 │ │ │ │ │ +149 // Get vector v from a block vector object which is compatible to │ │ │ │ │ +150 // matrix rows │ │ │ │ │ +151 static inline void │ │ │ │ │ +152 domainBlockVectorToArray (const DomainBlockVector& dbv, Real* v) │ │ │ │ │ +153 { │ │ │ │ │ +154 for (dbv_size_type block = 0; block < dbv.N(); ++block) │ │ │ │ │ +155 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock) │ │ │ │ │ +156 v[block*dbvBlockSize + iBlock] = dbv[block][iBlock]; │ │ │ │ │ +157 } │ │ │ │ │ +158 │ │ │ │ │ +159 // Get vector v from a block vector object which is compatible to │ │ │ │ │ +160 // matrix columns │ │ │ │ │ +161 static inline void │ │ │ │ │ +162 rangeBlockVectorToArray (const RangeBlockVector& rbv, Real* v) │ │ │ │ │ +163 { │ │ │ │ │ +164 for (rbv_size_type block = 0; block < rbv.N(); ++block) │ │ │ │ │ +165 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock) │ │ │ │ │ +166 v[block*rbvBlockSize + iBlock] = rbv[block][iBlock]; │ │ │ │ │ +167 } │ │ │ │ │ +168 │ │ │ │ │ +169 public: │ │ │ │ │ +172 static inline void arrayToDomainBlockVector (const Real* v, │ │ │ │ │ +173 DomainBlockVector& dbv) │ │ │ │ │ +174 { │ │ │ │ │ +175 for (dbv_size_type block = 0; block < dbv.N(); ++block) │ │ │ │ │ +176 for (dbvb_size_type iBlock = 0; iBlock < dbvBlockSize; ++iBlock) │ │ │ │ │ +177 dbv[block][iBlock] = v[block*dbvBlockSize + iBlock]; │ │ │ │ │ +178 } │ │ │ │ │ +179 │ │ │ │ │ +182 static inline void arrayToRangeBlockVector (const Real* v, │ │ │ │ │ +183 RangeBlockVector& rbv) │ │ │ │ │ +184 { │ │ │ │ │ +185 for (rbv_size_type block = 0; block < rbv.N(); ++block) │ │ │ │ │ +186 for (rbvb_size_type iBlock = 0; iBlock < rbvBlockSize; ++iBlock) │ │ │ │ │ +187 rbv[block][iBlock] = v[block*rbvBlockSize + iBlock]; │ │ │ │ │ +188 } │ │ │ │ │ +189 │ │ │ │ │ +190 protected: │ │ │ │ │ +191 // The DUNE-ISTL BCRSMatrix │ │ │ │ │ +192 const BCRSMatrix& A_; │ │ │ │ │ +193 │ │ │ │ │ +194 // Number of rows and columns in the matrix │ │ │ │ │ +195 const int m_, n_; │ │ │ │ │ +196 │ │ │ │ │ +197 // Auxiliary block vector objects which are │ │ │ │ │ +198 // compatible to matrix rows / columns │ │ │ │ │ +199 mutable DomainBlockVector domainBlockVector; │ │ │ │ │ +200 mutable RangeBlockVector rangeBlockVector; │ │ │ │ │ +201 }; │ │ │ │ │ +202 } // end namespace Impl │ │ │ │ │ +203 │ │ │ │ │ +243 template │ │ │ │ │ +_2_4_4 class _A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ +245 { │ │ │ │ │ +246 public: │ │ │ │ │ +_2_4_7 typedef typename _B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e _R_e_a_l; │ │ │ │ │ 248 │ │ │ │ │ -_2_5_0 _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 │ │ │ │ │ -251 { │ │ │ │ │ -252#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -253 if (i<0 || i>=rows_) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ -254#endif │ │ │ │ │ -255 return _w_i_n_d_o_w___t_y_p_e(this->p + i*columns_, columns_); │ │ │ │ │ -256 } │ │ │ │ │ -257 │ │ │ │ │ -258 // forward declaration │ │ │ │ │ -259 class ConstIterator; │ │ │ │ │ -260 │ │ │ │ │ -_2_6_2 class _I_t_e_r_a_t_o_r │ │ │ │ │ -263 { │ │ │ │ │ -264 public: │ │ │ │ │ -_2_6_6 _I_t_e_r_a_t_o_r () │ │ │ │ │ -267 : window_(nullptr,0) │ │ │ │ │ -268 { │ │ │ │ │ -269 i = 0; │ │ │ │ │ -270 } │ │ │ │ │ -271 │ │ │ │ │ -_2_7_2 _I_t_e_r_a_t_o_r (_I_t_e_r_a_t_o_r& other) = default; │ │ │ │ │ -_2_7_3 _I_t_e_r_a_t_o_r (_I_t_e_r_a_t_o_r&& other) = default; │ │ │ │ │ -274 │ │ │ │ │ -_2_7_6 _I_t_e_r_a_t_o_r (B* data, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ -277 : i(_i), │ │ │ │ │ -278 window_(data + _i*columns, columns) │ │ │ │ │ -279 {} │ │ │ │ │ -280 │ │ │ │ │ -_2_8_2 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r&& other) │ │ │ │ │ -283 { │ │ │ │ │ -284 i = other.i; │ │ │ │ │ -285 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ -not just the window! │ │ │ │ │ -286 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ -287 return *this; │ │ │ │ │ -288 } │ │ │ │ │ -289 │ │ │ │ │ -_2_9_1 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r& other) │ │ │ │ │ -292 { │ │ │ │ │ -293 i = other.i; │ │ │ │ │ -294 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ -not just the window! │ │ │ │ │ -295 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ -296 return *this; │ │ │ │ │ -297 } │ │ │ │ │ -298 │ │ │ │ │ -_3_0_0 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -301 { │ │ │ │ │ -302 ++i; │ │ │ │ │ -303 window_.setptr(window_.getptr()+window_.getsize()); │ │ │ │ │ -304 return *this; │ │ │ │ │ -305 } │ │ │ │ │ +249 public: │ │ │ │ │ +_2_6_8 _A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s (const _B_C_R_S_M_a_t_r_i_x& m, │ │ │ │ │ +269 const unsigned int nIterationsMax = 100000, │ │ │ │ │ +270 const unsigned int verbosity_level = 0) │ │ │ │ │ +271 : _m__(m), _n_I_t_e_r_a_t_i_o_n_s_M_a_x__(nIterationsMax), │ │ │ │ │ +272 _v_e_r_b_o_s_i_t_y___l_e_v_e_l__(verbosity_level), │ │ │ │ │ +273 _n_I_t_e_r_a_t_i_o_n_s__(0), │ │ │ │ │ +274 _t_i_t_l_e__(" ArPackPlusPlus_Algorithms: "), │ │ │ │ │ +275 _b_l_a_n_k__(_t_i_t_l_e__.length(),' ') │ │ │ │ │ +276 {} │ │ │ │ │ +277 │ │ │ │ │ +_2_8_9 inline void _c_o_m_p_u_t_e_S_y_m_M_a_x_M_a_g_n_i_t_u_d_e (const _R_e_a_l& epsilon, │ │ │ │ │ +290 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ +291 { │ │ │ │ │ +292 // print verbosity information │ │ │ │ │ +293 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +294 std::cout << _t_i_t_l_e__ << "Computing an approximation of " │ │ │ │ │ +295 << "the dominant eigenvalue of a matrix which " │ │ │ │ │ +296 << "is assumed to be symmetric." << std::endl; │ │ │ │ │ +297 │ │ │ │ │ +298 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ +299 // and to perform the product A*v (LU decomposition is not used) │ │ │ │ │ +300 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ +301 WrappedMatrix A(_m__); │ │ │ │ │ +302 │ │ │ │ │ +303 // get number of rows and columns in A │ │ │ │ │ +304 const int nrows = A.nrows(); │ │ │ │ │ +305 const int ncols = A.ncols(); │ │ │ │ │ 306 │ │ │ │ │ -_3_0_8 _I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ -309 { │ │ │ │ │ -310 --i; │ │ │ │ │ -311 window_.setptr(window_.getptr()-window_.getsize()); │ │ │ │ │ -312 return *this; │ │ │ │ │ -313 } │ │ │ │ │ -314 │ │ │ │ │ -_3_1_6 bool _o_p_e_r_a_t_o_r_=_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -317 { │ │ │ │ │ -318 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ -319 } │ │ │ │ │ +307 // assert that A is square │ │ │ │ │ +308 if (nrows != ncols) │ │ │ │ │ +309 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ +310 << nrows << "x" << ncols << ")."); │ │ │ │ │ +311 │ │ │ │ │ +312 // allocate memory for variables, set parameters │ │ │ │ │ +313 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ +314 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ +each iteration (0 == auto) │ │ │ │ │ +315 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ +values) (0 == machine precision) │ │ │ │ │ +316 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ +iterations allowed (0 == 100*nev) │ │ │ │ │ +317 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A │ │ │ │ │ +318 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ +determined │ │ │ │ │ +319 int nconv; // Number of converged eigenvalues │ │ │ │ │ 320 │ │ │ │ │ -_3_2_2 bool _o_p_e_r_a_t_o_r_!_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -323 { │ │ │ │ │ -324 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ -325 } │ │ │ │ │ -326 │ │ │ │ │ -_3_2_8 bool _o_p_e_r_a_t_o_r_=_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -329 { │ │ │ │ │ -330 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ -331 } │ │ │ │ │ -332 │ │ │ │ │ -_3_3_4 bool _o_p_e_r_a_t_o_r_!_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -335 { │ │ │ │ │ -336 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ -337 } │ │ │ │ │ +321 // define what we need: eigenvalues with largest magnitude │ │ │ │ │ +322 char which[] = "LM"; │ │ │ │ │ +323 ARSymStdEig │ │ │ │ │ +324 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit); │ │ │ │ │ +325 │ │ │ │ │ +326 // set ARPACK verbosity mode if requested │ │ │ │ │ +327 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ +328 │ │ │ │ │ +329 // find eigenvalues and eigenvectors of A, obtain the eigenvalues │ │ │ │ │ +330 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ +331 │ │ │ │ │ +332 // obtain approximated dominant eigenvalue of A │ │ │ │ │ +333 lambda = ev[nev-1]; │ │ │ │ │ +334 │ │ │ │ │ +335 // obtain associated approximated eigenvector of A │ │ │ │ │ +336 _R_e_a_l* x_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ +337 WrappedMatrix::arrayToDomainBlockVector(x_raw,x); │ │ │ │ │ 338 │ │ │ │ │ -_3_4_0 _w_i_n_d_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_*_ () const │ │ │ │ │ -341 { │ │ │ │ │ -342 return window_; │ │ │ │ │ -343 } │ │ │ │ │ -344 │ │ │ │ │ -_3_4_6 _w_i_n_d_o_w___t_y_p_e* _o_p_e_r_a_t_o_r_-_>_ () const │ │ │ │ │ -347 { │ │ │ │ │ -348 return &window_; │ │ │ │ │ -349 } │ │ │ │ │ -350 │ │ │ │ │ -351 // return index corresponding to pointer │ │ │ │ │ -_3_5_2 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ -353 { │ │ │ │ │ -354 return i; │ │ │ │ │ -355 } │ │ │ │ │ -356 │ │ │ │ │ -_3_5_7 friend class _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ -358 │ │ │ │ │ -359 private: │ │ │ │ │ -360 _s_i_z_e___t_y_p_e i; │ │ │ │ │ -361 mutable _w_i_n_d_o_w___t_y_p_e window_; │ │ │ │ │ -362 }; │ │ │ │ │ -363 │ │ │ │ │ -_3_6_5 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ -366 { │ │ │ │ │ -367 return _I_t_e_r_a_t_o_r(this->p, columns_, 0); │ │ │ │ │ -368 } │ │ │ │ │ -369 │ │ │ │ │ -_3_7_1 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ -372 { │ │ │ │ │ -373 return _I_t_e_r_a_t_o_r(this->p, columns_, rows_); │ │ │ │ │ -374 } │ │ │ │ │ -375 │ │ │ │ │ -_3_7_8 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ -379 { │ │ │ │ │ -380 return _I_t_e_r_a_t_o_r(this->p, columns_, rows_-1); │ │ │ │ │ -381 } │ │ │ │ │ -382 │ │ │ │ │ -_3_8_5 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ │ -386 { │ │ │ │ │ -387 return _I_t_e_r_a_t_o_r(this->p, columns_, -1); │ │ │ │ │ -388 } │ │ │ │ │ -389 │ │ │ │ │ -_3_9_1 _I_t_e_r_a_t_o_r _f_i_n_d (_s_i_z_e___t_y_p_e i) │ │ │ │ │ -392 { │ │ │ │ │ -393 return _I_t_e_r_a_t_o_r(this->p, columns_, std::min(i,rows_)); │ │ │ │ │ -394 } │ │ │ │ │ -395 │ │ │ │ │ -_3_9_7 _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 │ │ │ │ │ -398 { │ │ │ │ │ -399 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, std::min(i,rows_)); │ │ │ │ │ -400 } │ │ │ │ │ -401 │ │ │ │ │ -_4_0_3 class _C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -404 { │ │ │ │ │ -405 public: │ │ │ │ │ -_4_0_7 _C_o_n_s_t_I_t_e_r_a_t_o_r () │ │ │ │ │ -408 : window_(nullptr,0) │ │ │ │ │ -409 { │ │ │ │ │ -410 i = 0; │ │ │ │ │ -411 } │ │ │ │ │ -412 │ │ │ │ │ -_4_1_4 _C_o_n_s_t_I_t_e_r_a_t_o_r (const B* data, _s_i_z_e___t_y_p_e columns, _s_i_z_e___t_y_p_e _i) │ │ │ │ │ -415 : i(_i), │ │ │ │ │ -416 window_(const_cast(data + _i * columns), columns) │ │ │ │ │ -417 {} │ │ │ │ │ -418 │ │ │ │ │ -_4_2_0 _C_o_n_s_t_I_t_e_r_a_t_o_r (const _I_t_e_r_a_t_o_r& it) │ │ │ │ │ -421 : i(it.i), window_(it.window_.getptr(),it.window_.getsize()) │ │ │ │ │ -422 {} │ │ │ │ │ -423 │ │ │ │ │ -_4_2_4 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r&& other) │ │ │ │ │ -425 { │ │ │ │ │ -426 i = other.i; │ │ │ │ │ -427 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ -not just the window! │ │ │ │ │ -428 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ -429 return *this; │ │ │ │ │ -430 } │ │ │ │ │ -431 │ │ │ │ │ -_4_3_2 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(_I_t_e_r_a_t_o_r& other) │ │ │ │ │ -433 { │ │ │ │ │ -434 i = other.i; │ │ │ │ │ -435 // Do NOT use window_.operator=, because that copies the window content, │ │ │ │ │ -not just the window! │ │ │ │ │ -436 window_.set(other.window_.getsize(),other.window_.getptr()); │ │ │ │ │ -437 return *this; │ │ │ │ │ -438 } │ │ │ │ │ -439 │ │ │ │ │ -_4_4_1 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ │ -442 { │ │ │ │ │ -443 ++i; │ │ │ │ │ -444 window_.setptr(window_.getptr()+window_.getsize()); │ │ │ │ │ -445 return *this; │ │ │ │ │ -446 } │ │ │ │ │ -447 │ │ │ │ │ -_4_4_9 _C_o_n_s_t_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_-_-() │ │ │ │ │ -450 { │ │ │ │ │ -451 --i; │ │ │ │ │ -452 window_.setptr(window_.getptr()-window_.getsize()); │ │ │ │ │ -453 return *this; │ │ │ │ │ -454 } │ │ │ │ │ -455 │ │ │ │ │ -_4_5_7 bool _o_p_e_r_a_t_o_r_=_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -458 { │ │ │ │ │ -459 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ -460 } │ │ │ │ │ -461 │ │ │ │ │ -_4_6_3 bool _o_p_e_r_a_t_o_r_!_=_ (const _C_o_n_s_t_I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -464 { │ │ │ │ │ -465 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ -466 } │ │ │ │ │ -467 │ │ │ │ │ -_4_6_9 bool _o_p_e_r_a_t_o_r_=_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -470 { │ │ │ │ │ -471 return window_.getptr() == it.window_.getptr(); │ │ │ │ │ -472 } │ │ │ │ │ -473 │ │ │ │ │ -_4_7_5 bool _o_p_e_r_a_t_o_r_!_=_ (const _I_t_e_r_a_t_o_r& it) const │ │ │ │ │ -476 { │ │ │ │ │ -477 return window_.getptr() != it.window_.getptr(); │ │ │ │ │ -478 } │ │ │ │ │ -479 │ │ │ │ │ -_4_8_1 const _w_i_n_d_o_w___t_y_p_e& _o_p_e_r_a_t_o_r_*_ () const │ │ │ │ │ -482 { │ │ │ │ │ -483 return window_; │ │ │ │ │ -484 } │ │ │ │ │ -485 │ │ │ │ │ -_4_8_7 const _w_i_n_d_o_w___t_y_p_e* _o_p_e_r_a_t_o_r_-_>_ () const │ │ │ │ │ -488 { │ │ │ │ │ -489 return &window_; │ │ │ │ │ -490 } │ │ │ │ │ -491 │ │ │ │ │ -492 // return index corresponding to pointer │ │ │ │ │ -_4_9_3 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ │ +339 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ +340 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ +341 │ │ │ │ │ +342 // compute residual norm │ │ │ │ │ +343 _B_l_o_c_k_V_e_c_t_o_r r(x); │ │ │ │ │ +344 _R_e_a_l* Ax_raw = new _R_e_a_l[nrows]; │ │ │ │ │ +345 A.multMv(x_raw,Ax_raw); │ │ │ │ │ +346 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r); │ │ │ │ │ +347 r.axpy(-lambda,x); │ │ │ │ │ +348 const _R_e_a_l r_norm = r.two_norm(); │ │ │ │ │ +349 │ │ │ │ │ +350 // print verbosity information │ │ │ │ │ +351 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +352 { │ │ │ │ │ +353 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +354 { │ │ │ │ │ +355 // print some information about the problem │ │ │ │ │ +356 std::cout << _b_l_a_n_k__ << "Obtained eigenvalues of A by solving " │ │ │ │ │ +357 << "A*x = λ*x using the ARPACK++ class ARSym" │ │ │ │ │ +358 << "StdEig:" << std::endl; │ │ │ │ │ +359 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A: " │ │ │ │ │ +360 << nconv << " / " << nev << std::endl; │ │ │ │ │ +361 std::cout << _b_l_a_n_k__ << " dominant eigenvalue of A: " │ │ │ │ │ +362 << lambda << std::endl; │ │ │ │ │ +363 } │ │ │ │ │ +364 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +365 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +366 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +367 << "λ = " << lambda << std::endl; │ │ │ │ │ +368 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ +369 { │ │ │ │ │ +370 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ +371 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ +372 } │ │ │ │ │ +373 } │ │ │ │ │ +374 │ │ │ │ │ +375 // free dynamically allocated memory │ │ │ │ │ +376 delete[] Ax_raw; │ │ │ │ │ +377 delete[] ev; │ │ │ │ │ +378 } │ │ │ │ │ +379 │ │ │ │ │ +_3_9_1 inline void _c_o_m_p_u_t_e_S_y_m_M_i_n_M_a_g_n_i_t_u_d_e (const _R_e_a_l& epsilon, │ │ │ │ │ +392 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ +393 { │ │ │ │ │ +394 // print verbosity information │ │ │ │ │ +395 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +396 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ +397 << "least dominant eigenvalue of a matrix which " │ │ │ │ │ +398 << "is assumed to be symmetric." << std::endl; │ │ │ │ │ +399 │ │ │ │ │ +400 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ +401 // and to perform the product A*v (LU decomposition is not used) │ │ │ │ │ +402 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ +403 WrappedMatrix A(_m__); │ │ │ │ │ +404 │ │ │ │ │ +405 // get number of rows and columns in A │ │ │ │ │ +406 const int nrows = A.nrows(); │ │ │ │ │ +407 const int ncols = A.ncols(); │ │ │ │ │ +408 │ │ │ │ │ +409 // assert that A is square │ │ │ │ │ +410 if (nrows != ncols) │ │ │ │ │ +411 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ +412 << nrows << "x" << ncols << ")."); │ │ │ │ │ +413 │ │ │ │ │ +414 // allocate memory for variables, set parameters │ │ │ │ │ +415 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ +416 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ +each iteration (0 == auto) │ │ │ │ │ +417 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ +values) (0 == machine precision) │ │ │ │ │ +418 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ +iterations allowed (0 == 100*nev) │ │ │ │ │ +419 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A │ │ │ │ │ +420 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ +determined │ │ │ │ │ +421 int nconv; // Number of converged eigenvalues │ │ │ │ │ +422 │ │ │ │ │ +423 // define what we need: eigenvalues with smallest magnitude │ │ │ │ │ +424 char which[] = "SM"; │ │ │ │ │ +425 ARSymStdEig │ │ │ │ │ +426 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit); │ │ │ │ │ +427 │ │ │ │ │ +428 // set ARPACK verbosity mode if requested │ │ │ │ │ +429 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ +430 │ │ │ │ │ +431 // find eigenvalues and eigenvectors of A, obtain the eigenvalues │ │ │ │ │ +432 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ +433 │ │ │ │ │ +434 // obtain approximated least dominant eigenvalue of A │ │ │ │ │ +435 lambda = ev[nev-1]; │ │ │ │ │ +436 │ │ │ │ │ +437 // obtain associated approximated eigenvector of A │ │ │ │ │ +438 _R_e_a_l* x_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ +439 WrappedMatrix::arrayToDomainBlockVector(x_raw,x); │ │ │ │ │ +440 │ │ │ │ │ +441 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ +442 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ +443 │ │ │ │ │ +444 // compute residual norm │ │ │ │ │ +445 _B_l_o_c_k_V_e_c_t_o_r r(x); │ │ │ │ │ +446 _R_e_a_l* Ax_raw = new _R_e_a_l[nrows]; │ │ │ │ │ +447 A.multMv(x_raw,Ax_raw); │ │ │ │ │ +448 WrappedMatrix::arrayToDomainBlockVector(Ax_raw,r); │ │ │ │ │ +449 r.axpy(-lambda,x); │ │ │ │ │ +450 const _R_e_a_l r_norm = r.two_norm(); │ │ │ │ │ +451 │ │ │ │ │ +452 // print verbosity information │ │ │ │ │ +453 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +454 { │ │ │ │ │ +455 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +456 { │ │ │ │ │ +457 // print some information about the problem │ │ │ │ │ +458 std::cout << _b_l_a_n_k__ << "Obtained eigenvalues of A by solving " │ │ │ │ │ +459 << "A*x = λ*x using the ARPACK++ class ARSym" │ │ │ │ │ +460 << "StdEig:" << std::endl; │ │ │ │ │ +461 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A: " │ │ │ │ │ +462 << nconv << " / " << nev << std::endl; │ │ │ │ │ +463 std::cout << _b_l_a_n_k__ << " least dominant eigenvalue of A: " │ │ │ │ │ +464 << lambda << std::endl; │ │ │ │ │ +465 } │ │ │ │ │ +466 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +467 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +468 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +469 << "λ = " << lambda << std::endl; │ │ │ │ │ +470 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ +471 { │ │ │ │ │ +472 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ +473 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ +474 } │ │ │ │ │ +475 } │ │ │ │ │ +476 │ │ │ │ │ +477 // free dynamically allocated memory │ │ │ │ │ +478 delete[] Ax_raw; │ │ │ │ │ +479 delete[] ev; │ │ │ │ │ +480 } │ │ │ │ │ +481 │ │ │ │ │ +_4_9_3 inline void _c_o_m_p_u_t_e_S_y_m_C_o_n_d_2 (const _R_e_a_l& epsilon, _R_e_a_l& cond_2) const │ │ │ │ │ 494 { │ │ │ │ │ -495 return i; │ │ │ │ │ -496 } │ │ │ │ │ -497 │ │ │ │ │ -_4_9_8 friend class _I_t_e_r_a_t_o_r; │ │ │ │ │ -499 │ │ │ │ │ -500 private: │ │ │ │ │ -501 _s_i_z_e___t_y_p_e i; │ │ │ │ │ -502 mutable _w_i_n_d_o_w___t_y_p_e window_; │ │ │ │ │ -503 }; │ │ │ │ │ -504 │ │ │ │ │ -_5_0_6 using _i_t_e_r_a_t_o_r = _I_t_e_r_a_t_o_r; │ │ │ │ │ -507 │ │ │ │ │ -_5_0_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; │ │ │ │ │ -510 │ │ │ │ │ -_5_1_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ -513 { │ │ │ │ │ -514 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, 0); │ │ │ │ │ -515 } │ │ │ │ │ -516 │ │ │ │ │ -_5_1_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ -519 { │ │ │ │ │ -520 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, rows_); │ │ │ │ │ -521 } │ │ │ │ │ -522 │ │ │ │ │ -_5_2_5 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ -526 { │ │ │ │ │ -527 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, rows_-1); │ │ │ │ │ -528 } │ │ │ │ │ -529 │ │ │ │ │ -_5_3_1 _C_o_n_s_t_I_t_e_r_a_t_o_r _r_e_n_d () const │ │ │ │ │ -532 { │ │ │ │ │ -533 return _C_o_n_s_t_I_t_e_r_a_t_o_r(this->p, columns_, -1); │ │ │ │ │ -534 } │ │ │ │ │ -535 │ │ │ │ │ -536 //===== sizes │ │ │ │ │ -537 │ │ │ │ │ -_5_3_9 _s_i_z_e___t_y_p_e _N () const │ │ │ │ │ -540 { │ │ │ │ │ -541 return rows_; │ │ │ │ │ -542 } │ │ │ │ │ -543 │ │ │ │ │ -544 │ │ │ │ │ -545 private: │ │ │ │ │ -546 _s_i_z_e___t_y_p_e rows_; // number of matrix rows │ │ │ │ │ -547 _s_i_z_e___t_y_p_e columns_; // number of matrix columns │ │ │ │ │ +495 // print verbosity information │ │ │ │ │ +496 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +497 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ +498 << "spectral condition number of a matrix which " │ │ │ │ │ +499 << "is assumed to be symmetric." << std::endl; │ │ │ │ │ +500 │ │ │ │ │ +501 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ +502 // and to perform the product A*v (LU decomposition is not used) │ │ │ │ │ +503 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ +504 WrappedMatrix A(_m__); │ │ │ │ │ +505 │ │ │ │ │ +506 // get number of rows and columns in A │ │ │ │ │ +507 const int nrows = A.nrows(); │ │ │ │ │ +508 const int ncols = A.ncols(); │ │ │ │ │ +509 │ │ │ │ │ +510 // assert that A is square │ │ │ │ │ +511 if (nrows != ncols) │ │ │ │ │ +512 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ +513 << nrows << "x" << ncols << ")."); │ │ │ │ │ +514 │ │ │ │ │ +515 // allocate memory for variables, set parameters │ │ │ │ │ +516 const int nev = 2; // Number of eigenvalues to compute │ │ │ │ │ +517 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ +each iteration (0 == auto) │ │ │ │ │ +518 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ +values) (0 == machine precision) │ │ │ │ │ +519 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ +iterations allowed (0 == 100*nev) │ │ │ │ │ +520 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A │ │ │ │ │ +521 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ +determined │ │ │ │ │ +522 int nconv; // Number of converged eigenvalues │ │ │ │ │ +523 │ │ │ │ │ +524 // define what we need: eigenvalues from both ends of the spectrum │ │ │ │ │ +525 char which[] = "BE"; │ │ │ │ │ +526 ARSymStdEig │ │ │ │ │ +527 dprob(nrows, nev, &A, &WrappedMatrix::multMv, which, ncv, tol, maxit); │ │ │ │ │ +528 │ │ │ │ │ +529 // set ARPACK verbosity mode if requested │ │ │ │ │ +530 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ +531 │ │ │ │ │ +532 // find eigenvalues and eigenvectors of A, obtain the eigenvalues │ │ │ │ │ +533 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ +534 │ │ │ │ │ +535 // obtain approximated dominant and least dominant eigenvalue of A │ │ │ │ │ +536 const _R_e_a_l& lambda_max = ev[nev-1]; │ │ │ │ │ +537 const _R_e_a_l& lambda_min = ev[0]; │ │ │ │ │ +538 │ │ │ │ │ +539 // obtain associated approximated eigenvectors of A │ │ │ │ │ +540 _R_e_a_l* x_max_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ +541 _R_e_a_l* x_min_raw = dprob.RawEigenvector(0); │ │ │ │ │ +542 │ │ │ │ │ +543 // obtain approximated spectral condition number of A │ │ │ │ │ +544 cond_2 = std::abs(lambda_max / lambda_min); │ │ │ │ │ +545 │ │ │ │ │ +546 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ +547 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ 548 │ │ │ │ │ -549 A allocator_; │ │ │ │ │ -550 }; │ │ │ │ │ -551 │ │ │ │ │ -552} // namespace MatrixImp │ │ │ │ │ -553 │ │ │ │ │ -559 template > │ │ │ │ │ -_5_6_0 class _M_a_t_r_i_x │ │ │ │ │ -561 { │ │ │ │ │ -562 public: │ │ │ │ │ +549 // compute each residual norm │ │ │ │ │ +550 _R_e_a_l* Ax_max_raw = new _R_e_a_l[nrows]; │ │ │ │ │ +551 _R_e_a_l* Ax_min_raw = new _R_e_a_l[nrows]; │ │ │ │ │ +552 A.multMv(x_max_raw,Ax_max_raw); │ │ │ │ │ +553 A.multMv(x_min_raw,Ax_min_raw); │ │ │ │ │ +554 _R_e_a_l r_max_norm = 0.0; │ │ │ │ │ +555 _R_e_a_l r_min_norm = 0.0; │ │ │ │ │ +556 for (int i = 0; i < nrows; ++i) │ │ │ │ │ +557 { │ │ │ │ │ +558 r_max_norm += std::pow(Ax_max_raw[i] - lambda_max * x_max_raw[i],2); │ │ │ │ │ +559 r_min_norm += std::pow(Ax_min_raw[i] - lambda_min * x_min_raw[i],2); │ │ │ │ │ +560 } │ │ │ │ │ +561 r_max_norm = std::sqrt(r_max_norm); │ │ │ │ │ +562 r_min_norm = std::sqrt(r_min_norm); │ │ │ │ │ 563 │ │ │ │ │ -_5_6_5 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ -566 │ │ │ │ │ -_5_6_8 typedef T _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -569 │ │ │ │ │ -_5_7_1 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ -572 │ │ │ │ │ -_5_7_4 typedef typename _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_>_:_:_w_i_n_d_o_w___t_y_p_e _r_o_w___t_y_p_e; │ │ │ │ │ -575 │ │ │ │ │ -_5_7_7 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ -578 │ │ │ │ │ -_5_8_0 typedef typename _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ -581 │ │ │ │ │ -_5_8_3 typedef typename row_type::iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -584 │ │ │ │ │ -_5_8_6 typedef typename _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_>_:_:_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; │ │ │ │ │ -587 │ │ │ │ │ -_5_8_9 typedef typename row_type::const_iterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ -590 │ │ │ │ │ -592 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ -2.8.")]] │ │ │ │ │ -_5_9_3 static constexpr auto _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ -594 │ │ │ │ │ -_5_9_6 _M_a_t_r_i_x() : _d_a_t_a__(0,0), _c_o_l_s__(0) │ │ │ │ │ -597 {} │ │ │ │ │ -598 │ │ │ │ │ -_6_0_1 _M_a_t_r_i_x(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e cols) : _d_a_t_a__(rows,cols), _c_o_l_s__(cols) │ │ │ │ │ -602 {} │ │ │ │ │ -603 │ │ │ │ │ -_6_0_8 void _s_e_t_S_i_z_e(_s_i_z_e___t_y_p_e rows, _s_i_z_e___t_y_p_e cols) { │ │ │ │ │ -609 _d_a_t_a__.resize(rows,cols); │ │ │ │ │ -610 _c_o_l_s__ = cols; │ │ │ │ │ -611 } │ │ │ │ │ -612 │ │ │ │ │ -_6_1_4 _R_o_w_I_t_e_r_a_t_o_r _b_e_g_i_n() │ │ │ │ │ -615 { │ │ │ │ │ -616 return _d_a_t_a__.begin(); │ │ │ │ │ -617 } │ │ │ │ │ -618 │ │ │ │ │ -_6_2_0 _R_o_w_I_t_e_r_a_t_o_r _e_n_d() │ │ │ │ │ -621 { │ │ │ │ │ -622 return _d_a_t_a__.end(); │ │ │ │ │ -623 } │ │ │ │ │ -624 │ │ │ │ │ -_6_2_7 _R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ -628 { │ │ │ │ │ -629 return _d_a_t_a__.beforeEnd(); │ │ │ │ │ -630 } │ │ │ │ │ -631 │ │ │ │ │ -_6_3_4 _R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ -635 { │ │ │ │ │ -636 return _d_a_t_a__.beforeBegin(); │ │ │ │ │ -637 } │ │ │ │ │ -638 │ │ │ │ │ -_6_4_0 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _b_e_g_i_n() const │ │ │ │ │ -641 { │ │ │ │ │ -642 return _d_a_t_a__.begin(); │ │ │ │ │ -643 } │ │ │ │ │ -644 │ │ │ │ │ -_6_4_6 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _e_n_d() const │ │ │ │ │ -647 { │ │ │ │ │ -648 return _d_a_t_a__.end(); │ │ │ │ │ -649 } │ │ │ │ │ -650 │ │ │ │ │ -_6_5_3 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ -654 { │ │ │ │ │ -655 return _d_a_t_a__.beforeEnd(); │ │ │ │ │ -656 } │ │ │ │ │ -657 │ │ │ │ │ -_6_6_0 _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ │ -661 { │ │ │ │ │ -662 return _d_a_t_a__.beforeBegin(); │ │ │ │ │ -663 } │ │ │ │ │ -664 │ │ │ │ │ -_6_6_6 _M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& t) │ │ │ │ │ -667 { │ │ │ │ │ -668 _d_a_t_a__ = t; │ │ │ │ │ -669 return *this; │ │ │ │ │ -670 } │ │ │ │ │ -671 │ │ │ │ │ -_6_7_3 _r_o_w___t_y_p_e _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e row) { │ │ │ │ │ -674#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -675 if (row<0) │ │ │ │ │ -676 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Can't access negative rows!"); │ │ │ │ │ -677 if (row>=_N()) │ │ │ │ │ -678 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Row index out of range!"); │ │ │ │ │ -679#endif │ │ │ │ │ -680 return _d_a_t_a__[row]; │ │ │ │ │ -681 } │ │ │ │ │ -682 │ │ │ │ │ -_6_8_4 const _r_o_w___t_y_p_e _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e row) const { │ │ │ │ │ -685#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -686 if (row<0) │ │ │ │ │ -687 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Can't access negative rows!"); │ │ │ │ │ -688 if (row>=_N()) │ │ │ │ │ -689 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Row index out of range!"); │ │ │ │ │ -690#endif │ │ │ │ │ -691 return _d_a_t_a__[row]; │ │ │ │ │ -692 } │ │ │ │ │ -693 │ │ │ │ │ -_6_9_5 _s_i_z_e___t_y_p_e _N() const { │ │ │ │ │ -696 return _d_a_t_a__.N(); │ │ │ │ │ -697 } │ │ │ │ │ -698 │ │ │ │ │ -_7_0_0 _s_i_z_e___t_y_p_e _M() const { │ │ │ │ │ -701 return _c_o_l_s__; │ │ │ │ │ -702 } │ │ │ │ │ -703 │ │ │ │ │ -_7_0_5 _M_a_t_r_i_x_<_T_>& _o_p_e_r_a_t_o_r_*_=(const _f_i_e_l_d___t_y_p_e& scalar) { │ │ │ │ │ -706 _d_a_t_a__ *= scalar; │ │ │ │ │ -707 return (*this); │ │ │ │ │ -708 } │ │ │ │ │ -709 │ │ │ │ │ -_7_1_1 _M_a_t_r_i_x_<_T_>& _o_p_e_r_a_t_o_r_/_=(const _f_i_e_l_d___t_y_p_e& scalar) { │ │ │ │ │ -712 _d_a_t_a__ /= scalar; │ │ │ │ │ -713 return (*this); │ │ │ │ │ -714 } │ │ │ │ │ -715 │ │ │ │ │ -_7_2_1 _M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _M_a_t_r_i_x& b) { │ │ │ │ │ -722#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -723 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ -724 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ -725#endif │ │ │ │ │ -726 _d_a_t_a__ += b._d_a_t_a__; │ │ │ │ │ -727 return (*this); │ │ │ │ │ -728 } │ │ │ │ │ +564 // print verbosity information │ │ │ │ │ +565 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +566 { │ │ │ │ │ +567 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +568 { │ │ │ │ │ +569 // print some information about the problem │ │ │ │ │ +570 std::cout << _b_l_a_n_k__ << "Obtained eigenvalues of A by solving " │ │ │ │ │ +571 << "A*x = λ*x using the ARPACK++ class ARSym" │ │ │ │ │ +572 << "StdEig:" << std::endl; │ │ │ │ │ +573 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A: " │ │ │ │ │ +574 << nconv << " / " << nev << std::endl; │ │ │ │ │ +575 std::cout << _b_l_a_n_k__ << " dominant eigenvalue of A: " │ │ │ │ │ +576 << lambda_max << std::endl; │ │ │ │ │ +577 std::cout << _b_l_a_n_k__ << " least dominant eigenvalue of A: " │ │ │ │ │ +578 << lambda_min << std::endl; │ │ │ │ │ +579 std::cout << _b_l_a_n_k__ << " spectral condition number of A: " │ │ │ │ │ +580 << cond_2 << std::endl; │ │ │ │ │ +581 } │ │ │ │ │ +582 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +583 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +584 << "║residual║_2 = {" << r_max_norm << "," │ │ │ │ │ +585 << r_min_norm << "}, " << "λ = {" │ │ │ │ │ +586 << lambda_max << "," << lambda_min │ │ │ │ │ +587 << "}): cond_2 = " << cond_2 << std::endl; │ │ │ │ │ +588 } │ │ │ │ │ +589 │ │ │ │ │ +590 // free dynamically allocated memory │ │ │ │ │ +591 delete[] Ax_min_raw; │ │ │ │ │ +592 delete[] Ax_max_raw; │ │ │ │ │ +593 delete[] ev; │ │ │ │ │ +594 } │ │ │ │ │ +595 │ │ │ │ │ +_6_0_9 inline void _c_o_m_p_u_t_e_N_o_n_S_y_m_M_a_x (const _R_e_a_l& epsilon, │ │ │ │ │ +610 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& sigma) const │ │ │ │ │ +611 { │ │ │ │ │ +612 // print verbosity information │ │ │ │ │ +613 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +614 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ +615 << "largest singular value of a matrix which " │ │ │ │ │ +616 << "is assumed to be nonsymmetric." << std::endl; │ │ │ │ │ +617 │ │ │ │ │ +618 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ +619 // and to perform the product A^T*A*v (LU decomposition is not used) │ │ │ │ │ +620 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ +621 WrappedMatrix A(_m__); │ │ │ │ │ +622 │ │ │ │ │ +623 // get number of rows and columns in A │ │ │ │ │ +624 const int nrows = A.nrows(); │ │ │ │ │ +625 const int ncols = A.ncols(); │ │ │ │ │ +626 │ │ │ │ │ +627 // assert that A has more rows than columns (extend code later to the │ │ │ │ │ +opposite case!) │ │ │ │ │ +628 if (nrows < ncols) │ │ │ │ │ +629 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix has less rows than " │ │ │ │ │ +630 << "columns (" << nrows << "x" << ncols << ")." │ │ │ │ │ +631 << " This case is not implemented, yet."); │ │ │ │ │ +632 │ │ │ │ │ +633 // allocate memory for variables, set parameters │ │ │ │ │ +634 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ +635 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ +each iteration (0 == auto) │ │ │ │ │ +636 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ +values) (0 == machine precision) │ │ │ │ │ +637 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ +iterations allowed (0 == 100*nev) │ │ │ │ │ +638 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A^T*A │ │ │ │ │ +639 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ +determined │ │ │ │ │ +640 int nconv; // Number of converged eigenvalues │ │ │ │ │ +641 │ │ │ │ │ +642 // define what we need: eigenvalues with largest algebraic value │ │ │ │ │ +643 char which[] = "LA"; │ │ │ │ │ +644 ARSymStdEig │ │ │ │ │ +645 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit); │ │ │ │ │ +646 │ │ │ │ │ +647 // set ARPACK verbosity mode if requested │ │ │ │ │ +648 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ +649 │ │ │ │ │ +650 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues │ │ │ │ │ +651 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ +652 │ │ │ │ │ +653 // obtain approximated largest eigenvalue of A^T*A │ │ │ │ │ +654 const _R_e_a_l& lambda = ev[nev-1]; │ │ │ │ │ +655 │ │ │ │ │ +656 // obtain associated approximated eigenvector of A^T*A │ │ │ │ │ +657 _R_e_a_l* x_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ +658 WrappedMatrix::arrayToDomainBlockVector(x_raw,x); │ │ │ │ │ +659 │ │ │ │ │ +660 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ +661 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ +662 │ │ │ │ │ +663 // compute residual norm │ │ │ │ │ +664 _B_l_o_c_k_V_e_c_t_o_r r(x); │ │ │ │ │ +665 _R_e_a_l* AtAx_raw = new _R_e_a_l[ncols]; │ │ │ │ │ +666 A.multMtMv(x_raw,AtAx_raw); │ │ │ │ │ +667 WrappedMatrix::arrayToDomainBlockVector(AtAx_raw,r); │ │ │ │ │ +668 r.axpy(-lambda,x); │ │ │ │ │ +669 const _R_e_a_l r_norm = r.two_norm(); │ │ │ │ │ +670 │ │ │ │ │ +671 // calculate largest singular value of A (note that │ │ │ │ │ +672 // x is right-singular / left-singular vector of A) │ │ │ │ │ +673 sigma = std::sqrt(lambda); │ │ │ │ │ +674 │ │ │ │ │ +675 // print verbosity information │ │ │ │ │ +676 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +677 { │ │ │ │ │ +678 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +679 { │ │ │ │ │ +680 // print some information about the problem │ │ │ │ │ +681 std::cout << _b_l_a_n_k__ << "Obtained singular values of A by sol" │ │ │ │ │ +682 << "ving (A^T*A)*x = σ²*x using the ARPACK++ " │ │ │ │ │ +683 << "class ARSymStdEig:" << std::endl; │ │ │ │ │ +684 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A^T*A: " │ │ │ │ │ +685 << nconv << " / " << nev << std::endl; │ │ │ │ │ +686 std::cout << _b_l_a_n_k__ << " largest eigenvalue of A^T*A: " │ │ │ │ │ +687 << lambda << std::endl; │ │ │ │ │ +688 std::cout << _b_l_a_n_k__ << " => largest singular value of A: " │ │ │ │ │ +689 << sigma << std::endl; │ │ │ │ │ +690 } │ │ │ │ │ +691 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +692 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +693 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +694 << "σ = " << sigma << std::endl; │ │ │ │ │ +695 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ +696 { │ │ │ │ │ +697 // print approximated right-singular / left-singular vector │ │ │ │ │ +698 // via DUNE-ISTL I/O methods │ │ │ │ │ +699 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ +700 } │ │ │ │ │ +701 } │ │ │ │ │ +702 │ │ │ │ │ +703 // free dynamically allocated memory │ │ │ │ │ +704 delete[] AtAx_raw; │ │ │ │ │ +705 delete[] ev; │ │ │ │ │ +706 } │ │ │ │ │ +707 │ │ │ │ │ +_7_2_1 inline void _c_o_m_p_u_t_e_N_o_n_S_y_m_M_i_n (const _R_e_a_l& epsilon, │ │ │ │ │ +722 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& sigma) const │ │ │ │ │ +723 { │ │ │ │ │ +724 // print verbosity information │ │ │ │ │ +725 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +726 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ +727 << "smallest singular value of a matrix which " │ │ │ │ │ +728 << "is assumed to be nonsymmetric." << std::endl; │ │ │ │ │ 729 │ │ │ │ │ -_7_3_5 _M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _M_a_t_r_i_x& b) { │ │ │ │ │ -736#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -737 if(_N()!=b._N() || _M() != b._M()) │ │ │ │ │ -738 DUNE_THROW(RangeError, "Matrix sizes do not match!"); │ │ │ │ │ -739#endif │ │ │ │ │ -740 _d_a_t_a__ -= b._d_a_t_a__; │ │ │ │ │ -741 return (*this); │ │ │ │ │ -742 } │ │ │ │ │ -743 │ │ │ │ │ -_7_4_5 _M_a_t_r_i_x _t_r_a_n_s_p_o_s_e() const { │ │ │ │ │ -746 _M_a_t_r_i_x out(_M(), _N()); │ │ │ │ │ -747 for (_s_i_z_e___t_y_p_e i=0; i<_N(); i++) │ │ │ │ │ -748 for (_s_i_z_e___t_y_p_e j=0; j<_M(); j++) │ │ │ │ │ -749 out[j][i] = (*this)[i][j]; │ │ │ │ │ -750 │ │ │ │ │ -751 return out; │ │ │ │ │ -752 } │ │ │ │ │ +730 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ +731 // and to perform the product A^T*A*v (LU decomposition is not used) │ │ │ │ │ +732 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ +733 WrappedMatrix A(_m__); │ │ │ │ │ +734 │ │ │ │ │ +735 // get number of rows and columns in A │ │ │ │ │ +736 const int nrows = A.nrows(); │ │ │ │ │ +737 const int ncols = A.ncols(); │ │ │ │ │ +738 │ │ │ │ │ +739 // assert that A has more rows than columns (extend code later to the │ │ │ │ │ +opposite case!) │ │ │ │ │ +740 if (nrows < ncols) │ │ │ │ │ +741 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix has less rows than " │ │ │ │ │ +742 << "columns (" << nrows << "x" << ncols << ")." │ │ │ │ │ +743 << " This case is not implemented, yet."); │ │ │ │ │ +744 │ │ │ │ │ +745 // allocate memory for variables, set parameters │ │ │ │ │ +746 const int nev = 1; // Number of eigenvalues to compute │ │ │ │ │ +747 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ +each iteration (0 == auto) │ │ │ │ │ +748 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ +values) (0 == machine precision) │ │ │ │ │ +749 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ +iterations allowed (0 == 100*nev) │ │ │ │ │ +750 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A^T*A │ │ │ │ │ +751 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ +determined │ │ │ │ │ +752 int nconv; // Number of converged eigenvalues │ │ │ │ │ 753 │ │ │ │ │ -_7_5_5 friend _M_a_t_r_i_x_<_T_> _o_p_e_r_a_t_o_r_*(const _M_a_t_r_i_x_<_T_>& m1, const _M_a_t_r_i_x_<_T_>& m2) { │ │ │ │ │ -756 _M_a_t_r_i_x_<_T_> out(m1._N(), m2._M()); │ │ │ │ │ -757 out = 0; │ │ │ │ │ +754 // define what we need: eigenvalues with smallest algebraic value │ │ │ │ │ +755 char which[] = "SA"; │ │ │ │ │ +756 ARSymStdEig │ │ │ │ │ +757 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit); │ │ │ │ │ 758 │ │ │ │ │ -759 for (_s_i_z_e___t_y_p_e i=0; i 3) dprob.Trace(); │ │ │ │ │ +761 │ │ │ │ │ +762 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues │ │ │ │ │ +763 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ 764 │ │ │ │ │ -765 return out; │ │ │ │ │ -766 } │ │ │ │ │ +765 // obtain approximated smallest eigenvalue of A^T*A │ │ │ │ │ +766 const _R_e_a_l& lambda = ev[nev-1]; │ │ │ │ │ 767 │ │ │ │ │ -769 template │ │ │ │ │ -_7_7_0 friend Y _o_p_e_r_a_t_o_r_*(const _M_a_t_r_i_x_<_T_>& m, const X& vec) { │ │ │ │ │ -771#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -772 if (m._M()!=vec.size()) │ │ │ │ │ -773 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Vector size doesn't match the number of matrix │ │ │ │ │ -columns!"); │ │ │ │ │ -774#endif │ │ │ │ │ -775 Y out(m._N()); │ │ │ │ │ -776 out = 0; │ │ │ │ │ -777 │ │ │ │ │ -778 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_7_8_8 void _m_v(const X& x, Y& y) const │ │ │ │ │ +783 // calculate smallest singular value of A (note that │ │ │ │ │ +784 // x is right-singular / left-singular vector of A) │ │ │ │ │ +785 sigma = std::sqrt(lambda); │ │ │ │ │ +786 │ │ │ │ │ +787 // print verbosity information │ │ │ │ │ +788 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ 789 { │ │ │ │ │ -790#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -791 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -792 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -793#endif │ │ │ │ │ -794 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) { │ │ │ │ │ -795 y[i]=0; │ │ │ │ │ -796 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -797 { │ │ │ │ │ -798 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ -799 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ -800 Impl::asMatrix((*this)[i][j]).umv(xj, yi); │ │ │ │ │ -801 } │ │ │ │ │ +790 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +791 { │ │ │ │ │ +792 // print some information about the problem │ │ │ │ │ +793 std::cout << _b_l_a_n_k__ << "Obtained singular values of A by sol" │ │ │ │ │ +794 << "ving (A^T*A)*x = σ²*x using the ARPACK++ " │ │ │ │ │ +795 << "class ARSymStdEig:" << std::endl; │ │ │ │ │ +796 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A^T*A: " │ │ │ │ │ +797 << nconv << " / " << nev << std::endl; │ │ │ │ │ +798 std::cout << _b_l_a_n_k__ << " smallest eigenvalue of A^T*A: " │ │ │ │ │ +799 << lambda << std::endl; │ │ │ │ │ +800 std::cout << _b_l_a_n_k__ << " => smallest singular value of A: " │ │ │ │ │ +801 << sigma << std::endl; │ │ │ │ │ 802 } │ │ │ │ │ -803 } │ │ │ │ │ -804 │ │ │ │ │ -806 template │ │ │ │ │ -_8_0_7 void _m_t_v (const X& x, Y& y) const │ │ │ │ │ +803 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +804 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +805 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +806 << "σ = " << sigma << std::endl; │ │ │ │ │ +807 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ 808 { │ │ │ │ │ -809#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -810 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ -811 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ │ -812#endif │ │ │ │ │ -813 for(_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -_8_2_0 void _u_m_v(const X& x, Y& y) const │ │ │ │ │ -821 { │ │ │ │ │ -822#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -823 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -824 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -825#endif │ │ │ │ │ -826 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -827 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -828 { │ │ │ │ │ -829 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ -830 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ -831 Impl::asMatrix((*this)[i][j]).umv(xj, yi); │ │ │ │ │ -832 } │ │ │ │ │ -833 } │ │ │ │ │ -834 │ │ │ │ │ -836 template │ │ │ │ │ -_8_3_7 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ -838 { │ │ │ │ │ -839#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -840 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -841 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -842#endif │ │ │ │ │ -843 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -844 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -845 { │ │ │ │ │ -846 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ -847 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ -848 Impl::asMatrix((*this)[i][j]).mmv(xj, yi); │ │ │ │ │ -849 } │ │ │ │ │ -850 } │ │ │ │ │ -851 │ │ │ │ │ -853 template │ │ │ │ │ -_8_5_4 void _u_s_m_v(const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ -855 { │ │ │ │ │ -856#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -857 if (x.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -858 if (y.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -859#endif │ │ │ │ │ -860 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -861 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -862 { │ │ │ │ │ -863 auto&& xj = Impl::asVector(x[j]); │ │ │ │ │ -864 auto&& yi = Impl::asVector(y[i]); │ │ │ │ │ -865 Impl::asMatrix((*this)[i][j]).usmv(alpha, xj, yi); │ │ │ │ │ -866 } │ │ │ │ │ -867 } │ │ │ │ │ -868 │ │ │ │ │ -870 template │ │ │ │ │ -_8_7_1 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ -872 { │ │ │ │ │ -873#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -874 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -875 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -876#endif │ │ │ │ │ -877 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -878 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -879 { │ │ │ │ │ -880 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ -881 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ -882 Impl::asMatrix((*this)[i][j]).umtv(xi, yj); │ │ │ │ │ -883 } │ │ │ │ │ -884 } │ │ │ │ │ -885 │ │ │ │ │ -887 template │ │ │ │ │ -_8_8_8 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ -889 { │ │ │ │ │ -890#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -891 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -892 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -893#endif │ │ │ │ │ -894 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -895 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -896 { │ │ │ │ │ -897 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ -898 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ -899 Impl::asMatrix((*this)[i][j]).mmtv(xi, yj); │ │ │ │ │ -900 } │ │ │ │ │ -901 } │ │ │ │ │ +809 // print approximated right-singular / left-singular vector │ │ │ │ │ +810 // via DUNE-ISTL I/O methods │ │ │ │ │ +811 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ +812 } │ │ │ │ │ +813 } │ │ │ │ │ +814 │ │ │ │ │ +815 // free dynamically allocated memory │ │ │ │ │ +816 delete[] AtAx_raw; │ │ │ │ │ +817 delete[] ev; │ │ │ │ │ +818 } │ │ │ │ │ +819 │ │ │ │ │ +_8_3_0 inline void _c_o_m_p_u_t_e_N_o_n_S_y_m_C_o_n_d_2 (const _R_e_a_l& epsilon, _R_e_a_l& cond_2) const │ │ │ │ │ +831 { │ │ │ │ │ +832 // print verbosity information │ │ │ │ │ +833 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +834 std::cout << _t_i_t_l_e__ << "Computing an approximation of the " │ │ │ │ │ +835 << "spectral condition number of a matrix which " │ │ │ │ │ +836 << "is assumed to be nonsymmetric." << std::endl; │ │ │ │ │ +837 │ │ │ │ │ +838 // use type ArPackPlusPlus_BCRSMatrixWrapper to store matrix information │ │ │ │ │ +839 // and to perform the product A^T*A*v (LU decomposition is not used) │ │ │ │ │ +840 typedef Impl::ArPackPlusPlus_BCRSMatrixWrapper WrappedMatrix; │ │ │ │ │ +841 WrappedMatrix A(_m__); │ │ │ │ │ +842 │ │ │ │ │ +843 // get number of rows and columns in A │ │ │ │ │ +844 const int nrows = A.nrows(); │ │ │ │ │ +845 const int ncols = A.ncols(); │ │ │ │ │ +846 │ │ │ │ │ +847 // assert that A has more rows than columns (extend code later to the │ │ │ │ │ +opposite case!) │ │ │ │ │ +848 if (nrows < ncols) │ │ │ │ │ +849 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix has less rows than " │ │ │ │ │ +850 << "columns (" << nrows << "x" << ncols << ")." │ │ │ │ │ +851 << " This case is not implemented, yet."); │ │ │ │ │ +852 │ │ │ │ │ +853 // allocate memory for variables, set parameters │ │ │ │ │ +854 const int nev = 2; // Number of eigenvalues to compute │ │ │ │ │ +855 int ncv = std::min(20, nrows); // Number of Arnoldi vectors generated at │ │ │ │ │ +each iteration (0 == auto) │ │ │ │ │ +856 const _R_e_a_l tol = epsilon; // Stopping tolerance (relative accuracy of Ritz │ │ │ │ │ +values) (0 == machine precision) │ │ │ │ │ +857 const int maxit = _n_I_t_e_r_a_t_i_o_n_s_M_a_x__*nev; // Maximum number of Arnoldi update │ │ │ │ │ +iterations allowed (0 == 100*nev) │ │ │ │ │ +858 _R_e_a_l* ev = new _R_e_a_l[nev]; // Computed eigenvalues of A^T*A │ │ │ │ │ +859 const bool ivec = true; // Flag deciding if eigenvectors shall be │ │ │ │ │ +determined │ │ │ │ │ +860 int nconv; // Number of converged eigenvalues │ │ │ │ │ +861 │ │ │ │ │ +862 // define what we need: eigenvalues from both ends of the spectrum │ │ │ │ │ +863 char which[] = "BE"; │ │ │ │ │ +864 ARSymStdEig │ │ │ │ │ +865 dprob(ncols, nev, &A, &WrappedMatrix::multMtMv, which, ncv, tol, maxit); │ │ │ │ │ +866 │ │ │ │ │ +867 // set ARPACK verbosity mode if requested │ │ │ │ │ +868 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 3) dprob.Trace(); │ │ │ │ │ +869 │ │ │ │ │ +870 // find eigenvalues and eigenvectors of A^T*A, obtain the eigenvalues │ │ │ │ │ +871 nconv = dprob.Eigenvalues(ev,ivec); │ │ │ │ │ +872 │ │ │ │ │ +873 // obtain approximated largest and smallest eigenvalue of A^T*A │ │ │ │ │ +874 const _R_e_a_l& lambda_max = ev[nev-1]; │ │ │ │ │ +875 const _R_e_a_l& lambda_min = ev[0]; │ │ │ │ │ +876 │ │ │ │ │ +877 // obtain associated approximated eigenvectors of A^T*A │ │ │ │ │ +878 _R_e_a_l* x_max_raw = dprob.RawEigenvector(nev-1); │ │ │ │ │ +879 _R_e_a_l* x_min_raw = dprob.RawEigenvector(0); │ │ │ │ │ +880 │ │ │ │ │ +881 // obtain number of Arnoldi update iterations actually taken │ │ │ │ │ +882 _n_I_t_e_r_a_t_i_o_n_s__ = dprob.GetIter(); │ │ │ │ │ +883 │ │ │ │ │ +884 // compute each residual norm │ │ │ │ │ +885 _R_e_a_l* AtAx_max_raw = new _R_e_a_l[ncols]; │ │ │ │ │ +886 _R_e_a_l* AtAx_min_raw = new _R_e_a_l[ncols]; │ │ │ │ │ +887 A.multMtMv(x_max_raw,AtAx_max_raw); │ │ │ │ │ +888 A.multMtMv(x_min_raw,AtAx_min_raw); │ │ │ │ │ +889 _R_e_a_l r_max_norm = 0.0; │ │ │ │ │ +890 _R_e_a_l r_min_norm = 0.0; │ │ │ │ │ +891 for (int i = 0; i < ncols; ++i) │ │ │ │ │ +892 { │ │ │ │ │ +893 r_max_norm += std::pow(AtAx_max_raw[i] - lambda_max * x_max_raw[i],2); │ │ │ │ │ +894 r_min_norm += std::pow(AtAx_min_raw[i] - lambda_min * x_min_raw[i],2); │ │ │ │ │ +895 } │ │ │ │ │ +896 r_max_norm = std::sqrt(r_max_norm); │ │ │ │ │ +897 r_min_norm = std::sqrt(r_min_norm); │ │ │ │ │ +898 │ │ │ │ │ +899 // calculate largest and smallest singular value of A │ │ │ │ │ +900 const _R_e_a_l sigma_max = std::sqrt(lambda_max); │ │ │ │ │ +901 const _R_e_a_l sigma_min = std::sqrt(lambda_min); │ │ │ │ │ 902 │ │ │ │ │ -904 template │ │ │ │ │ -_9_0_5 void _u_s_m_t_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ -906 { │ │ │ │ │ -907#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -908 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -909 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -910#endif │ │ │ │ │ -911 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -912 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -913 { │ │ │ │ │ -914 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ -915 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ -916 Impl::asMatrix((*this)[i][j]).usmtv(alpha, xi, yj); │ │ │ │ │ -917 } │ │ │ │ │ -918 } │ │ │ │ │ -919 │ │ │ │ │ -921 template │ │ │ │ │ -_9_2_2 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ -923 { │ │ │ │ │ -924#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -925 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -926 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -927#endif │ │ │ │ │ -928 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -929 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -930 { │ │ │ │ │ -931 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ -932 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ -933 Impl::asMatrix((*this)[i][j]).umhv(xi,yj); │ │ │ │ │ -934 } │ │ │ │ │ -935 } │ │ │ │ │ -936 │ │ │ │ │ -938 template │ │ │ │ │ -_9_3_9 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ -940 { │ │ │ │ │ -941#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -942 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -943 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -944#endif │ │ │ │ │ -945 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -946 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -947 { │ │ │ │ │ -948 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ -949 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ -950 Impl::asMatrix((*this)[i][j]).mmhv(xi,yj); │ │ │ │ │ -951 } │ │ │ │ │ -952 } │ │ │ │ │ -953 │ │ │ │ │ -955 template │ │ │ │ │ -_9_5_6 void _u_s_m_h_v (const _f_i_e_l_d___t_y_p_e& alpha, const X& x, Y& y) const │ │ │ │ │ -957 { │ │ │ │ │ -958#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -959 if (x.N()!=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -960 if (y.N()!=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"vector/matrix size mismatch!"); │ │ │ │ │ -961#endif │ │ │ │ │ -962 for (_s_i_z_e___t_y_p_e i=0; i<_d_a_t_a__.N(); i++) │ │ │ │ │ -963 for (_s_i_z_e___t_y_p_e j=0; j<_c_o_l_s__; j++) │ │ │ │ │ -964 { │ │ │ │ │ -965 auto&& xi = Impl::asVector(x[i]); │ │ │ │ │ -966 auto&& yj = Impl::asVector(y[j]); │ │ │ │ │ -967 Impl::asMatrix((*this)[i][j]).usmhv(alpha,xi,yj); │ │ │ │ │ -968 } │ │ │ │ │ -969 } │ │ │ │ │ -970 │ │ │ │ │ -971 //===== norms │ │ │ │ │ -972 │ │ │ │ │ -_9_7_4 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ │ -975 { │ │ │ │ │ -976 return std::sqrt(_f_r_o_b_e_n_i_u_s___n_o_r_m_2()); │ │ │ │ │ -977 } │ │ │ │ │ -978 │ │ │ │ │ -_9_8_0 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ -981 { │ │ │ │ │ -982 typename FieldTraits::real_type sum=0; │ │ │ │ │ -983 for (_s_i_z_e___t_y_p_e i=0; i_N(); i++) │ │ │ │ │ -984 for (_s_i_z_e___t_y_p_e j=0; j_M(); j++) │ │ │ │ │ -985 sum += Impl::asMatrix(_d_a_t_a__[i][j]).frobenius_norm2(); │ │ │ │ │ -986 return sum; │ │ │ │ │ -987 } │ │ │ │ │ -988 │ │ │ │ │ -990 template ::value, int>::type = 0> │ │ │ │ │ -_9_9_2 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ -993 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -994 using std::max; │ │ │ │ │ -995 │ │ │ │ │ -996 real_type norm = 0; │ │ │ │ │ -997 for (auto const &x : *this) { │ │ │ │ │ -998 real_type sum = 0; │ │ │ │ │ -999 for (auto const &y : x) │ │ │ │ │ -1000 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ -1001 norm = max(sum, norm); │ │ │ │ │ -1002 isNaN += sum; │ │ │ │ │ -1003 } │ │ │ │ │ -1004 │ │ │ │ │ -1005 return norm; │ │ │ │ │ -1006 } │ │ │ │ │ -1007 │ │ │ │ │ -1009 template ::value, int>::type = 0> │ │ │ │ │ -_1_0_1_1 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ -1012 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1013 using std::max; │ │ │ │ │ -1014 │ │ │ │ │ -1015 real_type norm = 0; │ │ │ │ │ -1016 for (auto const &x : *this) { │ │ │ │ │ -1017 real_type sum = 0; │ │ │ │ │ -1018 for (auto const &y : x) │ │ │ │ │ -1019 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ -1020 norm = max(sum, norm); │ │ │ │ │ -1021 } │ │ │ │ │ -1022 return norm; │ │ │ │ │ -1023 } │ │ │ │ │ -1024 │ │ │ │ │ -1026 template ::value, int>::type = 0> │ │ │ │ │ -_1_0_2_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m() const { │ │ │ │ │ -1029 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1030 using std::max; │ │ │ │ │ -1031 │ │ │ │ │ -1032 real_type norm = 0; │ │ │ │ │ -1033 real_type isNaN = 1; │ │ │ │ │ -1034 for (auto const &x : *this) { │ │ │ │ │ -1035 real_type sum = 0; │ │ │ │ │ -1036 for (auto const &y : x) │ │ │ │ │ -1037 sum += Impl::asMatrix(y).infinity_norm(); │ │ │ │ │ -1038 norm = max(sum, norm); │ │ │ │ │ -1039 isNaN += sum; │ │ │ │ │ -1040 } │ │ │ │ │ -1041 │ │ │ │ │ -1042 return norm * (isNaN / isNaN); │ │ │ │ │ -1043 } │ │ │ │ │ -1044 │ │ │ │ │ -1046 template ::value, int>::type = 0> │ │ │ │ │ -_1_0_4_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const { │ │ │ │ │ -1049 using real_type = typename FieldTraits::real_type; │ │ │ │ │ -1050 using std::max; │ │ │ │ │ -1051 │ │ │ │ │ -1052 real_type norm = 0; │ │ │ │ │ -1053 real_type isNaN = 1; │ │ │ │ │ -1054 for (auto const &x : *this) { │ │ │ │ │ -1055 real_type sum = 0; │ │ │ │ │ -1056 for (auto const &y : x) │ │ │ │ │ -1057 sum += Impl::asMatrix(y).infinity_norm_real(); │ │ │ │ │ -1058 norm = max(sum, norm); │ │ │ │ │ -1059 isNaN += sum; │ │ │ │ │ -1060 } │ │ │ │ │ -1061 │ │ │ │ │ -1062 return norm * (isNaN / isNaN); │ │ │ │ │ -1063 } │ │ │ │ │ -1064 │ │ │ │ │ -1065 //===== query │ │ │ │ │ -1066 │ │ │ │ │ -_1_0_6_8 bool _e_x_i_s_t_s ([[maybe_unused]] _s_i_z_e___t_y_p_e i, [[maybe_unused]] _s_i_z_e___t_y_p_e j) │ │ │ │ │ -const │ │ │ │ │ -1069 { │ │ │ │ │ -1070#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -1071 if (i<0 || i>=_N()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"row index out of range"); │ │ │ │ │ -1072 if (j<0 || i>=_M()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"column index out of range"); │ │ │ │ │ -1073#endif │ │ │ │ │ -1074 return true; │ │ │ │ │ -1075 } │ │ │ │ │ -1076 │ │ │ │ │ -1077 protected: │ │ │ │ │ -1078 │ │ │ │ │ -_1_0_8_1 _M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_<_T_,_A_> _d_a_t_a__; │ │ │ │ │ -1082 │ │ │ │ │ -_1_0_8_8 _s_i_z_e___t_y_p_e _c_o_l_s__; │ │ │ │ │ -1089 }; │ │ │ │ │ -1090 │ │ │ │ │ -1091 template │ │ │ │ │ -_1_0_9_2 struct FieldTraits< _M_a_t_r_i_x > │ │ │ │ │ -1093 { │ │ │ │ │ -_1_0_9_4 using _f_i_e_l_d___t_y_p_e = typename _M_a_t_r_i_x_<_T_,_ _A_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_1_0_9_5 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ -1096 }; │ │ │ │ │ -1097 │ │ │ │ │ -1099} // end namespace Dune │ │ │ │ │ -1100 │ │ │ │ │ -1101#endif │ │ │ │ │ -_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... │ │ │ │ │ +903 // obtain approximated spectral condition number of A │ │ │ │ │ +904 cond_2 = sigma_max / sigma_min; │ │ │ │ │ +905 │ │ │ │ │ +906 // print verbosity information │ │ │ │ │ +907 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +908 { │ │ │ │ │ +909 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +910 { │ │ │ │ │ +911 // print some information about the problem │ │ │ │ │ +912 std::cout << _b_l_a_n_k__ << "Obtained singular values of A by sol" │ │ │ │ │ +913 << "ving (A^T*A)*x = σ²*x using the ARPACK++ " │ │ │ │ │ +914 << "class ARSymStdEig:" << std::endl; │ │ │ │ │ +915 std::cout << _b_l_a_n_k__ << " converged eigenvalues of A^T*A: " │ │ │ │ │ +916 << nconv << " / " << nev << std::endl; │ │ │ │ │ +917 std::cout << _b_l_a_n_k__ << " largest eigenvalue of A^T*A: " │ │ │ │ │ +918 << lambda_max << std::endl; │ │ │ │ │ +919 std::cout << _b_l_a_n_k__ << " smallest eigenvalue of A^T*A: " │ │ │ │ │ +920 << lambda_min << std::endl; │ │ │ │ │ +921 std::cout << _b_l_a_n_k__ << " => largest singular value of A: " │ │ │ │ │ +922 << sigma_max << std::endl; │ │ │ │ │ +923 std::cout << _b_l_a_n_k__ << " => smallest singular value of A: " │ │ │ │ │ +924 << sigma_min << std::endl; │ │ │ │ │ +925 } │ │ │ │ │ +926 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +927 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +928 << "║residual║_2 = {" << r_max_norm << "," │ │ │ │ │ +929 << r_min_norm << "}, " << "σ = {" │ │ │ │ │ +930 << sigma_max << "," << sigma_min │ │ │ │ │ +931 << "}): cond_2 = " << cond_2 << std::endl; │ │ │ │ │ +932 } │ │ │ │ │ +933 │ │ │ │ │ +934 // free dynamically allocated memory │ │ │ │ │ +935 delete[] AtAx_min_raw; │ │ │ │ │ +936 delete[] AtAx_max_raw; │ │ │ │ │ +937 delete[] ev; │ │ │ │ │ +938 } │ │ │ │ │ +939 │ │ │ │ │ +_9_4_4 inline unsigned int _g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t () const │ │ │ │ │ +945 { │ │ │ │ │ +946 if (_n_I_t_e_r_a_t_i_o_n_s__ == 0) │ │ │ │ │ +947 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"No algorithm applied, yet."); │ │ │ │ │ +948 │ │ │ │ │ +949 return _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ +950 } │ │ │ │ │ +951 │ │ │ │ │ +952 protected: │ │ │ │ │ +953 // parameters related to iterative eigenvalue algorithms │ │ │ │ │ +_9_5_4 const _B_C_R_S_M_a_t_r_i_x& _m__; │ │ │ │ │ +_9_5_5 const unsigned int _n_I_t_e_r_a_t_i_o_n_s_M_a_x__; │ │ │ │ │ +956 │ │ │ │ │ +957 // verbosity setting │ │ │ │ │ +_9_5_8 const unsigned int _v_e_r_b_o_s_i_t_y___l_e_v_e_l__; │ │ │ │ │ +959 │ │ │ │ │ +960 // memory for storing temporary variables (mutable as they shall │ │ │ │ │ +961 // just be effectless auxiliary variables of the const apply*(...) │ │ │ │ │ +962 // methods) │ │ │ │ │ +_9_6_3 mutable unsigned int _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ +964 │ │ │ │ │ +965 // constants for printing verbosity information │ │ │ │ │ +_9_6_6 const std::string _t_i_t_l_e__; │ │ │ │ │ +_9_6_7 const std::string _b_l_a_n_k__; │ │ │ │ │ +968 }; │ │ │ │ │ +969 │ │ │ │ │ +972} // namespace Dune │ │ │ │ │ +973 │ │ │ │ │ +974#endif // HAVE_ARPACKPP │ │ │ │ │ +975 │ │ │ │ │ +976#endif // DUNE_ISTL_EIGENVALUE_ARPACKPP_HH │ │ │ │ │ _b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ Helper functions for determining the vector/matrix block level. │ │ │ │ │ _i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_i_o_._h_h │ │ │ │ │ +Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ +_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_:_:_p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ +void printvector(std::ostream &s, const V &v, std::string title, std::string │ │ │ │ │ +rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ +Print an ISTL vector. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:89 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:488 │ │ │ │ │ _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:395 │ │ │ │ │ -_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_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ -A Vector of blocks with different blocksizes. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_w_i_n_d_o_w___t_y_p_e │ │ │ │ │ -Imp::BlockVectorWindow< B, A > window_type │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ -BlockVector< B, A > block_type │ │ │ │ │ -Same as value_type, here for historical reasons. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -DenseMatrixBase & operator=(const DenseMatrixBase &a) │ │ │ │ │ -assignment │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +_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 matrix.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -Iterator beforeBegin() const │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:385 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_r_e_s_i_z_e │ │ │ │ │ -void resize(size_type rows, size_type columns) │ │ │ │ │ -same effect as constructor with same argument │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:153 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ │ -const window_type const_reference │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ -DenseMatrixBase(size_type rows, size_type columns) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:95 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_e_n_d │ │ │ │ │ -Iterator end() │ │ │ │ │ -end Iterator │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:371 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -reference operator[](size_type i) │ │ │ │ │ -random access to blocks │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:241 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_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 matrix.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_f_i_n_d │ │ │ │ │ -Iterator find(size_type i) │ │ │ │ │ -random access returning iterator (end if not contained) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:391 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_N │ │ │ │ │ -size_type N() const │ │ │ │ │ -number of blocks in the vector (are of variable size here) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:539 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -ConstIterator beforeEnd() const │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:525 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_e_n_d │ │ │ │ │ -ConstIterator end() const │ │ │ │ │ -end ConstIterator │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:518 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ │ -window_type reference │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_r_e_n_d │ │ │ │ │ -ConstIterator rend() const │ │ │ │ │ -end ConstIterator │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:531 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -Iterator beforeEnd() │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:378 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_g_i_n │ │ │ │ │ -ConstIterator begin() const │ │ │ │ │ -begin ConstIterator │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:512 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ -A allocator_type │ │ │ │ │ -export the allocator type │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ -DenseMatrixBase() │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_f_i_n_d │ │ │ │ │ -ConstIterator find(size_type i) const │ │ │ │ │ -random access returning iterator (end if not contained) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:397 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn bvector.hh:401 │ │ │ │ │ +_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 size type for the index access. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_~_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ -~DenseMatrixBase() │ │ │ │ │ -free dynamic memory │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_b_e_g_i_n │ │ │ │ │ -Iterator begin() │ │ │ │ │ -begin Iterator │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:365 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e │ │ │ │ │ -DenseMatrixBase(const DenseMatrixBase &a) │ │ │ │ │ -copy constructor, has copy semantics │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ -Iterator & operator--() │ │ │ │ │ -prefix decrement │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:308 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ -size_type index() const │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:352 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator(Iterator &other)=default │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator(Iterator &&other)=default │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -bool operator!=(const Iterator &it) const │ │ │ │ │ -inequality │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:322 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -Iterator & operator=(Iterator &&other) │ │ │ │ │ -Move assignment. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -Iterator & operator++() │ │ │ │ │ -prefix increment │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:300 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator() │ │ │ │ │ -constructor, no arguments │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:266 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -window_type & operator*() const │ │ │ │ │ -dereferencing │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:340 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -bool operator==(const Iterator &it) const │ │ │ │ │ -equality │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:316 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -Iterator & operator=(Iterator &other) │ │ │ │ │ -Copy assignment. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:291 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ │ -Iterator(B *data, size_type columns, size_type _i) │ │ │ │ │ -constructor │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ -window_type * operator->() const │ │ │ │ │ -arrow │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:346 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator class for sequential access. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ │ -const window_type * operator->() const │ │ │ │ │ -arrow │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:487 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -const window_type & operator*() const │ │ │ │ │ -dereferencing │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:481 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ │ -ConstIterator & operator++() │ │ │ │ │ -prefix increment │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:441 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator(const B *data, size_type columns, size_type _i) │ │ │ │ │ -constructor from pointer │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:414 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_-_- │ │ │ │ │ -ConstIterator & operator--() │ │ │ │ │ -prefix decrement │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:449 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator(const Iterator &it) │ │ │ │ │ -constructor from non_const iterator │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:420 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ -bool operator!=(const ConstIterator &it) const │ │ │ │ │ -inequality │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:463 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ │ -ConstIterator() │ │ │ │ │ -constructor │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:407 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ -bool operator==(const ConstIterator &it) const │ │ │ │ │ -equality │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:457 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ │ -size_type index() const │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:493 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -ConstIterator & operator=(Iterator &&other) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:424 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -ConstIterator & operator=(Iterator &other) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:432 │ │ │ │ │ -_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_l_s__ │ │ │ │ │ -size_type cols_ │ │ │ │ │ -Number of columns of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:1088 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ -FieldTraits< ft >::real_type infinity_norm() const │ │ │ │ │ -infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:992 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ │ -A allocator_type │ │ │ │ │ -Export the allocator. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:571 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ │ -FieldTraits< ft >::real_type infinity_norm_real() const │ │ │ │ │ -simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:1011 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ -void usmhv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^H x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:956 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ -void usmv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:854 │ │ │ │ │ -_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_:_:_d_a_t_a__ │ │ │ │ │ -MatrixImp::DenseMatrixBase< T, A > data_ │ │ │ │ │ -Abuse DenseMatrixBase as an engine for a 2d array ISTL-style. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:1081 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_t_r_a_n_s_p_o_s_e │ │ │ │ │ -Matrix transpose() const │ │ │ │ │ -Return the transpose of the matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:745 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ │ -void mtv(const X &x, Y &y) const │ │ │ │ │ -y = A^T x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:807 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ │ -void umv(const X &x, Y &y) const │ │ │ │ │ -y += A x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:820 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ -void mv(const X &x, Y &y) const │ │ │ │ │ -y = A x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:788 │ │ │ │ │ -_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_:_:_s_e_t_S_i_z_e │ │ │ │ │ -void setSize(size_type rows, size_type cols) │ │ │ │ │ -Change the matrix size. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:608 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -RowIterator beforeBegin() │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:634 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -RowIterator beforeEnd() │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:627 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M_a_t_r_i_x │ │ │ │ │ -Matrix() │ │ │ │ │ -Create empty matrix. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:596 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ │ -Matrix & operator-=(const Matrix &b) │ │ │ │ │ -Subtract the entries of another matrix from this one. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:735 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm2() const │ │ │ │ │ -square of frobenius norm, need for block recursion │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:980 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ │ -row_type::iterator ColIterator │ │ │ │ │ -Iterator for the entries of each row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:583 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ -ConstRowIterator beforeEnd() const │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:653 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ -Matrix & operator=(const field_type &t) │ │ │ │ │ -Assignment from scalar. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:666 │ │ │ │ │ -_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:620 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -const row_type operator[](size_type row) const │ │ │ │ │ -The const index operator. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:684 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ -ConstRowIterator end() const │ │ │ │ │ -Get const iterator to one beyond last row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:646 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -friend Y operator*(const Matrix< T > &m, const X &vec) │ │ │ │ │ -Generic matrix-vector multiplication. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:770 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ │ -Matrix< T > & operator*=(const field_type &scalar) │ │ │ │ │ -Multiplication with a scalar. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:705 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ │ -row_type operator[](size_type row) │ │ │ │ │ -The index operator. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:673 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ │ -void mmv(const X &x, Y &y) const │ │ │ │ │ -y -= A x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:837 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ │ -Matrix & operator+=(const Matrix &b) │ │ │ │ │ -Add the entries of another matrix to this one. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:721 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ │ -ConstRowIterator begin() const │ │ │ │ │ -Get const iterator to first row. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:640 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ -void mmhv(const X &x, Y &y) const │ │ │ │ │ -y -= A^H x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:939 │ │ │ │ │ -_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:614 │ │ │ │ │ -_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_l_e_v_e_l │ │ │ │ │ -static constexpr auto blocklevel │ │ │ │ │ -The number of nesting levels the matrix contains. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:593 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M │ │ │ │ │ -size_type M() const │ │ │ │ │ -Return the number of columns. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:700 │ │ │ │ │ -_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_:_:_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 pattern │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:1068 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ │ -Matrix< T > & operator/=(const field_type &scalar) │ │ │ │ │ -Division by a scalar. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:711 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ -friend Matrix< T > operator*(const Matrix< T > &m1, const Matrix< T > &m2) │ │ │ │ │ -Generic matrix multiplication. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:755 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ │ -void umtv(const X &x, Y &y) const │ │ │ │ │ -y += A^T x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:871 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ │ -void mmtv(const X &x, Y &y) const │ │ │ │ │ -y -= A^T x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:888 │ │ │ │ │ -_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_:_:_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ -frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:974 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ -void usmtv(const field_type &alpha, const X &x, Y &y) const │ │ │ │ │ -y += alpha A^T x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:905 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ │ -void umhv(const X &x, Y &y) const │ │ │ │ │ -y += A^H x │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:922 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ -size_type N() const │ │ │ │ │ -Return the number of rows. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ │ -ConstRowIterator beforeBegin() const │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:660 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M_a_t_r_i_x │ │ │ │ │ -Matrix(size_type rows, size_type cols) │ │ │ │ │ -Create uninitialized matrix of size rows x cols. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:601 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ │ -MatrixImp::DenseMatrixBase< T, A >::Iterator RowIterator │ │ │ │ │ -Iterator over the matrix rows. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:580 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -typename Matrix< T, A >::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:1094 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ │ -typename FieldTraits< field_type >::real_type real_type │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:1095 │ │ │ │ │ +The type for the index access. │ │ │ │ │ +DDeeffiinniittiioonn bvector.hh:410 │ │ │ │ │ +_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_:_:_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ │ │ │ │ │ +const unsigned int verbosity_level_ │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:958 │ │ │ │ │ +_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_:_:_g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t │ │ │ │ │ +unsigned int getIterationCount() const │ │ │ │ │ +Return the number of iterations in last application of an algorithm. │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:944 │ │ │ │ │ +_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_:_:_t_i_t_l_e__ │ │ │ │ │ +const std::string title_ │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:966 │ │ │ │ │ +_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_:_:_R_e_a_l │ │ │ │ │ +BlockVector::field_type Real │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:247 │ │ │ │ │ +_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_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s_:_:_m__ │ │ │ │ │ +const BCRSMatrix & m_ │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:954 │ │ │ │ │ +_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_:_:_n_I_t_e_r_a_t_i_o_n_s_M_a_x__ │ │ │ │ │ +const unsigned int nIterationsMax_ │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:955 │ │ │ │ │ +_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_:_:_b_l_a_n_k__ │ │ │ │ │ +const std::string blank_ │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:967 │ │ │ │ │ +_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_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ +ArPackPlusPlus_Algorithms(const BCRSMatrix &m, const unsigned int │ │ │ │ │ +nIterationsMax=100000, const unsigned int verbosity_level=0) │ │ │ │ │ +Construct from required parameters. │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:268 │ │ │ │ │ +_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_C_o_n_d_2 │ │ │ │ │ +void computeSymCond2(const Real &epsilon, Real &cond_2) const │ │ │ │ │ +Assume the matrix to be square, symmetric and perform IRLM to compute an │ │ │ │ │ +approximation of its spectra... │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:493 │ │ │ │ │ +_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_:_:_n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ +unsigned int nIterations_ │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:963 │ │ │ │ │ +_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_N_o_n_S_y_m_M_i_n │ │ │ │ │ +void computeNonSymMin(const Real &epsilon, BlockVector &x, Real &sigma) const │ │ │ │ │ +Assume the matrix to be nonsymmetric and perform IRLM to compute an │ │ │ │ │ +approximation sigma of its smalle... │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:721 │ │ │ │ │ +_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_N_o_n_S_y_m_C_o_n_d_2 │ │ │ │ │ +void computeNonSymCond2(const Real &epsilon, Real &cond_2) const │ │ │ │ │ +Assume the matrix to be nonsymmetric and perform IRLM to compute an │ │ │ │ │ +approximation of its spectral con... │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:830 │ │ │ │ │ +_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_N_o_n_S_y_m_M_a_x │ │ │ │ │ +void computeNonSymMax(const Real &epsilon, BlockVector &x, Real &sigma) const │ │ │ │ │ +Assume the matrix to be nonsymmetric and perform IRLM to compute an │ │ │ │ │ +approximation sigma of its larges... │ │ │ │ │ +DDeeffiinniittiioonn arpackpp.hh:609 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00209.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: umfpack.hh File Reference │ │ │ │ +dune-istl: poweriteration.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,77 +65,55 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ +
poweriteration.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <complex>
│ │ │ │ +
#include <cstddef>
│ │ │ │ +#include <cmath>
│ │ │ │ #include <type_traits>
│ │ │ │ -#include <umfpack.h>
│ │ │ │ +#include <iostream>
│ │ │ │ +#include <limits>
│ │ │ │ +#include <ios>
│ │ │ │ +#include <iomanip>
│ │ │ │ +#include <memory>
│ │ │ │ +#include <string>
│ │ │ │ #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/solvers.hh>
│ │ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ │ -#include <dune/istl/solverfactory.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │ +#include <dune/istl/operators.hh>
│ │ │ │ +#include <dune/istl/solvercategory.hh>
│ │ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ │ +#include <dune/istl/istlexception.hh>
│ │ │ │ +#include <dune/istl/io.hh>
│ │ │ │ +#include <dune/istl/solvers.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< BCRSMatrix< FieldMatrix< T, n, m >, A > > >
 
struct  Dune::StoresColumnCompressed< UMFPack< BCRSMatrix< T, A > > >
 
struct  Dune::UMFPackCreator
 
struct  Dune::UMFPackCreator::isValidBlock< F, class >
 
struct  Dune::UMFPackCreator::isValidBlock< B, std::enable_if_t< std::is_same< typename FieldTraits< B >::real_type, double >::value > >
class  Dune::PowerIteration_Algorithms< BCRSMatrix, BlockVector >
 Iterative eigenvalue algorithms based on power iteration. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

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

Detailed Description

│ │ │ │ -

Classes for using UMFPack with ISTL matrices.

│ │ │ │ -
Author
Dominic Kempf
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,56 +1,36 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ + * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +poweriteration.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#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_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._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_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._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> │ │ │ │ │ +#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_/_i_o_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_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_:_:_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_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _> │ │ │ │ │ - _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_<_ _U_M_F_P_a_c_k_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_,_ _c_l_a_s_s_ _> │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _B_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_:_i_s___s_a_m_e_< │ │ │ │ │ - _t_y_p_e_n_a_m_e_ _F_i_e_l_d_T_r_a_i_t_s_<_ _B_ _>_:_:_r_e_a_l___t_y_p_e_,_ _d_o_u_b_l_e_ _>_:_:_v_a_l_u_e_ _>_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_<_ _B_C_R_S_M_a_t_r_i_x_,_ _B_l_o_c_k_V_e_c_t_o_r_ _> │ │ │ │ │ +  Iterative eigenvalue algorithms based on power iteration. _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___D_I_R_E_C_T___S_O_L_V_E_R ("umfpack", _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r()) │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Classes for using UMFPack with ISTL matrices. │ │ │ │ │ - Author │ │ │ │ │ - Dominic Kempf │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00209_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: umfpack.hh Source File │ │ │ │ +dune-istl: poweriteration.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,715 +70,875 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
umfpack.hh
│ │ │ │ +
poweriteration.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
5#ifndef DUNE_ISTL_UMFPACK_HH
│ │ │ │ -
6#define DUNE_ISTL_UMFPACK_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_EIGENVALUE_POWERITERATION_HH
│ │ │ │ +
6#define DUNE_ISTL_EIGENVALUE_POWERITERATION_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>
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
23
│ │ │ │ -
24
│ │ │ │ -
25
│ │ │ │ -
26namespace Dune {
│ │ │ │ -
38 // FORWARD DECLARATIONS
│ │ │ │ -
39 template<class M, class T, class TM, class TD, class TA>
│ │ │ │ -
40 class SeqOverlappingSchwarz;
│ │ │ │ -
41
│ │ │ │ -
42 template<class T, bool tag>
│ │ │ │ -
43 struct SeqOverlappingSchwarzAssemblerHelper;
│ │ │ │ -
44
│ │ │ │ -
45 // wrapper class for C-Function Calls in the backend. Choose the right function namespace
│ │ │ │ -
46 // depending on the template parameter used.
│ │ │ │ -
47 template<typename T>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
49 {
│ │ │ │ -
50 static constexpr bool valid = false ;
│ │ │ │ -
51 };
│ │ │ │ -
│ │ │ │ +
8#include <cstddef> // provides std::size_t
│ │ │ │ +
9#include <cmath> // provides std::sqrt, std::abs
│ │ │ │ +
10
│ │ │ │ +
11#include <type_traits> // provides std::is_same
│ │ │ │ +
12#include <iostream> // provides std::cout, std::endl
│ │ │ │ +
13#include <limits> // provides std::numeric_limits
│ │ │ │ +
14#include <ios> // provides std::left, std::ios::left
│ │ │ │ +
15#include <iomanip> // provides std::setw, std::resetiosflags
│ │ │ │ +
16#include <memory> // provides std::unique_ptr
│ │ │ │ +
17#include <string> // provides std::string
│ │ │ │ +
18
│ │ │ │ +
19#include <dune/common/exceptions.hh> // provides DUNE_THROW(...)
│ │ │ │ +
20
│ │ │ │ +
21#include <dune/istl/blocklevel.hh> // provides Dune::blockLevel
│ │ │ │ +
22#include <dune/istl/operators.hh> // provides Dune::LinearOperator
│ │ │ │ +
23#include <dune/istl/solvercategory.hh> // provides Dune::SolverCategory::sequential
│ │ │ │ +
24#include <dune/istl/solvertype.hh> // provides Dune::IsDirectSolver
│ │ │ │ +
25#include <dune/istl/operators.hh> // provides Dune::MatrixAdapter
│ │ │ │ +
26#include <dune/istl/istlexception.hh> // provides Dune::ISTLError
│ │ │ │ +
27#include <dune/istl/io.hh> // provides Dune::printvector(...)
│ │ │ │ +
28#include <dune/istl/solvers.hh> // provides Dune::InverseOperatorResult
│ │ │ │ +
29
│ │ │ │ +
30namespace Dune
│ │ │ │ +
31{
│ │ │ │ +
32
│ │ │ │ +
37 namespace Impl {
│ │ │ │ +
45 template <class X, class Y = X>
│ │ │ │ +
46 class ScalingLinearOperator : public Dune::LinearOperator<X,Y>
│ │ │ │ +
47 {
│ │ │ │ +
48 public:
│ │ │ │ +
49 typedef X domain_type;
│ │ │ │ +
50 typedef Y range_type;
│ │ │ │ +
51 typedef typename X::field_type field_type;
│ │ │ │
52
│ │ │ │ -
53 template<>
│ │ │ │ -
│ │ │ │ -
54 struct UMFPackMethodChooser<double>
│ │ │ │ -
55 {
│ │ │ │ -
56 static constexpr bool valid = true ;
│ │ │ │ -
57
│ │ │ │ -
58 template<typename... A>
│ │ │ │ -
│ │ │ │ -
59 static void defaults(A... args)
│ │ │ │ -
60 {
│ │ │ │ -
61 umfpack_dl_defaults(args...);
│ │ │ │ -
62 }
│ │ │ │ -
│ │ │ │ -
63 template<typename... A>
│ │ │ │ -
│ │ │ │ -
64 static void free_numeric(A... args)
│ │ │ │ -
65 {
│ │ │ │ -
66 umfpack_dl_free_numeric(args...);
│ │ │ │ -
67 }
│ │ │ │ -
│ │ │ │ -
68 template<typename... A>
│ │ │ │ -
│ │ │ │ -
69 static void free_symbolic(A... args)
│ │ │ │ -
70 {
│ │ │ │ -
71 umfpack_dl_free_symbolic(args...);
│ │ │ │ -
72 }
│ │ │ │ -
│ │ │ │ -
73 template<typename... A>
│ │ │ │ -
│ │ │ │ -
74 static int load_numeric(A... args)
│ │ │ │ -
75 {
│ │ │ │ -
76 return umfpack_dl_load_numeric(args...);
│ │ │ │ -
77 }
│ │ │ │ -
│ │ │ │ -
78 template<typename... A>
│ │ │ │ -
│ │ │ │ -
79 static void numeric(A... args)
│ │ │ │ -
80 {
│ │ │ │ -
81 umfpack_dl_numeric(args...);
│ │ │ │ -
82 }
│ │ │ │ -
│ │ │ │ -
83 template<typename... A>
│ │ │ │ -
│ │ │ │ -
84 static void report_info(A... args)
│ │ │ │ -
85 {
│ │ │ │ -
86 umfpack_dl_report_info(args...);
│ │ │ │ -
87 }
│ │ │ │ -
│ │ │ │ -
88 template<typename... A>
│ │ │ │ -
│ │ │ │ -
89 static void report_status(A... args)
│ │ │ │ -
90 {
│ │ │ │ -
91 umfpack_dl_report_status(args...);
│ │ │ │ -
92 }
│ │ │ │ -
│ │ │ │ -
93 template<typename... A>
│ │ │ │ -
│ │ │ │ -
94 static int save_numeric(A... args)
│ │ │ │ -
95 {
│ │ │ │ -
96 return umfpack_dl_save_numeric(args...);
│ │ │ │ -
97 }
│ │ │ │ -
│ │ │ │ -
98 template<typename... A>
│ │ │ │ -
│ │ │ │ -
99 static void solve(A... args)
│ │ │ │ -
100 {
│ │ │ │ -
101 umfpack_dl_solve(args...);
│ │ │ │ -
102 }
│ │ │ │ -
│ │ │ │ -
103 template<typename... A>
│ │ │ │ -
│ │ │ │ -
104 static void symbolic(A... args)
│ │ │ │ -
105 {
│ │ │ │ -
106 umfpack_dl_symbolic(args...);
│ │ │ │ -
107 }
│ │ │ │ -
│ │ │ │ -
108 };
│ │ │ │ -
│ │ │ │ -
109
│ │ │ │ -
110 template<>
│ │ │ │ -
│ │ │ │ -
111 struct UMFPackMethodChooser<std::complex<double> >
│ │ │ │ -
112 {
│ │ │ │ -
113 static constexpr bool valid = true ;
│ │ │ │ -
114
│ │ │ │ -
115 template<typename... A>
│ │ │ │ -
│ │ │ │ -
116 static void defaults(A... args)
│ │ │ │ -
117 {
│ │ │ │ -
118 umfpack_zl_defaults(args...);
│ │ │ │ -
119 }
│ │ │ │ -
│ │ │ │ -
120 template<typename... A>
│ │ │ │ -
│ │ │ │ -
121 static void free_numeric(A... args)
│ │ │ │ -
122 {
│ │ │ │ -
123 umfpack_zl_free_numeric(args...);
│ │ │ │ -
124 }
│ │ │ │ -
│ │ │ │ -
125 template<typename... A>
│ │ │ │ -
│ │ │ │ -
126 static void free_symbolic(A... args)
│ │ │ │ -
127 {
│ │ │ │ -
128 umfpack_zl_free_symbolic(args...);
│ │ │ │ -
129 }
│ │ │ │ -
│ │ │ │ -
130 template<typename... A>
│ │ │ │ -
│ │ │ │ -
131 static int load_numeric(A... args)
│ │ │ │ -
132 {
│ │ │ │ -
133 return umfpack_zl_load_numeric(args...);
│ │ │ │ -
134 }
│ │ │ │ -
│ │ │ │ -
135 template<typename... A>
│ │ │ │ -
│ │ │ │ -
136 static void numeric(const long int* cs, const long int* ri, const double* val, A... args)
│ │ │ │ -
137 {
│ │ │ │ -
138 umfpack_zl_numeric(cs,ri,val,NULL,args...);
│ │ │ │ -
139 }
│ │ │ │ -
│ │ │ │ -
140 template<typename... A>
│ │ │ │ -
│ │ │ │ -
141 static void report_info(A... args)
│ │ │ │ -
142 {
│ │ │ │ -
143 umfpack_zl_report_info(args...);
│ │ │ │ -
144 }
│ │ │ │ -
│ │ │ │ -
145 template<typename... A>
│ │ │ │ -
│ │ │ │ -
146 static void report_status(A... args)
│ │ │ │ -
147 {
│ │ │ │ -
148 umfpack_zl_report_status(args...);
│ │ │ │ -
149 }
│ │ │ │ -
│ │ │ │ -
150 template<typename... A>
│ │ │ │ -
│ │ │ │ -
151 static int save_numeric(A... args)
│ │ │ │ -
152 {
│ │ │ │ -
153 return umfpack_zl_save_numeric(args...);
│ │ │ │ -
154 }
│ │ │ │ -
│ │ │ │ -
155 template<typename... A>
│ │ │ │ -
│ │ │ │ -
156 static void solve(long int m, const long int* cs, const long int* ri, std::complex<double>* val, double* x, const double* b,A... args)
│ │ │ │ -
157 {
│ │ │ │ -
158 const double* cval = reinterpret_cast<const double*>(val);
│ │ │ │ -
159 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...);
│ │ │ │ -
160 }
│ │ │ │ -
│ │ │ │ -
161 template<typename... A>
│ │ │ │ -
│ │ │ │ -
162 static void symbolic(long int m, long int n, const long int* cs, const long int* ri, const double* val, A... args)
│ │ │ │ -
163 {
│ │ │ │ -
164 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...);
│ │ │ │ -
165 }
│ │ │ │ -
│ │ │ │ -
166 };
│ │ │ │ -
│ │ │ │ -
167
│ │ │ │ -
168 namespace Impl
│ │ │ │ -
169 {
│ │ │ │ -
170 template<class M>
│ │ │ │ -
171 struct UMFPackVectorChooser
│ │ │ │ -
172 {};
│ │ │ │ -
173
│ │ │ │ -
174 template<typename T, typename A, int n, int m>
│ │ │ │ -
175 struct UMFPackVectorChooser<BCRSMatrix<FieldMatrix<T,n,m>,A > >
│ │ │ │ -
176 {
│ │ │ │ -
178 using domain_type = BlockVector<
│ │ │ │ -
179 FieldVector<T,m>,
│ │ │ │ -
180 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > >;
│ │ │ │ -
182 using range_type = BlockVector<
│ │ │ │ -
183 FieldVector<T,n>,
│ │ │ │ -
184 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > >;
│ │ │ │ -
185 };
│ │ │ │ -
186
│ │ │ │ -
187 template<typename T, typename A>
│ │ │ │ -
188 struct UMFPackVectorChooser<BCRSMatrix<T,A> >
│ │ │ │ -
189 {
│ │ │ │ -
191 using domain_type = BlockVector<T, A>;
│ │ │ │ -
193 using range_type = BlockVector<T, A>;
│ │ │ │ -
194 };
│ │ │ │ -
195 }
│ │ │ │ -
196
│ │ │ │ -
210 template<typename M>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
212 : public InverseOperator<
│ │ │ │ -
213 typename Impl::UMFPackVectorChooser<M>::domain_type,
│ │ │ │ -
214 typename Impl::UMFPackVectorChooser<M>::range_type >
│ │ │ │ -
215 {
│ │ │ │ -
216 using T = typename M::field_type;
│ │ │ │ -
217
│ │ │ │ -
218 public:
│ │ │ │ -
220 using Matrix = M;
│ │ │ │ -
221 using matrix_type = M;
│ │ │ │ -
223 typedef ISTL::Impl::BCCSMatrix<typename Matrix::field_type, long int> UMFPackMatrix;
│ │ │ │ -
225 typedef ISTL::Impl::BCCSMatrixInitializer<M, long int> MatrixInitializer;
│ │ │ │ -
227 using domain_type = typename Impl::UMFPackVectorChooser<M>::domain_type;
│ │ │ │ -
229 using range_type = typename Impl::UMFPackVectorChooser<M>::range_type;
│ │ │ │ -
230
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
233 {
│ │ │ │ - │ │ │ │ +
53 ScalingLinearOperator (field_type immutable_scaling,
│ │ │ │ +
54 const field_type& mutable_scaling)
│ │ │ │ +
55 : immutable_scaling_(immutable_scaling),
│ │ │ │ +
56 mutable_scaling_(mutable_scaling)
│ │ │ │ +
57 {}
│ │ │ │ +
58
│ │ │ │ +
59 virtual void apply (const X& x, Y& y) const
│ │ │ │ +
60 {
│ │ │ │ +
61 y = x;
│ │ │ │ +
62 y *= immutable_scaling_*mutable_scaling_;
│ │ │ │ +
63 }
│ │ │ │ +
64
│ │ │ │ +
65 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
│ │ │ │ +
66 {
│ │ │ │ +
67 X temp(x);
│ │ │ │ +
68 temp *= immutable_scaling_*mutable_scaling_;
│ │ │ │ +
69 y.axpy(alpha,temp);
│ │ │ │ +
70 }
│ │ │ │ +
71
│ │ │ │ + │ │ │ │ +
74 {
│ │ │ │ + │ │ │ │ +
76 }
│ │ │ │ +
77
│ │ │ │ +
78 protected:
│ │ │ │ +
79 const field_type immutable_scaling_;
│ │ │ │ +
80 const field_type& mutable_scaling_;
│ │ │ │ +
81 };
│ │ │ │ +
82
│ │ │ │ +
83
│ │ │ │ +
92 template <class OP1, class OP2>
│ │ │ │ +
93 class LinearOperatorSum
│ │ │ │ +
94 : public Dune::LinearOperator<typename OP1::domain_type,
│ │ │ │ +
95 typename OP1::range_type>
│ │ │ │ +
96 {
│ │ │ │ +
97 public:
│ │ │ │ +
98 typedef typename OP1::domain_type domain_type;
│ │ │ │ +
99 typedef typename OP1::range_type range_type;
│ │ │ │ +
100 typedef typename domain_type::field_type field_type;
│ │ │ │ +
101
│ │ │ │ +
102 LinearOperatorSum (const OP1& op1, const OP2& op2)
│ │ │ │ +
103 : op1_(op1), op2_(op2)
│ │ │ │ +
104 {
│ │ │ │ +
105 static_assert(std::is_same<typename OP2::domain_type,domain_type>::value,
│ │ │ │ +
106 "Domain type of both operators doesn't match!");
│ │ │ │ +
107 static_assert(std::is_same<typename OP2::range_type,range_type>::value,
│ │ │ │ +
108 "Range type of both operators doesn't match!");
│ │ │ │ +
109 }
│ │ │ │ +
110
│ │ │ │ +
111 virtual void apply (const domain_type& x, range_type& y) const
│ │ │ │ +
112 {
│ │ │ │ +
113 op1_.apply(x,y);
│ │ │ │ +
114 op2_.applyscaleadd(1.0,x,y);
│ │ │ │ +
115 }
│ │ │ │ +
116
│ │ │ │ +
117 virtual void applyscaleadd (field_type alpha,
│ │ │ │ +
118 const domain_type& x, range_type& y) const
│ │ │ │ +
119 {
│ │ │ │ +
120 range_type temp(y);
│ │ │ │ +
121 op1_.apply(x,temp);
│ │ │ │ +
122 op2_.applyscaleadd(1.0,x,temp);
│ │ │ │ +
123 y.axpy(alpha,temp);
│ │ │ │ +
124 }
│ │ │ │ +
125
│ │ │ │ +
127 virtual SolverCategory::Category category() const
│ │ │ │ +
128 {
│ │ │ │ + │ │ │ │ +
130 }
│ │ │ │ +
131
│ │ │ │ +
132 protected:
│ │ │ │ +
133 const OP1& op1_;
│ │ │ │ +
134 const OP2& op2_;
│ │ │ │ +
135 };
│ │ │ │ +
136 } // end namespace Impl
│ │ │ │ +
137
│ │ │ │ +
174 template <typename BCRSMatrix, typename BlockVector>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
176 {
│ │ │ │ +
177 protected:
│ │ │ │ +
178 // Type definitions for type of iteration operator (m_ - mu_*I)
│ │ │ │ + │ │ │ │ + │ │ │ │ +
181 typedef Impl::ScalingLinearOperator<BlockVector> ScalingOperator;
│ │ │ │ +
182 typedef Impl::LinearOperatorSum<MatrixOperator,ScalingOperator> OperatorSum;
│ │ │ │ +
183
│ │ │ │ +
184 public:
│ │ │ │ + │ │ │ │ +
187
│ │ │ │ + │ │ │ │ +
190
│ │ │ │ +
191 public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
207 const unsigned int nIterationsMax = 1000,
│ │ │ │ +
208 const unsigned int verbosity_level = 0)
│ │ │ │ +
209 : m_(m), nIterationsMax_(nIterationsMax),
│ │ │ │ +
210 verbosity_level_(verbosity_level),
│ │ │ │ +
211 mu_(0.0),
│ │ │ │ + │ │ │ │ +
213 scalingOperator_(-1.0,mu_),
│ │ │ │ + │ │ │ │ +
215 nIterations_(0),
│ │ │ │ +
216 title_(" PowerIteration_Algorithms: "),
│ │ │ │ +
217 blank_(title_.length(),' ')
│ │ │ │ +
218 {
│ │ │ │ +
219 // assert that BCRSMatrix type has blocklevel 2
│ │ │ │ +
220 static_assert
│ │ │ │ +
221 (blockLevel<BCRSMatrix>() == 2,
│ │ │ │ +
222 "Only BCRSMatrices with blocklevel 2 are supported.");
│ │ │ │ +
223
│ │ │ │ +
224 // assert that BCRSMatrix type has square blocks
│ │ │ │ +
225 static_assert
│ │ │ │ +
226 (BCRSMatrix::block_type::rows == BCRSMatrix::block_type::cols,
│ │ │ │ +
227 "Only BCRSMatrices with square blocks are supported.");
│ │ │ │ +
228
│ │ │ │ +
229 // assert that m_ is square
│ │ │ │ +
230 const int nrows = m_.M() * BCRSMatrix::block_type::rows;
│ │ │ │ +
231 const int ncols = m_.N() * BCRSMatrix::block_type::cols;
│ │ │ │ +
232 if (nrows != ncols)
│ │ │ │ +
233 DUNE_THROW(Dune::ISTLError,"Matrix is not square ("
│ │ │ │ +
234 << nrows << "x" << ncols << ").");
│ │ │ │
235 }
│ │ │ │
│ │ │ │
236
│ │ │ │ -
│ │ │ │ -
245 UMFPack(const Matrix& matrix, int verbose=0) : matrixIsLoaded_(false)
│ │ │ │ -
246 {
│ │ │ │ -
247 //check whether T is a supported type
│ │ │ │ -
248 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ -
249 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ -
250 Caller::defaults(UMF_Control);
│ │ │ │ -
251 setVerbosity(verbose);
│ │ │ │ -
252 setMatrix(matrix);
│ │ │ │ -
253 }
│ │ │ │ -
│ │ │ │ -
254
│ │ │ │ -
│ │ │ │ -
263 UMFPack(const Matrix& matrix, int verbose, bool) : matrixIsLoaded_(false)
│ │ │ │ -
264 {
│ │ │ │ -
265 //check whether T is a supported type
│ │ │ │ -
266 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ -
267 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ -
268 Caller::defaults(UMF_Control);
│ │ │ │ -
269 setVerbosity(verbose);
│ │ │ │ -
270 setMatrix(matrix);
│ │ │ │ -
271 }
│ │ │ │ -
│ │ │ │ + │ │ │ │ +
241
│ │ │ │ + │ │ │ │ + │ │ │ │ +
247
│ │ │ │ +
│ │ │ │ +
260 inline void applyPowerIteration (const Real& epsilon,
│ │ │ │ +
261 BlockVector& x, Real& lambda) const
│ │ │ │ +
262 {
│ │ │ │ +
263 // print verbosity information
│ │ │ │ +
264 if (verbosity_level_ > 0)
│ │ │ │ +
265 std::cout << title_
│ │ │ │ +
266 << "Performing power iteration approximating "
│ │ │ │ +
267 << "the dominant eigenvalue." << std::endl;
│ │ │ │ +
268
│ │ │ │ +
269 // allocate memory for auxiliary variables
│ │ │ │ +
270 BlockVector y(x);
│ │ │ │ +
271 BlockVector temp(x);
│ │ │ │
272
│ │ │ │ -
│ │ │ │ -
282 UMFPack(const Matrix& mat_, const ParameterTree& config)
│ │ │ │ -
283 : UMFPack(mat_, config.get<int>("verbose", 0))
│ │ │ │ -
284 {}
│ │ │ │ -
│ │ │ │ -
285
│ │ │ │ -
│ │ │ │ -
288 UMFPack() : matrixIsLoaded_(false), verbosity_(0)
│ │ │ │ -
289 {
│ │ │ │ -
290 //check whether T is a supported type
│ │ │ │ -
291 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ -
292 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ -
293 Caller::defaults(UMF_Control);
│ │ │ │ -
294 }
│ │ │ │ -
│ │ │ │ +
273 // perform power iteration
│ │ │ │ +
274 x *= (1.0 / x.two_norm());
│ │ │ │ +
275 m_.mv(x,y);
│ │ │ │ +
276 Real r_norm = std::numeric_limits<Real>::max();
│ │ │ │ +
277 nIterations_ = 0;
│ │ │ │ +
278 while (r_norm > epsilon)
│ │ │ │ +
279 {
│ │ │ │ +
280 // update and check number of iterations
│ │ │ │ + │ │ │ │ +
282 DUNE_THROW(Dune::ISTLError,"Power iteration did not converge "
│ │ │ │ +
283 << "in " << nIterationsMax_ << " iterations "
│ │ │ │ +
284 << "(║residual║_2 = " << r_norm << ", epsilon = "
│ │ │ │ +
285 << epsilon << ").");
│ │ │ │ +
286
│ │ │ │ +
287 // do one iteration of the power iteration algorithm
│ │ │ │ +
288 // (use that y = m_ * x)
│ │ │ │ +
289 x = y;
│ │ │ │ +
290 x *= (1.0 / y.two_norm());
│ │ │ │ +
291
│ │ │ │ +
292 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ +
293 m_.mv(x,y);
│ │ │ │ +
294 lambda = x * y;
│ │ │ │
295
│ │ │ │ -
│ │ │ │ -
306 UMFPack(const Matrix& mat_, const char* file, int verbose=0)
│ │ │ │ -
307 {
│ │ │ │ -
308 //check whether T is a supported type
│ │ │ │ -
309 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ -
310 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ -
311 Caller::defaults(UMF_Control);
│ │ │ │ -
312 setVerbosity(verbose);
│ │ │ │ -
313 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ │ -
314 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == UMFPACK_ERROR_file_IO))
│ │ │ │ -
315 {
│ │ │ │ -
316 matrixIsLoaded_ = false;
│ │ │ │ -
317 setMatrix(mat_);
│ │ │ │ -
318 saveDecomposition(file);
│ │ │ │ -
319 }
│ │ │ │ -
320 else
│ │ │ │ -
321 {
│ │ │ │ -
322 matrixIsLoaded_ = true;
│ │ │ │ -
323 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ │ -
324 }
│ │ │ │ -
325 }
│ │ │ │ -
│ │ │ │ -
326
│ │ │ │ -
│ │ │ │ -
333 UMFPack(const char* file, int verbose=0)
│ │ │ │ -
334 {
│ │ │ │ -
335 //check whether T is a supported type
│ │ │ │ -
336 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ │ -
337 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ -
338 Caller::defaults(UMF_Control);
│ │ │ │ -
339 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ │ -
340 if (errcode == UMFPACK_ERROR_out_of_memory)
│ │ │ │ -
341 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack decomposition");
│ │ │ │ -
342 if (errcode == UMFPACK_ERROR_file_IO)
│ │ │ │ -
343 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack decomposition");
│ │ │ │ -
344 matrixIsLoaded_ = true;
│ │ │ │ -
345 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ │ -
346 setVerbosity(verbose);
│ │ │ │ -
347 }
│ │ │ │ -
│ │ │ │ -
348
│ │ │ │ -
│ │ │ │ -
349 virtual ~UMFPack()
│ │ │ │ -
350 {
│ │ │ │ -
351 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ │ -
352 free();
│ │ │ │ -
353 }
│ │ │ │ -
│ │ │ │ -
354
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
359 {
│ │ │ │ -
360 if (umfpackMatrix_.N() != b.dim())
│ │ │ │ -
361 DUNE_THROW(Dune::ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
│ │ │ │ -
362 if (umfpackMatrix_.M() != x.dim())
│ │ │ │ -
363 DUNE_THROW(Dune::ISTLError, "Size of solution vector x does not match the number of matrix columns!");
│ │ │ │ -
364 if (b.size() == 0)
│ │ │ │ -
365 return;
│ │ │ │ -
366
│ │ │ │ -
367 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ │ -
368 Caller::solve(UMFPACK_A,
│ │ │ │ -
369 umfpackMatrix_.getColStart(),
│ │ │ │ -
370 umfpackMatrix_.getRowIndex(),
│ │ │ │ -
371 umfpackMatrix_.getValues(),
│ │ │ │ -
372 reinterpret_cast<double*>(&x[0]),
│ │ │ │ -
373 reinterpret_cast<double*>(&b[0]),
│ │ │ │ -
374 UMF_Numeric,
│ │ │ │ -
375 UMF_Control,
│ │ │ │ -
376 UMF_Apply_Info);
│ │ │ │ -
377
│ │ │ │ -
378 //this is a direct solver
│ │ │ │ -
379 res.iterations = 1;
│ │ │ │ -
380 res.converged = true;
│ │ │ │ -
381 res.elapsed = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME];
│ │ │ │ -
382
│ │ │ │ -
383 printOnApply(UMF_Apply_Info);
│ │ │ │ -
384 }
│ │ │ │ -
│ │ │ │ -
385
│ │ │ │ -
│ │ │ │ -
389 virtual void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ │ -
390 {
│ │ │ │ -
391 apply(x,b,res);
│ │ │ │ -
392 }
│ │ │ │ -
│ │ │ │ -
393
│ │ │ │ -
│ │ │ │ -
399 void apply(T* x, T* b)
│ │ │ │ -
400 {
│ │ │ │ -
401 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ │ -
402 Caller::solve(UMFPACK_A,
│ │ │ │ -
403 umfpackMatrix_.getColStart(),
│ │ │ │ -
404 umfpackMatrix_.getRowIndex(),
│ │ │ │ -
405 umfpackMatrix_.getValues(),
│ │ │ │ -
406 x,
│ │ │ │ -
407 b,
│ │ │ │ -
408 UMF_Numeric,
│ │ │ │ -
409 UMF_Control,
│ │ │ │ -
410 UMF_Apply_Info);
│ │ │ │ -
411 printOnApply(UMF_Apply_Info);
│ │ │ │ -
412 }
│ │ │ │ -
│ │ │ │ -
413
│ │ │ │ -
│ │ │ │ -
425 void setOption(unsigned int option, double value)
│ │ │ │ -
426 {
│ │ │ │ -
427 if (option >= UMFPACK_CONTROL)
│ │ │ │ -
428 DUNE_THROW(RangeError, "Requested non-existing UMFPack option");
│ │ │ │ -
429
│ │ │ │ -
430 UMF_Control[option] = value;
│ │ │ │ -
431 }
│ │ │ │ -
│ │ │ │ -
432
│ │ │ │ -
│ │ │ │ -
436 void saveDecomposition(const char* file)
│ │ │ │ -
437 {
│ │ │ │ -
438 int errcode = Caller::save_numeric(UMF_Numeric, const_cast<char*>(file));
│ │ │ │ -
439 if (errcode != UMFPACK_OK)
│ │ │ │ -
440 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack decomposition");
│ │ │ │ -
441 }
│ │ │ │ -
│ │ │ │ -
442
│ │ │ │ -
│ │ │ │ -
444 void setMatrix(const Matrix& matrix)
│ │ │ │ -
445 {
│ │ │ │ -
446 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ │ -
447 free();
│ │ │ │ -
448 if (matrix.N() == 0 or matrix.M() == 0)
│ │ │ │ -
449 return;
│ │ │ │ -
450
│ │ │ │ -
451 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ │ -
452 umfpackMatrix_.free();
│ │ │ │ -
453 umfpackMatrix_.setSize(MatrixDimension<Matrix>::rowdim(matrix),
│ │ │ │ - │ │ │ │ -
455 ISTL::Impl::BCCSMatrixInitializer<Matrix, long int> initializer(umfpackMatrix_);
│ │ │ │ -
456
│ │ │ │ -
457 copyToBCCSMatrix(initializer, matrix);
│ │ │ │ -
458
│ │ │ │ -
459 decompose();
│ │ │ │ -
460 }
│ │ │ │ -
│ │ │ │ -
461
│ │ │ │ -
462 template<class S>
│ │ │ │ -
│ │ │ │ -
463 void setSubMatrix(const Matrix& _mat, const S& rowIndexSet)
│ │ │ │ -
464 {
│ │ │ │ -
465 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ │ -
466 free();
│ │ │ │ -
467
│ │ │ │ -
468 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ │ -
469 umfpackMatrix_.free();
│ │ │ │ -
470
│ │ │ │ -
471 umfpackMatrix_.setSize(rowIndexSet.size()*MatrixDimension<Matrix>::rowdim(_mat) / _mat.N(),
│ │ │ │ -
472 rowIndexSet.size()*MatrixDimension<Matrix>::coldim(_mat) / _mat.M());
│ │ │ │ -
473 ISTL::Impl::BCCSMatrixInitializer<Matrix, long int> initializer(umfpackMatrix_);
│ │ │ │ -
474
│ │ │ │ -
475 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(_mat,rowIndexSet));
│ │ │ │ +
296 // get norm of residual (use that y = m_ * x)
│ │ │ │ +
297 temp = y;
│ │ │ │ +
298 temp.axpy(-lambda,x);
│ │ │ │ +
299 r_norm = temp.two_norm();
│ │ │ │ +
300
│ │ │ │ +
301 // print verbosity information
│ │ │ │ +
302 if (verbosity_level_ > 1)
│ │ │ │ +
303 std::cout << blank_ << std::left
│ │ │ │ +
304 << "iteration " << std::setw(3) << nIterations_
│ │ │ │ +
305 << " (║residual║_2 = " << std::setw(11) << r_norm
│ │ │ │ +
306 << "): λ = " << lambda << std::endl
│ │ │ │ +
307 << std::resetiosflags(std::ios::left);
│ │ │ │ +
308 }
│ │ │ │ +
309
│ │ │ │ +
310 // print verbosity information
│ │ │ │ +
311 if (verbosity_level_ > 0)
│ │ │ │ +
312 {
│ │ │ │ +
313 std::cout << blank_ << "Result ("
│ │ │ │ +
314 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
315 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
316 << "λ = " << lambda << std::endl;
│ │ │ │ +
317 if (verbosity_level_ > 2)
│ │ │ │ +
318 {
│ │ │ │ +
319 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ +
320 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
321 }
│ │ │ │ +
322 }
│ │ │ │ +
323 }
│ │ │ │ +
│ │ │ │ +
324
│ │ │ │ +
353 template <typename ISTLLinearSolver,
│ │ │ │ +
354 bool avoidLinSolverCrime = false>
│ │ │ │ +
│ │ │ │ +
355 inline void applyInverseIteration (const Real& epsilon,
│ │ │ │ +
356 ISTLLinearSolver& solver,
│ │ │ │ +
357 BlockVector& x, Real& lambda) const
│ │ │ │ +
358 {
│ │ │ │ +
359 constexpr Real gamma = 0.0;
│ │ │ │ +
360 applyInverseIteration(gamma,epsilon,solver,x,lambda);
│ │ │ │ +
361 }
│ │ │ │ +
│ │ │ │ +
362
│ │ │ │ +
392 template <typename ISTLLinearSolver,
│ │ │ │ +
393 bool avoidLinSolverCrime = false>
│ │ │ │ +
│ │ │ │ +
394 inline void applyInverseIteration (const Real& gamma,
│ │ │ │ +
395 const Real& epsilon,
│ │ │ │ +
396 ISTLLinearSolver& solver,
│ │ │ │ +
397 BlockVector& x, Real& lambda) const
│ │ │ │ +
398 {
│ │ │ │ +
399 // print verbosity information
│ │ │ │ +
400 if (verbosity_level_ > 0)
│ │ │ │ +
401 {
│ │ │ │ +
402 std::cout << title_;
│ │ │ │ +
403 if (gamma == 0.0)
│ │ │ │ +
404 std::cout << "Performing inverse iteration approximating "
│ │ │ │ +
405 << "the least dominant eigenvalue." << std::endl;
│ │ │ │ +
406 else
│ │ │ │ +
407 std::cout << "Performing inverse iteration with shift "
│ │ │ │ +
408 << "gamma = " << gamma << " approximating the "
│ │ │ │ +
409 << "eigenvalue closest to gamma." << std::endl;
│ │ │ │ +
410 }
│ │ │ │ +
411
│ │ │ │ +
412 // initialize iteration operator,
│ │ │ │ +
413 // initialize iteration matrix when needed
│ │ │ │ +
414 updateShiftMu(gamma,solver);
│ │ │ │ +
415
│ │ │ │ +
416 // allocate memory for linear solver statistics
│ │ │ │ +
417 Dune::InverseOperatorResult solver_statistics;
│ │ │ │ +
418
│ │ │ │ +
419 // allocate memory for auxiliary variables
│ │ │ │ +
420 BlockVector y(x);
│ │ │ │ +
421 Real y_norm;
│ │ │ │ +
422 BlockVector temp(x);
│ │ │ │ +
423
│ │ │ │ +
424 // perform inverse iteration with shift
│ │ │ │ +
425 x *= (1.0 / x.two_norm());
│ │ │ │ +
426 Real r_norm = std::numeric_limits<Real>::max();
│ │ │ │ +
427 nIterations_ = 0;
│ │ │ │ +
428 while (r_norm > epsilon)
│ │ │ │ +
429 {
│ │ │ │ +
430 // update and check number of iterations
│ │ │ │ + │ │ │ │ +
432 DUNE_THROW(Dune::ISTLError,"Inverse iteration "
│ │ │ │ +
433 << (gamma != 0.0 ? "with shift " : "") << "did not "
│ │ │ │ +
434 << "converge in " << nIterationsMax_ << " iterations "
│ │ │ │ +
435 << "(║residual║_2 = " << r_norm << ", epsilon = "
│ │ │ │ +
436 << epsilon << ").");
│ │ │ │ +
437
│ │ │ │ +
438 // do one iteration of the inverse iteration with shift algorithm,
│ │ │ │ +
439 // part 1: solve (m_ - gamma*I) * y = x for y
│ │ │ │ +
440 // (protect x from being changed)
│ │ │ │ +
441 temp = x;
│ │ │ │ +
442 solver.apply(y,temp,solver_statistics);
│ │ │ │ +
443
│ │ │ │ +
444 // get norm of y
│ │ │ │ +
445 y_norm = y.two_norm();
│ │ │ │ +
446
│ │ │ │ +
447 // compile time switch between accuracy and efficiency
│ │ │ │ +
448 if (avoidLinSolverCrime)
│ │ │ │ +
449 {
│ │ │ │ +
450 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ +
451 // (use that x_new = y / y_norm)
│ │ │ │ +
452 m_.mv(y,temp);
│ │ │ │ +
453 lambda = (y * temp) / (y_norm * y_norm);
│ │ │ │ +
454
│ │ │ │ +
455 // get norm of residual
│ │ │ │ +
456 // (use that x_new = y / y_norm, additionally use that temp = m_ * y)
│ │ │ │ +
457 temp.axpy(-lambda,y);
│ │ │ │ +
458 r_norm = temp.two_norm() / y_norm;
│ │ │ │ +
459 }
│ │ │ │ +
460 else
│ │ │ │ +
461 {
│ │ │ │ +
462 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ +
463 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x)
│ │ │ │ +
464 lambda = gamma + (y * x) / (y_norm * y_norm);
│ │ │ │ +
465
│ │ │ │ +
466 // get norm of residual
│ │ │ │ +
467 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x)
│ │ │ │ +
468 temp = x; temp.axpy(gamma-lambda,y);
│ │ │ │ +
469 r_norm = temp.two_norm() / y_norm;
│ │ │ │ +
470 }
│ │ │ │ +
471
│ │ │ │ +
472 // do one iteration of the inverse iteration with shift algorithm,
│ │ │ │ +
473 // part 2: update x
│ │ │ │ +
474 x = y;
│ │ │ │ +
475 x *= (1.0 / y_norm);
│ │ │ │
476
│ │ │ │ -
477 decompose();
│ │ │ │ -
478 }
│ │ │ │ -
│ │ │ │ -
479
│ │ │ │ -
│ │ │ │ -
487 void setVerbosity(int v)
│ │ │ │ -
488 {
│ │ │ │ -
489 verbosity_ = v;
│ │ │ │ -
490 // set the verbosity level in UMFPack
│ │ │ │ -
491 if (verbosity_ == 0)
│ │ │ │ -
492 UMF_Control[UMFPACK_PRL] = 1;
│ │ │ │ -
493 if (verbosity_ == 1)
│ │ │ │ -
494 UMF_Control[UMFPACK_PRL] = 2;
│ │ │ │ -
495 if (verbosity_ == 2)
│ │ │ │ -
496 UMF_Control[UMFPACK_PRL] = 4;
│ │ │ │ -
497 }
│ │ │ │ -
│ │ │ │ -
498
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
504 {
│ │ │ │ -
505 return UMF_Numeric;
│ │ │ │ -
506 }
│ │ │ │ -
│ │ │ │ -
507
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
513 {
│ │ │ │ -
514 return umfpackMatrix_;
│ │ │ │ -
515 }
│ │ │ │ -
│ │ │ │ -
516
│ │ │ │ -
│ │ │ │ -
521 void free()
│ │ │ │ -
522 {
│ │ │ │ -
523 if (!matrixIsLoaded_)
│ │ │ │ -
524 {
│ │ │ │ -
525 Caller::free_symbolic(&UMF_Symbolic);
│ │ │ │ -
526 umfpackMatrix_.free();
│ │ │ │ -
527 }
│ │ │ │ -
528 Caller::free_numeric(&UMF_Numeric);
│ │ │ │ -
529 matrixIsLoaded_ = false;
│ │ │ │ -
530 }
│ │ │ │ -
│ │ │ │ -
531
│ │ │ │ -
532 const char* name() { return "UMFPACK"; }
│ │ │ │ -
533
│ │ │ │ -
534 private:
│ │ │ │ -
535 typedef typename Dune::UMFPackMethodChooser<T> Caller;
│ │ │ │ -
536
│ │ │ │ -
537 template<class Mat,class X, class TM, class TD, class T1>
│ │ │ │ - │ │ │ │ - │ │ │ │ -
540
│ │ │ │ -
542 void decompose()
│ │ │ │ -
543 {
│ │ │ │ -
544 double UMF_Decomposition_Info[UMFPACK_INFO];
│ │ │ │ -
545 Caller::symbolic(static_cast<int>(umfpackMatrix_.N()),
│ │ │ │ -
546 static_cast<int>(umfpackMatrix_.N()),
│ │ │ │ -
547 umfpackMatrix_.getColStart(),
│ │ │ │ -
548 umfpackMatrix_.getRowIndex(),
│ │ │ │ -
549 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ │ -
550 &UMF_Symbolic,
│ │ │ │ -
551 UMF_Control,
│ │ │ │ -
552 UMF_Decomposition_Info);
│ │ │ │ -
553 Caller::numeric(umfpackMatrix_.getColStart(),
│ │ │ │ -
554 umfpackMatrix_.getRowIndex(),
│ │ │ │ -
555 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ │ -
556 UMF_Symbolic,
│ │ │ │ -
557 &UMF_Numeric,
│ │ │ │ -
558 UMF_Control,
│ │ │ │ -
559 UMF_Decomposition_Info);
│ │ │ │ -
560 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]);
│ │ │ │ -
561 if (verbosity_ == 1)
│ │ │ │ -
562 {
│ │ │ │ -
563 std::cout << "[UMFPack Decomposition]" << std::endl;
│ │ │ │ -
564 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_TIME] << ")" << std::endl;
│ │ │ │ -
565 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << std::endl;
│ │ │ │ -
566 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" << std::endl;
│ │ │ │ -
567 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info[UMFPACK_RCOND] << std::endl;
│ │ │ │ -
568 std::cout << "Numbers of non-zeroes in decomposition: L: " << UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info[UMFPACK_UNZ] << std::endl;
│ │ │ │ -
569 }
│ │ │ │ -
570 if (verbosity_ == 2)
│ │ │ │ -
571 {
│ │ │ │ -
572 Caller::report_info(UMF_Control,UMF_Decomposition_Info);
│ │ │ │ -
573 }
│ │ │ │ -
574 }
│ │ │ │ -
575
│ │ │ │ -
576 void printOnApply(double* UMF_Info)
│ │ │ │ -
577 {
│ │ │ │ -
578 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]);
│ │ │ │ -
579 if (verbosity_ > 0)
│ │ │ │ -
580 {
│ │ │ │ -
581 std::cout << "[UMFPack Solve]" << std::endl;
│ │ │ │ -
582 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " (CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl;
│ │ │ │ -
583 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl;
│ │ │ │ -
584 std::cout << "Iterative Refinement steps taken: " << UMF_Info[UMFPACK_IR_TAKEN] << std::endl;
│ │ │ │ -
585 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << UMF_Info[UMFPACK_OMEGA2] << std::endl;
│ │ │ │ -
586 }
│ │ │ │ -
587 }
│ │ │ │ -
588
│ │ │ │ -
589 UMFPackMatrix umfpackMatrix_;
│ │ │ │ -
590 bool matrixIsLoaded_;
│ │ │ │ -
591 int verbosity_;
│ │ │ │ -
592 void *UMF_Symbolic;
│ │ │ │ -
593 void *UMF_Numeric;
│ │ │ │ -
594 double UMF_Control[UMFPACK_CONTROL];
│ │ │ │ -
595 };
│ │ │ │ -
│ │ │ │ -
596
│ │ │ │ -
597 template<typename T, typename A, int n, int m>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
599 {
│ │ │ │ -
600 enum { value=true};
│ │ │ │ -
601 };
│ │ │ │ -
│ │ │ │ -
602
│ │ │ │ -
603 template<typename T, typename A>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
605 {
│ │ │ │ -
606 enum { value = true };
│ │ │ │ -
607 };
│ │ │ │ -
│ │ │ │ +
477 // print verbosity information
│ │ │ │ +
478 if (verbosity_level_ > 1)
│ │ │ │ +
479 std::cout << blank_ << std::left
│ │ │ │ +
480 << "iteration " << std::setw(3) << nIterations_
│ │ │ │ +
481 << " (║residual║_2 = " << std::setw(11) << r_norm
│ │ │ │ +
482 << "): λ = " << lambda << std::endl
│ │ │ │ +
483 << std::resetiosflags(std::ios::left);
│ │ │ │ +
484 }
│ │ │ │ +
485
│ │ │ │ +
486 // print verbosity information
│ │ │ │ +
487 if (verbosity_level_ > 0)
│ │ │ │ +
488 {
│ │ │ │ +
489 std::cout << blank_ << "Result ("
│ │ │ │ +
490 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
491 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
492 << "λ = " << lambda << std::endl;
│ │ │ │ +
493 if (verbosity_level_ > 2)
│ │ │ │ +
494 {
│ │ │ │ +
495 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ +
496 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
497 }
│ │ │ │ +
498 }
│ │ │ │ +
499 }
│ │ │ │ +
│ │ │ │ +
500
│ │ │ │ +
531 template <typename ISTLLinearSolver,
│ │ │ │ +
532 bool avoidLinSolverCrime = false>
│ │ │ │ +
│ │ │ │ +
533 inline void applyRayleighQuotientIteration (const Real& epsilon,
│ │ │ │ +
534 ISTLLinearSolver& solver,
│ │ │ │ +
535 BlockVector& x, Real& lambda) const
│ │ │ │ +
536 {
│ │ │ │ +
537 // print verbosity information
│ │ │ │ +
538 if (verbosity_level_ > 0)
│ │ │ │ +
539 std::cout << title_
│ │ │ │ +
540 << "Performing Rayleigh quotient iteration for "
│ │ │ │ +
541 << "estimated eigenvalue " << lambda << "." << std::endl;
│ │ │ │ +
542
│ │ │ │ +
543 // allocate memory for linear solver statistics
│ │ │ │ +
544 Dune::InverseOperatorResult solver_statistics;
│ │ │ │ +
545
│ │ │ │ +
546 // allocate memory for auxiliary variables
│ │ │ │ +
547 BlockVector y(x);
│ │ │ │ +
548 Real y_norm;
│ │ │ │ +
549 Real lambda_update;
│ │ │ │ +
550 BlockVector temp(x);
│ │ │ │ +
551
│ │ │ │ +
552 // perform Rayleigh quotient iteration
│ │ │ │ +
553 x *= (1.0 / x.two_norm());
│ │ │ │ +
554 Real r_norm = std::numeric_limits<Real>::max();
│ │ │ │ +
555 nIterations_ = 0;
│ │ │ │ +
556 while (r_norm > epsilon)
│ │ │ │ +
557 {
│ │ │ │ +
558 // update and check number of iterations
│ │ │ │ + │ │ │ │ +
560 DUNE_THROW(Dune::ISTLError,"Rayleigh quotient iteration did not "
│ │ │ │ +
561 << "converge in " << nIterationsMax_ << " iterations "
│ │ │ │ +
562 << "(║residual║_2 = " << r_norm << ", epsilon = "
│ │ │ │ +
563 << epsilon << ").");
│ │ │ │ +
564
│ │ │ │ +
565 // update iteration operator,
│ │ │ │ +
566 // update iteration matrix when needed
│ │ │ │ +
567 updateShiftMu(lambda,solver);
│ │ │ │ +
568
│ │ │ │ +
569 // do one iteration of the Rayleigh quotient iteration algorithm,
│ │ │ │ +
570 // part 1: solve (m_ - lambda*I) * y = x for y
│ │ │ │ +
571 // (protect x from being changed)
│ │ │ │ +
572 temp = x;
│ │ │ │ +
573 solver.apply(y,temp,solver_statistics);
│ │ │ │ +
574
│ │ │ │ +
575 // get norm of y
│ │ │ │ +
576 y_norm = y.two_norm();
│ │ │ │ +
577
│ │ │ │ +
578 // compile time switch between accuracy and efficiency
│ │ │ │ +
579 if (avoidLinSolverCrime)
│ │ │ │ +
580 {
│ │ │ │ +
581 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ +
582 // (use that x_new = y / y_norm)
│ │ │ │ +
583 m_.mv(y,temp);
│ │ │ │ +
584 lambda = (y * temp) / (y_norm * y_norm);
│ │ │ │ +
585
│ │ │ │ +
586 // get norm of residual
│ │ │ │ +
587 // (use that x_new = y / y_norm, additionally use that temp = m_ * y)
│ │ │ │ +
588 temp.axpy(-lambda,y);
│ │ │ │ +
589 r_norm = temp.two_norm() / y_norm;
│ │ │ │ +
590 }
│ │ │ │ +
591 else
│ │ │ │ +
592 {
│ │ │ │ +
593 // get approximated eigenvalue lambda via the Rayleigh quotient
│ │ │ │ +
594 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x)
│ │ │ │ +
595 lambda_update = (y * x) / (y_norm * y_norm);
│ │ │ │ +
596 lambda += lambda_update;
│ │ │ │ +
597
│ │ │ │ +
598 // get norm of residual
│ │ │ │ +
599 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x)
│ │ │ │ +
600 temp = x; temp.axpy(-lambda_update,y);
│ │ │ │ +
601 r_norm = temp.two_norm() / y_norm;
│ │ │ │ +
602 }
│ │ │ │ +
603
│ │ │ │ +
604 // do one iteration of the Rayleigh quotient iteration algorithm,
│ │ │ │ +
605 // part 2: update x
│ │ │ │ +
606 x = y;
│ │ │ │ +
607 x *= (1.0 / y_norm);
│ │ │ │
608
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
610 template<class F,class=void> struct isValidBlock : std::false_type{};
│ │ │ │ -
611 template<class B> struct isValidBlock<B, std::enable_if_t<std::is_same<typename FieldTraits<B>::real_type,double>::value>> : std::true_type {};
│ │ │ │ -
612
│ │ │ │ -
613 template<typename TL, typename M>
│ │ │ │ -
614 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ -
615 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ -
│ │ │ │ -
616 operator() (TL /*tl*/, const M& mat, const Dune::ParameterTree& config,
│ │ │ │ -
617 std::enable_if_t<
│ │ │ │ -
618 isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ -
619 {
│ │ │ │ -
620 int verbose = config.get("verbose", 0);
│ │ │ │ -
621 return std::make_shared<Dune::UMFPack<M>>(mat,verbose);
│ │ │ │ -
622 }
│ │ │ │ -
│ │ │ │ -
623
│ │ │ │ -
624 // second version with SFINAE to validate the template parameters of UMFPack
│ │ │ │ -
625 template<typename TL, typename M>
│ │ │ │ -
626 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ │ -
627 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ │ -
│ │ │ │ -
628 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ │ -
629 std::enable_if_t<
│ │ │ │ -
630 !isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ │ -
631 {
│ │ │ │ -
632 DUNE_THROW(UnsupportedType,
│ │ │ │ -
633 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ │ -
634 }
│ │ │ │ -
│ │ │ │ -
635 };
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
637} // end namespace Dune
│ │ │ │ -
638
│ │ │ │ -
639#endif // HAVE_SUITESPARSE_UMFPACK
│ │ │ │ -
640
│ │ │ │ -
641#endif //DUNE_ISTL_UMFPACK_HH
│ │ │ │ -
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ │ -
Templates characterizing the type of a solver.
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ - │ │ │ │ -
Implementations of the inverse operator interface.
│ │ │ │ - │ │ │ │ -
void free()
free allocated space.
Definition umfpack.hh:521
│ │ │ │ -
virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition umfpack.hh:358
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition umfpack.hh:232
│ │ │ │ -
M matrix_type
Definition umfpack.hh:221
│ │ │ │ -
static void solve(long int m, const long int *cs, const long int *ri, std::complex< double > *val, double *x, const double *b, A... args)
Definition umfpack.hh:156
│ │ │ │ -
void setMatrix(const Matrix &matrix)
Initialize data from given matrix.
Definition umfpack.hh:444
│ │ │ │ -
static void report_info(A... args)
Definition umfpack.hh:141
│ │ │ │ -
UMFPack(const Matrix &mat_, const ParameterTree &config)
Construct a solver object from a matrix.
Definition umfpack.hh:282
│ │ │ │ -
static int load_numeric(A... args)
Definition umfpack.hh:131
│ │ │ │ -
static int load_numeric(A... args)
Definition umfpack.hh:74
│ │ │ │ -
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
Definition umfpack.hh:616
│ │ │ │ -
ISTL::Impl::BCCSMatrix< typename Matrix::field_type, long int > UMFPackMatrix
The corresponding UMFPack matrix type.
Definition umfpack.hh:223
│ │ │ │ -
static void report_status(A... args)
Definition umfpack.hh:89
│ │ │ │ -
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:306
│ │ │ │ -
typename Impl::UMFPackVectorChooser< M >::range_type range_type
The type of the range of the solver.
Definition umfpack.hh:229
│ │ │ │ -
UMFPack()
default constructor
Definition umfpack.hh:288
│ │ │ │ -
static void symbolic(A... args)
Definition umfpack.hh:104
│ │ │ │ -
static void report_info(A... args)
Definition umfpack.hh:84
│ │ │ │ -
static void symbolic(long int m, long int n, const long int *cs, const long int *ri, const double *val, A... args)
Definition umfpack.hh:162
│ │ │ │ -
static void free_symbolic(A... args)
Definition umfpack.hh:69
│ │ │ │ -
static int save_numeric(A... args)
Definition umfpack.hh:151
│ │ │ │ -
static void free_numeric(A... args)
Definition umfpack.hh:121
│ │ │ │ -
void setSubMatrix(const Matrix &_mat, const S &rowIndexSet)
Definition umfpack.hh:463
│ │ │ │ -
static int save_numeric(A... args)
Definition umfpack.hh:94
│ │ │ │ -
static void report_status(A... args)
Definition umfpack.hh:146
│ │ │ │ -
ISTL::Impl::BCCSMatrixInitializer< M, long int > MatrixInitializer
Type of an associated initializer class.
Definition umfpack.hh:225
│ │ │ │ -
void apply(T *x, T *b)
additional apply method with c-arrays in analogy to superlu
Definition umfpack.hh:399
│ │ │ │ -
static void defaults(A... args)
Definition umfpack.hh:116
│ │ │ │ -
static void free_numeric(A... args)
Definition umfpack.hh:64
│ │ │ │ -
void setVerbosity(int v)
sets the verbosity level for the UMFPack solver
Definition umfpack.hh:487
│ │ │ │ -
UMFPack(const char *file, int verbose=0)
try loading a decomposition from file
Definition umfpack.hh:333
│ │ │ │ -
static void numeric(A... args)
Definition umfpack.hh:79
│ │ │ │ -
static constexpr bool valid
Definition umfpack.hh:50
│ │ │ │ -
virtual ~UMFPack()
Definition umfpack.hh:349
│ │ │ │ -
const char * name()
Definition umfpack.hh:532
│ │ │ │ -
void saveDecomposition(const char *file)
saves a decomposition to a file
Definition umfpack.hh:436
│ │ │ │ -
UMFPackMatrix & getInternalMatrix()
Return the column compress matrix from UMFPack.
Definition umfpack.hh:512
│ │ │ │ -
typename Impl::UMFPackVectorChooser< M >::domain_type domain_type
The type of the domain of the solver.
Definition umfpack.hh:227
│ │ │ │ -
UMFPack(const Matrix &matrix, int verbose=0)
Construct a solver object from a matrix.
Definition umfpack.hh:245
│ │ │ │ -
virtual void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition umfpack.hh:389
│ │ │ │ -
void setOption(unsigned int option, double value)
Set UMFPack-specific options.
Definition umfpack.hh:425
│ │ │ │ -
static void free_symbolic(A... args)
Definition umfpack.hh:126
│ │ │ │ -
M Matrix
The matrix type.
Definition umfpack.hh:220
│ │ │ │ -
static void numeric(const long int *cs, const long int *ri, const double *val, A... args)
Definition umfpack.hh:136
│ │ │ │ -
static void defaults(A... args)
Definition umfpack.hh:59
│ │ │ │ -
static void solve(A... args)
Definition umfpack.hh:99
│ │ │ │ -
UMFPack(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition umfpack.hh:263
│ │ │ │ -
void * getFactorization()
Return the matrix factorization.
Definition umfpack.hh:503
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
STL namespace.
│ │ │ │ +
609 // print verbosity information
│ │ │ │ +
610 if (verbosity_level_ > 1)
│ │ │ │ +
611 std::cout << blank_ << std::left
│ │ │ │ +
612 << "iteration " << std::setw(3) << nIterations_
│ │ │ │ +
613 << " (║residual║_2 = " << std::setw(11) << r_norm
│ │ │ │ +
614 << "): λ = " << lambda << std::endl
│ │ │ │ +
615 << std::resetiosflags(std::ios::left);
│ │ │ │ +
616 }
│ │ │ │ +
617
│ │ │ │ +
618 // print verbosity information
│ │ │ │ +
619 if (verbosity_level_ > 0)
│ │ │ │ +
620 {
│ │ │ │ +
621 std::cout << blank_ << "Result ("
│ │ │ │ +
622 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
623 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
624 << "λ = " << lambda << std::endl;
│ │ │ │ +
625 if (verbosity_level_ > 2)
│ │ │ │ +
626 {
│ │ │ │ +
627 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ +
628 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
629 }
│ │ │ │ +
630 }
│ │ │ │ +
631 }
│ │ │ │ +
│ │ │ │ +
632
│ │ │ │ +
689 template <typename ISTLLinearSolver,
│ │ │ │ +
690 bool avoidLinSolverCrime = false>
│ │ │ │ +
│ │ │ │ +
691 inline void applyTLIMEIteration (const Real& gamma, const Real& eta,
│ │ │ │ +
692 const Real& epsilon,
│ │ │ │ +
693 ISTLLinearSolver& solver,
│ │ │ │ +
694 const Real& delta, const std::size_t& m,
│ │ │ │ +
695 bool& extrnl,
│ │ │ │ +
696 BlockVector& x, Real& lambda) const
│ │ │ │ +
697 {
│ │ │ │ +
698 // use same variable names as in [Szyld, 1988]
│ │ │ │ +
699 BlockVector& x_s = x;
│ │ │ │ +
700 Real& mu_s = lambda;
│ │ │ │ +
701
│ │ │ │ +
702 // print verbosity information
│ │ │ │ +
703 if (verbosity_level_ > 0)
│ │ │ │ +
704 std::cout << title_
│ │ │ │ +
705 << "Performing TLIME iteration for "
│ │ │ │ +
706 << "estimated eigenvalue in the "
│ │ │ │ +
707 << "interval (" << gamma - eta << ","
│ │ │ │ +
708 << gamma + eta << ")." << std::endl;
│ │ │ │ +
709
│ │ │ │ +
710 // allocate memory for linear solver statistics
│ │ │ │ +
711 Dune::InverseOperatorResult solver_statistics;
│ │ │ │ +
712
│ │ │ │ +
713 // allocate memory for auxiliary variables
│ │ │ │ +
714 bool doRQI;
│ │ │ │ +
715 Real mu;
│ │ │ │ +
716 BlockVector y(x_s);
│ │ │ │ +
717 Real omega;
│ │ │ │ +
718 Real mu_s_old;
│ │ │ │ +
719 Real mu_s_update;
│ │ │ │ +
720 BlockVector temp(x_s);
│ │ │ │ +
721 Real q_norm, r_norm;
│ │ │ │ +
722
│ │ │ │ +
723 // perform TLIME iteration
│ │ │ │ +
724 x_s *= (1.0 / x_s.two_norm());
│ │ │ │ +
725 extrnl = true;
│ │ │ │ +
726 doRQI = false;
│ │ │ │ +
727 r_norm = std::numeric_limits<Real>::max();
│ │ │ │ +
728 nIterations_ = 0;
│ │ │ │ +
729 while (r_norm > epsilon)
│ │ │ │ +
730 {
│ │ │ │ +
731 // update and check number of iterations
│ │ │ │ + │ │ │ │ +
733 DUNE_THROW(Dune::ISTLError,"TLIME iteration did not "
│ │ │ │ +
734 << "converge in " << nIterationsMax_
│ │ │ │ +
735 << " iterations (║residual║_2 = " << r_norm
│ │ │ │ +
736 << ", epsilon = " << epsilon << ").");
│ │ │ │ +
737
│ │ │ │ +
738 // set shift for next iteration according to inverse iteration
│ │ │ │ +
739 // with shift (II) resp. Rayleigh quotient iteration (RQI)
│ │ │ │ +
740 if (doRQI)
│ │ │ │ +
741 mu = mu_s;
│ │ │ │ +
742 else
│ │ │ │ +
743 mu = gamma;
│ │ │ │ +
744
│ │ │ │ +
745 // update II/RQI iteration operator,
│ │ │ │ +
746 // update II/RQI iteration matrix when needed
│ │ │ │ +
747 updateShiftMu(mu,solver);
│ │ │ │ +
748
│ │ │ │ +
749 // do one iteration of the II/RQI algorithm,
│ │ │ │ +
750 // part 1: solve (m_ - mu*I) * y = x for y
│ │ │ │ +
751 temp = x_s;
│ │ │ │ +
752 solver.apply(y,temp,solver_statistics);
│ │ │ │ +
753
│ │ │ │ +
754 // do one iteration of the II/RQI algorithm,
│ │ │ │ +
755 // part 2: compute omega
│ │ │ │ +
756 omega = (1.0 / y.two_norm());
│ │ │ │ +
757
│ │ │ │ +
758 // backup the old Rayleigh quotient
│ │ │ │ +
759 mu_s_old = mu_s;
│ │ │ │ +
760
│ │ │ │ +
761 // compile time switch between accuracy and efficiency
│ │ │ │ +
762 if (avoidLinSolverCrime)
│ │ │ │ +
763 {
│ │ │ │ +
764 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue
│ │ │ │ +
765 // (use that x_new = y * omega)
│ │ │ │ +
766 m_.mv(y,temp);
│ │ │ │ +
767 mu_s = (y * temp) * (omega * omega);
│ │ │ │ +
768
│ │ │ │ +
769 // get norm of "the residual with respect to the shift used by II",
│ │ │ │ +
770 // use normal representation of q
│ │ │ │ +
771 // (use that x_new = y * omega, use that temp = m_ * y)
│ │ │ │ +
772 temp.axpy(-gamma,y);
│ │ │ │ +
773 q_norm = temp.two_norm() * omega;
│ │ │ │ +
774
│ │ │ │ +
775 // get norm of "the residual with respect to the Rayleigh quotient"
│ │ │ │ +
776 r_norm = q_norm*q_norm - (gamma-mu_s)*(gamma-mu_s);
│ │ │ │ +
777 // prevent that truncation errors invalidate the norm
│ │ │ │ +
778 // (we don't want to calculate sqrt of a negative number)
│ │ │ │ +
779 if (r_norm >= 0)
│ │ │ │ +
780 {
│ │ │ │ +
781 // use relation between the norms of r and q for efficiency
│ │ │ │ +
782 r_norm = std::sqrt(r_norm);
│ │ │ │ +
783 }
│ │ │ │ +
784 else
│ │ │ │ +
785 {
│ │ │ │ +
786 // use relation between r and q
│ │ │ │ +
787 // (use that x_new = y * omega, use that temp = (m_ - gamma*I) * y = q / omega)
│ │ │ │ +
788 temp.axpy(gamma-mu_s,y);
│ │ │ │ +
789 r_norm = temp.two_norm() * omega;
│ │ │ │ +
790 }
│ │ │ │ +
791 }
│ │ │ │ +
792 else
│ │ │ │ +
793 {
│ │ │ │ +
794 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue
│ │ │ │ +
795 if (!doRQI)
│ │ │ │ +
796 {
│ │ │ │ +
797 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = x_s)
│ │ │ │ +
798 mu_s = gamma + (y * x_s) * (omega * omega);
│ │ │ │ +
799 }
│ │ │ │ +
800 else
│ │ │ │ +
801 {
│ │ │ │ +
802 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y = x_s)
│ │ │ │ +
803 mu_s_update = (y * x_s) * (omega * omega);
│ │ │ │ +
804 mu_s += mu_s_update;
│ │ │ │ +
805 }
│ │ │ │ +
806
│ │ │ │ +
807 // get norm of "the residual with respect to the shift used by II"
│ │ │ │ +
808 if (!doRQI)
│ │ │ │ +
809 {
│ │ │ │ +
810 // use special representation of q in the II case
│ │ │ │ +
811 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = x_s)
│ │ │ │ +
812 q_norm = omega;
│ │ │ │ +
813 }
│ │ │ │ +
814 else
│ │ │ │ +
815 {
│ │ │ │ +
816 // use special representation of q in the RQI case
│ │ │ │ +
817 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y = x_s)
│ │ │ │ +
818 temp = x_s; temp.axpy(mu_s-gamma,y);
│ │ │ │ +
819 q_norm = temp.two_norm() * omega;
│ │ │ │ +
820 }
│ │ │ │ +
821
│ │ │ │ +
822 // get norm of "the residual with respect to the Rayleigh quotient"
│ │ │ │ +
823 // don't use efficient relation between the norms of r and q, as
│ │ │ │ +
824 // this relation seems to yield a less accurate r_norm in the case
│ │ │ │ +
825 // where linear solver crime is admitted
│ │ │ │ +
826 if (!doRQI)
│ │ │ │ +
827 {
│ │ │ │ +
828 // (use that x_new = y * omega and use that (m_ - gamma*I) * y = x_s)
│ │ │ │ +
829 temp = x_s; temp.axpy(gamma-lambda,y);
│ │ │ │ +
830 r_norm = temp.two_norm() * omega;
│ │ │ │ +
831 }
│ │ │ │ +
832 else
│ │ │ │ +
833 {
│ │ │ │ +
834 // (use that x_new = y * omega and use that (m_ - mu_s_old*I) * y = x_s)
│ │ │ │ +
835 temp = x_s; temp.axpy(-mu_s_update,y);
│ │ │ │ +
836 r_norm = temp.two_norm() * omega;
│ │ │ │ +
837 }
│ │ │ │ +
838 }
│ │ │ │ +
839
│ │ │ │ +
840 // do one iteration of the II/RQI algorithm,
│ │ │ │ +
841 // part 3: update x
│ │ │ │ +
842 x_s = y; x_s *= omega;
│ │ │ │ +
843
│ │ │ │ +
844 // // for relative residual norm mode, scale with mu_s^{-1}
│ │ │ │ +
845 // r_norm /= std::abs(mu_s);
│ │ │ │ +
846
│ │ │ │ +
847 // print verbosity information
│ │ │ │ +
848 if (verbosity_level_ > 1)
│ │ │ │ +
849 std::cout << blank_ << "iteration "
│ │ │ │ +
850 << std::left << std::setw(3) << nIterations_
│ │ │ │ +
851 << " (" << (doRQI ? "RQI," : "II, ")
│ │ │ │ +
852 << " " << (doRQI ? "—>" : " ") << " "
│ │ │ │ +
853 << "║r║_2 = " << std::setw(11) << r_norm
│ │ │ │ +
854 << ", " << (doRQI ? " " : "—>") << " "
│ │ │ │ +
855 << "║q║_2 = " << std::setw(11) << q_norm
│ │ │ │ +
856 << "): λ = " << lambda << std::endl
│ │ │ │ +
857 << std::resetiosflags(std::ios::left);
│ │ │ │ +
858
│ │ │ │ +
859 // check if the eigenvalue closest to gamma lies in J
│ │ │ │ +
860 if (!doRQI && q_norm < eta)
│ │ │ │ +
861 {
│ │ │ │ +
862 // J is not free of eigenvalues
│ │ │ │ +
863 extrnl = false;
│ │ │ │ +
864
│ │ │ │ +
865 // by theory we know now that mu_s also lies in J
│ │ │ │ +
866 assert(std::abs(mu_s-gamma) < eta);
│ │ │ │ +
867
│ │ │ │ +
868 // switch to RQI
│ │ │ │ +
869 doRQI = true;
│ │ │ │ +
870 }
│ │ │ │ +
871
│ │ │ │ +
872 // revert to II if J is not free of eigenvalues but
│ │ │ │ +
873 // at some point mu_s falls back again outside J
│ │ │ │ +
874 if (!extrnl && doRQI && std::abs(mu_s-gamma) >= eta)
│ │ │ │ +
875 doRQI = false;
│ │ │ │ +
876
│ │ │ │ +
877 // if eigenvalue closest to gamma does not lie in J use RQI
│ │ │ │ +
878 // solely to accelerate the convergence to this eigenvalue
│ │ │ │ +
879 // when II has become stationary
│ │ │ │ +
880 if (extrnl && !doRQI)
│ │ │ │ +
881 {
│ │ │ │ +
882 // switch to RQI if the relative change of the Rayleigh
│ │ │ │ +
883 // quotient indicates that II has become stationary
│ │ │ │ +
884 if (nIterations_ >= m &&
│ │ │ │ +
885 std::abs(mu_s - mu_s_old) / std::abs(mu_s) < delta)
│ │ │ │ +
886 doRQI = true;
│ │ │ │ +
887 }
│ │ │ │ +
888 }
│ │ │ │ +
889
│ │ │ │ +
890 // // compute final residual and lambda again (paranoia....)
│ │ │ │ +
891 // m_.mv(x_s,temp);
│ │ │ │ +
892 // mu_s = x_s * temp;
│ │ │ │ +
893 // temp.axpy(-mu_s,x_s);
│ │ │ │ +
894 // r_norm = temp.two_norm();
│ │ │ │ +
895 // // r_norm /= std::abs(mu_s);
│ │ │ │ +
896
│ │ │ │ +
897 // print verbosity information
│ │ │ │ +
898 if (verbosity_level_ > 0)
│ │ │ │ +
899 {
│ │ │ │ +
900 if (extrnl)
│ │ │ │ +
901 std::cout << blank_ << "Interval "
│ │ │ │ +
902 << "(" << gamma - eta << "," << gamma + eta
│ │ │ │ +
903 << ") is free of eigenvalues, approximating "
│ │ │ │ +
904 << "the closest eigenvalue." << std::endl;
│ │ │ │ +
905 std::cout << blank_ << "Result ("
│ │ │ │ +
906 << "#iterations = " << nIterations_ << ", "
│ │ │ │ +
907 << "║residual║_2 = " << r_norm << "): "
│ │ │ │ +
908 << "λ = " << lambda << std::endl;
│ │ │ │ +
909 if (verbosity_level_ > 2)
│ │ │ │ +
910 {
│ │ │ │ +
911 // print approximated eigenvector via DUNE-ISTL I/O methods
│ │ │ │ +
912 Dune::printvector(std::cout,x,blank_+"x",blank_+"row");
│ │ │ │ +
913 }
│ │ │ │ +
914 }
│ │ │ │ +
915 }
│ │ │ │ +
│ │ │ │ +
916
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
926 {
│ │ │ │ +
927 // return iteration operator
│ │ │ │ +
928 return itOperator_;
│ │ │ │ +
929 }
│ │ │ │ +
│ │ │ │ +
930
│ │ │ │ +
│ │ │ │ +
945 inline const BCRSMatrix& getIterationMatrix () const
│ │ │ │ +
946 {
│ │ │ │ +
947 // create iteration matrix on demand
│ │ │ │ +
948 if (!itMatrix_)
│ │ │ │ +
949 itMatrix_ = std::make_unique<BCRSMatrix>(m_);
│ │ │ │ +
950
│ │ │ │ +
951 // return iteration matrix
│ │ │ │ +
952 return *itMatrix_;
│ │ │ │ +
953 }
│ │ │ │ +
│ │ │ │ +
954
│ │ │ │ +
│ │ │ │ +
959 inline unsigned int getIterationCount () const
│ │ │ │ +
960 {
│ │ │ │ +
961 if (nIterations_ == 0)
│ │ │ │ +
962 DUNE_THROW(Dune::ISTLError,"No algorithm applied, yet.");
│ │ │ │ +
963
│ │ │ │ +
964 return nIterations_;
│ │ │ │ +
965 }
│ │ │ │ +
│ │ │ │ +
966
│ │ │ │ +
967 protected:
│ │ │ │ +
982 template <typename ISTLLinearSolver>
│ │ │ │ +
│ │ │ │ +
983 inline void updateShiftMu (const Real& mu,
│ │ │ │ +
984 ISTLLinearSolver& solver) const
│ │ │ │ +
985 {
│ │ │ │ +
986 // do nothing if new shift equals the old one
│ │ │ │ +
987 if (mu == mu_) return;
│ │ │ │ +
988
│ │ │ │ +
989 // update shift mu_, i.e. update iteration operator
│ │ │ │ +
990 mu_ = mu;
│ │ │ │ +
991
│ │ │ │ +
992 // update iteration matrix when needed
│ │ │ │ +
993 if (itMatrix_)
│ │ │ │ +
994 {
│ │ │ │ +
995 // iterate over entries in iteration matrix diagonal
│ │ │ │ +
996 constexpr int rowBlockSize = BCRSMatrix::block_type::rows;
│ │ │ │ +
997 constexpr int colBlockSize = BCRSMatrix::block_type::cols;
│ │ │ │ +
998 for (typename BCRSMatrix::size_type i = 0;
│ │ │ │ +
999 i < itMatrix_->M()*rowBlockSize; ++i)
│ │ │ │ +
1000 {
│ │ │ │ +
1001 // access m_[i,i] where i is the flat index of a row/column
│ │ │ │ +
1002 const Real& m_entry = m_
│ │ │ │ +
1003 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize];
│ │ │ │ +
1004 // access *itMatrix[i,i] where i is the flat index of a row/column
│ │ │ │ +
1005 Real& entry = (*itMatrix_)
│ │ │ │ +
1006 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize];
│ │ │ │ +
1007 // change current entry in iteration matrix diagonal
│ │ │ │ +
1008 entry = m_entry - mu_;
│ │ │ │ +
1009 }
│ │ │ │ +
1010 // notify linear solver about change of the iteration matrix object
│ │ │ │ + │ │ │ │ +
1012 (solver,*itMatrix_);
│ │ │ │ +
1013 }
│ │ │ │ +
1014 }
│ │ │ │ +
│ │ │ │ +
1015
│ │ │ │ +
1016 protected:
│ │ │ │ +
1017 // parameters related to iterative eigenvalue algorithms
│ │ │ │ + │ │ │ │ +
1019 const unsigned int nIterationsMax_;
│ │ │ │ +
1020
│ │ │ │ +
1021 // verbosity setting
│ │ │ │ +
1022 const unsigned int verbosity_level_;
│ │ │ │ +
1023
│ │ │ │ +
1024 // shift mu_ used by iteration operator/matrix (m_ - mu_*I)
│ │ │ │ +
1025 mutable Real mu_;
│ │ │ │ +
1026
│ │ │ │ +
1027 // iteration operator (m_ - mu_*I), passing shift mu_ by reference
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
1031
│ │ │ │ +
1032 // iteration matrix (m_ - mu_*I), provided on demand when needed
│ │ │ │ +
1033 // (e.g. for preconditioning)
│ │ │ │ +
1034 mutable std::unique_ptr<BCRSMatrix> itMatrix_;
│ │ │ │ +
1035
│ │ │ │ +
1036 // memory for storing temporary variables (mutable as they shall
│ │ │ │ +
1037 // just be effectless auxiliary variables of the const apply*(...)
│ │ │ │ +
1038 // methods)
│ │ │ │ +
1039 mutable unsigned int nIterations_;
│ │ │ │ +
1040
│ │ │ │ +
1041 // constants for printing verbosity information
│ │ │ │ +
1042 const std::string title_;
│ │ │ │ +
1043 const std::string blank_;
│ │ │ │ +
1044 };
│ │ │ │ +
│ │ │ │ +
1045
│ │ │ │ +
1048} // namespace Dune
│ │ │ │ +
1049
│ │ │ │ +
1050#endif // DUNE_ISTL_EIGENVALUE_POWERITERATION_HH
│ │ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ │ +
Implementations of the inverse operator interface.
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ +
Templates characterizing the type of a solver.
│ │ │ │ + │ │ │ │ +
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ + │ │ │ │ +
void printvector(std::ostream &s, const V &v, std::string title, std::string rowtext, int columns=1, int width=10, int precision=2)
Print an ISTL vector.
Definition io.hh:89
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │ -
Definition matrixutils.hh:211
│ │ │ │
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ +
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:1978
│ │ │ │ +
void mv(const X &x, Y &y) const
y = A x
Definition bcrsmatrix.hh:1612
│ │ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
│ │ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:401
│ │ │ │ +
Iterative eigenvalue algorithms based on power iteration.
Definition poweriteration.hh:176
│ │ │ │ +
std::unique_ptr< BCRSMatrix > itMatrix_
Definition poweriteration.hh:1034
│ │ │ │ +
PowerIteration_Algorithms(const PowerIteration_Algorithms &)=delete
│ │ │ │ +
Impl::ScalingLinearOperator< BlockVector > ScalingOperator
Definition poweriteration.hh:181
│ │ │ │ +
const std::string blank_
Definition poweriteration.hh:1043
│ │ │ │ +
Impl::LinearOperatorSum< MatrixOperator, ScalingOperator > OperatorSum
Definition poweriteration.hh:182
│ │ │ │ +
Dune::MatrixAdapter< BCRSMatrix, BlockVector, BlockVector > MatrixOperator
Definition poweriteration.hh:180
│ │ │ │ +
void applyInverseIteration(const Real &epsilon, ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const
Perform the inverse iteration algorithm to compute an approximation lambda of the least dominant (i....
Definition poweriteration.hh:355
│ │ │ │ +
void applyTLIMEIteration(const Real &gamma, const Real &eta, const Real &epsilon, ISTLLinearSolver &solver, const Real &delta, const std::size_t &m, bool &extrnl, BlockVector &x, Real &lambda) const
Perform the "two-level iterative method for eigenvalue calculations (TLIME)" iteration algorit...
Definition poweriteration.hh:691
│ │ │ │ +
IterationOperator & getIterationOperator()
Return the iteration operator (m_ - mu_*I).
Definition poweriteration.hh:925
│ │ │ │ +
OperatorSum itOperator_
Definition poweriteration.hh:1030
│ │ │ │ +
const BCRSMatrix & m_
Definition poweriteration.hh:1018
│ │ │ │ +
PowerIteration_Algorithms(const BCRSMatrix &m, const unsigned int nIterationsMax=1000, const unsigned int verbosity_level=0)
Construct from required parameters.
Definition poweriteration.hh:206
│ │ │ │ +
const unsigned int nIterationsMax_
Definition poweriteration.hh:1019
│ │ │ │ +
void applyPowerIteration(const Real &epsilon, BlockVector &x, Real &lambda) const
Perform the power iteration algorithm to compute an approximation lambda of the dominant (i....
Definition poweriteration.hh:260
│ │ │ │ +
OperatorSum IterationOperator
Type of iteration operator (m_ - mu_*I)
Definition poweriteration.hh:189
│ │ │ │ +
void applyRayleighQuotientIteration(const Real &epsilon, ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const
Perform the Rayleigh quotient iteration algorithm to compute an approximation lambda of an eigenvalue...
Definition poweriteration.hh:533
│ │ │ │ +
void applyInverseIteration(const Real &gamma, const Real &epsilon, ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const
Perform the inverse iteration with shift algorithm to compute an approximation lambda of the eigenval...
Definition poweriteration.hh:394
│ │ │ │ +
const ScalingOperator scalingOperator_
Definition poweriteration.hh:1029
│ │ │ │ +
void updateShiftMu(const Real &mu, ISTLLinearSolver &solver) const
Update shift mu_, i.e. update iteration operator/matrix (m_ - mu_*I).
Definition poweriteration.hh:983
│ │ │ │ +
PowerIteration_Algorithms & operator=(const PowerIteration_Algorithms &)=delete
│ │ │ │ +
unsigned int getIterationCount() const
Return the number of iterations in last application of an algorithm.
Definition poweriteration.hh:959
│ │ │ │ +
const MatrixOperator matrixOperator_
Definition poweriteration.hh:1028
│ │ │ │ +
const BCRSMatrix & getIterationMatrix() const
Return the iteration matrix (m_ - mu_*I), provided on demand when needed (e.g. for direct solvers or ...
Definition poweriteration.hh:945
│ │ │ │ +
unsigned int nIterations_
Definition poweriteration.hh:1039
│ │ │ │ +
const unsigned int verbosity_level_
Definition poweriteration.hh:1022
│ │ │ │ +
const std::string title_
Definition poweriteration.hh:1042
│ │ │ │ +
BlockVector::field_type Real
Type of underlying field.
Definition poweriteration.hh:186
│ │ │ │ +
Real mu_
Definition poweriteration.hh:1025
│ │ │ │
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ │ -
Definition overlappingschwarz.hh:694
│ │ │ │ -
Definition matrixutils.hh:27
│ │ │ │ +
A linear operator.
Definition operators.hh:67
│ │ │ │ +
X::field_type field_type
The field type of the operator.
Definition operators.hh:74
│ │ │ │ +
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0
apply operator to x, scale and add:
│ │ │ │ +
virtual SolverCategory::Category category() const =0
Category of the linear operator (see SolverCategory::Category)
│ │ │ │ +
Y range_type
The type of the range of the operator.
Definition operators.hh:72
│ │ │ │ +
virtual void apply(const X &x, Y &y) const =0
apply operator to x: The input vector is consistent and the output must also be consistent on the in...
│ │ │ │ +
X domain_type
The type of the domain of the operator.
Definition operators.hh:70
│ │ │ │ +
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ -
double elapsed
Elapsed time in seconds.
Definition solver.hh:82
│ │ │ │ -
int iterations
Number of iterations.
Definition solver.hh:67
│ │ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:73
│ │ │ │ -
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ +
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:524
│ │ │ │
Category
Definition solvercategory.hh:23
│ │ │ │
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ -
Definition solverregistry.hh:77
│ │ │ │ -
Definition solvertype.hh:16
│ │ │ │ -
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ │ -
Definition solvertype.hh:30
│ │ │ │ -
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │ │ -
Definition umfpack.hh:49
│ │ │ │ -
The UMFPack direct sparse solver.
Definition umfpack.hh:215
│ │ │ │ -
Definition umfpack.hh:609
│ │ │ │ -
Definition umfpack.hh:610
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── encoding │ │ │ │ │ @@ -1 +1 @@ │ │ │ │ │ -us-ascii │ │ │ │ │ +utf-8 │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,842 +1,993 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -umfpack.hh │ │ │ │ │ + * _e_i_g_e_n_v_a_l_u_e │ │ │ │ │ +poweriteration.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 (C) DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -5#ifndef DUNE_ISTL_UMFPACK_HH │ │ │ │ │ -6#define DUNE_ISTL_UMFPACK_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_EIGENVALUE_POWERITERATION_HH │ │ │ │ │ +6#define DUNE_ISTL_EIGENVALUE_POWERITERATION_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_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ │ -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 │ │ │ │ │ -24 │ │ │ │ │ -25 │ │ │ │ │ -26namespace _D_u_n_e { │ │ │ │ │ -38 // FORWARD DECLARATIONS │ │ │ │ │ -39 template │ │ │ │ │ -40 class SeqOverlappingSchwarz; │ │ │ │ │ -41 │ │ │ │ │ -42 template │ │ │ │ │ -43 struct SeqOverlappingSchwarzAssemblerHelper; │ │ │ │ │ -44 │ │ │ │ │ -45 // wrapper class for C-Function Calls in the backend. Choose the right │ │ │ │ │ -function namespace │ │ │ │ │ -46 // depending on the template parameter used. │ │ │ │ │ -47 template │ │ │ │ │ -_4_8 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ -49 { │ │ │ │ │ -_5_0 static constexpr bool _v_a_l_i_d = false ; │ │ │ │ │ -51 }; │ │ │ │ │ +8#include // provides std::size_t │ │ │ │ │ +9#include // provides std::sqrt, std::abs │ │ │ │ │ +10 │ │ │ │ │ +11#include // provides std::is_same │ │ │ │ │ +12#include // provides std::cout, std::endl │ │ │ │ │ +13#include // provides std::numeric_limits │ │ │ │ │ +14#include // provides std::left, std::ios::left │ │ │ │ │ +15#include // provides std::setw, std::resetiosflags │ │ │ │ │ +16#include // provides std::unique_ptr │ │ │ │ │ +17#include // provides std::string │ │ │ │ │ +18 │ │ │ │ │ +19#include // provides DUNE_THROW(...) │ │ │ │ │ +20 │ │ │ │ │ +21#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> // provides Dune::blockLevel │ │ │ │ │ +22#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> // provides Dune::LinearOperator │ │ │ │ │ +23#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> // provides Dune::SolverCategory:: │ │ │ │ │ +sequential │ │ │ │ │ +24#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> // provides Dune::IsDirectSolver │ │ │ │ │ +25#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> // provides Dune::MatrixAdapter │ │ │ │ │ +26#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> // provides Dune::ISTLError │ │ │ │ │ +27#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> // provides Dune::printvector(...) │ │ │ │ │ +28#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> // provides Dune::InverseOperatorResult │ │ │ │ │ +29 │ │ │ │ │ +30namespace _D_u_n_e │ │ │ │ │ +31{ │ │ │ │ │ +32 │ │ │ │ │ +37 namespace Impl { │ │ │ │ │ +45 template │ │ │ │ │ +46 class ScalingLinearOperator : public _D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ +47 { │ │ │ │ │ +48 public: │ │ │ │ │ +49 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +50 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +51 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ 52 │ │ │ │ │ -53 template<> │ │ │ │ │ -_5_4 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ -55 { │ │ │ │ │ -_5_6 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ │ -57 │ │ │ │ │ -58 template │ │ │ │ │ -_5_9 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ │ +53 ScalingLinearOperator (field_type immutable_scaling, │ │ │ │ │ +54 const field_type& mutable_scaling) │ │ │ │ │ +55 : immutable_scaling_(immutable_scaling), │ │ │ │ │ +56 mutable_scaling_(mutable_scaling) │ │ │ │ │ +57 {} │ │ │ │ │ +58 │ │ │ │ │ +59 virtual void _a_p_p_l_y (const X& x, Y& y) const │ │ │ │ │ 60 { │ │ │ │ │ -61 umfpack_dl_defaults(args...); │ │ │ │ │ -62 } │ │ │ │ │ -63 template │ │ │ │ │ -_6_4 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ -65 { │ │ │ │ │ -66 umfpack_dl_free_numeric(args...); │ │ │ │ │ -67 } │ │ │ │ │ -68 template │ │ │ │ │ -_6_9 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ │ -70 { │ │ │ │ │ -71 umfpack_dl_free_symbolic(args...); │ │ │ │ │ -72 } │ │ │ │ │ -73 template │ │ │ │ │ -_7_4 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ │ -75 { │ │ │ │ │ -76 return umfpack_dl_load_numeric(args...); │ │ │ │ │ -77 } │ │ │ │ │ -78 template │ │ │ │ │ -_7_9 static void _n_u_m_e_r_i_c(A... args) │ │ │ │ │ -80 { │ │ │ │ │ -81 umfpack_dl_numeric(args...); │ │ │ │ │ -82 } │ │ │ │ │ -83 template │ │ │ │ │ -_8_4 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ │ -85 { │ │ │ │ │ -86 umfpack_dl_report_info(args...); │ │ │ │ │ -87 } │ │ │ │ │ -88 template │ │ │ │ │ -_8_9 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ │ -90 { │ │ │ │ │ -91 umfpack_dl_report_status(args...); │ │ │ │ │ -92 } │ │ │ │ │ -93 template │ │ │ │ │ -_9_4 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ -95 { │ │ │ │ │ -96 return umfpack_dl_save_numeric(args...); │ │ │ │ │ -97 } │ │ │ │ │ -98 template │ │ │ │ │ -_9_9 static void _s_o_l_v_e(A... args) │ │ │ │ │ -100 { │ │ │ │ │ -101 umfpack_dl_solve(args...); │ │ │ │ │ -102 } │ │ │ │ │ -103 template │ │ │ │ │ -_1_0_4 static void _s_y_m_b_o_l_i_c(A... args) │ │ │ │ │ -105 { │ │ │ │ │ -106 umfpack_dl_symbolic(args...); │ │ │ │ │ -107 } │ │ │ │ │ -108 }; │ │ │ │ │ -109 │ │ │ │ │ -110 template<> │ │ │ │ │ -_1_1_1 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 > │ │ │ │ │ +61 y = x; │ │ │ │ │ +62 y *= immutable_scaling_*mutable_scaling_; │ │ │ │ │ +63 } │ │ │ │ │ +64 │ │ │ │ │ +65 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (field_type alpha, const X& x, Y& y) const │ │ │ │ │ +66 { │ │ │ │ │ +67 X temp(x); │ │ │ │ │ +68 temp *= immutable_scaling_*mutable_scaling_; │ │ │ │ │ +69 y.axpy(alpha,temp); │ │ │ │ │ +70 } │ │ │ │ │ +71 │ │ │ │ │ +73 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 │ │ │ │ │ +74 { │ │ │ │ │ +75 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; │ │ │ │ │ +76 } │ │ │ │ │ +77 │ │ │ │ │ +78 protected: │ │ │ │ │ +79 const field_type immutable_scaling_; │ │ │ │ │ +80 const field_type& mutable_scaling_; │ │ │ │ │ +81 }; │ │ │ │ │ +82 │ │ │ │ │ +83 │ │ │ │ │ +92 template │ │ │ │ │ +93 class LinearOperatorSum │ │ │ │ │ +94 : public _D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ +96 { │ │ │ │ │ +97 public: │ │ │ │ │ +98 typedef typename OP1::domain_type domain_type; │ │ │ │ │ +99 typedef typename OP1::range_type range_type; │ │ │ │ │ +100 typedef typename domain_type::field_type field_type; │ │ │ │ │ +101 │ │ │ │ │ +102 LinearOperatorSum (const OP1& op1, const OP2& op2) │ │ │ │ │ +103 : op1_(op1), op2_(op2) │ │ │ │ │ +104 { │ │ │ │ │ +105 static_assert(std::is_same::value, │ │ │ │ │ +106 "Domain type of both operators doesn't match!"); │ │ │ │ │ +107 static_assert(std::is_same::value, │ │ │ │ │ +108 "Range type of both operators doesn't match!"); │ │ │ │ │ +109 } │ │ │ │ │ +110 │ │ │ │ │ +111 virtual void _a_p_p_l_y (const domain_type& x, range_type& y) const │ │ │ │ │ 112 { │ │ │ │ │ -_1_1_3 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ │ -114 │ │ │ │ │ -115 template │ │ │ │ │ -_1_1_6 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ │ -117 { │ │ │ │ │ -118 umfpack_zl_defaults(args...); │ │ │ │ │ -119 } │ │ │ │ │ -120 template │ │ │ │ │ -_1_2_1 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ -122 { │ │ │ │ │ -123 umfpack_zl_free_numeric(args...); │ │ │ │ │ +113 op1_.apply(x,y); │ │ │ │ │ +114 op2_.applyscaleadd(1.0,x,y); │ │ │ │ │ +115 } │ │ │ │ │ +116 │ │ │ │ │ +117 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (field_type alpha, │ │ │ │ │ +118 const domain_type& x, range_type& y) const │ │ │ │ │ +119 { │ │ │ │ │ +120 range_type temp(y); │ │ │ │ │ +121 op1_.apply(x,temp); │ │ │ │ │ +122 op2_.applyscaleadd(1.0,x,temp); │ │ │ │ │ +123 y.axpy(alpha,temp); │ │ │ │ │ 124 } │ │ │ │ │ -125 template │ │ │ │ │ -_1_2_6 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ │ -127 { │ │ │ │ │ -128 umfpack_zl_free_symbolic(args...); │ │ │ │ │ -129 } │ │ │ │ │ -130 template │ │ │ │ │ -_1_3_1 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ │ -132 { │ │ │ │ │ -133 return umfpack_zl_load_numeric(args...); │ │ │ │ │ -134 } │ │ │ │ │ -135 template │ │ │ │ │ -_1_3_6 static void _n_u_m_e_r_i_c(const long int* cs, const long int* ri, const double* │ │ │ │ │ -val, A... args) │ │ │ │ │ -137 { │ │ │ │ │ -138 umfpack_zl_numeric(cs,ri,val,NULL,args...); │ │ │ │ │ -139 } │ │ │ │ │ -140 template │ │ │ │ │ -_1_4_1 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ │ -142 { │ │ │ │ │ -143 umfpack_zl_report_info(args...); │ │ │ │ │ -144 } │ │ │ │ │ -145 template │ │ │ │ │ -_1_4_6 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ │ -147 { │ │ │ │ │ -148 umfpack_zl_report_status(args...); │ │ │ │ │ -149 } │ │ │ │ │ -150 template │ │ │ │ │ -_1_5_1 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ │ -152 { │ │ │ │ │ -153 return umfpack_zl_save_numeric(args...); │ │ │ │ │ -154 } │ │ │ │ │ -155 template │ │ │ │ │ -_1_5_6 static void _s_o_l_v_e(long int m, const long int* cs, const long int* ri, std:: │ │ │ │ │ -complex* val, double* x, const double* b,A... args) │ │ │ │ │ -157 { │ │ │ │ │ -158 const double* cval = reinterpret_cast(val); │ │ │ │ │ -159 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...); │ │ │ │ │ -160 } │ │ │ │ │ -161 template │ │ │ │ │ -_1_6_2 static void _s_y_m_b_o_l_i_c(long int m, long int n, const long int* cs, const long │ │ │ │ │ -int* ri, const double* val, A... args) │ │ │ │ │ -163 { │ │ │ │ │ -164 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...); │ │ │ │ │ -165 } │ │ │ │ │ -166 }; │ │ │ │ │ -167 │ │ │ │ │ -168 namespace Impl │ │ │ │ │ -169 { │ │ │ │ │ -170 template │ │ │ │ │ -171 struct UMFPackVectorChooser │ │ │ │ │ -172 {}; │ │ │ │ │ -173 │ │ │ │ │ -174 template │ │ │ │ │ -175 struct UMFPackVectorChooser,A > > │ │ │ │ │ +125 │ │ │ │ │ +127 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 │ │ │ │ │ +128 { │ │ │ │ │ +129 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; │ │ │ │ │ +130 } │ │ │ │ │ +131 │ │ │ │ │ +132 protected: │ │ │ │ │ +133 const OP1& op1_; │ │ │ │ │ +134 const OP2& op2_; │ │ │ │ │ +135 }; │ │ │ │ │ +136 } // end namespace Impl │ │ │ │ │ +137 │ │ │ │ │ +174 template │ │ │ │ │ +_1_7_5 class _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ 176 { │ │ │ │ │ -178 using domain_type = BlockVector< │ │ │ │ │ -179 FieldVector, │ │ │ │ │ -180 typename std::allocator_traits::template rebind_alloc > │ │ │ │ │ ->; │ │ │ │ │ -182 using range_type = BlockVector< │ │ │ │ │ -183 FieldVector, │ │ │ │ │ -184 typename std::allocator_traits::template rebind_alloc > │ │ │ │ │ ->; │ │ │ │ │ -185 }; │ │ │ │ │ -186 │ │ │ │ │ -187 template │ │ │ │ │ -188 struct UMFPackVectorChooser > │ │ │ │ │ -189 { │ │ │ │ │ -191 using domain_type = BlockVector; │ │ │ │ │ -193 using range_type = BlockVector; │ │ │ │ │ -194 }; │ │ │ │ │ -195 } │ │ │ │ │ -196 │ │ │ │ │ -210 template │ │ │ │ │ -_2_1_1 class _U_M_F_P_a_c_k │ │ │ │ │ -212 : public _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< │ │ │ │ │ -213 typename Impl::UMFPackVectorChooser::domain_type, │ │ │ │ │ -214 typename Impl::UMFPackVectorChooser::range_type > │ │ │ │ │ -215 { │ │ │ │ │ -216 using T = typename M::field_type; │ │ │ │ │ -217 │ │ │ │ │ -218 public: │ │ │ │ │ -_2_2_0 using _M_a_t_r_i_x = M; │ │ │ │ │ -_2_2_1 using _m_a_t_r_i_x___t_y_p_e = M; │ │ │ │ │ -_2_2_3 typedef ISTL::Impl::BCCSMatrix │ │ │ │ │ -_U_M_F_P_a_c_k_M_a_t_r_i_x; │ │ │ │ │ -_2_2_5 typedef ISTL::Impl::BCCSMatrixInitializer _M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ │ -_2_2_7 using _d_o_m_a_i_n___t_y_p_e = typename Impl::UMFPackVectorChooser::domain_type; │ │ │ │ │ -_2_2_9 using _r_a_n_g_e___t_y_p_e = typename Impl::UMFPackVectorChooser::range_type; │ │ │ │ │ -230 │ │ │ │ │ -_2_3_2 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -233 { │ │ │ │ │ -234 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; │ │ │ │ │ +177 protected: │ │ │ │ │ +178 // Type definitions for type of iteration operator (m_ - mu_*I) │ │ │ │ │ +179 typedef typename _D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_<_B_C_R_S_M_a_t_r_i_x_,_B_l_o_c_k_V_e_c_t_o_r_,_B_l_o_c_k_V_e_c_t_o_r_> │ │ │ │ │ +_1_8_0 _M_a_t_r_i_x_O_p_e_r_a_t_o_r; │ │ │ │ │ +_1_8_1 typedef Impl::ScalingLinearOperator _S_c_a_l_i_n_g_O_p_e_r_a_t_o_r; │ │ │ │ │ +_1_8_2 typedef Impl::LinearOperatorSum │ │ │ │ │ +_O_p_e_r_a_t_o_r_S_u_m; │ │ │ │ │ +183 │ │ │ │ │ +184 public: │ │ │ │ │ +_1_8_6 typedef typename _B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e _R_e_a_l; │ │ │ │ │ +187 │ │ │ │ │ +_1_8_9 typedef _O_p_e_r_a_t_o_r_S_u_m _I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r; │ │ │ │ │ +190 │ │ │ │ │ +191 public: │ │ │ │ │ +_2_0_6 _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s (const _B_C_R_S_M_a_t_r_i_x& m, │ │ │ │ │ +207 const unsigned int nIterationsMax = 1000, │ │ │ │ │ +208 const unsigned int verbosity_level = 0) │ │ │ │ │ +209 : _m__(m), _n_I_t_e_r_a_t_i_o_n_s_M_a_x__(nIterationsMax), │ │ │ │ │ +210 _v_e_r_b_o_s_i_t_y___l_e_v_e_l__(verbosity_level), │ │ │ │ │ +211 _m_u__(0.0), │ │ │ │ │ +212 _m_a_t_r_i_x_O_p_e_r_a_t_o_r__(_m__), │ │ │ │ │ +213 _s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__(-1.0,_m_u__), │ │ │ │ │ +214 _i_t_O_p_e_r_a_t_o_r__(_m_a_t_r_i_x_O_p_e_r_a_t_o_r__,_s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__), │ │ │ │ │ +215 _n_I_t_e_r_a_t_i_o_n_s__(0), │ │ │ │ │ +216 _t_i_t_l_e__(" PowerIteration_Algorithms: "), │ │ │ │ │ +217 _b_l_a_n_k__(_t_i_t_l_e__.length(),' ') │ │ │ │ │ +218 { │ │ │ │ │ +219 // assert that BCRSMatrix type has blocklevel 2 │ │ │ │ │ +220 static_assert │ │ │ │ │ +221 (blockLevel() == 2, │ │ │ │ │ +222 "Only BCRSMatrices with blocklevel 2 are supported."); │ │ │ │ │ +223 │ │ │ │ │ +224 // assert that BCRSMatrix type has square blocks │ │ │ │ │ +225 static_assert │ │ │ │ │ +226 (BCRSMatrix::block_type::rows == BCRSMatrix::block_type::cols, │ │ │ │ │ +227 "Only BCRSMatrices with square blocks are supported."); │ │ │ │ │ +228 │ │ │ │ │ +229 // assert that m_ is square │ │ │ │ │ +230 const int nrows = _m__._M() * BCRSMatrix::block_type::rows; │ │ │ │ │ +231 const int ncols = _m__._N() * BCRSMatrix::block_type::cols; │ │ │ │ │ +232 if (nrows != ncols) │ │ │ │ │ +233 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Matrix is not square (" │ │ │ │ │ +234 << nrows << "x" << ncols << ")."); │ │ │ │ │ 235 } │ │ │ │ │ 236 │ │ │ │ │ -_2_4_5 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose=0) : matrixIsLoaded_(false) │ │ │ │ │ -246 { │ │ │ │ │ -247 //check whether T is a supported type │ │ │ │ │ -248 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ -249 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ -supported)"); │ │ │ │ │ -250 Caller::defaults(UMF_Control); │ │ │ │ │ -251 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ -252 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ │ -253 } │ │ │ │ │ -254 │ │ │ │ │ -_2_6_3 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose, bool) : matrixIsLoaded_(false) │ │ │ │ │ -264 { │ │ │ │ │ -265 //check whether T is a supported type │ │ │ │ │ -266 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ -267 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ -supported)"); │ │ │ │ │ -268 Caller::defaults(UMF_Control); │ │ │ │ │ -269 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ -270 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ │ -271 } │ │ │ │ │ +_2_4_0 _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s (const _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s&) = delete; │ │ │ │ │ +241 │ │ │ │ │ +245 _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s& │ │ │ │ │ +_2_4_6 _o_p_e_r_a_t_o_r_=_ (const _P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s&) = delete; │ │ │ │ │ +247 │ │ │ │ │ +_2_6_0 inline void _a_p_p_l_y_P_o_w_e_r_I_t_e_r_a_t_i_o_n (const _R_e_a_l& epsilon, │ │ │ │ │ +261 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ +262 { │ │ │ │ │ +263 // print verbosity information │ │ │ │ │ +264 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +265 std::cout << _t_i_t_l_e__ │ │ │ │ │ +266 << "Performing power iteration approximating " │ │ │ │ │ +267 << "the dominant eigenvalue." << std::endl; │ │ │ │ │ +268 │ │ │ │ │ +269 // allocate memory for auxiliary variables │ │ │ │ │ +270 _B_l_o_c_k_V_e_c_t_o_r y(x); │ │ │ │ │ +271 _B_l_o_c_k_V_e_c_t_o_r temp(x); │ │ │ │ │ 272 │ │ │ │ │ -_2_8_2 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const ParameterTree& config) │ │ │ │ │ -283 : _U_M_F_P_a_c_k(mat_, config._g_e_t("verbose", 0)) │ │ │ │ │ -284 {} │ │ │ │ │ -285 │ │ │ │ │ -_2_8_8 _U_M_F_P_a_c_k() : matrixIsLoaded_(false), verbosity_(0) │ │ │ │ │ -289 { │ │ │ │ │ -290 //check whether T is a supported type │ │ │ │ │ -291 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ -292 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ -supported)"); │ │ │ │ │ -293 Caller::defaults(UMF_Control); │ │ │ │ │ -294 } │ │ │ │ │ +273 // perform power iteration │ │ │ │ │ +274 x *= (1.0 / x.two_norm()); │ │ │ │ │ +275 _m__._m_v(x,y); │ │ │ │ │ +276 _R_e_a_l r_norm = std::numeric_limits::max(); │ │ │ │ │ +277 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ +278 while (r_norm > epsilon) │ │ │ │ │ +279 { │ │ │ │ │ +280 // update and check number of iterations │ │ │ │ │ +281 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ +282 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Power iteration did not converge " │ │ │ │ │ +283 << "in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ << " iterations " │ │ │ │ │ +284 << "(║residual║_2 = " << r_norm << ", epsilon = " │ │ │ │ │ +285 << epsilon << ")."); │ │ │ │ │ +286 │ │ │ │ │ +287 // do one iteration of the power iteration algorithm │ │ │ │ │ +288 // (use that y = m_ * x) │ │ │ │ │ +289 x = y; │ │ │ │ │ +290 x *= (1.0 / y.two_norm()); │ │ │ │ │ +291 │ │ │ │ │ +292 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ +293 _m__._m_v(x,y); │ │ │ │ │ +294 lambda = x * y; │ │ │ │ │ 295 │ │ │ │ │ -_3_0_6 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const char* file, int verbose=0) │ │ │ │ │ -307 { │ │ │ │ │ -308 //check whether T is a supported type │ │ │ │ │ -309 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ -310 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ -supported)"); │ │ │ │ │ -311 Caller::defaults(UMF_Control); │ │ │ │ │ -312 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ -313 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ │ -314 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == │ │ │ │ │ -UMFPACK_ERROR_file_IO)) │ │ │ │ │ -315 { │ │ │ │ │ -316 matrixIsLoaded_ = false; │ │ │ │ │ -317 _s_e_t_M_a_t_r_i_x(mat_); │ │ │ │ │ -318 _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(file); │ │ │ │ │ -319 } │ │ │ │ │ -320 else │ │ │ │ │ -321 { │ │ │ │ │ -322 matrixIsLoaded_ = true; │ │ │ │ │ -323 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ │ -std::endl; │ │ │ │ │ -324 } │ │ │ │ │ -325 } │ │ │ │ │ -326 │ │ │ │ │ -_3_3_3 _U_M_F_P_a_c_k(const char* file, int verbose=0) │ │ │ │ │ -334 { │ │ │ │ │ -335 //check whether T is a supported type │ │ │ │ │ -336 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ │ -337 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ -supported)"); │ │ │ │ │ -338 Caller::defaults(UMF_Control); │ │ │ │ │ -339 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ │ -340 if (errcode == UMFPACK_ERROR_out_of_memory) │ │ │ │ │ -341 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack │ │ │ │ │ -decomposition"); │ │ │ │ │ -342 if (errcode == UMFPACK_ERROR_file_IO) │ │ │ │ │ -343 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack │ │ │ │ │ -decomposition"); │ │ │ │ │ -344 matrixIsLoaded_ = true; │ │ │ │ │ -345 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ │ -std::endl; │ │ │ │ │ -346 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ │ -347 } │ │ │ │ │ -348 │ │ │ │ │ -_3_4_9 virtual _~_U_M_F_P_a_c_k() │ │ │ │ │ -350 { │ │ │ │ │ -351 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ │ -352 _f_r_e_e(); │ │ │ │ │ -353 } │ │ │ │ │ -354 │ │ │ │ │ -_3_5_8 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ │ -res) │ │ │ │ │ -359 { │ │ │ │ │ -360 if (umfpackMatrix_.N() != b.dim()) │ │ │ │ │ -361 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!"); │ │ │ │ │ -362 if (umfpackMatrix_.M() != x.dim()) │ │ │ │ │ -363 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!"); │ │ │ │ │ -364 if (b.size() == 0) │ │ │ │ │ -365 return; │ │ │ │ │ -366 │ │ │ │ │ -367 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ │ -368 Caller::solve(UMFPACK_A, │ │ │ │ │ -369 umfpackMatrix_.getColStart(), │ │ │ │ │ -370 umfpackMatrix_.getRowIndex(), │ │ │ │ │ -371 umfpackMatrix_.getValues(), │ │ │ │ │ -372 reinterpret_cast(&x[0]), │ │ │ │ │ -373 reinterpret_cast(&b[0]), │ │ │ │ │ -374 UMF_Numeric, │ │ │ │ │ -375 UMF_Control, │ │ │ │ │ -376 UMF_Apply_Info); │ │ │ │ │ -377 │ │ │ │ │ -378 //this is a direct solver │ │ │ │ │ -379 res._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ │ -380 res._c_o_n_v_e_r_g_e_d = true; │ │ │ │ │ -381 res._e_l_a_p_s_e_d = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME]; │ │ │ │ │ -382 │ │ │ │ │ -383 printOnApply(UMF_Apply_Info); │ │ │ │ │ -384 } │ │ │ │ │ -385 │ │ │ │ │ -_3_8_9 virtual void _a_p_p_l_y (_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, [[maybe_unused]] double │ │ │ │ │ -reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ │ -390 { │ │ │ │ │ -391 _a_p_p_l_y(x,b,res); │ │ │ │ │ -392 } │ │ │ │ │ -393 │ │ │ │ │ -_3_9_9 void _a_p_p_l_y(T* x, T* b) │ │ │ │ │ -400 { │ │ │ │ │ -401 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ │ -402 Caller::solve(UMFPACK_A, │ │ │ │ │ -403 umfpackMatrix_.getColStart(), │ │ │ │ │ -404 umfpackMatrix_.getRowIndex(), │ │ │ │ │ -405 umfpackMatrix_.getValues(), │ │ │ │ │ -406 x, │ │ │ │ │ -407 b, │ │ │ │ │ -408 UMF_Numeric, │ │ │ │ │ -409 UMF_Control, │ │ │ │ │ -410 UMF_Apply_Info); │ │ │ │ │ -411 printOnApply(UMF_Apply_Info); │ │ │ │ │ -412 } │ │ │ │ │ -413 │ │ │ │ │ -_4_2_5 void _s_e_t_O_p_t_i_o_n(unsigned int option, double value) │ │ │ │ │ -426 { │ │ │ │ │ -427 if (option >= UMFPACK_CONTROL) │ │ │ │ │ -428 DUNE_THROW(RangeError, "Requested non-existing UMFPack option"); │ │ │ │ │ -429 │ │ │ │ │ -430 UMF_Control[option] = value; │ │ │ │ │ -431 } │ │ │ │ │ -432 │ │ │ │ │ -_4_3_6 void _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(const char* file) │ │ │ │ │ -437 { │ │ │ │ │ -438 int errcode = Caller::save_numeric(UMF_Numeric, const_cast(file)); │ │ │ │ │ -439 if (errcode != UMFPACK_OK) │ │ │ │ │ -440 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack │ │ │ │ │ -decomposition"); │ │ │ │ │ -441 } │ │ │ │ │ -442 │ │ │ │ │ -_4_4_4 void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& matrix) │ │ │ │ │ -445 { │ │ │ │ │ -446 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ │ -447 _f_r_e_e(); │ │ │ │ │ -448 if (matrix.N() == 0 or matrix.M() == 0) │ │ │ │ │ -449 return; │ │ │ │ │ -450 │ │ │ │ │ -451 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ │ -0) │ │ │ │ │ -452 umfpackMatrix_.free(); │ │ │ │ │ -453 umfpackMatrix_.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), │ │ │ │ │ -454 _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)); │ │ │ │ │ -455 ISTL::Impl::BCCSMatrixInitializer initializer │ │ │ │ │ -(umfpackMatrix_); │ │ │ │ │ -456 │ │ │ │ │ -457 copyToBCCSMatrix(initializer, matrix); │ │ │ │ │ -458 │ │ │ │ │ -459 decompose(); │ │ │ │ │ -460 } │ │ │ │ │ -461 │ │ │ │ │ -462 template │ │ │ │ │ -_4_6_3 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& _mat, const S& rowIndexSet) │ │ │ │ │ -464 { │ │ │ │ │ -465 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ │ -466 _f_r_e_e(); │ │ │ │ │ -467 │ │ │ │ │ -468 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ │ -0) │ │ │ │ │ -469 umfpackMatrix_.free(); │ │ │ │ │ -470 │ │ │ │ │ -471 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(), │ │ │ │ │ -472 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()); │ │ │ │ │ -473 ISTL::Impl::BCCSMatrixInitializer initializer │ │ │ │ │ -(umfpackMatrix_); │ │ │ │ │ -474 │ │ │ │ │ -475 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ │ -set >(_mat,rowIndexSet)); │ │ │ │ │ +296 // get norm of residual (use that y = m_ * x) │ │ │ │ │ +297 temp = y; │ │ │ │ │ +298 temp.axpy(-lambda,x); │ │ │ │ │ +299 r_norm = temp.two_norm(); │ │ │ │ │ +300 │ │ │ │ │ +301 // print verbosity information │ │ │ │ │ +302 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +303 std::cout << _b_l_a_n_k__ << std::left │ │ │ │ │ +304 << "iteration " << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ +305 << " (║residual║_2 = " << std::setw(11) << r_norm │ │ │ │ │ +306 << "): λ = " << lambda << std::endl │ │ │ │ │ +307 << std::resetiosflags(std::ios::left); │ │ │ │ │ +308 } │ │ │ │ │ +309 │ │ │ │ │ +310 // print verbosity information │ │ │ │ │ +311 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +312 { │ │ │ │ │ +313 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +314 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +315 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +316 << "λ = " << lambda << std::endl; │ │ │ │ │ +317 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ +318 { │ │ │ │ │ +319 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ +320 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ +321 } │ │ │ │ │ +322 } │ │ │ │ │ +323 } │ │ │ │ │ +324 │ │ │ │ │ +353 template │ │ │ │ │ +_3_5_5 inline void _a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n (const _R_e_a_l& epsilon, │ │ │ │ │ +356 ISTLLinearSolver& solver, │ │ │ │ │ +357 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ +358 { │ │ │ │ │ +359 constexpr _R_e_a_l gamma = 0.0; │ │ │ │ │ +360 _a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n(gamma,epsilon,solver,x,lambda); │ │ │ │ │ +361 } │ │ │ │ │ +362 │ │ │ │ │ +392 template │ │ │ │ │ +_3_9_4 inline void _a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n (const _R_e_a_l& gamma, │ │ │ │ │ +395 const _R_e_a_l& epsilon, │ │ │ │ │ +396 ISTLLinearSolver& solver, │ │ │ │ │ +397 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ +398 { │ │ │ │ │ +399 // print verbosity information │ │ │ │ │ +400 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +401 { │ │ │ │ │ +402 std::cout << _t_i_t_l_e__; │ │ │ │ │ +403 if (gamma == 0.0) │ │ │ │ │ +404 std::cout << "Performing inverse iteration approximating " │ │ │ │ │ +405 << "the least dominant eigenvalue." << std::endl; │ │ │ │ │ +406 else │ │ │ │ │ +407 std::cout << "Performing inverse iteration with shift " │ │ │ │ │ +408 << "gamma = " << gamma << " approximating the " │ │ │ │ │ +409 << "eigenvalue closest to gamma." << std::endl; │ │ │ │ │ +410 } │ │ │ │ │ +411 │ │ │ │ │ +412 // initialize iteration operator, │ │ │ │ │ +413 // initialize iteration matrix when needed │ │ │ │ │ +414 _u_p_d_a_t_e_S_h_i_f_t_M_u(gamma,solver); │ │ │ │ │ +415 │ │ │ │ │ +416 // allocate memory for linear solver statistics │ │ │ │ │ +417 _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 solver_statistics; │ │ │ │ │ +418 │ │ │ │ │ +419 // allocate memory for auxiliary variables │ │ │ │ │ +420 _B_l_o_c_k_V_e_c_t_o_r y(x); │ │ │ │ │ +421 _R_e_a_l y_norm; │ │ │ │ │ +422 _B_l_o_c_k_V_e_c_t_o_r temp(x); │ │ │ │ │ +423 │ │ │ │ │ +424 // perform inverse iteration with shift │ │ │ │ │ +425 x *= (1.0 / x.two_norm()); │ │ │ │ │ +426 _R_e_a_l r_norm = std::numeric_limits::max(); │ │ │ │ │ +427 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ +428 while (r_norm > epsilon) │ │ │ │ │ +429 { │ │ │ │ │ +430 // update and check number of iterations │ │ │ │ │ +431 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ +432 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Inverse iteration " │ │ │ │ │ +433 << (gamma != 0.0 ? "with shift " : "") << "did not " │ │ │ │ │ +434 << "converge in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ << " iterations " │ │ │ │ │ +435 << "(║residual║_2 = " << r_norm << ", epsilon = " │ │ │ │ │ +436 << epsilon << ")."); │ │ │ │ │ +437 │ │ │ │ │ +438 // do one iteration of the inverse iteration with shift algorithm, │ │ │ │ │ +439 // part 1: solve (m_ - gamma*I) * y = x for y │ │ │ │ │ +440 // (protect x from being changed) │ │ │ │ │ +441 temp = x; │ │ │ │ │ +442 solver.apply(y,temp,solver_statistics); │ │ │ │ │ +443 │ │ │ │ │ +444 // get norm of y │ │ │ │ │ +445 y_norm = y.two_norm(); │ │ │ │ │ +446 │ │ │ │ │ +447 // compile time switch between accuracy and efficiency │ │ │ │ │ +448 if (avoidLinSolverCrime) │ │ │ │ │ +449 { │ │ │ │ │ +450 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ +451 // (use that x_new = y / y_norm) │ │ │ │ │ +452 _m__._m_v(y,temp); │ │ │ │ │ +453 lambda = (y * temp) / (y_norm * y_norm); │ │ │ │ │ +454 │ │ │ │ │ +455 // get norm of residual │ │ │ │ │ +456 // (use that x_new = y / y_norm, additionally use that temp = m_ * y) │ │ │ │ │ +457 temp.axpy(-lambda,y); │ │ │ │ │ +458 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ +459 } │ │ │ │ │ +460 else │ │ │ │ │ +461 { │ │ │ │ │ +462 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ +463 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x) │ │ │ │ │ +464 lambda = gamma + (y * x) / (y_norm * y_norm); │ │ │ │ │ +465 │ │ │ │ │ +466 // get norm of residual │ │ │ │ │ +467 // (use that x_new = y / y_norm and use that (m_ - gamma*I) * y = x) │ │ │ │ │ +468 temp = x; temp.axpy(gamma-lambda,y); │ │ │ │ │ +469 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ +470 } │ │ │ │ │ +471 │ │ │ │ │ +472 // do one iteration of the inverse iteration with shift algorithm, │ │ │ │ │ +473 // part 2: update x │ │ │ │ │ +474 x = y; │ │ │ │ │ +475 x *= (1.0 / y_norm); │ │ │ │ │ 476 │ │ │ │ │ -477 decompose(); │ │ │ │ │ -478 } │ │ │ │ │ -479 │ │ │ │ │ -_4_8_7 void _s_e_t_V_e_r_b_o_s_i_t_y(int v) │ │ │ │ │ +477 // print verbosity information │ │ │ │ │ +478 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +479 std::cout << _b_l_a_n_k__ << std::left │ │ │ │ │ +480 << "iteration " << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ +481 << " (║residual║_2 = " << std::setw(11) << r_norm │ │ │ │ │ +482 << "): λ = " << lambda << std::endl │ │ │ │ │ +483 << std::resetiosflags(std::ios::left); │ │ │ │ │ +484 } │ │ │ │ │ +485 │ │ │ │ │ +486 // print verbosity information │ │ │ │ │ +487 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ 488 { │ │ │ │ │ -489 verbosity_ = v; │ │ │ │ │ -490 // set the verbosity level in UMFPack │ │ │ │ │ -491 if (verbosity_ == 0) │ │ │ │ │ -492 UMF_Control[UMFPACK_PRL] = 1; │ │ │ │ │ -493 if (verbosity_ == 1) │ │ │ │ │ -494 UMF_Control[UMFPACK_PRL] = 2; │ │ │ │ │ -495 if (verbosity_ == 2) │ │ │ │ │ -496 UMF_Control[UMFPACK_PRL] = 4; │ │ │ │ │ +489 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +490 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +491 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +492 << "λ = " << lambda << std::endl; │ │ │ │ │ +493 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ +494 { │ │ │ │ │ +495 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ +496 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ 497 } │ │ │ │ │ -498 │ │ │ │ │ -_5_0_3 void* _g_e_t_F_a_c_t_o_r_i_z_a_t_i_o_n() │ │ │ │ │ -504 { │ │ │ │ │ -505 return UMF_Numeric; │ │ │ │ │ -506 } │ │ │ │ │ -507 │ │ │ │ │ -_5_1_2 _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() │ │ │ │ │ -513 { │ │ │ │ │ -514 return umfpackMatrix_; │ │ │ │ │ -515 } │ │ │ │ │ -516 │ │ │ │ │ -_5_2_1 void _f_r_e_e() │ │ │ │ │ -522 { │ │ │ │ │ -523 if (!matrixIsLoaded_) │ │ │ │ │ -524 { │ │ │ │ │ -525 Caller::free_symbolic(&UMF_Symbolic); │ │ │ │ │ -526 umfpackMatrix_.free(); │ │ │ │ │ -527 } │ │ │ │ │ -528 Caller::free_numeric(&UMF_Numeric); │ │ │ │ │ -529 matrixIsLoaded_ = false; │ │ │ │ │ -530 } │ │ │ │ │ -531 │ │ │ │ │ -_5_3_2 const char* _n_a_m_e() { return "UMFPACK"; } │ │ │ │ │ -533 │ │ │ │ │ -534 private: │ │ │ │ │ -535 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; │ │ │ │ │ -536 │ │ │ │ │ -537 template │ │ │ │ │ -_5_3_8 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ │ -539 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>; │ │ │ │ │ -540 │ │ │ │ │ -542 void decompose() │ │ │ │ │ -543 { │ │ │ │ │ -544 double UMF_Decomposition_Info[UMFPACK_INFO]; │ │ │ │ │ -545 Caller::symbolic(static_cast(umfpackMatrix_.N()), │ │ │ │ │ -546 static_cast(umfpackMatrix_.N()), │ │ │ │ │ -547 umfpackMatrix_.getColStart(), │ │ │ │ │ -548 umfpackMatrix_.getRowIndex(), │ │ │ │ │ -549 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ │ -550 &UMF_Symbolic, │ │ │ │ │ -551 UMF_Control, │ │ │ │ │ -552 UMF_Decomposition_Info); │ │ │ │ │ -553 Caller::numeric(umfpackMatrix_.getColStart(), │ │ │ │ │ -554 umfpackMatrix_.getRowIndex(), │ │ │ │ │ -555 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ │ -556 UMF_Symbolic, │ │ │ │ │ -557 &UMF_Numeric, │ │ │ │ │ -558 UMF_Control, │ │ │ │ │ -559 UMF_Decomposition_Info); │ │ │ │ │ -560 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]); │ │ │ │ │ -561 if (verbosity_ == 1) │ │ │ │ │ -562 { │ │ │ │ │ -563 std::cout << "[UMFPack Decomposition]" << std::endl; │ │ │ │ │ -564 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info │ │ │ │ │ -[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info │ │ │ │ │ -[UMFPACK_NUMERIC_TIME] << ")" << std::endl; │ │ │ │ │ -565 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << │ │ │ │ │ -std::endl; │ │ │ │ │ -566 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info │ │ │ │ │ -[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" │ │ │ │ │ -<< std::endl; │ │ │ │ │ -567 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info │ │ │ │ │ -[UMFPACK_RCOND] << std::endl; │ │ │ │ │ -568 std::cout << "Numbers of non-zeroes in decomposition: L: " << │ │ │ │ │ -UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info │ │ │ │ │ -[UMFPACK_UNZ] << std::endl; │ │ │ │ │ -569 } │ │ │ │ │ -570 if (verbosity_ == 2) │ │ │ │ │ -571 { │ │ │ │ │ -572 Caller::report_info(UMF_Control,UMF_Decomposition_Info); │ │ │ │ │ -573 } │ │ │ │ │ -574 } │ │ │ │ │ -575 │ │ │ │ │ -576 void printOnApply(double* UMF_Info) │ │ │ │ │ -577 { │ │ │ │ │ -578 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]); │ │ │ │ │ -579 if (verbosity_ > 0) │ │ │ │ │ +498 } │ │ │ │ │ +499 } │ │ │ │ │ +500 │ │ │ │ │ +531 template │ │ │ │ │ +_5_3_3 inline void _a_p_p_l_y_R_a_y_l_e_i_g_h_Q_u_o_t_i_e_n_t_I_t_e_r_a_t_i_o_n (const _R_e_a_l& epsilon, │ │ │ │ │ +534 ISTLLinearSolver& solver, │ │ │ │ │ +535 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ +536 { │ │ │ │ │ +537 // print verbosity information │ │ │ │ │ +538 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +539 std::cout << _t_i_t_l_e__ │ │ │ │ │ +540 << "Performing Rayleigh quotient iteration for " │ │ │ │ │ +541 << "estimated eigenvalue " << lambda << "." << std::endl; │ │ │ │ │ +542 │ │ │ │ │ +543 // allocate memory for linear solver statistics │ │ │ │ │ +544 _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 solver_statistics; │ │ │ │ │ +545 │ │ │ │ │ +546 // allocate memory for auxiliary variables │ │ │ │ │ +547 _B_l_o_c_k_V_e_c_t_o_r y(x); │ │ │ │ │ +548 _R_e_a_l y_norm; │ │ │ │ │ +549 _R_e_a_l lambda_update; │ │ │ │ │ +550 _B_l_o_c_k_V_e_c_t_o_r temp(x); │ │ │ │ │ +551 │ │ │ │ │ +552 // perform Rayleigh quotient iteration │ │ │ │ │ +553 x *= (1.0 / x.two_norm()); │ │ │ │ │ +554 _R_e_a_l r_norm = std::numeric_limits::max(); │ │ │ │ │ +555 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ +556 while (r_norm > epsilon) │ │ │ │ │ +557 { │ │ │ │ │ +558 // update and check number of iterations │ │ │ │ │ +559 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ +560 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"Rayleigh quotient iteration did not " │ │ │ │ │ +561 << "converge in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ << " iterations " │ │ │ │ │ +562 << "(║residual║_2 = " << r_norm << ", epsilon = " │ │ │ │ │ +563 << epsilon << ")."); │ │ │ │ │ +564 │ │ │ │ │ +565 // update iteration operator, │ │ │ │ │ +566 // update iteration matrix when needed │ │ │ │ │ +567 _u_p_d_a_t_e_S_h_i_f_t_M_u(lambda,solver); │ │ │ │ │ +568 │ │ │ │ │ +569 // do one iteration of the Rayleigh quotient iteration algorithm, │ │ │ │ │ +570 // part 1: solve (m_ - lambda*I) * y = x for y │ │ │ │ │ +571 // (protect x from being changed) │ │ │ │ │ +572 temp = x; │ │ │ │ │ +573 solver.apply(y,temp,solver_statistics); │ │ │ │ │ +574 │ │ │ │ │ +575 // get norm of y │ │ │ │ │ +576 y_norm = y.two_norm(); │ │ │ │ │ +577 │ │ │ │ │ +578 // compile time switch between accuracy and efficiency │ │ │ │ │ +579 if (avoidLinSolverCrime) │ │ │ │ │ 580 { │ │ │ │ │ -581 std::cout << "[UMFPack Solve]" << std::endl; │ │ │ │ │ -582 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " │ │ │ │ │ -(CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl; │ │ │ │ │ -583 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl; │ │ │ │ │ -584 std::cout << "Iterative Refinement steps taken: " << UMF_Info │ │ │ │ │ -[UMFPACK_IR_TAKEN] << std::endl; │ │ │ │ │ -585 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << │ │ │ │ │ -UMF_Info[UMFPACK_OMEGA2] << std::endl; │ │ │ │ │ -586 } │ │ │ │ │ -587 } │ │ │ │ │ -588 │ │ │ │ │ -589 _U_M_F_P_a_c_k_M_a_t_r_i_x umfpackMatrix_; │ │ │ │ │ -590 bool matrixIsLoaded_; │ │ │ │ │ -591 int verbosity_; │ │ │ │ │ -592 void *UMF_Symbolic; │ │ │ │ │ -593 void *UMF_Numeric; │ │ │ │ │ -594 double UMF_Control[UMFPACK_CONTROL]; │ │ │ │ │ -595 }; │ │ │ │ │ -596 │ │ │ │ │ -597 template │ │ │ │ │ -_5_9_8 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r<_U_M_F_P_a_c_k<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A> > > │ │ │ │ │ -599 { │ │ │ │ │ -_6_0_0 enum { _v_a_l_u_e=true}; │ │ │ │ │ -601 }; │ │ │ │ │ -602 │ │ │ │ │ -603 template │ │ │ │ │ -_6_0_4 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 > > │ │ │ │ │ -605 { │ │ │ │ │ -_6_0_6 enum { _v_a_l_u_e = true }; │ │ │ │ │ -607 }; │ │ │ │ │ +581 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ +582 // (use that x_new = y / y_norm) │ │ │ │ │ +583 _m__._m_v(y,temp); │ │ │ │ │ +584 lambda = (y * temp) / (y_norm * y_norm); │ │ │ │ │ +585 │ │ │ │ │ +586 // get norm of residual │ │ │ │ │ +587 // (use that x_new = y / y_norm, additionally use that temp = m_ * y) │ │ │ │ │ +588 temp.axpy(-lambda,y); │ │ │ │ │ +589 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ +590 } │ │ │ │ │ +591 else │ │ │ │ │ +592 { │ │ │ │ │ +593 // get approximated eigenvalue lambda via the Rayleigh quotient │ │ │ │ │ +594 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x) │ │ │ │ │ +595 lambda_update = (y * x) / (y_norm * y_norm); │ │ │ │ │ +596 lambda += lambda_update; │ │ │ │ │ +597 │ │ │ │ │ +598 // get norm of residual │ │ │ │ │ +599 // (use that x_new = y / y_norm and use that (m_ - lambda_old*I) * y = x) │ │ │ │ │ +600 temp = x; temp.axpy(-lambda_update,y); │ │ │ │ │ +601 r_norm = temp.two_norm() / y_norm; │ │ │ │ │ +602 } │ │ │ │ │ +603 │ │ │ │ │ +604 // do one iteration of the Rayleigh quotient iteration algorithm, │ │ │ │ │ +605 // part 2: update x │ │ │ │ │ +606 x = y; │ │ │ │ │ +607 x *= (1.0 / y_norm); │ │ │ │ │ 608 │ │ │ │ │ -_6_0_9 struct _U_M_F_P_a_c_k_C_r_e_a_t_o_r { │ │ │ │ │ -_6_1_0 template struct _i_s_V_a_l_i_d_B_l_o_c_k : std::false_type{}; │ │ │ │ │ -_6_1_1 template struct _i_s_V_a_l_i_d_B_l_o_c_k::real_type,double>::value>> : std::true_type │ │ │ │ │ -{}; │ │ │ │ │ -612 │ │ │ │ │ -613 template │ │ │ │ │ -614 std::shared_ptr::type, │ │ │ │ │ -615 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ -_6_1_6 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& config, │ │ │ │ │ -617 std::enable_if_t< │ │ │ │ │ -618 _i_s_V_a_l_i_d_B_l_o_c_k::type::block_type>:: │ │ │ │ │ -value,int> = 0) const │ │ │ │ │ -619 { │ │ │ │ │ -620 int verbose = config.get("verbose", 0); │ │ │ │ │ -621 return std::make_shared>(_m_a_t,verbose); │ │ │ │ │ -622 } │ │ │ │ │ -623 │ │ │ │ │ -624 // second version with SFINAE to validate the template parameters of │ │ │ │ │ -UMFPack │ │ │ │ │ -625 template │ │ │ │ │ -626 std::shared_ptr::type, │ │ │ │ │ -627 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ │ -_6_2_8 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& / │ │ │ │ │ -*config*/, │ │ │ │ │ -629 std::enable_if_t< │ │ │ │ │ -630 !_i_s_V_a_l_i_d_B_l_o_c_k::type::block_type>:: │ │ │ │ │ -value,int> = 0) const │ │ │ │ │ -631 { │ │ │ │ │ -632 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ │ -633 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ │ -supported)"); │ │ │ │ │ -634 } │ │ │ │ │ -635 }; │ │ │ │ │ -_6_3_6 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("umfpack",_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r()); │ │ │ │ │ -637} // end namespace Dune │ │ │ │ │ -638 │ │ │ │ │ -639#endif // HAVE_SUITESPARSE_UMFPACK │ │ │ │ │ -640 │ │ │ │ │ -641#endif //DUNE_ISTL_UMFPACK_HH │ │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ │ -#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ │ -_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h │ │ │ │ │ +609 // print verbosity information │ │ │ │ │ +610 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +611 std::cout << _b_l_a_n_k__ << std::left │ │ │ │ │ +612 << "iteration " << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ +613 << " (║residual║_2 = " << std::setw(11) << r_norm │ │ │ │ │ +614 << "): λ = " << lambda << std::endl │ │ │ │ │ +615 << std::resetiosflags(std::ios::left); │ │ │ │ │ +616 } │ │ │ │ │ +617 │ │ │ │ │ +618 // print verbosity information │ │ │ │ │ +619 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +620 { │ │ │ │ │ +621 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +622 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +623 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +624 << "λ = " << lambda << std::endl; │ │ │ │ │ +625 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ +626 { │ │ │ │ │ +627 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ +628 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ +629 } │ │ │ │ │ +630 } │ │ │ │ │ +631 } │ │ │ │ │ +632 │ │ │ │ │ +689 template │ │ │ │ │ +_6_9_1 inline void _a_p_p_l_y_T_L_I_M_E_I_t_e_r_a_t_i_o_n (const _R_e_a_l& gamma, const _R_e_a_l& eta, │ │ │ │ │ +692 const _R_e_a_l& epsilon, │ │ │ │ │ +693 ISTLLinearSolver& solver, │ │ │ │ │ +694 const _R_e_a_l& delta, const std::size_t& m, │ │ │ │ │ +695 bool& extrnl, │ │ │ │ │ +696 _B_l_o_c_k_V_e_c_t_o_r& x, _R_e_a_l& lambda) const │ │ │ │ │ +697 { │ │ │ │ │ +698 // use same variable names as in [Szyld, 1988] │ │ │ │ │ +699 _B_l_o_c_k_V_e_c_t_o_r& x_s = x; │ │ │ │ │ +700 _R_e_a_l& mu_s = lambda; │ │ │ │ │ +701 │ │ │ │ │ +702 // print verbosity information │ │ │ │ │ +703 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +704 std::cout << _t_i_t_l_e__ │ │ │ │ │ +705 << "Performing TLIME iteration for " │ │ │ │ │ +706 << "estimated eigenvalue in the " │ │ │ │ │ +707 << "interval (" << gamma - eta << "," │ │ │ │ │ +708 << gamma + eta << ")." << std::endl; │ │ │ │ │ +709 │ │ │ │ │ +710 // allocate memory for linear solver statistics │ │ │ │ │ +711 _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 solver_statistics; │ │ │ │ │ +712 │ │ │ │ │ +713 // allocate memory for auxiliary variables │ │ │ │ │ +714 bool doRQI; │ │ │ │ │ +715 _R_e_a_l mu; │ │ │ │ │ +716 _B_l_o_c_k_V_e_c_t_o_r y(x_s); │ │ │ │ │ +717 _R_e_a_l omega; │ │ │ │ │ +718 _R_e_a_l mu_s_old; │ │ │ │ │ +719 _R_e_a_l mu_s_update; │ │ │ │ │ +720 _B_l_o_c_k_V_e_c_t_o_r temp(x_s); │ │ │ │ │ +721 _R_e_a_l q_norm, r_norm; │ │ │ │ │ +722 │ │ │ │ │ +723 // perform TLIME iteration │ │ │ │ │ +724 x_s *= (1.0 / x_s.two_norm()); │ │ │ │ │ +725 extrnl = true; │ │ │ │ │ +726 doRQI = false; │ │ │ │ │ +727 r_norm = std::numeric_limits::max(); │ │ │ │ │ +728 _n_I_t_e_r_a_t_i_o_n_s__ = 0; │ │ │ │ │ +729 while (r_norm > epsilon) │ │ │ │ │ +730 { │ │ │ │ │ +731 // update and check number of iterations │ │ │ │ │ +732 if (++_n_I_t_e_r_a_t_i_o_n_s__ > _n_I_t_e_r_a_t_i_o_n_s_M_a_x__) │ │ │ │ │ +733 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"TLIME iteration did not " │ │ │ │ │ +734 << "converge in " << _n_I_t_e_r_a_t_i_o_n_s_M_a_x__ │ │ │ │ │ +735 << " iterations (║residual║_2 = " << r_norm │ │ │ │ │ +736 << ", epsilon = " << epsilon << ")."); │ │ │ │ │ +737 │ │ │ │ │ +738 // set shift for next iteration according to inverse iteration │ │ │ │ │ +739 // with shift (II) resp. Rayleigh quotient iteration (RQI) │ │ │ │ │ +740 if (doRQI) │ │ │ │ │ +741 mu = mu_s; │ │ │ │ │ +742 else │ │ │ │ │ +743 mu = gamma; │ │ │ │ │ +744 │ │ │ │ │ +745 // update II/RQI iteration operator, │ │ │ │ │ +746 // update II/RQI iteration matrix when needed │ │ │ │ │ +747 _u_p_d_a_t_e_S_h_i_f_t_M_u(mu,solver); │ │ │ │ │ +748 │ │ │ │ │ +749 // do one iteration of the II/RQI algorithm, │ │ │ │ │ +750 // part 1: solve (m_ - mu*I) * y = x for y │ │ │ │ │ +751 temp = x_s; │ │ │ │ │ +752 solver.apply(y,temp,solver_statistics); │ │ │ │ │ +753 │ │ │ │ │ +754 // do one iteration of the II/RQI algorithm, │ │ │ │ │ +755 // part 2: compute omega │ │ │ │ │ +756 omega = (1.0 / y.two_norm()); │ │ │ │ │ +757 │ │ │ │ │ +758 // backup the old Rayleigh quotient │ │ │ │ │ +759 mu_s_old = mu_s; │ │ │ │ │ +760 │ │ │ │ │ +761 // compile time switch between accuracy and efficiency │ │ │ │ │ +762 if (avoidLinSolverCrime) │ │ │ │ │ +763 { │ │ │ │ │ +764 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue │ │ │ │ │ +765 // (use that x_new = y * omega) │ │ │ │ │ +766 _m__._m_v(y,temp); │ │ │ │ │ +767 mu_s = (y * temp) * (omega * omega); │ │ │ │ │ +768 │ │ │ │ │ +769 // get norm of "the residual with respect to the shift used by II", │ │ │ │ │ +770 // use normal representation of q │ │ │ │ │ +771 // (use that x_new = y * omega, use that temp = m_ * y) │ │ │ │ │ +772 temp.axpy(-gamma,y); │ │ │ │ │ +773 q_norm = temp.two_norm() * omega; │ │ │ │ │ +774 │ │ │ │ │ +775 // get norm of "the residual with respect to the Rayleigh quotient" │ │ │ │ │ +776 r_norm = q_norm*q_norm - (gamma-mu_s)*(gamma-mu_s); │ │ │ │ │ +777 // prevent that truncation errors invalidate the norm │ │ │ │ │ +778 // (we don't want to calculate sqrt of a negative number) │ │ │ │ │ +779 if (r_norm >= 0) │ │ │ │ │ +780 { │ │ │ │ │ +781 // use relation between the norms of r and q for efficiency │ │ │ │ │ +782 r_norm = std::sqrt(r_norm); │ │ │ │ │ +783 } │ │ │ │ │ +784 else │ │ │ │ │ +785 { │ │ │ │ │ +786 // use relation between r and q │ │ │ │ │ +787 // (use that x_new = y * omega, use that temp = (m_ - gamma*I) * y = q / │ │ │ │ │ +omega) │ │ │ │ │ +788 temp.axpy(gamma-mu_s,y); │ │ │ │ │ +789 r_norm = temp.two_norm() * omega; │ │ │ │ │ +790 } │ │ │ │ │ +791 } │ │ │ │ │ +792 else │ │ │ │ │ +793 { │ │ │ │ │ +794 // update the Rayleigh quotient mu_s, i.e. the approximated eigenvalue │ │ │ │ │ +795 if (!doRQI) │ │ │ │ │ +796 { │ │ │ │ │ +797 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = │ │ │ │ │ +x_s) │ │ │ │ │ +798 mu_s = gamma + (y * x_s) * (omega * omega); │ │ │ │ │ +799 } │ │ │ │ │ +800 else │ │ │ │ │ +801 { │ │ │ │ │ +802 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y │ │ │ │ │ += x_s) │ │ │ │ │ +803 mu_s_update = (y * x_s) * (omega * omega); │ │ │ │ │ +804 mu_s += mu_s_update; │ │ │ │ │ +805 } │ │ │ │ │ +806 │ │ │ │ │ +807 // get norm of "the residual with respect to the shift used by II" │ │ │ │ │ +808 if (!doRQI) │ │ │ │ │ +809 { │ │ │ │ │ +810 // use special representation of q in the II case │ │ │ │ │ +811 // (use that x_new = y * omega, additionally use that (m_ - gamma*I) * y = │ │ │ │ │ +x_s) │ │ │ │ │ +812 q_norm = omega; │ │ │ │ │ +813 } │ │ │ │ │ +814 else │ │ │ │ │ +815 { │ │ │ │ │ +816 // use special representation of q in the RQI case │ │ │ │ │ +817 // (use that x_new = y * omega, additionally use that (m_ - mu_s_old*I) * y │ │ │ │ │ += x_s) │ │ │ │ │ +818 temp = x_s; temp.axpy(mu_s-gamma,y); │ │ │ │ │ +819 q_norm = temp.two_norm() * omega; │ │ │ │ │ +820 } │ │ │ │ │ +821 │ │ │ │ │ +822 // get norm of "the residual with respect to the Rayleigh quotient" │ │ │ │ │ +823 // don't use efficient relation between the norms of r and q, as │ │ │ │ │ +824 // this relation seems to yield a less accurate r_norm in the case │ │ │ │ │ +825 // where linear solver crime is admitted │ │ │ │ │ +826 if (!doRQI) │ │ │ │ │ +827 { │ │ │ │ │ +828 // (use that x_new = y * omega and use that (m_ - gamma*I) * y = x_s) │ │ │ │ │ +829 temp = x_s; temp.axpy(gamma-lambda,y); │ │ │ │ │ +830 r_norm = temp.two_norm() * omega; │ │ │ │ │ +831 } │ │ │ │ │ +832 else │ │ │ │ │ +833 { │ │ │ │ │ +834 // (use that x_new = y * omega and use that (m_ - mu_s_old*I) * y = x_s) │ │ │ │ │ +835 temp = x_s; temp.axpy(-mu_s_update,y); │ │ │ │ │ +836 r_norm = temp.two_norm() * omega; │ │ │ │ │ +837 } │ │ │ │ │ +838 } │ │ │ │ │ +839 │ │ │ │ │ +840 // do one iteration of the II/RQI algorithm, │ │ │ │ │ +841 // part 3: update x │ │ │ │ │ +842 x_s = y; x_s *= omega; │ │ │ │ │ +843 │ │ │ │ │ +844 // // for relative residual norm mode, scale with mu_s^{-1} │ │ │ │ │ +845 // r_norm /= std::abs(mu_s); │ │ │ │ │ +846 │ │ │ │ │ +847 // print verbosity information │ │ │ │ │ +848 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 1) │ │ │ │ │ +849 std::cout << _b_l_a_n_k__ << "iteration " │ │ │ │ │ +850 << std::left << std::setw(3) << _n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ +851 << " (" << (doRQI ? "RQI," : "II, ") │ │ │ │ │ +852 << " " << (doRQI ? "—>" : " ") << " " │ │ │ │ │ +853 << "║r║_2 = " << std::setw(11) << r_norm │ │ │ │ │ +854 << ", " << (doRQI ? " " : "—>") << " " │ │ │ │ │ +855 << "║q║_2 = " << std::setw(11) << q_norm │ │ │ │ │ +856 << "): λ = " << lambda << std::endl │ │ │ │ │ +857 << std::resetiosflags(std::ios::left); │ │ │ │ │ +858 │ │ │ │ │ +859 // check if the eigenvalue closest to gamma lies in J │ │ │ │ │ +860 if (!doRQI && q_norm < eta) │ │ │ │ │ +861 { │ │ │ │ │ +862 // J is not free of eigenvalues │ │ │ │ │ +863 extrnl = false; │ │ │ │ │ +864 │ │ │ │ │ +865 // by theory we know now that mu_s also lies in J │ │ │ │ │ +866 assert(std::abs(mu_s-gamma) < eta); │ │ │ │ │ +867 │ │ │ │ │ +868 // switch to RQI │ │ │ │ │ +869 doRQI = true; │ │ │ │ │ +870 } │ │ │ │ │ +871 │ │ │ │ │ +872 // revert to II if J is not free of eigenvalues but │ │ │ │ │ +873 // at some point mu_s falls back again outside J │ │ │ │ │ +874 if (!extrnl && doRQI && std::abs(mu_s-gamma) >= eta) │ │ │ │ │ +875 doRQI = false; │ │ │ │ │ +876 │ │ │ │ │ +877 // if eigenvalue closest to gamma does not lie in J use RQI │ │ │ │ │ +878 // solely to accelerate the convergence to this eigenvalue │ │ │ │ │ +879 // when II has become stationary │ │ │ │ │ +880 if (extrnl && !doRQI) │ │ │ │ │ +881 { │ │ │ │ │ +882 // switch to RQI if the relative change of the Rayleigh │ │ │ │ │ +883 // quotient indicates that II has become stationary │ │ │ │ │ +884 if (_n_I_t_e_r_a_t_i_o_n_s__ >= m && │ │ │ │ │ +885 std::abs(mu_s - mu_s_old) / std::abs(mu_s) < delta) │ │ │ │ │ +886 doRQI = true; │ │ │ │ │ +887 } │ │ │ │ │ +888 } │ │ │ │ │ +889 │ │ │ │ │ +890 // // compute final residual and lambda again (paranoia....) │ │ │ │ │ +891 // m_.mv(x_s,temp); │ │ │ │ │ +892 // mu_s = x_s * temp; │ │ │ │ │ +893 // temp.axpy(-mu_s,x_s); │ │ │ │ │ +894 // r_norm = temp.two_norm(); │ │ │ │ │ +895 // // r_norm /= std::abs(mu_s); │ │ │ │ │ +896 │ │ │ │ │ +897 // print verbosity information │ │ │ │ │ +898 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 0) │ │ │ │ │ +899 { │ │ │ │ │ +900 if (extrnl) │ │ │ │ │ +901 std::cout << _b_l_a_n_k__ << "Interval " │ │ │ │ │ +902 << "(" << gamma - eta << "," << gamma + eta │ │ │ │ │ +903 << ") is free of eigenvalues, approximating " │ │ │ │ │ +904 << "the closest eigenvalue." << std::endl; │ │ │ │ │ +905 std::cout << _b_l_a_n_k__ << "Result (" │ │ │ │ │ +906 << "#iterations = " << _n_I_t_e_r_a_t_i_o_n_s__ << ", " │ │ │ │ │ +907 << "║residual║_2 = " << r_norm << "): " │ │ │ │ │ +908 << "λ = " << lambda << std::endl; │ │ │ │ │ +909 if (_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ > 2) │ │ │ │ │ +910 { │ │ │ │ │ +911 // print approximated eigenvector via DUNE-ISTL I/O methods │ │ │ │ │ +912 _D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r(std::cout,x,_b_l_a_n_k__+"x",_b_l_a_n_k__+"row"); │ │ │ │ │ +913 } │ │ │ │ │ +914 } │ │ │ │ │ +915 } │ │ │ │ │ +916 │ │ │ │ │ +_9_2_5 inline _I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r& _g_e_t_I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r () │ │ │ │ │ +926 { │ │ │ │ │ +927 // return iteration operator │ │ │ │ │ +928 return _i_t_O_p_e_r_a_t_o_r__; │ │ │ │ │ +929 } │ │ │ │ │ +930 │ │ │ │ │ +_9_4_5 inline const _B_C_R_S_M_a_t_r_i_x& _g_e_t_I_t_e_r_a_t_i_o_n_M_a_t_r_i_x () const │ │ │ │ │ +946 { │ │ │ │ │ +947 // create iteration matrix on demand │ │ │ │ │ +948 if (!_i_t_M_a_t_r_i_x__) │ │ │ │ │ +949 _i_t_M_a_t_r_i_x__ = std::make_unique(_m__); │ │ │ │ │ +950 │ │ │ │ │ +951 // return iteration matrix │ │ │ │ │ +952 return *_i_t_M_a_t_r_i_x__; │ │ │ │ │ +953 } │ │ │ │ │ +954 │ │ │ │ │ +_9_5_9 inline unsigned int _g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t () const │ │ │ │ │ +960 { │ │ │ │ │ +961 if (_n_I_t_e_r_a_t_i_o_n_s__ == 0) │ │ │ │ │ +962 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r,"No algorithm applied, yet."); │ │ │ │ │ +963 │ │ │ │ │ +964 return _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ +965 } │ │ │ │ │ +966 │ │ │ │ │ +967 protected: │ │ │ │ │ +982 template │ │ │ │ │ +_9_8_3 inline void _u_p_d_a_t_e_S_h_i_f_t_M_u (const _R_e_a_l& mu, │ │ │ │ │ +984 ISTLLinearSolver& solver) const │ │ │ │ │ +985 { │ │ │ │ │ +986 // do nothing if new shift equals the old one │ │ │ │ │ +987 if (mu == _m_u__) return; │ │ │ │ │ +988 │ │ │ │ │ +989 // update shift mu_, i.e. update iteration operator │ │ │ │ │ +990 _m_u__ = mu; │ │ │ │ │ +991 │ │ │ │ │ +992 // update iteration matrix when needed │ │ │ │ │ +993 if (_i_t_M_a_t_r_i_x__) │ │ │ │ │ +994 { │ │ │ │ │ +995 // iterate over entries in iteration matrix diagonal │ │ │ │ │ +996 constexpr int rowBlockSize = BCRSMatrix::block_type::rows; │ │ │ │ │ +997 constexpr int colBlockSize = BCRSMatrix::block_type::cols; │ │ │ │ │ +998 for (typename _B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e i = 0; │ │ │ │ │ +999 i < _i_t_M_a_t_r_i_x__->M()*rowBlockSize; ++i) │ │ │ │ │ +1000 { │ │ │ │ │ +1001 // access m_[i,i] where i is the flat index of a row/column │ │ │ │ │ +1002 const _R_e_a_l& m_entry = _m__ │ │ │ │ │ +1003 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize]; │ │ │ │ │ +1004 // access *itMatrix[i,i] where i is the flat index of a row/column │ │ │ │ │ +1005 _R_e_a_l& entry = (*itMatrix_) │ │ │ │ │ +1006 [i/rowBlockSize][i/colBlockSize][i%rowBlockSize][i%colBlockSize]; │ │ │ │ │ +1007 // change current entry in iteration matrix diagonal │ │ │ │ │ +1008 entry = m_entry - _m_u__; │ │ │ │ │ +1009 } │ │ │ │ │ +1010 // notify linear solver about change of the iteration matrix object │ │ │ │ │ +1011 _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_>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ │ +1012 (solver,*_i_t_M_a_t_r_i_x__); │ │ │ │ │ +1013 } │ │ │ │ │ +1014 } │ │ │ │ │ +1015 │ │ │ │ │ +1016 protected: │ │ │ │ │ +1017 // parameters related to iterative eigenvalue algorithms │ │ │ │ │ +_1_0_1_8 const _B_C_R_S_M_a_t_r_i_x& _m__; │ │ │ │ │ +_1_0_1_9 const unsigned int _n_I_t_e_r_a_t_i_o_n_s_M_a_x__; │ │ │ │ │ +1020 │ │ │ │ │ +1021 // verbosity setting │ │ │ │ │ +_1_0_2_2 const unsigned int _v_e_r_b_o_s_i_t_y___l_e_v_e_l__; │ │ │ │ │ +1023 │ │ │ │ │ +1024 // shift mu_ used by iteration operator/matrix (m_ - mu_*I) │ │ │ │ │ +_1_0_2_5 mutable _R_e_a_l _m_u__; │ │ │ │ │ +1026 │ │ │ │ │ +1027 // iteration operator (m_ - mu_*I), passing shift mu_ by reference │ │ │ │ │ +_1_0_2_8 const _M_a_t_r_i_x_O_p_e_r_a_t_o_r _m_a_t_r_i_x_O_p_e_r_a_t_o_r__; │ │ │ │ │ +_1_0_2_9 const _S_c_a_l_i_n_g_O_p_e_r_a_t_o_r _s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__; │ │ │ │ │ +_1_0_3_0 _O_p_e_r_a_t_o_r_S_u_m _i_t_O_p_e_r_a_t_o_r__; │ │ │ │ │ +1031 │ │ │ │ │ +1032 // iteration matrix (m_ - mu_*I), provided on demand when needed │ │ │ │ │ +1033 // (e.g. for preconditioning) │ │ │ │ │ +_1_0_3_4 mutable std::unique_ptr _i_t_M_a_t_r_i_x__; │ │ │ │ │ +1035 │ │ │ │ │ +1036 // memory for storing temporary variables (mutable as they shall │ │ │ │ │ +1037 // just be effectless auxiliary variables of the const apply*(...) │ │ │ │ │ +1038 // methods) │ │ │ │ │ +_1_0_3_9 mutable unsigned int _n_I_t_e_r_a_t_i_o_n_s__; │ │ │ │ │ +1040 │ │ │ │ │ +1041 // constants for printing verbosity information │ │ │ │ │ +_1_0_4_2 const std::string _t_i_t_l_e__; │ │ │ │ │ +_1_0_4_3 const std::string _b_l_a_n_k__; │ │ │ │ │ +1044 }; │ │ │ │ │ +1045 │ │ │ │ │ +1048} // namespace Dune │ │ │ │ │ +1049 │ │ │ │ │ +1050#endif // DUNE_ISTL_EIGENVALUE_POWERITERATION_HH │ │ │ │ │ +_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ │ +Define general, extensible interface for operators. The available │ │ │ │ │ +implementation wraps a matrix. │ │ │ │ │ _s_o_l_v_e_r_s_._h_h │ │ │ │ │ Implementations of the inverse operator interface. │ │ │ │ │ -_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_f_r_e_e │ │ │ │ │ -void free() │ │ │ │ │ -free allocated space. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:521 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res) │ │ │ │ │ -Apply inverse operator,. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:358 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:232 │ │ │ │ │ -_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:221 │ │ │ │ │ -_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(long int m, const long int *cs, const long int *ri, std:: │ │ │ │ │ -complex< double > *val, double *x, const double *b, A... args) │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:156 │ │ │ │ │ -_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) │ │ │ │ │ -Initialize data from given matrix. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:444 │ │ │ │ │ -_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:141 │ │ │ │ │ -_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:282 │ │ │ │ │ -_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:131 │ │ │ │ │ -_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:74 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ │ -std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL │ │ │ │ │ ->::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const │ │ │ │ │ -M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< │ │ │ │ │ -typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) │ │ │ │ │ -const │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:616 │ │ │ │ │ -_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, long int > UMFPackMatrix │ │ │ │ │ -The corresponding UMFPack matrix type. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:223 │ │ │ │ │ -_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:89 │ │ │ │ │ -_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:306 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -typename Impl::UMFPackVectorChooser< M >::range_type range_type │ │ │ │ │ -The type of the range of the solver. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:229 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ │ -UMFPack() │ │ │ │ │ -default constructor │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:288 │ │ │ │ │ -_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:104 │ │ │ │ │ -_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:84 │ │ │ │ │ -_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(long int m, long int n, const long int *cs, const long int │ │ │ │ │ -*ri, const double *val, A... args) │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:162 │ │ │ │ │ -_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:69 │ │ │ │ │ -_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:151 │ │ │ │ │ -_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:121 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ -void setSubMatrix(const Matrix &_mat, const S &rowIndexSet) │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:463 │ │ │ │ │ -_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:94 │ │ │ │ │ -_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:146 │ │ │ │ │ -_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, long int > MatrixInitializer │ │ │ │ │ -Type of an associated initializer class. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:225 │ │ │ │ │ -_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:399 │ │ │ │ │ -_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:116 │ │ │ │ │ -_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:64 │ │ │ │ │ -_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:487 │ │ │ │ │ -_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:333 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_n_u_m_e_r_i_c │ │ │ │ │ -static void numeric(A... args) │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:79 │ │ │ │ │ -_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:50 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_~_U_M_F_P_a_c_k │ │ │ │ │ -virtual ~UMFPack() │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:349 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_n_a_m_e │ │ │ │ │ -const char * name() │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:532 │ │ │ │ │ -_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:436 │ │ │ │ │ -_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:512 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -typename Impl::UMFPackVectorChooser< M >::domain_type domain_type │ │ │ │ │ -The type of the domain of the solver. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:227 │ │ │ │ │ -_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:245 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ │ -InverseOperatorResult &res) │ │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:389 │ │ │ │ │ -_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:425 │ │ │ │ │ -_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:126 │ │ │ │ │ -_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:220 │ │ │ │ │ -_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 long int *cs, const long int *ri, const double *val, │ │ │ │ │ -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_ _>_:_:_d_e_f_a_u_l_t_s │ │ │ │ │ -static void defaults(A... args) │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:59 │ │ │ │ │ -_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:99 │ │ │ │ │ -_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:263 │ │ │ │ │ -_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:503 │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_s_t_d │ │ │ │ │ -STL namespace. │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ +_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ │ +Templates characterizing the type of a solver. │ │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_i_o_._h_h │ │ │ │ │ +Some generic functions for pretty printing vectors and matrices. │ │ │ │ │ +_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ +_D_u_n_e_:_:_p_r_i_n_t_v_e_c_t_o_r │ │ │ │ │ +void printvector(std::ostream &s, const V &v, std::string title, std::string │ │ │ │ │ +rowtext, int columns=1, int width=10, int precision=2) │ │ │ │ │ +Print an ISTL vector. │ │ │ │ │ +DDeeffiinniittiioonn io.hh:89 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ │ _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ A sparse block matrix with compressed row storage. │ │ │ │ │ DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The type for the index access and the size. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ +_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:1978 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_m_v │ │ │ │ │ +void mv(const X &x, Y &y) const │ │ │ │ │ +y = A x │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1612 │ │ │ │ │ +_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:1972 │ │ │ │ │ +_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:395 │ │ │ │ │ +_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:401 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ +Iterative eigenvalue algorithms based on power iteration. │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:176 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_i_t_M_a_t_r_i_x__ │ │ │ │ │ +std::unique_ptr< BCRSMatrix > itMatrix_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1034 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ +PowerIteration_Algorithms(const PowerIteration_Algorithms &)=delete │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_S_c_a_l_i_n_g_O_p_e_r_a_t_o_r │ │ │ │ │ +Impl::ScalingLinearOperator< BlockVector > ScalingOperator │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:181 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_b_l_a_n_k__ │ │ │ │ │ +const std::string blank_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1043 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_O_p_e_r_a_t_o_r_S_u_m │ │ │ │ │ +Impl::LinearOperatorSum< MatrixOperator, ScalingOperator > OperatorSum │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ │ +Dune::MatrixAdapter< BCRSMatrix, BlockVector, BlockVector > MatrixOperator │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n │ │ │ │ │ +void applyInverseIteration(const Real &epsilon, ISTLLinearSolver &solver, │ │ │ │ │ +BlockVector &x, Real &lambda) const │ │ │ │ │ +Perform the inverse iteration algorithm to compute an approximation lambda of │ │ │ │ │ +the least dominant (i.... │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:355 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_T_L_I_M_E_I_t_e_r_a_t_i_o_n │ │ │ │ │ +void applyTLIMEIteration(const Real &gamma, const Real &eta, const Real │ │ │ │ │ +&epsilon, ISTLLinearSolver &solver, const Real &delta, const std::size_t &m, │ │ │ │ │ +bool &extrnl, BlockVector &x, Real &lambda) const │ │ │ │ │ +Perform the "two-level iterative method for eigenvalue calculations (TLIME)" │ │ │ │ │ +iteration algorit... │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:691 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_g_e_t_I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ +IterationOperator & getIterationOperator() │ │ │ │ │ +Return the iteration operator (m_ - mu_*I). │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:925 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_i_t_O_p_e_r_a_t_o_r__ │ │ │ │ │ +OperatorSum itOperator_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1030 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_m__ │ │ │ │ │ +const BCRSMatrix & m_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1018 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s │ │ │ │ │ +PowerIteration_Algorithms(const BCRSMatrix &m, const unsigned int │ │ │ │ │ +nIterationsMax=1000, const unsigned int verbosity_level=0) │ │ │ │ │ +Construct from required parameters. │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_n_I_t_e_r_a_t_i_o_n_s_M_a_x__ │ │ │ │ │ +const unsigned int nIterationsMax_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1019 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_P_o_w_e_r_I_t_e_r_a_t_i_o_n │ │ │ │ │ +void applyPowerIteration(const Real &epsilon, BlockVector &x, Real &lambda) │ │ │ │ │ +const │ │ │ │ │ +Perform the power iteration algorithm to compute an approximation lambda of the │ │ │ │ │ +dominant (i.... │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:260 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_I_t_e_r_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ +OperatorSum IterationOperator │ │ │ │ │ +Type of iteration operator (m_ - mu_*I) │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:189 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_R_a_y_l_e_i_g_h_Q_u_o_t_i_e_n_t_I_t_e_r_a_t_i_o_n │ │ │ │ │ +void applyRayleighQuotientIteration(const Real &epsilon, ISTLLinearSolver │ │ │ │ │ +&solver, BlockVector &x, Real &lambda) const │ │ │ │ │ +Perform the Rayleigh quotient iteration algorithm to compute an approximation │ │ │ │ │ +lambda of an eigenvalue... │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:533 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_a_p_p_l_y_I_n_v_e_r_s_e_I_t_e_r_a_t_i_o_n │ │ │ │ │ +void applyInverseIteration(const Real &gamma, const Real &epsilon, │ │ │ │ │ +ISTLLinearSolver &solver, BlockVector &x, Real &lambda) const │ │ │ │ │ +Perform the inverse iteration with shift algorithm to compute an approximation │ │ │ │ │ +lambda of the eigenval... │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:394 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_s_c_a_l_i_n_g_O_p_e_r_a_t_o_r__ │ │ │ │ │ +const ScalingOperator scalingOperator_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1029 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_u_p_d_a_t_e_S_h_i_f_t_M_u │ │ │ │ │ +void updateShiftMu(const Real &mu, ISTLLinearSolver &solver) const │ │ │ │ │ +Update shift mu_, i.e. update iteration operator/matrix (m_ - mu_*I). │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:983 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +PowerIteration_Algorithms & operator=(const PowerIteration_Algorithms &)=delete │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_g_e_t_I_t_e_r_a_t_i_o_n_C_o_u_n_t │ │ │ │ │ +unsigned int getIterationCount() const │ │ │ │ │ +Return the number of iterations in last application of an algorithm. │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:959 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_m_a_t_r_i_x_O_p_e_r_a_t_o_r__ │ │ │ │ │ +const MatrixOperator matrixOperator_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1028 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_g_e_t_I_t_e_r_a_t_i_o_n_M_a_t_r_i_x │ │ │ │ │ +const BCRSMatrix & getIterationMatrix() const │ │ │ │ │ +Return the iteration matrix (m_ - mu_*I), provided on demand when needed (e.g. │ │ │ │ │ +for direct solvers or ... │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:945 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_n_I_t_e_r_a_t_i_o_n_s__ │ │ │ │ │ +unsigned int nIterations_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1039 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_v_e_r_b_o_s_i_t_y___l_e_v_e_l__ │ │ │ │ │ +const unsigned int verbosity_level_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1022 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_t_i_t_l_e__ │ │ │ │ │ +const std::string title_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1042 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_R_e_a_l │ │ │ │ │ +BlockVector::field_type Real │ │ │ │ │ +Type of underlying field. │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:186 │ │ │ │ │ +_D_u_n_e_:_:_P_o_w_e_r_I_t_e_r_a_t_i_o_n___A_l_g_o_r_i_t_h_m_s_:_:_m_u__ │ │ │ │ │ +Real mu_ │ │ │ │ │ +DDeeffiinniittiioonn poweriteration.hh:1025 │ │ │ │ │ _D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ derive error class from the base class in common │ │ │ │ │ DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ -Sequential overlapping Schwarz preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ +A linear operator. │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 operators.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ +virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0 │ │ │ │ │ +apply operator to x, scale and add: │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 linear operator (see SolverCategory::Category) │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ +virtual void apply(const X &x, Y &y) const =0 │ │ │ │ │ +apply operator to x: The input vector is consistent and the output must also be │ │ │ │ │ +consistent on the in... │ │ │ │ │ +_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ +DDeeffiinniittiioonn operators.hh:70 │ │ │ │ │ +_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:137 │ │ │ │ │ _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:48 │ │ │ │ │ -_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:82 │ │ │ │ │ -_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:67 │ │ │ │ │ -_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:73 │ │ │ │ │ -_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:99 │ │ │ │ │ +_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:524 │ │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ │ Category │ │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ │ @ sequential │ │ │ │ │ Category for sequential solvers. │ │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ │ -@ value │ │ │ │ │ -Whether this is a direct solver. │ │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ │ -@ value │ │ │ │ │ -whether the solver internally uses column compressed storage │ │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ │ -The UMFPack direct sparse solver. │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:215 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:609 │ │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k │ │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:610 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00212.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bccsmatrixinitializer.hh File Reference │ │ │ │ +dune-istl: scaledidmatrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,33 +70,50 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces
│ │ │ │ -
bccsmatrixinitializer.hh File Reference
│ │ │ │ +
scaledidmatrix.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <limits>
│ │ │ │ -#include <set>
│ │ │ │ -#include <dune/common/typetraits.hh>
│ │ │ │ -#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -#include <dune/istl/bccsmatrix.hh>
│ │ │ │ + │ │ │ │ +

This file implements a quadratic matrix of fixed size which is a multiple of the identity. │ │ │ │ +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>
│ │ │ │
│ │ │ │

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::ISTL
 
│ │ │ │ -
│ │ │ │ +

Detailed Description

│ │ │ │ +

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

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,21 +1,36 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -bccsmatrixinitializer.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ +_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 │ │ │ │ │ _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_ _>_ _> │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_I_S_T_L │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +This file implements a quadratic matrix of fixed size which is a multiple of │ │ │ │ │ +the identity. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00212_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: bccsmatrixinitializer.hh Source File │ │ │ │ +dune-istl: scaledidmatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,335 +74,626 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
bccsmatrixinitializer.hh
│ │ │ │ +
scaledidmatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_BCCSMATRIX_INITIALIZER_HH
│ │ │ │ -
6#define DUNE_ISTL_BCCSMATRIX_INITIALIZER_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_SCALEDIDMATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_SCALEDIDMATRIX_HH
│ │ │ │
7
│ │ │ │ -
8#include <limits>
│ │ │ │ -
9#include <set>
│ │ │ │ -
10
│ │ │ │ -
11#include <dune/common/typetraits.hh>
│ │ │ │ -
12#include <dune/common/scalarmatrixview.hh>
│ │ │ │ -
13
│ │ │ │ - │ │ │ │ -
15
│ │ │ │ -
16namespace Dune
│ │ │ │ -
17{
│ │ │ │ -
18 template<class I, class S, class D>
│ │ │ │ -
19 class OverlappingSchwarzInitializer;
│ │ │ │ -
20}
│ │ │ │ -
21
│ │ │ │ -
22namespace Dune::ISTL::Impl
│ │ │ │ -
23{
│ │ │ │ -
31 template<class M, class S>
│ │ │ │ -
32 class MatrixRowSubset
│ │ │ │ -
33 {
│ │ │ │ -
34 public:
│ │ │ │ -
36 typedef M Matrix;
│ │ │ │ -
38 typedef S RowIndexSet;
│ │ │ │ -
39
│ │ │ │ -
45 MatrixRowSubset(const Matrix& m, const RowIndexSet& s)
│ │ │ │ -
46 : m_(m), s_(s)
│ │ │ │ -
47 {}
│ │ │ │ +
14#include <cmath>
│ │ │ │ +
15#include <cstddef>
│ │ │ │ +
16#include <complex>
│ │ │ │ +
17#include <iostream>
│ │ │ │ +
18#include <dune/common/exceptions.hh>
│ │ │ │ +
19#include <dune/common/fmatrix.hh>
│ │ │ │ +
20#include <dune/common/diagonalmatrix.hh>
│ │ │ │ +
21#include <dune/common/ftraits.hh>
│ │ │ │ +
22
│ │ │ │ +
23namespace Dune {
│ │ │ │ +
24
│ │ │ │ +
28 template<class K, int n>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
30 {
│ │ │ │ +
31 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix<K,n> > WrapperType;
│ │ │ │ +
32
│ │ │ │ +
33 public:
│ │ │ │ +
34 //===== type definitions and constants
│ │ │ │ +
35
│ │ │ │ +
37 typedef K field_type;
│ │ │ │ +
38
│ │ │ │ +
40 typedef K block_type;
│ │ │ │ +
41
│ │ │ │ +
43 typedef std::size_t size_type;
│ │ │ │ +
44
│ │ │ │ +
46 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
47 static constexpr std::size_t blocklevel = 1;
│ │ │ │
48
│ │ │ │ -
49 const Matrix& matrix() const
│ │ │ │ -
50 {
│ │ │ │ -
51 return m_;
│ │ │ │ -
52 }
│ │ │ │ -
53
│ │ │ │ -
54 const RowIndexSet& rowIndexSet() const
│ │ │ │ -
55 {
│ │ │ │ -
56 return s_;
│ │ │ │ -
57 }
│ │ │ │ -
58
│ │ │ │ -
60 class const_iterator
│ │ │ │ -
61 : public ForwardIteratorFacade<const_iterator, const typename Matrix::row_type>
│ │ │ │ -
62 {
│ │ │ │ -
63 public:
│ │ │ │ -
64 const_iterator(typename Matrix::const_iterator firstRow,
│ │ │ │ -
65 typename RowIndexSet::const_iterator pos)
│ │ │ │ -
66 : firstRow_(firstRow), pos_(pos)
│ │ │ │ -
67 {}
│ │ │ │ -
68
│ │ │ │ -
69
│ │ │ │ -
70 const typename Matrix::row_type& dereference() const
│ │ │ │ -
71 {
│ │ │ │ -
72 return *(firstRow_+ *pos_);
│ │ │ │ -
73 }
│ │ │ │ -
74 bool equals(const const_iterator& o) const
│ │ │ │ -
75 {
│ │ │ │ -
76 return pos_==o.pos_;
│ │ │ │ -
77 }
│ │ │ │ -
78 void increment()
│ │ │ │ -
79 {
│ │ │ │ -
80 ++pos_;
│ │ │ │ -
81 }
│ │ │ │ -
82 typename RowIndexSet::value_type index() const
│ │ │ │ -
83 {
│ │ │ │ -
84 return *pos_;
│ │ │ │ -
85 }
│ │ │ │ +
50 typedef DiagonalRowVector<K,n> row_type;
│ │ │ │ + │ │ │ │ +
52 typedef DiagonalRowVectorConst<K,n> const_row_type;
│ │ │ │ + │ │ │ │ +
54
│ │ │ │ +
56 enum {
│ │ │ │ +
58 rows = n,
│ │ │ │ +
60 cols = n
│ │ │ │ +
61 };
│ │ │ │ +
62
│ │ │ │ +
63 //===== constructors
│ │ │ │ + │ │ │ │ +
67
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
71 : p_(k)
│ │ │ │ +
72 {}
│ │ │ │ +
│ │ │ │ +
73
│ │ │ │ +
74 //===== assignment from scalar
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
76 {
│ │ │ │ +
77 p_ = k;
│ │ │ │ +
78 return *this;
│ │ │ │ +
79 }
│ │ │ │ +
│ │ │ │ +
80
│ │ │ │ +
81 // check if matrix is identical to other matrix (not only identical values)
│ │ │ │ +
│ │ │ │ +
82 bool identical(const ScaledIdentityMatrix<K,n>& other) const
│ │ │ │ +
83 {
│ │ │ │ +
84 return (this==&other);
│ │ │ │ +
85 }
│ │ │ │ +
│ │ │ │
86
│ │ │ │ -
87 private:
│ │ │ │ -
89 typename Matrix::const_iterator firstRow_;
│ │ │ │ -
91 typename RowIndexSet::const_iterator pos_;
│ │ │ │ -
92 };
│ │ │ │ -
93
│ │ │ │ -
95 const_iterator begin() const
│ │ │ │ -
96 {
│ │ │ │ -
97 return const_iterator(m_.begin(), s_.begin());
│ │ │ │ -
98 }
│ │ │ │ -
100 const_iterator end() const
│ │ │ │ -
101 {
│ │ │ │ -
102 return const_iterator(m_.begin(), s_.end());
│ │ │ │ -
103 }
│ │ │ │ -
104
│ │ │ │ -
105 private:
│ │ │ │ -
107 const Matrix& m_;
│ │ │ │ -
109 const RowIndexSet& s_;
│ │ │ │ -
110 };
│ │ │ │ -
111
│ │ │ │ -
118 template<class M, class I = typename M::size_type>
│ │ │ │ -
119 class BCCSMatrixInitializer
│ │ │ │ -
120 {
│ │ │ │ -
121 template<class IList, class S, class D>
│ │ │ │ - │ │ │ │ -
123 public:
│ │ │ │ -
124 using Matrix = M;
│ │ │ │ -
125 using Index = I;
│ │ │ │ -
126 typedef Dune::ISTL::Impl::BCCSMatrix<typename Matrix::field_type, I> OutputMatrix;
│ │ │ │ -
127 typedef typename Matrix::size_type size_type;
│ │ │ │ -
128
│ │ │ │ -
131 BCCSMatrixInitializer(OutputMatrix& mat_)
│ │ │ │ -
132 : mat(&mat_), cols(mat_.M())
│ │ │ │ -
133 {
│ │ │ │ -
134 if constexpr (Dune::IsNumber<typename M::block_type>::value)
│ │ │ │ -
135 {
│ │ │ │ -
136 n = m = 1;
│ │ │ │ -
137 }
│ │ │ │ -
138 else
│ │ │ │ -
139 {
│ │ │ │ -
140 // WARNING: This assumes that all blocks are dense and identical
│ │ │ │ -
141 n = M::block_type::rows;
│ │ │ │ -
142 m = M::block_type::cols;
│ │ │ │ -
143 }
│ │ │ │ +
87 //===== iterator interface to rows of the matrix
│ │ │ │ +
89 typedef ContainerWrapperIterator<const WrapperType, reference, reference> Iterator;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
95 typedef typename row_type::Iterator ColIterator;
│ │ │ │ +
96
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
99 {
│ │ │ │ +
100 return Iterator(WrapperType(this),0);
│ │ │ │ +
101 }
│ │ │ │ +
│ │ │ │ +
102
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
105 {
│ │ │ │ +
106 return Iterator(WrapperType(this),n);
│ │ │ │ +
107 }
│ │ │ │ +
│ │ │ │ +
108
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
112 {
│ │ │ │ +
113 return Iterator(WrapperType(this),n-1);
│ │ │ │ +
114 }
│ │ │ │ +
│ │ │ │ +
115
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
119 {
│ │ │ │ +
120 return Iterator(WrapperType(this),-1);
│ │ │ │ +
121 }
│ │ │ │ +
│ │ │ │ +
122
│ │ │ │ +
123
│ │ │ │ +
125 typedef ContainerWrapperIterator<const WrapperType, const_reference, const_reference> ConstIterator;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
131 typedef typename const_row_type::ConstIterator ConstColIterator;
│ │ │ │ +
132
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
135 {
│ │ │ │ +
136 return ConstIterator(WrapperType(this),0);
│ │ │ │ +
137 }
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
141 {
│ │ │ │ +
142 return ConstIterator(WrapperType(this),n);
│ │ │ │ +
143 }
│ │ │ │ +
│ │ │ │
144
│ │ │ │ -
145 mat->Nnz_=0;
│ │ │ │ -
146 }
│ │ │ │ -
147
│ │ │ │ -
148 BCCSMatrixInitializer()
│ │ │ │ -
149 : mat(0), cols(0), n(0), m(0)
│ │ │ │ -
150 {}
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
148 {
│ │ │ │ +
149 return ConstIterator(WrapperType(this),n-1);
│ │ │ │ +
150 }
│ │ │ │ +
│ │ │ │
151
│ │ │ │ -
152 virtual ~BCCSMatrixInitializer()
│ │ │ │ -
153 {}
│ │ │ │ -
154
│ │ │ │ -
155 template<typename Iter>
│ │ │ │ -
156 void addRowNnz(const Iter& row) const
│ │ │ │ -
157 {
│ │ │ │ -
158 mat->Nnz_+=row->getsize();
│ │ │ │ -
159 }
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
155 {
│ │ │ │ +
156 return ConstIterator(WrapperType(this),-1);
│ │ │ │ +
157 }
│ │ │ │ +
│ │ │ │ +
158
│ │ │ │ +
159 //===== vector space arithmetic
│ │ │ │
160
│ │ │ │ -
161 template<typename Iter, typename FullMatrixIndex>
│ │ │ │ -
162 void addRowNnz(const Iter& row, const std::set<FullMatrixIndex>& indices) const
│ │ │ │ -
163 {
│ │ │ │ -
164 auto siter =indices.begin();
│ │ │ │ -
165 for (auto entry=row->begin(); entry!=row->end(); ++entry)
│ │ │ │ -
166 {
│ │ │ │ -
167 for(; siter!=indices.end() && *siter<entry.index(); ++siter) ;
│ │ │ │ -
168 if(siter==indices.end())
│ │ │ │ -
169 break;
│ │ │ │ -
170 if(*siter==entry.index())
│ │ │ │ -
171 // index is in subdomain
│ │ │ │ -
172 ++mat->Nnz_;
│ │ │ │ -
173 }
│ │ │ │ -
174 }
│ │ │ │ -
175
│ │ │ │ -
176 template<typename Iter, typename SubMatrixIndex>
│ │ │ │ -
177 void addRowNnz(const Iter& row, const std::vector<SubMatrixIndex>& indices) const
│ │ │ │ -
178 {
│ │ │ │ -
179 for (auto entry=row->begin(); entry!=row->end(); ++entry)
│ │ │ │ -
180 if (indices[entry.index()]!=std::numeric_limits<SubMatrixIndex>::max())
│ │ │ │ -
181 ++mat->Nnz_;
│ │ │ │ -
182 }
│ │ │ │ -
183
│ │ │ │ -
184 void allocate()
│ │ │ │ -
185 {
│ │ │ │ -
186 allocateMatrixStorage();
│ │ │ │ -
187 allocateMarker();
│ │ │ │ -
188 }
│ │ │ │ -
189
│ │ │ │ -
190 template<typename Iter, typename CIter>
│ │ │ │ -
191 void countEntries([[maybe_unused]] const Iter& row, const CIter& col) const
│ │ │ │ -
192 {
│ │ │ │ -
193 countEntries(col.index());
│ │ │ │ -
194 }
│ │ │ │ -
195
│ │ │ │ -
196 void countEntries(size_type colindex) const
│ │ │ │ -
197 {
│ │ │ │ -
198 for(size_type i=0; i < m; ++i)
│ │ │ │ -
199 {
│ │ │ │ -
200 assert(colindex*m+i<cols);
│ │ │ │ -
201 marker[colindex*m+i]+=n;
│ │ │ │ -
202 }
│ │ │ │ -
203 }
│ │ │ │ -
204
│ │ │ │ -
205 void calcColstart() const
│ │ │ │ -
206 {
│ │ │ │ -
207 mat->colstart[0]=0;
│ │ │ │ -
208 for(size_type i=0; i < cols; ++i) {
│ │ │ │ -
209 assert(i<cols);
│ │ │ │ -
210 mat->colstart[i+1]=mat->colstart[i]+marker[i];
│ │ │ │ -
211 marker[i]=mat->colstart[i];
│ │ │ │ -
212 }
│ │ │ │ -
213 }
│ │ │ │ -
214
│ │ │ │ -
215 template<typename Iter, typename CIter>
│ │ │ │ -
216 void copyValue(const Iter& row, const CIter& col) const
│ │ │ │ -
217 {
│ │ │ │ -
218 copyValue(col, row.index(), col.index());
│ │ │ │ -
219 }
│ │ │ │ -
220
│ │ │ │ -
221 template<typename CIter>
│ │ │ │ -
222 void copyValue(const CIter& col, size_type rowindex, size_type colindex) const
│ │ │ │ -
223 {
│ │ │ │ -
224 for(size_type i=0; i<n; i++) {
│ │ │ │ -
225 for(size_type j=0; j<m; j++) {
│ │ │ │ -
226 assert(colindex*m+j<cols-1 || (size_type)marker[colindex*m+j]<(size_type)mat->colstart[colindex*m+j+1]);
│ │ │ │ -
227 assert((size_type)marker[colindex*m+j]<mat->Nnz_);
│ │ │ │ -
228 mat->rowindex[marker[colindex*m+j]]=rowindex*n+i;
│ │ │ │ -
229 mat->values[marker[colindex*m+j]] = Dune::Impl::asMatrix(*col)[i][j];
│ │ │ │ -
230 ++marker[colindex*m+j]; // index for next entry in column
│ │ │ │ -
231 }
│ │ │ │ -
232 }
│ │ │ │ -
233 }
│ │ │ │ -
234
│ │ │ │ -
235 virtual void createMatrix() const
│ │ │ │ -
236 {
│ │ │ │ -
237 marker.clear();
│ │ │ │ -
238 }
│ │ │ │ -
239
│ │ │ │ -
240 protected:
│ │ │ │ -
241
│ │ │ │ -
242 void allocateMatrixStorage() const
│ │ │ │ -
243 {
│ │ │ │ -
244 mat->Nnz_*=n*m;
│ │ │ │ -
245 // initialize data
│ │ │ │ -
246 mat->values=new typename M::field_type[mat->Nnz_];
│ │ │ │ -
247 mat->rowindex=new I[mat->Nnz_];
│ │ │ │ -
248 mat->colstart=new I[cols+1];
│ │ │ │ -
249 }
│ │ │ │ -
250
│ │ │ │ -
251 void allocateMarker()
│ │ │ │ -
252 {
│ │ │ │ -
253 marker.resize(cols);
│ │ │ │ -
254 std::fill(marker.begin(), marker.end(), 0);
│ │ │ │ -
255 }
│ │ │ │ -
256
│ │ │ │ -
257 OutputMatrix* mat;
│ │ │ │ -
258 size_type cols;
│ │ │ │ -
259
│ │ │ │ -
260 // Number of rows/columns of the matrix entries
│ │ │ │ -
261 // (assumed to be scalars or dense matrices)
│ │ │ │ -
262 size_type n, m;
│ │ │ │ -
263
│ │ │ │ -
264 mutable std::vector<size_type> marker;
│ │ │ │ -
265 };
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
163 {
│ │ │ │ +
164 p_ += y.p_;
│ │ │ │ +
165 return *this;
│ │ │ │ +
166 }
│ │ │ │ +
│ │ │ │ +
167
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
170 {
│ │ │ │ +
171 p_ -= y.p_;
│ │ │ │ +
172 return *this;
│ │ │ │ +
173 }
│ │ │ │ +
│ │ │ │ +
174
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
177 {
│ │ │ │ +
178 p_ += k;
│ │ │ │ +
179 return *this;
│ │ │ │ +
180 }
│ │ │ │ +
│ │ │ │ +
181
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
184 {
│ │ │ │ +
185 p_ -= k;
│ │ │ │ +
186 return *this;
│ │ │ │ +
187 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
190 {
│ │ │ │ +
191 p_ *= k;
│ │ │ │ +
192 return *this;
│ │ │ │ +
193 }
│ │ │ │ +
│ │ │ │ +
194
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
197 {
│ │ │ │ +
198 p_ /= k;
│ │ │ │ +
199 return *this;
│ │ │ │ +
200 }
│ │ │ │ +
│ │ │ │ +
201
│ │ │ │ +
202 //===== binary operators
│ │ │ │ +
203
│ │ │ │ +
205 template <class Scalar,
│ │ │ │ +
206 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ │ +
│ │ │ │ +
207 friend auto operator* ( const ScaledIdentityMatrix& matrix, Scalar scalar)
│ │ │ │ +
208 {
│ │ │ │ + │ │ │ │ +
210 }
│ │ │ │ +
│ │ │ │ +
211
│ │ │ │ +
213 template <class Scalar,
│ │ │ │ +
214 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ │ +
│ │ │ │ +
215 friend auto operator* (Scalar scalar, const ScaledIdentityMatrix& matrix)
│ │ │ │ +
216 {
│ │ │ │ + │ │ │ │ +
218 }
│ │ │ │ +
│ │ │ │ +
219
│ │ │ │ +
220 //===== comparison ops
│ │ │ │ +
221
│ │ │ │ +
│ │ │ │ +
223 bool operator==(const ScaledIdentityMatrix& other) const
│ │ │ │ +
224 {
│ │ │ │ +
225 return p_==other.scalar();
│ │ │ │ +
226 }
│ │ │ │ +
│ │ │ │ +
227
│ │ │ │ +
│ │ │ │ +
229 bool operator!=(const ScaledIdentityMatrix& other) const
│ │ │ │ +
230 {
│ │ │ │ +
231 return p_!=other.scalar();
│ │ │ │ +
232 }
│ │ │ │ +
│ │ │ │ +
233
│ │ │ │ +
234 //===== linear maps
│ │ │ │ +
235
│ │ │ │ +
237 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
238 void mv (const X& x, Y& y) const
│ │ │ │ +
239 {
│ │ │ │ +
240#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
241 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
242 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
243#endif
│ │ │ │ +
244 for (size_type i=0; i<n; ++i)
│ │ │ │ +
245 y[i] = p_ * x[i];
│ │ │ │ +
246 }
│ │ │ │ +
│ │ │ │ +
247
│ │ │ │ +
249 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
250 void mtv (const X& x, Y& y) const
│ │ │ │ +
251 {
│ │ │ │ +
252 mv(x, y);
│ │ │ │ +
253 }
│ │ │ │ +
│ │ │ │ +
254
│ │ │ │ +
256 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
257 void umv (const X& x, Y& y) const
│ │ │ │ +
258 {
│ │ │ │ +
259#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
260 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
261 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
262#endif
│ │ │ │ +
263 for (size_type i=0; i<n; ++i)
│ │ │ │ +
264 y[i] += p_ * x[i];
│ │ │ │ +
265 }
│ │ │ │ +
│ │ │ │
266
│ │ │ │ -
267 template<class F, class Matrix>
│ │ │ │ -
268 void copyToBCCSMatrix(F& initializer, const Matrix& matrix)
│ │ │ │ -
269 {
│ │ │ │ -
270 for (auto row=matrix.begin(); row!= matrix.end(); ++row)
│ │ │ │ -
271 initializer.addRowNnz(row);
│ │ │ │ -
272
│ │ │ │ -
273 initializer.allocate();
│ │ │ │ -
274
│ │ │ │ -
275 for (auto row=matrix.begin(); row!= matrix.end(); ++row) {
│ │ │ │ -
276
│ │ │ │ -
277 for (auto col=row->begin(); col != row->end(); ++col)
│ │ │ │ -
278 initializer.countEntries(row, col);
│ │ │ │ -
279 }
│ │ │ │ -
280
│ │ │ │ -
281 initializer.calcColstart();
│ │ │ │ -
282
│ │ │ │ -
283 for (auto row=matrix.begin(); row!= matrix.end(); ++row) {
│ │ │ │ -
284 for (auto col=row->begin(); col != row->end(); ++col) {
│ │ │ │ -
285 initializer.copyValue(row, col);
│ │ │ │ -
286 }
│ │ │ │ -
287
│ │ │ │ -
288 }
│ │ │ │ -
289 initializer.createMatrix();
│ │ │ │ -
290 }
│ │ │ │ -
291
│ │ │ │ -
292 template<class F, class M,class S>
│ │ │ │ -
293 void copyToBCCSMatrix(F& initializer, const MatrixRowSubset<M,S>& mrs)
│ │ │ │ -
294 {
│ │ │ │ -
295 typedef MatrixRowSubset<M,S> MRS;
│ │ │ │ -
296 typedef typename MRS::RowIndexSet SIS;
│ │ │ │ -
297 typedef typename SIS::const_iterator SIter;
│ │ │ │ -
298 typedef typename MRS::const_iterator Iter;
│ │ │ │ -
299 typedef typename std::iterator_traits<Iter>::value_type row_type;
│ │ │ │ -
300 typedef typename row_type::const_iterator CIter;
│ │ │ │ -
301
│ │ │ │ -
302 typedef typename MRS::Matrix::size_type size_type;
│ │ │ │ -
303
│ │ │ │ -
304 // A vector containing the corresponding indices in
│ │ │ │ -
305 // the to create submatrix.
│ │ │ │ -
306 // If an entry is the maximum of size_type then this index will not appear in
│ │ │ │ -
307 // the submatrix.
│ │ │ │ -
308 std::vector<size_type> subMatrixIndex(mrs.matrix().N(),
│ │ │ │ -
309 std::numeric_limits<size_type>::max());
│ │ │ │ -
310 size_type s=0;
│ │ │ │ -
311 for(SIter index = mrs.rowIndexSet().begin(); index!=mrs.rowIndexSet().end(); ++index)
│ │ │ │ -
312 subMatrixIndex[*index]=s++;
│ │ │ │ -
313
│ │ │ │ -
314 // Calculate upper Bound for nonzeros
│ │ │ │ -
315 for(Iter row=mrs.begin(); row!= mrs.end(); ++row)
│ │ │ │ -
316 initializer.addRowNnz(row, subMatrixIndex);
│ │ │ │ -
317
│ │ │ │ -
318 initializer.allocate();
│ │ │ │ -
319
│ │ │ │ -
320 for(Iter row=mrs.begin(); row!= mrs.end(); ++row)
│ │ │ │ -
321 for(CIter col=row->begin(); col != row->end(); ++col) {
│ │ │ │ -
322 if(subMatrixIndex[col.index()]!=std::numeric_limits<size_type>::max())
│ │ │ │ -
323 // This column is in our subset (use submatrix column index)
│ │ │ │ -
324 initializer.countEntries(subMatrixIndex[col.index()]);
│ │ │ │ -
325 }
│ │ │ │ +
268 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
269 void umtv (const X& x, Y& y) const
│ │ │ │ +
270 {
│ │ │ │ +
271#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
272 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
273 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
274#endif
│ │ │ │ +
275 for (size_type i=0; i<n; ++i)
│ │ │ │ +
276 y[i] += p_ * x[i];
│ │ │ │ +
277 }
│ │ │ │ +
│ │ │ │ +
278
│ │ │ │ +
280 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
281 void umhv (const X& x, Y& y) const
│ │ │ │ +
282 {
│ │ │ │ +
283#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
284 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
285 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
286#endif
│ │ │ │ +
287 for (size_type i=0; i<n; i++)
│ │ │ │ +
288 y[i] += conjugateComplex(p_)*x[i];
│ │ │ │ +
289 }
│ │ │ │ +
│ │ │ │ +
290
│ │ │ │ +
292 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
293 void mmv (const X& x, Y& y) const
│ │ │ │ +
294 {
│ │ │ │ +
295#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
296 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
297 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
298#endif
│ │ │ │ +
299 for (size_type i=0; i<n; ++i)
│ │ │ │ +
300 y[i] -= p_ * x[i];
│ │ │ │ +
301 }
│ │ │ │ +
│ │ │ │ +
302
│ │ │ │ +
304 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
305 void mmtv (const X& x, Y& y) const
│ │ │ │ +
306 {
│ │ │ │ +
307#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
308 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
309 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
310#endif
│ │ │ │ +
311 for (size_type i=0; i<n; ++i)
│ │ │ │ +
312 y[i] -= p_ * x[i];
│ │ │ │ +
313 }
│ │ │ │ +
│ │ │ │ +
314
│ │ │ │ +
316 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
317 void mmhv (const X& x, Y& y) const
│ │ │ │ +
318 {
│ │ │ │ +
319#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
320 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
321 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
322#endif
│ │ │ │ +
323 for (size_type i=0; i<n; i++)
│ │ │ │ +
324 y[i] -= conjugateComplex(p_)*x[i];
│ │ │ │ +
325 }
│ │ │ │ +
│ │ │ │
326
│ │ │ │ -
327 initializer.calcColstart();
│ │ │ │ -
328
│ │ │ │ -
329 for(Iter row=mrs.begin(); row!= mrs.end(); ++row)
│ │ │ │ -
330 for(CIter col=row->begin(); col != row->end(); ++col) {
│ │ │ │ -
331 if(subMatrixIndex[col.index()]!=std::numeric_limits<size_type>::max())
│ │ │ │ -
332 // This value is in our submatrix -> copy (use submatrix indices
│ │ │ │ -
333 initializer.copyValue(col, subMatrixIndex[row.index()], subMatrixIndex[col.index()]);
│ │ │ │ -
334 }
│ │ │ │ -
335 initializer.createMatrix();
│ │ │ │ -
336 }
│ │ │ │ -
337
│ │ │ │ -
338}
│ │ │ │ -
339#endif
│ │ │ │ - │ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ -
std::size_t countEntries(const BlockVector< T, A > &vector)
Definition matrixmarket.hh:1076
│ │ │ │ +
328 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
329 void usmv (const K& alpha, const X& x, Y& y) const
│ │ │ │ +
330 {
│ │ │ │ +
331#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
332 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
333 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
334#endif
│ │ │ │ +
335 for (size_type i=0; i<n; i++)
│ │ │ │ +
336 y[i] += alpha * p_ * x[i];
│ │ │ │ +
337 }
│ │ │ │ +
│ │ │ │ +
338
│ │ │ │ +
340 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
341 void usmtv (const K& alpha, const X& x, Y& y) const
│ │ │ │ +
342 {
│ │ │ │ +
343#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
344 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
345 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
346#endif
│ │ │ │ +
347 for (size_type i=0; i<n; i++)
│ │ │ │ +
348 y[i] += alpha * p_ * x[i];
│ │ │ │ +
349 }
│ │ │ │ +
│ │ │ │ +
350
│ │ │ │ +
352 template<class X, class Y>
│ │ │ │ +
│ │ │ │ +
353 void usmhv (const K& alpha, const X& x, Y& y) const
│ │ │ │ +
354 {
│ │ │ │ +
355#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
356 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
357 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ │ +
358#endif
│ │ │ │ +
359 for (size_type i=0; i<n; i++)
│ │ │ │ +
360 y[i] += alpha * conjugateComplex(p_) * x[i];
│ │ │ │ +
361 }
│ │ │ │ +
│ │ │ │ +
362
│ │ │ │ +
363 //===== norms
│ │ │ │ +
364
│ │ │ │ +
│ │ │ │ +
366 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ │ +
367 {
│ │ │ │ +
368 return fvmeta::sqrt(n*p_*p_);
│ │ │ │ +
369 }
│ │ │ │ +
│ │ │ │ +
370
│ │ │ │ +
│ │ │ │ +
372 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ │ +
373 {
│ │ │ │ +
374 return n*p_*p_;
│ │ │ │ +
375 }
│ │ │ │ +
│ │ │ │ +
376
│ │ │ │ +
│ │ │ │ +
378 typename FieldTraits<field_type>::real_type infinity_norm () const
│ │ │ │ +
379 {
│ │ │ │ +
380 return std::abs(p_);
│ │ │ │ +
381 }
│ │ │ │ +
│ │ │ │ +
382
│ │ │ │ +
│ │ │ │ +
384 typename FieldTraits<field_type>::real_type infinity_norm_real () const
│ │ │ │ +
385 {
│ │ │ │ +
386 return fvmeta::absreal(p_);
│ │ │ │ +
387 }
│ │ │ │ +
│ │ │ │ +
388
│ │ │ │ +
389 //===== solve
│ │ │ │ +
390
│ │ │ │ +
393 template<class V>
│ │ │ │ +
│ │ │ │ +
394 void solve (V& x, const V& b) const
│ │ │ │ +
395 {
│ │ │ │ +
396 for (int i=0; i<n; i++)
│ │ │ │ +
397 x[i] = b[i]/p_;
│ │ │ │ +
398 }
│ │ │ │ +
│ │ │ │ +
399
│ │ │ │ +
│ │ │ │ +
402 void invert()
│ │ │ │ +
403 {
│ │ │ │ +
404 p_ = 1/p_;
│ │ │ │ +
405 }
│ │ │ │ +
│ │ │ │ +
406
│ │ │ │ +
│ │ │ │ +
408 K determinant () const {
│ │ │ │ +
409 return std::pow(p_,n);
│ │ │ │ +
410 }
│ │ │ │ +
│ │ │ │ +
411
│ │ │ │ +
412 //===== sizes
│ │ │ │ +
413
│ │ │ │ +
│ │ │ │ +
415 size_type N () const
│ │ │ │ +
416 {
│ │ │ │ +
417 return n;
│ │ │ │ +
418 }
│ │ │ │ +
│ │ │ │ +
419
│ │ │ │ +
│ │ │ │ +
421 size_type M () const
│ │ │ │ +
422 {
│ │ │ │ +
423 return n;
│ │ │ │ +
424 }
│ │ │ │ +
│ │ │ │ +
425
│ │ │ │ +
426 //===== query
│ │ │ │ +
427
│ │ │ │ +
│ │ │ │ +
429 bool exists (size_type i, size_type j) const
│ │ │ │ +
430 {
│ │ │ │ +
431#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ │ +
432 if (i<0 || i>=n) DUNE_THROW(FMatrixError,"row index out of range");
│ │ │ │ +
433 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range");
│ │ │ │ +
434#endif
│ │ │ │ +
435 return i==j;
│ │ │ │ +
436 }
│ │ │ │ +
│ │ │ │ +
437
│ │ │ │ +
438 //===== conversion operator
│ │ │ │ +
439
│ │ │ │ +
│ │ │ │ +
441 friend std::ostream& operator<< (std::ostream& s, const ScaledIdentityMatrix<K,n>& a)
│ │ │ │ +
442 {
│ │ │ │ +
443 for (size_type i=0; i<n; i++) {
│ │ │ │ +
444 for (size_type j=0; j<n; j++)
│ │ │ │ +
445 s << ((i==j) ? a.p_ : 0) << " ";
│ │ │ │ +
446 s << std::endl;
│ │ │ │ +
447 }
│ │ │ │ +
448 return s;
│ │ │ │ +
449 }
│ │ │ │ +
│ │ │ │ +
450
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
453 {
│ │ │ │ +
454 return reference(const_cast<K*>(&p_), i);
│ │ │ │ +
455 }
│ │ │ │ +
│ │ │ │ +
456
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
459 {
│ │ │ │ +
460 return const_reference(const_cast<K*>(&p_), i);
│ │ │ │ +
461 }
│ │ │ │ +
│ │ │ │ +
462
│ │ │ │ +
│ │ │ │ +
464 const K& diagonal(size_type /*i*/) const
│ │ │ │ +
465 {
│ │ │ │ +
466 return p_;
│ │ │ │ +
467 }
│ │ │ │ +
│ │ │ │ +
468
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
471 {
│ │ │ │ +
472 return p_;
│ │ │ │ +
473 }
│ │ │ │ +
│ │ │ │ +
474
│ │ │ │ +
│ │ │ │ +
477 const K& scalar() const
│ │ │ │ +
478 {
│ │ │ │ +
479 return p_;
│ │ │ │ +
480 }
│ │ │ │ +
│ │ │ │ +
481
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
485 {
│ │ │ │ +
486 return p_;
│ │ │ │ +
487 }
│ │ │ │ +
│ │ │ │ +
488
│ │ │ │ +
489 private:
│ │ │ │ +
490 // the data, very simply a single number
│ │ │ │ +
491 K p_;
│ │ │ │ +
492
│ │ │ │ +
493 };
│ │ │ │ +
│ │ │ │ +
494
│ │ │ │ +
495 template <class DenseMatrix, class field, int N>
│ │ │ │ +
│ │ │ │ +
496 struct DenseMatrixAssigner<DenseMatrix, ScaledIdentityMatrix<field, N>> {
│ │ │ │ +
│ │ │ │ +
497 static void apply(DenseMatrix& denseMatrix,
│ │ │ │ + │ │ │ │ +
499 assert(denseMatrix.M() == N);
│ │ │ │ +
500 assert(denseMatrix.N() == N);
│ │ │ │ +
501 denseMatrix = field(0);
│ │ │ │ +
502 for (int i = 0; i < N; ++i)
│ │ │ │ +
503 denseMatrix[i][i] = rhs.scalar();
│ │ │ │ +
504 }
│ │ │ │ +
│ │ │ │ +
505 };
│ │ │ │ +
│ │ │ │ +
506
│ │ │ │ +
507 template<class K, int n>
│ │ │ │ +
│ │ │ │ +
508 struct FieldTraits< ScaledIdentityMatrix<K, n> >
│ │ │ │ +
509 {
│ │ │ │ + │ │ │ │ +
511 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ │ +
512 };
│ │ │ │ +
│ │ │ │ +
513
│ │ │ │ +
514} // end namespace
│ │ │ │ +
515
│ │ │ │ +
516#endif
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
Initializer for SuperLU Matrices representing the subdomains.
Definition overlappingschwarz.hh:47
│ │ │ │ -
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
│ │ │ │ +
A multiple of the identity matrix of static size.
Definition scaledidmatrix.hh:30
│ │ │ │ +
void usmhv(const K &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition scaledidmatrix.hh:353
│ │ │ │ +
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition scaledidmatrix.hh:305
│ │ │ │ +
ScaledIdentityMatrix & operator-=(const ScaledIdentityMatrix &y)
vector space subtraction
Definition scaledidmatrix.hh:169
│ │ │ │ +
const_row_type::ConstIterator ConstColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:131
│ │ │ │ +
ConstIterator end() const
end iterator
Definition scaledidmatrix.hh:140
│ │ │ │ +
Iterator beforeBegin()
Definition scaledidmatrix.hh:118
│ │ │ │ +
bool operator!=(const ScaledIdentityMatrix &other) const
incomparison operator
Definition scaledidmatrix.hh:229
│ │ │ │ +
void mmv(const X &x, Y &y) const
y -= A x
Definition scaledidmatrix.hh:293
│ │ │ │ +
std::size_t size_type
The type used for the index access and size operations.
Definition scaledidmatrix.hh:43
│ │ │ │ +
void usmv(const K &alpha, const X &x, Y &y) const
y += alpha A x
Definition scaledidmatrix.hh:329
│ │ │ │ +
row_type::Iterator ColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:95
│ │ │ │ +
const_row_type const_reference
Definition scaledidmatrix.hh:53
│ │ │ │ +
void mv(const X &x, Y &y) const
y = A x
Definition scaledidmatrix.hh:238
│ │ │ │ +
void umtv(const X &x, Y &y) const
y += A^T x
Definition scaledidmatrix.hh:269
│ │ │ │ +
void umhv(const X &x, Y &y) const
y += A^H x
Definition scaledidmatrix.hh:281
│ │ │ │ +
DiagonalRowVector< K, n > row_type
Each row is implemented by a field vector.
Definition scaledidmatrix.hh:50
│ │ │ │ +
ContainerWrapperIterator< const WrapperType, reference, reference > Iterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:89
│ │ │ │ +
Iterator beforeEnd()
Definition scaledidmatrix.hh:111
│ │ │ │ +
K determinant() const
calculates the determinant of this matrix
Definition scaledidmatrix.hh:408
│ │ │ │ +
K field_type
export the type representing the field
Definition scaledidmatrix.hh:37
│ │ │ │ +
void usmtv(const K &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition scaledidmatrix.hh:341
│ │ │ │ +
Iterator end()
end iterator
Definition scaledidmatrix.hh:104
│ │ │ │ +
Iterator iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:91
│ │ │ │ +
const K & scalar() const
Get const reference to the scalar diagonal value.
Definition scaledidmatrix.hh:477
│ │ │ │ +
void umv(const X &x, Y &y) const
y += A x
Definition scaledidmatrix.hh:257
│ │ │ │ +
static constexpr std::size_t blocklevel
We are at the leaf of the block recursion.
Definition scaledidmatrix.hh:47
│ │ │ │ +
const K & diagonal(size_type) const
Get const reference to diagonal entry.
Definition scaledidmatrix.hh:464
│ │ │ │ +
@ rows
The number of rows.
Definition scaledidmatrix.hh:58
│ │ │ │ +
@ cols
The number of columns.
Definition scaledidmatrix.hh:60
│ │ │ │ +
ScaledIdentityMatrix & operator=(const K &k)
Definition scaledidmatrix.hh:75
│ │ │ │ +
ContainerWrapperIterator< const WrapperType, const_reference, const_reference > ConstIterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:125
│ │ │ │ +
K & diagonal(size_type)
Get reference to diagonal entry.
Definition scaledidmatrix.hh:470
│ │ │ │ +
void solve(V &x, const V &b) const
Solve system A x = b.
Definition scaledidmatrix.hh:394
│ │ │ │ +
bool exists(size_type i, size_type j) const
return true when (i,j) is in pattern
Definition scaledidmatrix.hh:429
│ │ │ │ +
Iterator RowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:93
│ │ │ │ +
ConstIterator const_iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:127
│ │ │ │ +
ScaledIdentityMatrix()
Default constructor.
Definition scaledidmatrix.hh:66
│ │ │ │ +
bool operator==(const ScaledIdentityMatrix &other) const
comparison operator
Definition scaledidmatrix.hh:223
│ │ │ │ +
ConstIterator beforeBegin() const
Definition scaledidmatrix.hh:154
│ │ │ │ +
ScaledIdentityMatrix & operator/=(const K &k)
vector space division by scalar
Definition scaledidmatrix.hh:196
│ │ │ │ +
friend std::ostream & operator<<(std::ostream &s, const ScaledIdentityMatrix< K, n > &a)
Sends the matrix to an output stream.
Definition scaledidmatrix.hh:441
│ │ │ │ +
FieldTraits< field_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition scaledidmatrix.hh:372
│ │ │ │ +
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition scaledidmatrix.hh:366
│ │ │ │ +
FieldTraits< field_type >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition scaledidmatrix.hh:378
│ │ │ │ +
ConstIterator ConstRowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:129
│ │ │ │ +
ConstIterator beforeEnd() const
Definition scaledidmatrix.hh:147
│ │ │ │ +
size_type M() const
number of blocks in column direction
Definition scaledidmatrix.hh:421
│ │ │ │ +
const_reference operator[](size_type i) const
Return const_reference object as row replacement.
Definition scaledidmatrix.hh:458
│ │ │ │ +
ScaledIdentityMatrix(const K &k)
Constructor initializing the whole matrix with a scalar.
Definition scaledidmatrix.hh:70
│ │ │ │ +
friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar)
vector space multiplication with scalar
Definition scaledidmatrix.hh:207
│ │ │ │ +
FieldTraits< field_type >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition scaledidmatrix.hh:384
│ │ │ │ +
ScaledIdentityMatrix & operator*=(const K &k)
vector space multiplication with scalar
Definition scaledidmatrix.hh:189
│ │ │ │ +
bool identical(const ScaledIdentityMatrix< K, n > &other) const
Definition scaledidmatrix.hh:82
│ │ │ │ +
void invert()
Compute inverse.
Definition scaledidmatrix.hh:402
│ │ │ │ +
Iterator begin()
begin iterator
Definition scaledidmatrix.hh:98
│ │ │ │ +
K & scalar()
Get reference to the scalar diagonal value.
Definition scaledidmatrix.hh:484
│ │ │ │ +
row_type reference
Definition scaledidmatrix.hh:51
│ │ │ │ +
K block_type
export the type representing the components
Definition scaledidmatrix.hh:40
│ │ │ │ +
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition scaledidmatrix.hh:317
│ │ │ │ +
ScaledIdentityMatrix & operator+=(const ScaledIdentityMatrix &y)
vector space addition
Definition scaledidmatrix.hh:162
│ │ │ │ +
DiagonalRowVectorConst< K, n > const_row_type
Definition scaledidmatrix.hh:52
│ │ │ │ +
void mtv(const X &x, Y &y) const
y = A^T x
Definition scaledidmatrix.hh:250
│ │ │ │ +
reference operator[](size_type i)
Return reference object as row replacement.
Definition scaledidmatrix.hh:452
│ │ │ │ +
ConstIterator begin() const
begin iterator
Definition scaledidmatrix.hh:134
│ │ │ │ +
size_type N() const
number of blocks in row direction
Definition scaledidmatrix.hh:415
│ │ │ │ +
static void apply(DenseMatrix &denseMatrix, ScaledIdentityMatrix< field, N > const &rhs)
Definition scaledidmatrix.hh:497
│ │ │ │ +
typename ScaledIdentityMatrix< K, n >::field_type field_type
Definition scaledidmatrix.hh:510
│ │ │ │ +
typename FieldTraits< field_type >::real_type real_type
Definition scaledidmatrix.hh:511
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,353 +1,718 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -bccsmatrixinitializer.hh │ │ │ │ │ +scaledidmatrix.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 (C) 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_BCCSMATRIX_INITIALIZER_HH │ │ │ │ │ -6#define DUNE_ISTL_BCCSMATRIX_INITIALIZER_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_SCALEDIDMATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_SCALEDIDMATRIX_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_._h_h> │ │ │ │ │ -15 │ │ │ │ │ -16namespace _D_u_n_e │ │ │ │ │ -17{ │ │ │ │ │ -18 template │ │ │ │ │ -19 class OverlappingSchwarzInitializer; │ │ │ │ │ -20} │ │ │ │ │ -21 │ │ │ │ │ -22namespace Dune::ISTL::Impl │ │ │ │ │ -23{ │ │ │ │ │ -31 template │ │ │ │ │ -32 class MatrixRowSubset │ │ │ │ │ -33 { │ │ │ │ │ -34 public: │ │ │ │ │ -36 typedef M Matrix; │ │ │ │ │ -38 typedef S RowIndexSet; │ │ │ │ │ -39 │ │ │ │ │ -45 MatrixRowSubset(const Matrix& m, const RowIndexSet& s) │ │ │ │ │ -46 : m_(m), s_(s) │ │ │ │ │ -47 {} │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22 │ │ │ │ │ +23namespace _D_u_n_e { │ │ │ │ │ +24 │ │ │ │ │ +28 template │ │ │ │ │ +_2_9 class _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ │ +30 { │ │ │ │ │ +31 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix > WrapperType; │ │ │ │ │ +32 │ │ │ │ │ +33 public: │ │ │ │ │ +34 //===== type definitions and constants │ │ │ │ │ +35 │ │ │ │ │ +_3_7 typedef K _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +38 │ │ │ │ │ +_4_0 typedef K _b_l_o_c_k___t_y_p_e; │ │ │ │ │ +41 │ │ │ │ │ +_4_3 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ │ +44 │ │ │ │ │ +46 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]] │ │ │ │ │ +_4_7 static constexpr std::size_t _b_l_o_c_k_l_e_v_e_l = 1; │ │ │ │ │ 48 │ │ │ │ │ -49 const Matrix& matrix() const │ │ │ │ │ -50 { │ │ │ │ │ -51 return m_; │ │ │ │ │ -52 } │ │ │ │ │ -53 │ │ │ │ │ -54 const RowIndexSet& rowIndexSet() const │ │ │ │ │ -55 { │ │ │ │ │ -56 return s_; │ │ │ │ │ -57 } │ │ │ │ │ -58 │ │ │ │ │ -60 class const_iterator │ │ │ │ │ -61 : public ForwardIteratorFacade │ │ │ │ │ -62 { │ │ │ │ │ -63 public: │ │ │ │ │ -64 const_iterator(typename Matrix::const_iterator firstRow, │ │ │ │ │ -65 typename RowIndexSet::const_iterator pos) │ │ │ │ │ -66 : firstRow_(firstRow), pos_(pos) │ │ │ │ │ -67 {} │ │ │ │ │ -68 │ │ │ │ │ -69 │ │ │ │ │ -70 const typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e& dereference() const │ │ │ │ │ -71 { │ │ │ │ │ -72 return *(firstRow_+ *pos_); │ │ │ │ │ -73 } │ │ │ │ │ -74 bool equals(const const_iterator& o) const │ │ │ │ │ -75 { │ │ │ │ │ -76 return pos_==o.pos_; │ │ │ │ │ -77 } │ │ │ │ │ -78 void increment() │ │ │ │ │ -79 { │ │ │ │ │ -80 ++pos_; │ │ │ │ │ -81 } │ │ │ │ │ -82 typename RowIndexSet::value_type index() const │ │ │ │ │ +_5_0 typedef DiagonalRowVector _r_o_w___t_y_p_e; │ │ │ │ │ +_5_1 typedef _r_o_w___t_y_p_e _r_e_f_e_r_e_n_c_e; │ │ │ │ │ +_5_2 typedef DiagonalRowVectorConst _c_o_n_s_t___r_o_w___t_y_p_e; │ │ │ │ │ +_5_3 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; │ │ │ │ │ +54 │ │ │ │ │ +56 enum { │ │ │ │ │ +_5_8 _r_o_w_s = n, │ │ │ │ │ +60 _c_o_l_s = n │ │ │ │ │ +_6_1 }; │ │ │ │ │ +62 │ │ │ │ │ +63 //===== constructors │ │ │ │ │ +_6_6 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x () {} │ │ │ │ │ +67 │ │ │ │ │ +_7_0 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x (const K& k) │ │ │ │ │ +71 : p_(k) │ │ │ │ │ +72 {} │ │ │ │ │ +73 │ │ │ │ │ +74 //===== assignment from scalar │ │ │ │ │ +_7_5 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const K& k) │ │ │ │ │ +76 { │ │ │ │ │ +77 p_ = k; │ │ │ │ │ +78 return *this; │ │ │ │ │ +79 } │ │ │ │ │ +80 │ │ │ │ │ +81 // check if matrix is identical to other matrix (not only identical values) │ │ │ │ │ +_8_2 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 │ │ │ │ │ 83 { │ │ │ │ │ -84 return *pos_; │ │ │ │ │ +84 return (this==&other); │ │ │ │ │ 85 } │ │ │ │ │ 86 │ │ │ │ │ -87 private: │ │ │ │ │ -89 typename Matrix::const_iterator firstRow_; │ │ │ │ │ -91 typename RowIndexSet::const_iterator pos_; │ │ │ │ │ -92 }; │ │ │ │ │ -93 │ │ │ │ │ -95 const_iterator begin() const │ │ │ │ │ -96 { │ │ │ │ │ -97 return const_iterator(m_.begin(), s_.begin()); │ │ │ │ │ -98 } │ │ │ │ │ -100 const_iterator end() const │ │ │ │ │ -101 { │ │ │ │ │ -102 return const_iterator(m_.begin(), s_.end()); │ │ │ │ │ -103 } │ │ │ │ │ -104 │ │ │ │ │ -105 private: │ │ │ │ │ -107 const Matrix& m_; │ │ │ │ │ -109 const RowIndexSet& s_; │ │ │ │ │ -110 }; │ │ │ │ │ -111 │ │ │ │ │ -118 template │ │ │ │ │ -119 class BCCSMatrixInitializer │ │ │ │ │ -120 { │ │ │ │ │ -121 template │ │ │ │ │ -122 friend class _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ │ -123 public: │ │ │ │ │ -124 using Matrix = M; │ │ │ │ │ -125 using Index = I; │ │ │ │ │ -126 typedef Dune::ISTL::Impl::BCCSMatrix │ │ │ │ │ -OutputMatrix; │ │ │ │ │ -127 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ -128 │ │ │ │ │ -131 BCCSMatrixInitializer(OutputMatrix& mat_) │ │ │ │ │ -132 : _m_a_t(&mat_), cols(mat_.M()) │ │ │ │ │ -133 { │ │ │ │ │ -134 if constexpr (Dune::IsNumber::value) │ │ │ │ │ +87 //===== iterator interface to rows of the matrix │ │ │ │ │ +_8_9 typedef ContainerWrapperIterator │ │ │ │ │ +_I_t_e_r_a_t_o_r; │ │ │ │ │ +_9_1 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ │ +_9_3 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ │ +_9_5 typedef typename row_type::Iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +96 │ │ │ │ │ +_9_8 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ │ +99 { │ │ │ │ │ +100 return _I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ │ +101 } │ │ │ │ │ +102 │ │ │ │ │ +_1_0_4 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ │ +105 { │ │ │ │ │ +106 return _I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ │ +107 } │ │ │ │ │ +108 │ │ │ │ │ +_1_1_1 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ │ +112 { │ │ │ │ │ +113 return _I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ │ +114 } │ │ │ │ │ +115 │ │ │ │ │ +_1_1_8 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ │ +119 { │ │ │ │ │ +120 return _I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ │ +121 } │ │ │ │ │ +122 │ │ │ │ │ +123 │ │ │ │ │ +_1_2_5 typedef ContainerWrapperIterator _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +_1_2_7 typedef _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ │ +_1_2_9 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_3_1 typedef typename const_row_type::ConstIterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ │ +132 │ │ │ │ │ +_1_3_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ │ 135 { │ │ │ │ │ -136 n = m = 1; │ │ │ │ │ +136 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ │ 137 } │ │ │ │ │ -138 else │ │ │ │ │ -139 { │ │ │ │ │ -140 // WARNING: This assumes that all blocks are dense and identical │ │ │ │ │ -141 n = M::block_type::rows; │ │ │ │ │ -142 m = M::block_type::cols; │ │ │ │ │ +138 │ │ │ │ │ +_1_4_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ │ +141 { │ │ │ │ │ +142 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ │ 143 } │ │ │ │ │ 144 │ │ │ │ │ -145 _m_a_t->Nnz_=0; │ │ │ │ │ -146 } │ │ │ │ │ -147 │ │ │ │ │ -148 BCCSMatrixInitializer() │ │ │ │ │ -149 : _m_a_t(0), cols(0), n(0), m(0) │ │ │ │ │ -150 {} │ │ │ │ │ +_1_4_7 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ │ +148 { │ │ │ │ │ +149 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ │ +150 } │ │ │ │ │ 151 │ │ │ │ │ -152 virtual ~BCCSMatrixInitializer() │ │ │ │ │ -153 {} │ │ │ │ │ -154 │ │ │ │ │ -155 template │ │ │ │ │ -156 void addRowNnz(const Iter& row) const │ │ │ │ │ -157 { │ │ │ │ │ -158 _m_a_t->Nnz_+=row->getsize(); │ │ │ │ │ -159 } │ │ │ │ │ +_1_5_4 _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 │ │ │ │ │ +155 { │ │ │ │ │ +156 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ │ +157 } │ │ │ │ │ +158 │ │ │ │ │ +159 //===== vector space arithmetic │ │ │ │ │ 160 │ │ │ │ │ -161 template │ │ │ │ │ -162 void addRowNnz(const Iter& row, const std::set& indices) │ │ │ │ │ -const │ │ │ │ │ +_1_6_2 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& y) │ │ │ │ │ 163 { │ │ │ │ │ -164 auto siter =indices.begin(); │ │ │ │ │ -165 for (auto entry=row->begin(); entry!=row->end(); ++entry) │ │ │ │ │ -166 { │ │ │ │ │ -167 for(; siter!=indices.end() && *siterNnz_; │ │ │ │ │ +164 p_ += y.p_; │ │ │ │ │ +165 return *this; │ │ │ │ │ +166 } │ │ │ │ │ +167 │ │ │ │ │ +_1_6_9 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& y) │ │ │ │ │ +170 { │ │ │ │ │ +171 p_ -= y.p_; │ │ │ │ │ +172 return *this; │ │ │ │ │ 173 } │ │ │ │ │ -174 } │ │ │ │ │ -175 │ │ │ │ │ -176 template │ │ │ │ │ -177 void addRowNnz(const Iter& row, const std::vector& indices) │ │ │ │ │ -const │ │ │ │ │ -178 { │ │ │ │ │ -179 for (auto entry=row->begin(); entry!=row->end(); ++entry) │ │ │ │ │ -180 if (indices[entry.index()]!=std::numeric_limits::max()) │ │ │ │ │ -181 ++_m_a_t->Nnz_; │ │ │ │ │ -182 } │ │ │ │ │ -183 │ │ │ │ │ -184 void allocate() │ │ │ │ │ -185 { │ │ │ │ │ -186 allocateMatrixStorage(); │ │ │ │ │ -187 allocateMarker(); │ │ │ │ │ -188 } │ │ │ │ │ -189 │ │ │ │ │ -190 template │ │ │ │ │ -191 void _c_o_u_n_t_E_n_t_r_i_e_s([[maybe_unused]] const Iter& row, const CIter& _c_o_l) const │ │ │ │ │ -192 { │ │ │ │ │ -193 _c_o_u_n_t_E_n_t_r_i_e_s(_c_o_l.index()); │ │ │ │ │ -194 } │ │ │ │ │ -195 │ │ │ │ │ -196 void _c_o_u_n_t_E_n_t_r_i_e_s(size_type colindex) const │ │ │ │ │ +174 │ │ │ │ │ +_1_7_6 _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) │ │ │ │ │ +177 { │ │ │ │ │ +178 p_ += k; │ │ │ │ │ +179 return *this; │ │ │ │ │ +180 } │ │ │ │ │ +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 K& k) │ │ │ │ │ +184 { │ │ │ │ │ +185 p_ -= k; │ │ │ │ │ +186 return *this; │ │ │ │ │ +187 } │ │ │ │ │ +_1_8_9 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const K& k) │ │ │ │ │ +190 { │ │ │ │ │ +191 p_ *= k; │ │ │ │ │ +192 return *this; │ │ │ │ │ +193 } │ │ │ │ │ +194 │ │ │ │ │ +_1_9_6 _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) │ │ │ │ │ 197 { │ │ │ │ │ -198 for(size_type i=0; i < m; ++i) │ │ │ │ │ -199 { │ │ │ │ │ -200 assert(colindex*m+icolstart[0]=0; │ │ │ │ │ -208 for(size_type i=0; i < cols; ++i) { │ │ │ │ │ -209 assert(icolstart[i+1]=_m_a_t->colstart[i]+marker[i]; │ │ │ │ │ -211 marker[i]=_m_a_t->colstart[i]; │ │ │ │ │ -212 } │ │ │ │ │ -213 } │ │ │ │ │ -214 │ │ │ │ │ -215 template │ │ │ │ │ -216 void copyValue(const Iter& row, const CIter& _c_o_l) const │ │ │ │ │ -217 { │ │ │ │ │ -218 copyValue(_c_o_l, row.index(), _c_o_l.index()); │ │ │ │ │ -219 } │ │ │ │ │ -220 │ │ │ │ │ -221 template │ │ │ │ │ -222 void copyValue(const CIter& _c_o_l, size_type rowindex, size_type colindex) │ │ │ │ │ -const │ │ │ │ │ -223 { │ │ │ │ │ -224 for(size_type i=0; icolstart[colindex*m+j+1]); │ │ │ │ │ -227 assert((size_type)marker[colindex*m+j]<_m_a_t->Nnz_); │ │ │ │ │ -228 _m_a_t->rowindex[marker[colindex*m+j]]=rowindex*n+i; │ │ │ │ │ -229 _m_a_t->values[marker[colindex*m+j]] = Dune::Impl::asMatrix(*_c_o_l)[i][j]; │ │ │ │ │ -230 ++marker[colindex*m+j]; // index for next entry in column │ │ │ │ │ -231 } │ │ │ │ │ +198 p_ /= k; │ │ │ │ │ +199 return *this; │ │ │ │ │ +200 } │ │ │ │ │ +201 │ │ │ │ │ +202 //===== binary operators │ │ │ │ │ +203 │ │ │ │ │ +205 template ::value, int> = 0> │ │ │ │ │ +_2_0_7 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) │ │ │ │ │ +208 { │ │ │ │ │ +209 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}; │ │ │ │ │ +210 } │ │ │ │ │ +211 │ │ │ │ │ +213 template ::value, int> = 0> │ │ │ │ │ +_2_1_5 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) │ │ │ │ │ +216 { │ │ │ │ │ +217 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()}; │ │ │ │ │ +218 } │ │ │ │ │ +219 │ │ │ │ │ +220 //===== comparison ops │ │ │ │ │ +221 │ │ │ │ │ +_2_2_3 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 │ │ │ │ │ +224 { │ │ │ │ │ +225 return p_==other._s_c_a_l_a_r(); │ │ │ │ │ +226 } │ │ │ │ │ +227 │ │ │ │ │ +_2_2_9 bool _o_p_e_r_a_t_o_r_!_=(const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& other) const │ │ │ │ │ +230 { │ │ │ │ │ +231 return p_!=other._s_c_a_l_a_r(); │ │ │ │ │ 232 } │ │ │ │ │ -233 } │ │ │ │ │ -234 │ │ │ │ │ -235 virtual void createMatrix() const │ │ │ │ │ -236 { │ │ │ │ │ -237 marker.clear(); │ │ │ │ │ -238 } │ │ │ │ │ -239 │ │ │ │ │ -240 protected: │ │ │ │ │ -241 │ │ │ │ │ -242 void allocateMatrixStorage() const │ │ │ │ │ -243 { │ │ │ │ │ -244 _m_a_t->Nnz_*=n*m; │ │ │ │ │ -245 // initialize data │ │ │ │ │ -246 _m_a_t->values=new typename M::field_type[_m_a_t->Nnz_]; │ │ │ │ │ -247 _m_a_t->rowindex=new I[_m_a_t->Nnz_]; │ │ │ │ │ -248 _m_a_t->colstart=new I[cols+1]; │ │ │ │ │ -249 } │ │ │ │ │ -250 │ │ │ │ │ -251 void allocateMarker() │ │ │ │ │ -252 { │ │ │ │ │ -253 marker.resize(cols); │ │ │ │ │ -254 std::fill(marker.begin(), marker.end(), 0); │ │ │ │ │ -255 } │ │ │ │ │ -256 │ │ │ │ │ -257 OutputMatrix* _m_a_t; │ │ │ │ │ -258 size_type cols; │ │ │ │ │ -259 │ │ │ │ │ -260 // Number of rows/columns of the matrix entries │ │ │ │ │ -261 // (assumed to be scalars or dense matrices) │ │ │ │ │ -262 size_type n, m; │ │ │ │ │ -263 │ │ │ │ │ -264 mutable std::vector marker; │ │ │ │ │ -265 }; │ │ │ │ │ +233 │ │ │ │ │ +234 //===== linear maps │ │ │ │ │ +235 │ │ │ │ │ +237 template │ │ │ │ │ +_2_3_8 void _m_v (const X& x, Y& y) const │ │ │ │ │ +239 { │ │ │ │ │ +240#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +241 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +242 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +243#endif │ │ │ │ │ +244 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_2_5_0 void _m_t_v (const X& x, Y& y) const │ │ │ │ │ +251 { │ │ │ │ │ +252 _m_v(x, y); │ │ │ │ │ +253 } │ │ │ │ │ +254 │ │ │ │ │ +256 template │ │ │ │ │ +_2_5_7 void _u_m_v (const X& x, Y& y) const │ │ │ │ │ +258 { │ │ │ │ │ +259#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +260 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +261 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +262#endif │ │ │ │ │ +263 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ -268 void copyToBCCSMatrix(F& initializer, const Matrix& matrix) │ │ │ │ │ -269 { │ │ │ │ │ -270 for (auto row=matrix.begin(); row!= matrix.end(); ++row) │ │ │ │ │ -271 initializer.addRowNnz(row); │ │ │ │ │ -272 │ │ │ │ │ -273 initializer.allocate(); │ │ │ │ │ -274 │ │ │ │ │ -275 for (auto row=matrix.begin(); row!= matrix.end(); ++row) { │ │ │ │ │ -276 │ │ │ │ │ -277 for (auto _c_o_l=row->begin(); _c_o_l != row->end(); ++_c_o_l) │ │ │ │ │ -278 initializer.countEntries(row, _c_o_l); │ │ │ │ │ -279 } │ │ │ │ │ -280 │ │ │ │ │ -281 initializer.calcColstart(); │ │ │ │ │ -282 │ │ │ │ │ -283 for (auto row=matrix.begin(); row!= matrix.end(); ++row) { │ │ │ │ │ -284 for (auto _c_o_l=row->begin(); _c_o_l != row->end(); ++_c_o_l) { │ │ │ │ │ -285 initializer.copyValue(row, _c_o_l); │ │ │ │ │ -286 } │ │ │ │ │ -287 │ │ │ │ │ -288 } │ │ │ │ │ -289 initializer.createMatrix(); │ │ │ │ │ -290 } │ │ │ │ │ -291 │ │ │ │ │ -292 template │ │ │ │ │ -293 void copyToBCCSMatrix(F& initializer, const MatrixRowSubset& mrs) │ │ │ │ │ +268 template │ │ │ │ │ +_2_6_9 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ │ +270 { │ │ │ │ │ +271#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +272 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +273 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +274#endif │ │ │ │ │ +275 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_2_8_1 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ │ +282 { │ │ │ │ │ +283#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +284 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +285 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +286#endif │ │ │ │ │ +287 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_2_9_3 void _m_m_v (const X& x, Y& y) const │ │ │ │ │ 294 { │ │ │ │ │ -295 typedef MatrixRowSubset MRS; │ │ │ │ │ -296 typedef typename MRS::RowIndexSet SIS; │ │ │ │ │ -297 typedef typename SIS::const_iterator SIter; │ │ │ │ │ -298 typedef typename MRS::const_iterator Iter; │ │ │ │ │ -299 typedef typename std::iterator_traits::value_type row_type; │ │ │ │ │ -300 typedef typename row_type::const_iterator CIter; │ │ │ │ │ -301 │ │ │ │ │ -302 typedef typename MRS::Matrix::size_type size_type; │ │ │ │ │ -303 │ │ │ │ │ -304 // A vector containing the corresponding indices in │ │ │ │ │ -305 // the to create submatrix. │ │ │ │ │ -306 // If an entry is the maximum of size_type then this index will not appear │ │ │ │ │ -in │ │ │ │ │ -307 // the submatrix. │ │ │ │ │ -308 std::vector subMatrixIndex(mrs.matrix().N(), │ │ │ │ │ -309 std::numeric_limits::max()); │ │ │ │ │ -310 size_type s=0; │ │ │ │ │ -311 for(SIter index = mrs.rowIndexSet().begin(); index!=mrs.rowIndexSet().end │ │ │ │ │ -(); ++index) │ │ │ │ │ -312 subMatrixIndex[*index]=s++; │ │ │ │ │ -313 │ │ │ │ │ -314 // Calculate upper Bound for nonzeros │ │ │ │ │ -315 for(Iter row=mrs.begin(); row!= mrs.end(); ++row) │ │ │ │ │ -316 initializer.addRowNnz(row, subMatrixIndex); │ │ │ │ │ -317 │ │ │ │ │ -318 initializer.allocate(); │ │ │ │ │ -319 │ │ │ │ │ -320 for(Iter row=mrs.begin(); row!= mrs.end(); ++row) │ │ │ │ │ -321 for(CIter _c_o_l=row->begin(); _c_o_l != row->end(); ++_c_o_l) { │ │ │ │ │ -322 if(subMatrixIndex[_c_o_l.index()]!=std::numeric_limits::max()) │ │ │ │ │ -323 // This column is in our subset (use submatrix column index) │ │ │ │ │ -324 initializer.countEntries(subMatrixIndex[_c_o_l.index()]); │ │ │ │ │ +295#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +296 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +297 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +298#endif │ │ │ │ │ +299 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_3_0_5 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ │ +306 { │ │ │ │ │ +307#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +308 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +309 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +310#endif │ │ │ │ │ +311 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_3_1_7 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ │ +318 { │ │ │ │ │ +319#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +320 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +321 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +322#endif │ │ │ │ │ +323 for (_s_i_z_e___t_y_p_e i=0; ibegin(); _c_o_l != row->end(); ++_c_o_l) { │ │ │ │ │ -331 if(subMatrixIndex[_c_o_l.index()]!=std::numeric_limits::max()) │ │ │ │ │ -332 // This value is in our submatrix -> copy (use submatrix indices │ │ │ │ │ -333 initializer.copyValue(_c_o_l, subMatrixIndex[row.index()], subMatrixIndex │ │ │ │ │ -[_c_o_l.index()]); │ │ │ │ │ -334 } │ │ │ │ │ -335 initializer.createMatrix(); │ │ │ │ │ -336 } │ │ │ │ │ -337 │ │ │ │ │ -338} │ │ │ │ │ -339#endif │ │ │ │ │ -_b_c_c_s_m_a_t_r_i_x_._h_h │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ -_m_a_t │ │ │ │ │ -Matrix & mat │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ -_D_u_n_e_:_:_c_o_u_n_t_E_n_t_r_i_e_s │ │ │ │ │ -std::size_t countEntries(const BlockVector< T, A > &vector) │ │ │ │ │ -DDeeffiinniittiioonn matrixmarket.hh:1076 │ │ │ │ │ +328 template │ │ │ │ │ +_3_2_9 void _u_s_m_v (const K& alpha, const X& x, Y& y) const │ │ │ │ │ +330 { │ │ │ │ │ +331#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +332 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +333 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +334#endif │ │ │ │ │ +335 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_3_4_1 void _u_s_m_t_v (const K& alpha, const X& x, Y& y) const │ │ │ │ │ +342 { │ │ │ │ │ +343#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +344 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +345 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +346#endif │ │ │ │ │ +347 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ │ +_3_5_3 void _u_s_m_h_v (const K& alpha, const X& x, Y& y) const │ │ │ │ │ +354 { │ │ │ │ │ +355#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ │ +356 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +357 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ │ +358#endif │ │ │ │ │ +359 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 │ │ │ │ │ +367 { │ │ │ │ │ +368 return fvmeta::sqrt(n*p_*p_); │ │ │ │ │ +369 } │ │ │ │ │ +370 │ │ │ │ │ +_3_7_2 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ │ +373 { │ │ │ │ │ +374 return n*p_*p_; │ │ │ │ │ +375 } │ │ │ │ │ +376 │ │ │ │ │ +_3_7_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m () const │ │ │ │ │ +379 { │ │ │ │ │ +380 return std::abs(p_); │ │ │ │ │ +381 } │ │ │ │ │ +382 │ │ │ │ │ +_3_8_4 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l () const │ │ │ │ │ +385 { │ │ │ │ │ +386 return fvmeta::absreal(p_); │ │ │ │ │ +387 } │ │ │ │ │ +388 │ │ │ │ │ +389 //===== solve │ │ │ │ │ +390 │ │ │ │ │ +393 template │ │ │ │ │ +_3_9_4 void _s_o_l_v_e (V& x, const V& b) const │ │ │ │ │ +395 { │ │ │ │ │ +396 for (int i=0; i=n) DUNE_THROW(FMatrixError,"row index out of range"); │ │ │ │ │ +433 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range"); │ │ │ │ │ +434#endif │ │ │ │ │ +435 return i==j; │ │ │ │ │ +436 } │ │ │ │ │ +437 │ │ │ │ │ +438 //===== conversion operator │ │ │ │ │ +439 │ │ │ │ │ +_4_4_1 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) │ │ │ │ │ +442 { │ │ │ │ │ +443 for (_s_i_z_e___t_y_p_e i=0; i(&p_), i); │ │ │ │ │ +455 } │ │ │ │ │ +456 │ │ │ │ │ +_4_5_8 _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 │ │ │ │ │ +459 { │ │ │ │ │ +460 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(const_cast(&p_), i); │ │ │ │ │ +461 } │ │ │ │ │ +462 │ │ │ │ │ +_4_6_4 const K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) const │ │ │ │ │ +465 { │ │ │ │ │ +466 return p_; │ │ │ │ │ +467 } │ │ │ │ │ +468 │ │ │ │ │ +_4_7_0 K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) │ │ │ │ │ +471 { │ │ │ │ │ +472 return p_; │ │ │ │ │ +473 } │ │ │ │ │ +474 │ │ │ │ │ +_4_7_7 const K& _s_c_a_l_a_r() const │ │ │ │ │ +478 { │ │ │ │ │ +479 return p_; │ │ │ │ │ +480 } │ │ │ │ │ +481 │ │ │ │ │ +_4_8_4 K& _s_c_a_l_a_r() │ │ │ │ │ +485 { │ │ │ │ │ +486 return p_; │ │ │ │ │ +487 } │ │ │ │ │ +488 │ │ │ │ │ +489 private: │ │ │ │ │ +490 // the data, very simply a single number │ │ │ │ │ +491 K p_; │ │ │ │ │ +492 │ │ │ │ │ +493 }; │ │ │ │ │ +494 │ │ │ │ │ +495 template │ │ │ │ │ +_4_9_6 struct DenseMatrixAssigner> { │ │ │ │ │ +_4_9_7 static void _a_p_p_l_y(DenseMatrix& denseMatrix, │ │ │ │ │ +498 _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) { │ │ │ │ │ +499 assert(denseMatrix.M() == N); │ │ │ │ │ +500 assert(denseMatrix.N() == N); │ │ │ │ │ +501 denseMatrix = field(0); │ │ │ │ │ +502 for (int i = 0; i < N; ++i) │ │ │ │ │ +503 denseMatrix[i][i] = rhs._s_c_a_l_a_r(); │ │ │ │ │ +504 } │ │ │ │ │ +505 }; │ │ │ │ │ +506 │ │ │ │ │ +507 template │ │ │ │ │ +_5_0_8 struct FieldTraits< _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x > │ │ │ │ │ +509 { │ │ │ │ │ +_5_1_0 using _f_i_e_l_d___t_y_p_e = typename _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_K_,_ _n_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_5_1_1 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ │ +512 }; │ │ │ │ │ +513 │ │ │ │ │ +514} // end namespace │ │ │ │ │ +515 │ │ │ │ │ +516#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ -Initializer for SuperLU Matrices representing the subdomains. │ │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:47 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_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_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ │ +A multiple of the identity matrix of static size. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ │ +void usmhv(const K &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^H x │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:353 │ │ │ │ │ +_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:305 │ │ │ │ │ +_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:169 │ │ │ │ │ +_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:131 │ │ │ │ │ +_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:140 │ │ │ │ │ +_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:118 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ │ +bool operator!=(const ScaledIdentityMatrix &other) const │ │ │ │ │ +incomparison operator │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:229 │ │ │ │ │ +_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:293 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +std::size_t size_type │ │ │ │ │ +The type used for the index access and size operations. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ │ +void usmv(const K &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A x │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:329 │ │ │ │ │ +_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:95 │ │ │ │ │ +_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:53 │ │ │ │ │ +_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:238 │ │ │ │ │ +_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:269 │ │ │ │ │ +_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:281 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ │ +DiagonalRowVector< K, n > row_type │ │ │ │ │ +Each row is implemented by a field vector. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:50 │ │ │ │ │ +_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:89 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ │ +Iterator beforeEnd() │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:111 │ │ │ │ │ +_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:408 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ +K field_type │ │ │ │ │ +export the type representing the field │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ │ +void usmtv(const K &alpha, const X &x, Y &y) const │ │ │ │ │ +y += alpha A^T x │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:341 │ │ │ │ │ +_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:104 │ │ │ │ │ +_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: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_:_:_s_c_a_l_a_r │ │ │ │ │ +const K & scalar() const │ │ │ │ │ +Get const reference to the scalar diagonal value. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:477 │ │ │ │ │ +_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:257 │ │ │ │ │ +_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_l_e_v_e_l │ │ │ │ │ +static constexpr std::size_t blocklevel │ │ │ │ │ +We are at the leaf of the block recursion. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ +const K & diagonal(size_type) const │ │ │ │ │ +Get const reference to diagonal entry. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:464 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_r_o_w_s │ │ │ │ │ +@ rows │ │ │ │ │ +The number of rows. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_l_s │ │ │ │ │ +@ cols │ │ │ │ │ +The number of columns. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +ScaledIdentityMatrix & operator=(const K &k) │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:75 │ │ │ │ │ +_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:125 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ │ +K & diagonal(size_type) │ │ │ │ │ +Get reference to diagonal entry. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:470 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ │ +void solve(V &x, const V &b) const │ │ │ │ │ +Solve system A x = b. │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:394 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_e_x_i_s_t_s │ │ │ │ │ +bool exists(size_type i, size_type j) const │ │ │ │ │ +return true when (i,j) is in pattern │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:429 │ │ │ │ │ +_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:93 │ │ │ │ │ +_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:127 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_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:66 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ │ +bool operator==(const ScaledIdentityMatrix &other) const │ │ │ │ │ +comparison operator │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:223 │ │ │ │ │ +_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:154 │ │ │ │ │ +_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:196 │ │ │ │ │ +_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:441 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ │ +FieldTraits< field_type >::real_type frobenius_norm2() const │ │ │ │ │ +square of frobenius norm, need for block recursion │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:372 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ │ +FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ │ +frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:366 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ │ +FieldTraits< field_type >::real_type infinity_norm() const │ │ │ │ │ +infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:378 │ │ │ │ │ +_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:129 │ │ │ │ │ +_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:147 │ │ │ │ │ +_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:421 │ │ │ │ │ +_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:458 │ │ │ │ │ +_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: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_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ │ +friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar) │ │ │ │ │ +vector space multiplication with scalar │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:207 │ │ │ │ │ +_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:384 │ │ │ │ │ +_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:189 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_d_e_n_t_i_c_a_l │ │ │ │ │ +bool identical(const ScaledIdentityMatrix< K, n > &other) const │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:82 │ │ │ │ │ +_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:402 │ │ │ │ │ +_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:98 │ │ │ │ │ +_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:484 │ │ │ │ │ +_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:51 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ │ +K block_type │ │ │ │ │ +export the type representing the components │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ │ +void mmhv(const X &x, Y &y) const │ │ │ │ │ +y -= A^H x │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:317 │ │ │ │ │ +_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:162 │ │ │ │ │ +_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_n_s_t___r_o_w___t_y_p_e │ │ │ │ │ +DiagonalRowVectorConst< K, n > const_row_type │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh: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_t_v │ │ │ │ │ +void mtv(const X &x, Y &y) const │ │ │ │ │ +y = A^T x │ │ │ │ │ +DDeeffiinniittiioonn scaledidmatrix.hh:250 │ │ │ │ │ +_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:452 │ │ │ │ │ +_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:134 │ │ │ │ │ +_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:415 │ │ │ │ │ +_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:497 │ │ │ │ │ +_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:510 │ │ │ │ │ +_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:511 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00215.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: istlexception.hh File Reference │ │ │ │ +dune-istl: supermatrix.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,38 +72,55 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
istlexception.hh File Reference
│ │ │ │ +
supermatrix.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/common/exceptions.hh>
│ │ │ │ +
#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"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::ISTLError
 derive error class from the base class in common More...
struct  Dune::SuperMatrixCreateSparseChooser< T >
 
class  Dune::BCRSMatrixError
 Error specific to BCRSMatrix. More...
struct  Dune::SuperMatrixPrinter< T >
 
class  Dune::ImplicitModeCompressionBufferExhausted
 Thrown when the compression buffer used by the implicit BCRSMatrix construction is exhausted. More...
struct  Dune::BaseGetSuperLUType< T >
 
class  Dune::SolverAbort
 Thrown when a solver aborts due to some problem. More...
struct  Dune::GetSuperLUType< T >
 
class  Dune::MatrixBlockError
 Error when performing an operation on a matrix block. More...
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
 
│ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,33 +1,50 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -istlexception.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +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" │ │ │ │ │ _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_S_T_L_E_r_r_o_r │ │ │ │ │ -  derive error class from the base class in common _M_o_r_e_._._. │ │ │ │ │ +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_ _> │ │ │ │ │   │ │ │ │ │ -class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ │ -  Error specific to _B_C_R_S_M_a_t_r_i_x. _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _T_ _> │ │ │ │ │   │ │ │ │ │ -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_._._. │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00215_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: istlexception.hh Source File │ │ │ │ +dune-istl: supermatrix.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,65 +74,427 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
istlexception.hh
│ │ │ │ +
supermatrix.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ISTLEXCEPTION_HH
│ │ │ │ -
6#define DUNE_ISTL_ISTLEXCEPTION_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_SUPERMATRIX_HH
│ │ │ │ +
6#define DUNE_ISTL_SUPERMATRIX_HH
│ │ │ │
7
│ │ │ │ -
8#include <dune/common/exceptions.hh>
│ │ │ │ -
9#include <dune/common/fmatrix.hh>
│ │ │ │ -
10
│ │ │ │ -
11namespace Dune {
│ │ │ │ -
12
│ │ │ │ -
19 class ISTLError : public Dune::MathError {};
│ │ │ │ +
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>
│ │ │ │ +
16
│ │ │ │ + │ │ │ │ +
18
│ │ │ │ +
19#include "superlufunctions.hh"
│ │ │ │
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
│ │ │ │ -
59} // end namespace
│ │ │ │ -
60
│ │ │ │ -
61#endif
│ │ │ │ +
21namespace Dune
│ │ │ │ +
22{
│ │ │ │ +
23
│ │ │ │ +
24 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
26 {};
│ │ │ │ +
│ │ │ │ +
27
│ │ │ │ +
28 template<class T>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
30 {};
│ │ │ │ +
│ │ │ │ +
31
│ │ │ │ +
32#if __has_include("slu_sdefs.h")
│ │ │ │ +
33 template<>
│ │ │ │ + │ │ │ │ +
35 {
│ │ │ │ +
36 static void create(SuperMatrix *mat, int n, int m, int offset,
│ │ │ │ +
37 float *values, int *rowindex, int* colindex,
│ │ │ │ +
38 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ │ +
39 {
│ │ │ │ +
40 sCreate_CompCol_Matrix(mat, n, m, offset, values, rowindex, colindex,
│ │ │ │ +
41 stype, dtype, mtype);
│ │ │ │ +
42 }
│ │ │ │ +
43 };
│ │ │ │ +
44
│ │ │ │ +
45 template<>
│ │ │ │ +
46 struct SuperMatrixPrinter<float>
│ │ │ │ +
47 {
│ │ │ │ +
48 static void print(char* name, SuperMatrix* mat)
│ │ │ │ +
49 {
│ │ │ │ +
50 sPrint_CompCol_Matrix(name, mat);
│ │ │ │ +
51 }
│ │ │ │ +
52 };
│ │ │ │ +
53#endif
│ │ │ │ +
54
│ │ │ │ +
55#if __has_include("slu_ddefs.h")
│ │ │ │ +
56 template<>
│ │ │ │ +
57 struct SuperMatrixCreateSparseChooser<double>
│ │ │ │ +
58 {
│ │ │ │ +
59 static void create(SuperMatrix *mat, int n, int m, int offset,
│ │ │ │ +
60 double *values, int *rowindex, int* colindex,
│ │ │ │ +
61 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ │ +
62 {
│ │ │ │ +
63 dCreate_CompCol_Matrix(mat, n, m, offset, values, rowindex, colindex,
│ │ │ │ +
64 stype, dtype, mtype);
│ │ │ │ +
65 }
│ │ │ │ +
66 };
│ │ │ │ +
67
│ │ │ │ +
68 template<>
│ │ │ │ +
69 struct SuperMatrixPrinter<double>
│ │ │ │ +
70 {
│ │ │ │ +
71 static void print(char* name, SuperMatrix* mat)
│ │ │ │ +
72 {
│ │ │ │ +
73 dPrint_CompCol_Matrix(name, mat);
│ │ │ │ +
74 }
│ │ │ │ +
75 };
│ │ │ │ +
76#endif
│ │ │ │ +
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< ::complex*>(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>
│ │ │ │ +
135 const Dtype_t BaseGetSuperLUType<T>::type =
│ │ │ │ +
136 std::is_same<T,float>::value ? SLU_S :
│ │ │ │ +
137 ( std::is_same<T,std::complex<double> >::value ? SLU_Z :
│ │ │ │ +
138 ( std::is_same<T,std::complex<float> >::value ? SLU_C : SLU_D ));
│ │ │ │ +
139
│ │ │ │ +
140 template<>
│ │ │ │ +
│ │ │ │ +
141 struct GetSuperLUType<double>
│ │ │ │ +
142 : public BaseGetSuperLUType<double>
│ │ │ │ +
143 {
│ │ │ │ +
144 typedef double float_type;
│ │ │ │ +
145 };
│ │ │ │ +
│ │ │ │ +
146
│ │ │ │ +
147 template<>
│ │ │ │ +
│ │ │ │ +
148 struct GetSuperLUType<float>
│ │ │ │ +
149 : public BaseGetSuperLUType<float>
│ │ │ │ +
150 {
│ │ │ │ +
151 typedef float float_type;
│ │ │ │ +
152 };
│ │ │ │ +
│ │ │ │ +
153
│ │ │ │ +
154 template<>
│ │ │ │ +
│ │ │ │ +
155 struct GetSuperLUType<std::complex<double> >
│ │ │ │ +
156 : public BaseGetSuperLUType<std::complex<double> >
│ │ │ │ +
157 {
│ │ │ │ +
158 typedef double float_type;
│ │ │ │ +
159 };
│ │ │ │ +
│ │ │ │ +
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 using Matrix = BCRSMatrix<B,TA>;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
245 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*this);
│ │ │ │ +
246
│ │ │ │ +
247 copyToBCCSMatrix(initializer, mat);
│ │ │ │ +
248
│ │ │ │ + │ │ │ │ +
250 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
│ │ │ │ +
251 this->values,this->rowindex, this->colstart, SLU_NC,
│ │ │ │ +
252 static_cast<Dtype_t>(GetSuperLUType<typename Matrix::field_type>::type), SLU_GE);
│ │ │ │ +
253 return *this;
│ │ │ │ +
254 }
│ │ │ │ +
│ │ │ │ +
255
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
257 {
│ │ │ │ +
258 if (this->N_ + this->M_ + this->Nnz_!=0)
│ │ │ │ +
259 free();
│ │ │ │ +
260
│ │ │ │ +
261 using Matrix = BCRSMatrix<B,TA>;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
264 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*this);
│ │ │ │ +
265
│ │ │ │ +
266 copyToBCCSMatrix(initializer, mat);
│ │ │ │ +
267
│ │ │ │ + │ │ │ │ +
269 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
│ │ │ │ +
270 this->values,this->rowindex, this->colstart, SLU_NC,
│ │ │ │ +
271 static_cast<Dtype_t>(GetSuperLUType<B>::type), SLU_GE);
│ │ │ │ +
272 return *this;
│ │ │ │ +
273 }
│ │ │ │ +
│ │ │ │ +
274
│ │ │ │ +
│ │ │ │ +
281 virtual void setMatrix(const Matrix& mat, const std::set<std::size_t>& mrs)
│ │ │ │ +
282 {
│ │ │ │ +
283 if(this->N_+this->M_+this->Nnz_!=0)
│ │ │ │ +
284 free();
│ │ │ │ +
285 this->N_=mrs.size()*MatrixDimension<typename Matrix::block_type>::rowdim(*(mat[0].begin()));
│ │ │ │ +
286 this->M_=mrs.size()*MatrixDimension<typename Matrix::block_type>::coldim(*(mat[0].begin()));
│ │ │ │ +
287 SuperMatrixInitializer<Matrix> initializer(*this);
│ │ │ │ +
288
│ │ │ │ +
289 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(mat,mrs));
│ │ │ │ +
290 }
│ │ │ │ +
│ │ │ │ +
291
│ │ │ │ +
│ │ │ │ +
293 virtual void setMatrix(const Matrix& mat)
│ │ │ │ +
294 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
297 SuperMatrixInitializer<Matrix> initializer(*this);
│ │ │ │ +
298
│ │ │ │ +
299 copyToBCCSMatrix(initializer, mat);
│ │ │ │ +
300 }
│ │ │ │ +
│ │ │ │ +
301
│ │ │ │ +
│ │ │ │ +
303 virtual void free()
│ │ │ │ +
304 {
│ │ │ │ +
305 ISTL::Impl::BCCSMatrix<typename BCRSMatrix<B,TA>::field_type, int>::free();
│ │ │ │ +
306 SUPERLU_FREE(A.Store);
│ │ │ │ +
307 }
│ │ │ │ +
│ │ │ │ +
308 private:
│ │ │ │ +
309 SuperMatrix A;
│ │ │ │ +
310 };
│ │ │ │ +
│ │ │ │ +
311
│ │ │ │ +
312 template<class B, class A>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
314 : public ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>
│ │ │ │ +
315 {
│ │ │ │ +
316 template<class I, class S, class D>
│ │ │ │ + │ │ │ │ +
318 public:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
321
│ │ │ │ +
│ │ │ │ +
322 SuperMatrixInitializer(SuperLUMatrix& lum) : ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>(lum)
│ │ │ │ +
323 ,slumat(&lum)
│ │ │ │ +
324 {}
│ │ │ │ +
│ │ │ │ +
325
│ │ │ │ +
│ │ │ │ +
326 SuperMatrixInitializer() : ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>()
│ │ │ │ +
327 {}
│ │ │ │ +
│ │ │ │ +
328
│ │ │ │ +
│ │ │ │ +
329 virtual void createMatrix() const
│ │ │ │ +
330 {
│ │ │ │ +
331 ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>::createMatrix();
│ │ │ │ + │ │ │ │ +
333 ::create(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols],
│ │ │ │ +
334 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC,
│ │ │ │ +
335 static_cast<Dtype_t>(GetSuperLUType<typename Matrix::field_type>::type), SLU_GE);
│ │ │ │ +
336 }
│ │ │ │ +
│ │ │ │ +
337 private:
│ │ │ │ +
338 SuperLUMatrix* slumat;
│ │ │ │ +
339 };
│ │ │ │ +
│ │ │ │ +
340}
│ │ │ │ +
341#endif // HAVE_SUPERLU
│ │ │ │ +
342#endif
│ │ │ │ + │ │ │ │ + │ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ │ +
STL namespace.
│ │ │ │
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
│ │ │ │ +
Initializer for SuperLU Matrices representing the subdomains.
Definition overlappingschwarz.hh:47
│ │ │ │ +
static auto coldim(const M &A)
Definition matrixutils.hh:219
│ │ │ │ +
static auto rowdim(const M &A)
Definition matrixutils.hh:214
│ │ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │ +
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
│ │ │ │ +
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ │ +
Definition overlappingschwarz.hh:694
│ │ │ │ +
SuperLu Solver.
Definition superlu.hh:271
│ │ │ │ +
Definition supermatrix.hh:26
│ │ │ │ +
Definition supermatrix.hh:30
│ │ │ │ +
Definition supermatrix.hh:126
│ │ │ │ +
static const Dtype_t type
Definition supermatrix.hh:127
│ │ │ │ +
Definition supermatrix.hh:132
│ │ │ │ +
double float_type
Definition supermatrix.hh:144
│ │ │ │ +
float float_type
Definition supermatrix.hh:151
│ │ │ │ +
double float_type
Definition supermatrix.hh:158
│ │ │ │ +
float float_type
Definition supermatrix.hh:165
│ │ │ │ +
Utility class for converting an ISTL Matrix into a SuperLU Matrix.
Definition supermatrix.hh:175
│ │ │ │ +
Definition supermatrix.hh:179
│ │ │ │ +
virtual void free()
free allocated space.
Definition supermatrix.hh:303
│ │ │ │ +
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const SuperLUMatrix< BCRSMatrix< B, TA > > &mat)
Definition supermatrix.hh:256
│ │ │ │ +
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const BCRSMatrix< B, TA > &mat)
Definition supermatrix.hh:237
│ │ │ │ +
SuperLUMatrix(const Matrix &mat)
Constructor that initializes the data.
Definition supermatrix.hh:212
│ │ │ │ +
virtual void setMatrix(const Matrix &mat)
Initialize data from given matrix.
Definition supermatrix.hh:293
│ │ │ │ +
SuperLUMatrix()
Definition supermatrix.hh:215
│ │ │ │ +
Matrix::size_type size_type
Definition supermatrix.hh:206
│ │ │ │ +
BCRSMatrix< B, TA > Matrix
The type of the matrix to convert.
Definition supermatrix.hh:202
│ │ │ │ +
virtual void setMatrix(const Matrix &mat, const std::set< std::size_t > &mrs)
Initialize data from a given set of matrix rows and columns.
Definition supermatrix.hh:281
│ │ │ │ +
virtual ~SuperLUMatrix()
Destructor.
Definition supermatrix.hh:219
│ │ │ │ +
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
Definition supermatrix.hh:320
│ │ │ │ +
BCRSMatrix< B, A > Matrix
Definition supermatrix.hh:319
│ │ │ │ +
SuperMatrixInitializer()
Definition supermatrix.hh:326
│ │ │ │ +
virtual void createMatrix() const
Definition supermatrix.hh:329
│ │ │ │ +
SuperMatrixInitializer(SuperLUMatrix &lum)
Definition supermatrix.hh:322
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,69 +1,461 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -istlexception.hh │ │ │ │ │ +supermatrix.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 (C) 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_ISTLEXCEPTION_HH │ │ │ │ │ -6#define DUNE_ISTL_ISTLEXCEPTION_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_SUPERMATRIX_HH │ │ │ │ │ +6#define DUNE_ISTL_SUPERMATRIX_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e { │ │ │ │ │ -12 │ │ │ │ │ -_1_9 class _I_S_T_L_E_r_r_o_r : public Dune::MathError {}; │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ -_2_2 class _B_C_R_S_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ │ -23 : public _I_S_T_L_E_r_r_o_r │ │ │ │ │ -24 {}; │ │ │ │ │ -25 │ │ │ │ │ -_3_5 class _I_m_p_l_i_c_i_t_M_o_d_e_C_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_E_x_h_a_u_s_t_e_d │ │ │ │ │ -36 : public _B_C_R_S_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ │ -37 {}; │ │ │ │ │ -38 │ │ │ │ │ -40 │ │ │ │ │ -_4_6 class _S_o_l_v_e_r_A_b_o_r_t : public _I_S_T_L_E_r_r_o_r {}; │ │ │ │ │ -47 │ │ │ │ │ -49 │ │ │ │ │ -_5_2 class _M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r : public virtual Dune::FMatrixError { │ │ │ │ │ -53 public: │ │ │ │ │ -_5_4 int _r, _c; // row and column index of the entry from which the error resulted │ │ │ │ │ -55 }; │ │ │ │ │ -56 │ │ │ │ │ -59} // end namespace │ │ │ │ │ -60 │ │ │ │ │ -61#endif │ │ │ │ │ +21namespace _D_u_n_e │ │ │ │ │ +22{ │ │ │ │ │ +23 │ │ │ │ │ +24 template │ │ │ │ │ +_2_5 struct _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r │ │ │ │ │ +26 {}; │ │ │ │ │ +27 │ │ │ │ │ +28 template │ │ │ │ │ +_2_9 struct _S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r │ │ │ │ │ +30 {}; │ │ │ │ │ +31 │ │ │ │ │ +32#if __has_include("slu_sdefs.h") │ │ │ │ │ +33 template<> │ │ │ │ │ +34 struct _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r │ │ │ │ │ +35 { │ │ │ │ │ +36 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ │ +37 float *values, int *rowindex, int* colindex, │ │ │ │ │ +38 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ │ +39 { │ │ │ │ │ +40 sCreate_CompCol_Matrix(_m_a_t, n, m, offset, values, rowindex, colindex, │ │ │ │ │ +41 stype, dtype, mtype); │ │ │ │ │ +42 } │ │ │ │ │ +43 }; │ │ │ │ │ +44 │ │ │ │ │ +45 template<> │ │ │ │ │ +46 struct SuperMatrixPrinter │ │ │ │ │ +47 { │ │ │ │ │ +48 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ │ +49 { │ │ │ │ │ +50 sPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ │ +51 } │ │ │ │ │ +52 }; │ │ │ │ │ +53#endif │ │ │ │ │ +54 │ │ │ │ │ +55#if __has_include("slu_ddefs.h") │ │ │ │ │ +56 template<> │ │ │ │ │ +57 struct SuperMatrixCreateSparseChooser │ │ │ │ │ +58 { │ │ │ │ │ +59 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ │ +60 double *values, int *rowindex, int* colindex, │ │ │ │ │ +61 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ │ +62 { │ │ │ │ │ +63 dCreate_CompCol_Matrix(_m_a_t, n, m, offset, values, rowindex, colindex, │ │ │ │ │ +64 stype, dtype, mtype); │ │ │ │ │ +65 } │ │ │ │ │ +66 }; │ │ │ │ │ +67 │ │ │ │ │ +68 template<> │ │ │ │ │ +69 struct SuperMatrixPrinter │ │ │ │ │ +70 { │ │ │ │ │ +71 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ │ +72 { │ │ │ │ │ +73 dPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ │ +74 } │ │ │ │ │ +75 }; │ │ │ │ │ +76#endif │ │ │ │ │ +77 │ │ │ │ │ +78#if __has_include("slu_cdefs.h") │ │ │ │ │ +79 template<> │ │ │ │ │ +80 struct SuperMatrixCreateSparseChooser<_s_t_d::complex > │ │ │ │ │ +81 { │ │ │ │ │ +82 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ │ +83 std::complex *values, int *rowindex, int* colindex, │ │ │ │ │ +84 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ │ +85 { │ │ │ │ │ +86 cCreate_CompCol_Matrix(_m_a_t, n, m, offset, reinterpret_cast< ::complex*> │ │ │ │ │ +(values), │ │ │ │ │ +87 rowindex, colindex, stype, dtype, mtype); │ │ │ │ │ +88 } │ │ │ │ │ +89 }; │ │ │ │ │ +90 │ │ │ │ │ +91 template<> │ │ │ │ │ +92 struct SuperMatrixPrinter<_s_t_d::complex > │ │ │ │ │ +93 { │ │ │ │ │ +94 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ │ +95 { │ │ │ │ │ +96 cPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ │ +97 } │ │ │ │ │ +98 }; │ │ │ │ │ +99#endif │ │ │ │ │ +100 │ │ │ │ │ +101#if __has_include("slu_zdefs.h") │ │ │ │ │ +102 template<> │ │ │ │ │ +103 struct SuperMatrixCreateSparseChooser<_s_t_d::complex > │ │ │ │ │ +104 { │ │ │ │ │ +105 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ │ +106 std::complex *values, int *rowindex, int* colindex, │ │ │ │ │ +107 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ │ +108 { │ │ │ │ │ +109 zCreate_CompCol_Matrix(_m_a_t, n, m, offset, reinterpret_cast │ │ │ │ │ +(values), │ │ │ │ │ +110 rowindex, colindex, stype, dtype, mtype); │ │ │ │ │ +111 } │ │ │ │ │ +112 }; │ │ │ │ │ +113 │ │ │ │ │ +114 template<> │ │ │ │ │ +115 struct SuperMatrixPrinter<_s_t_d::complex > │ │ │ │ │ +116 { │ │ │ │ │ +117 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ │ +118 { │ │ │ │ │ +119 zPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ │ +120 } │ │ │ │ │ +121 }; │ │ │ │ │ +122#endif │ │ │ │ │ +123 │ │ │ │ │ +124 template │ │ │ │ │ +_1_2_5 struct _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +126 { │ │ │ │ │ +_1_2_7 static const Dtype_t _t_y_p_e; │ │ │ │ │ +128 }; │ │ │ │ │ +129 │ │ │ │ │ +130 template │ │ │ │ │ +_1_3_1 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +132 {}; │ │ │ │ │ +133 │ │ │ │ │ +134 template │ │ │ │ │ +135 const Dtype_t _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e = │ │ │ │ │ +136 std::is_same::value ? SLU_S : │ │ │ │ │ +137 ( std::is_same >::value ? SLU_Z : │ │ │ │ │ +138 ( std::is_same >::value ? SLU_C : SLU_D )); │ │ │ │ │ +139 │ │ │ │ │ +140 template<> │ │ │ │ │ +_1_4_1 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +142 : public _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +143 { │ │ │ │ │ +_1_4_4 typedef double _f_l_o_a_t___t_y_p_e; │ │ │ │ │ +145 }; │ │ │ │ │ +146 │ │ │ │ │ +147 template<> │ │ │ │ │ +_1_4_8 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +149 : public _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +150 { │ │ │ │ │ +_1_5_1 typedef float _f_l_o_a_t___t_y_p_e; │ │ │ │ │ +152 }; │ │ │ │ │ +153 │ │ │ │ │ +154 template<> │ │ │ │ │ +_1_5_5 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e<_s_t_d::complex > │ │ │ │ │ +156 : public _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e > │ │ │ │ │ +157 { │ │ │ │ │ +_1_5_8 typedef double _f_l_o_a_t___t_y_p_e; │ │ │ │ │ +159 }; │ │ │ │ │ +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& _m_a_t) : ISTL::Impl:: │ │ │ │ │ +BCCSMatrix<_B_C_R_S_M_a_t_r_i_x, int>(_m_a_t) │ │ │ │ │ +213 {} │ │ │ │ │ +214 │ │ │ │ │ +_2_1_5 _S_u_p_e_r_L_U_M_a_t_r_i_x() : ISTL::Impl::BCCSMatrix:: │ │ │ │ │ +field_type, int>() │ │ │ │ │ +216 {} │ │ │ │ │ +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 free(); │ │ │ │ │ +223 } │ │ │ │ │ +224 │ │ │ │ │ +_2_2_6 operator SuperMatrix&() │ │ │ │ │ +227 { │ │ │ │ │ +228 return A; │ │ │ │ │ +229 } │ │ │ │ │ +230 │ │ │ │ │ +_2_3_2 operator const SuperMatrix&() const │ │ │ │ │ +233 { │ │ │ │ │ +234 return A; │ │ │ │ │ +235 } │ │ │ │ │ +236 │ │ │ │ │ +_2_3_7 _S_u_p_e_r_L_U_M_a_t_r_i_x_<_B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> >& _o_p_e_r_a_t_o_r_=(const _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_>& _m_a_t) │ │ │ │ │ +238 { │ │ │ │ │ +239 if (this->N_ + this->M_ + this->Nnz_!=0) │ │ │ │ │ +240 free(); │ │ │ │ │ +241 │ │ │ │ │ +242 using _M_a_t_r_i_x = _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_>; │ │ │ │ │ +243 this->N_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t); │ │ │ │ │ +244 this->M_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t); │ │ │ │ │ +245 ISTL::Impl::BCCSMatrixInitializer initializer(*this); │ │ │ │ │ +246 │ │ │ │ │ +247 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ │ +248 │ │ │ │ │ +249 _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ │ +250_ _:_:_c_r_e_a_t_e(&A, this->N_, this->M_, this->colstart[this->N_], │ │ │ │ │ +251 this->values,this->rowindex, this->colstart, SLU_NC, │ │ │ │ │ +252 static_cast(_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_>_:_:_t_y_p_e), │ │ │ │ │ +SLU_GE); │ │ │ │ │ +253 return *this; │ │ │ │ │ +254 } │ │ │ │ │ +255 │ │ │ │ │ +_2_5_6 _S_u_p_e_r_L_U_M_a_t_r_i_x_<_B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> >& _o_p_e_r_a_t_o_r_=(const _S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ │ +<_B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> >& _m_a_t) │ │ │ │ │ +257 { │ │ │ │ │ +258 if (this->N_ + this->M_ + this->Nnz_!=0) │ │ │ │ │ +259 free(); │ │ │ │ │ +260 │ │ │ │ │ +261 using _M_a_t_r_i_x = _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_>; │ │ │ │ │ +262 this->N_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t); │ │ │ │ │ +263 this->M_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t); │ │ │ │ │ +264 ISTL::Impl::BCCSMatrixInitializer initializer(*this); │ │ │ │ │ +265 │ │ │ │ │ +266 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ │ +267 │ │ │ │ │ +268 _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r_<_B_> │ │ │ │ │ +269_ _:_:_c_r_e_a_t_e(&A, this->N_, this->M_, this->colstart[this->N_], │ │ │ │ │ +270 this->values,this->rowindex, this->colstart, SLU_NC, │ │ │ │ │ +271 static_cast(_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_B_>_:_:_t_y_p_e), SLU_GE); │ │ │ │ │ +272 return *this; │ │ │ │ │ +273 } │ │ │ │ │ +274 │ │ │ │ │ +_2_8_1 virtual void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& _m_a_t, const std::set& mrs) │ │ │ │ │ +282 { │ │ │ │ │ +283 if(this->N_+this->M_+this->Nnz_!=0) │ │ │ │ │ +284 free(); │ │ │ │ │ +285 this->N_=mrs.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e_>_:_:_r_o_w_d_i_m(* │ │ │ │ │ +(_m_a_t[0].begin())); │ │ │ │ │ +286 this->M_=mrs.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e_>_:_:_c_o_l_d_i_m(* │ │ │ │ │ +(_m_a_t[0].begin())); │ │ │ │ │ +287 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_M_a_t_r_i_x_> initializer(*this); │ │ │ │ │ +288 │ │ │ │ │ +289 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ │ +set >(_m_a_t,mrs)); │ │ │ │ │ +290 } │ │ │ │ │ +291 │ │ │ │ │ +_2_9_3 virtual void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& _m_a_t) │ │ │ │ │ +294 { │ │ │ │ │ +295 this->N_=_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t); │ │ │ │ │ +296 this->M_=_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t); │ │ │ │ │ +297 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_M_a_t_r_i_x_> initializer(*this); │ │ │ │ │ +298 │ │ │ │ │ +299 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ │ +300 } │ │ │ │ │ +301 │ │ │ │ │ +_3_0_3 virtual void _f_r_e_e() │ │ │ │ │ +304 { │ │ │ │ │ +305 ISTL::Impl::BCCSMatrix::field_type, int>::free(); │ │ │ │ │ +306 SUPERLU_FREE(A.Store); │ │ │ │ │ +307 } │ │ │ │ │ +308 private: │ │ │ │ │ +309 SuperMatrix A; │ │ │ │ │ +310 }; │ │ │ │ │ +311 │ │ │ │ │ +312 template │ │ │ │ │ +_3_1_3 class _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ │ +314 : public ISTL::Impl::BCCSMatrixInitializer, int> │ │ │ │ │ +315 { │ │ │ │ │ +316 template │ │ │ │ │ +_3_1_7 friend class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ │ +318 public: │ │ │ │ │ +_3_1_9 typedef _B_C_R_S_M_a_t_r_i_x_<_B_,_A_> _M_a_t_r_i_x; │ │ │ │ │ +_3_2_0 typedef _D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_M_a_t_r_i_x_> _S_u_p_e_r_L_U_M_a_t_r_i_x; │ │ │ │ │ +321 │ │ │ │ │ +_3_2_2 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r(_S_u_p_e_r_L_U_M_a_t_r_i_x& lum) : ISTL::Impl:: │ │ │ │ │ +BCCSMatrixInitializer<_B_C_R_S_M_a_t_r_i_x, int>(lum) │ │ │ │ │ +323 ,slumat(&lum) │ │ │ │ │ +324 {} │ │ │ │ │ +325 │ │ │ │ │ +_3_2_6 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r() : ISTL::Impl:: │ │ │ │ │ +BCCSMatrixInitializer<_B_C_R_S_M_a_t_r_i_x, int>() │ │ │ │ │ +327 {} │ │ │ │ │ +328 │ │ │ │ │ +_3_2_9 virtual void _c_r_e_a_t_e_M_a_t_r_i_x() const │ │ │ │ │ +330 { │ │ │ │ │ +331 ISTL::Impl::BCCSMatrixInitializer, int>::createMatrix(); │ │ │ │ │ +332 _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ │ +333_ _:_:_c_r_e_a_t_e(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols], │ │ │ │ │ +334 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC, │ │ │ │ │ +335 static_cast(_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_>_:_:_t_y_p_e), │ │ │ │ │ +SLU_GE); │ │ │ │ │ +336 } │ │ │ │ │ +337 private: │ │ │ │ │ +338 _S_u_p_e_r_L_U_M_a_t_r_i_x* slumat; │ │ │ │ │ +339 }; │ │ │ │ │ +340} │ │ │ │ │ +341#endif // HAVE_SUPERLU │ │ │ │ │ +342#endif │ │ │ │ │ +_s_u_p_e_r_l_u_f_u_n_c_t_i_o_n_s_._h_h │ │ │ │ │ +_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ │ +_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 │ │ │ │ │ +Matrix & mat │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ -derive error class from the base class in common │ │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_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 │ │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ +Initializer for SuperLU Matrices representing the subdomains. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_c_o_l_d_i_m │ │ │ │ │ +static auto coldim(const M &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_r_o_w_d_i_m │ │ │ │ │ +static auto rowdim(const M &A) │ │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:214 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +A::size_type size_type │ │ │ │ │ +The type for the index access and the size. │ │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:500 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ │ +Sequential overlapping Schwarz preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ │ +_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U │ │ │ │ │ +SuperLu Solver. │ │ │ │ │ +DDeeffiinniittiioonn superlu.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:126 │ │ │ │ │ +_D_u_n_e_:_:_B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e_:_:_t_y_p_e │ │ │ │ │ +static const Dtype_t type │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:127 │ │ │ │ │ +_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:132 │ │ │ │ │ +_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _d_o_u_b_l_e_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ │ +double float_type │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:144 │ │ │ │ │ +_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _f_l_o_a_t_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ │ +float float_type │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ │ +double float_type │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:158 │ │ │ │ │ +_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _f_l_o_a_t_ _>_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ │ +float float_type │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:165 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ │ +Utility class for converting an ISTL Matrix into a SuperLU Matrix. │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:175 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:179 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_f_r_e_e │ │ │ │ │ +virtual void free() │ │ │ │ │ +free allocated space. │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:303 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const SuperLUMatrix< │ │ │ │ │ +BCRSMatrix< B, TA > > &mat) │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:256 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ │ +SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const BCRSMatrix< B, TA > │ │ │ │ │ +&mat) │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:237 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ │ +SuperLUMatrix(const Matrix &mat) │ │ │ │ │ +Constructor that initializes the data. │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:212 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ │ +virtual void setMatrix(const Matrix &mat) │ │ │ │ │ +Initialize data from given matrix. │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ │ +SuperLUMatrix() │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:215 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ │ +Matrix::size_type size_type │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< B, TA > Matrix │ │ │ │ │ +The type of the matrix to convert. │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:202 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ │ +virtual void setMatrix(const Matrix &mat, const std::set< std::size_t > &mrs) │ │ │ │ │ +Initialize data from a given set of matrix rows and columns. │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_~_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ │ +virtual ~SuperLUMatrix() │ │ │ │ │ +Destructor. │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:219 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ │ +Dune::SuperLUMatrix< Matrix > SuperLUMatrix │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:320 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ │ +BCRSMatrix< B, A > Matrix │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:319 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ +SuperMatrixInitializer() │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:326 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_c_r_e_a_t_e_M_a_t_r_i_x │ │ │ │ │ +virtual void createMatrix() const │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:329 │ │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ │ +SuperMatrixInitializer(SuperLUMatrix &lum) │ │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:322 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00218.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioners.hh File Reference │ │ │ │ +dune-istl: solverregistry.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,98 +72,143 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Typedefs | │ │ │ │ +Macros | │ │ │ │ Functions
│ │ │ │ - │ │ │ │ +
solverregistry.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 "ildl.hh"
│ │ │ │ -#include "ilu.hh"
│ │ │ │ +
#include <dune/istl/common/registry.hh>
│ │ │ │ +#include <dune/istl/preconditioner.hh>
│ │ │ │ +#include <dune/istl/solver.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::SeqILU< M, X, Y, l >
 Sequential ILU preconditioner. More...
class  Dune::UnsupportedType
 
class  Dune::Richardson< X, Y >
 Richardson preconditioner. More...
 
class  Dune::SeqILDL< M, X, Y >
 sequential ILDL preconditioner More...
class  Dune::InvalidSolverFactoryConfiguration
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

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

│ │ │ │ +Macros

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

│ │ │ │ Functions

 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 ("ilu", defaultPreconditionerBlockLevelCreator< Dune::SeqILU >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("richardson", [](auto tl, const auto &, const ParameterTree &config){ using D=typename Dune::TypeListElement< 1, decltype(tl)>::type;using R=typename Dune::TypeListElement< 2, decltype(tl)>::type;return std::make_shared< Richardson< D, R > >(config);})
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("ildl", defaultPreconditionerCreator< Dune::SeqILDL >())
 
template<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 ()
 
│ │ │ │ -

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.

│ │ │ │ -
│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DUNE_REGISTER_DIRECT_SOLVER

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

◆ DUNE_REGISTER_ITERATIVE_SOLVER

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

◆ DUNE_REGISTER_PRECONDITIONER

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_REGISTER_PRECONDITIONER( name,
 ... 
)    DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,89 +1,60 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 "_i_l_d_l_._h_h" │ │ │ │ │ -#include "_i_l_u_._h_h" │ │ │ │ │ +_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> │ │ │ │ │ _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_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_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_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_:_:_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 │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ -template │ │ │ │ │ -using  _D_u_n_e_:_:_S_e_q_G_S = _S_e_q_S_O_R< M, X, Y, l > │ │ │ │ │ -  Sequential Gauss Seidel preconditioner. │ │ │ │ │ -  │ │ │ │ │ -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 >()) │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ + (DirectSolverTag, name, __VA_ARGS__) │ │ │ │ │   │ │ │ │ │ -  _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 >()) │ │ │ │ │ +#define  _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ + (PreconditionerTag, name, __VA_ARGS__) │ │ │ │ │   │ │ │ │ │ -  _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 >()) │ │ │ │ │ +#define  _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ + (IterativeSolverTag, name, __VA_ARGS__) │ │ │ │ │   │ │ │ │ │ -  _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 ("ilu", │ │ │ │ │ - _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_I_L_U >()) │ │ │ │ │ -  │ │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("richardson", [](auto tl, const auto &, │ │ │ │ │ - const ParameterTree &config){ using D=typename Dune::TypeListElement< 1, │ │ │ │ │ - decltype(tl)>::type;using R=typename Dune::TypeListElement< 2, decltype │ │ │ │ │ - (tl)>::type;return std::make_shared< _R_i_c_h_a_r_d_s_o_n< D, R > >(config);}) │ │ │ │ │ -  │ │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("ildl", _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r< │ │ │ │ │ - _D_u_n_e_:_:_S_e_q_I_L_D_L >()) │ │ │ │ │ -  │ │ │ │ │ -********** 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. │ │ │ │ │ +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__DDIIRREECCTT__SSOOLLVVEERR ********** │ │ │ │ │ +#define DUNE_REGISTER_DIRECT_SOLVER (   name, │ │ │ │ │ +   ......  │ │ │ │ │ + )     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(DirectSolverTag, │ │ │ │ │ + name, __VA_ARGS__) │ │ │ │ │ +********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__IITTEERRAATTIIVVEE__SSOOLLVVEERR ********** │ │ │ │ │ +#define DUNE_REGISTER_ITERATIVE_SOLVER (   name, │ │ │ │ │ +   ......  │ │ │ │ │ +     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ + ) (IterativeSolverTag, name, │ │ │ │ │ + __VA_ARGS__) │ │ │ │ │ +********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__PPRREECCOONNDDIITTIIOONNEERR ********** │ │ │ │ │ +#define DUNE_REGISTER_PRECONDITIONER (   name, │ │ │ │ │ +   ......  │ │ │ │ │ + )     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ │ + (PreconditionerTag, name, __VA_ARGS__) │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00218_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioners.hh Source File │ │ │ │ +dune-istl: solverregistry.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,738 +74,118 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
preconditioners.hh
│ │ │ │ +
solverregistry.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
│ │ │ │ -
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 "ildl.hh"
│ │ │ │ -
26#include "ilu.hh"
│ │ │ │ -
27
│ │ │ │ -
28
│ │ │ │ -
29namespace Dune {
│ │ │ │ -
72 template<class O, int c = -1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
74 public Preconditioner<typename O::domain_type, typename O::range_type>
│ │ │ │ -
75 {
│ │ │ │ -
76 public:
│ │ │ │ -
78 typedef typename O::domain_type domain_type;
│ │ │ │ -
80 typedef typename O::range_type range_type;
│ │ │ │ -
82 typedef typename range_type::field_type field_type;
│ │ │ │ -
84 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ -
86 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ -
88 typedef O InverseOperator;
│ │ │ │ -
89
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
95 : inverse_operator_(inverse_operator)
│ │ │ │ -
96 {
│ │ │ │ -
97 if(c != -1 && SolverCategory::category(inverse_operator_) != c)
│ │ │ │ -
98 DUNE_THROW(InvalidStateException, "User-supplied solver category does not match that of the given inverse operator");
│ │ │ │ -
99 }
│ │ │ │ -
│ │ │ │ -
100
│ │ │ │ -
│ │ │ │ -
101 virtual void pre(domain_type&,range_type&)
│ │ │ │ -
102 {}
│ │ │ │ -
│ │ │ │ -
103
│ │ │ │ -
│ │ │ │ -
104 virtual void apply(domain_type& v, const range_type& d)
│ │ │ │ -
105 {
│ │ │ │ - │ │ │ │ -
107 range_type copy(d);
│ │ │ │ -
108 inverse_operator_.apply(v, copy, res);
│ │ │ │ -
109 }
│ │ │ │ -
│ │ │ │ -
110
│ │ │ │ -
│ │ │ │ -
111 virtual void post(domain_type&)
│ │ │ │ -
112 {}
│ │ │ │ -
│ │ │ │ -
113
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
116 {
│ │ │ │ -
117 return SolverCategory::category(inverse_operator_);
│ │ │ │ -
118 }
│ │ │ │ -
│ │ │ │ -
119
│ │ │ │ -
120 private:
│ │ │ │ -
121 InverseOperator& inverse_operator_;
│ │ │ │ -
122 };
│ │ │ │ -
│ │ │ │ -
123
│ │ │ │ -
124 //=====================================================================
│ │ │ │ -
125 // Implementation of this interface for sequential ISTL-preconditioners
│ │ │ │ -
126 //=====================================================================
│ │ │ │ -
127
│ │ │ │ -
128
│ │ │ │ -
140 template<class M, class X, class Y, int l=1>
│ │ │ │ -
│ │ │ │ -
141 class SeqSSOR : public Preconditioner<X,Y> {
│ │ │ │ -
142 public:
│ │ │ │ -
144 typedef M matrix_type;
│ │ │ │ -
146 typedef X domain_type;
│ │ │ │ -
148 typedef Y range_type;
│ │ │ │ -
150 typedef typename X::field_type field_type;
│ │ │ │ -
152 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ -
154 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ -
155
│ │ │ │ -
│ │ │ │ -
163 SeqSSOR (const M& A, int n, real_field_type w)
│ │ │ │ -
164 : _A_(A), _n(n), _w(w)
│ │ │ │ -
165 {
│ │ │ │ - │ │ │ │ -
167 }
│ │ │ │ -
│ │ │ │ -
168
│ │ │ │ -
│ │ │ │ -
182 SeqSSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ -
183 : SeqSSOR(A->getmat(), configuration)
│ │ │ │ -
184 {}
│ │ │ │ -
│ │ │ │ -
185
│ │ │ │ -
│ │ │ │ -
199 SeqSSOR (const M& A, const ParameterTree& configuration)
│ │ │ │ -
200 : SeqSSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ │ -
201 {}
│ │ │ │ -
│ │ │ │ -
202
│ │ │ │ -
│ │ │ │ -
208 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ -
209 {}
│ │ │ │ -
│ │ │ │ -
210
│ │ │ │ -
│ │ │ │ -
216 virtual void apply (X& v, const Y& d)
│ │ │ │ -
217 {
│ │ │ │ -
218 for (int i=0; i<_n; i++) {
│ │ │ │ -
219 bsorf(_A_,v,d,_w,BL<l>());
│ │ │ │ -
220 bsorb(_A_,v,d,_w,BL<l>());
│ │ │ │ -
221 }
│ │ │ │ -
222 }
│ │ │ │ -
│ │ │ │ -
223
│ │ │ │ -
│ │ │ │ -
229 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ -
230 {}
│ │ │ │ -
│ │ │ │ -
231
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
234 {
│ │ │ │ - │ │ │ │ -
236 }
│ │ │ │ -
│ │ │ │ -
237
│ │ │ │ -
238 private:
│ │ │ │ -
240 const M& _A_;
│ │ │ │ -
242 int _n;
│ │ │ │ - │ │ │ │ -
245 };
│ │ │ │ -
│ │ │ │ -
246 DUNE_REGISTER_PRECONDITIONER("ssor", defaultPreconditionerBlockLevelCreator<Dune::SeqSSOR>());
│ │ │ │ -
247
│ │ │ │ -
248
│ │ │ │ -
260 template<class M, class X, class Y, int l=1>
│ │ │ │ -
│ │ │ │ -
261 class SeqSOR : public Preconditioner<X,Y> {
│ │ │ │ -
262 public:
│ │ │ │ -
264 typedef M matrix_type;
│ │ │ │ -
266 typedef X domain_type;
│ │ │ │ -
268 typedef Y range_type;
│ │ │ │ -
270 typedef typename X::field_type field_type;
│ │ │ │ -
272 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ -
274 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ -
275
│ │ │ │ -
│ │ │ │ -
283 SeqSOR (const M& A, int n, real_field_type w)
│ │ │ │ -
284 : _A_(A), _n(n), _w(w)
│ │ │ │ -
285 {
│ │ │ │ - │ │ │ │ -
287 }
│ │ │ │ -
│ │ │ │ -
288
│ │ │ │ -
│ │ │ │ -
302 SeqSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ -
303 : SeqSOR(A->getmat(), configuration)
│ │ │ │ -
304 {}
│ │ │ │ -
│ │ │ │ -
305
│ │ │ │ -
│ │ │ │ -
319 SeqSOR (const M& A, const ParameterTree& configuration)
│ │ │ │ -
320 : SeqSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ │ -
321 {}
│ │ │ │ -
│ │ │ │ -
322
│ │ │ │ -
│ │ │ │ -
328 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ -
329 {}
│ │ │ │ -
│ │ │ │ -
330
│ │ │ │ -
│ │ │ │ -
336 virtual void apply (X& v, const Y& d)
│ │ │ │ -
337 {
│ │ │ │ -
338 this->template apply<true>(v,d);
│ │ │ │ -
339 }
│ │ │ │ -
│ │ │ │ -
340
│ │ │ │ -
349 template<bool forward>
│ │ │ │ -
│ │ │ │ -
350 void apply(X& v, const Y& d)
│ │ │ │ -
351 {
│ │ │ │ -
352 if(forward)
│ │ │ │ -
353 for (int i=0; i<_n; i++) {
│ │ │ │ -
354 bsorf(_A_,v,d,_w,BL<l>());
│ │ │ │ -
355 }
│ │ │ │ -
356 else
│ │ │ │ -
357 for (int i=0; i<_n; i++) {
│ │ │ │ -
358 bsorb(_A_,v,d,_w,BL<l>());
│ │ │ │ -
359 }
│ │ │ │ -
360 }
│ │ │ │ -
│ │ │ │ -
361
│ │ │ │ -
│ │ │ │ -
367 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ -
368 {}
│ │ │ │ -
│ │ │ │ -
369
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
372 {
│ │ │ │ - │ │ │ │ -
374 }
│ │ │ │ -
│ │ │ │ -
375
│ │ │ │ -
376 private:
│ │ │ │ -
378 const M& _A_;
│ │ │ │ -
380 int _n;
│ │ │ │ - │ │ │ │ -
383 };
│ │ │ │ -
│ │ │ │ -
384 DUNE_REGISTER_PRECONDITIONER("sor", defaultPreconditionerBlockLevelCreator<Dune::SeqSOR>());
│ │ │ │ -
385
│ │ │ │ -
386
│ │ │ │ -
397 template<class M, class X, class Y, int l=1>
│ │ │ │ - │ │ │ │ -
399 DUNE_REGISTER_PRECONDITIONER("gs", defaultPreconditionerBlockLevelCreator<Dune::SeqGS>());
│ │ │ │ -
400
│ │ │ │ -
411 template<class M, class X, class Y, int l=1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
413 public:
│ │ │ │ -
415 typedef M matrix_type;
│ │ │ │ -
417 typedef X domain_type;
│ │ │ │ -
419 typedef Y range_type;
│ │ │ │ -
421 typedef typename X::field_type field_type;
│ │ │ │ -
423 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ -
425 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ -
426
│ │ │ │ -
│ │ │ │ -
434 SeqJac (const M& A, int n, real_field_type w)
│ │ │ │ -
435 : _A_(A), _n(n), _w(w)
│ │ │ │ -
436 {
│ │ │ │ - │ │ │ │ -
438 }
│ │ │ │ -
│ │ │ │ -
439
│ │ │ │ -
│ │ │ │ -
453 SeqJac (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ -
454 : SeqJac(A->getmat(), configuration)
│ │ │ │ -
455 {}
│ │ │ │ -
│ │ │ │ -
456
│ │ │ │ -
│ │ │ │ -
470 SeqJac (const M& A, const ParameterTree& configuration)
│ │ │ │ -
471 : SeqJac(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ │ -
472 {}
│ │ │ │ -
│ │ │ │ -
473
│ │ │ │ -
│ │ │ │ -
479 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ -
480 {}
│ │ │ │ -
│ │ │ │ -
481
│ │ │ │ -
│ │ │ │ -
487 virtual void apply (X& v, const Y& d)
│ │ │ │ -
488 {
│ │ │ │ -
489 for (int i=0; i<_n; i++) {
│ │ │ │ -
490 dbjac(_A_,v,d,_w,BL<l>());
│ │ │ │ -
491 }
│ │ │ │ -
492 }
│ │ │ │ -
│ │ │ │ -
493
│ │ │ │ -
│ │ │ │ -
499 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ -
500 {}
│ │ │ │ -
│ │ │ │ -
501
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
504 {
│ │ │ │ - │ │ │ │ -
506 }
│ │ │ │ -
│ │ │ │ -
507
│ │ │ │ -
508 private:
│ │ │ │ -
510 const M& _A_;
│ │ │ │ -
512 int _n;
│ │ │ │ -
514 real_field_type _w;
│ │ │ │ -
515 };
│ │ │ │ -
│ │ │ │ -
516 DUNE_REGISTER_PRECONDITIONER("jac", defaultPreconditionerBlockLevelCreator<Dune::SeqJac>());
│ │ │ │ -
517
│ │ │ │ -
518
│ │ │ │ -
519
│ │ │ │ -
531 template<class M, class X, class Y, int l=1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
533 public:
│ │ │ │ -
535 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ │ -
537 typedef typename matrix_type :: block_type block_type;
│ │ │ │ -
539 typedef X domain_type;
│ │ │ │ -
541 typedef Y range_type;
│ │ │ │ -
542
│ │ │ │ -
544 typedef typename X::field_type field_type;
│ │ │ │ -
545
│ │ │ │ -
547 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ -
549 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ -
550
│ │ │ │ - │ │ │ │ -
553
│ │ │ │ -
│ │ │ │ -
561 SeqILU (const M& A, real_field_type w, const bool resort = false )
│ │ │ │ -
562 : SeqILU( A, 0, w, resort ) // construct ILU(0)
│ │ │ │ -
563 {
│ │ │ │ -
564 }
│ │ │ │ -
│ │ │ │ -
565
│ │ │ │ -
│ │ │ │ -
580 SeqILU (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ -
581 : SeqILU(A->getmat(), configuration)
│ │ │ │ -
582 {}
│ │ │ │ -
│ │ │ │ -
583
│ │ │ │ -
│ │ │ │ -
598 SeqILU(const M& A, const ParameterTree& config)
│ │ │ │ -
599 : SeqILU(A, config.get("n", 0),
│ │ │ │ -
600 config.get<real_field_type>("relaxation", 1.0),
│ │ │ │ -
601 config.get("resort", false))
│ │ │ │ -
602 {}
│ │ │ │ -
│ │ │ │ -
603
│ │ │ │ -
│ │ │ │ -
612 SeqILU (const M& A, int n, real_field_type w, const bool resort = false )
│ │ │ │ -
613 : ILU_(),
│ │ │ │ -
614 lower_(),
│ │ │ │ -
615 upper_(),
│ │ │ │ -
616 inv_(),
│ │ │ │ -
617 w_(w),
│ │ │ │ -
618 wNotIdentity_([w]{using std::abs; return abs(w - real_field_type(1)) > 1e-15;}() )
│ │ │ │ -
619 {
│ │ │ │ -
620 if( n == 0 )
│ │ │ │ -
621 {
│ │ │ │ -
622 // copy A
│ │ │ │ -
623 ILU_.reset( new matrix_type( A ) );
│ │ │ │ -
624 // create ILU(0) decomposition
│ │ │ │ - │ │ │ │ -
626 }
│ │ │ │ -
627 else
│ │ │ │ -
628 {
│ │ │ │ -
629 // create matrix in build mode
│ │ │ │ -
630 ILU_.reset( new matrix_type( A.N(), A.M(), matrix_type::row_wise) );
│ │ │ │ -
631 // create ILU(n) decomposition
│ │ │ │ -
632 ILU::blockILUDecomposition( A, n, *ILU_ );
│ │ │ │ -
633 }
│ │ │ │ -
634
│ │ │ │ -
635 if( resort )
│ │ │ │ -
636 {
│ │ │ │ -
637 // store ILU in simple CRS format
│ │ │ │ -
638 ILU::convertToCRS( *ILU_, lower_, upper_, inv_ );
│ │ │ │ -
639 ILU_.reset();
│ │ │ │ -
640 }
│ │ │ │ -
641 }
│ │ │ │ -
│ │ │ │ -
642
│ │ │ │ -
│ │ │ │ -
648 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ -
649 {}
│ │ │ │ -
│ │ │ │ -
650
│ │ │ │ -
│ │ │ │ -
656 virtual void apply (X& v, const Y& d)
│ │ │ │ -
657 {
│ │ │ │ -
658 if( ILU_ )
│ │ │ │ -
659 {
│ │ │ │ -
660 ILU::blockILUBacksolve( *ILU_, v, d);
│ │ │ │ -
661 }
│ │ │ │ -
662 else
│ │ │ │ -
663 {
│ │ │ │ -
664 ILU::blockILUBacksolve(lower_, upper_, inv_, v, d);
│ │ │ │ -
665 }
│ │ │ │ -
666
│ │ │ │ -
667 if( wNotIdentity_ )
│ │ │ │ -
668 {
│ │ │ │ -
669 v *= w_;
│ │ │ │ -
670 }
│ │ │ │ -
671 }
│ │ │ │ -
│ │ │ │ -
672
│ │ │ │ -
│ │ │ │ -
678 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ -
679 {}
│ │ │ │ -
│ │ │ │ -
680
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
683 {
│ │ │ │ - │ │ │ │ -
685 }
│ │ │ │ -
│ │ │ │ -
686
│ │ │ │ -
687 protected:
│ │ │ │ -
689 std::unique_ptr< matrix_type > ILU_;
│ │ │ │ -
690
│ │ │ │ - │ │ │ │ - │ │ │ │ -
694 std::vector< block_type, typename matrix_type::allocator_type > inv_;
│ │ │ │ -
695
│ │ │ │ - │ │ │ │ -
699 const bool wNotIdentity_;
│ │ │ │ -
700 };
│ │ │ │ -
│ │ │ │ -
701 DUNE_REGISTER_PRECONDITIONER("ilu", defaultPreconditionerBlockLevelCreator<Dune::SeqILU>());
│ │ │ │ -
702
│ │ │ │ -
703
│ │ │ │ -
712 template<class X, class Y>
│ │ │ │ -
│ │ │ │ -
713 class Richardson : public Preconditioner<X,Y> {
│ │ │ │ -
714 public:
│ │ │ │ -
716 typedef X domain_type;
│ │ │ │ -
718 typedef Y range_type;
│ │ │ │ -
720 typedef typename X::field_type field_type;
│ │ │ │ -
722 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ -
724 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ -
725
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
732 _w(w)
│ │ │ │ -
733 {}
│ │ │ │ -
│ │ │ │ -
734
│ │ │ │ -
│ │ │ │ -
746 Richardson (const ParameterTree& configuration)
│ │ │ │ -
747 : Richardson(configuration.get<real_field_type>("relaxation", 1.0))
│ │ │ │ -
748 {}
│ │ │ │ -
│ │ │ │ -
749
│ │ │ │ -
│ │ │ │ -
755 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ │ -
756 {}
│ │ │ │ -
│ │ │ │ -
757
│ │ │ │ -
│ │ │ │ -
763 virtual void apply (X& v, const Y& d)
│ │ │ │ -
764 {
│ │ │ │ -
765 v = d;
│ │ │ │ -
766 v *= _w;
│ │ │ │ -
767 }
│ │ │ │ -
│ │ │ │ -
768
│ │ │ │ -
│ │ │ │ -
774 virtual void post ([[maybe_unused]] X& x)
│ │ │ │ -
775 {}
│ │ │ │ -
│ │ │ │ -
776
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
779 {
│ │ │ │ - │ │ │ │ -
781 }
│ │ │ │ -
│ │ │ │ -
782
│ │ │ │ -
783 private:
│ │ │ │ - │ │ │ │ -
786 };
│ │ │ │ -
│ │ │ │ -
787 DUNE_REGISTER_PRECONDITIONER("richardson", [](auto tl, const auto& /* mat */, const ParameterTree& config){
│ │ │ │ -
788 using D = typename Dune::TypeListElement<1, decltype(tl)>::type;
│ │ │ │ -
789 using R = typename Dune::TypeListElement<2, decltype(tl)>::type;
│ │ │ │ -
790 return std::make_shared<Richardson<D,R>>(config);
│ │ │ │ -
791 });
│ │ │ │ -
792
│ │ │ │ -
793
│ │ │ │ -
804 template< class M, class X, class Y >
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
806 : public Preconditioner< X, Y >
│ │ │ │ -
807 {
│ │ │ │ -
808 typedef SeqILDL< M, X, Y > This;
│ │ │ │ - │ │ │ │ -
810
│ │ │ │ -
811 public:
│ │ │ │ -
813 typedef std::remove_const_t< M > matrix_type;
│ │ │ │ -
815 typedef X domain_type;
│ │ │ │ -
817 typedef Y range_type;
│ │ │ │ -
819 typedef typename X::field_type field_type;
│ │ │ │ -
821 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ │ -
823 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ │ -
824
│ │ │ │ -
│ │ │ │ -
837 SeqILDL (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ │ -
838 : SeqILDL(A->getmat(), configuration)
│ │ │ │ -
839 {}
│ │ │ │ -
│ │ │ │ -
840
│ │ │ │ -
│ │ │ │ -
853 SeqILDL(const matrix_type& A, const ParameterTree& config)
│ │ │ │ -
854 : SeqILDL(A, config.get<real_field_type>("relaxation", 1.0))
│ │ │ │ -
855 {}
│ │ │ │ -
│ │ │ │ -
856
│ │ │ │ -
│ │ │ │ -
865 explicit SeqILDL ( const matrix_type &A, real_field_type relax = real_field_type( 1 ) )
│ │ │ │ -
866 : decomposition_( A.N(), A.M(), matrix_type::random ),
│ │ │ │ -
867 relax_( relax )
│ │ │ │ -
868 {
│ │ │ │ -
869 // setup row sizes for lower triangular matrix
│ │ │ │ -
870 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ -
871 {
│ │ │ │ -
872 const auto &A_i = *i;
│ │ │ │ -
873 const auto ij = A_i.find( i.index() );
│ │ │ │ -
874 if( ij != A_i.end() )
│ │ │ │ -
875 decomposition_.setrowsize( i.index(), ij.offset()+1 );
│ │ │ │ -
876 else
│ │ │ │ -
877 DUNE_THROW( ISTLError, "diagonal entry missing" );
│ │ │ │ -
878 }
│ │ │ │ -
879 decomposition_.endrowsizes();
│ │ │ │ -
880
│ │ │ │ -
881 // setup row indices for lower triangular matrix
│ │ │ │ -
882 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ │ -
883 {
│ │ │ │ -
884 const auto &A_i = *i;
│ │ │ │ -
885 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij )
│ │ │ │ -
886 decomposition_.addindex( i.index(), ij.index() );
│ │ │ │ -
887 decomposition_.addindex( i.index(), i.index() );
│ │ │ │ -
888 }
│ │ │ │ -
889 decomposition_.endindices();
│ │ │ │ -
890
│ │ │ │ -
891 // copy values of lower triangular matrix
│ │ │ │ -
892 auto i = A.begin();
│ │ │ │ -
893 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row != rowend; ++row, ++i )
│ │ │ │ -
894 {
│ │ │ │ -
895 auto ij = i->begin();
│ │ │ │ -
896 for( auto col = row->begin(), colend = row->end(); col != colend; ++col, ++ij )
│ │ │ │ -
897 *col = *ij;
│ │ │ │ -
898 }
│ │ │ │ -
899
│ │ │ │ -
900 // perform ILDL decomposition
│ │ │ │ -
901 bildl_decompose( decomposition_ );
│ │ │ │ -
902 }
│ │ │ │ -
│ │ │ │ -
903
│ │ │ │ -
│ │ │ │ -
905 void pre ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override
│ │ │ │ -
906 {}
│ │ │ │ -
│ │ │ │ -
907
│ │ │ │ -
│ │ │ │ -
909 void apply ( X &v, const Y &d ) override
│ │ │ │ -
910 {
│ │ │ │ -
911 bildl_backsolve( decomposition_, v, d, true );
│ │ │ │ -
912 v *= relax_;
│ │ │ │ -
913 }
│ │ │ │ -
│ │ │ │ -
914
│ │ │ │ -
│ │ │ │ -
916 void post ([[maybe_unused]] X &x) override
│ │ │ │ -
917 {}
│ │ │ │ -
│ │ │ │ -
918
│ │ │ │ - │ │ │ │ -
921
│ │ │ │ -
922 private:
│ │ │ │ -
923 matrix_type decomposition_;
│ │ │ │ -
924 real_field_type relax_;
│ │ │ │ -
925 };
│ │ │ │ -
│ │ │ │ -
926 DUNE_REGISTER_PRECONDITIONER("ildl", defaultPreconditionerCreator<Dune::SeqILDL>());
│ │ │ │ -
927
│ │ │ │ -
930} // end namespace
│ │ │ │ -
931
│ │ │ │ -
932
│ │ │ │ -
933#endif
│ │ │ │ -
Incomplete LDL decomposition.
│ │ │ │ - │ │ │ │ -
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ │ - │ │ │ │ - │ │ │ │ -
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:16
│ │ │ │ -
Some handy generic functions for ISTL matrices.
│ │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ │ -
The incomplete LU factorization kernels.
│ │ │ │ - │ │ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ │ -
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition gsetc.hh:646
│ │ │ │ -
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition gsetc.hh:658
│ │ │ │ -
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition gsetc.hh:634
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ │ +
7#define DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ │ +
8
│ │ │ │ + │ │ │ │ + │ │ │ │ +
11#include <dune/istl/solver.hh>
│ │ │ │ +
12
│ │ │ │ +
│ │ │ │ +
13#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \
│ │ │ │ +
14 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__)
│ │ │ │ +
│ │ │ │ +
15
│ │ │ │ +
│ │ │ │ +
16#define DUNE_REGISTER_PRECONDITIONER(name, ...) \
│ │ │ │ +
17 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
│ │ │ │ +
│ │ │ │ +
18
│ │ │ │ +
│ │ │ │ +
19#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \
│ │ │ │ +
20 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__)
│ │ │ │ +
│ │ │ │ +
21
│ │ │ │ +
22namespace Dune{
│ │ │ │ +
27 namespace {
│ │ │ │ +
28 struct DirectSolverTag {};
│ │ │ │ +
29 struct PreconditionerTag {};
│ │ │ │ +
30 struct IterativeSolverTag {};
│ │ │ │ +
31 }
│ │ │ │ +
32 template<template<class,class,class,int>class Preconditioner, int blockLevel=1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
34 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& config)
│ │ │ │ +
35 {
│ │ │ │ +
36 using Matrix = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ │ +
37 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ │ +
38 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type;
│ │ │ │ +
39 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
│ │ │ │ +
40 = std::make_shared<Preconditioner<Matrix, Domain, Range, blockLevel>>(matrix, config);
│ │ │ │ +
41 return preconditioner;
│ │ │ │ +
42 };
│ │ │ │ +
43 }
│ │ │ │ +
│ │ │ │ +
44
│ │ │ │ +
45 template<template<class,class,class>class Preconditioner>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
47 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& config)
│ │ │ │ +
48 {
│ │ │ │ +
49 using Matrix = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ │ +
50 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ │ +
51 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type;
│ │ │ │ +
52 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
│ │ │ │ +
53 = std::make_shared<Preconditioner<Matrix, Domain, Range>>(matrix, config);
│ │ │ │ +
54 return preconditioner;
│ │ │ │ +
55 };
│ │ │ │ +
56 }
│ │ │ │ +
│ │ │ │ +
57
│ │ │ │ +
58 template<template<class...>class Solver>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
60 return [](auto typeList,
│ │ │ │ +
61 const auto& linearOperator,
│ │ │ │ +
62 const auto& scalarProduct,
│ │ │ │ +
63 const auto& preconditioner,
│ │ │ │ +
64 const Dune::ParameterTree& config)
│ │ │ │ +
65 {
│ │ │ │ +
66 using Domain = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ │ +
67 using Range = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ │ +
68 std::shared_ptr<Dune::InverseOperator<Domain, Range>> solver
│ │ │ │ +
69 = std::make_shared<Solver<Domain>>(linearOperator, scalarProduct, preconditioner, config);
│ │ │ │ +
70 return solver;
│ │ │ │ +
71 };
│ │ │ │ +
72 }
│ │ │ │ +
│ │ │ │ +
73
│ │ │ │ +
74 /* This exception is thrown, when the requested solver is in the factory but
│ │ │ │ +
75 cannot be instantiated for the required template parameters
│ │ │ │ +
76 */
│ │ │ │ +
77 class UnsupportedType : public NotImplemented {};
│ │ │ │ +
78
│ │ │ │ +
79 class InvalidSolverFactoryConfiguration : public InvalidStateException{};
│ │ │ │ +
80} // end namespace Dune
│ │ │ │ +
81
│ │ │ │ +
82#endif // DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ │ + │ │ │ │ + │ │ │ │ +
Define general, extensible interface for inverse operators.
│ │ │ │ +
auto defaultIterativeSolverCreator()
Definition solverregistry.hh:59
│ │ │ │ +
auto defaultPreconditionerBlockLevelCreator()
Definition solverregistry.hh:33
│ │ │ │ +
auto defaultPreconditionerCreator()
Definition solverregistry.hh:46
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
void bildl_decompose(Matrix &A)
compute ILDL decomposition of a symmetric matrix A
Definition ildl.hh:88
│ │ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ │ -
void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
Definition ildl.hh:149
│ │ │ │ -
void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv)
convert ILU decomposition into CRS format for lower and upper triangular and inverse.
Definition ilu.hh:307
│ │ │ │ -
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ │ -
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ │ -
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ │ -
compile-time parameter for block recursion depth
Definition gsetc.hh:45
│ │ │ │ -
a simple compressed row storage matrix class
Definition ilu.hh:259
│ │ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ │ -
size_type M() const
Return the number of columns.
Definition matrix.hh:700
│ │ │ │ -
size_type N() const
Return the number of rows.
Definition matrix.hh:695
│ │ │ │ -
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:109
│ │ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:32
│ │ │ │ -
Turns an InverseOperator into a Preconditioner.
Definition preconditioners.hh:75
│ │ │ │ -
O::range_type range_type
The range type of the preconditioner.
Definition preconditioners.hh:80
│ │ │ │ -
O::domain_type domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:78
│ │ │ │ -
virtual void post(domain_type &)
Clean up.
Definition preconditioners.hh:111
│ │ │ │ -
range_type::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:82
│ │ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:86
│ │ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:84
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:115
│ │ │ │ -
virtual void pre(domain_type &, range_type &)
Prepare the preconditioner.
Definition preconditioners.hh:101
│ │ │ │ -
InverseOperator2Preconditioner(InverseOperator &inverse_operator)
Construct the preconditioner from the solver.
Definition preconditioners.hh:94
│ │ │ │ -
O InverseOperator
type of the wrapped inverse operator
Definition preconditioners.hh:88
│ │ │ │ -
virtual void apply(domain_type &v, const range_type &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:104
│ │ │ │ -
Sequential SSOR preconditioner.
Definition preconditioners.hh:141
│ │ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:229
│ │ │ │ -
SeqSSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:182
│ │ │ │ -
SeqSSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:199
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:233
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:150
│ │ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:152
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:146
│ │ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:144
│ │ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:216
│ │ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:208
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:148
│ │ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:154
│ │ │ │ -
SeqSSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:163
│ │ │ │ -
Sequential SOR preconditioner.
Definition preconditioners.hh:261
│ │ │ │ -
SeqSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:302
│ │ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:264
│ │ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:274
│ │ │ │ -
void apply(X &v, const Y &d)
Apply the preconditioner in a special direction.
Definition preconditioners.hh:350
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:266
│ │ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:367
│ │ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:328
│ │ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:272
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:371
│ │ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:336
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:268
│ │ │ │ -
SeqSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:319
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:270
│ │ │ │ -
SeqSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:283
│ │ │ │ -
The sequential jacobian preconditioner.
Definition preconditioners.hh:412
│ │ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:499
│ │ │ │ -
SeqJac(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:470
│ │ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:487
│ │ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:415
│ │ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:423
│ │ │ │ -
SeqJac(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:453
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:421
│ │ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:479
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:417
│ │ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:425
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:503
│ │ │ │ -
SeqJac(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:434
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:419
│ │ │ │ -
Sequential ILU preconditioner.
Definition preconditioners.hh:532
│ │ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:678
│ │ │ │ -
SeqILU(const M &A, int n, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:612
│ │ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:648
│ │ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:656
│ │ │ │ -
ILU::CRS< block_type, typename M::allocator_type > CRS
type of ILU storage
Definition preconditioners.hh:552
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:541
│ │ │ │ -
CRS lower_
The ILU(n) decomposition of the matrix. As storage a CRS structure is used.
Definition preconditioners.hh:692
│ │ │ │ -
const bool wNotIdentity_
true if w != 1.0
Definition preconditioners.hh:699
│ │ │ │ -
SeqILU(const M &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:598
│ │ │ │ -
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:535
│ │ │ │ -
matrix_type::block_type block_type
block type of matrix
Definition preconditioners.hh:537
│ │ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:549
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:544
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:682
│ │ │ │ -
SeqILU(const M &A, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:561
│ │ │ │ -
const real_field_type w_
The relaxation factor to use.
Definition preconditioners.hh:697
│ │ │ │ -
SeqILU(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:580
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:539
│ │ │ │ -
std::vector< block_type, typename matrix_type::allocator_type > inv_
Definition preconditioners.hh:694
│ │ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:547
│ │ │ │ -
std::unique_ptr< matrix_type > ILU_
The ILU(n) decomposition of the matrix. As storage a BCRSMatrix is used.
Definition preconditioners.hh:689
│ │ │ │ -
CRS upper_
Definition preconditioners.hh:693
│ │ │ │ -
Richardson preconditioner.
Definition preconditioners.hh:713
│ │ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:720
│ │ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:778
│ │ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:718
│ │ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:755
│ │ │ │ -
Richardson(real_field_type w=1.0)
Constructor.
Definition preconditioners.hh:731
│ │ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:774
│ │ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:724
│ │ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:722
│ │ │ │ -
Richardson(const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:746
│ │ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:716
│ │ │ │ -
virtual void apply(X &v, const Y &d)
Apply the precondioner.
Definition preconditioners.hh:763
│ │ │ │ -
sequential ILDL preconditioner
Definition preconditioners.hh:807
│ │ │ │ -
SeqILDL(const matrix_type &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:853
│ │ │ │ -
SeqILDL(const matrix_type &A, real_field_type relax=real_field_type(1))
constructor
Definition preconditioners.hh:865
│ │ │ │ -
X domain_type
domain type of the preconditioner
Definition preconditioners.hh:815
│ │ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:916
│ │ │ │ -
Y range_type
range type of the preconditioner
Definition preconditioners.hh:817
│ │ │ │ -
std::remove_const_t< M > matrix_type
type of matrix the preconditioner is for
Definition preconditioners.hh:813
│ │ │ │ -
void apply(X &v, const Y &d) override
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:909
│ │ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:823
│ │ │ │ -
SeqILDL(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:837
│ │ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:905
│ │ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:821
│ │ │ │ -
X::field_type field_type
field type of the preconditioner
Definition preconditioners.hh:819
│ │ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:920
│ │ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:48
│ │ │ │ -
Abstract base class for all solvers.
Definition solver.hh:99
│ │ │ │ -
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
│ │ │ │ +
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:176
│ │ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ │ +
Definition solverregistry.hh:77
│ │ │ │ +
Definition solverregistry.hh:79
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,1027 +1,120 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -preconditioners.hh │ │ │ │ │ +solverregistry.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 (C) 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 │ │ │ │ │ -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 "_i_l_d_l_._h_h" │ │ │ │ │ -26#include "_i_l_u_._h_h" │ │ │ │ │ -27 │ │ │ │ │ -28 │ │ │ │ │ -29namespace _D_u_n_e { │ │ │ │ │ -72 template │ │ │ │ │ -_7_3 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 : │ │ │ │ │ -74 public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -75 { │ │ │ │ │ -76 public: │ │ │ │ │ -_7_8 typedef typename O::domain_type _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_8_0 typedef typename O::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_8_2 typedef typename range_type::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_8_4 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_8_6 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_8_8 typedef O _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r; │ │ │ │ │ -89 │ │ │ │ │ -_9_4 _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) │ │ │ │ │ -95 : inverse_operator_(inverse_operator) │ │ │ │ │ -96 { │ │ │ │ │ -97 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) │ │ │ │ │ -98 DUNE_THROW(InvalidStateException, "User-supplied solver category does not │ │ │ │ │ -match that of the given inverse operator"); │ │ │ │ │ -99 } │ │ │ │ │ -100 │ │ │ │ │ -_1_0_1 virtual void _p_r_e(_d_o_m_a_i_n___t_y_p_e&,_r_a_n_g_e___t_y_p_e&) │ │ │ │ │ -102 {} │ │ │ │ │ -103 │ │ │ │ │ -_1_0_4 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& d) │ │ │ │ │ -105 { │ │ │ │ │ -106 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ │ -107 _r_a_n_g_e___t_y_p_e copy(d); │ │ │ │ │ -108 inverse_operator_.apply(v, copy, res); │ │ │ │ │ -109 } │ │ │ │ │ -110 │ │ │ │ │ -_1_1_1 virtual void _p_o_s_t(_d_o_m_a_i_n___t_y_p_e&) │ │ │ │ │ -112 {} │ │ │ │ │ -113 │ │ │ │ │ -_1_1_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 │ │ │ │ │ -116 { │ │ │ │ │ -117 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_); │ │ │ │ │ -118 } │ │ │ │ │ -119 │ │ │ │ │ -120 private: │ │ │ │ │ -121 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r& inverse_operator_; │ │ │ │ │ -122 }; │ │ │ │ │ -123 │ │ │ │ │ -124 //===================================================================== │ │ │ │ │ -125 // Implementation of this interface for sequential ISTL-preconditioners │ │ │ │ │ -126 //===================================================================== │ │ │ │ │ -127 │ │ │ │ │ -128 │ │ │ │ │ -140 template │ │ │ │ │ -_1_4_1 class _S_e_q_S_S_O_R : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ -142 public: │ │ │ │ │ -_1_4_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_1_4_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_1_4_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_1_5_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_1_5_2 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_1_5_4 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -155 │ │ │ │ │ -_1_6_3 _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) │ │ │ │ │ -164 : _A_(A), _n(n), _w(w) │ │ │ │ │ -165 { │ │ │ │ │ -166 _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_); │ │ │ │ │ -167 } │ │ │ │ │ -168 │ │ │ │ │ -_1_8_2 _S_e_q_S_S_O_R (const std::shared_ptr>& A, │ │ │ │ │ -const ParameterTree& configuration) │ │ │ │ │ -183 : _S_e_q_S_S_O_R(A->getmat(), configuration) │ │ │ │ │ -184 {} │ │ │ │ │ -185 │ │ │ │ │ -_1_9_9 _S_e_q_S_S_O_R (const M& A, const ParameterTree& configuration) │ │ │ │ │ -200 : _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)) │ │ │ │ │ -201 {} │ │ │ │ │ -202 │ │ │ │ │ -_2_0_8 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ -209 {} │ │ │ │ │ -210 │ │ │ │ │ -_2_1_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -217 { │ │ │ │ │ -218 for (int i=0; i<_n; i++) { │ │ │ │ │ -219 _b_s_o_r_f(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ -220 _b_s_o_r_b(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ -221 } │ │ │ │ │ -222 } │ │ │ │ │ -223 │ │ │ │ │ -_2_2_9 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ -230 {} │ │ │ │ │ -231 │ │ │ │ │ -_2_3_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -234 { │ │ │ │ │ -235 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ │ -236 } │ │ │ │ │ -237 │ │ │ │ │ -238 private: │ │ │ │ │ -240 const M& _A_; │ │ │ │ │ -242 int _n; │ │ │ │ │ -244 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ -245 }; │ │ │ │ │ -_2_4_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("ssor", │ │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ -247 │ │ │ │ │ -248 │ │ │ │ │ -260 template │ │ │ │ │ -_2_6_1 class _S_e_q_S_O_R : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ │ -262 public: │ │ │ │ │ -_2_6_4 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_2_6_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_2_6_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_2_7_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_2_7_2 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_2_7_4 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -275 │ │ │ │ │ -_2_8_3 _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) │ │ │ │ │ -284 : _A_(A), _n(n), _w(w) │ │ │ │ │ -285 { │ │ │ │ │ -286 _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_); │ │ │ │ │ -287 } │ │ │ │ │ -288 │ │ │ │ │ -_3_0_2 _S_e_q_S_O_R (const std::shared_ptr>& A, │ │ │ │ │ -const ParameterTree& configuration) │ │ │ │ │ -303 : _S_e_q_S_O_R(A->getmat(), configuration) │ │ │ │ │ -304 {} │ │ │ │ │ -305 │ │ │ │ │ -_3_1_9 _S_e_q_S_O_R (const M& A, const ParameterTree& configuration) │ │ │ │ │ -320 : _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)) │ │ │ │ │ -321 {} │ │ │ │ │ -322 │ │ │ │ │ -_3_2_8 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ -329 {} │ │ │ │ │ -330 │ │ │ │ │ -_3_3_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -337 { │ │ │ │ │ -338 this->template apply(v,d); │ │ │ │ │ -339 } │ │ │ │ │ -340 │ │ │ │ │ -349 template │ │ │ │ │ -_3_5_0 void _a_p_p_l_y(X& v, const Y& d) │ │ │ │ │ -351 { │ │ │ │ │ -352 if(forward) │ │ │ │ │ -353 for (int i=0; i<_n; i++) { │ │ │ │ │ -354 _b_s_o_r_f(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ -355 } │ │ │ │ │ -356 else │ │ │ │ │ -357 for (int i=0; i<_n; i++) { │ │ │ │ │ -358 _b_s_o_r_b(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ -359 } │ │ │ │ │ -360 } │ │ │ │ │ -361 │ │ │ │ │ -_3_6_7 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ -368 {} │ │ │ │ │ -369 │ │ │ │ │ -_3_7_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 │ │ │ │ │ -372 { │ │ │ │ │ -373 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; │ │ │ │ │ -374 } │ │ │ │ │ -375 │ │ │ │ │ -376 private: │ │ │ │ │ -378 const M& _A_; │ │ │ │ │ -380 int _n; │ │ │ │ │ -382 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ -383 }; │ │ │ │ │ -_3_8_4 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("sor", │ │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ -385 │ │ │ │ │ -386 │ │ │ │ │ -397 template │ │ │ │ │ -_3_9_8 using _S_e_q_G_S = _S_e_q_S_O_R_<_M_,_X_,_Y_,_l_>; │ │ │ │ │ -_3_9_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("gs", │ │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ -400 │ │ │ │ │ -411 template │ │ │ │ │ -_4_1_2 class _S_e_q_J_a_c : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_> { │ │ │ │ │ -413 public: │ │ │ │ │ -_4_1_5 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_4_1_7 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_4_1_9 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_4_2_1 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_4_2_3 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_4_2_5 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -426 │ │ │ │ │ -_4_3_4 _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) │ │ │ │ │ -435 : _A_(A), _n(n), _w(w) │ │ │ │ │ -436 { │ │ │ │ │ -437 _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_); │ │ │ │ │ -438 } │ │ │ │ │ -439 │ │ │ │ │ -_4_5_3 _S_e_q_J_a_c (const std::shared_ptr>& A, │ │ │ │ │ -const ParameterTree& configuration) │ │ │ │ │ -454 : _S_e_q_J_a_c(A->getmat(), configuration) │ │ │ │ │ -455 {} │ │ │ │ │ -456 │ │ │ │ │ -_4_7_0 _S_e_q_J_a_c (const M& A, const ParameterTree& configuration) │ │ │ │ │ -471 : _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)) │ │ │ │ │ -472 {} │ │ │ │ │ -473 │ │ │ │ │ -_4_7_9 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ -480 {} │ │ │ │ │ -481 │ │ │ │ │ -_4_8_7 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -488 { │ │ │ │ │ -489 for (int i=0; i<_n; i++) { │ │ │ │ │ -490 _d_b_j_a_c(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ │ -491 } │ │ │ │ │ -492 } │ │ │ │ │ -493 │ │ │ │ │ -_4_9_9 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ -500 {} │ │ │ │ │ -501 │ │ │ │ │ -_5_0_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -504 { │ │ │ │ │ -505 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; │ │ │ │ │ -506 } │ │ │ │ │ -507 │ │ │ │ │ -508 private: │ │ │ │ │ -510 const M& _A_; │ │ │ │ │ -512 int _n; │ │ │ │ │ -514 real_field_type _w; │ │ │ │ │ -515 }; │ │ │ │ │ -_5_1_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("jac", │ │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ -517 │ │ │ │ │ -518 │ │ │ │ │ -519 │ │ │ │ │ -531 template │ │ │ │ │ -_5_3_2 class _S_e_q_I_L_U : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_> { │ │ │ │ │ -533 public: │ │ │ │ │ -_5_3_5 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_5_3_7 typedef typename matrix_type :: block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ │ -_5_3_9 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_5_4_1 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -542 │ │ │ │ │ -_5_4_4 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -545 │ │ │ │ │ -_5_4_7 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_5_4_9 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -550 │ │ │ │ │ -_5_5_2 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; │ │ │ │ │ -553 │ │ │ │ │ -_5_6_1 _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 ) │ │ │ │ │ -562 : _S_e_q_I_L_U( A, 0, w, resort ) // construct ILU(0) │ │ │ │ │ -563 { │ │ │ │ │ -564 } │ │ │ │ │ -565 │ │ │ │ │ -_5_8_0 _S_e_q_I_L_U (const std::shared_ptr>& A, │ │ │ │ │ -const ParameterTree& configuration) │ │ │ │ │ -581 : _S_e_q_I_L_U(A->getmat(), configuration) │ │ │ │ │ -582 {} │ │ │ │ │ -583 │ │ │ │ │ -_5_9_8 _S_e_q_I_L_U(const M& A, const ParameterTree& config) │ │ │ │ │ -599 : _S_e_q_I_L_U(A, config._g_e_t("n", 0), │ │ │ │ │ -600 config._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation", 1.0), │ │ │ │ │ -601 config._g_e_t("resort", false)) │ │ │ │ │ -602 {} │ │ │ │ │ -603 │ │ │ │ │ -_6_1_2 _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 ) │ │ │ │ │ -613 : ILU_(), │ │ │ │ │ -614 lower_(), │ │ │ │ │ -615 upper_(), │ │ │ │ │ -616 inv_(), │ │ │ │ │ -617 w_(w), │ │ │ │ │ -618 wNotIdentity_([w]{using std::abs; return abs(w - _r_e_a_l___f_i_e_l_d___t_y_p_e(1)) > 1e- │ │ │ │ │ -15;}() ) │ │ │ │ │ -619 { │ │ │ │ │ -620 if( n == 0 ) │ │ │ │ │ -621 { │ │ │ │ │ -622 // copy A │ │ │ │ │ -623 ILU_.reset( new matrix_type( A ) ); │ │ │ │ │ -624 // create ILU(0) decomposition │ │ │ │ │ -625 _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( *ILU_ ); │ │ │ │ │ -626 } │ │ │ │ │ -627 else │ │ │ │ │ -628 { │ │ │ │ │ -629 // create matrix in build mode │ │ │ │ │ -630 ILU_.reset( new matrix_type( A._N(), A._M(), matrix_type::row_wise) ); │ │ │ │ │ -631 // create ILU(n) decomposition │ │ │ │ │ -632 _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, *ILU_ ); │ │ │ │ │ -633 } │ │ │ │ │ -634 │ │ │ │ │ -635 if( resort ) │ │ │ │ │ -636 { │ │ │ │ │ -637 // store ILU in simple CRS format │ │ │ │ │ -638 _I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S( *ILU_, lower_, upper_, inv_ ); │ │ │ │ │ -639 ILU_.reset(); │ │ │ │ │ -640 } │ │ │ │ │ -641 } │ │ │ │ │ -642 │ │ │ │ │ -_6_4_8 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ -649 {} │ │ │ │ │ -650 │ │ │ │ │ -_6_5_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -657 { │ │ │ │ │ -658 if( ILU_ ) │ │ │ │ │ -659 { │ │ │ │ │ -660 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e( *ILU_, v, d); │ │ │ │ │ -661 } │ │ │ │ │ -662 else │ │ │ │ │ -663 { │ │ │ │ │ -664 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e(lower_, upper_, inv_, v, d); │ │ │ │ │ -665 } │ │ │ │ │ -666 │ │ │ │ │ -667 if( wNotIdentity_ ) │ │ │ │ │ -668 { │ │ │ │ │ -669 v *= w_; │ │ │ │ │ -670 } │ │ │ │ │ -671 } │ │ │ │ │ -672 │ │ │ │ │ -_6_7_8 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ -679 {} │ │ │ │ │ -680 │ │ │ │ │ -_6_8_2 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -683 { │ │ │ │ │ -684 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; │ │ │ │ │ -685 } │ │ │ │ │ -686 │ │ │ │ │ -687 protected: │ │ │ │ │ -_6_8_9 std::unique_ptr< matrix_type > _I_L_U__; │ │ │ │ │ -690 │ │ │ │ │ -_6_9_2 _C_R_S _l_o_w_e_r__; │ │ │ │ │ -_6_9_3 _C_R_S _u_p_p_e_r__; │ │ │ │ │ -_6_9_4 std::vector< block_type, typename matrix_type::allocator_type > _i_n_v__; │ │ │ │ │ -695 │ │ │ │ │ -_6_9_7 const _r_e_a_l___f_i_e_l_d___t_y_p_e _w__; │ │ │ │ │ -_6_9_9 const bool _w_N_o_t_I_d_e_n_t_i_t_y__; │ │ │ │ │ -700 }; │ │ │ │ │ -_7_0_1 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("ilu", │ │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ │ -702 │ │ │ │ │ -703 │ │ │ │ │ -712 template │ │ │ │ │ -_7_1_3 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 { │ │ │ │ │ -714 public: │ │ │ │ │ -_7_1_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_7_1_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_7_2_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_7_2_2 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_7_2_4 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -725 │ │ │ │ │ -_7_3_1 _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) : │ │ │ │ │ -732 _w(w) │ │ │ │ │ -733 {} │ │ │ │ │ -734 │ │ │ │ │ -_7_4_6 _R_i_c_h_a_r_d_s_o_n (const ParameterTree& configuration) │ │ │ │ │ -747 : _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)) │ │ │ │ │ -748 {} │ │ │ │ │ -749 │ │ │ │ │ -_7_5_5 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ │ -756 {} │ │ │ │ │ -757 │ │ │ │ │ -_7_6_3 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ -764 { │ │ │ │ │ -765 v = d; │ │ │ │ │ -766 v *= _w; │ │ │ │ │ -767 } │ │ │ │ │ -768 │ │ │ │ │ -_7_7_4 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ │ -775 {} │ │ │ │ │ -776 │ │ │ │ │ -_7_7_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 │ │ │ │ │ -779 { │ │ │ │ │ -780 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; │ │ │ │ │ -781 } │ │ │ │ │ -782 │ │ │ │ │ -783 private: │ │ │ │ │ -785 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ │ -786 }; │ │ │ │ │ -_7_8_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("richardson", [](auto tl, const auto& /* mat │ │ │ │ │ -*/, const ParameterTree& config){ │ │ │ │ │ -788 using D = typename Dune::TypeListElement<1, decltype(tl)>::type; │ │ │ │ │ -789 using R = typename Dune::TypeListElement<2, decltype(tl)>::type; │ │ │ │ │ -790 return std::make_shared>(config); │ │ │ │ │ -791 }); │ │ │ │ │ -792 │ │ │ │ │ -793 │ │ │ │ │ -804 template< class M, class X, class Y > │ │ │ │ │ -_8_0_5 class _S_e_q_I_L_D_L │ │ │ │ │ -806 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ │ -807 { │ │ │ │ │ -808 typedef _S_e_q_I_L_D_L_<_ _M_,_ _X_,_ _Y_ _> _T_h_i_s; │ │ │ │ │ -809 typedef _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_ _> _B_a_s_e; │ │ │ │ │ -810 │ │ │ │ │ -811 public: │ │ │ │ │ -_8_1_3 typedef std::remove_const_t< M > _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_8_1_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_8_1_7 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_8_1_9 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_8_2_1 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -_8_2_3 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ │ -824 │ │ │ │ │ -_8_3_7 _S_e_q_I_L_D_L (const std::shared_ptr>& A, │ │ │ │ │ -const ParameterTree& configuration) │ │ │ │ │ -838 : _S_e_q_I_L_D_L(A->getmat(), configuration) │ │ │ │ │ -839 {} │ │ │ │ │ -840 │ │ │ │ │ -_8_5_3 _S_e_q_I_L_D_L(const _m_a_t_r_i_x___t_y_p_e& A, const ParameterTree& config) │ │ │ │ │ -854 : _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)) │ │ │ │ │ -855 {} │ │ │ │ │ -856 │ │ │ │ │ -_8_6_5 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 ) ) │ │ │ │ │ -866 : decomposition_( A.N(), A.M(), _m_a_t_r_i_x___t_y_p_e::random ), │ │ │ │ │ -867 relax_( relax ) │ │ │ │ │ -868 { │ │ │ │ │ -869 // setup row sizes for lower triangular matrix │ │ │ │ │ -870 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ │ -871 { │ │ │ │ │ -872 const auto &A_i = *i; │ │ │ │ │ -873 const auto ij = A_i.find( i.index() ); │ │ │ │ │ -874 if( ij != A_i.end() ) │ │ │ │ │ -875 decomposition_.setrowsize( i.index(), ij.offset()+1 ); │ │ │ │ │ -876 else │ │ │ │ │ -877 DUNE_THROW( _I_S_T_L_E_r_r_o_r, "diagonal entry missing" ); │ │ │ │ │ -878 } │ │ │ │ │ -879 decomposition_.endrowsizes(); │ │ │ │ │ -880 │ │ │ │ │ -881 // setup row indices for lower triangular matrix │ │ │ │ │ -882 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ │ -883 { │ │ │ │ │ -884 const auto &A_i = *i; │ │ │ │ │ -885 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij ) │ │ │ │ │ -886 decomposition_.addindex( i.index(), ij.index() ); │ │ │ │ │ -887 decomposition_.addindex( i.index(), i.index() ); │ │ │ │ │ -888 } │ │ │ │ │ -889 decomposition_.endindices(); │ │ │ │ │ -890 │ │ │ │ │ -891 // copy values of lower triangular matrix │ │ │ │ │ -892 auto i = A.begin(); │ │ │ │ │ -893 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row │ │ │ │ │ -!= rowend; ++row, ++i ) │ │ │ │ │ -894 { │ │ │ │ │ -895 auto ij = i->begin(); │ │ │ │ │ -896 for( auto _c_o_l = row->begin(), colend = row->end(); _c_o_l != colend; ++_c_o_l, │ │ │ │ │ -++ij ) │ │ │ │ │ -897 *_c_o_l = *ij; │ │ │ │ │ -898 } │ │ │ │ │ -899 │ │ │ │ │ -900 // perform ILDL decomposition │ │ │ │ │ -901 _b_i_l_d_l___d_e_c_o_m_p_o_s_e( decomposition_ ); │ │ │ │ │ -902 } │ │ │ │ │ -903 │ │ │ │ │ -_9_0_5 void _p_r_e ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override │ │ │ │ │ -906 {} │ │ │ │ │ -907 │ │ │ │ │ -_9_0_9 void _a_p_p_l_y ( X &v, const Y &d ) override │ │ │ │ │ -910 { │ │ │ │ │ -911 _b_i_l_d_l___b_a_c_k_s_o_l_v_e( decomposition_, v, d, true ); │ │ │ │ │ -912 v *= relax_; │ │ │ │ │ -913 } │ │ │ │ │ -914 │ │ │ │ │ -_9_1_6 void _p_o_s_t ([[maybe_unused]] X &x) override │ │ │ │ │ -917 {} │ │ │ │ │ -918 │ │ │ │ │ -_9_2_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 { 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; } │ │ │ │ │ -921 │ │ │ │ │ -922 private: │ │ │ │ │ -923 _m_a_t_r_i_x___t_y_p_e decomposition_; │ │ │ │ │ -924 _r_e_a_l___f_i_e_l_d___t_y_p_e relax_; │ │ │ │ │ -925 }; │ │ │ │ │ -_9_2_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("ildl", defaultPreconditionerCreator()); │ │ │ │ │ -927 │ │ │ │ │ -930} // end namespace │ │ │ │ │ -931 │ │ │ │ │ -932 │ │ │ │ │ -933#endif │ │ │ │ │ -_i_l_d_l_._h_h │ │ │ │ │ -Incomplete LDL decomposition. │ │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ -_g_s_e_t_c_._h_h │ │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ │ -generic way. │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ │ +7#define DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ │ +8 │ │ │ │ │ +9#include <_d_u_n_e_/_i_s_t_l_/_c_o_m_m_o_n_/_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h> │ │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ │ +12 │ │ │ │ │ +_1_3#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \ │ │ │ │ │ +14 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__) │ │ │ │ │ +15 │ │ │ │ │ +_1_6#define DUNE_REGISTER_PRECONDITIONER(name, ...) \ │ │ │ │ │ +17 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__) │ │ │ │ │ +18 │ │ │ │ │ +_1_9#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \ │ │ │ │ │ +20 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__) │ │ │ │ │ +21 │ │ │ │ │ +22namespace _D_u_n_e{ │ │ │ │ │ +27 namespace { │ │ │ │ │ +28 struct DirectSolverTag {}; │ │ │ │ │ +29 struct PreconditionerTag {}; │ │ │ │ │ +30 struct IterativeSolverTag {}; │ │ │ │ │ +31 } │ │ │ │ │ +32 templateclass Preconditioner, int │ │ │ │ │ +_b_l_o_c_k_L_e_v_e_l=1> │ │ │ │ │ +_3_3 auto _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r(){ │ │ │ │ │ +34 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& │ │ │ │ │ +config) │ │ │ │ │ +35 { │ │ │ │ │ +36 using _M_a_t_r_i_x = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ │ +37 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ │ +38 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type; │ │ │ │ │ +39 std::shared_ptr> preconditioner │ │ │ │ │ +40 = std::make_shared> │ │ │ │ │ +(matrix, config); │ │ │ │ │ +41 return preconditioner; │ │ │ │ │ +42 }; │ │ │ │ │ +43 } │ │ │ │ │ +44 │ │ │ │ │ +45 templateclass Preconditioner> │ │ │ │ │ +_4_6 auto _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r(){ │ │ │ │ │ +47 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& │ │ │ │ │ +config) │ │ │ │ │ +48 { │ │ │ │ │ +49 using _M_a_t_r_i_x = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ │ +50 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ │ +51 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type; │ │ │ │ │ +52 std::shared_ptr> preconditioner │ │ │ │ │ +53 = std::make_shared>(matrix, config); │ │ │ │ │ +54 return preconditioner; │ │ │ │ │ +55 }; │ │ │ │ │ +56 } │ │ │ │ │ +57 │ │ │ │ │ +58 templateclass Solver> │ │ │ │ │ +_5_9 auto _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r(){ │ │ │ │ │ +60 return [](auto typeList, │ │ │ │ │ +61 const auto& linearOperator, │ │ │ │ │ +62 const auto& scalarProduct, │ │ │ │ │ +63 const auto& preconditioner, │ │ │ │ │ +64 const Dune::ParameterTree& config) │ │ │ │ │ +65 { │ │ │ │ │ +66 using Domain = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ │ +67 using Range = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ │ +68 std::shared_ptr> solver │ │ │ │ │ +69 = std::make_shared>(linearOperator, scalarProduct, │ │ │ │ │ +preconditioner, config); │ │ │ │ │ +70 return solver; │ │ │ │ │ +71 }; │ │ │ │ │ +72 } │ │ │ │ │ +73 │ │ │ │ │ +74 /* This exception is thrown, when the requested solver is in the factory but │ │ │ │ │ +75 cannot be instantiated for the required template parameters │ │ │ │ │ +76 */ │ │ │ │ │ +_7_7 class _U_n_s_u_p_p_o_r_t_e_d_T_y_p_e : public NotImplemented {}; │ │ │ │ │ +78 │ │ │ │ │ +_7_9 class _I_n_v_a_l_i_d_S_o_l_v_e_r_F_a_c_t_o_r_y_C_o_n_f_i_g_u_r_a_t_i_o_n : public InvalidStateException{}; │ │ │ │ │ +80} // end namespace Dune │ │ │ │ │ +81 │ │ │ │ │ +82#endif // DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ │ +_r_e_g_i_s_t_r_y_._h_h │ │ │ │ │ _p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h │ │ │ │ │ -_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h │ │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R │ │ │ │ │ -#define DUNE_REGISTER_PRECONDITIONER(name,...) │ │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ │ -_m_a_t_r_i_x_u_t_i_l_s_._h_h │ │ │ │ │ -Some handy generic functions for ISTL matrices. │ │ │ │ │ _s_o_l_v_e_r_._h_h │ │ │ │ │ Define general, extensible interface for inverse operators. │ │ │ │ │ -_i_l_u_._h_h │ │ │ │ │ -The incomplete LU factorization kernels. │ │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ -_c_o_l │ │ │ │ │ -Col col │ │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ -_D_u_n_e_:_:_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_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r │ │ │ │ │ +auto defaultIterativeSolverCreator() │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r │ │ │ │ │ +auto defaultPreconditionerBlockLevelCreator() │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r │ │ │ │ │ +auto defaultPreconditionerCreator() │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:46 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e │ │ │ │ │ -void bildl_decompose(Matrix &A) │ │ │ │ │ -compute ILDL decomposition of a symmetric matrix A │ │ │ │ │ -DDeeffiinniittiioonn ildl.hh:88 │ │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_b_i_l_d_l___b_a_c_k_s_o_l_v_e │ │ │ │ │ -void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool │ │ │ │ │ -isLowerTriangular=false) │ │ │ │ │ -DDeeffiinniittiioonn ildl.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S │ │ │ │ │ -void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv) │ │ │ │ │ -convert ILU decomposition into CRS format for lower and upper triangular and │ │ │ │ │ -inverse. │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:307 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ │ -void blockILUBacksolve(const M &A, X &v, const Y &d) │ │ │ │ │ -LU backsolve with stored inverse. │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ -void blockILU0Decomposition(M &A) │ │ │ │ │ -compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ -void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ │ -_D_u_n_e_:_:_B_L │ │ │ │ │ -compile-time parameter for block recursion depth │ │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S │ │ │ │ │ -a simple compressed row storage matrix class │ │ │ │ │ -DDeeffiinniittiioonn ilu.hh:259 │ │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ │ -derive error class from the base class in common │ │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M │ │ │ │ │ -size_type M() const │ │ │ │ │ -Return the number of columns. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:700 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ │ -size_type N() const │ │ │ │ │ -Return the number of rows. │ │ │ │ │ -DDeeffiinniittiioonn matrix.hh:695 │ │ │ │ │ -_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:109 │ │ │ │ │ -_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:32 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ │ -Turns an InverseOperator into a Preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:75 │ │ │ │ │ -_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:80 │ │ │ │ │ -_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:78 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_o_s_t │ │ │ │ │ -virtual void post(domain_type &) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:111 │ │ │ │ │ -_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:82 │ │ │ │ │ -_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:86 │ │ │ │ │ -_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:84 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:115 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_r_e │ │ │ │ │ -virtual void pre(domain_type &, range_type &) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:101 │ │ │ │ │ -_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:94 │ │ │ │ │ -_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:88 │ │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(domain_type &v, const range_type &d) │ │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R │ │ │ │ │ -Sequential SSOR preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:229 │ │ │ │ │ -_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:182 │ │ │ │ │ -_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:199 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:233 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:150 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ │ -scalar type underlying the field_type │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:152 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:146 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:144 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ │ -Apply the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:208 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:148 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ │ -real scalar type underlying the field_type │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:154 │ │ │ │ │ -_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:163 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R │ │ │ │ │ -Sequential SOR preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:261 │ │ │ │ │ -_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:302 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:264 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ │ -real scalar type underlying the field_type │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:274 │ │ │ │ │ -_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:350 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ -X domain_type │ │ │ │ │ -The domain type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:266 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:367 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:328 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ │ -scalar type underlying the field_type │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:371 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ │ -Apply the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:336 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ -Y range_type │ │ │ │ │ -The range type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:268 │ │ │ │ │ -_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:319 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -The field type of the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:270 │ │ │ │ │ -_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:283 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c │ │ │ │ │ -The sequential jacobian preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:412 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:499 │ │ │ │ │ -_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:470 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ │ -Apply the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:487 │ │ │ │ │ -_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:415 │ │ │ │ │ -_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:423 │ │ │ │ │ -_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:453 │ │ │ │ │ -_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:421 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:479 │ │ │ │ │ -_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:417 │ │ │ │ │ -_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:425 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:503 │ │ │ │ │ -_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:434 │ │ │ │ │ -_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:419 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U │ │ │ │ │ -Sequential ILU preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:532 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:678 │ │ │ │ │ -_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:612 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:648 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ │ -Apply the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:656 │ │ │ │ │ -_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:552 │ │ │ │ │ -_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:541 │ │ │ │ │ -_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:692 │ │ │ │ │ -_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:699 │ │ │ │ │ -_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:598 │ │ │ │ │ -_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:535 │ │ │ │ │ -_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:537 │ │ │ │ │ -_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:549 │ │ │ │ │ -_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:544 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:682 │ │ │ │ │ -_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:561 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_w__ │ │ │ │ │ -const real_field_type w_ │ │ │ │ │ -The relaxation factor to use. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:697 │ │ │ │ │ -_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:580 │ │ │ │ │ -_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:539 │ │ │ │ │ -_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:694 │ │ │ │ │ -_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:547 │ │ │ │ │ -_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:689 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_u_p_p_e_r__ │ │ │ │ │ -CRS upper_ │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:693 │ │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n │ │ │ │ │ -Richardson preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:713 │ │ │ │ │ -_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:720 │ │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:778 │ │ │ │ │ -_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:718 │ │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_p_r_e │ │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ │ -Prepare the preconditioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:755 │ │ │ │ │ -_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:731 │ │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_p_o_s_t │ │ │ │ │ -virtual void post(X &x) │ │ │ │ │ -Clean up. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:774 │ │ │ │ │ -_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:724 │ │ │ │ │ -_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:722 │ │ │ │ │ -_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:746 │ │ │ │ │ -_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:716 │ │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ │ -Apply the precondioner. │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:763 │ │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L │ │ │ │ │ -sequential ILDL preconditioner │ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:807 │ │ │ │ │ -_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:853 │ │ │ │ │ -_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:865 │ │ │ │ │ -_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:815 │ │ │ │ │ -_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:916 │ │ │ │ │ -_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:817 │ │ │ │ │ -_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:813 │ │ │ │ │ -_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:909 │ │ │ │ │ -_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:823 │ │ │ │ │ -_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:837 │ │ │ │ │ -_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:905 │ │ │ │ │ -_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:821 │ │ │ │ │ -_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:819 │ │ │ │ │ -_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:920 │ │ │ │ │ -_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:48 │ │ │ │ │ -_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:99 │ │ │ │ │ -_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_:_:_b_l_o_c_k_L_e_v_e_l │ │ │ │ │ +constexpr std::size_t blockLevel() │ │ │ │ │ +Determine the block level of a possibly nested vector/matrix type. │ │ │ │ │ +DDeeffiinniittiioonn blocklevel.hh:176 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ │ +_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_F_a_c_t_o_r_y_C_o_n_f_i_g_u_r_a_t_i_o_n │ │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:79 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00221.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: basearray.hh File Reference │ │ │ │ +dune-istl: bvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,38 +70,66 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces
│ │ │ │ -
basearray.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
bvector.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Implements several basic array containers. │ │ │ │ +

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 "assert.h"
│ │ │ │ +
#include <algorithm>
│ │ │ │ #include <cmath>
│ │ │ │ -#include <cstddef>
│ │ │ │ +#include <complex>
│ │ │ │ +#include <initializer_list>
│ │ │ │ +#include <limits>
│ │ │ │ #include <memory>
│ │ │ │ -#include <algorithm>
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ -#include <dune/common/iteratorfacades.hh>
│ │ │ │ +#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/scalarvectorview.hh>
│ │ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ │ +#include "basearray.hh"
│ │ │ │ +#include "istlexception.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::BlockVector< B, A >
 A vector of blocks with memory management. More...
 
struct  Dune::FieldTraits< BlockVector< B, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

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

│ │ │ │ -

Implements several basic array containers.

│ │ │ │ +

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,24 +1,49 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -basearray.hh File Reference │ │ │ │ │ -Implements several basic array containers. _M_o_r_e_._._. │ │ │ │ │ -#include "assert.h" │ │ │ │ │ +_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 │ │ │ │ │ +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_/_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" │ │ │ │ │ -#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_:_:_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 │ │ │ │ │   │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +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 ********** │ │ │ │ │ -Implements several basic array containers. │ │ │ │ │ +This file implements a vector space as a tensor product of a given vector │ │ │ │ │ +space. The number of components can be given at run-time. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00221_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: basearray.hh Source File │ │ │ │ +dune-istl: bvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,427 +74,961 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
basearray.hh
│ │ │ │ +
bvector.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_BASEARRAY_HH
│ │ │ │ -
6#define DUNE_ISTL_BASEARRAY_HH
│ │ │ │ -
7
│ │ │ │ -
8#include "assert.h"
│ │ │ │ -
9#include <cmath>
│ │ │ │ -
10#include <cstddef>
│ │ │ │ -
11#include <memory>
│ │ │ │ -
12#include <algorithm>
│ │ │ │ -
13
│ │ │ │ -
14#include "istlexception.hh"
│ │ │ │ -
15#include <dune/common/iteratorfacades.hh>
│ │ │ │ -
16
│ │ │ │ -
21namespace Dune {
│ │ │ │ -
22
│ │ │ │ -
24namespace Imp {
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_ISTL_BVECTOR_HH
│ │ │ │ +
7#define DUNE_ISTL_BVECTOR_HH
│ │ │ │ +
8
│ │ │ │ +
9#include <algorithm>
│ │ │ │ +
10#include <cmath>
│ │ │ │ +
11#include <complex>
│ │ │ │ +
12#include <initializer_list>
│ │ │ │ +
13#include <limits>
│ │ │ │ +
14#include <memory>
│ │ │ │ +
15#include <utility>
│ │ │ │ +
16#include <vector>
│ │ │ │ +
17
│ │ │ │ +
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
│ │ │ │ -
50 template<class B, class A=std::allocator<B> >
│ │ │ │ -
51 class base_array_unmanaged
│ │ │ │ -
52 {
│ │ │ │ -
53 public:
│ │ │ │ -
54
│ │ │ │ -
55 //===== type definitions and constants
│ │ │ │ -
56
│ │ │ │ -
58 typedef B member_type;
│ │ │ │ -
59
│ │ │ │ -
61 typedef A allocator_type;
│ │ │ │ -
62
│ │ │ │ -
64 typedef typename A::size_type size_type;
│ │ │ │ -
65
│ │ │ │ -
67 using reference = B&;
│ │ │ │ -
68
│ │ │ │ -
70 using const_reference = const B&;
│ │ │ │ -
71
│ │ │ │ -
72 //===== access to components
│ │ │ │ -
73
│ │ │ │ -
75 reference operator[] (size_type i)
│ │ │ │ -
76 {
│ │ │ │ -
77#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
78 if (i>=n) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
79#endif
│ │ │ │ -
80 return p[i];
│ │ │ │ -
81 }
│ │ │ │ -
82
│ │ │ │ -
84 const_reference operator[] (size_type i) const
│ │ │ │ -
85 {
│ │ │ │ -
86#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ -
87 if (i>=n) DUNE_THROW(ISTLError,"index out of range");
│ │ │ │ -
88#endif
│ │ │ │ -
89 return p[i];
│ │ │ │ -
90 }
│ │ │ │ -
91
│ │ │ │ -
93 template<class T>
│ │ │ │ -
94 class RealIterator
│ │ │ │ -
95 : public RandomAccessIteratorFacade<RealIterator<T>, T>
│ │ │ │ -
96 {
│ │ │ │ -
97 public:
│ │ │ │ -
99 typedef typename std::remove_const<T>::type ValueType;
│ │ │ │ -
100
│ │ │ │ -
101 friend class RandomAccessIteratorFacade<RealIterator<const ValueType>, const ValueType>;
│ │ │ │ -
102 friend class RandomAccessIteratorFacade<RealIterator<ValueType>, ValueType>;
│ │ │ │ -
103 friend class RealIterator<const ValueType>;
│ │ │ │ -
104 friend class RealIterator<ValueType>;
│ │ │ │ + │ │ │ │ +
27
│ │ │ │ +
28#include "basearray.hh"
│ │ │ │ +
29#include "istlexception.hh"
│ │ │ │ +
30
│ │ │ │ +
38namespace Dune {
│ │ │ │ +
39
│ │ │ │ +
41namespace Imp {
│ │ │ │ +
42
│ │ │ │ +
48 template <class B, bool isNumber>
│ │ │ │ +
49 class BlockTraitsImp;
│ │ │ │ +
50
│ │ │ │ +
51 template <class B>
│ │ │ │ +
52 class BlockTraitsImp<B,true>
│ │ │ │ +
53 {
│ │ │ │ +
54 public:
│ │ │ │ +
55 using field_type = B;
│ │ │ │ +
56 };
│ │ │ │ +
57
│ │ │ │ +
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 A=std::allocator<B> >
│ │ │ │ +
84 class block_vector_unmanaged : public base_array_unmanaged<B,A>
│ │ │ │ +
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 A allocator_type;
│ │ │ │ +
96
│ │ │ │ +
98 typedef typename A::size_type size_type;
│ │ │ │ +
99
│ │ │ │ +
101 typedef typename base_array_unmanaged<B,A>::iterator Iterator;
│ │ │ │ +
102
│ │ │ │ +
104 typedef typename base_array_unmanaged<B,A>::const_iterator ConstIterator;
│ │ │ │
105
│ │ │ │ -
107 RealIterator ()
│ │ │ │ -
108 : p(0), i(0)
│ │ │ │ -
109 {}
│ │ │ │ -
110
│ │ │ │ -
111 RealIterator (const B* _p, B* _i) : p(_p), i(_i)
│ │ │ │ -
112 { }
│ │ │ │ -
113
│ │ │ │ -
114 RealIterator(const RealIterator<ValueType>& it)
│ │ │ │ -
115 : p(it.p), i(it.i)
│ │ │ │ -
116 {}
│ │ │ │ +
107 typedef B value_type;
│ │ │ │ +
108
│ │ │ │ +
110 typedef B& reference;
│ │ │ │ +
111
│ │ │ │ +
113 typedef const B& const_reference;
│ │ │ │ +
114
│ │ │ │ +
115 //===== assignment from scalar
│ │ │ │
117
│ │ │ │ -
119 size_type index () const
│ │ │ │ -
120 {
│ │ │ │ -
121 return i-p;
│ │ │ │ -
122 }
│ │ │ │ -
123
│ │ │ │ -
125 bool equals (const RealIterator<ValueType>& other) const
│ │ │ │ -
126 {
│ │ │ │ -
127 assert(other.p==p);
│ │ │ │ -
128 return i==other.i;
│ │ │ │ -
129 }
│ │ │ │ -
130
│ │ │ │ -
132 bool equals (const RealIterator<const ValueType>& other) const
│ │ │ │ -
133 {
│ │ │ │ -
134 assert(other.p==p);
│ │ │ │ -
135 return i==other.i;
│ │ │ │ -
136 }
│ │ │ │ -
137
│ │ │ │ -
138 std::ptrdiff_t distanceTo(const RealIterator& o) const
│ │ │ │ -
139 {
│ │ │ │ -
140 return o.i-i;
│ │ │ │ -
141 }
│ │ │ │ -
142
│ │ │ │ -
143 private:
│ │ │ │ -
145 void increment()
│ │ │ │ -
146 {
│ │ │ │ -
147 ++i;
│ │ │ │ -
148 }
│ │ │ │ -
149
│ │ │ │ -
151 void decrement()
│ │ │ │ -
152 {
│ │ │ │ -
153 --i;
│ │ │ │ -
154 }
│ │ │ │ -
155
│ │ │ │ -
156 // Needed for operator[] of the iterator
│ │ │ │ -
157 reference elementAt (std::ptrdiff_t offset) const
│ │ │ │ -
158 {
│ │ │ │ -
159 return *(i+offset);
│ │ │ │ -
160 }
│ │ │ │ -
161
│ │ │ │ -
163 reference dereference () const
│ │ │ │ -
164 {
│ │ │ │ -
165 return *i;
│ │ │ │ -
166 }
│ │ │ │ -
167
│ │ │ │ -
168 void advance(std::ptrdiff_t d)
│ │ │ │ -
169 {
│ │ │ │ -
170 i+=d;
│ │ │ │ -
171 }
│ │ │ │ +
118 block_vector_unmanaged& operator= (const field_type& k)
│ │ │ │ +
119 {
│ │ │ │ +
120 for (size_type i=0; i<this->n; i++)
│ │ │ │ +
121 (*this)[i] = k;
│ │ │ │ +
122 return *this;
│ │ │ │ +
123 }
│ │ │ │ +
124
│ │ │ │ +
125 //===== vector space arithmetic
│ │ │ │ +
127 block_vector_unmanaged& operator+= (const block_vector_unmanaged& y)
│ │ │ │ +
128 {
│ │ │ │ +
129#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
130 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ +
131#endif
│ │ │ │ +
132 for (size_type i=0; i<this->n; ++i) (*this)[i] += y[i];
│ │ │ │ +
133 return *this;
│ │ │ │ +
134 }
│ │ │ │ +
135
│ │ │ │ +
137 block_vector_unmanaged& operator-= (const block_vector_unmanaged& y)
│ │ │ │ +
138 {
│ │ │ │ +
139#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
140 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ +
141#endif
│ │ │ │ +
142 for (size_type i=0; i<this->n; ++i) (*this)[i] -= y[i];
│ │ │ │ +
143 return *this;
│ │ │ │ +
144 }
│ │ │ │ +
145
│ │ │ │ +
147 block_vector_unmanaged& operator*= (const field_type& k)
│ │ │ │ +
148 {
│ │ │ │ +
149 for (size_type i=0; i<this->n; ++i) (*this)[i] *= k;
│ │ │ │ +
150 return *this;
│ │ │ │ +
151 }
│ │ │ │ +
152
│ │ │ │ +
154 block_vector_unmanaged& operator/= (const field_type& k)
│ │ │ │ +
155 {
│ │ │ │ +
156 for (size_type i=0; i<this->n; ++i) (*this)[i] /= k;
│ │ │ │ +
157 return *this;
│ │ │ │ +
158 }
│ │ │ │ +
159
│ │ │ │ +
161 block_vector_unmanaged& axpy (const field_type& a, const block_vector_unmanaged& y)
│ │ │ │ +
162 {
│ │ │ │ +
163#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
164 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ +
165#endif
│ │ │ │ +
166 for (size_type i=0; i<this->n; ++i)
│ │ │ │ +
167 Impl::asVector((*this)[i]).axpy(a,Impl::asVector(y[i]));
│ │ │ │ +
168
│ │ │ │ +
169 return *this;
│ │ │ │ +
170 }
│ │ │ │ +
171
│ │ │ │
172
│ │ │ │ -
173 const B* p;
│ │ │ │ -
174 B* i;
│ │ │ │ -
175 };
│ │ │ │ -
176
│ │ │ │ -
178 typedef RealIterator<B> iterator;
│ │ │ │ -
179
│ │ │ │ -
180
│ │ │ │ -
182 iterator begin ()
│ │ │ │ -
183 {
│ │ │ │ -
184 return iterator(p,p);
│ │ │ │ -
185 }
│ │ │ │ -
186
│ │ │ │ -
188 iterator end ()
│ │ │ │ -
189 {
│ │ │ │ -
190 return iterator(p,p+n);
│ │ │ │ -
191 }
│ │ │ │ -
192
│ │ │ │ -
195 iterator beforeEnd ()
│ │ │ │ -
196 {
│ │ │ │ -
197 return iterator(p,p+n-1);
│ │ │ │ -
198 }
│ │ │ │ -
199
│ │ │ │ -
202 iterator beforeBegin ()
│ │ │ │ -
203 {
│ │ │ │ -
204 return iterator(p,p-1);
│ │ │ │ -
205 }
│ │ │ │ -
206
│ │ │ │ -
208 iterator find (size_type i)
│ │ │ │ -
209 {
│ │ │ │ -
210 return iterator(p,p+std::min(i,n));
│ │ │ │ -
211 }
│ │ │ │ +
180 template<class OtherB, class OtherA>
│ │ │ │ +
181 auto operator* (const block_vector_unmanaged<OtherB,OtherA>& y) const
│ │ │ │ +
182 {
│ │ │ │ +
183 typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
│ │ │ │ +
184 PromotedType sum(0);
│ │ │ │ +
185#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
186 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ +
187#endif
│ │ │ │ +
188 for (size_type i=0; i<this->n; ++i) {
│ │ │ │ +
189 sum += PromotedType(((*this)[i])*y[i]);
│ │ │ │ +
190 }
│ │ │ │ +
191 return sum;
│ │ │ │ +
192 }
│ │ │ │ +
193
│ │ │ │ +
201 template<class OtherB, class OtherA>
│ │ │ │ +
202 auto dot(const block_vector_unmanaged<OtherB,OtherA>& y) const
│ │ │ │ +
203 {
│ │ │ │ +
204 typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
│ │ │ │ +
205 PromotedType sum(0);
│ │ │ │ +
206#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
207 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ +
208#endif
│ │ │ │ +
209
│ │ │ │ +
210 for (size_type i=0; i<this->n; ++i)
│ │ │ │ +
211 sum += Impl::asVector((*this)[i]).dot(Impl::asVector(y[i]));
│ │ │ │
212
│ │ │ │ -
214 typedef RealIterator<const B> const_iterator;
│ │ │ │ +
213 return sum;
│ │ │ │ +
214 }
│ │ │ │
215
│ │ │ │ -
217 const_iterator begin () const
│ │ │ │ -
218 {
│ │ │ │ -
219 return const_iterator(p,p+0);
│ │ │ │ -
220 }
│ │ │ │ -
221
│ │ │ │ -
223 const_iterator end () const
│ │ │ │ -
224 {
│ │ │ │ -
225 return const_iterator(p,p+n);
│ │ │ │ -
226 }
│ │ │ │ -
227
│ │ │ │ -
230 const_iterator beforeEnd () const
│ │ │ │ -
231 {
│ │ │ │ -
232 return const_iterator(p,p+n-1);
│ │ │ │ -
233 }
│ │ │ │ -
234
│ │ │ │ -
237 const_iterator beforeBegin () const
│ │ │ │ +
216 //===== norms
│ │ │ │ +
217
│ │ │ │ +
219 typename FieldTraits<field_type>::real_type one_norm () const
│ │ │ │ +
220 {
│ │ │ │ +
221 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
222 for (size_type i=0; i<this->n; ++i)
│ │ │ │ +
223 sum += Impl::asVector((*this)[i]).one_norm();
│ │ │ │ +
224 return sum;
│ │ │ │ +
225 }
│ │ │ │ +
226
│ │ │ │ +
228 typename FieldTraits<field_type>::real_type one_norm_real () const
│ │ │ │ +
229 {
│ │ │ │ +
230 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
231 for (size_type i=0; i<this->n; ++i)
│ │ │ │ +
232 sum += Impl::asVector((*this)[i]).one_norm_real();
│ │ │ │ +
233 return sum;
│ │ │ │ +
234 }
│ │ │ │ +
235
│ │ │ │ +
237 typename FieldTraits<field_type>::real_type two_norm () const
│ │ │ │
238 {
│ │ │ │ -
239 return const_iterator(p,p-1);
│ │ │ │ -
240 }
│ │ │ │ -
241
│ │ │ │ -
243 const_iterator find (size_type i) const
│ │ │ │ -
244 {
│ │ │ │ -
245 return const_iterator(p,p+std::min(i,n));
│ │ │ │ -
246 }
│ │ │ │ -
247
│ │ │ │ -
248
│ │ │ │ -
249 //===== sizes
│ │ │ │ -
250
│ │ │ │ -
252 size_type size () const
│ │ │ │ -
253 {
│ │ │ │ -
254 return n;
│ │ │ │ -
255 }
│ │ │ │ -
256
│ │ │ │ -
258 const B* data() const
│ │ │ │ -
259 {
│ │ │ │ -
260 return p;
│ │ │ │ -
261 }
│ │ │ │ -
262
│ │ │ │ -
264 B* data()
│ │ │ │ -
265 {
│ │ │ │ -
266 return p;
│ │ │ │ -
267 }
│ │ │ │ -
268
│ │ │ │ -
269 protected:
│ │ │ │ -
271 base_array_unmanaged ()
│ │ │ │ -
272 : n(0), p(0)
│ │ │ │ -
273 {}
│ │ │ │ -
275 base_array_unmanaged (size_type n_, B* p_)
│ │ │ │ -
276 : n(n_), p(p_)
│ │ │ │ -
277 {}
│ │ │ │ -
278 size_type n; // number of elements in array
│ │ │ │ -
279 B *p; // pointer to dynamically allocated built-in array
│ │ │ │ -
280 };
│ │ │ │ +
239 using std::sqrt;
│ │ │ │ +
240 return sqrt(two_norm2());
│ │ │ │ +
241 }
│ │ │ │ +
242
│ │ │ │ +
244 typename FieldTraits<field_type>::real_type two_norm2 () const
│ │ │ │ +
245 {
│ │ │ │ +
246 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
247 for (size_type i=0; i<this->n; ++i)
│ │ │ │ +
248 sum += Impl::asVector((*this)[i]).two_norm2();
│ │ │ │ +
249 return sum;
│ │ │ │ +
250 }
│ │ │ │ +
251
│ │ │ │ +
253 template <typename ft = field_type,
│ │ │ │ +
254 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
255 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
256 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
257 using std::max;
│ │ │ │ +
258
│ │ │ │ +
259 real_type norm = 0;
│ │ │ │ +
260 for (auto const &xi : *this) {
│ │ │ │ +
261 real_type const a = Impl::asVector(xi).infinity_norm();
│ │ │ │ +
262 norm = max(a, norm);
│ │ │ │ +
263 }
│ │ │ │ +
264 return norm;
│ │ │ │ +
265 }
│ │ │ │ +
266
│ │ │ │ +
268 template <typename ft = field_type,
│ │ │ │ +
269 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
270 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
271 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
272 using std::max;
│ │ │ │ +
273
│ │ │ │ +
274 real_type norm = 0;
│ │ │ │ +
275 for (auto const &xi : *this) {
│ │ │ │ +
276 real_type const a = Impl::asVector(xi).infinity_norm_real();
│ │ │ │ +
277 norm = max(a, norm);
│ │ │ │ +
278 }
│ │ │ │ +
279 return norm;
│ │ │ │ +
280 }
│ │ │ │
281
│ │ │ │ -
282
│ │ │ │ -
283
│ │ │ │ -
305 template<class B, class A=std::allocator<B> >
│ │ │ │ -
306 class compressed_base_array_unmanaged
│ │ │ │ -
307 {
│ │ │ │ -
308 public:
│ │ │ │ -
309
│ │ │ │ -
310 //===== type definitions and constants
│ │ │ │ -
311
│ │ │ │ -
313 typedef B member_type;
│ │ │ │ -
314
│ │ │ │ -
316 typedef A allocator_type;
│ │ │ │ -
317
│ │ │ │ -
319 typedef typename A::size_type size_type;
│ │ │ │ -
320
│ │ │ │ -
322 using reference = B&;
│ │ │ │ -
323
│ │ │ │ -
325 using const_reference = const B&;
│ │ │ │ -
326
│ │ │ │ -
327 //===== access to components
│ │ │ │ -
328
│ │ │ │ -
330 reference operator[] (size_type i)
│ │ │ │ -
331 {
│ │ │ │ -
332 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ -
333 if (lb == j+n || *lb != i)
│ │ │ │ -
334 DUNE_THROW(ISTLError,"index "<<i<<" not in compressed array");
│ │ │ │ -
335 return p[lb-j];
│ │ │ │ -
336 }
│ │ │ │ -
337
│ │ │ │ -
339 const_reference operator[] (size_type i) const
│ │ │ │ -
340 {
│ │ │ │ -
341 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ -
342 if (lb == j+n || *lb != i)
│ │ │ │ -
343 DUNE_THROW(ISTLError,"index "<<i<<" not in compressed array");
│ │ │ │ -
344 return p[lb-j];
│ │ │ │ -
345 }
│ │ │ │ +
283 template <typename ft = field_type,
│ │ │ │ +
284 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
285 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
286 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
287 using std::max;
│ │ │ │ +
288 using std::abs;
│ │ │ │ +
289
│ │ │ │ +
290 real_type norm = 0;
│ │ │ │ +
291 real_type isNaN = 1;
│ │ │ │ +
292
│ │ │ │ +
293 for (auto const &xi : *this) {
│ │ │ │ +
294 real_type const a = Impl::asVector(xi).infinity_norm();
│ │ │ │ +
295 norm = max(a, norm);
│ │ │ │ +
296 isNaN += a;
│ │ │ │ +
297 }
│ │ │ │ +
298 return norm * (isNaN / isNaN);
│ │ │ │ +
299 }
│ │ │ │ +
300
│ │ │ │ +
302 template <typename ft = field_type,
│ │ │ │ +
303 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
304 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
305 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
306 using std::max;
│ │ │ │ +
307
│ │ │ │ +
308 real_type norm = 0;
│ │ │ │ +
309 real_type isNaN = 1;
│ │ │ │ +
310
│ │ │ │ +
311 for (auto const &xi : *this) {
│ │ │ │ +
312 real_type const a = Impl::asVector(xi).infinity_norm_real();
│ │ │ │ +
313 norm = max(a, norm);
│ │ │ │ +
314 isNaN += a;
│ │ │ │ +
315 }
│ │ │ │ +
316
│ │ │ │ +
317 return norm * (isNaN / isNaN);
│ │ │ │ +
318 }
│ │ │ │ +
319
│ │ │ │ +
320 //===== sizes
│ │ │ │ +
321
│ │ │ │ +
323 size_type N () const
│ │ │ │ +
324 {
│ │ │ │ +
325 return this->n;
│ │ │ │ +
326 }
│ │ │ │ +
327
│ │ │ │ +
329 size_type dim () const
│ │ │ │ +
330 {
│ │ │ │ +
331 size_type d=0;
│ │ │ │ +
332
│ │ │ │ +
333 for (size_type i=0; i<this->n; i++)
│ │ │ │ +
334 d += Impl::asVector((*this)[i]).dim();
│ │ │ │ +
335
│ │ │ │ +
336 return d;
│ │ │ │ +
337 }
│ │ │ │ +
338
│ │ │ │ +
339 protected:
│ │ │ │ +
341 block_vector_unmanaged () : base_array_unmanaged<B,A>()
│ │ │ │ +
342 { }
│ │ │ │ +
343 };
│ │ │ │ +
344
│ │ │ │
346
│ │ │ │ -
348 template<class T>
│ │ │ │ -
349 class RealIterator
│ │ │ │ -
350 : public BidirectionalIteratorFacade<RealIterator<T>, T>
│ │ │ │ -
351 {
│ │ │ │ -
352 public:
│ │ │ │ -
354 typedef typename std::remove_const<T>::type ValueType;
│ │ │ │ -
355
│ │ │ │ -
356 friend class BidirectionalIteratorFacade<RealIterator<const ValueType>, const ValueType>;
│ │ │ │ -
357 friend class BidirectionalIteratorFacade<RealIterator<ValueType>, ValueType>;
│ │ │ │ -
358 friend class RealIterator<const ValueType>;
│ │ │ │ -
359 friend class RealIterator<ValueType>;
│ │ │ │ -
360
│ │ │ │ -
362 RealIterator ()
│ │ │ │ -
363 : p(0), j(0), i(0)
│ │ │ │ -
364 {}
│ │ │ │ -
365
│ │ │ │ -
367 RealIterator (B* _p, size_type* _j, size_type _i)
│ │ │ │ -
368 : p(_p), j(_j), i(_i)
│ │ │ │ -
369 { }
│ │ │ │ -
370
│ │ │ │ -
374 RealIterator(const RealIterator<ValueType>& it)
│ │ │ │ -
375 : p(it.p), j(it.j), i(it.i)
│ │ │ │ -
376 {}
│ │ │ │ +
351 template<class F>
│ │ │ │ +
352 class ScopeGuard {
│ │ │ │ +
353 F cleanupFunc_;
│ │ │ │ +
354 public:
│ │ │ │ +
355 ScopeGuard(F cleanupFunc) : cleanupFunc_(std::move(cleanupFunc)) {}
│ │ │ │ +
356 ScopeGuard(const ScopeGuard &) = delete;
│ │ │ │ +
357 ScopeGuard(ScopeGuard &&) = delete;
│ │ │ │ +
358 ScopeGuard &operator=(ScopeGuard) = delete;
│ │ │ │ +
359 ~ScopeGuard() { cleanupFunc_(); }
│ │ │ │ +
360 };
│ │ │ │ +
361
│ │ │ │ +
363
│ │ │ │ +
372 template<class F>
│ │ │ │ +
373 ScopeGuard<F> makeScopeGuard(F cleanupFunc)
│ │ │ │ +
374 {
│ │ │ │ +
375 return { std::move(cleanupFunc) };
│ │ │ │ +
376 }
│ │ │ │
377
│ │ │ │ -
378
│ │ │ │ -
380 bool equals (const RealIterator<ValueType>& it) const
│ │ │ │ -
381 {
│ │ │ │ -
382 assert(p==it.p);
│ │ │ │ -
383 return (i)==(it.i);
│ │ │ │ -
384 }
│ │ │ │ -
385
│ │ │ │ -
387 bool equals (const RealIterator<const ValueType>& it) const
│ │ │ │ -
388 {
│ │ │ │ -
389 assert(p==it.p);
│ │ │ │ -
390 return (i)==(it.i);
│ │ │ │ -
391 }
│ │ │ │ -
392
│ │ │ │ -
393
│ │ │ │ -
395 size_type index () const
│ │ │ │ -
396 {
│ │ │ │ -
397 return j[i];
│ │ │ │ -
398 }
│ │ │ │ +
378} // end namespace Imp
│ │ │ │ +
393 template<class B, class A=std::allocator<B> >
│ │ │ │ +
│ │ │ │ +
394 class BlockVector : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ +
395 {
│ │ │ │ +
396 public:
│ │ │ │ +
397
│ │ │ │ +
398 //===== type definitions and constants
│ │ │ │
399
│ │ │ │ -
401 void setindex (size_type k)
│ │ │ │ -
402 {
│ │ │ │ -
403 return j[i] = k;
│ │ │ │ -
404 }
│ │ │ │ +
401 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
402
│ │ │ │ +
404 typedef B block_type;
│ │ │ │
405
│ │ │ │ -
413 size_type offset () const
│ │ │ │ -
414 {
│ │ │ │ -
415 return i;
│ │ │ │ -
416 }
│ │ │ │ -
417
│ │ │ │ -
418 private:
│ │ │ │ -
420 void increment()
│ │ │ │ -
421 {
│ │ │ │ -
422 ++i;
│ │ │ │ -
423 }
│ │ │ │ -
424
│ │ │ │ -
426 void decrement()
│ │ │ │ -
427 {
│ │ │ │ -
428 --i;
│ │ │ │ -
429 }
│ │ │ │ -
430
│ │ │ │ -
432 reference dereference () const
│ │ │ │ -
433 {
│ │ │ │ -
434 return p[i];
│ │ │ │ -
435 }
│ │ │ │ -
436
│ │ │ │ -
437 B* p;
│ │ │ │ -
438 size_type* j;
│ │ │ │ -
439 size_type i;
│ │ │ │ -
440 };
│ │ │ │ +
407 typedef A allocator_type;
│ │ │ │ +
408
│ │ │ │ +
410 typedef typename A::size_type size_type;
│ │ │ │ +
411
│ │ │ │ +
413 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
414 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ +
415
│ │ │ │ +
417 typedef typename Imp::block_vector_unmanaged<B,A>::Iterator Iterator;
│ │ │ │ +
418
│ │ │ │ +
420 typedef typename Imp::block_vector_unmanaged<B,A>::ConstIterator ConstIterator;
│ │ │ │ +
421
│ │ │ │ +
422 //===== constructors and such
│ │ │ │ +
423
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
426 {
│ │ │ │ +
427 syncBaseArray();
│ │ │ │ +
428 }
│ │ │ │ +
│ │ │ │ +
429
│ │ │ │ +
│ │ │ │ +
431 explicit BlockVector (size_type _n) : storage_(_n)
│ │ │ │ +
432 {
│ │ │ │ +
433 syncBaseArray();
│ │ │ │ +
434 }
│ │ │ │ +
│ │ │ │ +
435
│ │ │ │ +
│ │ │ │ +
437 BlockVector (std::initializer_list<B> const &l) : storage_(l)
│ │ │ │ +
438 {
│ │ │ │ +
439 syncBaseArray();
│ │ │ │ +
440 }
│ │ │ │ +
│ │ │ │
441
│ │ │ │ -
443 typedef RealIterator<B> iterator;
│ │ │ │ -
444
│ │ │ │ -
446 iterator begin ()
│ │ │ │ -
447 {
│ │ │ │ -
448 return iterator(p,j,0);
│ │ │ │ -
449 }
│ │ │ │ -
450
│ │ │ │ -
452 iterator end ()
│ │ │ │ -
453 {
│ │ │ │ -
454 return iterator(p,j,n);
│ │ │ │ -
455 }
│ │ │ │ -
456
│ │ │ │ -
459 iterator beforeEnd ()
│ │ │ │ -
460 {
│ │ │ │ -
461 return iterator(p,j,n-1);
│ │ │ │ -
462 }
│ │ │ │ -
463
│ │ │ │ -
466 iterator beforeBegin ()
│ │ │ │ -
467 {
│ │ │ │ -
468 return iterator(p,j,-1);
│ │ │ │ -
469 }
│ │ │ │ -
470
│ │ │ │ -
472 iterator find (size_type i)
│ │ │ │ -
473 {
│ │ │ │ -
474 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ -
475 return (lb != j+n && *lb == i)
│ │ │ │ -
476 ? iterator(p,j,lb-j)
│ │ │ │ -
477 : end();
│ │ │ │ -
478 }
│ │ │ │ -
479
│ │ │ │ -
481 typedef RealIterator<const B> const_iterator;
│ │ │ │ -
482
│ │ │ │ -
484 const_iterator begin () const
│ │ │ │ -
485 {
│ │ │ │ -
486 return const_iterator(p,j,0);
│ │ │ │ -
487 }
│ │ │ │ -
488
│ │ │ │ -
490 const_iterator end () const
│ │ │ │ -
491 {
│ │ │ │ -
492 return const_iterator(p,j,n);
│ │ │ │ -
493 }
│ │ │ │ -
494
│ │ │ │ -
497 const_iterator beforeEnd () const
│ │ │ │ -
498 {
│ │ │ │ -
499 return const_iterator(p,j,n-1);
│ │ │ │ -
500 }
│ │ │ │ -
501
│ │ │ │ -
504 const_iterator beforeBegin () const
│ │ │ │ -
505 {
│ │ │ │ -
506 return const_iterator(p,j,-1);
│ │ │ │ -
507 }
│ │ │ │ -
508
│ │ │ │ -
510 const_iterator find (size_type i) const
│ │ │ │ -
511 {
│ │ │ │ -
512 const size_type* lb = std::lower_bound(j, j+n, i);
│ │ │ │ -
513 return (lb != j+n && *lb == i)
│ │ │ │ -
514 ? const_iterator(p,j,lb-j)
│ │ │ │ -
515 : end();
│ │ │ │ +
442
│ │ │ │ +
454 template<typename S>
│ │ │ │ +
│ │ │ │ +
455 BlockVector (size_type _n, S _capacity)
│ │ │ │ +
456 {
│ │ │ │ +
457 static_assert(std::numeric_limits<S>::is_integer,
│ │ │ │ +
458 "capacity must be an unsigned integral type (be aware, that this constructor does not set the default value!)" );
│ │ │ │ +
459 if((size_type)_capacity > _n)
│ │ │ │ +
460 storage_.reserve(_capacity);
│ │ │ │ +
461 storage_.resize(_n);
│ │ │ │ +
462 syncBaseArray();
│ │ │ │ +
463 }
│ │ │ │ +
│ │ │ │ +
464
│ │ │ │ +
465
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
476 {
│ │ │ │ +
477 [[maybe_unused]] const auto &guard =
│ │ │ │ +
478 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ │ +
479 storage_.reserve(capacity);
│ │ │ │ +
480 }
│ │ │ │ +
│ │ │ │ +
481
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
489 {
│ │ │ │ +
490 return storage_.capacity();
│ │ │ │ +
491 }
│ │ │ │ +
│ │ │ │ +
492
│ │ │ │ +
│ │ │ │ +
503 void resize(size_type size)
│ │ │ │ +
504 {
│ │ │ │ +
505 [[maybe_unused]] const auto &guard =
│ │ │ │ +
506 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ │ +
507 storage_.resize(size);
│ │ │ │ +
508 }
│ │ │ │ +
│ │ │ │ +
509
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
512 noexcept(noexcept(std::declval<BlockVector>().storage_ = a.storage_))
│ │ │ │ +
513 {
│ │ │ │ +
514 storage_ = a.storage_;
│ │ │ │ +
515 syncBaseArray();
│ │ │ │
516 }
│ │ │ │ +
│ │ │ │
517
│ │ │ │ -
518 //===== sizes
│ │ │ │ -
519
│ │ │ │ -
521 size_type size () const
│ │ │ │ -
522 {
│ │ │ │ -
523 return n;
│ │ │ │ -
524 }
│ │ │ │ -
525
│ │ │ │ -
526 protected:
│ │ │ │ -
528 compressed_base_array_unmanaged ()
│ │ │ │ -
529 : n(0), p(0), j(0)
│ │ │ │ -
530 {}
│ │ │ │ -
531
│ │ │ │ -
532 size_type n; // number of elements in array
│ │ │ │ -
533 B *p; // pointer to dynamically allocated built-in array
│ │ │ │ -
534 size_type* j; // the index set
│ │ │ │ -
535 };
│ │ │ │ -
536
│ │ │ │ -
537} // end namespace Imp
│ │ │ │ -
538
│ │ │ │ -
539} // end namespace
│ │ │ │ -
540
│ │ │ │ -
541#endif
│ │ │ │ - │ │ │ │ +
│ │ │ │ + │ │ │ │ +
520 noexcept(noexcept(std::declval<BlockVector>().swap(a)))
│ │ │ │ +
521 {
│ │ │ │ +
522 swap(a);
│ │ │ │ +
523 }
│ │ │ │ +
│ │ │ │ +
524
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
527 noexcept(noexcept(std::declval<BlockVector>().storage_ = a.storage_))
│ │ │ │ +
528 {
│ │ │ │ +
529 [[maybe_unused]] const auto &guard =
│ │ │ │ +
530 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ │ +
531 storage_ = a.storage_;
│ │ │ │ +
532 return *this;
│ │ │ │ +
533 }
│ │ │ │ +
│ │ │ │ +
534
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
537 noexcept(noexcept(std::declval<BlockVector>().swap(a)))
│ │ │ │ +
538 {
│ │ │ │ +
539 swap(a);
│ │ │ │ +
540 return *this;
│ │ │ │ +
541 }
│ │ │ │ +
│ │ │ │ +
542
│ │ │ │ +
│ │ │ │ +
544 void swap(BlockVector &other)
│ │ │ │ +
545 noexcept(noexcept(
│ │ │ │ +
546 std::declval<BlockVector&>().storage_.swap(other.storage_)))
│ │ │ │ +
547 {
│ │ │ │ +
548 [[maybe_unused]] const auto &guard = Imp::makeScopeGuard([&]{
│ │ │ │ +
549 syncBaseArray();
│ │ │ │ +
550 other.syncBaseArray();
│ │ │ │ +
551 });
│ │ │ │ +
552 storage_.swap(other.storage_);
│ │ │ │ +
553 }
│ │ │ │ +
│ │ │ │ +
554
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
557 {
│ │ │ │ +
558 // forward to operator= in base class
│ │ │ │ +
559 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ +
560 return *this;
│ │ │ │ +
561 }
│ │ │ │ +
│ │ │ │ +
562
│ │ │ │ +
563 private:
│ │ │ │ +
564 void syncBaseArray() noexcept
│ │ │ │ +
565 {
│ │ │ │ +
566 this->p = storage_.data();
│ │ │ │ +
567 this->n = storage_.size();
│ │ │ │ +
568 }
│ │ │ │ +
569
│ │ │ │ +
570 std::vector<B, A> storage_;
│ │ │ │ +
571 };
│ │ │ │ +
│ │ │ │ +
572
│ │ │ │ +
578 template<class B, class A>
│ │ │ │ +
│ │ │ │ +
579 struct FieldTraits< BlockVector<B, A> >
│ │ │ │ +
580 {
│ │ │ │ +
581 typedef typename FieldTraits<B>::field_type field_type;
│ │ │ │ +
582 typedef typename FieldTraits<B>::real_type real_type;
│ │ │ │ +
583 };
│ │ │ │ +
│ │ │ │ +
589 template<class K, class A>
│ │ │ │ +
│ │ │ │ +
590 std::ostream& operator<< (std::ostream& s, const BlockVector<K, A>& v)
│ │ │ │ +
591 {
│ │ │ │ +
592 typedef typename BlockVector<K, A>::size_type size_type;
│ │ │ │ +
593
│ │ │ │ +
594 for (size_type i=0; i<v.size(); i++)
│ │ │ │ +
595 s << v[i] << std::endl;
│ │ │ │ +
596
│ │ │ │ +
597 return s;
│ │ │ │ +
598 }
│ │ │ │ +
│ │ │ │ +
599
│ │ │ │ +
601namespace Imp {
│ │ │ │ +
602
│ │ │ │ +
621#ifndef DOXYGEN
│ │ │ │ +
622 template<class B, class A>
│ │ │ │ +
623#else
│ │ │ │ +
624 template<class B, class A=std::allocator<B> >
│ │ │ │ +
625#endif
│ │ │ │ +
626 class BlockVectorWindow : public Imp::block_vector_unmanaged<B,A>
│ │ │ │ +
627 {
│ │ │ │ +
628 public:
│ │ │ │ +
629
│ │ │ │ +
630 //===== type definitions and constants
│ │ │ │ +
631
│ │ │ │ +
633 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
634
│ │ │ │ +
636 typedef B block_type;
│ │ │ │ +
637
│ │ │ │ +
639 typedef A allocator_type;
│ │ │ │ +
640
│ │ │ │ +
642 typedef typename A::size_type size_type;
│ │ │ │ +
643
│ │ │ │ +
645 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
646 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ +
647
│ │ │ │ +
649 typedef typename Imp::block_vector_unmanaged<B,A>::Iterator Iterator;
│ │ │ │ +
650
│ │ │ │ +
652 typedef typename Imp::block_vector_unmanaged<B,A>::ConstIterator ConstIterator;
│ │ │ │ +
653
│ │ │ │ +
654
│ │ │ │ +
655 //===== constructors and such
│ │ │ │ +
657 BlockVectorWindow () : Imp::block_vector_unmanaged<B,A>()
│ │ │ │ +
658 { }
│ │ │ │ +
659
│ │ │ │ +
661 BlockVectorWindow (B* _p, size_type _n)
│ │ │ │ +
662 {
│ │ │ │ +
663 this->n = _n;
│ │ │ │ +
664 this->p = _p;
│ │ │ │ +
665 }
│ │ │ │ +
666
│ │ │ │ +
668 BlockVectorWindow (const BlockVectorWindow& a)
│ │ │ │ +
669 {
│ │ │ │ +
670 this->n = a.n;
│ │ │ │ +
671 this->p = a.p;
│ │ │ │ +
672 }
│ │ │ │ +
673
│ │ │ │ +
675 BlockVectorWindow& operator= (const BlockVectorWindow& a)
│ │ │ │ +
676 {
│ │ │ │ +
677 // check correct size
│ │ │ │ +
678#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
679 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ +
680#endif
│ │ │ │ +
681
│ │ │ │ +
682 if (&a!=this) // check if this and a are different objects
│ │ │ │ +
683 {
│ │ │ │ +
684 // copy data
│ │ │ │ +
685 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ +
686 }
│ │ │ │ +
687 return *this;
│ │ │ │ +
688 }
│ │ │ │ +
689
│ │ │ │ +
691 BlockVectorWindow& operator= (const field_type& k)
│ │ │ │ +
692 {
│ │ │ │ +
693 (static_cast<Imp::block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ +
694 return *this;
│ │ │ │ +
695 }
│ │ │ │ +
696
│ │ │ │ +
698 operator BlockVector<B, A>() const {
│ │ │ │ +
699 auto bv = BlockVector<B, A>(this->n);
│ │ │ │ +
700
│ │ │ │ +
701 std::copy(this->begin(), this->end(), bv.begin());
│ │ │ │ +
702
│ │ │ │ +
703 return bv;
│ │ │ │ +
704 }
│ │ │ │ +
705
│ │ │ │ +
706 //===== window manipulation methods
│ │ │ │ +
707
│ │ │ │ +
709 void set (size_type _n, B* _p)
│ │ │ │ +
710 {
│ │ │ │ +
711 this->n = _n;
│ │ │ │ +
712 this->p = _p;
│ │ │ │ +
713 }
│ │ │ │ +
714
│ │ │ │ +
716 void setsize (size_type _n)
│ │ │ │ +
717 {
│ │ │ │ +
718 this->n = _n;
│ │ │ │ +
719 }
│ │ │ │ +
720
│ │ │ │ +
722 void setptr (B* _p)
│ │ │ │ +
723 {
│ │ │ │ +
724 this->p = _p;
│ │ │ │ +
725 }
│ │ │ │ +
726
│ │ │ │ +
728 B* getptr ()
│ │ │ │ +
729 {
│ │ │ │ +
730 return this->p;
│ │ │ │ +
731 }
│ │ │ │ +
732
│ │ │ │ +
734 size_type getsize () const
│ │ │ │ +
735 {
│ │ │ │ +
736 return this->n;
│ │ │ │ +
737 }
│ │ │ │ +
738 };
│ │ │ │ +
739
│ │ │ │ +
740
│ │ │ │ +
741
│ │ │ │ +
752 template<class B, class A=std::allocator<B> >
│ │ │ │ +
753 class compressed_block_vector_unmanaged : public compressed_base_array_unmanaged<B,A>
│ │ │ │ +
754 {
│ │ │ │ +
755 public:
│ │ │ │ +
756
│ │ │ │ +
757 //===== type definitions and constants
│ │ │ │ +
758
│ │ │ │ +
760 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
761
│ │ │ │ +
763 typedef B block_type;
│ │ │ │ +
764
│ │ │ │ +
766 typedef A allocator_type;
│ │ │ │ +
767
│ │ │ │ +
769 typedef typename compressed_base_array_unmanaged<B,A>::iterator Iterator;
│ │ │ │ +
770
│ │ │ │ +
772 typedef typename compressed_base_array_unmanaged<B,A>::const_iterator ConstIterator;
│ │ │ │ +
773
│ │ │ │ +
775 typedef typename A::size_type size_type;
│ │ │ │ +
776
│ │ │ │ +
777 //===== assignment from scalar
│ │ │ │ +
778
│ │ │ │ +
779 compressed_block_vector_unmanaged& operator= (const field_type& k)
│ │ │ │ +
780 {
│ │ │ │ +
781 for (size_type i=0; i<this->n; i++)
│ │ │ │ +
782 (this->p)[i] = k;
│ │ │ │ +
783 return *this;
│ │ │ │ +
784 }
│ │ │ │ +
785
│ │ │ │ +
786
│ │ │ │ +
787 //===== vector space arithmetic
│ │ │ │ +
788
│ │ │ │ +
790 template<class V>
│ │ │ │ +
791 compressed_block_vector_unmanaged& operator+= (const V& y)
│ │ │ │ +
792 {
│ │ │ │ +
793#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
794 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ +
795#endif
│ │ │ │ +
796 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) += y.p[i];
│ │ │ │ +
797 return *this;
│ │ │ │ +
798 }
│ │ │ │ +
799
│ │ │ │ +
801 template<class V>
│ │ │ │ +
802 compressed_block_vector_unmanaged& operator-= (const V& y)
│ │ │ │ +
803 {
│ │ │ │ +
804#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
805 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ +
806#endif
│ │ │ │ +
807 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) -= y.p[i];
│ │ │ │ +
808 return *this;
│ │ │ │ +
809 }
│ │ │ │ +
810
│ │ │ │ +
812 template<class V>
│ │ │ │ +
813 compressed_block_vector_unmanaged& axpy (const field_type& a, const V& y)
│ │ │ │ +
814 {
│ │ │ │ +
815#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
816 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ +
817#endif
│ │ │ │ +
818 for (size_type i=0; i<y.n; ++i)
│ │ │ │ +
819 Impl::asVector((*this)[y.j[i]]).axpy(a,Impl::asVector(y.p[i]));
│ │ │ │ +
820 return *this;
│ │ │ │ +
821 }
│ │ │ │ +
822
│ │ │ │ +
824 compressed_block_vector_unmanaged& operator*= (const field_type& k)
│ │ │ │ +
825 {
│ │ │ │ +
826 for (size_type i=0; i<this->n; ++i) (this->p)[i] *= k;
│ │ │ │ +
827 return *this;
│ │ │ │ +
828 }
│ │ │ │ +
829
│ │ │ │ +
831 compressed_block_vector_unmanaged& operator/= (const field_type& k)
│ │ │ │ +
832 {
│ │ │ │ +
833 for (size_type i=0; i<this->n; ++i) (this->p)[i] /= k;
│ │ │ │ +
834 return *this;
│ │ │ │ +
835 }
│ │ │ │ +
836
│ │ │ │ +
837
│ │ │ │ +
838 //===== Euclidean scalar product
│ │ │ │ +
839
│ │ │ │ +
841 field_type operator* (const compressed_block_vector_unmanaged& y) const
│ │ │ │ +
842 {
│ │ │ │ +
843#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
844 if (!includesindexset(y) || !y.includesindexset(*this) )
│ │ │ │ +
845 DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ │ +
846#endif
│ │ │ │ +
847 field_type sum=0;
│ │ │ │ +
848 for (size_type i=0; i<this->n; ++i)
│ │ │ │ +
849 sum += (this->p)[i] * y[(this->j)[i]];
│ │ │ │ +
850 return sum;
│ │ │ │ +
851 }
│ │ │ │ +
852
│ │ │ │ +
853
│ │ │ │ +
854 //===== norms
│ │ │ │ +
855
│ │ │ │ +
857 typename FieldTraits<field_type>::real_type one_norm () const
│ │ │ │ +
858 {
│ │ │ │ +
859 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
860 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm();
│ │ │ │ +
861 return sum;
│ │ │ │ +
862 }
│ │ │ │ +
863
│ │ │ │ +
865 typename FieldTraits<field_type>::real_type one_norm_real () const
│ │ │ │ +
866 {
│ │ │ │ +
867 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
868 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm_real();
│ │ │ │ +
869 return sum;
│ │ │ │ +
870 }
│ │ │ │ +
871
│ │ │ │ +
873 typename FieldTraits<field_type>::real_type two_norm () const
│ │ │ │ +
874 {
│ │ │ │ +
875 using std::sqrt;
│ │ │ │ +
876 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
877 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
│ │ │ │ +
878 return sqrt(sum);
│ │ │ │ +
879 }
│ │ │ │ +
880
│ │ │ │ +
882 typename FieldTraits<field_type>::real_type two_norm2 () const
│ │ │ │ +
883 {
│ │ │ │ +
884 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ │ +
885 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
│ │ │ │ +
886 return sum;
│ │ │ │ +
887 }
│ │ │ │ +
888
│ │ │ │ +
890 template <typename ft = field_type,
│ │ │ │ +
891 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
892 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
893 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
894 using std::max;
│ │ │ │ +
895
│ │ │ │ +
896 real_type norm = 0;
│ │ │ │ +
897 for (auto const &x : *this) {
│ │ │ │ +
898 real_type const a = x.infinity_norm();
│ │ │ │ +
899 norm = max(a, norm);
│ │ │ │ +
900 }
│ │ │ │ +
901 return norm;
│ │ │ │ +
902 }
│ │ │ │ +
903
│ │ │ │ +
905 template <typename ft = field_type,
│ │ │ │ +
906 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
907 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
908 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
909 using std::max;
│ │ │ │ +
910
│ │ │ │ +
911 real_type norm = 0;
│ │ │ │ +
912 for (auto const &x : *this) {
│ │ │ │ +
913 real_type const a = x.infinity_norm_real();
│ │ │ │ +
914 norm = max(a, norm);
│ │ │ │ +
915 }
│ │ │ │ +
916 return norm;
│ │ │ │ +
917 }
│ │ │ │ +
918
│ │ │ │ +
920 template <typename ft = field_type,
│ │ │ │ +
921 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
922 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ │ +
923 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
924 using std::max;
│ │ │ │ +
925
│ │ │ │ +
926 real_type norm = 0;
│ │ │ │ +
927 real_type isNaN = 1;
│ │ │ │ +
928 for (auto const &x : *this) {
│ │ │ │ +
929 real_type const a = x.infinity_norm();
│ │ │ │ +
930 norm = max(a, norm);
│ │ │ │ +
931 isNaN += a;
│ │ │ │ +
932 }
│ │ │ │ +
933 return norm * (isNaN / isNaN);
│ │ │ │ +
934 }
│ │ │ │ +
935
│ │ │ │ +
937 template <typename ft = field_type,
│ │ │ │ +
938 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ │ +
939 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ │ +
940 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ │ +
941 using std::max;
│ │ │ │ +
942
│ │ │ │ +
943 real_type norm = 0;
│ │ │ │ +
944 real_type isNaN = 1;
│ │ │ │ +
945 for (auto const &x : *this) {
│ │ │ │ +
946 real_type const a = x.infinity_norm_real();
│ │ │ │ +
947 norm = max(a, norm);
│ │ │ │ +
948 isNaN += a;
│ │ │ │ +
949 }
│ │ │ │ +
950 return norm * (isNaN / isNaN);
│ │ │ │ +
951 }
│ │ │ │ +
952
│ │ │ │ +
953 //===== sizes
│ │ │ │ +
954
│ │ │ │ +
956 size_type N () const
│ │ │ │ +
957 {
│ │ │ │ +
958 return this->n;
│ │ │ │ +
959 }
│ │ │ │ +
960
│ │ │ │ +
962 size_type dim () const
│ │ │ │ +
963 {
│ │ │ │ +
964 size_type d=0;
│ │ │ │ +
965 for (size_type i=0; i<this->n; i++)
│ │ │ │ +
966 d += (this->p)[i].dim();
│ │ │ │ +
967 return d;
│ │ │ │ +
968 }
│ │ │ │ +
969
│ │ │ │ +
970 protected:
│ │ │ │ +
972 compressed_block_vector_unmanaged () : compressed_base_array_unmanaged<B,A>()
│ │ │ │ +
973 { }
│ │ │ │ +
974
│ │ │ │ +
976 template<class V>
│ │ │ │ +
977 bool includesindexset (const V& y)
│ │ │ │ +
978 {
│ │ │ │ +
979 typename V::ConstIterator e=this->end();
│ │ │ │ +
980 for (size_type i=0; i<y.n; i++)
│ │ │ │ +
981 if (this->find(y.j[i])==e)
│ │ │ │ +
982 return false;
│ │ │ │ +
983 return true;
│ │ │ │ +
984 }
│ │ │ │ +
985 };
│ │ │ │ +
986
│ │ │ │ +
987
│ │ │ │ +
1006 template<class B, class A=std::allocator<B> >
│ │ │ │ +
1007 class CompressedBlockVectorWindow : public compressed_block_vector_unmanaged<B,A>
│ │ │ │ +
1008 {
│ │ │ │ +
1009 public:
│ │ │ │ +
1010
│ │ │ │ +
1011 //===== type definitions and constants
│ │ │ │ +
1012
│ │ │ │ +
1014 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ │ +
1015
│ │ │ │ +
1017 typedef B block_type;
│ │ │ │ +
1018
│ │ │ │ +
1020 typedef A allocator_type;
│ │ │ │ +
1021
│ │ │ │ +
1023 typedef typename A::size_type size_type;
│ │ │ │ +
1024
│ │ │ │ +
1026 [[deprecated("Use free function blockLevel(). Will be removed after 2.8.")]]
│ │ │ │ +
1027 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
│ │ │ │ +
1028
│ │ │ │ +
1030 typedef typename compressed_block_vector_unmanaged<B,A>::Iterator Iterator;
│ │ │ │ +
1031
│ │ │ │ +
1033 typedef typename compressed_block_vector_unmanaged<B,A>::ConstIterator ConstIterator;
│ │ │ │ +
1034
│ │ │ │ +
1035
│ │ │ │ +
1036 //===== constructors and such
│ │ │ │ +
1038 CompressedBlockVectorWindow () : compressed_block_vector_unmanaged<B,A>()
│ │ │ │ +
1039 { }
│ │ │ │ +
1040
│ │ │ │ +
1042 CompressedBlockVectorWindow (B* _p, size_type* _j, size_type _n)
│ │ │ │ +
1043 {
│ │ │ │ +
1044 this->n = _n;
│ │ │ │ +
1045 this->p = _p;
│ │ │ │ +
1046 this->j = _j;
│ │ │ │ +
1047 }
│ │ │ │ +
1048
│ │ │ │ +
1050 CompressedBlockVectorWindow (const CompressedBlockVectorWindow& a)
│ │ │ │ +
1051 {
│ │ │ │ +
1052 this->n = a.n;
│ │ │ │ +
1053 this->p = a.p;
│ │ │ │ +
1054 this->j = a.j;
│ │ │ │ +
1055 }
│ │ │ │ +
1056
│ │ │ │ +
1058 CompressedBlockVectorWindow& operator= (const CompressedBlockVectorWindow& a)
│ │ │ │ +
1059 {
│ │ │ │ +
1060 // check correct size
│ │ │ │ +
1061#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ │ +
1062 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ │ +
1063#endif
│ │ │ │ +
1064
│ │ │ │ +
1065 if (&a!=this) // check if this and a are different objects
│ │ │ │ +
1066 {
│ │ │ │ +
1067 // copy data
│ │ │ │ +
1068 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ │ +
1069 for (size_type i=0; i<this->n; i++) this->j[i]=a.j[i];
│ │ │ │ +
1070 }
│ │ │ │ +
1071 return *this;
│ │ │ │ +
1072 }
│ │ │ │ +
1073
│ │ │ │ +
1075 CompressedBlockVectorWindow& operator= (const field_type& k)
│ │ │ │ +
1076 {
│ │ │ │ +
1077 (static_cast<compressed_block_vector_unmanaged<B,A>&>(*this)) = k;
│ │ │ │ +
1078 return *this;
│ │ │ │ +
1079 }
│ │ │ │ +
1080
│ │ │ │ +
1081
│ │ │ │ +
1082 //===== window manipulation methods
│ │ │ │ +
1083
│ │ │ │ +
1085 void set (size_type _n, B* _p, size_type* _j)
│ │ │ │ +
1086 {
│ │ │ │ +
1087 this->n = _n;
│ │ │ │ +
1088 this->p = _p;
│ │ │ │ +
1089 this->j = _j;
│ │ │ │ +
1090 }
│ │ │ │ +
1091
│ │ │ │ +
1093 void setsize (size_type _n)
│ │ │ │ +
1094 {
│ │ │ │ +
1095 this->n = _n;
│ │ │ │ +
1096 }
│ │ │ │ +
1097
│ │ │ │ +
1099 void setptr (B* _p)
│ │ │ │ +
1100 {
│ │ │ │ +
1101 this->p = _p;
│ │ │ │ +
1102 }
│ │ │ │ +
1103
│ │ │ │ +
1105 void setindexptr (size_type* _j)
│ │ │ │ +
1106 {
│ │ │ │ +
1107 this->j = _j;
│ │ │ │ +
1108 }
│ │ │ │ +
1109
│ │ │ │ +
1111 B* getptr ()
│ │ │ │ +
1112 {
│ │ │ │ +
1113 return this->p;
│ │ │ │ +
1114 }
│ │ │ │ +
1115
│ │ │ │ +
1117 size_type* getindexptr ()
│ │ │ │ +
1118 {
│ │ │ │ +
1119 return this->j;
│ │ │ │ +
1120 }
│ │ │ │ +
1121
│ │ │ │ +
1123 const B* getptr () const
│ │ │ │ +
1124 {
│ │ │ │ +
1125 return this->p;
│ │ │ │ +
1126 }
│ │ │ │ +
1127
│ │ │ │ +
1129 const size_type* getindexptr () const
│ │ │ │ +
1130 {
│ │ │ │ +
1131 return this->j;
│ │ │ │ +
1132 }
│ │ │ │ +
1134 size_type getsize () const
│ │ │ │ +
1135 {
│ │ │ │ +
1136 return this->n;
│ │ │ │ +
1137 }
│ │ │ │ +
1138 };
│ │ │ │ +
1139
│ │ │ │ +
1140} // end namespace 'Imp'
│ │ │ │ +
1141
│ │ │ │ +
1142
│ │ │ │ +
1144 template<typename B, typename A>
│ │ │ │ +
1145 struct AutonomousValueType<Imp::BlockVectorWindow<B,A>>
│ │ │ │ +
1146 {
│ │ │ │ +
1147 using type = BlockVector<B, A>;
│ │ │ │ +
1148 };
│ │ │ │ +
1149
│ │ │ │ +
1150
│ │ │ │ +
1151} // end namespace 'Dune'
│ │ │ │ +
1152
│ │ │ │ +
1153#endif
│ │ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │ │ +
Implements several basic array containers.
│ │ │ │ + │ │ │ │ +
STL namespace.
│ │ │ │
Definition allocator.hh:11
│ │ │ │ +
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:590
│ │ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:395
│ │ │ │ +
BlockVector()
makes empty vector
Definition bvector.hh:425
│ │ │ │ +
void reserve(size_type capacity)
Reserve space.
Definition bvector.hh:475
│ │ │ │ +
BlockVector(BlockVector &&a) noexcept(noexcept(std::declval< BlockVector >().swap(a)))
move constructor
Definition bvector.hh:519
│ │ │ │ +
BlockVector(size_type _n)
make vector with _n components
Definition bvector.hh:431
│ │ │ │ +
void resize(size_type size)
Resize the vector.
Definition bvector.hh:503
│ │ │ │ +
Imp::block_vector_unmanaged< B, A >::Iterator Iterator
make iterators available as types
Definition bvector.hh:417
│ │ │ │ +
static constexpr unsigned int blocklevel
increment block level counter
Definition bvector.hh:414
│ │ │ │ +
BlockVector(const BlockVector &a) noexcept(noexcept(std::declval< BlockVector >().storage_=a.storage_))
copy constructor
Definition bvector.hh:511
│ │ │ │ +
A allocator_type
export the allocator type
Definition bvector.hh:407
│ │ │ │ +
BlockVector & operator=(const BlockVector &a) noexcept(noexcept(std::declval< BlockVector >().storage_=a.storage_))
assignment
Definition bvector.hh:526
│ │ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:401
│ │ │ │ +
A::size_type size_type
The type for the index access.
Definition bvector.hh:410
│ │ │ │ +
BlockVector(std::initializer_list< B > const &l)
Construct from a std::initializer_list.
Definition bvector.hh:437
│ │ │ │ +
size_type capacity() const
Get the capacity of the vector.
Definition bvector.hh:488
│ │ │ │ +
BlockVector(size_type _n, S _capacity)
Make vector with _n components but preallocating capacity components.
Definition bvector.hh:455
│ │ │ │ +
B block_type
export the type representing the components
Definition bvector.hh:404
│ │ │ │ +
void swap(BlockVector &other) noexcept(noexcept(std::declval< BlockVector & >().storage_.swap(other.storage_)))
swap operation
Definition bvector.hh:544
│ │ │ │ +
Imp::block_vector_unmanaged< B, A >::ConstIterator ConstIterator
make iterators available as types
Definition bvector.hh:420
│ │ │ │ +
FieldTraits< B >::real_type real_type
Definition bvector.hh:582
│ │ │ │ +
FieldTraits< B >::field_type field_type
Definition bvector.hh:581
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,426 +1,1010 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -basearray.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 (C) 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_BASEARRAY_HH │ │ │ │ │ -6#define DUNE_ISTL_BASEARRAY_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include "assert.h" │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ -15#include │ │ │ │ │ -16 │ │ │ │ │ -21namespace _D_u_n_e { │ │ │ │ │ -22 │ │ │ │ │ -24namespace Imp { │ │ │ │ │ +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 │ │ │ │ │ +16#include │ │ │ │ │ +17 │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22#include │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ 25 │ │ │ │ │ -50 template > │ │ │ │ │ -51 class base_array_unmanaged │ │ │ │ │ -52 { │ │ │ │ │ -53 public: │ │ │ │ │ -54 │ │ │ │ │ -55 //===== type definitions and constants │ │ │ │ │ -56 │ │ │ │ │ -58 typedef B member_type; │ │ │ │ │ -59 │ │ │ │ │ -61 typedef A allocator_type; │ │ │ │ │ -62 │ │ │ │ │ -64 typedef typename A::size_type size_type; │ │ │ │ │ -65 │ │ │ │ │ -67 using reference = B&; │ │ │ │ │ -68 │ │ │ │ │ -70 using const_reference = const B&; │ │ │ │ │ -71 │ │ │ │ │ -72 //===== access to components │ │ │ │ │ -73 │ │ │ │ │ -75 reference operator[] (size_type i) │ │ │ │ │ -76 { │ │ │ │ │ -77#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -78 if (i>=n) DUNE_THROW(ISTLError,"index out of range"); │ │ │ │ │ -79#endif │ │ │ │ │ -80 return p[i]; │ │ │ │ │ -81 } │ │ │ │ │ -82 │ │ │ │ │ -84 const_reference operator[] (size_type i) const │ │ │ │ │ +26#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ │ +27 │ │ │ │ │ +28#include "_b_a_s_e_a_r_r_a_y_._h_h" │ │ │ │ │ +29#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ │ +30 │ │ │ │ │ +38namespace _D_u_n_e { │ │ │ │ │ +39 │ │ │ │ │ +41namespace Imp { │ │ │ │ │ +42 │ │ │ │ │ +48 template │ │ │ │ │ +49 class BlockTraitsImp; │ │ │ │ │ +50 │ │ │ │ │ +51 template │ │ │ │ │ +52 class BlockTraitsImp │ │ │ │ │ +53 { │ │ │ │ │ +54 public: │ │ │ │ │ +55 using field_type = B; │ │ │ │ │ +56 }; │ │ │ │ │ +57 │ │ │ │ │ +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#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ -87 if (i>=n) DUNE_THROW(ISTLError,"index out of range"); │ │ │ │ │ -88#endif │ │ │ │ │ -89 return p[i]; │ │ │ │ │ -90 } │ │ │ │ │ -91 │ │ │ │ │ -93 template │ │ │ │ │ -94 class RealIterator │ │ │ │ │ -95 : public RandomAccessIteratorFacade, T> │ │ │ │ │ -96 { │ │ │ │ │ -97 public: │ │ │ │ │ -99 typedef typename std::remove_const::type ValueType; │ │ │ │ │ -100 │ │ │ │ │ -101 friend class RandomAccessIteratorFacade, │ │ │ │ │ -const ValueType>; │ │ │ │ │ -102 friend class RandomAccessIteratorFacade, │ │ │ │ │ -ValueType>; │ │ │ │ │ -103 friend class RealIterator; │ │ │ │ │ -104 friend class RealIterator; │ │ │ │ │ +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 A allocator_type; │ │ │ │ │ +96 │ │ │ │ │ +98 typedef typename A::size_type size_type; │ │ │ │ │ +99 │ │ │ │ │ +101 typedef typename base_array_unmanaged::iterator Iterator; │ │ │ │ │ +102 │ │ │ │ │ +104 typedef typename base_array_unmanaged::const_iterator ConstIterator; │ │ │ │ │ 105 │ │ │ │ │ -107 RealIterator () │ │ │ │ │ -108 : p(0), i(0) │ │ │ │ │ -109 {} │ │ │ │ │ -110 │ │ │ │ │ -111 RealIterator (const B* _p, B* _i) : p(_p), i(_i) │ │ │ │ │ -112 { } │ │ │ │ │ -113 │ │ │ │ │ -114 RealIterator(const RealIterator& it) │ │ │ │ │ -115 : p(it.p), i(it.i) │ │ │ │ │ -116 {} │ │ │ │ │ +107 typedef B value_type; │ │ │ │ │ +108 │ │ │ │ │ +110 typedef B& reference; │ │ │ │ │ +111 │ │ │ │ │ +113 typedef const B& const_reference; │ │ │ │ │ +114 │ │ │ │ │ +115 //===== assignment from scalar │ │ │ │ │ 117 │ │ │ │ │ -119 size_type index () const │ │ │ │ │ -120 { │ │ │ │ │ -121 return i-p; │ │ │ │ │ -122 } │ │ │ │ │ -123 │ │ │ │ │ -125 bool equals (const RealIterator& other) const │ │ │ │ │ -126 { │ │ │ │ │ -127 assert(other.p==p); │ │ │ │ │ -128 return i==other.i; │ │ │ │ │ -129 } │ │ │ │ │ -130 │ │ │ │ │ -132 bool equals (const RealIterator& other) const │ │ │ │ │ -133 { │ │ │ │ │ -134 assert(other.p==p); │ │ │ │ │ -135 return i==other.i; │ │ │ │ │ -136 } │ │ │ │ │ -137 │ │ │ │ │ -138 std::ptrdiff_t distanceTo(const RealIterator& o) const │ │ │ │ │ -139 { │ │ │ │ │ -140 return o.i-i; │ │ │ │ │ -141 } │ │ │ │ │ -142 │ │ │ │ │ -143 private: │ │ │ │ │ -145 void increment() │ │ │ │ │ -146 { │ │ │ │ │ -147 ++i; │ │ │ │ │ -148 } │ │ │ │ │ -149 │ │ │ │ │ -151 void decrement() │ │ │ │ │ -152 { │ │ │ │ │ -153 --i; │ │ │ │ │ -154 } │ │ │ │ │ -155 │ │ │ │ │ -156 // Needed for operator[] of the iterator │ │ │ │ │ -157 reference elementAt (std::ptrdiff_t offset) const │ │ │ │ │ -158 { │ │ │ │ │ -159 return *(i+offset); │ │ │ │ │ -160 } │ │ │ │ │ -161 │ │ │ │ │ -163 reference dereference () const │ │ │ │ │ -164 { │ │ │ │ │ -165 return *i; │ │ │ │ │ -166 } │ │ │ │ │ -167 │ │ │ │ │ -168 void advance(std::ptrdiff_t d) │ │ │ │ │ -169 { │ │ │ │ │ -170 i+=d; │ │ │ │ │ -171 } │ │ │ │ │ +118 block_vector_unmanaged& operator= (const field_type& k) │ │ │ │ │ +119 { │ │ │ │ │ +120 for (size_type i=0; in; i++) │ │ │ │ │ +121 (*this)[i] = k; │ │ │ │ │ +122 return *this; │ │ │ │ │ +123 } │ │ │ │ │ +124 │ │ │ │ │ +125 //===== vector space arithmetic │ │ │ │ │ +127 block_vector_unmanaged& operator+= (const block_vector_unmanaged& y) │ │ │ │ │ +128 { │ │ │ │ │ +129#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +130 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ +131#endif │ │ │ │ │ +132 for (size_type i=0; in; ++i) (*this)[i] += y[i]; │ │ │ │ │ +133 return *this; │ │ │ │ │ +134 } │ │ │ │ │ +135 │ │ │ │ │ +137 block_vector_unmanaged& operator-= (const block_vector_unmanaged& y) │ │ │ │ │ +138 { │ │ │ │ │ +139#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +140 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ +141#endif │ │ │ │ │ +142 for (size_type i=0; in; ++i) (*this)[i] -= y[i]; │ │ │ │ │ +143 return *this; │ │ │ │ │ +144 } │ │ │ │ │ +145 │ │ │ │ │ +147 block_vector_unmanaged& operator*= (const field_type& k) │ │ │ │ │ +148 { │ │ │ │ │ +149 for (size_type i=0; in; ++i) (*this)[i] *= k; │ │ │ │ │ +150 return *this; │ │ │ │ │ +151 } │ │ │ │ │ +152 │ │ │ │ │ +154 block_vector_unmanaged& operator/= (const field_type& k) │ │ │ │ │ +155 { │ │ │ │ │ +156 for (size_type i=0; in; ++i) (*this)[i] /= k; │ │ │ │ │ +157 return *this; │ │ │ │ │ +158 } │ │ │ │ │ +159 │ │ │ │ │ +161 block_vector_unmanaged& axpy (const field_type& a, const │ │ │ │ │ +block_vector_unmanaged& y) │ │ │ │ │ +162 { │ │ │ │ │ +163#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +164 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ +165#endif │ │ │ │ │ +166 for (size_type i=0; in; ++i) │ │ │ │ │ +167 Impl::asVector((*this)[i]).axpy(a,Impl::asVector(y[i])); │ │ │ │ │ +168 │ │ │ │ │ +169 return *this; │ │ │ │ │ +170 } │ │ │ │ │ +171 │ │ │ │ │ 172 │ │ │ │ │ -173 const B* p; │ │ │ │ │ -174 B* i; │ │ │ │ │ -175 }; │ │ │ │ │ -176 │ │ │ │ │ -178 typedef RealIterator iterator; │ │ │ │ │ -179 │ │ │ │ │ -180 │ │ │ │ │ -182 iterator begin () │ │ │ │ │ -183 { │ │ │ │ │ -184 return iterator(p,p); │ │ │ │ │ -185 } │ │ │ │ │ -186 │ │ │ │ │ -188 iterator end () │ │ │ │ │ -189 { │ │ │ │ │ -190 return iterator(p,p+n); │ │ │ │ │ -191 } │ │ │ │ │ -192 │ │ │ │ │ -195 iterator beforeEnd () │ │ │ │ │ -196 { │ │ │ │ │ -197 return iterator(p,p+n-1); │ │ │ │ │ -198 } │ │ │ │ │ -199 │ │ │ │ │ -202 iterator beforeBegin () │ │ │ │ │ +180 template │ │ │ │ │ +181 auto operator* (const block_vector_unmanaged& y) const │ │ │ │ │ +182 { │ │ │ │ │ +183 typedef typename PromotionTraits:: │ │ │ │ │ +field_type>::PromotedType PromotedType; │ │ │ │ │ +184 PromotedType sum(0); │ │ │ │ │ +185#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +186 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ +187#endif │ │ │ │ │ +188 for (size_type i=0; in; ++i) { │ │ │ │ │ +189 sum += PromotedType(((*this)[i])*y[i]); │ │ │ │ │ +190 } │ │ │ │ │ +191 return sum; │ │ │ │ │ +192 } │ │ │ │ │ +193 │ │ │ │ │ +201 template │ │ │ │ │ +202 auto dot(const block_vector_unmanaged& y) const │ │ │ │ │ 203 { │ │ │ │ │ -204 return iterator(p,p-1); │ │ │ │ │ -205 } │ │ │ │ │ -206 │ │ │ │ │ -208 iterator find (size_type i) │ │ │ │ │ -209 { │ │ │ │ │ -210 return iterator(p,p+std::min(i,n)); │ │ │ │ │ -211 } │ │ │ │ │ +204 typedef typename PromotionTraits:: │ │ │ │ │ +field_type>::PromotedType PromotedType; │ │ │ │ │ +205 PromotedType sum(0); │ │ │ │ │ +206#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +207 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ +208#endif │ │ │ │ │ +209 │ │ │ │ │ +210 for (size_type i=0; in; ++i) │ │ │ │ │ +211 sum += Impl::asVector((*this)[i]).dot(Impl::asVector(y[i])); │ │ │ │ │ 212 │ │ │ │ │ -214 typedef RealIterator const_iterator; │ │ │ │ │ +213 return sum; │ │ │ │ │ +214 } │ │ │ │ │ 215 │ │ │ │ │ -217 const_iterator begin () const │ │ │ │ │ -218 { │ │ │ │ │ -219 return const_iterator(p,p+0); │ │ │ │ │ -220 } │ │ │ │ │ -221 │ │ │ │ │ -223 const_iterator end () const │ │ │ │ │ -224 { │ │ │ │ │ -225 return const_iterator(p,p+n); │ │ │ │ │ -226 } │ │ │ │ │ -227 │ │ │ │ │ -230 const_iterator beforeEnd () const │ │ │ │ │ -231 { │ │ │ │ │ -232 return const_iterator(p,p+n-1); │ │ │ │ │ -233 } │ │ │ │ │ -234 │ │ │ │ │ -237 const_iterator beforeBegin () const │ │ │ │ │ +216 //===== norms │ │ │ │ │ +217 │ │ │ │ │ +219 typename FieldTraits::real_type one_norm () const │ │ │ │ │ +220 { │ │ │ │ │ +221 typename FieldTraits::real_type sum=0; │ │ │ │ │ +222 for (size_type i=0; in; ++i) │ │ │ │ │ +223 sum += Impl::asVector((*this)[i]).one_norm(); │ │ │ │ │ +224 return sum; │ │ │ │ │ +225 } │ │ │ │ │ +226 │ │ │ │ │ +228 typename FieldTraits::real_type one_norm_real () const │ │ │ │ │ +229 { │ │ │ │ │ +230 typename FieldTraits::real_type sum=0; │ │ │ │ │ +231 for (size_type i=0; in; ++i) │ │ │ │ │ +232 sum += Impl::asVector((*this)[i]).one_norm_real(); │ │ │ │ │ +233 return sum; │ │ │ │ │ +234 } │ │ │ │ │ +235 │ │ │ │ │ +237 typename FieldTraits::real_type two_norm () const │ │ │ │ │ 238 { │ │ │ │ │ -239 return const_iterator(p,p-1); │ │ │ │ │ -240 } │ │ │ │ │ -241 │ │ │ │ │ -243 const_iterator find (size_type i) const │ │ │ │ │ -244 { │ │ │ │ │ -245 return const_iterator(p,p+std::min(i,n)); │ │ │ │ │ -246 } │ │ │ │ │ -247 │ │ │ │ │ -248 │ │ │ │ │ -249 //===== sizes │ │ │ │ │ -250 │ │ │ │ │ -252 size_type size () const │ │ │ │ │ -253 { │ │ │ │ │ -254 return n; │ │ │ │ │ -255 } │ │ │ │ │ -256 │ │ │ │ │ -258 const B* data() const │ │ │ │ │ -259 { │ │ │ │ │ -260 return p; │ │ │ │ │ -261 } │ │ │ │ │ -262 │ │ │ │ │ -264 B* data() │ │ │ │ │ -265 { │ │ │ │ │ -266 return p; │ │ │ │ │ -267 } │ │ │ │ │ -268 │ │ │ │ │ -269 protected: │ │ │ │ │ -271 base_array_unmanaged () │ │ │ │ │ -272 : n(0), p(0) │ │ │ │ │ -273 {} │ │ │ │ │ -275 base_array_unmanaged (size_type n_, B* p_) │ │ │ │ │ -276 : n(n_), p(p_) │ │ │ │ │ -277 {} │ │ │ │ │ -278 size_type n; // number of elements in array │ │ │ │ │ -279 B *p; // pointer to dynamically allocated built-in array │ │ │ │ │ -280 }; │ │ │ │ │ +239 using std::sqrt; │ │ │ │ │ +240 return sqrt(two_norm2()); │ │ │ │ │ +241 } │ │ │ │ │ +242 │ │ │ │ │ +244 typename FieldTraits::real_type two_norm2 () const │ │ │ │ │ +245 { │ │ │ │ │ +246 typename FieldTraits::real_type sum=0; │ │ │ │ │ +247 for (size_type i=0; in; ++i) │ │ │ │ │ +248 sum += Impl::asVector((*this)[i]).two_norm2(); │ │ │ │ │ +249 return sum; │ │ │ │ │ +250 } │ │ │ │ │ +251 │ │ │ │ │ +253 template ::value, int>::type = 0> │ │ │ │ │ +255 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ +256 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +257 using std::max; │ │ │ │ │ +258 │ │ │ │ │ +259 real_type norm = 0; │ │ │ │ │ +260 for (auto const &xi : *this) { │ │ │ │ │ +261 real_type const a = Impl::asVector(xi).infinity_norm(); │ │ │ │ │ +262 norm = max(a, norm); │ │ │ │ │ +263 } │ │ │ │ │ +264 return norm; │ │ │ │ │ +265 } │ │ │ │ │ +266 │ │ │ │ │ +268 template ::value, int>::type = 0> │ │ │ │ │ +270 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ +271 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +272 using std::max; │ │ │ │ │ +273 │ │ │ │ │ +274 real_type norm = 0; │ │ │ │ │ +275 for (auto const &xi : *this) { │ │ │ │ │ +276 real_type const a = Impl::asVector(xi).infinity_norm_real(); │ │ │ │ │ +277 norm = max(a, norm); │ │ │ │ │ +278 } │ │ │ │ │ +279 return norm; │ │ │ │ │ +280 } │ │ │ │ │ 281 │ │ │ │ │ -282 │ │ │ │ │ -283 │ │ │ │ │ -305 template > │ │ │ │ │ -306 class compressed_base_array_unmanaged │ │ │ │ │ -307 { │ │ │ │ │ -308 public: │ │ │ │ │ -309 │ │ │ │ │ -310 //===== type definitions and constants │ │ │ │ │ -311 │ │ │ │ │ -313 typedef B member_type; │ │ │ │ │ -314 │ │ │ │ │ -316 typedef A allocator_type; │ │ │ │ │ -317 │ │ │ │ │ -319 typedef typename A::size_type size_type; │ │ │ │ │ -320 │ │ │ │ │ -322 using reference = B&; │ │ │ │ │ -323 │ │ │ │ │ -325 using const_reference = const B&; │ │ │ │ │ -326 │ │ │ │ │ -327 //===== access to components │ │ │ │ │ -328 │ │ │ │ │ -330 reference operator[] (size_type i) │ │ │ │ │ -331 { │ │ │ │ │ -332 const size_type* lb = std::lower_bound(j, j+n, i); │ │ │ │ │ -333 if (lb == j+n || *lb != i) │ │ │ │ │ -334 DUNE_THROW(ISTLError,"index "<::value, int>::type = 0> │ │ │ │ │ +285 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ +286 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +287 using std::max; │ │ │ │ │ +288 using std::abs; │ │ │ │ │ +289 │ │ │ │ │ +290 real_type norm = 0; │ │ │ │ │ +291 real_type isNaN = 1; │ │ │ │ │ +292 │ │ │ │ │ +293 for (auto const &xi : *this) { │ │ │ │ │ +294 real_type const a = Impl::asVector(xi).infinity_norm(); │ │ │ │ │ +295 norm = max(a, norm); │ │ │ │ │ +296 isNaN += a; │ │ │ │ │ +297 } │ │ │ │ │ +298 return norm * (isNaN / isNaN); │ │ │ │ │ +299 } │ │ │ │ │ +300 │ │ │ │ │ +302 template ::value, int>::type = 0> │ │ │ │ │ +304 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ +305 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +306 using std::max; │ │ │ │ │ +307 │ │ │ │ │ +308 real_type norm = 0; │ │ │ │ │ +309 real_type isNaN = 1; │ │ │ │ │ +310 │ │ │ │ │ +311 for (auto const &xi : *this) { │ │ │ │ │ +312 real_type const a = Impl::asVector(xi).infinity_norm_real(); │ │ │ │ │ +313 norm = max(a, norm); │ │ │ │ │ +314 isNaN += a; │ │ │ │ │ +315 } │ │ │ │ │ +316 │ │ │ │ │ +317 return norm * (isNaN / isNaN); │ │ │ │ │ +318 } │ │ │ │ │ +319 │ │ │ │ │ +320 //===== sizes │ │ │ │ │ +321 │ │ │ │ │ +323 size_type N () const │ │ │ │ │ +324 { │ │ │ │ │ +325 return this->n; │ │ │ │ │ +326 } │ │ │ │ │ +327 │ │ │ │ │ +329 size_type dim () const │ │ │ │ │ +330 { │ │ │ │ │ +331 size_type d=0; │ │ │ │ │ +332 │ │ │ │ │ +333 for (size_type i=0; in; i++) │ │ │ │ │ +334 d += Impl::asVector((*this)[i]).dim(); │ │ │ │ │ +335 │ │ │ │ │ +336 return d; │ │ │ │ │ +337 } │ │ │ │ │ +338 │ │ │ │ │ +339 protected: │ │ │ │ │ +341 block_vector_unmanaged () : base_array_unmanaged() │ │ │ │ │ +342 { } │ │ │ │ │ +343 }; │ │ │ │ │ +344 │ │ │ │ │ 346 │ │ │ │ │ -348 template │ │ │ │ │ -349 class RealIterator │ │ │ │ │ -350 : public BidirectionalIteratorFacade, T> │ │ │ │ │ -351 { │ │ │ │ │ -352 public: │ │ │ │ │ -354 typedef typename std::remove_const::type ValueType; │ │ │ │ │ -355 │ │ │ │ │ -356 friend class BidirectionalIteratorFacade, │ │ │ │ │ -const ValueType>; │ │ │ │ │ -357 friend class BidirectionalIteratorFacade, │ │ │ │ │ -ValueType>; │ │ │ │ │ -358 friend class RealIterator; │ │ │ │ │ -359 friend class RealIterator; │ │ │ │ │ -360 │ │ │ │ │ -362 RealIterator () │ │ │ │ │ -363 : p(0), j(0), i(0) │ │ │ │ │ -364 {} │ │ │ │ │ -365 │ │ │ │ │ -367 RealIterator (B* _p, size_type* _j, size_type _i) │ │ │ │ │ -368 : p(_p), j(_j), i(_i) │ │ │ │ │ -369 { } │ │ │ │ │ -370 │ │ │ │ │ -374 RealIterator(const RealIterator& it) │ │ │ │ │ -375 : p(it.p), j(it.j), i(it.i) │ │ │ │ │ -376 {} │ │ │ │ │ +351 template │ │ │ │ │ +352 class ScopeGuard { │ │ │ │ │ +353 F cleanupFunc_; │ │ │ │ │ +354 public: │ │ │ │ │ +355 ScopeGuard(F cleanupFunc) : cleanupFunc_(_s_t_d::move(cleanupFunc)) {} │ │ │ │ │ +356 ScopeGuard(const ScopeGuard &) = delete; │ │ │ │ │ +357 ScopeGuard(ScopeGuard &&) = delete; │ │ │ │ │ +358 ScopeGuard &operator=(ScopeGuard) = delete; │ │ │ │ │ +359 ~ScopeGuard() { cleanupFunc_(); } │ │ │ │ │ +360 }; │ │ │ │ │ +361 │ │ │ │ │ +363 │ │ │ │ │ +372 template │ │ │ │ │ +373 ScopeGuard makeScopeGuard(F cleanupFunc) │ │ │ │ │ +374 { │ │ │ │ │ +375 return { std::move(cleanupFunc) }; │ │ │ │ │ +376 } │ │ │ │ │ 377 │ │ │ │ │ -378 │ │ │ │ │ -380 bool equals (const RealIterator& it) const │ │ │ │ │ -381 { │ │ │ │ │ -382 assert(p==it.p); │ │ │ │ │ -383 return (i)==(it.i); │ │ │ │ │ -384 } │ │ │ │ │ -385 │ │ │ │ │ -387 bool equals (const RealIterator& it) const │ │ │ │ │ -388 { │ │ │ │ │ -389 assert(p==it.p); │ │ │ │ │ -390 return (i)==(it.i); │ │ │ │ │ -391 } │ │ │ │ │ -392 │ │ │ │ │ -393 │ │ │ │ │ -395 size_type index () const │ │ │ │ │ -396 { │ │ │ │ │ -397 return j[i]; │ │ │ │ │ -398 } │ │ │ │ │ +378} // end namespace Imp │ │ │ │ │ +393 template > │ │ │ │ │ +_3_9_4 class _B_l_o_c_k_V_e_c_t_o_r : public Imp::block_vector_unmanaged │ │ │ │ │ +395 { │ │ │ │ │ +396 public: │ │ │ │ │ +397 │ │ │ │ │ +398 //===== type definitions and constants │ │ │ │ │ 399 │ │ │ │ │ -401 void setindex (size_type k) │ │ │ │ │ -402 { │ │ │ │ │ -403 return j[i] = k; │ │ │ │ │ -404 } │ │ │ │ │ +_4_0_1 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ │ +402 │ │ │ │ │ +_4_0_4 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ │ 405 │ │ │ │ │ -413 size_type offset () const │ │ │ │ │ -414 { │ │ │ │ │ -415 return i; │ │ │ │ │ -416 } │ │ │ │ │ -417 │ │ │ │ │ -418 private: │ │ │ │ │ -420 void increment() │ │ │ │ │ -421 { │ │ │ │ │ -422 ++i; │ │ │ │ │ -423 } │ │ │ │ │ -424 │ │ │ │ │ -426 void decrement() │ │ │ │ │ -427 { │ │ │ │ │ -428 --i; │ │ │ │ │ -429 } │ │ │ │ │ -430 │ │ │ │ │ -432 reference dereference () const │ │ │ │ │ -433 { │ │ │ │ │ -434 return p[i]; │ │ │ │ │ -435 } │ │ │ │ │ -436 │ │ │ │ │ -437 B* p; │ │ │ │ │ -438 size_type* j; │ │ │ │ │ -439 size_type i; │ │ │ │ │ -440 }; │ │ │ │ │ +_4_0_7 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ │ +408 │ │ │ │ │ +_4_1_0 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ │ +411 │ │ │ │ │ +413 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ +2.8.")]] │ │ │ │ │ +_4_1_4 static constexpr unsigned int _b_l_o_c_k_l_e_v_e_l = blockLevel()+1; │ │ │ │ │ +415 │ │ │ │ │ +_4_1_7 typedef typename Imp::block_vector_unmanaged::Iterator _I_t_e_r_a_t_o_r; │ │ │ │ │ +418 │ │ │ │ │ +_4_2_0 typedef typename Imp::block_vector_unmanaged::ConstIterator │ │ │ │ │ +_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ │ +421 │ │ │ │ │ +422 //===== constructors and such │ │ │ │ │ +423 │ │ │ │ │ +_4_2_5 _B_l_o_c_k_V_e_c_t_o_r () │ │ │ │ │ +426 { │ │ │ │ │ +427 syncBaseArray(); │ │ │ │ │ +428 } │ │ │ │ │ +429 │ │ │ │ │ +_4_3_1 explicit _B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e _n) : storage_(_n) │ │ │ │ │ +432 { │ │ │ │ │ +433 syncBaseArray(); │ │ │ │ │ +434 } │ │ │ │ │ +435 │ │ │ │ │ +_4_3_7 _B_l_o_c_k_V_e_c_t_o_r (std::initializer_list const &l) : storage_(l) │ │ │ │ │ +438 { │ │ │ │ │ +439 syncBaseArray(); │ │ │ │ │ +440 } │ │ │ │ │ 441 │ │ │ │ │ -443 typedef RealIterator iterator; │ │ │ │ │ -444 │ │ │ │ │ -446 iterator begin () │ │ │ │ │ -447 { │ │ │ │ │ -448 return iterator(p,j,0); │ │ │ │ │ -449 } │ │ │ │ │ -450 │ │ │ │ │ -452 iterator end () │ │ │ │ │ -453 { │ │ │ │ │ -454 return iterator(p,j,n); │ │ │ │ │ -455 } │ │ │ │ │ -456 │ │ │ │ │ -459 iterator beforeEnd () │ │ │ │ │ -460 { │ │ │ │ │ -461 return iterator(p,j,n-1); │ │ │ │ │ -462 } │ │ │ │ │ -463 │ │ │ │ │ -466 iterator beforeBegin () │ │ │ │ │ -467 { │ │ │ │ │ -468 return iterator(p,j,-1); │ │ │ │ │ -469 } │ │ │ │ │ -470 │ │ │ │ │ -472 iterator find (size_type i) │ │ │ │ │ -473 { │ │ │ │ │ -474 const size_type* lb = std::lower_bound(j, j+n, i); │ │ │ │ │ -475 return (lb != j+n && *lb == i) │ │ │ │ │ -476 ? iterator(p,j,lb-j) │ │ │ │ │ -477 : end(); │ │ │ │ │ -478 } │ │ │ │ │ -479 │ │ │ │ │ -481 typedef RealIterator const_iterator; │ │ │ │ │ -482 │ │ │ │ │ -484 const_iterator begin () const │ │ │ │ │ -485 { │ │ │ │ │ -486 return const_iterator(p,j,0); │ │ │ │ │ -487 } │ │ │ │ │ -488 │ │ │ │ │ -490 const_iterator end () const │ │ │ │ │ -491 { │ │ │ │ │ -492 return const_iterator(p,j,n); │ │ │ │ │ -493 } │ │ │ │ │ -494 │ │ │ │ │ -497 const_iterator beforeEnd () const │ │ │ │ │ -498 { │ │ │ │ │ -499 return const_iterator(p,j,n-1); │ │ │ │ │ -500 } │ │ │ │ │ -501 │ │ │ │ │ -504 const_iterator beforeBegin () const │ │ │ │ │ -505 { │ │ │ │ │ -506 return const_iterator(p,j,-1); │ │ │ │ │ -507 } │ │ │ │ │ -508 │ │ │ │ │ -510 const_iterator find (size_type i) const │ │ │ │ │ -511 { │ │ │ │ │ -512 const size_type* lb = std::lower_bound(j, j+n, i); │ │ │ │ │ -513 return (lb != j+n && *lb == i) │ │ │ │ │ -514 ? const_iterator(p,j,lb-j) │ │ │ │ │ -515 : end(); │ │ │ │ │ +442 │ │ │ │ │ +454 template │ │ │ │ │ +_4_5_5 _B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e _n, S _capacity) │ │ │ │ │ +456 { │ │ │ │ │ +457 static_assert(std::numeric_limits::is_integer, │ │ │ │ │ +458 "capacity must be an unsigned integral type (be aware, that this │ │ │ │ │ +constructor does not set the default value!)" ); │ │ │ │ │ +459 if((_s_i_z_e___t_y_p_e)_capacity > _n) │ │ │ │ │ +460 storage_.reserve(_capacity); │ │ │ │ │ +461 storage_.resize(_n); │ │ │ │ │ +462 syncBaseArray(); │ │ │ │ │ +463 } │ │ │ │ │ +464 │ │ │ │ │ +465 │ │ │ │ │ +_4_7_5 void _r_e_s_e_r_v_e(_s_i_z_e___t_y_p_e _c_a_p_a_c_i_t_y) │ │ │ │ │ +476 { │ │ │ │ │ +477 [[maybe_unused]] const auto &guard = │ │ │ │ │ +478 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ │ +479 storage_.reserve(_c_a_p_a_c_i_t_y); │ │ │ │ │ +480 } │ │ │ │ │ +481 │ │ │ │ │ +_4_8_8 _s_i_z_e___t_y_p_e _c_a_p_a_c_i_t_y() const │ │ │ │ │ +489 { │ │ │ │ │ +490 return storage_.capacity(); │ │ │ │ │ +491 } │ │ │ │ │ +492 │ │ │ │ │ +_5_0_3 void _r_e_s_i_z_e(_s_i_z_e___t_y_p_e size) │ │ │ │ │ +504 { │ │ │ │ │ +505 [[maybe_unused]] const auto &guard = │ │ │ │ │ +506 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ │ +507 storage_.resize(size); │ │ │ │ │ +508 } │ │ │ │ │ +509 │ │ │ │ │ +_5_1_1 _B_l_o_c_k_V_e_c_t_o_r(const _B_l_o_c_k_V_e_c_t_o_r &a) │ │ │ │ │ +512 noexcept(noexcept(std::declval().storage_ = a.storage_)) │ │ │ │ │ +513 { │ │ │ │ │ +514 storage_ = a.storage_; │ │ │ │ │ +515 syncBaseArray(); │ │ │ │ │ 516 } │ │ │ │ │ 517 │ │ │ │ │ -518 //===== sizes │ │ │ │ │ -519 │ │ │ │ │ -521 size_type size () const │ │ │ │ │ -522 { │ │ │ │ │ -523 return n; │ │ │ │ │ -524 } │ │ │ │ │ -525 │ │ │ │ │ -526 protected: │ │ │ │ │ -528 compressed_base_array_unmanaged () │ │ │ │ │ -529 : n(0), p(0), j(0) │ │ │ │ │ -530 {} │ │ │ │ │ -531 │ │ │ │ │ -532 size_type n; // number of elements in array │ │ │ │ │ -533 B *p; // pointer to dynamically allocated built-in array │ │ │ │ │ -534 size_type* j; // the index set │ │ │ │ │ -535 }; │ │ │ │ │ -536 │ │ │ │ │ -537} // end namespace Imp │ │ │ │ │ -538 │ │ │ │ │ -539} // end namespace │ │ │ │ │ -540 │ │ │ │ │ -541#endif │ │ │ │ │ +_5_1_9 _B_l_o_c_k_V_e_c_t_o_r(_B_l_o_c_k_V_e_c_t_o_r &&a) │ │ │ │ │ +520 noexcept(noexcept(std::declval().swap(a))) │ │ │ │ │ +521 { │ │ │ │ │ +522 _s_w_a_p(a); │ │ │ │ │ +523 } │ │ │ │ │ +524 │ │ │ │ │ +_5_2_6 _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) │ │ │ │ │ +527 noexcept(noexcept(std::declval().storage_ = a.storage_)) │ │ │ │ │ +528 { │ │ │ │ │ +529 [[maybe_unused]] const auto &guard = │ │ │ │ │ +530 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ │ +531 storage_ = a.storage_; │ │ │ │ │ +532 return *this; │ │ │ │ │ +533 } │ │ │ │ │ +534 │ │ │ │ │ +_5_3_6 _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) │ │ │ │ │ +537 noexcept(noexcept(std::declval().swap(a))) │ │ │ │ │ +538 { │ │ │ │ │ +539 _s_w_a_p(a); │ │ │ │ │ +540 return *this; │ │ │ │ │ +541 } │ │ │ │ │ +542 │ │ │ │ │ +_5_4_4 void _s_w_a_p(_B_l_o_c_k_V_e_c_t_o_r &other) │ │ │ │ │ +545 noexcept(noexcept( │ │ │ │ │ +546 std::declval().storage_.swap(other.storage_))) │ │ │ │ │ +547 { │ │ │ │ │ +548 [[maybe_unused]] const auto &guard = Imp::makeScopeGuard([&]{ │ │ │ │ │ +549 syncBaseArray(); │ │ │ │ │ +550 other.syncBaseArray(); │ │ │ │ │ +551 }); │ │ │ │ │ +552 storage_.swap(other.storage_); │ │ │ │ │ +553 } │ │ │ │ │ +554 │ │ │ │ │ +_5_5_6 _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) │ │ │ │ │ +557 { │ │ │ │ │ +558 // forward to operator= in base class │ │ │ │ │ +559 (static_cast&>(*this)) = k; │ │ │ │ │ +560 return *this; │ │ │ │ │ +561 } │ │ │ │ │ +562 │ │ │ │ │ +563 private: │ │ │ │ │ +564 void syncBaseArray() noexcept │ │ │ │ │ +565 { │ │ │ │ │ +566 this->p = storage_.data(); │ │ │ │ │ +567 this->n = storage_.size(); │ │ │ │ │ +568 } │ │ │ │ │ +569 │ │ │ │ │ +570 std::vector storage_; │ │ │ │ │ +571 }; │ │ │ │ │ +572 │ │ │ │ │ +578 template │ │ │ │ │ +_5_7_9 struct FieldTraits< _B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ │ +580 { │ │ │ │ │ +_5_8_1 typedef typename FieldTraits::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ +_5_8_2 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ │ +583 }; │ │ │ │ │ +589 template │ │ │ │ │ +_5_9_0 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) │ │ │ │ │ +591 { │ │ │ │ │ +592 typedef typename _B_l_o_c_k_V_e_c_t_o_r_<_K_,_ _A_>_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ │ +593 │ │ │ │ │ +594 for (size_type i=0; i │ │ │ │ │ +623#else │ │ │ │ │ +624 template > │ │ │ │ │ +625#endif │ │ │ │ │ +626 class BlockVectorWindow : public Imp::block_vector_unmanaged │ │ │ │ │ +627 { │ │ │ │ │ +628 public: │ │ │ │ │ +629 │ │ │ │ │ +630 //===== type definitions and constants │ │ │ │ │ +631 │ │ │ │ │ +633 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ │ +634 │ │ │ │ │ +636 typedef B block_type; │ │ │ │ │ +637 │ │ │ │ │ +639 typedef A allocator_type; │ │ │ │ │ +640 │ │ │ │ │ +642 typedef typename A::size_type size_type; │ │ │ │ │ +643 │ │ │ │ │ +645 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ +2.8.")]] │ │ │ │ │ +646 static constexpr unsigned int blocklevel = blockLevel()+1; │ │ │ │ │ +647 │ │ │ │ │ +649 typedef typename Imp::block_vector_unmanaged::Iterator Iterator; │ │ │ │ │ +650 │ │ │ │ │ +652 typedef typename Imp::block_vector_unmanaged::ConstIterator │ │ │ │ │ +ConstIterator; │ │ │ │ │ +653 │ │ │ │ │ +654 │ │ │ │ │ +655 //===== constructors and such │ │ │ │ │ +657 BlockVectorWindow () : Imp::block_vector_unmanaged() │ │ │ │ │ +658 { } │ │ │ │ │ +659 │ │ │ │ │ +661 BlockVectorWindow (B* _p, size_type _n) │ │ │ │ │ +662 { │ │ │ │ │ +663 this->n = _n; │ │ │ │ │ +664 this->p = _p; │ │ │ │ │ +665 } │ │ │ │ │ +666 │ │ │ │ │ +668 BlockVectorWindow (const BlockVectorWindow& a) │ │ │ │ │ +669 { │ │ │ │ │ +670 this->n = a.n; │ │ │ │ │ +671 this->p = a.p; │ │ │ │ │ +672 } │ │ │ │ │ +673 │ │ │ │ │ +675 BlockVectorWindow& operator= (const BlockVectorWindow& a) │ │ │ │ │ +676 { │ │ │ │ │ +677 // check correct size │ │ │ │ │ +678#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +679 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ +680#endif │ │ │ │ │ +681 │ │ │ │ │ +682 if (&a!=this) // check if this and a are different objects │ │ │ │ │ +683 { │ │ │ │ │ +684 // copy data │ │ │ │ │ +685 for (size_type i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ │ +686 } │ │ │ │ │ +687 return *this; │ │ │ │ │ +688 } │ │ │ │ │ +689 │ │ │ │ │ +691 BlockVectorWindow& operator= (const field_type& k) │ │ │ │ │ +692 { │ │ │ │ │ +693 (static_cast&>(*this)) = k; │ │ │ │ │ +694 return *this; │ │ │ │ │ +695 } │ │ │ │ │ +696 │ │ │ │ │ +698 operator BlockVector() const { │ │ │ │ │ +699 auto bv = BlockVector(this->n); │ │ │ │ │ +700 │ │ │ │ │ +701 std::copy(this->begin(), this->end(), bv.begin()); │ │ │ │ │ +702 │ │ │ │ │ +703 return bv; │ │ │ │ │ +704 } │ │ │ │ │ +705 │ │ │ │ │ +706 //===== window manipulation methods │ │ │ │ │ +707 │ │ │ │ │ +709 void set (size_type _n, B* _p) │ │ │ │ │ +710 { │ │ │ │ │ +711 this->n = _n; │ │ │ │ │ +712 this->p = _p; │ │ │ │ │ +713 } │ │ │ │ │ +714 │ │ │ │ │ +716 void setsize (size_type _n) │ │ │ │ │ +717 { │ │ │ │ │ +718 this->n = _n; │ │ │ │ │ +719 } │ │ │ │ │ +720 │ │ │ │ │ +722 void setptr (B* _p) │ │ │ │ │ +723 { │ │ │ │ │ +724 this->p = _p; │ │ │ │ │ +725 } │ │ │ │ │ +726 │ │ │ │ │ +728 B* getptr () │ │ │ │ │ +729 { │ │ │ │ │ +730 return this->p; │ │ │ │ │ +731 } │ │ │ │ │ +732 │ │ │ │ │ +734 size_type getsize () const │ │ │ │ │ +735 { │ │ │ │ │ +736 return this->n; │ │ │ │ │ +737 } │ │ │ │ │ +738 }; │ │ │ │ │ +739 │ │ │ │ │ +740 │ │ │ │ │ +741 │ │ │ │ │ +752 template > │ │ │ │ │ +753 class compressed_block_vector_unmanaged : public │ │ │ │ │ +compressed_base_array_unmanaged │ │ │ │ │ +754 { │ │ │ │ │ +755 public: │ │ │ │ │ +756 │ │ │ │ │ +757 //===== type definitions and constants │ │ │ │ │ +758 │ │ │ │ │ +760 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ │ +761 │ │ │ │ │ +763 typedef B block_type; │ │ │ │ │ +764 │ │ │ │ │ +766 typedef A allocator_type; │ │ │ │ │ +767 │ │ │ │ │ +769 typedef typename compressed_base_array_unmanaged::iterator Iterator; │ │ │ │ │ +770 │ │ │ │ │ +772 typedef typename compressed_base_array_unmanaged::const_iterator │ │ │ │ │ +ConstIterator; │ │ │ │ │ +773 │ │ │ │ │ +775 typedef typename A::size_type size_type; │ │ │ │ │ +776 │ │ │ │ │ +777 //===== assignment from scalar │ │ │ │ │ +778 │ │ │ │ │ +779 compressed_block_vector_unmanaged& operator= (const field_type& k) │ │ │ │ │ +780 { │ │ │ │ │ +781 for (size_type i=0; in; i++) │ │ │ │ │ +782 (this->p)[i] = k; │ │ │ │ │ +783 return *this; │ │ │ │ │ +784 } │ │ │ │ │ +785 │ │ │ │ │ +786 │ │ │ │ │ +787 //===== vector space arithmetic │ │ │ │ │ +788 │ │ │ │ │ +790 template │ │ │ │ │ +791 compressed_block_vector_unmanaged& operator+= (const V& y) │ │ │ │ │ +792 { │ │ │ │ │ +793#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +794 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ +795#endif │ │ │ │ │ +796 for (size_type i=0; ioperator[](y.j[i]) += y.p[i]; │ │ │ │ │ +797 return *this; │ │ │ │ │ +798 } │ │ │ │ │ +799 │ │ │ │ │ +801 template │ │ │ │ │ +802 compressed_block_vector_unmanaged& operator-= (const V& y) │ │ │ │ │ +803 { │ │ │ │ │ +804#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +805 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ +806#endif │ │ │ │ │ +807 for (size_type i=0; ioperator[](y.j[i]) -= y.p[i]; │ │ │ │ │ +808 return *this; │ │ │ │ │ +809 } │ │ │ │ │ +810 │ │ │ │ │ +812 template │ │ │ │ │ +813 compressed_block_vector_unmanaged& axpy (const field_type& a, const V& y) │ │ │ │ │ +814 { │ │ │ │ │ +815#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +816 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ +817#endif │ │ │ │ │ +818 for (size_type i=0; in; ++i) (this->p)[i] *= k; │ │ │ │ │ +827 return *this; │ │ │ │ │ +828 } │ │ │ │ │ +829 │ │ │ │ │ +831 compressed_block_vector_unmanaged& operator/= (const field_type& k) │ │ │ │ │ +832 { │ │ │ │ │ +833 for (size_type i=0; in; ++i) (this->p)[i] /= k; │ │ │ │ │ +834 return *this; │ │ │ │ │ +835 } │ │ │ │ │ +836 │ │ │ │ │ +837 │ │ │ │ │ +838 //===== Euclidean scalar product │ │ │ │ │ +839 │ │ │ │ │ +841 field_type operator* (const compressed_block_vector_unmanaged& y) const │ │ │ │ │ +842 { │ │ │ │ │ +843#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +844 if (!includesindexset(y) || !y.includesindexset(*this) ) │ │ │ │ │ +845 DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ │ +846#endif │ │ │ │ │ +847 field_type sum=0; │ │ │ │ │ +848 for (size_type i=0; in; ++i) │ │ │ │ │ +849 sum += (this->p)[i] * y[(this->j)[i]]; │ │ │ │ │ +850 return sum; │ │ │ │ │ +851 } │ │ │ │ │ +852 │ │ │ │ │ +853 │ │ │ │ │ +854 //===== norms │ │ │ │ │ +855 │ │ │ │ │ +857 typename FieldTraits::real_type one_norm () const │ │ │ │ │ +858 { │ │ │ │ │ +859 typename FieldTraits::real_type sum=0; │ │ │ │ │ +860 for (size_type i=0; in; ++i) sum += (this->p)[i].one_norm(); │ │ │ │ │ +861 return sum; │ │ │ │ │ +862 } │ │ │ │ │ +863 │ │ │ │ │ +865 typename FieldTraits::real_type one_norm_real () const │ │ │ │ │ +866 { │ │ │ │ │ +867 typename FieldTraits::real_type sum=0; │ │ │ │ │ +868 for (size_type i=0; in; ++i) sum += (this->p)[i].one_norm_real(); │ │ │ │ │ +869 return sum; │ │ │ │ │ +870 } │ │ │ │ │ +871 │ │ │ │ │ +873 typename FieldTraits::real_type two_norm () const │ │ │ │ │ +874 { │ │ │ │ │ +875 using std::sqrt; │ │ │ │ │ +876 typename FieldTraits::real_type sum=0; │ │ │ │ │ +877 for (size_type i=0; in; ++i) sum += (this->p)[i].two_norm2(); │ │ │ │ │ +878 return sqrt(sum); │ │ │ │ │ +879 } │ │ │ │ │ +880 │ │ │ │ │ +882 typename FieldTraits::real_type two_norm2 () const │ │ │ │ │ +883 { │ │ │ │ │ +884 typename FieldTraits::real_type sum=0; │ │ │ │ │ +885 for (size_type i=0; in; ++i) sum += (this->p)[i].two_norm2(); │ │ │ │ │ +886 return sum; │ │ │ │ │ +887 } │ │ │ │ │ +888 │ │ │ │ │ +890 template ::value, int>::type = 0> │ │ │ │ │ +892 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ +893 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +894 using std::max; │ │ │ │ │ +895 │ │ │ │ │ +896 real_type norm = 0; │ │ │ │ │ +897 for (auto const &x : *this) { │ │ │ │ │ +898 real_type const a = x.infinity_norm(); │ │ │ │ │ +899 norm = max(a, norm); │ │ │ │ │ +900 } │ │ │ │ │ +901 return norm; │ │ │ │ │ +902 } │ │ │ │ │ +903 │ │ │ │ │ +905 template ::value, int>::type = 0> │ │ │ │ │ +907 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ +908 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +909 using std::max; │ │ │ │ │ +910 │ │ │ │ │ +911 real_type norm = 0; │ │ │ │ │ +912 for (auto const &x : *this) { │ │ │ │ │ +913 real_type const a = x.infinity_norm_real(); │ │ │ │ │ +914 norm = max(a, norm); │ │ │ │ │ +915 } │ │ │ │ │ +916 return norm; │ │ │ │ │ +917 } │ │ │ │ │ +918 │ │ │ │ │ +920 template ::value, int>::type = 0> │ │ │ │ │ +922 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ │ +923 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +924 using std::max; │ │ │ │ │ +925 │ │ │ │ │ +926 real_type norm = 0; │ │ │ │ │ +927 real_type isNaN = 1; │ │ │ │ │ +928 for (auto const &x : *this) { │ │ │ │ │ +929 real_type const a = x.infinity_norm(); │ │ │ │ │ +930 norm = max(a, norm); │ │ │ │ │ +931 isNaN += a; │ │ │ │ │ +932 } │ │ │ │ │ +933 return norm * (isNaN / isNaN); │ │ │ │ │ +934 } │ │ │ │ │ +935 │ │ │ │ │ +937 template ::value, int>::type = 0> │ │ │ │ │ +939 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ │ +940 using real_type = typename FieldTraits::real_type; │ │ │ │ │ +941 using std::max; │ │ │ │ │ +942 │ │ │ │ │ +943 real_type norm = 0; │ │ │ │ │ +944 real_type isNaN = 1; │ │ │ │ │ +945 for (auto const &x : *this) { │ │ │ │ │ +946 real_type const a = x.infinity_norm_real(); │ │ │ │ │ +947 norm = max(a, norm); │ │ │ │ │ +948 isNaN += a; │ │ │ │ │ +949 } │ │ │ │ │ +950 return norm * (isNaN / isNaN); │ │ │ │ │ +951 } │ │ │ │ │ +952 │ │ │ │ │ +953 //===== sizes │ │ │ │ │ +954 │ │ │ │ │ +956 size_type N () const │ │ │ │ │ +957 { │ │ │ │ │ +958 return this->n; │ │ │ │ │ +959 } │ │ │ │ │ +960 │ │ │ │ │ +962 size_type dim () const │ │ │ │ │ +963 { │ │ │ │ │ +964 size_type d=0; │ │ │ │ │ +965 for (size_type i=0; in; i++) │ │ │ │ │ +966 d += (this->p)[i].dim(); │ │ │ │ │ +967 return d; │ │ │ │ │ +968 } │ │ │ │ │ +969 │ │ │ │ │ +970 protected: │ │ │ │ │ +972 compressed_block_vector_unmanaged () : compressed_base_array_unmanaged │ │ │ │ │ +() │ │ │ │ │ +973 { } │ │ │ │ │ +974 │ │ │ │ │ +976 template │ │ │ │ │ +977 bool includesindexset (const V& y) │ │ │ │ │ +978 { │ │ │ │ │ +979 typename V::ConstIterator e=this->end(); │ │ │ │ │ +980 for (size_type i=0; ifind(y.j[i])==e) │ │ │ │ │ +982 return false; │ │ │ │ │ +983 return true; │ │ │ │ │ +984 } │ │ │ │ │ +985 }; │ │ │ │ │ +986 │ │ │ │ │ +987 │ │ │ │ │ +1006 template > │ │ │ │ │ +1007 class CompressedBlockVectorWindow : public │ │ │ │ │ +compressed_block_vector_unmanaged │ │ │ │ │ +1008 { │ │ │ │ │ +1009 public: │ │ │ │ │ +1010 │ │ │ │ │ +1011 //===== type definitions and constants │ │ │ │ │ +1012 │ │ │ │ │ +1014 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ │ +1015 │ │ │ │ │ +1017 typedef B block_type; │ │ │ │ │ +1018 │ │ │ │ │ +1020 typedef A allocator_type; │ │ │ │ │ +1021 │ │ │ │ │ +1023 typedef typename A::size_type size_type; │ │ │ │ │ +1024 │ │ │ │ │ +1026 [[deprecated("Use free function blockLevel(). Will be removed after │ │ │ │ │ +2.8.")]] │ │ │ │ │ +1027 static constexpr unsigned int blocklevel = blockLevel()+1; │ │ │ │ │ +1028 │ │ │ │ │ +1030 typedef typename compressed_block_vector_unmanaged::Iterator │ │ │ │ │ +Iterator; │ │ │ │ │ +1031 │ │ │ │ │ +1033 typedef typename compressed_block_vector_unmanaged::ConstIterator │ │ │ │ │ +ConstIterator; │ │ │ │ │ +1034 │ │ │ │ │ +1035 │ │ │ │ │ +1036 //===== constructors and such │ │ │ │ │ +1038 CompressedBlockVectorWindow () : compressed_block_vector_unmanaged() │ │ │ │ │ +1039 { } │ │ │ │ │ +1040 │ │ │ │ │ +1042 CompressedBlockVectorWindow (B* _p, size_type* _j, size_type _n) │ │ │ │ │ +1043 { │ │ │ │ │ +1044 this->n = _n; │ │ │ │ │ +1045 this->p = _p; │ │ │ │ │ +1046 this->j = _j; │ │ │ │ │ +1047 } │ │ │ │ │ +1048 │ │ │ │ │ +1050 CompressedBlockVectorWindow (const CompressedBlockVectorWindow& a) │ │ │ │ │ +1051 { │ │ │ │ │ +1052 this->n = a.n; │ │ │ │ │ +1053 this->p = a.p; │ │ │ │ │ +1054 this->j = a.j; │ │ │ │ │ +1055 } │ │ │ │ │ +1056 │ │ │ │ │ +1058 CompressedBlockVectorWindow& operator= (const CompressedBlockVectorWindow& │ │ │ │ │ +a) │ │ │ │ │ +1059 { │ │ │ │ │ +1060 // check correct size │ │ │ │ │ +1061#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ │ +1062 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ │ +1063#endif │ │ │ │ │ +1064 │ │ │ │ │ +1065 if (&a!=this) // check if this and a are different objects │ │ │ │ │ +1066 { │ │ │ │ │ +1067 // copy data │ │ │ │ │ +1068 for (size_type i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ │ +1069 for (size_type i=0; in; i++) this->j[i]=a.j[i]; │ │ │ │ │ +1070 } │ │ │ │ │ +1071 return *this; │ │ │ │ │ +1072 } │ │ │ │ │ +1073 │ │ │ │ │ +1075 CompressedBlockVectorWindow& operator= (const field_type& k) │ │ │ │ │ +1076 { │ │ │ │ │ +1077 (static_cast&>(*this)) = k; │ │ │ │ │ +1078 return *this; │ │ │ │ │ +1079 } │ │ │ │ │ +1080 │ │ │ │ │ +1081 │ │ │ │ │ +1082 //===== window manipulation methods │ │ │ │ │ +1083 │ │ │ │ │ +1085 void set (size_type _n, B* _p, size_type* _j) │ │ │ │ │ +1086 { │ │ │ │ │ +1087 this->n = _n; │ │ │ │ │ +1088 this->p = _p; │ │ │ │ │ +1089 this->j = _j; │ │ │ │ │ +1090 } │ │ │ │ │ +1091 │ │ │ │ │ +1093 void setsize (size_type _n) │ │ │ │ │ +1094 { │ │ │ │ │ +1095 this->n = _n; │ │ │ │ │ +1096 } │ │ │ │ │ +1097 │ │ │ │ │ +1099 void setptr (B* _p) │ │ │ │ │ +1100 { │ │ │ │ │ +1101 this->p = _p; │ │ │ │ │ +1102 } │ │ │ │ │ +1103 │ │ │ │ │ +1105 void setindexptr (size_type* _j) │ │ │ │ │ +1106 { │ │ │ │ │ +1107 this->j = _j; │ │ │ │ │ +1108 } │ │ │ │ │ +1109 │ │ │ │ │ +1111 B* getptr () │ │ │ │ │ +1112 { │ │ │ │ │ +1113 return this->p; │ │ │ │ │ +1114 } │ │ │ │ │ +1115 │ │ │ │ │ +1117 size_type* getindexptr () │ │ │ │ │ +1118 { │ │ │ │ │ +1119 return this->j; │ │ │ │ │ +1120 } │ │ │ │ │ +1121 │ │ │ │ │ +1123 const B* getptr () const │ │ │ │ │ +1124 { │ │ │ │ │ +1125 return this->p; │ │ │ │ │ +1126 } │ │ │ │ │ +1127 │ │ │ │ │ +1129 const size_type* getindexptr () const │ │ │ │ │ +1130 { │ │ │ │ │ +1131 return this->j; │ │ │ │ │ +1132 } │ │ │ │ │ +1134 size_type getsize () const │ │ │ │ │ +1135 { │ │ │ │ │ +1136 return this->n; │ │ │ │ │ +1137 } │ │ │ │ │ +1138 }; │ │ │ │ │ +1139 │ │ │ │ │ +1140} // end namespace 'Imp' │ │ │ │ │ +1141 │ │ │ │ │ +1142 │ │ │ │ │ +1144 template │ │ │ │ │ +1145 struct AutonomousValueType> │ │ │ │ │ +1146 { │ │ │ │ │ +1147 using type = BlockVector; │ │ │ │ │ +1148 }; │ │ │ │ │ +1149 │ │ │ │ │ +1150 │ │ │ │ │ +1151} // end namespace 'Dune' │ │ │ │ │ +1152 │ │ │ │ │ +1153#endif │ │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ │ +_b_a_s_e_a_r_r_a_y_._h_h │ │ │ │ │ +Implements several basic array containers. │ │ │ │ │ _i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ │ +_s_t_d │ │ │ │ │ +STL namespace. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ +_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:590 │ │ │ │ │ +_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:395 │ │ │ │ │ +_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:425 │ │ │ │ │ +_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:475 │ │ │ │ │ +_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:519 │ │ │ │ │ +_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:431 │ │ │ │ │ +_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:503 │ │ │ │ │ +_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, A >::Iterator Iterator │ │ │ │ │ +make iterators available as types │ │ │ │ │ +DDeeffiinniittiioonn bvector.hh:417 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_b_l_o_c_k_l_e_v_e_l │ │ │ │ │ +static constexpr unsigned int blocklevel │ │ │ │ │ +increment block level counter │ │ │ │ │ +DDeeffiinniittiioonn bvector.hh:414 │ │ │ │ │ +_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:511 │ │ │ │ │ +_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:407 │ │ │ │ │ +_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:526 │ │ │ │ │ +_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:401 │ │ │ │ │ +_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: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(std::initializer_list< B > const &l) │ │ │ │ │ +Construct from a std::initializer_list. │ │ │ │ │ +DDeeffiinniittiioonn bvector.hh:437 │ │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_c_a_p_a_c_i_t_y │ │ │ │ │ +size_type capacity() const │ │ │ │ │ +Get the capacity of the vector. │ │ │ │ │ +DDeeffiinniittiioonn bvector.hh:488 │ │ │ │ │ +_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:455 │ │ │ │ │ +_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:404 │ │ │ │ │ +_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:544 │ │ │ │ │ +_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, A >::ConstIterator ConstIterator │ │ │ │ │ +make iterators available as types │ │ │ │ │ +DDeeffiinniittiioonn bvector.hh:420 │ │ │ │ │ +_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:582 │ │ │ │ │ +_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:581 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00224.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: operators.hh File Reference │ │ │ │ +dune-istl: ilusubdomainsolver.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,50 +72,48 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ - │ │ │ │ +
ilusubdomainsolver.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Define general, extensible interface for operators. The available implementation wraps a matrix. │ │ │ │ +

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

│ │ │ │ -
#include <cmath>
│ │ │ │ -#include <complex>
│ │ │ │ -#include <iostream>
│ │ │ │ -#include <iomanip>
│ │ │ │ -#include <string>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/shared_ptr.hh>
│ │ │ │ -#include "solvercategory.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

class  Dune::LinearOperator< X, Y >
 A linear operator. More...
class  Dune::ILUSubdomainSolver< M, X, Y >
 base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver. More...
 
class  Dune::AssembledLinearOperator< M, X, Y >
 A linear operator exporting itself in matrix form. More...
class  Dune::ILU0SubdomainSolver< M, X, Y >
 Exact subdomain solver using ILU(p) with appropriate p. More...
 
class  Dune::MatrixAdapter< M, X, Y >
 Adapter to turn a matrix into a linear operator. More...
class  Dune::ILUNSubdomainSolver< M, X, Y >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
│ │ │ │

Detailed Description

│ │ │ │ -

Define general, extensible interface for operators. The available implementation wraps a matrix.

│ │ │ │ +

Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.

│ │ │ │ +
Author
Markus Blatt
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,39 +1,35 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ 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 │ │ │ │ │ -operators.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 » _O_p_e_r_a_t_o_r │ │ │ │ │ -_c_o_n_c_e_p_t │ │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ │ -implementation wraps a matrix. _M_o_r_e_._._. │ │ │ │ │ +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 │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._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_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_ _X_,_ _Y_ _> │ │ │ │ │ -  A linear operator. _M_o_r_e_._._. │ │ │ │ │ +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_:_:_A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ -  A linear operator exporting itself in matrix form. _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_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ │ -  Adapter to turn a matrix into a linear operator. _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 │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ │ -implementation wraps a matrix. │ │ │ │ │ +Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ │ │ + Author │ │ │ │ │ + Markus Blatt │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00224_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: operators.hh Source File │ │ │ │ +dune-istl: ilusubdomainsolver.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,170 +74,235 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
operators.hh
│ │ │ │ +
ilusubdomainsolver.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_OPERATORS_HH
│ │ │ │ -
6#define DUNE_ISTL_OPERATORS_HH
│ │ │ │ +
5#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
│ │ │ │ +
6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
│ │ │ │
7
│ │ │ │ -
8#include <cmath>
│ │ │ │ -
9#include <complex>
│ │ │ │ -
10#include <iostream>
│ │ │ │ -
11#include <iomanip>
│ │ │ │ -
12#include <string>
│ │ │ │ -
13
│ │ │ │ -
14#include <dune/common/exceptions.hh>
│ │ │ │ -
15#include <dune/common/shared_ptr.hh>
│ │ │ │ +
8#include <map>
│ │ │ │ +
9#include <dune/common/typetraits.hh>
│ │ │ │ + │ │ │ │ +
11#include "matrix.hh"
│ │ │ │ +
12#include <cmath>
│ │ │ │ +
13#include <cstdlib>
│ │ │ │ +
14
│ │ │ │ +
15namespace Dune {
│ │ │ │
16
│ │ │ │ -
17#include "solvercategory.hh"
│ │ │ │ -
18
│ │ │ │ -
19
│ │ │ │ -
20namespace Dune {
│ │ │ │ -
21
│ │ │ │ -
44 //=====================================================================
│ │ │ │ -
45 // Abstract operator interface
│ │ │ │ -
46 //=====================================================================
│ │ │ │ -
47
│ │ │ │ -
48
│ │ │ │ -
66 template<class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
68 public:
│ │ │ │ -
70 typedef X domain_type;
│ │ │ │ -
72 typedef Y range_type;
│ │ │ │ -
74 typedef typename X::field_type field_type;
│ │ │ │ -
75
│ │ │ │ -
80 virtual void apply (const X& x, Y& y) const = 0;
│ │ │ │ -
81
│ │ │ │ -
83 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const = 0;
│ │ │ │ -
84
│ │ │ │ -
86 virtual ~LinearOperator () {}
│ │ │ │ +
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
│ │ │ │ - │ │ │ │ -
90#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ │ -
91 {
│ │ │ │ -
92 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
│ │ │ │ -
93 };
│ │ │ │ -
94#else
│ │ │ │ -
95 = 0;
│ │ │ │ -
96#endif
│ │ │ │ -
97 };
│ │ │ │ -
│ │ │ │ -
98
│ │ │ │ -
99
│ │ │ │ -
108 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
110 public:
│ │ │ │ -
112 typedef M matrix_type;
│ │ │ │ -
113 typedef X domain_type;
│ │ │ │ -
114 typedef Y range_type;
│ │ │ │ -
115 typedef typename X::field_type field_type;
│ │ │ │ -
116
│ │ │ │ -
118 virtual const M& getmat () const = 0;
│ │ │ │ -
119
│ │ │ │ - │ │ │ │ -
122 };
│ │ │ │ -
│ │ │ │ -
123
│ │ │ │ -
124
│ │ │ │ -
125
│ │ │ │ -
126 //=====================================================================
│ │ │ │ -
127 // Implementation for ISTL-matrix based operator
│ │ │ │ -
128 //=====================================================================
│ │ │ │ +
88
│ │ │ │ +
│ │ │ │ +
93 void apply (X& v, const Y& d)
│ │ │ │ +
94 {
│ │ │ │ +
95 ILU::blockILUBacksolve(this->ILU,v,d);
│ │ │ │ +
96 }
│ │ │ │ +
│ │ │ │ +
104 template<class S>
│ │ │ │ +
105 void setSubMatrix(const M& A, S& rowset);
│ │ │ │ +
106
│ │ │ │ +
107 };
│ │ │ │ +
│ │ │ │ +
108
│ │ │ │ +
109 template<class M, class X, class Y>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
111 : public ILUSubdomainSolver<M,X,Y>{
│ │ │ │ +
112 public:
│ │ │ │ +
114 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ │ +
115 typedef typename std::remove_const<M>::type rilu_type;
│ │ │ │ +
117 typedef X domain_type;
│ │ │ │ +
119 typedef Y range_type;
│ │ │ │ +
120
│ │ │ │ +
│ │ │ │ +
125 void apply (X& v, const Y& d)
│ │ │ │ +
126 {
│ │ │ │ +
127 ILU::blockILUBacksolve(RILU,v,d);
│ │ │ │ +
128 }
│ │ │ │ +
│ │ │ │
129
│ │ │ │ -
135 template<class M, class X, class Y>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
137 {
│ │ │ │ -
138 public:
│ │ │ │ -
140 typedef M matrix_type;
│ │ │ │ -
141 typedef X domain_type;
│ │ │ │ -
142 typedef Y range_type;
│ │ │ │ -
143 typedef typename X::field_type field_type;
│ │ │ │ -
144
│ │ │ │ -
146 explicit MatrixAdapter (const M& A) : _A_(stackobject_to_shared_ptr(A)) {}
│ │ │ │ -
147
│ │ │ │ -
149 explicit MatrixAdapter (std::shared_ptr<const M> A) : _A_(A) {}
│ │ │ │ -
150
│ │ │ │ -
│ │ │ │ -
152 void apply (const X& x, Y& y) const override
│ │ │ │ -
153 {
│ │ │ │ -
154 _A_->mv(x,y);
│ │ │ │ -
155 }
│ │ │ │ -
│ │ │ │ -
156
│ │ │ │ -
│ │ │ │ -
158 void applyscaleadd (field_type alpha, const X& x, Y& y) const override
│ │ │ │ -
159 {
│ │ │ │ -
160 _A_->usmv(alpha,x,y);
│ │ │ │ -
161 }
│ │ │ │ -
│ │ │ │ -
162
│ │ │ │ -
│ │ │ │ -
164 const M& getmat () const override
│ │ │ │ -
165 {
│ │ │ │ -
166 return *_A_;
│ │ │ │ -
167 }
│ │ │ │ +
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 perserving 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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
171 {
│ │ │ │ - │ │ │ │ -
173 }
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
175 private:
│ │ │ │ -
176 const std::shared_ptr<const M> _A_;
│ │ │ │ -
177 };
│ │ │ │ -
│ │ │ │ -
178
│ │ │ │ -
181} // end namespace
│ │ │ │ +
169 // Build Matrix for local subproblem
│ │ │ │ +
170 ILU.setSize(rowSet.size(),rowSet.size());
│ │ │ │ +
171 ILU.setBuildMode(matrix_type::row_wise);
│ │ │ │ +
172
│ │ │ │ +
173 // Create sparsity pattern
│ │ │ │ +
174 typedef typename matrix_type::CreateIterator CIter;
│ │ │ │ +
175 CIter rowCreator = ILU.createbegin();
│ │ │ │ +
176 std::size_t offset=0;
│ │ │ │ +
177 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ │ +
178 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) {
│ │ │ │ +
179 // See which row entries are in our subset and add them to
│ │ │ │ +
180 // the sparsity pattern
│ │ │ │ +
181 guess = indexMap.begin();
│ │ │ │
182
│ │ │ │ -
183#endif
│ │ │ │ - │ │ │ │ +
183 for(typename matrix_type::ConstColIterator col=A[*rowIdx].begin(),
│ │ │ │ +
184 endcol=A[*rowIdx].end(); col != endcol; ++col) {
│ │ │ │ +
185 // search for the entry in the row set
│ │ │ │ +
186 guess = indexMap.find(col.index());
│ │ │ │ +
187 if(guess!=indexMap.end()) {
│ │ │ │ +
188 // add local index to row
│ │ │ │ +
189 rowCreator.insert(guess->second);
│ │ │ │ +
190 offset=std::max(offset,(std::size_t)std::abs((int)(guess->second-rowCreator.index())));
│ │ │ │ +
191 }
│ │ │ │ +
192 }
│ │ │ │ +
193
│ │ │ │ +
194 }
│ │ │ │ +
195
│ │ │ │ +
196 // Insert the matrix values for the local problem
│ │ │ │ +
197 typename matrix_type::iterator iluRow=ILU.begin();
│ │ │ │ +
198
│ │ │ │ +
199 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ │ +
200 rowIdx!= rowEnd; ++rowIdx, ++iluRow) {
│ │ │ │ +
201 // See which row entries are in our subset and add them to
│ │ │ │ +
202 // the sparsity pattern
│ │ │ │ +
203 typename matrix_type::ColIterator localCol=iluRow->begin();
│ │ │ │ +
204 for(typename matrix_type::ConstColIterator col=A[*rowIdx].begin(),
│ │ │ │ +
205 endcol=A[*rowIdx].end(); col != endcol; ++col) {
│ │ │ │ +
206 // search for the entry in the row set
│ │ │ │ +
207 guess = indexMap.find(col.index());
│ │ │ │ +
208 if(guess!=indexMap.end()) {
│ │ │ │ +
209 // set local value
│ │ │ │ +
210 (*localCol)=(*col);
│ │ │ │ +
211 ++localCol;
│ │ │ │ +
212 }
│ │ │ │ +
213 }
│ │ │ │ +
214 }
│ │ │ │ +
215 return offset;
│ │ │ │ +
216 }
│ │ │ │ +
│ │ │ │ +
217
│ │ │ │ +
218
│ │ │ │ +
219 template<class M, class X, class Y>
│ │ │ │ +
220 template<class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
222 {
│ │ │ │ +
223 this->copyToLocalMatrix(A,rowSet);
│ │ │ │ + │ │ │ │ +
225 }
│ │ │ │ +
│ │ │ │ +
226
│ │ │ │ +
227 template<class M, class X, class Y>
│ │ │ │ +
228 template<class S>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
230 {
│ │ │ │ +
231 std::size_t offset=copyToLocalMatrix(A,rowSet);
│ │ │ │ +
232 RILU.setSize(rowSet.size(),rowSet.size(), (1+2*offset)*rowSet.size());
│ │ │ │ +
233 RILU.setBuildMode(matrix_type::row_wise);
│ │ │ │ +
234 ILU::blockILUDecomposition(this->ILU, (offset+1)/2, RILU);
│ │ │ │ +
235 }
│ │ │ │ +
│ │ │ │ +
236
│ │ │ │ +
238} // end name space DUNE
│ │ │ │ +
239
│ │ │ │ +
240
│ │ │ │ +
241#endif
│ │ │ │ +
A dynamic dense block matrix class.
│ │ │ │ +
Define general preconditioner interface.
│ │ │ │ +
std::size_t copyToLocalMatrix(const M &A, S &rowset)
Copy the local part of the global matrix to ILU.
Definition ilusubdomainsolver.hh:151
│ │ │ │ +
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition ilusubdomainsolver.hh:229
│ │ │ │ +
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition ilusubdomainsolver.hh:221
│ │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ │
Definition allocator.hh:11
│ │ │ │ -
A linear operator.
Definition operators.hh:67
│ │ │ │ -
virtual ~LinearOperator()
every abstract base class has a virtual destructor
Definition operators.hh:86
│ │ │ │ -
X::field_type field_type
The field type of the operator.
Definition operators.hh:74
│ │ │ │ -
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0
apply operator to x, scale and add:
│ │ │ │ -
virtual SolverCategory::Category category() const =0
Category of the linear operator (see SolverCategory::Category)
│ │ │ │ -
Y range_type
The type of the range of the operator.
Definition operators.hh:72
│ │ │ │ -
virtual void apply(const X &x, Y &y) const =0
apply operator to x: The input vector is consistent and the output must also be consistent on the in...
│ │ │ │ -
X domain_type
The type of the domain of the operator.
Definition operators.hh:70
│ │ │ │ -
A linear operator exporting itself in matrix form.
Definition operators.hh:109
│ │ │ │ -
virtual const M & getmat() const =0
get matrix via *
│ │ │ │ -
X domain_type
Definition operators.hh:113
│ │ │ │ -
X::field_type field_type
Definition operators.hh:115
│ │ │ │ -
Y range_type
Definition operators.hh:114
│ │ │ │ -
M matrix_type
export types, usually they come from the derived class
Definition operators.hh:112
│ │ │ │ -
virtual ~AssembledLinearOperator()
every abstract base class has a virtual destructor
Definition operators.hh:121
│ │ │ │ -
Adapter to turn a matrix into a linear operator.
Definition operators.hh:137
│ │ │ │ -
MatrixAdapter(std::shared_ptr< const M > A)
constructor: store an std::shared_ptr to a matrix
Definition operators.hh:149
│ │ │ │ -
MatrixAdapter(const M &A)
constructor: just store a reference to a matrix
Definition operators.hh:146
│ │ │ │ -
void applyscaleadd(field_type alpha, const X &x, Y &y) const override
apply operator to x, scale and add:
Definition operators.hh:158
│ │ │ │ -
Y range_type
Definition operators.hh:142
│ │ │ │ -
X domain_type
Definition operators.hh:141
│ │ │ │ -
X::field_type field_type
Definition operators.hh:143
│ │ │ │ -
const M & getmat() const override
get matrix via *
Definition operators.hh:164
│ │ │ │ -
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category)
Definition operators.hh:170
│ │ │ │ -
void apply(const X &x, Y &y) const override
apply operator to x:
Definition operators.hh:152
│ │ │ │ -
M matrix_type
export types
Definition operators.hh:140
│ │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ │ +
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ │ +
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ │ +
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ │ +
base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver.
Definition ilusubdomainsolver.hh:36
│ │ │ │ +
matrix_type ILU
The ILU0 decomposition of the matrix, or the local matrix.
Definition ilusubdomainsolver.hh:67
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:41
│ │ │ │ +
virtual ~ILUSubdomainSolver()
Definition ilusubdomainsolver.hh:53
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:43
│ │ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:39
│ │ │ │ +
virtual void apply(X &v, const Y &d)=0
Apply the subdomain solver.
│ │ │ │ +
Exact subdomain solver using ILU(p) with appropriate p.
Definition ilusubdomainsolver.hh:78
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:84
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:86
│ │ │ │ +
std::remove_const< M >::type rilu_type
Definition ilusubdomainsolver.hh:82
│ │ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:81
│ │ │ │ +
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition ilusubdomainsolver.hh:93
│ │ │ │ +
Definition ilusubdomainsolver.hh:111
│ │ │ │ +
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:117
│ │ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:114
│ │ │ │ +
std::remove_const< M >::type rilu_type
Definition ilusubdomainsolver.hh:115
│ │ │ │ +
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition ilusubdomainsolver.hh:125
│ │ │ │ +
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:119
│ │ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:620
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,223 +1,288 @@ │ │ │ │ │ dune-istl 2.9.0 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _i_s_t_l │ │ │ │ │ -operators.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 (C) 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_OPERATORS_HH │ │ │ │ │ -6#define DUNE_ISTL_OPERATORS_HH │ │ │ │ │ +5#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH │ │ │ │ │ +6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH │ │ │ │ │ 7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ │ +11#include "_m_a_t_r_i_x_._h_h" │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ +14 │ │ │ │ │ +15namespace _D_u_n_e { │ │ │ │ │ 16 │ │ │ │ │ -17#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ │ -18 │ │ │ │ │ -19 │ │ │ │ │ -20namespace _D_u_n_e { │ │ │ │ │ -21 │ │ │ │ │ -44 //===================================================================== │ │ │ │ │ -45 // Abstract operator interface │ │ │ │ │ -46 //===================================================================== │ │ │ │ │ -47 │ │ │ │ │ -48 │ │ │ │ │ -66 template │ │ │ │ │ -_6_7 class _L_i_n_e_a_r_O_p_e_r_a_t_o_r { │ │ │ │ │ -68 public: │ │ │ │ │ -_7_0 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_7_2 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_7_4 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -75 │ │ │ │ │ -_8_0 virtual void _a_p_p_l_y (const X& x, Y& y) const = 0; │ │ │ │ │ -81 │ │ │ │ │ -_8_3 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (_f_i_e_l_d___t_y_p_e alpha, const X& x, Y& y) const = 0; │ │ │ │ │ -84 │ │ │ │ │ -_8_6 virtual _~_L_i_n_e_a_r_O_p_e_r_a_t_o_r () {} │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ -_8_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ │ -90#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ │ -91 { │ │ │ │ │ -92 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method │ │ │ │ │ -in a derived classes, in the future this method will pure virtual."); │ │ │ │ │ -93 }; │ │ │ │ │ -94#else │ │ │ │ │ -95 = 0; │ │ │ │ │ -96#endif │ │ │ │ │ -97 }; │ │ │ │ │ -98 │ │ │ │ │ -99 │ │ │ │ │ -108 template │ │ │ │ │ -_1_0_9 class _A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r : public _L_i_n_e_a_r_O_p_e_r_a_t_o_r { │ │ │ │ │ -110 public: │ │ │ │ │ -_1_1_2 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_1_1_3 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_1_1_4 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_1_1_5 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -116 │ │ │ │ │ -_1_1_8 virtual const M& _g_e_t_m_a_t () const = 0; │ │ │ │ │ -119 │ │ │ │ │ -_1_2_1 virtual _~_A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r () {} │ │ │ │ │ -122 }; │ │ │ │ │ -123 │ │ │ │ │ -124 │ │ │ │ │ -125 │ │ │ │ │ -126 //===================================================================== │ │ │ │ │ -127 // Implementation for ISTL-matrix based operator │ │ │ │ │ -128 //===================================================================== │ │ │ │ │ +88 │ │ │ │ │ +_9_3 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +94 { │ │ │ │ │ +95 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e(this->_I_L_U,v,d); │ │ │ │ │ +96 } │ │ │ │ │ +104 template │ │ │ │ │ +105 void _s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowset); │ │ │ │ │ +106 │ │ │ │ │ +107 }; │ │ │ │ │ +108 │ │ │ │ │ +109 template │ │ │ │ │ +_1_1_0 class _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ +111 : public _I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r{ │ │ │ │ │ +112 public: │ │ │ │ │ +_1_1_4 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ +_1_1_5 typedef typename std::remove_const::type _r_i_l_u___t_y_p_e; │ │ │ │ │ +_1_1_7 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ +_1_1_9 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ +120 │ │ │ │ │ +_1_2_5 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ │ +126 { │ │ │ │ │ +127 _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 │ │ │ │ │ -135 template │ │ │ │ │ -_1_3_6 class _M_a_t_r_i_x_A_d_a_p_t_e_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 │ │ │ │ │ -137 { │ │ │ │ │ -138 public: │ │ │ │ │ -_1_4_0 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ │ -_1_4_1 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ │ -_1_4_2 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ │ -_1_4_3 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ │ -144 │ │ │ │ │ -_1_4_6 explicit _M_a_t_r_i_x_A_d_a_p_t_e_r (const M& A) : _A_(stackobject_to_shared_ptr(A)) {} │ │ │ │ │ +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 │ │ │ │ │ -_1_4_9 explicit _M_a_t_r_i_x_A_d_a_p_t_e_r (std::shared_ptr A) : _A_(A) {} │ │ │ │ │ -150 │ │ │ │ │ -_1_5_2 void _a_p_p_l_y (const X& x, Y& y) const override │ │ │ │ │ -153 { │ │ │ │ │ -154 _A_->mv(x,y); │ │ │ │ │ -155 } │ │ │ │ │ -156 │ │ │ │ │ -_1_5_8 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 │ │ │ │ │ -159 { │ │ │ │ │ -160 _A_->usmv(alpha,x,y); │ │ │ │ │ -161 } │ │ │ │ │ -162 │ │ │ │ │ -_1_6_4 const M& _g_e_t_m_a_t () const override │ │ │ │ │ -165 { │ │ │ │ │ -166 return *_A_; │ │ │ │ │ -167 } │ │ │ │ │ +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 perserving the ordering │ │ │ │ │ +155 typedef typename M::size_type size_type; │ │ │ │ │ +156 typedef std::map IndexMap; │ │ │ │ │ +157 typedef typename IndexMap::iterator IMIter; │ │ │ │ │ +158 IndexMap indexMap; │ │ │ │ │ +159 IMIter guess = indexMap.begin(); │ │ │ │ │ +160 size_type localIndex=0; │ │ │ │ │ +161 │ │ │ │ │ +162 typedef typename S::const_iterator SIter; │ │ │ │ │ +163 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ │ +164 rowIdx!= rowEnd; ++rowIdx, ++localIndex) │ │ │ │ │ +165 guess = indexMap.insert(guess, │ │ │ │ │ +166 std::make_pair(*rowIdx,localIndex)); │ │ │ │ │ +167 │ │ │ │ │ 168 │ │ │ │ │ -_1_7_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 │ │ │ │ │ -171 { │ │ │ │ │ -172 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; │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -175 private: │ │ │ │ │ -176 const std::shared_ptr _A_; │ │ │ │ │ -177 }; │ │ │ │ │ -178 │ │ │ │ │ -181} // end namespace │ │ │ │ │ +169 // Build Matrix for local subproblem │ │ │ │ │ +170 ILU.setSize(rowSet.size(),rowSet.size()); │ │ │ │ │ +171 ILU.setBuildMode(matrix_type::row_wise); │ │ │ │ │ +172 │ │ │ │ │ +173 // Create sparsity pattern │ │ │ │ │ +174 typedef typename matrix_type::CreateIterator CIter; │ │ │ │ │ +175 CIter rowCreator = ILU.createbegin(); │ │ │ │ │ +176 std::size_t offset=0; │ │ │ │ │ +177 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ │ +178 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) { │ │ │ │ │ +179 // See which row entries are in our subset and add them to │ │ │ │ │ +180 // the sparsity pattern │ │ │ │ │ +181 guess = indexMap.begin(); │ │ │ │ │ 182 │ │ │ │ │ -183#endif │ │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ │ +183 for(typename matrix_type::ConstColIterator _c_o_l=A[*rowIdx].begin(), │ │ │ │ │ +184 endcol=A[*rowIdx]._e_n_d(); _c_o_l != endcol; ++_c_o_l) { │ │ │ │ │ +185 // search for the entry in the row set │ │ │ │ │ +186 guess = indexMap.find(_c_o_l.index()); │ │ │ │ │ +187 if(guess!=indexMap.end()) { │ │ │ │ │ +188 // add local index to row │ │ │ │ │ +189 rowCreator.insert(guess->second); │ │ │ │ │ +190 offset=std::max(offset,(std::size_t)std::abs((int)(guess->second- │ │ │ │ │ +rowCreator.index()))); │ │ │ │ │ +191 } │ │ │ │ │ +192 } │ │ │ │ │ +193 │ │ │ │ │ +194 } │ │ │ │ │ +195 │ │ │ │ │ +196 // Insert the matrix values for the local problem │ │ │ │ │ +197 typename matrix_type::iterator iluRow=ILU.begin(); │ │ │ │ │ +198 │ │ │ │ │ +199 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ │ +200 rowIdx!= rowEnd; ++rowIdx, ++iluRow) { │ │ │ │ │ +201 // See which row entries are in our subset and add them to │ │ │ │ │ +202 // the sparsity pattern │ │ │ │ │ +203 typename matrix_type::ColIterator localCol=iluRow->begin(); │ │ │ │ │ +204 for(typename matrix_type::ConstColIterator _c_o_l=A[*rowIdx].begin(), │ │ │ │ │ +205 endcol=A[*rowIdx]._e_n_d(); _c_o_l != endcol; ++_c_o_l) { │ │ │ │ │ +206 // search for the entry in the row set │ │ │ │ │ +207 guess = indexMap.find(_c_o_l.index()); │ │ │ │ │ +208 if(guess!=indexMap.end()) { │ │ │ │ │ +209 // set local value │ │ │ │ │ +210 (*localCol)=(*col); │ │ │ │ │ +211 ++localCol; │ │ │ │ │ +212 } │ │ │ │ │ +213 } │ │ │ │ │ +214 } │ │ │ │ │ +215 return offset; │ │ │ │ │ +216 } │ │ │ │ │ +217 │ │ │ │ │ +218 │ │ │ │ │ +219 template │ │ │ │ │ +220 template │ │ │ │ │ +_2_2_1 void _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_M_,_X_,_Y_>_:_:_s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowSet) │ │ │ │ │ +222 { │ │ │ │ │ +223 this->copyToLocalMatrix(A,rowSet); │ │ │ │ │ +224 _I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n(this->ILU); │ │ │ │ │ +225 } │ │ │ │ │ +226 │ │ │ │ │ +227 template │ │ │ │ │ +228 template │ │ │ │ │ +_2_2_9 void _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_M_,_X_,_Y_>_:_:_s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowSet) │ │ │ │ │ +230 { │ │ │ │ │ +231 std::size_t offset=copyToLocalMatrix(A,rowSet); │ │ │ │ │ +232 RILU.setSize(rowSet.size(),rowSet.size(), (1+2*offset)*rowSet.size()); │ │ │ │ │ +233 RILU.setBuildMode(matrix_type::row_wise); │ │ │ │ │ +234 _I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n(this->ILU, (offset+1)/2, RILU); │ │ │ │ │ +235 } │ │ │ │ │ +236 │ │ │ │ │ +238} // end name space DUNE │ │ │ │ │ +239 │ │ │ │ │ +240 │ │ │ │ │ +241#endif │ │ │ │ │ +_m_a_t_r_i_x_._h_h │ │ │ │ │ +A dynamic dense block matrix class. │ │ │ │ │ +_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ │ +Define general preconditioner interface. │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_c_o_p_y_T_o_L_o_c_a_l_M_a_t_r_i_x │ │ │ │ │ +std::size_t copyToLocalMatrix(const M &A, S &rowset) │ │ │ │ │ +Copy the local part of the global matrix to ILU. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ +void setSubMatrix(const M &A, S &rowset) │ │ │ │ │ +Set the data of the local problem. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:229 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ │ +void setSubMatrix(const M &A, S &rowset) │ │ │ │ │ +Set the data of the local problem. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:221 │ │ │ │ │ +_c_o_l │ │ │ │ │ +Col col │ │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -A linear operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_~_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -virtual ~LinearOperator() │ │ │ │ │ -every abstract base class has a virtual destructor │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 operators.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ │ -virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const =0 │ │ │ │ │ -apply operator to x, scale and add: │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 linear operator (see SolverCategory::Category) │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:72 │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ │ -virtual void apply(const X &x, Y &y) const =0 │ │ │ │ │ -apply operator to x: The input vector is consistent and the output must also be │ │ │ │ │ -consistent on the in... │ │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_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 of the operator. │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:70 │ │ │ │ │ -_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:109 │ │ │ │ │ -_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_:_:_g_e_t_m_a_t │ │ │ │ │ -virtual const M & getmat() const =0 │ │ │ │ │ -get matrix via * │ │ │ │ │ -_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_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ │ +void blockILUBacksolve(const M &A, X &v, const Y &d) │ │ │ │ │ +LU backsolve with stored inverse. │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ +void blockILU0Decomposition(M &A) │ │ │ │ │ +compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ │ +void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ │ +DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ │ +base class encapsulating common algorithms of ILU0SubdomainSolver and │ │ │ │ │ +ILUNSubdomainSolver. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:36 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_I_L_U │ │ │ │ │ +matrix_type ILU │ │ │ │ │ +The ILU0 decomposition of the matrix, or the local matrix. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ X domain_type │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:113 │ │ │ │ │ -_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_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:115 │ │ │ │ │ -_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_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +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 │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:114 │ │ │ │ │ -_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_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -export types, usually they come from the derived class │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:112 │ │ │ │ │ -_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_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ │ -virtual ~AssembledLinearOperator() │ │ │ │ │ -every abstract base class has a virtual destructor │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:121 │ │ │ │ │ -_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:137 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ │ -MatrixAdapter(std::shared_ptr< const M > A) │ │ │ │ │ -constructor: store an std::shared_ptr to a matrix │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:149 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ │ -MatrixAdapter(const M &A) │ │ │ │ │ -constructor: just store a reference to a matrix │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:146 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_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 operators.hh:158 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +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 │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:142 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ │ +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 │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ │ -X::field_type field_type │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_g_e_t_m_a_t │ │ │ │ │ -const M & getmat() const override │ │ │ │ │ -get matrix via * │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:164 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:170 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_a_p_p_l_y │ │ │ │ │ -void apply(const X &x, Y &y) const override │ │ │ │ │ -apply operator to x: │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:152 │ │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ -M matrix_type │ │ │ │ │ -export types │ │ │ │ │ -DDeeffiinniittiioonn operators.hh:140 │ │ │ │ │ -_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 │ │ │ │ │ +The domain type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:117 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ │ +std::remove_const< M >::type matrix_type │ │ │ │ │ +The matrix type the preconditioner is for. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:114 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_i_l_u___t_y_p_e │ │ │ │ │ +std::remove_const< M >::type rilu_type │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:115 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ │ +void apply(X &v, const Y &d) │ │ │ │ │ +Apply the subdomain solver. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:125 │ │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ │ +Y range_type │ │ │ │ │ +The range type of the preconditioner. │ │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:119 │ │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ │ +RowIterator end() │ │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ │ +DDeeffiinniittiioonn matrix.hh:620 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00227.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlu.hh File Reference │ │ │ │ +dune-istl: solvercategory.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,81 +71,35 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ - │ │ │ │ +Namespaces
│ │ │ │ +
solvercategory.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include "superlufunctions.hh"
│ │ │ │ -#include "solvers.hh"
│ │ │ │ -#include "supermatrix.hh"
│ │ │ │ -#include <algorithm>
│ │ │ │ -#include <functional>
│ │ │ │ -#include "bcrsmatrix.hh"
│ │ │ │ -#include "bvector.hh"
│ │ │ │ -#include "istlexception.hh"
│ │ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ │ -#include <dune/istl/solverfactory.hh>
│ │ │ │ +
#include <dune/common/exceptions.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::SuperLUSolveChooser< T >
 
struct  Dune::SuperLUDenseMatChooser< T >
 
struct  Dune::SuperLUQueryChooser< T >
 
struct  Dune::QuerySpaceChooser< T >
 
class  Dune::SuperLU< M >
 SuperLu Solver. More...
 
struct  Dune::IsDirectSolver< SuperLU< BCRSMatrix< T, A > > >
 
struct  Dune::StoresColumnCompressed< SuperLU< BCRSMatrix< T, A > > >
struct  Dune::SolverCategory
 Categories for the solvers. More...
 
struct  Dune::SuperLUCreator
 
struct  Dune::SuperLUCreator::isValidBlock< class >
 
struct  Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< double, k > >
 
struct  Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< std::complex< double >, k > >
 
struct  Dune::SuperLUCreator::isValidBlock< double >
 
struct  Dune::SuperLUCreator::isValidBlock< std::complex< double > >
class  Dune::InvalidSolverCategory
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

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

Detailed Description

│ │ │ │ -

Classes for using SuperLU with ISTL matrices.

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

│ │ │ │ Files

file  ldl.hh
 Class for using LDL with ISTL matrices.
file  ldl.hh
 Class for using LDL with ISTL matrices.
 
file  spqr.hh
 Class for using SPQR with ISTL matrices.
file  spqr.hh
 Class for using SPQR with ISTL matrices.
 
file  superlu.hh
 Classes for using SuperLU with ISTL matrices.
file  superlu.hh
 Classes for using SuperLU with ISTL matrices.
 
file  umfpack.hh
 Classes for using UMFPack with ISTL matrices.
file  umfpack.hh
 Classes for using UMFPack with ISTL matrices.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00234.html │ │ │ │ @@ -104,19 +104,19 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  Dune::ILUSubdomainSolver< M, X, Y >
 base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver. More...
 
 
 Scalar products
 Scalar products for the use in iterative solvers.
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  solver.hh
 Define general, extensible interface for inverse operators.
file  solver.hh
 Define general, extensible interface for inverse operators.
 
file  solvers.hh
 Implementations of the inverse operator interface.
file  solvers.hh
 Implementations of the inverse operator interface.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00236.html │ │ │ │ @@ -84,16 +84,16 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  Dune::InverseOperatorResult
 Statistics about the application of an inverse operator. More...
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  owneroverlapcopy.hh
 Classes providing communication interfaces for overlapping Schwarz methods.
file  owneroverlapcopy.hh
 Classes providing communication interfaces for overlapping Schwarz methods.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00237.html │ │ │ │ @@ -105,19 +105,19 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  Dune::OwnerOverlapCopyAttributeSet
 Attribute set for overlapping Schwarz. More...
 
 Provides methods for reading and writing matrices and vectors in various formats.
 
 DenseMatVec
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  matrixmatrix.hh
 provides functions for sparse matrix matrix multiplication.
file  matrixmatrix.hh
 provides functions for sparse matrix matrix multiplication.
 
file  matrixutils.hh
 Some handy generic functions for ISTL matrices.
file  matrixutils.hh
 Some handy generic functions for ISTL matrices.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00239.html │ │ │ │ @@ -83,16 +83,16 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  Dune::MatrixDimension< M >
 
struct  Dune::CompressionStatistics< size_type >
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  operators.hh
 Define general, extensible interface for operators. The available implementation wraps a matrix.
file  operators.hh
 Define general, extensible interface for operators. The available implementation wraps a matrix.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00240.html │ │ │ │ @@ -93,61 +93,61 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  Dune::NonoverlappingSchwarzOperator< M, X, Y, C >
 A nonoverlapping operator with communication object. More...
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  aggregates.hh
 Provides classes for the Coloring process of AMG.
file  aggregates.hh
 Provides classes for the Coloring process of AMG.
 
file  amg.hh
 The AMG preconditioner.
file  amg.hh
 The AMG preconditioner.
 
file  construction.hh
 Helper classes for the construction of classes without empty constructor.
file  construction.hh
 Helper classes for the construction of classes without empty constructor.
 
file  dependency.hh
 Provides classes for initializing the link attributes of a matrix graph.
file  dependency.hh
 Provides classes for initializing the link attributes of a matrix graph.
 
file  galerkin.hh
 Provides a class for building the galerkin product based on a aggregation scheme.
file  galerkin.hh
 Provides a class for building the galerkin product based on a aggregation scheme.
 
file  globalaggregates.hh
 Provdes class for identifying aggregates globally.
file  globalaggregates.hh
 Provdes class for identifying aggregates globally.
 
file  graph.hh
 Provides classes for building the matrix graph.
file  graph.hh
 Provides classes for building the matrix graph.
 
file  hierarchy.hh
 Provides a classes representing the hierarchies in AMG.
file  hierarchy.hh
 Provides a classes representing the hierarchies in AMG.
 
file  indicescoarsener.hh
 Provides a class for building the index set and remote indices on the coarse level.
file  indicescoarsener.hh
 Provides a class for building the index set and remote indices on the coarse level.
 
file  kamg.hh
 Provides an algebraic multigrid using a Krylov cycle.
file  kamg.hh
 Provides an algebraic multigrid using a Krylov cycle.
 
file  matrixhierarchy.hh
 Provides a classes representing the hierarchies in AMG.
file  matrixhierarchy.hh
 Provides a classes representing the hierarchies in AMG.
 
file  parameters.hh
 Parameter classes for customizing AMG.
file  parameters.hh
 Parameter classes for customizing AMG.
 
file  properties.hh
 Provides classes for handling internal properties in a graph.
file  properties.hh
 Provides classes for handling internal properties in a graph.
 
file  smoother.hh
 Classes for the generic construction and application of the smoothers.
file  smoother.hh
 Classes for the generic construction and application of the smoothers.
 
file  transfer.hh
 Prolongation and restriction for amg.
file  transfer.hh
 Prolongation and restriction for amg.
 
file  twolevelmethod.hh
 Algebraic twolevel methods.
file  twolevelmethod.hh
 Algebraic twolevel methods.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00242.html │ │ │ │ @@ -98,19 +98,19 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
 Fast (sequential) Algebraic Multigrid
 An Algebraic Multigrid based on Agglomeration that saves memory bandwidth.
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  overlappingschwarz.hh
 Contains one level overlapping Schwarz preconditioners.
file  overlappingschwarz.hh
 Contains one level overlapping Schwarz preconditioners.
 
file  preconditioners.hh
 Define general preconditioner interface.
file  preconditioners.hh
 Define general preconditioner interface.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00243.html │ │ │ │ @@ -86,16 +86,16 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  Dune::NonoverlappingBlockPreconditioner< C, P >
 Nonoverlapping parallel preconditioner. More...
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  scalarproducts.hh
 Define base class for scalar product and norm.
file  scalarproducts.hh
 Define base class for scalar product and norm.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00246.html │ │ │ │ @@ -89,19 +89,19 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  Dune::ScalarProduct< X >
 Base class for scalar product and norm computation. More...
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

file  io.hh
 Some generic functions for pretty printing vectors and matrices.
file  io.hh
 Some generic functions for pretty printing vectors and matrices.
 
file  matrixmarket.hh
 Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
file  matrixmarket.hh
 Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune::MatrixMarketImpl
 
│ │ │ │ @@ -315,16 +315,16 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ inline
│ │ │ │
│ │ │ │ │ │ │ │

Print a row of zeros for a non-existing block.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │ +
Some generic functions for pretty printing vectors and matrices.
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ loadMatrixMarket() [1/2]

│ │ │ │ │ │ │ │
│ │ │ │ @@ -743,15 +743,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Print one row of a matrix, specialization for number types.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ print_row() [2/2]

│ │ │ │ │ │ │ │
│ │ │ │ @@ -812,15 +812,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Print one row of a matrix.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ printmatrix()

│ │ │ │ │ │ │ │
│ │ │ │ @@ -869,15 +869,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Print a generic block matrix.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │
Bug:
Empty rows and columns are omitted by this method. (FlySpray #7)
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ printSparseMatrix()

│ │ │ │ │ │ │ │ @@ -927,15 +927,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Prints a BCRSMatrix with fixed sized blocks.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │

Only the nonzero entries will be printed as matrix blocks together with their corresponding column index and all others will be omitted.

│ │ │ │

This might be preferable over printmatrix in the case of big sparse matrices with nonscalar blocks.

│ │ │ │
Parameters
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1003,15 +1003,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
sThe ostream to print to.
matThe matrix to print.
titleThe title for the matrix.
)
│ │ │ │
│ │ │ │ │ │ │ │

Print an ISTL vector.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ readMatrixMarket() [1/2]

│ │ │ │ │ │ │ │
│ │ │ │ @@ -1140,15 +1140,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Recursively print a vector.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ storeMatrixMarket() [1/2]

│ │ │ │ │ │ │ │
│ │ │ │ @@ -1391,15 +1391,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Writes sparse matrix in a Matlab-readable format.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │

This routine writes the argument BCRSMatrix to a file with the name given by the filename argument. The file format is ASCII, with no header, and three data columns. Each row describes a scalar matrix entry and consists of the matrix row and column numbers (both counted starting from 1), and the matrix entry. Such a file can be read from Matlab using the command

new_mat = spconvert(load('filename'));
│ │ │ │
Parameters
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
matrixreference to matrix
filename
outputPrecision(number of digits) which is used to write the output file
│ │ │ │ @@ -1451,15 +1451,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper method for the writeMatrixToMatlab routine.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │

This specialization for numbers ends the recursion

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ writeMatrixToMatlabHelper() [2/2]

│ │ │ │ │ │ │ │ @@ -1503,15 +1503,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper method for the writeMatrixToMatlab routine.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

◆ writeSVGMatrix()

│ │ │ │ │ │ │ │
│ │ │ │ @@ -1596,15 +1596,15 @@ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Writes vectors in a Matlab-readable format.

│ │ │ │ -
#include <dune/istl/io.hh>
│ │ │ │ +
#include <dune/istl/io.hh>
│ │ │ │

This routine writes the argument block vector to a file with the name given by the filename argument. The file format is ASCII, with no header, and a single data column. Such a file can be read from Matlab using the command

new_vec = load('filename');
│ │ │ │
Parameters
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
vectorreference to vector to be printed to output file
filenamefilename of output file
outputPrecision(number of digits) which is used to write the output file
│ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01084.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Attributes | │ │ │ │ List of all members
│ │ │ │
Dune::exists< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/allocator.hh>

│ │ │ │ +

#include <dune/istl/allocator.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Attributes

static const bool value = true
 
│ │ │ │

Member Data Documentation

│ │ │ │ @@ -109,15 +109,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01088.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::DefaultAllocatorTraits< T, typename > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/allocator.hh>

│ │ │ │ +

#include <dune/istl/allocator.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::DefaultAllocatorTraits< T, typename >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -111,15 +111,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01092.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::DefaultAllocatorTraits< T, std::void_t< typename T::allocator_type > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/allocator.hh>

│ │ │ │ +

#include <dune/istl/allocator.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using type = typename T::allocator_type
 
│ │ │ │

Member Typedef Documentation

│ │ │ │ @@ -101,15 +101,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01096.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::AllocatorTraits< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/allocator.hh>

│ │ │ │ +

#include <dune/istl/allocator.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::AllocatorTraits< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -119,15 +119,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01120.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::OverlappingSchwarzInitializer< I, S, D > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Initializer for SuperLU Matrices representing the subdomains. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -255,16 +255,16 @@ │ │ │ │
│ │ │ │ │ │ │ │

The vector type containing the subdomain to row index mapping.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01136.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixDimension< M > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │

│ │ │ │ Public Types

typedef D subdomain_vector
 The vector type containing the subdomain to row index mapping.
 
typedef I InitializerList
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -143,16 +143,16 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static auto rowdim (const M &A)
 
static auto coldim (const M &A)
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01140.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::CompressionStatistics< size_type > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Statistics about compression achieved in implicit mode. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ +

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -175,15 +175,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

total number of elements written to the overflow area during construction.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01144.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::ImplicitMatrixBuilder< M_ > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A wrapper for uniform access to the BCRSMatrix during and after the build stage in implicit build mode. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ +

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │

│ │ │ │ Public Attributes

double avg
 average number of non-zeroes per row.
 
size_type maximum
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  row_object
 Proxy row object for entry access. More...
 
│ │ │ │ @@ -376,15 +376,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Returns a proxy for entries in row i.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01148.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::ImplicitMatrixBuilder< M_ >::row_object Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Proxy row object for entry access. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ +

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

block_typeoperator[] (size_type j) const
 Returns entry in column j.
 
│ │ │ │ @@ -123,15 +123,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Returns entry in column j.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01152.html │ │ │ │ @@ -85,15 +85,15 @@ │ │ │ │
Dune::BCRSMatrix< B, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A sparse block matrix with compressed row storage. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ +

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BCRSMatrix< B, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -451,15 +451,15 @@ │ │ │ │

Error checking: no error checking is provided normally. Setting the compile time switch DUNE_ISTL_WITH_CHECKING enables error checking.

│ │ │ │

Details:

│ │ │ │
    │ │ │ │
  1. Row-wise scheme
  2. │ │ │ │
│ │ │ │

Rows are built up in sequential order. Size of the row and the column indices are defined. A row can be used as soon as it is initialized. With respect to memory there are two variants of this scheme: (a) number of non-zeroes known in advance (application finite difference schemes), (b) number of non-zeroes not known in advance (application: Sparse LU, ILU(n)).

│ │ │ │
#include<dune/common/fmatrix.hh>
│ │ │ │ - │ │ │ │ + │ │ │ │
│ │ │ │
...
│ │ │ │
│ │ │ │ │ │ │ │
// third parameter is an optional upper bound for the number
│ │ │ │
// of nonzeros. If given the matrix will use one array for all values
│ │ │ │
// as opposed to one for each row.
│ │ │ │ @@ -476,25 +476,25 @@ │ │ │ │
row.insert(row.index()+1);
│ │ │ │
}
│ │ │ │
│ │ │ │
// Now the sparsity pattern is fully set up and we can add values
│ │ │ │
│ │ │ │
B[0][0]=2;
│ │ │ │
...
│ │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ │
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ │
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:1978
│ │ │ │
Iterator class for sequential creation of blocks
Definition bcrsmatrix.hh:957
│ │ │ │
Definition matrixutils.hh:27
│ │ │ │
    │ │ │ │
  1. Random scheme
  2. │ │ │ │
│ │ │ │

For general finite element implementations the number of rows n is known, the number of non-zeroes might also be known (e.g. #edges + #nodes for P2) but the size of a row and the indices of a row can not be defined in sequential order.

│ │ │ │
#include<dune/common/fmatrix.hh>
│ │ │ │ - │ │ │ │ + │ │ │ │
│ │ │ │
...
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
// initially set row size for each row
│ │ │ │ @@ -554,15 +554,15 @@ │ │ │ │ M_i = \textrm{avg} + A + \sum_{j<i} (\textrm{avg} - \textrm{nnz}_j) │ │ │ │ \]" src="form_23.png" width="178" height="29"/> │ │ │ │

│ │ │ │

for all $i$, where $ A = \textrm{avg}(n \cdot \textrm{compressionBufferSize}) $ is the total size of the compression buffer determined by the parameters explained above.

│ │ │ │

The data of the matrix is now located at the beginning of the allocated area, and covers what used to be the compression buffer. In exchange, there is now unused space at the end of the large allocated piece of memory. This will go unused and cannot be freed during the lifetime of the matrix, but it has no negative impact on run-time performance. No matrix entries may be added after the compression step.

│ │ │ │

The compress() method returns a value of type Dune::CompressionStatistics, which you can inspect to tune the construction parameters _avg and compressionBufferSize.

│ │ │ │

Use of copy constructor, assignment operator and matrix vector arithmetics are not supported until the matrix is fully built.

│ │ │ │ -

The following sample code constructs a $ 10 \times 10$ matrix, with an expected number of two entries per matrix row. The compression buffer size is set to 0.4. Hence the main chunk of allocated memory will be able to hold 10 * 2 entries in the matrix rows, and 10 * 2 * 0.4 entries in the compression buffer. In total that's 28 entries.

│ │ │ │ +

The following sample code constructs a $ 10 \times 10$ matrix, with an expected number of two entries per matrix row. The compression buffer size is set to 0.4. Hence the main chunk of allocated memory will be able to hold 10 * 2 entries in the matrix rows, and 10 * 2 * 0.4 entries in the compression buffer. In total that's 28 entries.

│ │ │ │
│ │ │ │ │ │ │ │
M m(10, 10, 2, 0.4, M::implicit);
│ │ │ │
│ │ │ │
// Fill in some arbitrary entries; the order is irrelevant.
│ │ │ │
// Even operations on these would be possible, you get a reference to the entry!
│ │ │ │
m.entry(0,0) = 0.;
│ │ │ │ @@ -3761,15 +3761,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01156.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::BCRSMatrix< B, A >::RealRowIterator< T > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Iterator access to matrix rows │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ +

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BCRSMatrix< B, A >::RealRowIterator< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -408,15 +408,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

return index

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01160.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::BCRSMatrix< B, A >::CreateIterator Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Iterator class for sequential creation of blocks │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ +

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -362,15 +362,15 @@ │ │ │ │ │ │ │ │

Get the current row size.

│ │ │ │
Returns
The number of indices already inserted for the current row.
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01164.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::FieldTraits< BCRSMatrix< B, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │ +

#include <dune/istl/bcrsmatrix.hh>

│ │ │ │

│ │ │ │ Public Member Functions

 CreateIterator (BCRSMatrix &_Mat, size_type _i)
 constructor
 
CreateIteratoroperator++ ()
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -119,15 +119,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using field_type = typename BCRSMatrix< B, A >::field_type
 
using real_type = typename FieldTraits< field_type >::real_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01168.html │ │ │ │ @@ -84,15 +84,15 @@ │ │ │ │
Dune::BDMatrix< B, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A block-diagonal matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bdmatrix.hh>

│ │ │ │ +

#include <dune/istl/bdmatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BDMatrix< B, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -3485,15 +3485,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01172.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::FieldTraits< BDMatrix< B, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/bdmatrix.hh>

│ │ │ │ +

#include <dune/istl/bdmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -119,15 +119,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using field_type = typename BDMatrix< B, A >::field_type
 
using real_type = typename FieldTraits< field_type >::real_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01176.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::MultiTypeBlockVector< Args > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A Vector class to support different block types. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockvector.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockvector.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MultiTypeBlockVector< Args >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -176,16 +176,16 @@ │ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<typename... Args>
│ │ │ │ class Dune::MultiTypeBlockVector< Args >

A Vector class to support different block types.

│ │ │ │

This vector class combines elements of different types known at compile-time.

│ │ │ │

The documentation for this class was generated from the following files: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01180.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::MultiTypeBlockMatrix< FirstRow, Args > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

A Matrix class to support different block types. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MultiTypeBlockMatrix< FirstRow, Args >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -202,16 +202,16 @@ │ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<typename FirstRow, typename... Args>
│ │ │ │ class Dune::MultiTypeBlockMatrix< FirstRow, Args >

A Matrix class to support different block types.

│ │ │ │

This matrix class combines MultiTypeBlockVector elements as rows.

│ │ │ │

The documentation for this class was generated from the following files: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01216.html │ │ │ │ @@ -84,15 +84,15 @@ │ │ │ │
Dune::BTDMatrix< B, A > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

A block-tridiagonal matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/btdmatrix.hh>

│ │ │ │ +

#include <dune/istl/btdmatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BTDMatrix< B, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -3420,15 +3420,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01220.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::FieldTraits< BTDMatrix< B, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/btdmatrix.hh>

│ │ │ │ +

#include <dune/istl/btdmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -119,15 +119,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using field_type = typename BTDMatrix< B, A >::field_type
 
using real_type = typename FieldTraits< field_type >::real_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01244.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::BlockVector< B, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A vector of blocks with memory management. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/bvector.hh>

│ │ │ │ +

#include <dune/istl/bvector.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BlockVector< B, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -730,15 +730,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

increment block level counter

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01248.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::FieldTraits< BlockVector< B, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/bvector.hh>

│ │ │ │ +

#include <dune/istl/bvector.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -119,15 +119,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef FieldTraits< B >::field_type field_type
 
typedef FieldTraits< B >::real_type real_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01280.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::ArPackPlusPlus_Algorithms< BCRSMatrix, BlockVector > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Wrapper to use a range of ARPACK++ eigenvalue solvers. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/eigenvalue/arpackpp.hh>

│ │ │ │ +

#include <dune/istl/eigenvalue/arpackpp.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BlockVector::field_type Real
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -715,15 +715,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01292.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::PowerIteration_Algorithms< BCRSMatrix, BlockVector > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Iterative eigenvalue algorithms based on power iteration. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/eigenvalue/poweriteration.hh>

│ │ │ │ +

#include <dune/istl/eigenvalue/poweriteration.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1203,15 +1203,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BlockVector::field_type Real
 Type of underlying field.
 
typedef OperatorSum IterationOperator
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01312.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

compile-time parameter for block recursion depth │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { recursion_level = l │ │ │ │ }
 
│ │ │ │ @@ -111,15 +111,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
Enumerator
recursion_level 
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01316.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::algmeta_btsolve< I, diag, relax > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -193,15 +193,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bltsolve (const M &A, X &v, const Y &d, const K &w)
 
template<class M , class X , class Y , class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01320.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::algmeta_btsolve< 0, withdiag, withrelax > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -189,15 +189,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bltsolve (const M &A, X &v, const Y &d, const K &w)
 
template<class M , class X , class Y , class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01324.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -189,15 +189,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bltsolve (const M &A, X &v, const Y &d, const K &)
 
template<class M , class X , class Y , class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01328.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -189,15 +189,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bltsolve (const M &, X &v, const Y &d, const K &w)
 
template<class M , class X , class Y , class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01332.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -189,15 +189,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bltsolve (const M &, X &v, const Y &d, const K &)
 
template<class M , class X , class Y , class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01336.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bdsolve (const M &A, X &v, const Y &d, const K &w)
 
│ │ │ │ @@ -138,15 +138,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01340.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bdsolve (const M &A, X &v, const Y &d, const K &w)
 
│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01344.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class X , class Y , class K >
static void bdsolve (const M &A, X &v, const Y &d, const K &)
 
│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01348.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -303,15 +303,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class X , class Y , class K >
static void dbgs (const M &A, X &x, const Y &b, const K &w)
 
template<class X , class Y , class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01352.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -303,15 +303,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class X , class Y , class K >
static void dbgs (const M &A, X &x, const Y &b, const K &)
 
template<class X , class Y , class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01356.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::algmeta_itsteps< I, MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/gsetc.hh>

│ │ │ │ +

#include <dune/istl/gsetc.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -303,15 +303,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename... MultiTypeVectorArgs, class K >
static void dbgs (const MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > &A, MultiTypeBlockVector< MultiTypeVectorArgs... > &x, const MultiTypeBlockVector< MultiTypeVectorArgs... > &b, const K &w)
 
template<typename... MultiTypeVectorArgs, class K >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01360.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::ILU::CRS< B, Alloc > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

a simple compressed row storage matrix class │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/ilu.hh>

│ │ │ │ +

#include <dune/istl/ilu.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ILU::CRS< B, Alloc >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -405,15 +405,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • ilu.hh
  • │ │ │ │ +
  • ilu.hh
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01364.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::ILUSubdomainSolver< M, X, Y > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/ilusubdomainsolver.hh>

│ │ │ │ +

#include <dune/istl/ilusubdomainsolver.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ILUSubdomainSolver< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -295,15 +295,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The ILU0 decomposition of the matrix, or the local matrix.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01368.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::ILU0SubdomainSolver< M, X, Y > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Exact subdomain solver using ILU(p) with appropriate p. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/ilusubdomainsolver.hh>

│ │ │ │ +

#include <dune/istl/ilusubdomainsolver.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ILU0SubdomainSolver< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -286,15 +286,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The ILU0 decomposition of the matrix, or the local matrix.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01372.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ Protected Member Functions | │ │ │ │ Protected Attributes | │ │ │ │ List of all members │ │ │ │
Dune::ILUNSubdomainSolver< M, X, Y > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/ilusubdomainsolver.hh>

│ │ │ │ +

#include <dune/istl/ilusubdomainsolver.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ILUNSubdomainSolver< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -272,15 +272,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The ILU0 decomposition of the matrix, or the local matrix.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01388.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Default options class to write SVG matrices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/io.hh>

│ │ │ │ +

#include <dune/istl/io.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -447,15 +447,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Whether to write the SVG header.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • io.hh
  • │ │ │ │ +
  • io.hh
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01392.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
Dune::ISTLError Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

derive error class from the base class in common │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/istlexception.hh>

│ │ │ │ +

#include <dune/istl/istlexception.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ISTLError:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │

Detailed Description

│ │ │ │

derive error class from the base class in common

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01396.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
Dune::BCRSMatrixError Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Error specific to BCRSMatrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/istlexception.hh>

│ │ │ │ +

#include <dune/istl/istlexception.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BCRSMatrixError:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │

Detailed Description

│ │ │ │

Error specific to BCRSMatrix.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01400.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
Dune::ImplicitModeCompressionBufferExhausted Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Thrown when the compression buffer used by the implicit BCRSMatrix construction is exhausted. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/istlexception.hh>

│ │ │ │ +

#include <dune/istl/istlexception.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ImplicitModeCompressionBufferExhausted:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ │ │ │ │
│ │ │ │

Detailed Description

│ │ │ │

Thrown when the compression buffer used by the implicit BCRSMatrix construction is exhausted.

│ │ │ │

This error occurs if the compression buffer of the BCRSMatrix did not have room for another non-zero entry during implicit mode construction.

│ │ │ │

You can fix this problem by either increasing the average row size or the compressionBufferSize value.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01404.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
Dune::SolverAbort Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Thrown when a solver aborts due to some problem. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/istlexception.hh>

│ │ │ │ +

#include <dune/istl/istlexception.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SolverAbort:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -93,15 +93,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │

Detailed Description

│ │ │ │

Thrown when a solver aborts due to some problem.

│ │ │ │

Problems that may cause the solver to abort include a NaN detected during the convergence check (which may be caused by invalid input data), or breakdown conditions (which can happen e.g. in BiCGSTABSolver or RestartedGMResSolver).

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01408.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::MatrixBlockError Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Error when performing an operation on a matrix block. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/istlexception.hh>

│ │ │ │ +

#include <dune/istl/istlexception.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MatrixBlockError:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -131,15 +131,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

template<class RowPrefix , class ColPrefix >
std::string blockStyleClass (const RowPrefix &row_prefix, const ColPrefix &col_prefix) const
 Helper function that returns an style class for a given prefix.
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01412.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SeqOverlappingSchwarz< M, X, TM, TD, TA > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Sequential overlapping Schwarz preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqOverlappingSchwarz< M, X, TM, TD, TA >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -543,16 +543,16 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, X >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01416.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SeqOverlappingSchwarzAssemblerHelper< T, tag > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01420.html │ │ │ │ @@ -76,26 +76,26 @@ │ │ │ │
Dune::LDL< Matrix > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Use the LDL package to directly solve linear systems – empty default class. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/ldl.hh>

│ │ │ │ +

#include <dune/istl/ldl.hh>

│ │ │ │

Detailed Description

│ │ │ │
template<class Matrix>
│ │ │ │ class Dune::LDL< Matrix >

Use the LDL package to directly solve linear systems – empty default class.

│ │ │ │
Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │
Matrixthe matrix type defining the system Details on UMFPack can be found on http://www.cise.ufl.edu/research/sparse/ldl/
│ │ │ │
│ │ │ │
│ │ │ │

The documentation for this class was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01424.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The LDL direct sparse solver for matrices of type BCRSMatrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/ldl.hh>

│ │ │ │ +

#include <dune/istl/ldl.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -569,15 +569,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

helper function for printing solver output

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01428.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::IsDirectSolver< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/ldl.hh>

│ │ │ │ +

#include <dune/istl/ldl.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01432.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::StoresColumnCompressed< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/ldl.hh>

│ │ │ │ +

#include <dune/istl/ldl.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01436.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Classes | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::LDLCreator Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/ldl.hh>

│ │ │ │ +

#include <dune/istl/ldl.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  isValidBlock
 
struct  isValidBlock< FieldVector< double, k > >
 
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
 
template<typename TL , typename M >
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL, const M &, const Dune::ParameterTree &, std::enable_if_t< !isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
 
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01440.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::LDLCreator::isValidBlock< F > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/ldl.hh>

│ │ │ │ +

#include <dune/istl/ldl.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::LDLCreator::isValidBlock< F >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01444.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::LDLCreator::isValidBlock< FieldVector< double, k > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/ldl.hh>

│ │ │ │ +

#include <dune/istl/ldl.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::LDLCreator::isValidBlock< FieldVector< double, k > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • ldl.hh
  • │ │ │ │ +
  • ldl.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01448.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::MatrixImp::DenseMatrixBase< B, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A Vector of blocks with different blocksizes. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrix.hh>

│ │ │ │ +

#include <dune/istl/matrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MatrixImp::DenseMatrixBase< B, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -988,15 +988,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

same effect as constructor with same argument

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01452.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::MatrixImp::DenseMatrixBase< B, A >::Iterator Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Iterator class for sequential access. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrix.hh>

│ │ │ │ +

#include <dune/istl/matrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -586,15 +586,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

equality

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01456.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::MatrixImp::DenseMatrixBase< B, A >::ConstIterator Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

ConstIterator class for sequential access. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrix.hh>

│ │ │ │ +

#include <dune/istl/matrix.hh>

│ │ │ │

│ │ │ │ Public Member Functions

 Iterator ()
 constructor, no arguments
 
 Iterator (Iterator &other)=default
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -553,15 +553,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

equality

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01460.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::Matrix< T, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A generic dynamic dense matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrix.hh>

│ │ │ │ +

#include <dune/istl/matrix.hh>

│ │ │ │

│ │ │ │ Public Member Functions

 ConstIterator ()
 constructor
 
 ConstIterator (const B *data, size_type columns, size_type _i)
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1858,15 +1858,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Abuse DenseMatrixBase as an engine for a 2d array ISTL-style.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01464.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::FieldTraits< Matrix< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrix.hh>

│ │ │ │ +

#include <dune/istl/matrix.hh>

│ │ │ │

│ │ │ │ Public Types

using field_type = typename Imp::BlockTraits< T >::field_type
 Export the type representing the underlying field.
 
typedef T block_type
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -119,15 +119,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using field_type = typename Matrix< T, A >::field_type
 
using real_type = typename FieldTraits< field_type >::real_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01468.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::MatrixIndexSet Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Stores the nonzero entries in a sparse matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixindexset.hh>

│ │ │ │ +

#include <dune/istl/matrixindexset.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef std::size_t size_type
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -464,15 +464,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Return the number of entries.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01472.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::MatrixMarketImpl::mm_numeric_type< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper metaprogram to get the matrix market string representation of the numeric type. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_numeric =false │ │ │ │ }
 
│ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │

Enumerator
is_numeric 

Whether T is a supported numeric type.

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01476.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_numeric_type< int > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_numeric =true │ │ │ │ }
 
│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01480.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_numeric_type< double > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_numeric =true │ │ │ │ }
 
│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01484.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_numeric_type< float > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_numeric =true │ │ │ │ }
 
│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01488.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_numeric_type< std::complex< double > > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_numeric =true │ │ │ │ }
 
│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01492.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_numeric_type< std::complex< float > > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_numeric =true │ │ │ │ }
 
│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01496.html │ │ │ │ @@ -86,15 +86,15 @@ │ │ │ │
Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │
MThe matrix type.
│ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01500.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::mm_header_printer< BCRSMatrix< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void print (std::ostream &os)
 
│ │ │ │

Member Function Documentation

│ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01504.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::mm_header_printer< BlockVector< B, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void print (std::ostream &os)
 
│ │ │ │

Member Function Documentation

│ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01508.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::mm_header_printer< FieldVector< T, j > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void print (std::ostream &os)
 
│ │ │ │

Member Function Documentation

│ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01512.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::mm_header_printer< FieldMatrix< T, i, j > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void print (std::ostream &os)
 
│ │ │ │

Member Function Documentation

│ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01516.html │ │ │ │ @@ -85,15 +85,15 @@ │ │ │ │

Member function mm_block_structure_header::print(os, mat) writes the corresponding header to the specified ostream.

Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │
Thetype of the matrix to generate the header for.
│ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01520.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_block_structure_header< BlockVector< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BlockVector< T, A > M
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -146,15 +146,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01524.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_block_structure_header< BlockVector< FieldVector< T, i >, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BlockVector< FieldVector< T, i >, A > M
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -146,15 +146,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01528.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_block_structure_header< BCRSMatrix< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< T, A > M
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -146,15 +146,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01532.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_block_structure_header< BCRSMatrix< FieldMatrix< T, i, j >, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< FieldMatrix< T, i, j >, A > M
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -146,15 +146,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01536.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_block_structure_header< FieldMatrix< T, i, j > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef FieldMatrix< T, i, j > M
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -146,15 +146,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01540.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::mm_block_structure_header< FieldVector< T, i > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef FieldVector< T, i > M
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -146,15 +146,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01544.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::MatrixMarketImpl::MMHeader Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 MMHeader ()
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -163,15 +163,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01548.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Attributes | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::IndexData< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MatrixMarketImpl::IndexData< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -111,15 +111,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01552.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::MatrixMarketImpl::NumericWrapper< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

a wrapper class of numeric values. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 operator T& ()
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -148,15 +148,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01556.html │ │ │ │ @@ -76,19 +76,19 @@ │ │ │ │
Dune::MatrixMarketImpl::PatternDummy Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Utility class for marking the pattern type of the MatrixMarket matrices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │

Detailed Description

│ │ │ │

Utility class for marking the pattern type of the MatrixMarket matrices.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01560.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::MatrixMarketImpl::NumericWrapper< PatternDummy > Struct Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01564.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::MatrixMarketImpl::MatrixValuesSetter< D, brows, bcols > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Functor to the data values of the matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -196,15 +196,15 @@ │ │ │ │

│ │ │ │ Public Member Functions

template<typename T >
void operator() (const std::vector< std::set< IndexData< D > > > &rows, BCRSMatrix< T > &matrix)
 Sets the matrix values.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01568.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::MatrixValuesSetter< PatternDummy, brows, bcols > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

template<typename M >
void operator() (const std::vector< std::set< IndexData< PatternDummy > > > &rows, M &matrix)
 
│ │ │ │ @@ -126,15 +126,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01572.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::MatrixMarketImpl::is_complex< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MatrixMarketImpl::is_complex< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01576.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::MatrixMarketImpl::is_complex< std::complex< T > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MatrixMarketImpl::is_complex< std::complex< T > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01580.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::MatrixMarketImpl::mm_multipliers< M > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01584.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::mm_multipliers< BCRSMatrix< B, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -107,15 +107,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { rows = 1 │ │ │ │ , cols = 1 │ │ │ │ }
 
Enumerator
rows 
cols 
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01588.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::MatrixMarketImpl::mm_multipliers< BCRSMatrix< FieldMatrix< B, i, j >, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -107,15 +107,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { rows = i │ │ │ │ , cols = j │ │ │ │ }
 
Enumerator
rows 
cols 
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01592.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmarket.hh>

│ │ │ │ +

#include <dune/istl/matrixmarket.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MatrixMarketFormatError:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01664.html │ │ │ │ @@ -76,27 +76,27 @@ │ │ │ │
Dune::MatMultMatResult< M1, M2 > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$) │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ +

#include <dune/istl/matrixmatrix.hh>

│ │ │ │

Detailed Description

│ │ │ │
template<typename M1, typename M2>
│ │ │ │ struct Dune::MatMultMatResult< M1, M2 >

Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$)

│ │ │ │

The type of matrix C will be stored as the associated type MatMultMatResult::type.

Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
M1The type of matrix A.
M2The type of matrix B.
│ │ │ │
│ │ │ │
│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01668.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ +

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef FieldMatrix< T, n, m > type
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01672.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::MatMultMatResult< BCRSMatrix< FieldMatrix< T, n, k >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ +

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type > > type
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01676.html │ │ │ │ @@ -76,27 +76,27 @@ │ │ │ │
Dune::TransposedMatMultMatResult< M1, M2 > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$) │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ +

#include <dune/istl/matrixmatrix.hh>

│ │ │ │

Detailed Description

│ │ │ │
template<typename M1, typename M2>
│ │ │ │ struct Dune::TransposedMatMultMatResult< M1, M2 >

Helper TMP to get the result type of a sparse matrix matrix multiplication ( $C=A*B$)

│ │ │ │

The type of matrix C will be stored as the associated type MatMultMatResult::type.

Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
M1The type of matrix A.
M2The type of matrix B.
│ │ │ │
│ │ │ │
│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01680.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::TransposedMatMultMatResult< FieldMatrix< T, k, n >, FieldMatrix< T, k, m > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ +

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef FieldMatrix< T, n, m > type
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01684.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::TransposedMatMultMatResult< BCRSMatrix< FieldMatrix< T, k, n >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ +

#include <dune/istl/matrixmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type, std::allocator< typename MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > >::type > > type
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01688.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::RedistributeInformation< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -407,15 +407,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

bool isSetup () const
 
template<class D >
void redistribute (const D &from, D &to) const
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01692.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::RedistributeInformation< OwnerOverlapCopyCommunication< T, T1 > > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef OwnerOverlapCopyCommunication< T, T1 > Comm
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -773,15 +773,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01696.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::CommMatrixRowSize< M, RI > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Utility class to communicate and set the row sizes of a redistributed matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -228,15 +228,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef M::size_type value_type
 
typedef M::size_type size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01700.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::CommMatrixSparsityPattern< M, I > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Utility class to communicate and build the sparsity pattern of a redistributed matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -432,15 +432,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef M::size_type size_type
 
typedef Dune::GlobalLookupIndexSet< I > LookupIndexSet
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01704.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::CommPolicy< CommMatrixSparsityPattern< M, I > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -188,15 +188,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef CommMatrixSparsityPattern< M, I > Type
 
typedef I::GlobalIndex IndexedType
 The indexed type we send. This is the global index indentitfying the column.
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01708.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::CommMatrixRow< M, I > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Utility class for comunicating the matrix entries. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -331,15 +331,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

row size information for the receiving side.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01712.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::CommPolicy< CommMatrixRow< M, I > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │

│ │ │ │ Public Member Functions

 CommMatrixRow (M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_)
 Constructor.
 
 CommMatrixRow (M &m_, const Dune::GlobalLookupIndexSet< I > &idxset_, const I &aggidxset_, std::vector< size_t > &rowsize_)
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -188,15 +188,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef CommMatrixRow< M, I > Type
 
typedef std::pair< typename I::GlobalIndex, typename M::block_type > IndexedType
 The indexed type we send. This is the pair of global index indentitfying the column and the value itself.
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01716.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixRowSizeGatherScatter< M, I, RI > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef CommMatrixRowSize< M, RI > Container
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -192,15 +192,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01720.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixCopyRowSizeGatherScatter< M, I, RI > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef CommMatrixRowSize< M, RI > Container
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -192,15 +192,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01724.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::MatrixSparsityPatternGatherScatter< M, I > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -297,15 +297,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef I::GlobalIndex GlobalIndex
 
typedef CommMatrixSparsityPattern< M, I > Container
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01728.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::MatrixRowGatherScatter< M, I > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ +

#include <dune/istl/matrixredistribute.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -341,15 +341,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef I::GlobalIndex GlobalIndex
 
typedef CommMatrixRow< M, I > Container
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01732.html │ │ │ │ @@ -73,15 +73,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::FieldMatrix< K, n, m > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01736.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::CheckIfDiagonalPresent< Matrix, blocklevel, l > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Check whether the a matrix has diagonal values on blocklevel recursion levels. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void check (const Matrix &mat)
 Check whether the a matrix has diagonal values on blocklevel recursion levels.
 
│ │ │ │ @@ -122,15 +122,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Check whether the a matrix has diagonal values on blocklevel recursion levels.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01740.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::CheckIfDiagonalPresent< Matrix, 0, l > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void check (const Matrix &mat)
 
│ │ │ │

Member Function Documentation

│ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01744.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::CheckIfDiagonalPresent< MultiTypeBlockMatrix< T1, Args... >, blocklevel, l > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef MultiTypeBlockMatrix< T1, Args... > Matrix
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -139,15 +139,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Check whether the a matrix has diagonal values on blocklevel recursion levels.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01752.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< Matrix< B, TA > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -264,15 +264,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using block_type = typename Matrix< B, TA >::block_type
 
using size_type = typename Matrix< B, TA >::size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01756.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< BCRSMatrix< B, TA > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -282,15 +282,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< B, TA > Matrix
 
typedef Matrix::block_type block_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01760.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< BCRSMatrix< FieldMatrix< B, n, m >, TA > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -264,15 +264,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< FieldMatrix< B, n, m >,TA > Matrix
 
typedef Matrix::size_type size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01764.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< FieldMatrix< K, n, m > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -264,15 +264,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef FieldMatrix< K, n, m > Matrix
 
typedef Matrix::size_type size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01768.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< Dune::DynamicMatrix< T > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -264,15 +264,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef Dune::DynamicMatrix< T > MatrixType
 
typedef MatrixType::size_type size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01772.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< Matrix< FieldMatrix< K, n, m >, TA > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -264,15 +264,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef Matrix< FieldMatrix< K, n, m >, TA > ThisMatrix
 
typedef ThisMatrix::size_type size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01776.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< DiagonalMatrix< K, n > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -264,15 +264,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DiagonalMatrix< K, n > Matrix
 
typedef Matrix::size_type size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01780.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::MatrixDimension< ScaledIdentityMatrix< K, n > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -264,15 +264,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef ScaledIdentityMatrix< K, n > Matrix
 
typedef Matrix::size_type size_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01784.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::IsMatrix< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Test whether a type is an ISTL Matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = false │ │ │ │ }
 
│ │ │ │ @@ -112,15 +112,15 @@ │ │ │ │

Enumerator
value 

True if T is an ISTL matrix.

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01788.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::IsMatrix< DenseMatrix< T > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │ @@ -106,15 +106,15 @@ │ │ │ │ Enumeratorvalue 

True if T is an ISTL matrix.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01792.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::IsMatrix< BCRSMatrix< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │ @@ -106,15 +106,15 @@ │ │ │ │ Enumeratorvalue 

True if T is an ISTL matrix.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01796.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::PointerCompare< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/matrixutils.hh>

│ │ │ │ +

#include <dune/istl/matrixutils.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

bool operator() (const T *l, const T *r)
 
│ │ │ │

Member Function Documentation

│ │ │ │ @@ -123,15 +123,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01800.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::MultiTypeBlockMatrix_Solver< I, crow, remain_row > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

solver for MultiTypeBlockVector & MultiTypeBlockMatrix types │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename TVector , typename TMatrix , typename K >
static void dbgs (const TMatrix &A, TVector &x, const TVector &b, const K &w)
 
template<typename TVector , typename TMatrix , typename K >
 
│ │ │ │

Detailed Description

│ │ │ │
template<int I, int crow, int remain_row>
│ │ │ │ class Dune::MultiTypeBlockMatrix_Solver< I, crow, remain_row >

solver for MultiTypeBlockVector & MultiTypeBlockMatrix types

│ │ │ │

The methods of this class are called by the solver specializations for MultiTypeBlockVector & MultiTypeBlockMatrix types (dbgs, bsorf, bsorb, dbjac).

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01804.html │ │ │ │ @@ -79,28 +79,28 @@ │ │ │ │
Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, remain_col > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename Trhs , typename TVector , typename TMatrix , typename K >
static void calc_rhs (const TMatrix &A, TVector &x, TVector &v, Trhs &b, const K &w)
 
│ │ │ │

Detailed Description

│ │ │ │
template<int I, int crow, int ccol, int remain_col>
│ │ │ │ class Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, remain_col >

part of solvers for MultiTypeBlockVector & MultiTypeBlockMatrix types

│ │ │ │

For the given row (index "crow") each element is used to calculate the equation's right side.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01808.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, 0 > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename Trhs , typename TVector , typename TMatrix , typename K >
static void calc_rhs (const TMatrix &, TVector &, TVector &, Trhs &, const K &)
 
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01812.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::MultiTypeBlockMatrix_Solver< I, crow, 0 > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename TVector , typename TMatrix , typename K >
static void dbgs (const TMatrix &, TVector &, TVector &, const TVector &, const K &)
 
template<typename TVector , typename TMatrix , typename K >
static void bsorb (const TMatrix &, TVector &, TVector &, const TVector &, const K &)
 
template<typename TVector , typename TMatrix , typename K >
static void dbjac (const TMatrix &, TVector &, TVector &, const TVector &, const K &)
 
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01816.html │ │ │ │ @@ -79,27 +79,27 @@ │ │ │ │
std::tuple_element< i, Dune::MultiTypeBlockMatrix< Args... > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Make std::tuple_element work for MultiTypeBlockMatrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using type = typename std::tuple_element< i, std::tuple< Args... > >::type
 
│ │ │ │

Detailed Description

│ │ │ │
template<size_t i, typename... Args>
│ │ │ │ struct std::tuple_element< i, Dune::MultiTypeBlockMatrix< Args... > >

Make std::tuple_element work for MultiTypeBlockMatrix.

│ │ │ │

It derives from std::tuple after all.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01820.html │ │ │ │ @@ -76,25 +76,25 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::FieldTraits< MultiTypeBlockVector< Args... > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockvector.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockvector.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using field_type = typename MultiTypeBlockVector< Args... >::field_type
 
using real_type = typename FieldTraits< field_type >::real_type
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01824.html │ │ │ │ @@ -79,27 +79,27 @@ │ │ │ │
std::tuple_element< i, Dune::MultiTypeBlockVector< Args... > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Make std::tuple_element work for MultiTypeBlockVector. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/multitypeblockvector.hh>

│ │ │ │ +

#include <dune/istl/multitypeblockvector.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using type = typename std::tuple_element< i, std::tuple< Args... > >::type
 
│ │ │ │

Detailed Description

│ │ │ │
template<size_t i, typename... Args>
│ │ │ │ struct std::tuple_element< i, Dune::MultiTypeBlockVector< Args... > >

Make std::tuple_element work for MultiTypeBlockVector.

│ │ │ │

It derives from std::tuple after all.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01828.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::NonoverlappingSchwarzOperator< M, X, Y, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A nonoverlapping operator with communication object. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/novlpschwarz.hh>

│ │ │ │ +

#include <dune/istl/novlpschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::NonoverlappingSchwarzOperator< M, X, Y, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -724,15 +724,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01836.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::NonoverlappingBlockPreconditioner< C, P > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Nonoverlapping parallel preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/novlpschwarz.hh>

│ │ │ │ +

#include <dune/istl/novlpschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::NonoverlappingBlockPreconditioner< C, P >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -520,15 +520,15 @@ │ │ │ │

Prepare the preconditioner.

│ │ │ │ │ │ │ │

Implements Dune::Preconditioner< P::domain_type, P::range_type >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01840.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::LinearOperator< X, Y > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A linear operator. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/operators.hh>

│ │ │ │ +

#include <dune/istl/operators.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::LinearOperator< X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -352,15 +352,15 @@ │ │ │ │

Category of the linear operator (see SolverCategory::Category)

│ │ │ │ │ │ │ │

Implemented in Dune::NonoverlappingSchwarzOperator< M, X, Y, C >, Dune::OverlappingSchwarzOperator< M, X, Y, C >, and Dune::MatrixAdapter< M, X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01844.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::AssembledLinearOperator< M, X, Y > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A linear operator exporting itself in matrix form. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/operators.hh>

│ │ │ │ +

#include <dune/istl/operators.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::AssembledLinearOperator< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -383,15 +383,15 @@ │ │ │ │

get matrix via *

│ │ │ │ │ │ │ │

Implemented in Dune::NonoverlappingSchwarzOperator< M, X, Y, C >, Dune::OverlappingSchwarzOperator< M, X, Y, C >, and Dune::MatrixAdapter< M, X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01848.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::MatrixAdapter< M, X, Y > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Adapter to turn a matrix into a linear operator. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/operators.hh>

│ │ │ │ +

#include <dune/istl/operators.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MatrixAdapter< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -413,15 +413,15 @@ │ │ │ │

get matrix via *

│ │ │ │ │ │ │ │

Implements Dune::AssembledLinearOperator< M, X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01856.html │ │ │ │ @@ -76,19 +76,19 @@ │ │ │ │
Dune::AdditiveSchwarzMode Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Tag that the tells the Schwarz method to be additive. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │

Detailed Description

│ │ │ │

Tag that the tells the Schwarz method to be additive.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01860.html │ │ │ │ @@ -76,19 +76,19 @@ │ │ │ │
Dune::MultiplicativeSchwarzMode Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Tag that tells the Schwarz method to be multiplicative. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │

Detailed Description

│ │ │ │

Tag that tells the Schwarz method to be multiplicative.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01864.html │ │ │ │ @@ -76,19 +76,19 @@ │ │ │ │
Dune::SymmetricMultiplicativeSchwarzMode Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Tag that tells the Schwarz method to be multiplicative and symmetric. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │

Detailed Description

│ │ │ │

Tag that tells the Schwarz method to be multiplicative and symmetric.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01868.html │ │ │ │ @@ -85,15 +85,15 @@ │ │ │ │
Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │
MThe type of the matrix.
│ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01872.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -322,15 +322,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef std::remove_const< M >::type matrix_type
 The matrix type the preconditioner is for.
 
typedef X::field_type field_type
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01876.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::OverlappingAssignerHelper< T, tag > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::OverlappingAssignerHelper< T, tag >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01880.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >, false > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -232,15 +232,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< K, Al > matrix_type
 
typedef X::field_type field_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01884.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::OverlappingAssignerHelper< S< BCRSMatrix< T, A > >, true > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -257,15 +257,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< T, A > matrix_type
 
typedef S< BCRSMatrix< T, A > >::range_type range_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01888.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::OverlappingAssignerILUBase< M, X, Y > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::OverlappingAssignerILUBase< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -195,15 +195,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01892.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::OverlappingAssignerHelper< ILU0SubdomainSolver< M, X, Y >, false > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::OverlappingAssignerHelper< ILU0SubdomainSolver< M, X, Y >, false >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -287,15 +287,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01896.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::OverlappingAssignerHelper< ILUNSubdomainSolver< M, X, Y >, false > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::OverlappingAssignerHelper< ILUNSubdomainSolver< M, X, Y >, false >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -287,15 +287,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01900.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::AdditiveAdder< S, T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01904.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::AdditiveAdder< S, BlockVector< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -160,15 +160,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef A::size_type size_type
 
typedef std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type field_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01908.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::MultiplicativeAdder< S, T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01912.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::MultiplicativeAdder< S, BlockVector< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -160,15 +160,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef A::size_type size_type
 
typedef std::decay_t< decltype(Impl::asVector(std::declval< T >()))>::field_type field_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01916.html │ │ │ │ @@ -76,28 +76,28 @@ │ │ │ │
Dune::AdderSelector< T, X, S > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

template meta program for choosing how to add the correction. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │

Detailed Description

│ │ │ │
template<typename T, class X, class S>
│ │ │ │ struct Dune::AdderSelector< T, X, S >

template meta program for choosing how to add the correction.

│ │ │ │

There are specialization for the additive, the multiplicative, and the symmetric multiplicative mode.

│ │ │ │
Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
TThe Schwarz mode (either AdditiveSchwarzMode or MuliplicativeSchwarzMode or SymmetricMultiplicativeSchwarzMode)
XThe vector field type
│ │ │ │
│ │ │ │
│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01920.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::AdderSelector< AdditiveSchwarzMode, X, S > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef AdditiveAdder< S, X > Adder
 
│ │ │ │

Member Typedef Documentation

│ │ │ │ @@ -101,15 +101,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01924.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::AdderSelector< MultiplicativeSchwarzMode, X, S > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef MultiplicativeAdder< S, X > Adder
 
│ │ │ │

Member Typedef Documentation

│ │ │ │ @@ -101,15 +101,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01928.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::AdderSelector< SymmetricMultiplicativeSchwarzMode, X, S > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef MultiplicativeAdder< S, X > Adder
 
│ │ │ │

Member Typedef Documentation

│ │ │ │ @@ -101,15 +101,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01932.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::IteratorDirectionSelector< T1, T2, forward > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper template meta program for application of overlapping Schwarz. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -295,15 +295,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef T1 solver_vector
 
typedef solver_vector::iterator solver_iterator
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01936.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::IteratorDirectionSelector< T1, T2, false > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -280,15 +280,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef T1 solver_vector
 
typedef solver_vector::reverse_iterator solver_iterator
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01940.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SeqOverlappingSchwarzApplier< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper template meta program for application of overlapping Schwarz. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -182,15 +182,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef T smoother
 
typedef smoother::range_type range_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01944.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::SeqOverlappingSchwarzApplier< SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -170,15 +170,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > smoother
 
typedef smoother::range_type range_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01948.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::SeqOverlappingSchwarzAssemblerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >, false > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< K, Al > matrix_type
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -139,15 +139,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01952.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::SeqOverlappingSchwarzAssemblerHelper< S< BCRSMatrix< T, A > >, true > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BCRSMatrix< T, A > matrix_type
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -139,15 +139,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01956.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::SeqOverlappingSchwarzAssemblerILUBase< M, X, Y > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqOverlappingSchwarzAssemblerILUBase< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -120,15 +120,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01960.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::SeqOverlappingSchwarzAssemblerHelper< ILU0SubdomainSolver< M, X, Y >, false > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqOverlappingSchwarzAssemblerHelper< ILU0SubdomainSolver< M, X, Y >, false >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -126,15 +126,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01964.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::SeqOverlappingSchwarzAssemblerHelper< ILUNSubdomainSolver< M, X, Y >, false > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqOverlappingSchwarzAssemblerHelper< ILUNSubdomainSolver< M, X, Y >, false >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -126,15 +126,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01968.html │ │ │ │ @@ -73,21 +73,21 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SeqOverlappingSchwarzDomainSize< M > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │

Detailed Description

│ │ │ │
template<class M>
│ │ │ │ struct Dune::SeqOverlappingSchwarzDomainSize< M >

template helper struct to determine the size of a domain for the SeqOverlappingSchwarz solver

│ │ │ │

only implemented for BCRSMatrix<T>

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01972.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::SeqOverlappingSchwarzDomainSize< BCRSMatrix< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ +

#include <dune/istl/overlappingschwarz.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class Domain >
static int size (const Domain &d)
 
│ │ │ │ @@ -173,15 +173,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01976.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::OwnerOverlapCopyAttributeSet Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Attribute set for overlapping Schwarz. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ +

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -112,15 +112,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  AttributeSet { owner =1 │ │ │ │ , overlap =2 │ │ │ │ , copy =3 │ │ │ │ }
overlap 
copy 
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01980.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::IndexInfoFromGrid< G, L > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Information about the index distribution. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ +

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -358,15 +358,15 @@ │ │ │ │ │ │ │ │

Get the set of remote indices.

│ │ │ │
Returns
the set of remote indices.
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01984.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A class setting up standard communication for a two-valued attribute set with owner/overlap/copy semantics. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ +

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │

│ │ │ │ Public Types

typedef G GlobalIdType
 The type of the global index.
 
typedef L LocalIdType
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1400,15 +1400,15 @@ │ │ │ │ │ │ │ │

Get the underlying remote indices.

│ │ │ │
Returns
The underlying remote indices.
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01988.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::CopyGatherScatter< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

gather/scatter callback for communcation │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ +

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │

│ │ │ │ Classes

struct  AddGatherScatter
 
struct  CopyGatherScatter
 gather/scatter callback for communcation More...
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef CommPolicy< T >::IndexedType V
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -205,15 +205,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01992.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::AddGatherScatter< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ +

#include <dune/istl/owneroverlapcopy.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef CommPolicy< T >::IndexedType V
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -198,15 +198,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a01996.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::AggregationCriterion< T > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Base class of all aggregation criterions. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::AggregationCriterion< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -124,15 +124,15 @@ │ │ │ │  Sets reasonable default values for an aisotropic problem.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class T>
│ │ │ │ class Dune::Amg::AggregationCriterion< T >

Base class of all aggregation criterions.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02000.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::Amg::SymmetricMatrixDependency< M, N > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Dependency policy for symmetric matrices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SymmetricMatrixDependency< M, N >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -284,15 +284,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
MThe type of the matrix
NThe type of the metric that turns matrix blocks into field values
│ │ │ │ │ │ │ │ │ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02004.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Dependency policy for symmetric matrices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::Dependency< M, N >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -278,15 +278,15 @@ │ │ │ │  The norm of the current diagonal.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class M, class N>
│ │ │ │ class Dune::Amg::Dependency< M, N >

Dependency policy for symmetric matrices.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02008.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::Amg::SymmetricDependency< M, N > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Dependency policy for symmetric matrices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SymmetricDependency< M, N >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -278,15 +278,15 @@ │ │ │ │  The norm of the current diagonal.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class M, class N>
│ │ │ │ class Dune::Amg::SymmetricDependency< M, N >

Dependency policy for symmetric matrices.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02012.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Norm that uses only the [N][N] entry of the block to determine couplings. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::Diagonal< N >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -115,15 +115,15 @@ │ │ │ │  Compute the norm of a scalar.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<int N>
│ │ │ │ class Dune::Amg::Diagonal< N >

Norm that uses only the [N][N] entry of the block to determine couplings.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02016.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Norm that uses only the [0][0] entry of the block to determine couplings. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::FirstDiagonal:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -223,15 +223,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02020.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Functor using the row sum (infinity) norm to determine strong couplings. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_sign_preserving = false │ │ │ │ }
 
│ │ │ │ @@ -99,15 +99,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
 compute the norm of a matrix.
 
│ │ │ │

Detailed Description

│ │ │ │

Functor using the row sum (infinity) norm to determine strong couplings.

│ │ │ │

The is proposed by several people for elasticity problems.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02024.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_sign_preserving = false │ │ │ │ }
 
│ │ │ │ @@ -93,15 +93,15 @@ │ │ │ │ Public Member Functions │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
template<class M >
FieldTraits< typenameM::field_type >::real_type operator() (const M &m) const
 compute the norm of a matrix.
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02028.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { is_sign_preserving = false │ │ │ │ }
 
│ │ │ │ @@ -93,15 +93,15 @@ │ │ │ │ Public Member Functions │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
template<class M >
FieldTraits< typenameM::field_type >::real_type operator() (const M &m) const
 compute the norm of a matrix.
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02032.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::Amg::SymmetricCriterion< M, Norm > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Criterion taking advantage of symmetric matrices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SymmetricCriterion< M, Norm >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -826,15 +826,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

index of the currently evaluated row.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02036.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::Amg::UnSymmetricCriterion< M, Norm > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Criterion suitable for unsymmetric matrices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::UnSymmetricCriterion< M, Norm >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -827,15 +827,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

index of the currently evaluated row.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02040.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Class for building the aggregates. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -112,15 +112,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef G MatrixGraph
 The matrix graph type used.
 
typedef MatrixGraph::VertexDescriptor Vertex
 Build the aggregates.
 
│ │ │ │

Detailed Description

│ │ │ │
template<class G>
│ │ │ │ class Dune::Amg::Aggregator< G >

Class for building the aggregates.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02044.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::AggregatesMap< V >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -180,15 +180,15 @@ │ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class V>
│ │ │ │ class Dune::Amg::AggregatesMap< V >

Class providing information about the mapping of the vertices onto aggregates.

│ │ │ │

It is assumed that the vertices are consecutively numbered from 0 to the maximum vertex number.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02048.html │ │ │ │ @@ -79,27 +79,27 @@ │ │ │ │
Dune::Amg::AggregatesMap< V >::DummyEdgeVisitor Class Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

A Dummy visitor that does nothing for each visited edge. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

template<class EdgeIterator >
void operator() (const EdgeIterator &edge) const
 
│ │ │ │

Detailed Description

│ │ │ │
template<class V>
│ │ │ │ class Dune::Amg::AggregatesMap< V >::DummyEdgeVisitor

A Dummy visitor that does nothing for each visited edge.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02052.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A class for temporarily storing the vertices of an aggregate in. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/aggregates.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::Aggregate< G, S >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -153,15 +153,15 @@ │ │ │ │  get an iterator over the vertices of the aggregate.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class G, class S>
│ │ │ │ class Dune::Amg::Aggregate< G, S >

A class for temporarily storing the vertices of an aggregate in.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02092.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::KAMG< M, X, S, PI, K, A > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

an algebraic multigrid method using a Krylov-cycle. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/kamg.hh>

│ │ │ │ +

#include <dune/istl/paamg/kamg.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::KAMG< M, X, S, PI, K, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -481,16 +481,16 @@ │ │ │ │

Category of the preconditioner (see SolverCategory::Category)

│ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, X >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02096.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::KAmgTwoGrid< AMG > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Two grid operator for AMG with Krylov cycle. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/kamg.hh>

│ │ │ │ +

#include <dune/istl/paamg/kamg.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::KAmgTwoGrid< AMG >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -675,16 +675,16 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02100.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::AMG< M, X, S, PI, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Parallel algebraic multigrid based on agglomeration. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/amg.hh>

│ │ │ │ +

#include <dune/istl/paamg/amg.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::AMG< M, X, S, PI, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -267,15 +267,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The range type of the preconditioner.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file:
    │ │ │ │ -
  • amg.hh
  • │ │ │ │ +
  • amg.hh
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02112.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::DirectSolverSelector< Matrix, Vector > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/amg.hh>

│ │ │ │ +

#include <dune/istl/paamg/amg.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -117,15 +117,15 @@ │ │ │ │ Static Public Attributes │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  Solver
 
struct  Solver< M, superlu >
 
static constexpr SolverType solver
 
static constexpr bool isDirectSolver = solver != none
 
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • amg.hh
  • │ │ │ │ +
  • amg.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02116.html │ │ │ │ @@ -77,30 +77,30 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, SolverType > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/amg.hh>

│ │ │ │ +

#include <dune/istl/paamg/amg.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef InverseOperator< Vector, Vector > type
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static typecreate (const M &mat, bool verbose, bool reusevector)
 
static std::string name ()
 
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • amg.hh
  • │ │ │ │ +
  • amg.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02120.html │ │ │ │ @@ -77,30 +77,30 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, superlu > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/amg.hh>

│ │ │ │ +

#include <dune/istl/paamg/amg.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef SuperLU< M > type
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static typecreate (const M &mat, bool verbose, bool reusevector)
 
static std::string name ()
 
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • amg.hh
  • │ │ │ │ +
  • amg.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02124.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Classes | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::AMGCreator Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/amg.hh>

│ │ │ │ +

#include <dune/istl/paamg/amg.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -108,15 +108,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  isValidBlockType
 
struct  isValidBlockType< FieldMatrix< T, n, m > >
 
std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL tl, const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std::enable_if_t< isValidBlockType< typename OP::matrix_type::block_type >::value, int >=0) const
 
template<typename TL , typename OP >
std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL, const std::shared_ptr< OP > &, const Dune::ParameterTree &, std::enable_if_t<!isValidBlockType< typename OP::matrix_type::block_type >::value, int >=0) const
 
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • amg.hh
  • │ │ │ │ +
  • amg.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02128.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::AMGCreator::isValidBlockType< class > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/amg.hh>

│ │ │ │ +

#include <dune/istl/paamg/amg.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::AMGCreator::isValidBlockType< class >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • amg.hh
  • │ │ │ │ +
  • amg.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02132.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::AMGCreator::isValidBlockType< FieldMatrix< T, n, m > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/amg.hh>

│ │ │ │ +

#include <dune/istl/paamg/amg.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::AMGCreator::isValidBlockType< FieldMatrix< T, n, m > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file:
    │ │ │ │ -
  • amg.hh
  • │ │ │ │ +
  • amg.hh
  • │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02136.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::ApplyHelper< i > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/combinedfunctor.hh>

│ │ │ │ +

#include <dune/istl/paamg/combinedfunctor.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class TT , class T >
static void apply (TT tuple, const T &t)
 
│ │ │ │ @@ -126,15 +126,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02140.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::ApplyHelper< 0 > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/combinedfunctor.hh>

│ │ │ │ +

#include <dune/istl/paamg/combinedfunctor.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class TT , class T >
static void apply (TT tuple, const T &t)
 
│ │ │ │ @@ -124,15 +124,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02144.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::CombinedFunctor< T > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/combinedfunctor.hh>

│ │ │ │ +

#include <dune/istl/paamg/combinedfunctor.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::CombinedFunctor< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -157,15 +157,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02148.html │ │ │ │ @@ -77,28 +77,28 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< BlockVector< T, A > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef const int Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static std::shared_ptr< BlockVector< T, A > > construct (Arguments &n)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02152.html │ │ │ │ @@ -77,30 +77,30 @@ │ │ │ │ Public Member Functions | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ParallelOperatorArgs< M, C > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 ParallelOperatorArgs (std::shared_ptr< M > matrix, const C &comm)
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Attributes

std::shared_ptr< M > matrix_
 
const C & comm_
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02156.html │ │ │ │ @@ -77,30 +77,30 @@ │ │ │ │ Public Member Functions | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::OwnerOverlapCopyCommunicationArgs Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 OwnerOverlapCopyCommunicationArgs (MPI_Comm comm, SolverCategory::Category cat)
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Attributes

MPI_Comm comm_
 
SolverCategory::Category cat_
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02160.html │ │ │ │ @@ -77,28 +77,28 @@ │ │ │ │ Public Member Functions | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 SequentialCommunicationArgs (Communication< void * > comm, int cat)
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Attributes

Communication< void * > comm_
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02164.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::OverlappingSchwarzOperator< M, X, Y, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

An overlapping Schwarz operator. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/schwarz.hh>

│ │ │ │ +

#include <dune/istl/schwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::OverlappingSchwarzOperator< M, X, Y, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -511,16 +511,16 @@ │ │ │ │

get the sequential assembled linear operator.

│ │ │ │ │ │ │ │

Implements Dune::AssembledLinearOperator< M, X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02168.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< OverlappingSchwarzOperator< M, X, Y, C > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef ParallelOperatorArgs< M, C > Arguments
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02172.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< NonoverlappingSchwarzOperator< M, X, Y, C > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef ParallelOperatorArgs< M, C > Arguments
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02176.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::MatrixAdapterArgs< M, X, Y > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 MatrixAdapterArgs (std::shared_ptr< M > matrix, const SequentialInformation)
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -146,15 +146,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02180.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< MatrixAdapter< M, X, Y > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef const MatrixAdapterArgs< M, X, Y > Arguments
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02184.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< SequentialInformation > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef const SequentialCommunicationArgs Arguments
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -132,15 +132,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02188.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< OwnerOverlapCopyCommunication< T1, T2 > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/construction.hh>

│ │ │ │ +

#include <dune/istl/paamg/construction.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef const OwnerOverlapCopyCommunicationArgs Arguments
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02192.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Class representing the properties of an ede in the matrix graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/dependency.hh>

│ │ │ │ +

#include <dune/istl/paamg/dependency.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -140,15 +140,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { INFLUENCE │ │ │ │ , DEPEND │ │ │ │ , SIZE │ │ │ │ }
 Prints the attributes of the edge for debugging.
 
│ │ │ │

Detailed Description

│ │ │ │

Class representing the properties of an ede in the matrix graph.

│ │ │ │

During the coarsening process the matrix graph needs to hold different properties of its edges. This class ontains methods for getting and setting these edge attributes.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02196.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Class representing a node in the matrix graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/dependency.hh>

│ │ │ │ +

#include <dune/istl/paamg/dependency.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  {
│ │ │ │   ISOLATED │ │ │ │ , VISITED │ │ │ │ , FRONT │ │ │ │ @@ -150,15 +150,15 @@ │ │ │ │
 Reset all flags.
 
│ │ │ │

Detailed Description

│ │ │ │

Class representing a node in the matrix graph.

│ │ │ │

Contains methods for getting and setting node attributes.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02200.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::PropertyGraphVertexPropertyMap< G, i > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/dependency.hh>

│ │ │ │ +

#include <dune/istl/paamg/dependency.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::PropertyGraphVertexPropertyMap< G, i >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -125,15 +125,15 @@ │ │ │ │  Default constructor.
│ │ │ │   │ │ │ │ Reference operator[] (const Vertex &vertex) const │ │ │ │  Get the properties associated to a vertex.
│ │ │ │   │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02204.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/dependency.hh>

│ │ │ │ +

#include <dune/istl/paamg/dependency.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef Amg::PropertyGraphVertexPropertyMap< Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM >, Amg::VertexProperties::VISITEDType
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02208.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/fastamg.hh>

│ │ │ │ +

#include <dune/istl/paamg/fastamg.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::FastAMG< M, X, PI, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -253,15 +253,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The range type of the preconditioner.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02216.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::GaussSeidelPresmoothDefect< level > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/fastamgsmoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/fastamgsmoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename M , typename X , typename Y >
static void apply (const M &A, X &x, Y &d, const Y &b)
 
│ │ │ │ @@ -138,15 +138,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02220.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::GaussSeidelPostsmoothDefect< level > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/fastamgsmoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/fastamgsmoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename M , typename X , typename Y >
static void apply (const M &A, X &x, Y &d, const Y &b)
 
│ │ │ │ @@ -138,15 +138,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02224.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -98,15 +98,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef T Aggregate
 The aggregate descriptor.
 
typedef T Vertex
 The aggregate the vertex belongs to.
 
Vertex vertex
 The vertex descriptor.
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02228.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::Amg::SparsityBuilder< M > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Functor for building the sparsity pattern of the matrix using examineConnectivity. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -103,15 +103,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 SparsityBuilder (M &matrix)
 Constructor.
 
void insert (const typename M::size_type &index)
std::size_t index ()
 
│ │ │ │

Detailed Description

│ │ │ │
template<class M>
│ │ │ │ class Dune::Amg::SparsityBuilder< M >

Functor for building the sparsity pattern of the matrix using examineConnectivity.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02232.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::BaseGalerkinProduct:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -101,15 +101,15 @@ │ │ │ │  Calculate the galerkin product.
│ │ │ │   │ │ │ │ template<class M , class V , class P , class O > │ │ │ │ void calculate (const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const P &pinfo, const O &copy) │ │ │ │   │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02236.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::GalerkinProduct< T > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::GalerkinProduct< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -110,15 +110,15 @@ │ │ │ │  Calculate the galerkin product.
│ │ │ │   │ │ │ │ template<class M , class V , class P , class O > │ │ │ │ void calculate (const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const P &pinfo, const O &copy) │ │ │ │   │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02244.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::GalerkinProduct< SequentialInformation > Class Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::GalerkinProduct< SequentialInformation >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -103,15 +103,15 @@ │ │ │ │  Calculate the galerkin product.
│ │ │ │   │ │ │ │ template<class M , class V , class P , class O > │ │ │ │ void calculate (const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const P &pinfo, const O &copy) │ │ │ │   │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02248.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Classes | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::BaseConnectivityConstructor:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -108,15 +108,15 @@ │ │ │ │   │ │ │ │ template<class R , class G , class V > │ │ │ │ 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.
│ │ │ │   │ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02252.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::BaseConnectivityConstructor::ConnectedBuilder< G, S, V > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Visitor for identifying connected aggregates during a breadthFirstSearch. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef G Graph
 The type of the graph.
 
typedef Graph::ConstEdgeIterator ConstEdgeIterator
 Process an edge pointing to another aggregate.
 
│ │ │ │

Detailed Description

│ │ │ │
template<class G, class S, class V>
│ │ │ │ class Dune::Amg::BaseConnectivityConstructor::ConnectedBuilder< G, S, V >

Visitor for identifying connected aggregates during a breadthFirstSearch.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02256.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConnectivityConstructor< G, T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::ConnectivityConstructor< G, T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -108,15 +108,15 @@ │ │ │ │   │ │ │ │ template<class R , class G , class V > │ │ │ │ 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.
│ │ │ │   │ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02260.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::ConnectivityConstructor< G, SequentialInformation > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::ConnectivityConstructor< G, SequentialInformation >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -108,15 +108,15 @@ │ │ │ │   │ │ │ │ template<class R , class G , class V > │ │ │ │ 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.
│ │ │ │   │ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02264.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::DirichletBoundarySetter< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class O >
static void set (M &coarse, const T &pinfo, const O &copy)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02268.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::DirichletBoundarySetter< SequentialInformation > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ +

#include <dune/istl/paamg/galerkin.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<class M , class O >
static void set (M &coarse, const SequentialInformation &pinfo, const O &copy)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02272.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::GlobalAggregatesMap< T, TI > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  Proxy
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -112,15 +112,15 @@ │ │ │ │

 
Proxy operator[] (std::size_t index)
 
void put (const GlobalIndex &global, size_t i)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02276.html │ │ │ │ @@ -76,25 +76,25 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::GlobalAggregatesMap< T, TI >::Proxy Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 Proxy (const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
 
Proxyoperator= (const GlobalIndex &global)
 
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02280.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::AggregatesGatherScatter< T, TI > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │ Static Public Member Functions │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef TI ParallelIndexSet
 
typedef ParallelIndexSet::GlobalIndex GlobalIndex
 
static const GlobalIndexgather (const GlobalAggregatesMap< T, TI > &ga, size_t i)
 
static void scatter (GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02284.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::Amg::AggregatesPublisher< T, O, I > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02288.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::AggregatesPublisher< T, O, OwnerOverlapCopyCommunication< T1, T2 > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Utility class for publishing the aggregate number of the DOFs in the overlap to other processors and convert them to local indices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -113,15 +113,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef T Vertex
 
typedef O OverlapFlags
 
OThe set of overlap flags.
T1The type of the global indices.
T2The type of the local indices.
│ │ │ │ │ │ │ │ │ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02292.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::AggregatesPublisher< T, O, SequentialInformation > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │

│ │ │ │ Public Types

typedef T Vertex
 
typedef SequentialInformation ParallelInformation
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void publish (AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02296.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::CommPolicy< Amg::GlobalAggregatesMap< T, TI > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ +

#include <dune/istl/paamg/globalaggregates.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │

│ │ │ │ Public Types

typedef Amg::AggregatesMap< T > Type
 
typedef Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static int getSize (const Type &, int)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02300.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The (undirected) graph of a matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::MatrixGraph< M >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -780,15 +780,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Get the number of vertices in the graph.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02304.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::MatrixGraph< M >::EdgeIteratorT< C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Iterator over all edges starting from a vertex. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -625,15 +625,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Access the edge weight.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02308.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::MatrixGraph< M >::VertexIteratorT< C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The vertex iterator type of the graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │

│ │ │ │ Public Types

enum  { isMutable = std::is_same<C, MutableContainer>::value │ │ │ │ }
 
typedef std::remove_const< C >::type MutableContainer
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -547,15 +547,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Access the weight of the vertex.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02312.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A subgraph of a graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SubGraph< G, T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -564,15 +564,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Get the number of vertices in the graph.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02316.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::SubGraph< G, T >::EdgeIndexMap Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

An index map for mapping the edges to indices. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │

│ │ │ │ Public Types

enum  { isMutable = std::is_same<C, MutableContainer>::value │ │ │ │ }
 
typedef std::remove_const< C >::type MutableContainer
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef ReadablePropertyMapTag Category
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -207,15 +207,15 @@ │ │ │ │

│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02320.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::Amg::SubGraph< G, T >::EdgeIterator Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The edge iterator of the graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SubGraph< G, T >::EdgeIterator:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -378,15 +378,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The index of the target vertex of the current edge.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02324.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::Amg::SubGraph< G, T >::VertexIterator Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The vertex iterator of the graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SubGraph< G, T >::VertexIterator:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -320,15 +320,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Preincrement operator.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02328.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::VertexPropertiesGraph< G, VP, VM > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Attaches properties to the vertices of a graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  VertexIteratorT
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -700,15 +700,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Get the number of vertices in the graph.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02332.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::VertexPropertiesGraph< G, VP, VM >::VertexIteratorT< C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::VertexPropertiesGraph< G, VP, VM >::VertexIteratorT< C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -354,15 +354,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Get the properties of the current Vertex.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02336.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Attaches properties to the edges and vertices of a graph. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -954,15 +954,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Get the number of vertices in the graph.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02340.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::EdgeIteratorT< C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::EdgeIteratorT< C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -277,15 +277,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Get the properties of the current edge.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02344.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::VertexIteratorT< C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::VertexIteratorT< C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -331,15 +331,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Get the properties of the current Vertex.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02348.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::GraphVertexPropertiesSelector< G > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Wrapper to access the internal edge properties of a graph via operator[]() │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │

│ │ │ │ Classes

class  EdgeIteratorT
 
class  VertexIteratorT
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -268,15 +268,15 @@ │ │ │ │

│ │ │ │ Public Types

typedef G Graph
 The type of the graph with internal properties.
 
typedef G::VertexProperties VertexProperties
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02352.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::GraphEdgePropertiesSelector< G > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Wrapper to access the internal vertex properties of a graph via operator[]() │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graph.hh>

│ │ │ │ +

#include <dune/istl/paamg/graph.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -268,15 +268,15 @@ │ │ │ │

│ │ │ │ Public Types

typedef G Graph
 The type of the graph with internal properties.
 
typedef G::EdgeProperties EdgeProperties
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02356.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::PropertiesGraphCreator< M, PI > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graphcreator.hh>

│ │ │ │ +

#include <dune/istl/paamg/graphcreator.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -263,15 +263,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef M::matrix_type Matrix
 
typedef Dune::Amg::MatrixGraph< const MatrixMatrixGraph
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02360.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::PropertiesGraphCreator< M, SequentialInformation > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/graphcreator.hh>

│ │ │ │ +

#include <dune/istl/paamg/graphcreator.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -245,15 +245,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef M::matrix_type Matrix
 
typedef Dune::Amg::MatrixGraph< const MatrixMatrixGraph
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02364.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/hierarchy.hh>

│ │ │ │ +

#include <dune/istl/paamg/hierarchy.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::Hierarchy< T, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -289,15 +289,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Construct an empty hierarchy.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02368.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::Amg::Hierarchy< T, A >::LevelIterator< C, T1 > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Iterator over the levels in the hierarchy. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/hierarchy.hh>

│ │ │ │ +

#include <dune/istl/paamg/hierarchy.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::Hierarchy< T, A >::LevelIterator< C, T1 >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -543,15 +543,15 @@ │ │ │ │ │ │ │ │

Check whether there was a redistribution at the current level.

│ │ │ │
Returns
True if there is a redistributed version of the container at the current level.
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02376.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::Amg::IndicesCoarsener< T, E > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │ +

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02380.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ParallelIndicesCoarsener< T, E > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │ +

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::ParallelIndicesCoarsener< T, E >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -123,15 +123,15 @@ │ │ │ │ Static Public Member Functions

template<typename Graph , typename VM >
static Graph::VertexDescriptor coarsen (ParallelInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates)
 Build the coarse index set after the aggregatio.
 
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02388.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Coarsen Indices in the parallel case. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │ +

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -368,15 +368,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
Returns
The number of unknowns on the coarse level.
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02392.html │ │ │ │ @@ -79,28 +79,28 @@ │ │ │ │
Dune::Amg::IndicesCoarsener< SequentialInformation, E > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Coarsen Indices in the sequential case. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │ +

#include <dune/istl/paamg/indicescoarsener.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename Graph , typename VM >
static Graph::VertexDescriptor coarsen (const SequentialInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, SequentialInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates)
 
│ │ │ │

Detailed Description

│ │ │ │
template<typename E>
│ │ │ │ class Dune::Amg::IndicesCoarsener< SequentialInformation, E >

Coarsen Indices in the sequential case.

│ │ │ │

Nothing to be coarsened here. Just renumber the aggregates consecutively

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02396.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::MatrixHierarchy< M, PI, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The hierarchies build by the coarsening process. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/matrixhierarchy.hh>

│ │ │ │ +

#include <dune/istl/paamg/matrixhierarchy.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -424,15 +424,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef M MatrixOperator
 The type of the matrix operator.
 
typedef MatrixOperator::matrix_type Matrix
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02408.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::MatrixHierarchy< M, PI, A >::MatrixStats< Matrix, true >::calc Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/matrixhierarchy.hh>

│ │ │ │ +

#include <dune/istl/paamg/matrixhierarchy.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -257,15 +257,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef Matrix::size_type size_type
 
typedef Matrix::row_type matrix_row
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02412.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::CoarsenCriterion< T > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The criterion describing the stop criteria for the coarsening process. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/matrixhierarchy.hh>

│ │ │ │ +

#include <dune/istl/paamg/matrixhierarchy.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::CoarsenCriterion< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -226,15 +226,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02416.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Parameters needed to check whether a node depends on another. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/parameters.hh>

│ │ │ │ +

#include <dune/istl/paamg/parameters.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::DependencyParameters:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -136,15 +136,15 @@ │ │ │ │ double alpha () const │ │ │ │  Get the scaling value for marking connections as strong. Default value is 1/3.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │

Parameters needed to check whether a node depends on another.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02420.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Parameters needed for the aggregation process. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/parameters.hh>

│ │ │ │ +

#include <dune/istl/paamg/parameters.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::AggregationParameters:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -172,15 +172,15 @@ │ │ │ │ double alpha () const │ │ │ │  Get the scaling value for marking connections as strong. Default value is 1/3.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │

Parameters needed for the aggregation process.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02424.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Parameters for the complete coarsening process. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/parameters.hh>

│ │ │ │ +

#include <dune/istl/paamg/parameters.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::CoarseningParameters:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -204,15 +204,15 @@ │ │ │ │ double alpha () const │ │ │ │  Get the scaling value for marking connections as strong. Default value is 1/3.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │

Parameters for the complete coarsening process.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02428.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

All parameters for AMG. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/parameters.hh>

│ │ │ │ +

#include <dune/istl/paamg/parameters.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::Parameters:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -235,15 +235,15 @@ │ │ │ │  Get the scaling value for marking connections as strong. Default value is 1/3.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │

All parameters for AMG.

│ │ │ │

Instances of this class can be provided to CoarsenCriterion via its constructor.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02436.html │ │ │ │ @@ -76,19 +76,19 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Tag idnetifying the visited property of a vertex. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/properties.hh>

│ │ │ │ +

#include <dune/istl/paamg/properties.hh>

│ │ │ │

Detailed Description

│ │ │ │

Tag idnetifying the visited property of a vertex.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02440.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::RandomAccessBundledPropertyMap< C, K, i, T, R > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A property map that extracts one property out of a bundle using operator[]() │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/properties.hh>

│ │ │ │ +

#include <dune/istl/paamg/properties.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::RandomAccessBundledPropertyMap< C, K, i, T, R >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -127,15 +127,15 @@ │ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<typename C, typename K, std::size_t i, typename T = typename C::ValueType, typename R = typename C::Reference>
│ │ │ │ class Dune::Amg::RandomAccessBundledPropertyMap< C, K, i, T, R >

A property map that extracts one property out of a bundle using operator[]()

│ │ │ │

Using this access class properties can be stored in std::bitset.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02444.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Protected Attributes | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::AggregateRenumberer< G > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/renumberer.hh>

│ │ │ │ +

#include <dune/istl/paamg/renumberer.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef G::VertexDescriptor Vertex
 The vertex type.
 
│ │ │ │ @@ -265,15 +265,15 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02448.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::DefaultSmootherArgs< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The default class for the smoother arguments. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::DefaultSmootherArgs< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -118,15 +118,15 @@ │ │ │ │  The relaxation factor to use.
│ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class T>
│ │ │ │ struct Dune::Amg::DefaultSmootherArgs< T >

The default class for the smoother arguments.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02452.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::Amg::SmootherTraits< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Traits class for getting the attribute class of a smoother. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SmootherTraits< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -106,15 +106,15 @@ │ │ │ │ typedef DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments │ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class T>
│ │ │ │ struct Dune::Amg::SmootherTraits< T >

Traits class for getting the attribute class of a smoother.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02456.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::SmootherTraits< Richardson< X, Y > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultSmootherArgs< typename X::field_type > Arguments
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02460.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::SmootherTraits< BlockPreconditioner< X, Y, C, T > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SmootherTraits< BlockPreconditioner< X, Y, C, T > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02464.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::SmootherTraits< NonoverlappingBlockPreconditioner< C, T > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SmootherTraits< NonoverlappingBlockPreconditioner< C, T > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02468.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::DefaultConstructionArgs< T > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Construction Arguments for the default smoothers. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::DefaultConstructionArgs< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -131,15 +131,15 @@ │ │ │ │ const Matrix * matrix_ │ │ │ │   │ │ │ │ │ │ │ │

Detailed Description

│ │ │ │
template<class T>
│ │ │ │ class Dune::Amg::DefaultConstructionArgs< T >

Construction Arguments for the default smoothers.

│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02472.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Protected Attributes | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::ConstructionArgs< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::ConstructionArgs< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -115,15 +115,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Protected Attributes

const Matrix * matrix_
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02476.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Protected Attributes | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::DefaultParallelConstructionArgs< T, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::DefaultParallelConstructionArgs< T, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -121,15 +121,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Protected Attributes

const Matrix * matrix_
 
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02480.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::DefaultConstructionArgs< Richardson< X, Y > > Class Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

virtual ~DefaultConstructionArgs ()
 
template<class... Args>
void setMatrix (const Args &...)
 
const SequentialInformationgetComm ()
 
const SmootherArgs getArgs () const
 
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02484.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::ConstructionTraits< SeqSSOR< M, X, Y, l > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Policy for the construction of the SeqSSOR smoother. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultConstructionArgs< SeqSSOR< M, X, Y, l > > Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │

static std::shared_ptr< SeqSSOR< M, X, Y, l > > construct (Arguments &args)
 
│ │ │ │

Detailed Description

│ │ │ │
template<class M, class X, class Y, int l>
│ │ │ │ struct Dune::Amg::ConstructionTraits< SeqSSOR< M, X, Y, l > >

Policy for the construction of the SeqSSOR smoother.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02488.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::ConstructionTraits< SeqSOR< M, X, Y, l > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Policy for the construction of the SeqSOR smoother. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultConstructionArgs< SeqSOR< M, X, Y, l > > Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │

static std::shared_ptr< SeqSOR< M, X, Y, l > > construct (Arguments &args)
 
│ │ │ │

Detailed Description

│ │ │ │
template<class M, class X, class Y, int l>
│ │ │ │ struct Dune::Amg::ConstructionTraits< SeqSOR< M, X, Y, l > >

Policy for the construction of the SeqSOR smoother.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02492.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::ConstructionTraits< SeqJac< M, X, Y, l > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Policy for the construction of the SeqJac smoother. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultConstructionArgs< SeqJac< M, X, Y, l > > Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │

static std::shared_ptr< SeqJac< M, X, Y, l > > construct (Arguments &args)
 
│ │ │ │

Detailed Description

│ │ │ │
template<class M, class X, class Y, int l>
│ │ │ │ struct Dune::Amg::ConstructionTraits< SeqJac< M, X, Y, l > >

Policy for the construction of the SeqJac smoother.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02496.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::ConstructionTraits< Richardson< X, Y > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Policy for the construction of the Richardson smoother. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultConstructionArgs< Richardson< X, Y > > Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │

static std::shared_ptr< Richardson< X, Y > > construct (Arguments &args)
 
│ │ │ │

Detailed Description

│ │ │ │
template<class X, class Y>
│ │ │ │ struct Dune::Amg::ConstructionTraits< Richardson< X, Y > >

Policy for the construction of the Richardson smoother.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02500.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Protected Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionArgs< SeqILU< M, X, Y > > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::ConstructionArgs< SeqILU< M, X, Y > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -333,15 +333,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02504.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::ConstructionTraits< SeqILU< M, X, Y > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Policy for the construction of the SeqILU smoother. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef ConstructionArgs< SeqILU< M, X, Y > > Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │

static std::shared_ptr< SeqILU< M, X, Y > > construct (Arguments &args)
 
│ │ │ │

Detailed Description

│ │ │ │
template<class M, class X, class Y>
│ │ │ │ struct Dune::Amg::ConstructionTraits< SeqILU< M, X, Y > >

Policy for the construction of the SeqILU smoother.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02508.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::ConstructionTraits< ParSSOR< M, X, Y, C > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Policy for the construction of the ParSSOR smoother. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultParallelConstructionArgs< M, C > Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │

static std::shared_ptr< ParSSOR< M, X, Y, C > > construct (Arguments &args)
 
│ │ │ │

Detailed Description

│ │ │ │
template<class M, class X, class Y, class C>
│ │ │ │ struct Dune::Amg::ConstructionTraits< ParSSOR< M, X, Y, C > >

Policy for the construction of the ParSSOR smoother.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02512.html │ │ │ │ @@ -77,30 +77,30 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< BlockPreconditioner< X, Y, C, T > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultParallelConstructionArgs< T, C > Arguments
 
typedef ConstructionTraits< T > SeqConstructionTraits
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static std::shared_ptr< BlockPreconditioner< X, Y, C, T > > construct (Arguments &args)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02516.html │ │ │ │ @@ -77,30 +77,30 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< NonoverlappingBlockPreconditioner< C, T > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef DefaultParallelConstructionArgs< T, C > Arguments
 
typedef ConstructionTraits< T > SeqConstructionTraits
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static std::shared_ptr< NonoverlappingBlockPreconditioner< C, T > > construct (Arguments &args)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02520.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Amg::SmootherApplier< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper class for applying the smoothers. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -106,15 +106,15 @@ │ │ │ │

│ │ │ │ Public Types

typedef T Smoother
 
typedef Smoother::range_type Range
 
│ │ │ │

Detailed Description

│ │ │ │
template<class T>
│ │ │ │ struct Dune::Amg::SmootherApplier< T >

Helper class for applying the smoothers.

│ │ │ │

The goal of this class is to get a symmetric AMG method whenever possible.

│ │ │ │

The specializations for SOR and SeqOverlappingSchwarz in MultiplicativeSchwarzMode will apply the smoother forward when pre and backward when post smoothing.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02524.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::SmootherApplier< SeqSOR< M, X, Y, l > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ Static Public Member Functions │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef SeqSOR< M, X, Y, l > Smoother
 
typedef Smoother::range_type Range
 
static void preSmooth (Smoother &smoother, Domain &v, Range &d)
 
static void postSmooth (Smoother &smoother, Domain &v, Range &d)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02528.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::SmootherApplier< BlockPreconditioner< X, Y, C, SeqSOR< M, X, Y, l > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ Static Public Member Functions │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef BlockPreconditioner< X, Y, C, SeqSOR< M, X, Y, l > > Smoother
 
typedef Smoother::range_type Range
 
static void preSmooth (Smoother &smoother, Domain &v, Range &d)
 
static void postSmooth (Smoother &smoother, Domain &v, Range &d)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02532.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::SmootherApplier< NonoverlappingBlockPreconditioner< C, SeqSOR< M, X, Y, l > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ Static Public Member Functions │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef NonoverlappingBlockPreconditioner< C, SeqSOR< M, X, Y, l > > Smoother
 
typedef Smoother::range_type Range
 
static void preSmooth (Smoother &smoother, Domain &v, Range &d)
 
static void postSmooth (Smoother &smoother, Domain &v, Range &d)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02536.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::SmootherApplier< SeqOverlappingSchwarz< M, X, MultiplicativeSchwarzMode, MS, TA > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ Static Public Member Functions │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef SeqOverlappingSchwarz< M, X, MultiplicativeSchwarzMode, MS, TA > Smoother
 
typedef Smoother::range_type Range
 
static void preSmooth (Smoother &smoother, Domain &v, const Range &d)
 
static void postSmooth (Smoother &smoother, Domain &v, const Range &d)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02540.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::SeqOverlappingSchwarzSmootherArgs< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::SeqOverlappingSchwarzSmootherArgs< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -121,15 +121,15 @@ │ │ │ │  The numbe of iterations to perform.
│ │ │ │   │ │ │ │ RelaxationFactor relaxationFactor │ │ │ │  The relaxation factor to use.
│ │ │ │   │ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02544.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::Amg::SmootherTraits< SeqOverlappingSchwarz< M, X, TM, TS, TA > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef SeqOverlappingSchwarzSmootherArgs< typename M::field_type > Arguments
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02548.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Protected Attributes | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -348,15 +348,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02564.html │ │ │ │ @@ -77,28 +77,28 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::ConstructionTraits< SeqOverlappingSchwarz< M, X, TM, TS, TA > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ +

#include <dune/istl/paamg/smoother.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > > Arguments
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static std::shared_ptr< SeqOverlappingSchwarz< M, X, TM, TS, TA > > construct (Arguments &args)
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02568.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::Transfer< V1, V2, T > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/transfer.hh>

│ │ │ │ +

#include <dune/istl/paamg/transfer.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -298,15 +298,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef V1 Vertex
 
typedef V2 Vector
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02572.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Member Functions | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::Transfer< V, V1, SequentialInformation > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/transfer.hh>

│ │ │ │ +

#include <dune/istl/paamg/transfer.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -288,15 +288,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef V Vertex
 
typedef V1 Vector
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02576.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/transfer.hh>

│ │ │ │ +

#include <dune/istl/paamg/transfer.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -149,15 +149,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

typedef V Vertex
 
typedef V1 Vector
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02580.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::LevelTransferPolicy< FO, CO > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Abstract base class for transfer between levels and creation of the coarse level system. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │ +

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::LevelTransferPolicy< FO, CO >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -620,15 +620,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The coarse level rhs.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02584.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::AggregationLevelTransferPolicy< O, C > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A LeveTransferPolicy that used aggregation to construct the coarse level system. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │ +

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::AggregationLevelTransferPolicy< O, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -722,15 +722,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

The coarse level rhs.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02588.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::Amg::OneStepAMGCoarseSolverPolicy< O, S, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A policy class for solving the coarse level system using one step of AMG. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │ +

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -383,15 +383,15 @@ │ │ │ │

│ │ │ │ Public Types

typedef O Operator
 The type of the linear operator used.
 
typedef O::range_type X
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02596.html │ │ │ │ @@ -78,15 +78,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::Amg::TwoLevelMethod< FO, CSP, S > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │ +

#include <dune/istl/paamg/twolevelmethod.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Amg::TwoLevelMethod< FO, CSP, S >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -812,15 +812,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02604.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Preconditioner< X, Y > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Base class for matrix free definition of preconditioners. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioner.hh>

│ │ │ │ +

#include <dune/istl/preconditioner.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Preconditioner< X, Y >:
│ │ │ │ │ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02608.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::InverseOperator2Preconditioner< O, c > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Turns an InverseOperator into a Preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioners.hh>

│ │ │ │ +

#include <dune/istl/preconditioners.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::InverseOperator2Preconditioner< O, c >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -467,15 +467,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< O::domain_type, O::range_type >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02612.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SeqSSOR< M, X, Y, l > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Sequential SSOR preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioners.hh>

│ │ │ │ +

#include <dune/istl/preconditioners.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqSSOR< M, X, Y, l >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -608,15 +608,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02616.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SeqSOR< M, X, Y, l > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Sequential SOR preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioners.hh>

│ │ │ │ +

#include <dune/istl/preconditioners.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqSOR< M, X, Y, l >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -657,15 +657,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02620.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SeqJac< M, X, Y, l > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The sequential jacobian preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioners.hh>

│ │ │ │ +

#include <dune/istl/preconditioners.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqJac< M, X, Y, l >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -608,15 +608,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02624.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::SeqILU< M, X, Y, l > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Sequential ILU preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioners.hh>

│ │ │ │ +

#include <dune/istl/preconditioners.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqILU< M, X, Y, l >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -891,15 +891,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

true if w != 1.0

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02628.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::Richardson< X, Y > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Richardson preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioners.hh>

│ │ │ │ +

#include <dune/istl/preconditioners.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::Richardson< X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -495,15 +495,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02632.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SeqILDL< M, X, Y > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

sequential ILDL preconditioner │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/preconditioners.hh>

│ │ │ │ +

#include <dune/istl/preconditioners.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqILDL< M, X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -595,15 +595,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02640.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::RedistributeInterface Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/repartition.hh>

│ │ │ │ +

#include <dune/istl/repartition.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::RedistributeInterface:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -297,15 +297,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02660.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::ScalarProduct< X > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Base class for scalar product and norm computation. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/scalarproducts.hh>

│ │ │ │ +

#include <dune/istl/scalarproducts.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ScalarProduct< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -316,15 +316,15 @@ │ │ │ │

Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.

│ │ │ │ │ │ │ │

Reimplemented in Dune::ParallelScalarProduct< X, C >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02664.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::ParallelScalarProduct< X, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Scalar product for overlapping Schwarz methods. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/scalarproducts.hh>

│ │ │ │ +

#include <dune/istl/scalarproducts.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ParallelScalarProduct< X, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -408,15 +408,15 @@ │ │ │ │

Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.

│ │ │ │ │ │ │ │

Reimplemented from Dune::ScalarProduct< X >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02668.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SeqScalarProduct< X > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Default implementation for the scalar case. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/scalarproducts.hh>

│ │ │ │ +

#include <dune/istl/scalarproducts.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SeqScalarProduct< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -299,15 +299,15 @@ │ │ │ │

Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.

│ │ │ │ │ │ │ │

Reimplemented in Dune::ParallelScalarProduct< X, C >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02672.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::NonoverlappingSchwarzScalarProduct< X, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Nonoverlapping Scalar Product with communication object. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/scalarproducts.hh>

│ │ │ │ +

#include <dune/istl/scalarproducts.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::NonoverlappingSchwarzScalarProduct< X, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -397,15 +397,15 @@ │ │ │ │

Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.

│ │ │ │ │ │ │ │

Reimplemented from Dune::ScalarProduct< X >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02676.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::OverlappingSchwarzScalarProduct< X, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Scalar product for overlapping Schwarz methods. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/scalarproducts.hh>

│ │ │ │ +

#include <dune/istl/scalarproducts.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::OverlappingSchwarzScalarProduct< X, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -403,15 +403,15 @@ │ │ │ │

Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.

│ │ │ │ │ │ │ │

Reimplemented from Dune::ScalarProduct< X >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02680.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::ScaledIdentityMatrix< K, n > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A multiple of the identity matrix of static size. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/scaledidmatrix.hh>

│ │ │ │ +

#include <dune/istl/scaledidmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -2167,15 +2167,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

We are at the leaf of the block recursion.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02684.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Member Functions | │ │ │ │ List of all members
│ │ │ │
Dune::DenseMatrixAssigner< DenseMatrix, ScaledIdentityMatrix< field, N > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/scaledidmatrix.hh>

│ │ │ │ +

#include <dune/istl/scaledidmatrix.hh>

│ │ │ │

│ │ │ │ Public Types

enum  { rows = n │ │ │ │ , cols = n │ │ │ │ }
 export size More...
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void apply (DenseMatrix &denseMatrix, ScaledIdentityMatrix< field, N > const &rhs)
 
│ │ │ │

Member Function Documentation

│ │ │ │ @@ -123,15 +123,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02688.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::FieldTraits< ScaledIdentityMatrix< K, n > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/scaledidmatrix.hh>

│ │ │ │ +

#include <dune/istl/scaledidmatrix.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -119,15 +119,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using field_type = typename ScaledIdentityMatrix< K, n >::field_type
 
using real_type = typename FieldTraits< field_type >::real_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02692.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::ParSSOR< M, X, Y, C > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A parallel SSOR preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/schwarz.hh>

│ │ │ │ +

#include <dune/istl/schwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::ParSSOR< M, X, Y, C >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -475,15 +475,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02696.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::BlockPreconditioner< X, Y, C, P > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Block parallel preconditioner. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/schwarz.hh>

│ │ │ │ +

#include <dune/istl/schwarz.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BlockPreconditioner< X, Y, C, P >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -549,15 +549,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

Implements Dune::Preconditioner< X, Y >.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02700.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::InverseOperatorResult Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Statistics about the application of an inverse operator. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solver.hh>

│ │ │ │ +

#include <dune/istl/solver.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -269,15 +269,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Reduction achieved: $ \|b-A(x^n)\|/\|b-A(x^0)\|$.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02704.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::InverseOperator< X, Y > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Abstract base class for all solvers. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solver.hh>

│ │ │ │ +

#include <dune/istl/solver.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::InverseOperator< X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -644,15 +644,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

helper function for printing solver output

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02708.html │ │ │ │ @@ -84,15 +84,15 @@ │ │ │ │
Dune::IterativeSolver< X, Y > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Base class for all implementations of iterative solvers. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solver.hh>

│ │ │ │ +

#include <dune/istl/solver.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::IterativeSolver< X, Y >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1324,15 +1324,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 InverseOperatorResult ()
 Default constructor.
 
void clear ()
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02712.html │ │ │ │ @@ -81,15 +81,15 @@ │ │ │ │
Dune::IterativeSolver< X, Y >::Iteration< CountType > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Class for controlling iterative methods. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solver.hh>

│ │ │ │ +

#include <dune/istl/solver.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -526,15 +526,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

 Iteration (const IterativeSolver &parent, InverseOperatorResult &res)
 
 Iteration (const Iteration &)=delete
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02716.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SolverHelper< ISTLLinearSolver, BCRSMatrix > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solver.hh>

│ │ │ │ +

#include <dune/istl/solver.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -140,15 +140,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  Implementation
 Implementation that works together with iterative ISTL solvers, e.g. Dune::CGSolver or Dune::BiCGSTABSolver. More...
 
struct  Implementation< true, Dummy >
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02720.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::SolverHelper< ISTLLinearSolver, BCRSMatrix >::Implementation< is_direct_solver, Dummy > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Implementation that works together with iterative ISTL solvers, e.g. Dune::CGSolver or Dune::BiCGSTABSolver. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solver.hh>

│ │ │ │ +

#include <dune/istl/solver.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void setMatrix (ISTLLinearSolver &, const BCRSMatrix &)
 
│ │ │ │

Detailed Description

│ │ │ │ @@ -132,15 +132,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02724.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::SolverHelper< ISTLLinearSolver, BCRSMatrix >::Implementation< true, Dummy > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Implementation that works together with direct ISTL solvers, e.g. Dune::SuperLU or Dune::UMFPack. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solver.hh>

│ │ │ │ +

#include <dune/istl/solver.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static void setMatrix (ISTLLinearSolver &solver, const BCRSMatrix &matrix)
 
│ │ │ │

Detailed Description

│ │ │ │ @@ -132,15 +132,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02728.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SolverCategory Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Categories for the solvers. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvercategory.hh>

│ │ │ │ +

#include <dune/istl/solvercategory.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -164,15 +164,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Helperfunction to extract the solver category either from an enum, or from the newly introduced virtual member function.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02732.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::InvalidSolverCategory Class Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/solvercategory.hh>

│ │ │ │ +

#include <dune/istl/solvercategory.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::InvalidSolverCategory:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02736.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::SolverFactory< Operator > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Factory to assembly solvers configured by a ParameterTree. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solverfactory.hh>

│ │ │ │ +

#include <dune/istl/solverfactory.hh>

│ │ │ │

│ │ │ │ Public Types

enum  Category { sequential │ │ │ │ , nonoverlapping │ │ │ │ , overlapping │ │ │ │ }
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -196,15 +196,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Construct a Preconditioner for a given Operator.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02752.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::UnsupportedType Class Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/solverregistry.hh>

│ │ │ │ +

#include <dune/istl/solverregistry.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::UnsupportedType:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02756.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::InvalidSolverFactoryConfiguration Class Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/solverregistry.hh>

│ │ │ │ +

#include <dune/istl/solverregistry.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::InvalidSolverFactoryConfiguration:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02760.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::LoopSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Preconditioned loop solver. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::LoopSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -971,15 +971,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

static std::shared_ptr< Solverget (std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner > prec=nullptr)
 get a solver from the factory
 
static std::shared_ptr< PreconditionergetPreconditioner (std::shared_ptr< Operator > op, const ParameterTree &config)
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02764.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::GradientSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

gradient method │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::GradientSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -971,15 +971,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02768.html │ │ │ │ @@ -84,15 +84,15 @@ │ │ │ │
Dune::CGSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

conjugate gradient method │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::CGSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1234,15 +1234,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02772.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::BiCGSTABSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Bi-conjugate Gradient Stabilized (BiCG-STAB) │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BiCGSTABSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -975,15 +975,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02776.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::MINRESSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Minimal Residual Method (MINRES) │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::MINRESSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -972,15 +972,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02780.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::RestartedGMResSolver< X, Y, F > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

implements the Generalized Minimal Residual (GMRes) method │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::RestartedGMResSolver< X, Y, F >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1595,15 +1595,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02784.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::RestartedFlexibleGMResSolver< X, Y, F > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

implements the Flexible Generalized Minimal Residual (FGMRes) method (right preconditioned) │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::RestartedFlexibleGMResSolver< X, Y, F >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1167,15 +1167,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02788.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::GeneralizedPCGSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Generalized preconditioned conjugate gradient solver. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::GeneralizedPCGSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1288,15 +1288,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02792.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::RestartedFCGSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Accelerated flexible conjugate gradient method. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::RestartedFCGSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1344,15 +1344,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02796.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
Dune::CompleteFCGSolver< X > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Complete flexible conjugate gradient method. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/solvers.hh>

│ │ │ │ +

#include <dune/istl/solvers.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::CompleteFCGSolver< X >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1003,15 +1003,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02800.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::IsDirectSolver< Solver > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/solvertype.hh>

│ │ │ │ +

#include <dune/istl/solvertype.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value =false │ │ │ │ }
 
│ │ │ │ @@ -107,15 +107,15 @@ │ │ │ │

If Solver is a direct solver, this is true.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02804.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::StoresColumnCompressed< Solver > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/solvertype.hh>

│ │ │ │ +

#include <dune/istl/solvertype.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = false │ │ │ │ }
 
│ │ │ │ @@ -106,15 +106,15 @@ │ │ │ │ Enumeratorvalue 

whether the solver internally uses column compressed storage

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02808.html │ │ │ │ @@ -76,26 +76,26 @@ │ │ │ │
Dune::SPQR< Matrix > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Use the SPQR package to directly solve linear systems – empty default class. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/spqr.hh>

│ │ │ │ +

#include <dune/istl/spqr.hh>

│ │ │ │

Detailed Description

│ │ │ │
template<class Matrix>
│ │ │ │ class Dune::SPQR< Matrix >

Use the SPQR package to directly solve linear systems – empty default class.

│ │ │ │
Template Parameters
│ │ │ │ │ │ │ │ │ │ │ │
Matrixthe matrix type defining the system Details on SPQR can be found on http://www.cise.ufl.edu/research/sparse/spqr/
│ │ │ │
│ │ │ │
│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02812.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::SPQR< BCRSMatrix< FieldMatrix< T, n, m >, A > > Class Template Referenceabstract
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The SPQR direct sparse solver for matrices of type BCRSMatrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/spqr.hh>

│ │ │ │ +

#include <dune/istl/spqr.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SPQR< BCRSMatrix< FieldMatrix< T, n, m >, A > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -557,15 +557,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

helper function for printing solver output

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02816.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::IsDirectSolver< SPQR< BCRSMatrix< T, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/spqr.hh>

│ │ │ │ +

#include <dune/istl/spqr.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02820.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::StoresColumnCompressed< SPQR< BCRSMatrix< T, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/spqr.hh>

│ │ │ │ +

#include <dune/istl/spqr.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02824.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Classes | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::SPQRCreator Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/spqr.hh>

│ │ │ │ +

#include <dune/istl/spqr.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  isValidBlock
 
struct  isValidBlock< FieldVector< double, 1 > >
 
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
 
template<typename TL , typename M >
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL, const M &, const Dune::ParameterTree &, std::enable_if_t<!isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02828.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SPQRCreator::isValidBlock< class > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/spqr.hh>

│ │ │ │ +

#include <dune/istl/spqr.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SPQRCreator::isValidBlock< class >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02832.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SPQRCreator::isValidBlock< FieldVector< double, 1 > > Struct Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/spqr.hh>

│ │ │ │ +

#include <dune/istl/spqr.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SPQRCreator::isValidBlock< FieldVector< double, 1 > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02836.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUSolveChooser< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02840.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUDenseMatChooser< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02844.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUQueryChooser< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02848.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::QuerySpaceChooser< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02864.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SuperLU< M > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

SuperLu Solver. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLU< M >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -476,15 +476,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02868.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::IsDirectSolver< SuperLU< BCRSMatrix< T, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value =true │ │ │ │ }
 
│ │ │ │ @@ -105,15 +105,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
Enumerator
value 
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02872.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::StoresColumnCompressed< SuperLU< BCRSMatrix< T, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │ @@ -105,15 +105,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
Enumerator
value 
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02876.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Classes | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::SuperLUCreator Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -203,15 +203,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  isValidBlock
 
struct  isValidBlock< double >
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02880.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUCreator::isValidBlock< class > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLUCreator::isValidBlock< class >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02884.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< double, k > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< double, k > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02888.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< std::complex< double >, k > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< std::complex< double >, k > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02892.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUCreator::isValidBlock< double > Struct Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLUCreator::isValidBlock< double >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02896.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperLUCreator::isValidBlock< std::complex< double > > Struct Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/superlu.hh>

│ │ │ │ +

#include <dune/istl/superlu.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLUCreator::isValidBlock< std::complex< double > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02900.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperMatrixCreateSparseChooser< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02904.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperMatrixPrinter< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02908.html │ │ │ │ @@ -76,15 +76,15 @@ │ │ │ │
│ │ │ │ Static Public Attributes | │ │ │ │ List of all members
│ │ │ │
Dune::BaseGetSuperLUType< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::BaseGetSuperLUType< T >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -137,15 +137,15 @@ │ │ │ │
std::is_same<T,float>::value ? SLU_S :
│ │ │ │
( std::is_same<T,std::complex<double> >::value ? SLU_Z :
│ │ │ │
( std::is_same<T,std::complex<float> >::value ? SLU_C : SLU_D ))
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02912.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::GetSuperLUType< T > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02916.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::GetSuperLUType< double > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::GetSuperLUType< double >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -140,15 +140,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02920.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::GetSuperLUType< float > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::GetSuperLUType< float >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -140,15 +140,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02924.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::GetSuperLUType< std::complex< double > > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::GetSuperLUType< std::complex< double > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -140,15 +140,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02928.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::GetSuperLUType< std::complex< float > > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::GetSuperLUType< std::complex< float > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -140,15 +140,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02932.html │ │ │ │ @@ -76,30 +76,30 @@ │ │ │ │
Dune::SuperLUMatrix< M > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Utility class for converting an ISTL Matrix into a SuperLU Matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLUMatrix< M >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │

Detailed Description

│ │ │ │
template<class M>
│ │ │ │ struct Dune::SuperLUMatrix< M >

Utility class for converting an ISTL Matrix into a SuperLU Matrix.

│ │ │ │

The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02936.html │ │ │ │ @@ -73,17 +73,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::SuperMatrixInitializer< M > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02940.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::SuperLUMatrix< BCRSMatrix< B, TA > > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Converter for BCRSMatrix to SuperLU Matrix. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperLUMatrix< BCRSMatrix< B, TA > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -491,15 +491,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02944.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Public Types | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::SuperMatrixInitializer< BCRSMatrix< B, A > > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/supermatrix.hh>

│ │ │ │ +

#include <dune/istl/supermatrix.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::SuperMatrixInitializer< BCRSMatrix< B, A > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -225,15 +225,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02948.html │ │ │ │ @@ -76,23 +76,23 @@ │ │ │ │
│ │ │ │ Static Public Attributes | │ │ │ │ List of all members
│ │ │ │
Dune::UMFPackMethodChooser< T > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Attributes

static constexpr bool valid = false
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02952.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::UMFPackMethodChooser< double > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -118,15 +118,15 @@ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename... A>
static void defaults (A... args)
 
template<typename... A>
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Attributes

static constexpr bool valid = true
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02956.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Static Public Member Functions | │ │ │ │ Static Public Attributes | │ │ │ │ List of all members │ │ │ │
Dune::UMFPackMethodChooser< std::complex< double > > Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -118,15 +118,15 @@ │ │ │ │

│ │ │ │ Static Public Member Functions

template<typename... A>
static void defaults (A... args)
 
template<typename... A>
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Attributes

static constexpr bool valid = true
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02972.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::UMFPack< M > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The UMFPack direct sparse solver. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::UMFPack< M >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -188,15 +188,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
Matrixthe matrix type defining the system
│ │ │ │ │ │ │ │ │ │ │ │
Note
This will only work if dune-istl has been configured to use UMFPack
│ │ │ │

The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02976.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::IsDirectSolver< UMFPack< BCRSMatrix< FieldMatrix< T, n, m >, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value =true │ │ │ │ }
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02980.html │ │ │ │ @@ -76,24 +76,24 @@ │ │ │ │
│ │ │ │ Public Types | │ │ │ │ List of all members
│ │ │ │
Dune::StoresColumnCompressed< UMFPack< BCRSMatrix< T, A > > > Struct Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  { value = true │ │ │ │ }
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02984.html │ │ │ │ @@ -77,15 +77,15 @@ │ │ │ │ Classes | │ │ │ │ Public Member Functions | │ │ │ │ List of all members │ │ │ │
Dune::UMFPackCreator Struct Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Classes

struct  isValidBlock
 
struct  isValidBlock< B, std::enable_if_t< std::is_same< typename FieldTraits< B >::real_type, double >::value > >
 
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
 
template<typename TL , typename M >
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator() (TL, const M &, const Dune::ParameterTree &, std::enable_if_t< !isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
 
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02988.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::UMFPackCreator::isValidBlock< F, class > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::UMFPackCreator::isValidBlock< F, class >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02992.html │ │ │ │ @@ -73,27 +73,27 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Dune::UMFPackCreator::isValidBlock< B, std::enable_if_t< std::is_same< typename FieldTraits< B >::real_type, double >::value > > Struct Template Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

#include <dune/istl/umfpack.hh>

│ │ │ │ +

#include <dune/istl/umfpack.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::UMFPackCreator::isValidBlock< B, std::enable_if_t< std::is_same< typename FieldTraits< B >::real_type, double >::value > >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a02996.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │
Dune::VariableBlockVector< B, A > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

A Vector of blocks with different blocksizes. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/vbvector.hh>

│ │ │ │ +

#include <dune/istl/vbvector.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::VariableBlockVector< B, A >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1210,15 +1210,15 @@ │ │ │ │ │ │ │ │
│ │ │ │

increment block level counter, yes, it is two levels because VariableBlockVector is a container of containers

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a03000.html │ │ │ │ @@ -80,15 +80,15 @@ │ │ │ │
Dune::VariableBlockVector< B, A >::CreateIterator Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Iterator class for sequential creation of blocks. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/vbvector.hh>

│ │ │ │ +

#include <dune/istl/vbvector.hh>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -507,15 +507,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

set size of current block

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a03004.html │ │ │ │ @@ -79,15 +79,15 @@ │ │ │ │
Dune::VariableBlockVector< B, A >::RealIterator< T, R > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Iterator class for sequential access. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dune/istl/vbvector.hh>

│ │ │ │ +

#include <dune/istl/vbvector.hh>

│ │ │ │
│ │ │ │ Inheritance diagram for Dune::VariableBlockVector< B, A >::RealIterator< T, R >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -447,15 +447,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Return the index of the entry this iterator is pointing to.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dir_000005_000000.html │ │ │ │ @@ -69,14 +69,14 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -

istl → common Relation

│ │ │ │ Public Types

using iterator_category = std::output_iterator_tag
 iterator category
 
using value_type = size_type
File in dune/istlIncludes file in dune/istl/common
solverregistry.hhregistry.hh
│ │ │ │ +

istl → common Relation

File in dune/istlIncludes file in dune/istl/common
solverregistry.hhregistry.hh
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dir_000005_000004.html │ │ │ │ @@ -69,14 +69,14 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -

istl → eigenvalue Relation

File in dune/istlIncludes file in dune/istl/eigenvalue
solvers.hharpackpp.hh
│ │ │ │ +

istl → eigenvalue Relation

File in dune/istlIncludes file in dune/istl/eigenvalue
solvers.hharpackpp.hh
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dir_000005_000006.html │ │ │ │ @@ -69,14 +69,14 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -

istl → paamg Relation

File in dune/istlIncludes file in dune/istl/paamg
matrixredistribute.hhpinfo.hh
repartition.hhgraph.hh
│ │ │ │ +

istl → paamg Relation

File in dune/istlIncludes file in dune/istl/paamg
matrixredistribute.hhpinfo.hh
repartition.hhgraph.hh
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dir_30ac00acf892fa1550fd06f6d9d3e856.html │ │ │ │ @@ -84,17 +84,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

 counter.hh
 counter.hh
 
 registry.hh
 registry.hh
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dir_4aff653484460245da749266b1996776.html │ │ │ │ @@ -84,17 +84,17 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

 arpackpp.hh
 arpackpp.hh
 
 poweriteration.hh
 poweriteration.hh
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e12c67a8fe12cf8b78c94f3b4cb9926.html │ │ │ │ @@ -102,140 +102,140 @@ │ │ │ │  eigenvalue │ │ │ │   │ │ │ │  paamg │ │ │ │   │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

 allocator.hh
 allocator.hh
 
 basearray.hh
 Implements several basic array containers.
 basearray.hh
 Implements several basic array containers.
 
 bccsmatrix.hh
 bccsmatrix.hh
 
 bccsmatrixinitializer.hh
 bccsmatrixinitializer.hh
 
 bcrsmatrix.hh
 Implementation of the BCRSMatrix class.
 bcrsmatrix.hh
 Implementation of the BCRSMatrix class.
 
 bdmatrix.hh
 Implementation of the BDMatrix class.
 bdmatrix.hh
 Implementation of the BDMatrix class.
 
 blocklevel.hh
 Helper functions for determining the vector/matrix block level.
 blocklevel.hh
 Helper functions for determining the vector/matrix block level.
 
 btdmatrix.hh
 Implementation of the BTDMatrix class.
 btdmatrix.hh
 Implementation of the BTDMatrix class.
 
 bvector.hh
 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.
 bvector.hh
 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.
 
 cholmod.hh
 cholmod.hh
 
 foreach.hh
 foreach.hh
 
 gsetc.hh
 Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
 gsetc.hh
 Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
 
 ildl.hh
 Incomplete LDL decomposition.
 ildl.hh
 Incomplete LDL decomposition.
 
 ilu.hh
 The incomplete LU factorization kernels.
 ilu.hh
 The incomplete LU factorization kernels.
 
 ilusubdomainsolver.hh
 Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.
 ilusubdomainsolver.hh
 Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.
 
 io.hh
 Some generic functions for pretty printing vectors and matrices.
 io.hh
 Some generic functions for pretty printing vectors and matrices.
 
 istlexception.hh
 istlexception.hh
 
 ldl.hh
 Class for using LDL with ISTL matrices.
 ldl.hh
 Class for using LDL with ISTL matrices.
 
 matrix.hh
 A dynamic dense block matrix class.
 matrix.hh
 A dynamic dense block matrix class.
 
 matrixindexset.hh
 matrixindexset.hh
 
 matrixmarket.hh
 Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
 matrixmarket.hh
 Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
 
 matrixmatrix.hh
 provides functions for sparse matrix matrix multiplication.
 matrixmatrix.hh
 provides functions for sparse matrix matrix multiplication.
 
 matrixredistribute.hh
 Functionality for redistributing a sparse matrix.
 matrixredistribute.hh
 Functionality for redistributing a sparse matrix.
 
 matrixutils.hh
 Some handy generic functions for ISTL matrices.
 matrixutils.hh
 Some handy generic functions for ISTL matrices.
 
 multitypeblockmatrix.hh
 multitypeblockmatrix.hh
 
 multitypeblockvector.hh
 multitypeblockvector.hh
 
 novlpschwarz.hh
 novlpschwarz.hh
 
 operators.hh
 Define general, extensible interface for operators. The available implementation wraps a matrix.
 operators.hh
 Define general, extensible interface for operators. The available implementation wraps a matrix.
 
 overlappingschwarz.hh
 Contains one level overlapping Schwarz preconditioners.
 overlappingschwarz.hh
 Contains one level overlapping Schwarz preconditioners.
 
 owneroverlapcopy.hh
 Classes providing communication interfaces for overlapping Schwarz methods.
 owneroverlapcopy.hh
 Classes providing communication interfaces for overlapping Schwarz methods.
 
 preconditioner.hh
 preconditioner.hh
 
 preconditioners.hh
 Define general preconditioner interface.
 preconditioners.hh
 Define general preconditioner interface.
 
 repartition.hh
 Functionality for redistributing a parallel index set using graph partitioning.
 repartition.hh
 Functionality for redistributing a parallel index set using graph partitioning.
 
 scalarproducts.hh
 Define base class for scalar product and norm.
 scalarproducts.hh
 Define base class for scalar product and norm.
 
 scaledidmatrix.hh
 This file implements a quadratic matrix of fixed size which is a multiple of the identity.
 scaledidmatrix.hh
 This file implements a quadratic matrix of fixed size which is a multiple of the identity.
 
 schwarz.hh
 schwarz.hh
 
 solver.hh
 Define general, extensible interface for inverse operators.
 solver.hh
 Define general, extensible interface for inverse operators.
 
 solvercategory.hh
 solvercategory.hh
 
 solverfactory.hh
 solverfactory.hh
 
 solverregistry.hh
 solverregistry.hh
 
 solvers.hh
 Implementations of the inverse operator interface.
 solvers.hh
 Implementations of the inverse operator interface.
 
 solvertype.hh
 Templates characterizing the type of a solver.
 solvertype.hh
 Templates characterizing the type of a solver.
 
 spqr.hh
 Class for using SPQR with ISTL matrices.
 spqr.hh
 Class for using SPQR with ISTL matrices.
 
 superlu.hh
 Classes for using SuperLU with ISTL matrices.
 superlu.hh
 Classes for using SuperLU with ISTL matrices.
 
 superlufunctions.hh
 superlufunctions.hh
 
 supermatrix.hh
 supermatrix.hh
 
 umfpack.hh
 Classes for using UMFPack with ISTL matrices.
 umfpack.hh
 Classes for using UMFPack with ISTL matrices.
 
 vbvector.hh
 ???
 vbvector.hh
 ???
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dir_667edbdb0a8210232217f5e7df6d52d4.html │ │ │ │ @@ -84,74 +84,74 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Files

 aggregates.hh
 Provides classes for the Coloring process of AMG.
 aggregates.hh
 Provides classes for the Coloring process of AMG.
 
 amg.hh
 The AMG preconditioner.
 amg.hh
 The AMG preconditioner.
 
 combinedfunctor.hh
 combinedfunctor.hh
 
 construction.hh
 Helper classes for the construction of classes without empty constructor.
 construction.hh
 Helper classes for the construction of classes without empty constructor.
 
 dependency.hh
 Provides classes for initializing the link attributes of a matrix graph.
 dependency.hh
 Provides classes for initializing the link attributes of a matrix graph.
 
 fastamg.hh
 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.
 fastamg.hh
 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.
 
 fastamgsmoother.hh
 fastamgsmoother.hh
 
 galerkin.hh
 Provides a class for building the galerkin product based on a aggregation scheme.
 galerkin.hh
 Provides a class for building the galerkin product based on a aggregation scheme.
 
 globalaggregates.hh
 Provdes class for identifying aggregates globally.
 globalaggregates.hh
 Provdes class for identifying aggregates globally.
 
 graph.hh
 Provides classes for building the matrix graph.
 graph.hh
 Provides classes for building the matrix graph.
 
 graphcreator.hh
 graphcreator.hh
 
 hierarchy.hh
 Provides a classes representing the hierarchies in AMG.
 hierarchy.hh
 Provides a classes representing the hierarchies in AMG.
 
 indicescoarsener.hh
 Provides a class for building the index set and remote indices on the coarse level.
 indicescoarsener.hh
 Provides a class for building the index set and remote indices on the coarse level.
 
 kamg.hh
 Provides an algebraic multigrid using a Krylov cycle.
 kamg.hh
 Provides an algebraic multigrid using a Krylov cycle.
 
 matrixhierarchy.hh
 Provides a classes representing the hierarchies in AMG.
 matrixhierarchy.hh
 Provides a classes representing the hierarchies in AMG.
 
 parameters.hh
 Parameter classes for customizing AMG.
 parameters.hh
 Parameter classes for customizing AMG.
 
 pinfo.hh
 
 properties.hh
 Provides classes for handling internal properties in a graph.
 properties.hh
 Provides classes for handling internal properties in a graph.
 
 renumberer.hh
 renumberer.hh
 
 smoother.hh
 Classes for the generic construction and application of the smoothers.
 smoother.hh
 Classes for the generic construction and application of the smoothers.
 
 transfer.hh
 Prolongation and restriction for amg.
 transfer.hh
 Prolongation and restriction for amg.
 
 twolevelmethod.hh
 Algebraic twolevel methods.
 twolevelmethod.hh
 Algebraic twolevel methods.
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/dune-istl.tag.gz │ │ │ │ ├── dune-istl.tag │ │ │ │ │ ├── dune-istl.tag │ │ │ │ │ │ @@ -9,185 +9,185 @@ │ │ │ │ │ │ modules.txt │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/doc/doxygen/ │ │ │ │ │ │ a00005.html │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ allocator.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00035.html │ │ │ │ │ │ + a00044.html │ │ │ │ │ │ Dune::exists │ │ │ │ │ │ Dune::DefaultAllocatorTraits │ │ │ │ │ │ Dune::DefaultAllocatorTraits< T, std::void_t< typename T::allocator_type > > │ │ │ │ │ │ Dune::AllocatorTraits │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ basearray.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00221.html │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ + a00098.html │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ bccsmatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00170.html │ │ │ │ │ │ + a00185.html │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::ISTL │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ bccsmatrixinitializer.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00212.html │ │ │ │ │ │ - dune/istl/bccsmatrix.hh │ │ │ │ │ │ + a00029.html │ │ │ │ │ │ + dune/istl/bccsmatrix.hh │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::ISTL │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ bcrsmatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00179.html │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - matrixutils.hh │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ + a00053.html │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + matrixutils.hh │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ Dune::CompressionStatistics │ │ │ │ │ │ Dune::ImplicitMatrixBuilder │ │ │ │ │ │ Dune::ImplicitMatrixBuilder::row_object │ │ │ │ │ │ Dune::BCRSMatrix │ │ │ │ │ │ Dune::BCRSMatrix::RealRowIterator │ │ │ │ │ │ Dune::BCRSMatrix::CreateIterator │ │ │ │ │ │ Dune::FieldTraits< BCRSMatrix< B, A > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ bdmatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00074.html │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ + a00062.html │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ Dune::BDMatrix │ │ │ │ │ │ Dune::FieldTraits< BDMatrix< B, A > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ blocklevel.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00047.html │ │ │ │ │ │ + a00068.html │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ btdmatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00023.html │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ + a00032.html │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ Dune::BTDMatrix │ │ │ │ │ │ Dune::FieldTraits< BTDMatrix< B, A > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ bvector.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00020.html │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ - basearray.hh │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ + a00221.html │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ + basearray.hh │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ Dune::BlockVector │ │ │ │ │ │ Dune::FieldTraits< BlockVector< B, A > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ cholmod.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00077.html │ │ │ │ │ │ + a00113.html │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ counter.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/common/ │ │ │ │ │ │ - a00062.html │ │ │ │ │ │ + a00050.html │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::CounterImpl │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ DUNE_GET_COUNTER │ │ │ │ │ │ - a00062.html │ │ │ │ │ │ + a00050.html │ │ │ │ │ │ a52c18e20d25c64cfa14ec5faaa4eb3bd │ │ │ │ │ │ (Tag) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ DUNE_INC_COUNTER │ │ │ │ │ │ - a00062.html │ │ │ │ │ │ + a00050.html │ │ │ │ │ │ a5d969c720adf3ae3114e5a51e2cf5d96 │ │ │ │ │ │ (Tag) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ constexpr std::size_t │ │ │ │ │ │ maxcount │ │ │ │ │ │ - a00062.html │ │ │ │ │ │ + a00050.html │ │ │ │ │ │ a691e9cc830a63581384caef120bcbef8 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ registry.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/common/ │ │ │ │ │ │ - a00065.html │ │ │ │ │ │ - counter.hh │ │ │ │ │ │ + a00047.html │ │ │ │ │ │ + counter.hh │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ DUNE_REGISTRY_PUT │ │ │ │ │ │ - a00065.html │ │ │ │ │ │ + a00047.html │ │ │ │ │ │ a5aba8ecf7926f3c3dade1b898db68cf7 │ │ │ │ │ │ (Tag, id,...) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ arpackpp.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/eigenvalue/ │ │ │ │ │ │ - a00164.html │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ - dune/istl/bvector.hh │ │ │ │ │ │ - dune/istl/istlexception.hh │ │ │ │ │ │ - dune/istl/io.hh │ │ │ │ │ │ + a00206.html │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ + dune/istl/bvector.hh │ │ │ │ │ │ + dune/istl/istlexception.hh │ │ │ │ │ │ + dune/istl/io.hh │ │ │ │ │ │ Dune::ArPackPlusPlus_Algorithms │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ poweriteration.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/eigenvalue/ │ │ │ │ │ │ - a00167.html │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ - dune/istl/operators.hh │ │ │ │ │ │ - dune/istl/solvercategory.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ - dune/istl/istlexception.hh │ │ │ │ │ │ - dune/istl/io.hh │ │ │ │ │ │ - dune/istl/solvers.hh │ │ │ │ │ │ + a00209.html │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ + dune/istl/operators.hh │ │ │ │ │ │ + dune/istl/solvercategory.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ + dune/istl/istlexception.hh │ │ │ │ │ │ + dune/istl/io.hh │ │ │ │ │ │ + dune/istl/solvers.hh │ │ │ │ │ │ Dune::PowerIteration_Algorithms │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ foreach.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00053.html │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ - dune/istl/scaledidmatrix.hh │ │ │ │ │ │ + a00197.html │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/scaledidmatrix.hh │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::ForEach │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ gsetc.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00041.html │ │ │ │ │ │ - multitypeblockvector.hh │ │ │ │ │ │ - multitypeblockmatrix.hh │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ + a00035.html │ │ │ │ │ │ + multitypeblockvector.hh │ │ │ │ │ │ + multitypeblockmatrix.hh │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ Dune::BL │ │ │ │ │ │ Dune::algmeta_btsolve │ │ │ │ │ │ Dune::algmeta_btsolve< 0, withdiag, withrelax > │ │ │ │ │ │ Dune::algmeta_btsolve< 0, withdiag, norelax > │ │ │ │ │ │ Dune::algmeta_btsolve< 0, nodiag, withrelax > │ │ │ │ │ │ Dune::algmeta_btsolve< 0, nodiag, norelax > │ │ │ │ │ │ Dune::algmeta_bdsolve │ │ │ │ │ │ @@ -197,107 +197,107 @@ │ │ │ │ │ │ Dune::algmeta_itsteps< 0, M > │ │ │ │ │ │ Dune::algmeta_itsteps< I, MultiTypeBlockMatrix< T1, MultiTypeMatrixArgs... > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ildl.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00014.html │ │ │ │ │ │ - ilu.hh │ │ │ │ │ │ + a00092.html │ │ │ │ │ │ + ilu.hh │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ilu.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00188.html │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ + a00089.html │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ Dune::ILU::CRS │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::ILU │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ilusubdomainsolver.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00191.html │ │ │ │ │ │ - dune/istl/preconditioners.hh │ │ │ │ │ │ - matrix.hh │ │ │ │ │ │ + a00224.html │ │ │ │ │ │ + dune/istl/preconditioners.hh │ │ │ │ │ │ + matrix.hh │ │ │ │ │ │ Dune::ILUSubdomainSolver │ │ │ │ │ │ Dune::ILU0SubdomainSolver │ │ │ │ │ │ Dune::ILUNSubdomainSolver │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ io.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00203.html │ │ │ │ │ │ - matrixutils.hh │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ + a00188.html │ │ │ │ │ │ + matrixutils.hh │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ Dune::DefaultSVGMatrixOptions │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ istlexception.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00215.html │ │ │ │ │ │ + a00107.html │ │ │ │ │ │ Dune::ISTLError │ │ │ │ │ │ Dune::BCRSMatrixError │ │ │ │ │ │ Dune::ImplicitModeCompressionBufferExhausted │ │ │ │ │ │ Dune::SolverAbort │ │ │ │ │ │ Dune::MatrixBlockError │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ldl.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00068.html │ │ │ │ │ │ - dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ - dune/istl/solvers.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ - dune/istl/solverfactory.hh │ │ │ │ │ │ + a00038.html │ │ │ │ │ │ + dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ + dune/istl/solvers.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ + dune/istl/solverfactory.hh │ │ │ │ │ │ Dune::LDL │ │ │ │ │ │ Dune::LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > │ │ │ │ │ │ Dune::IsDirectSolver< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > > │ │ │ │ │ │ Dune::StoresColumnCompressed< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > > │ │ │ │ │ │ Dune::LDLCreator │ │ │ │ │ │ Dune::LDLCreator::isValidBlock │ │ │ │ │ │ Dune::LDLCreator::isValidBlock< FieldVector< double, k > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ matrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00206.html │ │ │ │ │ │ - dune/istl/bvector.hh │ │ │ │ │ │ - dune/istl/istlexception.hh │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ + a00008.html │ │ │ │ │ │ + dune/istl/bvector.hh │ │ │ │ │ │ + dune/istl/istlexception.hh │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ Dune::MatrixImp::DenseMatrixBase │ │ │ │ │ │ Dune::MatrixImp::DenseMatrixBase::Iterator │ │ │ │ │ │ Dune::MatrixImp::DenseMatrixBase::ConstIterator │ │ │ │ │ │ Dune::Matrix │ │ │ │ │ │ Dune::FieldTraits< Matrix< T, A > > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::MatrixImp │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ matrixindexset.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00161.html │ │ │ │ │ │ + a00194.html │ │ │ │ │ │ Dune::MatrixIndexSet │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ matrixmarket.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00050.html │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ - dune/istl/bvector.hh │ │ │ │ │ │ - dune/istl/matrixutils.hh │ │ │ │ │ │ - dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ + a00080.html │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/bvector.hh │ │ │ │ │ │ + dune/istl/matrixutils.hh │ │ │ │ │ │ + dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ Dune::MatrixMarketImpl::mm_numeric_type │ │ │ │ │ │ Dune::MatrixMarketImpl::mm_numeric_type< int > │ │ │ │ │ │ Dune::MatrixMarketImpl::mm_numeric_type< double > │ │ │ │ │ │ Dune::MatrixMarketImpl::mm_numeric_type< float > │ │ │ │ │ │ Dune::MatrixMarketImpl::mm_numeric_type< std::complex< double > > │ │ │ │ │ │ Dune::MatrixMarketImpl::mm_numeric_type< std::complex< float > > │ │ │ │ │ │ Dune::MatrixMarketImpl::mm_header_printer< BCRSMatrix< T, A > > │ │ │ │ │ │ @@ -325,16 +325,16 @@ │ │ │ │ │ │ Dune::MatrixMarketFormatError │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::MatrixMarketImpl │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ matrixmatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00173.html │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + a00110.html │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ Dune::MatMultMatResult │ │ │ │ │ │ Dune::MatMultMatResult< FieldMatrix< T, n, k >, FieldMatrix< T, k, m > > │ │ │ │ │ │ Dune::MatMultMatResult< BCRSMatrix< FieldMatrix< T, n, k >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > > │ │ │ │ │ │ Dune::TransposedMatMultMatResult │ │ │ │ │ │ Dune::TransposedMatMultMatResult< FieldMatrix< T, k, n >, FieldMatrix< T, k, m > > │ │ │ │ │ │ Dune::TransposedMatMultMatResult< BCRSMatrix< FieldMatrix< T, k, n >, A >, BCRSMatrix< FieldMatrix< T, k, m >, A1 > > │ │ │ │ │ │ Dune │ │ │ │ │ │ @@ -352,17 +352,17 @@ │ │ │ │ │ │ ga67ae04c7e7c030370f82da49ab2b98d1 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ matrixredistribute.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00032.html │ │ │ │ │ │ - repartition.hh │ │ │ │ │ │ - dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ + a00011.html │ │ │ │ │ │ + repartition.hh │ │ │ │ │ │ + dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ dune/istl/paamg/pinfo.hh │ │ │ │ │ │ Dune::RedistributeInformation │ │ │ │ │ │ Dune::RedistributeInformation< OwnerOverlapCopyCommunication< T, T1 > > │ │ │ │ │ │ Dune::CommMatrixRowSize │ │ │ │ │ │ Dune::CommMatrixSparsityPattern │ │ │ │ │ │ Dune::CommPolicy< CommMatrixSparsityPattern< M, I > > │ │ │ │ │ │ Dune::CommMatrixRow │ │ │ │ │ │ @@ -372,17 +372,17 @@ │ │ │ │ │ │ Dune::MatrixSparsityPatternGatherScatter │ │ │ │ │ │ Dune::MatrixRowGatherScatter │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ matrixutils.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00080.html │ │ │ │ │ │ - dune/istl/scaledidmatrix.hh │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ + a00095.html │ │ │ │ │ │ + dune/istl/scaledidmatrix.hh │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ Dune::CheckIfDiagonalPresent │ │ │ │ │ │ Dune::CheckIfDiagonalPresent< Matrix, 0, l > │ │ │ │ │ │ Dune::CheckIfDiagonalPresent< MultiTypeBlockMatrix< T1, Args... >, blocklevel, l > │ │ │ │ │ │ Dune::MatrixDimension │ │ │ │ │ │ Dune::MatrixDimension< Matrix< B, TA > > │ │ │ │ │ │ Dune::MatrixDimension< BCRSMatrix< B, TA > > │ │ │ │ │ │ Dune::MatrixDimension< BCRSMatrix< FieldMatrix< B, n, m >, TA > > │ │ │ │ │ │ @@ -396,80 +396,80 @@ │ │ │ │ │ │ Dune::IsMatrix< BCRSMatrix< T, A > > │ │ │ │ │ │ Dune::PointerCompare │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ multitypeblockmatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00029.html │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - gsetc.hh │ │ │ │ │ │ + a00077.html │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + gsetc.hh │ │ │ │ │ │ Dune::MultiTypeBlockMatrix │ │ │ │ │ │ Dune::MultiTypeBlockMatrix_Solver_Col │ │ │ │ │ │ Dune::MultiTypeBlockMatrix_Solver_Col< I, crow, ccol, 0 > │ │ │ │ │ │ Dune::MultiTypeBlockMatrix_Solver │ │ │ │ │ │ Dune::MultiTypeBlockMatrix_Solver< I, crow, 0 > │ │ │ │ │ │ std::tuple_element< i, Dune::MultiTypeBlockMatrix< Args... > > │ │ │ │ │ │ Dune │ │ │ │ │ │ std │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ multitypeblockvector.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00176.html │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - gsetc.hh │ │ │ │ │ │ + a00104.html │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + gsetc.hh │ │ │ │ │ │ Dune::FieldTraits< MultiTypeBlockVector< Args... > > │ │ │ │ │ │ Dune::MultiTypeBlockVector │ │ │ │ │ │ std::tuple_element< i, Dune::MultiTypeBlockVector< Args... > > │ │ │ │ │ │ Dune │ │ │ │ │ │ std │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ novlpschwarz.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00086.html │ │ │ │ │ │ - io.hh │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - vbvector.hh │ │ │ │ │ │ - bcrsmatrix.hh │ │ │ │ │ │ - gsetc.hh │ │ │ │ │ │ - ilu.hh │ │ │ │ │ │ - operators.hh │ │ │ │ │ │ - solvers.hh │ │ │ │ │ │ - preconditioners.hh │ │ │ │ │ │ - scalarproducts.hh │ │ │ │ │ │ - owneroverlapcopy.hh │ │ │ │ │ │ + a00020.html │ │ │ │ │ │ + io.hh │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + vbvector.hh │ │ │ │ │ │ + bcrsmatrix.hh │ │ │ │ │ │ + gsetc.hh │ │ │ │ │ │ + ilu.hh │ │ │ │ │ │ + operators.hh │ │ │ │ │ │ + solvers.hh │ │ │ │ │ │ + preconditioners.hh │ │ │ │ │ │ + scalarproducts.hh │ │ │ │ │ │ + owneroverlapcopy.hh │ │ │ │ │ │ Dune::NonoverlappingSchwarzOperator │ │ │ │ │ │ Dune::NonoverlappingBlockPreconditioner │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ operators.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00224.html │ │ │ │ │ │ - solvercategory.hh │ │ │ │ │ │ + a00041.html │ │ │ │ │ │ + solvercategory.hh │ │ │ │ │ │ Dune::LinearOperator │ │ │ │ │ │ Dune::AssembledLinearOperator │ │ │ │ │ │ Dune::MatrixAdapter │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ overlappingschwarz.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00083.html │ │ │ │ │ │ - dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ - preconditioners.hh │ │ │ │ │ │ - superlu.hh │ │ │ │ │ │ - umfpack.hh │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - bcrsmatrix.hh │ │ │ │ │ │ - ilusubdomainsolver.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ + a00056.html │ │ │ │ │ │ + dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ + preconditioners.hh │ │ │ │ │ │ + superlu.hh │ │ │ │ │ │ + umfpack.hh │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + bcrsmatrix.hh │ │ │ │ │ │ + ilusubdomainsolver.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ Dune::OverlappingSchwarzInitializer │ │ │ │ │ │ Dune::AdditiveSchwarzMode │ │ │ │ │ │ Dune::MultiplicativeSchwarzMode │ │ │ │ │ │ Dune::SymmetricMultiplicativeSchwarzMode │ │ │ │ │ │ Dune::DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y > │ │ │ │ │ │ Dune::OverlappingAssignerHelper │ │ │ │ │ │ Dune::OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< K, Al >, X, Y >, false > │ │ │ │ │ │ @@ -499,40 +499,40 @@ │ │ │ │ │ │ Dune::SeqOverlappingSchwarzDomainSize │ │ │ │ │ │ Dune::SeqOverlappingSchwarzDomainSize< BCRSMatrix< T, A > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ owneroverlapcopy.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00017.html │ │ │ │ │ │ - solvercategory.hh │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - dune/istl/matrixmarket.hh │ │ │ │ │ │ + a00023.html │ │ │ │ │ │ + solvercategory.hh │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + dune/istl/matrixmarket.hh │ │ │ │ │ │ Dune::OwnerOverlapCopyAttributeSet │ │ │ │ │ │ Dune::IndexInfoFromGrid │ │ │ │ │ │ Dune::OwnerOverlapCopyCommunication │ │ │ │ │ │ Dune::OwnerOverlapCopyCommunication::CopyGatherScatter │ │ │ │ │ │ Dune::OwnerOverlapCopyCommunication::AddGatherScatter │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ void │ │ │ │ │ │ testRedistributed │ │ │ │ │ │ - a00017.html │ │ │ │ │ │ + a00023.html │ │ │ │ │ │ abcfd3b2ed3c4dd837b155879a3247503 │ │ │ │ │ │ (int s) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ aggregates.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00122.html │ │ │ │ │ │ - parameters.hh │ │ │ │ │ │ - graph.hh │ │ │ │ │ │ - properties.hh │ │ │ │ │ │ - combinedfunctor.hh │ │ │ │ │ │ + a00146.html │ │ │ │ │ │ + parameters.hh │ │ │ │ │ │ + graph.hh │ │ │ │ │ │ + properties.hh │ │ │ │ │ │ + combinedfunctor.hh │ │ │ │ │ │ Dune::Amg::AggregationCriterion │ │ │ │ │ │ Dune::Amg::SymmetricMatrixDependency │ │ │ │ │ │ Dune::Amg::Dependency │ │ │ │ │ │ Dune::Amg::SymmetricDependency │ │ │ │ │ │ Dune::Amg::Diagonal │ │ │ │ │ │ Dune::Amg::FirstDiagonal │ │ │ │ │ │ Dune::Amg::RowSum │ │ │ │ │ │ @@ -546,51 +546,51 @@ │ │ │ │ │ │ Dune::Amg::Aggregator │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ amg.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00131.html │ │ │ │ │ │ - dune/istl/paamg/smoother.hh │ │ │ │ │ │ - dune/istl/paamg/transfer.hh │ │ │ │ │ │ - dune/istl/paamg/matrixhierarchy.hh │ │ │ │ │ │ - dune/istl/solvers.hh │ │ │ │ │ │ - dune/istl/scalarproducts.hh │ │ │ │ │ │ - dune/istl/superlu.hh │ │ │ │ │ │ - dune/istl/umfpack.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ + a00167.html │ │ │ │ │ │ + dune/istl/paamg/smoother.hh │ │ │ │ │ │ + dune/istl/paamg/transfer.hh │ │ │ │ │ │ + dune/istl/paamg/matrixhierarchy.hh │ │ │ │ │ │ + dune/istl/solvers.hh │ │ │ │ │ │ + dune/istl/scalarproducts.hh │ │ │ │ │ │ + dune/istl/superlu.hh │ │ │ │ │ │ + dune/istl/umfpack.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ Dune::Amg::AMG │ │ │ │ │ │ Dune::Amg::DirectSolverSelector │ │ │ │ │ │ Dune::Amg::DirectSolverSelector::Solver │ │ │ │ │ │ Dune::Amg::DirectSolverSelector::Solver< M, superlu > │ │ │ │ │ │ Dune::AMGCreator │ │ │ │ │ │ Dune::AMGCreator::isValidBlockType │ │ │ │ │ │ Dune::AMGCreator::isValidBlockType< FieldMatrix< T, n, m > > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ combinedfunctor.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00110.html │ │ │ │ │ │ + a00128.html │ │ │ │ │ │ Dune::Amg::ApplyHelper │ │ │ │ │ │ Dune::Amg::ApplyHelper< 0 > │ │ │ │ │ │ Dune::Amg::CombinedFunctor │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ construction.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00101.html │ │ │ │ │ │ - dune/istl/bvector.hh │ │ │ │ │ │ - dune/istl/operators.hh │ │ │ │ │ │ - dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ - dune/istl/solvercategory.hh │ │ │ │ │ │ + a00161.html │ │ │ │ │ │ + dune/istl/bvector.hh │ │ │ │ │ │ + dune/istl/operators.hh │ │ │ │ │ │ + dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ + dune/istl/solvercategory.hh │ │ │ │ │ │ pinfo.hh │ │ │ │ │ │ Dune::Amg::ConstructionTraits< BlockVector< T, A > > │ │ │ │ │ │ Dune::Amg::ParallelOperatorArgs │ │ │ │ │ │ Dune::Amg::OwnerOverlapCopyCommunicationArgs │ │ │ │ │ │ Dune::Amg::SequentialCommunicationArgs │ │ │ │ │ │ Dune::Amg::ConstructionTraits< OverlappingSchwarzOperator< M, X, Y, C > > │ │ │ │ │ │ Dune::Amg::ConstructionTraits< NonoverlappingSchwarzOperator< M, X, Y, C > > │ │ │ │ │ │ @@ -600,64 +600,64 @@ │ │ │ │ │ │ Dune::Amg::ConstructionTraits< OwnerOverlapCopyCommunication< T1, T2 > > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ dependency.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00098.html │ │ │ │ │ │ - graph.hh │ │ │ │ │ │ - properties.hh │ │ │ │ │ │ + a00182.html │ │ │ │ │ │ + graph.hh │ │ │ │ │ │ + properties.hh │ │ │ │ │ │ Dune::Amg::EdgeProperties │ │ │ │ │ │ Dune::Amg::VertexProperties │ │ │ │ │ │ Dune::Amg::PropertyGraphVertexPropertyMap │ │ │ │ │ │ Dune::PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ fastamg.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00137.html │ │ │ │ │ │ - dune/istl/paamg/smoother.hh │ │ │ │ │ │ - dune/istl/paamg/transfer.hh │ │ │ │ │ │ - dune/istl/paamg/matrixhierarchy.hh │ │ │ │ │ │ - dune/istl/solvers.hh │ │ │ │ │ │ - dune/istl/scalarproducts.hh │ │ │ │ │ │ - dune/istl/superlu.hh │ │ │ │ │ │ - dune/istl/umfpack.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ - dune/istl/io.hh │ │ │ │ │ │ - dune/istl/preconditioners.hh │ │ │ │ │ │ - fastamgsmoother.hh │ │ │ │ │ │ + a00122.html │ │ │ │ │ │ + dune/istl/paamg/smoother.hh │ │ │ │ │ │ + dune/istl/paamg/transfer.hh │ │ │ │ │ │ + dune/istl/paamg/matrixhierarchy.hh │ │ │ │ │ │ + dune/istl/solvers.hh │ │ │ │ │ │ + dune/istl/scalarproducts.hh │ │ │ │ │ │ + dune/istl/superlu.hh │ │ │ │ │ │ + dune/istl/umfpack.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ + dune/istl/io.hh │ │ │ │ │ │ + dune/istl/preconditioners.hh │ │ │ │ │ │ + fastamgsmoother.hh │ │ │ │ │ │ Dune::Amg::FastAMG │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ DIRECTSOLVER │ │ │ │ │ │ - a00137.html │ │ │ │ │ │ + a00122.html │ │ │ │ │ │ a72c0db94af03bbad6ae55a51224a4a4a │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ fastamgsmoother.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00104.html │ │ │ │ │ │ + a00137.html │ │ │ │ │ │ Dune::Amg::GaussSeidelPresmoothDefect │ │ │ │ │ │ Dune::Amg::GaussSeidelPostsmoothDefect │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ galerkin.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00146.html │ │ │ │ │ │ - aggregates.hh │ │ │ │ │ │ + a00125.html │ │ │ │ │ │ + aggregates.hh │ │ │ │ │ │ pinfo.hh │ │ │ │ │ │ Dune::Amg::OverlapVertex │ │ │ │ │ │ Dune::Amg::SparsityBuilder │ │ │ │ │ │ Dune::Amg::BaseGalerkinProduct │ │ │ │ │ │ Dune::Amg::GalerkinProduct │ │ │ │ │ │ Dune::Amg::GalerkinProduct< SequentialInformation > │ │ │ │ │ │ Dune::Amg::BaseConnectivityConstructor │ │ │ │ │ │ @@ -668,32 +668,32 @@ │ │ │ │ │ │ Dune::Amg::DirichletBoundarySetter< SequentialInformation > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ globalaggregates.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00119.html │ │ │ │ │ │ - aggregates.hh │ │ │ │ │ │ + a00131.html │ │ │ │ │ │ + aggregates.hh │ │ │ │ │ │ pinfo.hh │ │ │ │ │ │ Dune::Amg::GlobalAggregatesMap │ │ │ │ │ │ Dune::Amg::GlobalAggregatesMap::Proxy │ │ │ │ │ │ Dune::Amg::AggregatesGatherScatter │ │ │ │ │ │ Dune::Amg::AggregatesPublisher │ │ │ │ │ │ Dune::Amg::AggregatesPublisher< T, O, OwnerOverlapCopyCommunication< T1, T2 > > │ │ │ │ │ │ Dune::Amg::AggregatesPublisher< T, O, SequentialInformation > │ │ │ │ │ │ Dune::CommPolicy< Amg::GlobalAggregatesMap< T, TI > > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ graph.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00149.html │ │ │ │ │ │ - dune/istl/istlexception.hh │ │ │ │ │ │ + a00164.html │ │ │ │ │ │ + dune/istl/istlexception.hh │ │ │ │ │ │ Dune::Amg::MatrixGraph │ │ │ │ │ │ Dune::Amg::MatrixGraph::EdgeIteratorT │ │ │ │ │ │ Dune::Amg::MatrixGraph::VertexIteratorT │ │ │ │ │ │ Dune::Amg::SubGraph │ │ │ │ │ │ Dune::Amg::SubGraph::EdgeIndexMap │ │ │ │ │ │ Dune::Amg::SubGraph::EdgeIterator │ │ │ │ │ │ Dune::Amg::SubGraph::VertexIterator │ │ │ │ │ │ @@ -706,132 +706,132 @@ │ │ │ │ │ │ Dune::Amg::GraphEdgePropertiesSelector │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ graphcreator.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00143.html │ │ │ │ │ │ - graph.hh │ │ │ │ │ │ - dependency.hh │ │ │ │ │ │ + a00173.html │ │ │ │ │ │ + graph.hh │ │ │ │ │ │ + dependency.hh │ │ │ │ │ │ pinfo.hh │ │ │ │ │ │ - dune/istl/operators.hh │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/operators.hh │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ Dune::Amg::PropertiesGraphCreator │ │ │ │ │ │ Dune::Amg::PropertiesGraphCreator< M, SequentialInformation > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ hierarchy.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00152.html │ │ │ │ │ │ - dune/istl/paamg/construction.hh │ │ │ │ │ │ + a00134.html │ │ │ │ │ │ + dune/istl/paamg/construction.hh │ │ │ │ │ │ Dune::Amg::Hierarchy │ │ │ │ │ │ Dune::Amg::Hierarchy::LevelIterator │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ indicescoarsener.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00155.html │ │ │ │ │ │ - renumberer.hh │ │ │ │ │ │ - dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ + a00158.html │ │ │ │ │ │ + renumberer.hh │ │ │ │ │ │ + dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ pinfo.hh │ │ │ │ │ │ Dune::Amg::IndicesCoarsener │ │ │ │ │ │ Dune::Amg::ParallelIndicesCoarsener │ │ │ │ │ │ Dune::Amg::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E > │ │ │ │ │ │ Dune::Amg::IndicesCoarsener< SequentialInformation, E > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ kamg.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00128.html │ │ │ │ │ │ - dune/istl/preconditioners.hh │ │ │ │ │ │ - amg.hh │ │ │ │ │ │ + a00119.html │ │ │ │ │ │ + dune/istl/preconditioners.hh │ │ │ │ │ │ + amg.hh │ │ │ │ │ │ Dune::Amg::KAmgTwoGrid │ │ │ │ │ │ Dune::Amg::KAMG │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ matrixhierarchy.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00116.html │ │ │ │ │ │ - aggregates.hh │ │ │ │ │ │ - graph.hh │ │ │ │ │ │ - galerkin.hh │ │ │ │ │ │ - renumberer.hh │ │ │ │ │ │ - graphcreator.hh │ │ │ │ │ │ - hierarchy.hh │ │ │ │ │ │ - dune/istl/bvector.hh │ │ │ │ │ │ - dune/istl/matrixutils.hh │ │ │ │ │ │ - dune/istl/matrixredistribute.hh │ │ │ │ │ │ - dune/istl/paamg/dependency.hh │ │ │ │ │ │ - dune/istl/paamg/indicescoarsener.hh │ │ │ │ │ │ - dune/istl/paamg/globalaggregates.hh │ │ │ │ │ │ - dune/istl/paamg/construction.hh │ │ │ │ │ │ - dune/istl/paamg/smoother.hh │ │ │ │ │ │ - dune/istl/paamg/transfer.hh │ │ │ │ │ │ + a00155.html │ │ │ │ │ │ + aggregates.hh │ │ │ │ │ │ + graph.hh │ │ │ │ │ │ + galerkin.hh │ │ │ │ │ │ + renumberer.hh │ │ │ │ │ │ + graphcreator.hh │ │ │ │ │ │ + hierarchy.hh │ │ │ │ │ │ + dune/istl/bvector.hh │ │ │ │ │ │ + dune/istl/matrixutils.hh │ │ │ │ │ │ + dune/istl/matrixredistribute.hh │ │ │ │ │ │ + dune/istl/paamg/dependency.hh │ │ │ │ │ │ + dune/istl/paamg/indicescoarsener.hh │ │ │ │ │ │ + dune/istl/paamg/globalaggregates.hh │ │ │ │ │ │ + dune/istl/paamg/construction.hh │ │ │ │ │ │ + dune/istl/paamg/smoother.hh │ │ │ │ │ │ + dune/istl/paamg/transfer.hh │ │ │ │ │ │ Dune::Amg::MatrixHierarchy │ │ │ │ │ │ Dune::Amg::MatrixHierarchy::MatrixStats< Matrix, true >::calc │ │ │ │ │ │ Dune::Amg::CoarsenCriterion │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ parameters.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00095.html │ │ │ │ │ │ + a00152.html │ │ │ │ │ │ Dune::Amg::DependencyParameters │ │ │ │ │ │ Dune::Amg::AggregationParameters │ │ │ │ │ │ Dune::Amg::CoarseningParameters │ │ │ │ │ │ Dune::Amg::Parameters │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ pinfo.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ a00140.html │ │ │ │ │ │ - dune/istl/solvercategory.hh │ │ │ │ │ │ + dune/istl/solvercategory.hh │ │ │ │ │ │ Dune::Amg::SequentialInformation │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ properties.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00134.html │ │ │ │ │ │ + a00176.html │ │ │ │ │ │ Dune::Amg::VertexVisitedTag │ │ │ │ │ │ Dune::Amg::RandomAccessBundledPropertyMap │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ renumberer.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00125.html │ │ │ │ │ │ - aggregates.hh │ │ │ │ │ │ + a00149.html │ │ │ │ │ │ + aggregates.hh │ │ │ │ │ │ Dune::Amg::AggregateRenumberer │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ smoother.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00107.html │ │ │ │ │ │ - dune/istl/paamg/construction.hh │ │ │ │ │ │ - dune/istl/paamg/aggregates.hh │ │ │ │ │ │ - dune/istl/preconditioners.hh │ │ │ │ │ │ - dune/istl/schwarz.hh │ │ │ │ │ │ - dune/istl/novlpschwarz.hh │ │ │ │ │ │ + a00170.html │ │ │ │ │ │ + dune/istl/paamg/construction.hh │ │ │ │ │ │ + dune/istl/paamg/aggregates.hh │ │ │ │ │ │ + dune/istl/preconditioners.hh │ │ │ │ │ │ + dune/istl/schwarz.hh │ │ │ │ │ │ + dune/istl/novlpschwarz.hh │ │ │ │ │ │ Dune::Amg::DefaultSmootherArgs │ │ │ │ │ │ Dune::Amg::SmootherTraits │ │ │ │ │ │ Dune::Amg::SmootherTraits< Richardson< X, Y > > │ │ │ │ │ │ Dune::Amg::SmootherTraits< BlockPreconditioner< X, Y, C, T > > │ │ │ │ │ │ Dune::Amg::SmootherTraits< NonoverlappingBlockPreconditioner< C, T > > │ │ │ │ │ │ Dune::Amg::DefaultConstructionArgs │ │ │ │ │ │ Dune::Amg::ConstructionArgs │ │ │ │ │ │ @@ -857,212 +857,212 @@ │ │ │ │ │ │ Dune::Amg::ConstructionTraits< SeqOverlappingSchwarz< M, X, TM, TS, TA > > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ transfer.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00113.html │ │ │ │ │ │ - dune/istl/bvector.hh │ │ │ │ │ │ - dune/istl/matrixredistribute.hh │ │ │ │ │ │ + a00179.html │ │ │ │ │ │ + dune/istl/bvector.hh │ │ │ │ │ │ + dune/istl/matrixredistribute.hh │ │ │ │ │ │ dune/istl/paamg/pinfo.hh │ │ │ │ │ │ - dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ - dune/istl/paamg/aggregates.hh │ │ │ │ │ │ + dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ + dune/istl/paamg/aggregates.hh │ │ │ │ │ │ Dune::Amg::Transfer │ │ │ │ │ │ Dune::Amg::Transfer< V, V1, SequentialInformation > │ │ │ │ │ │ Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > > │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ twolevelmethod.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/paamg/ │ │ │ │ │ │ - a00158.html │ │ │ │ │ │ - dune/istl/operators.hh │ │ │ │ │ │ - amg.hh │ │ │ │ │ │ - galerkin.hh │ │ │ │ │ │ - dune/istl/solver.hh │ │ │ │ │ │ + a00143.html │ │ │ │ │ │ + dune/istl/operators.hh │ │ │ │ │ │ + amg.hh │ │ │ │ │ │ + galerkin.hh │ │ │ │ │ │ + dune/istl/solver.hh │ │ │ │ │ │ Dune::Amg::LevelTransferPolicy │ │ │ │ │ │ Dune::Amg::AggregationLevelTransferPolicy │ │ │ │ │ │ Dune::Amg::OneStepAMGCoarseSolverPolicy │ │ │ │ │ │ Dune::Amg::TwoLevelMethod │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ preconditioner.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00044.html │ │ │ │ │ │ - solvercategory.hh │ │ │ │ │ │ + a00071.html │ │ │ │ │ │ + solvercategory.hh │ │ │ │ │ │ Dune::Preconditioner │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ preconditioners.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00218.html │ │ │ │ │ │ - dune/istl/solverregistry.hh │ │ │ │ │ │ - preconditioner.hh │ │ │ │ │ │ - solver.hh │ │ │ │ │ │ - solvercategory.hh │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - matrixutils.hh │ │ │ │ │ │ - gsetc.hh │ │ │ │ │ │ - ildl.hh │ │ │ │ │ │ - ilu.hh │ │ │ │ │ │ + a00014.html │ │ │ │ │ │ + dune/istl/solverregistry.hh │ │ │ │ │ │ + preconditioner.hh │ │ │ │ │ │ + solver.hh │ │ │ │ │ │ + solvercategory.hh │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + matrixutils.hh │ │ │ │ │ │ + gsetc.hh │ │ │ │ │ │ + ildl.hh │ │ │ │ │ │ + ilu.hh │ │ │ │ │ │ Dune::InverseOperator2Preconditioner │ │ │ │ │ │ Dune::SeqSSOR │ │ │ │ │ │ Dune::SeqSOR │ │ │ │ │ │ Dune::SeqJac │ │ │ │ │ │ Dune::SeqILU │ │ │ │ │ │ Dune::Richardson │ │ │ │ │ │ Dune::SeqILDL │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ repartition.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00011.html │ │ │ │ │ │ - dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ - dune/istl/paamg/graph.hh │ │ │ │ │ │ + a00101.html │ │ │ │ │ │ + dune/istl/owneroverlapcopy.hh │ │ │ │ │ │ + dune/istl/paamg/graph.hh │ │ │ │ │ │ Dune::RedistributeInterface │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Metis │ │ │ │ │ │ │ │ │ │ │ │ int │ │ │ │ │ │ globalOwnerVertices │ │ │ │ │ │ - a00011.html │ │ │ │ │ │ + a00101.html │ │ │ │ │ │ ae1de746d0ff4ac76e9ddc08c991d0e41 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ scalarproducts.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00026.html │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - solvercategory.hh │ │ │ │ │ │ + a00203.html │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + solvercategory.hh │ │ │ │ │ │ Dune::ScalarProduct │ │ │ │ │ │ Dune::ParallelScalarProduct │ │ │ │ │ │ Dune::SeqScalarProduct │ │ │ │ │ │ Dune::NonoverlappingSchwarzScalarProduct │ │ │ │ │ │ Dune::OverlappingSchwarzScalarProduct │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ scaledidmatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00194.html │ │ │ │ │ │ + a00212.html │ │ │ │ │ │ Dune::ScaledIdentityMatrix │ │ │ │ │ │ Dune::DenseMatrixAssigner< DenseMatrix, ScaledIdentityMatrix< field, N > > │ │ │ │ │ │ Dune::FieldTraits< ScaledIdentityMatrix< K, n > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ schwarz.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00008.html │ │ │ │ │ │ - io.hh │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - vbvector.hh │ │ │ │ │ │ - bcrsmatrix.hh │ │ │ │ │ │ - gsetc.hh │ │ │ │ │ │ - ilu.hh │ │ │ │ │ │ - operators.hh │ │ │ │ │ │ - solvers.hh │ │ │ │ │ │ - preconditioners.hh │ │ │ │ │ │ - scalarproducts.hh │ │ │ │ │ │ - owneroverlapcopy.hh │ │ │ │ │ │ + a00086.html │ │ │ │ │ │ + io.hh │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + vbvector.hh │ │ │ │ │ │ + bcrsmatrix.hh │ │ │ │ │ │ + gsetc.hh │ │ │ │ │ │ + ilu.hh │ │ │ │ │ │ + operators.hh │ │ │ │ │ │ + solvers.hh │ │ │ │ │ │ + preconditioners.hh │ │ │ │ │ │ + scalarproducts.hh │ │ │ │ │ │ + owneroverlapcopy.hh │ │ │ │ │ │ Dune::OverlappingSchwarzOperator │ │ │ │ │ │ Dune::ParSSOR │ │ │ │ │ │ Dune::BlockPreconditioner │ │ │ │ │ │ Dune │ │ │ │ │ │ Dune::Amg │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ solver.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00182.html │ │ │ │ │ │ - solvertype.hh │ │ │ │ │ │ - preconditioner.hh │ │ │ │ │ │ - operators.hh │ │ │ │ │ │ - scalarproducts.hh │ │ │ │ │ │ + a00200.html │ │ │ │ │ │ + solvertype.hh │ │ │ │ │ │ + preconditioner.hh │ │ │ │ │ │ + operators.hh │ │ │ │ │ │ + scalarproducts.hh │ │ │ │ │ │ Dune::InverseOperatorResult │ │ │ │ │ │ Dune::InverseOperator │ │ │ │ │ │ Dune::IterativeSolver │ │ │ │ │ │ Dune::IterativeSolver::Iteration │ │ │ │ │ │ Dune::SolverHelper │ │ │ │ │ │ Dune::SolverHelper::Implementation │ │ │ │ │ │ Dune::SolverHelper::Implementation< true, Dummy > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ solvercategory.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00038.html │ │ │ │ │ │ + a00227.html │ │ │ │ │ │ Dune::SolverCategory │ │ │ │ │ │ Dune::InvalidSolverCategory │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ solverfactory.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00197.html │ │ │ │ │ │ - solverregistry.hh │ │ │ │ │ │ - dune/istl/solver.hh │ │ │ │ │ │ - dune/istl/schwarz.hh │ │ │ │ │ │ - dune/istl/novlpschwarz.hh │ │ │ │ │ │ + a00083.html │ │ │ │ │ │ + solverregistry.hh │ │ │ │ │ │ + dune/istl/solver.hh │ │ │ │ │ │ + dune/istl/schwarz.hh │ │ │ │ │ │ + dune/istl/novlpschwarz.hh │ │ │ │ │ │ Dune::SolverFactory │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ solverregistry.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00056.html │ │ │ │ │ │ - dune/istl/common/registry.hh │ │ │ │ │ │ - dune/istl/preconditioner.hh │ │ │ │ │ │ - dune/istl/solver.hh │ │ │ │ │ │ + a00218.html │ │ │ │ │ │ + dune/istl/common/registry.hh │ │ │ │ │ │ + dune/istl/preconditioner.hh │ │ │ │ │ │ + dune/istl/solver.hh │ │ │ │ │ │ Dune::UnsupportedType │ │ │ │ │ │ Dune::InvalidSolverFactoryConfiguration │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ DUNE_REGISTER_DIRECT_SOLVER │ │ │ │ │ │ - a00056.html │ │ │ │ │ │ + a00218.html │ │ │ │ │ │ a3ae3b642fa70a9ad21350f7f90488169 │ │ │ │ │ │ (name,...) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ DUNE_REGISTER_PRECONDITIONER │ │ │ │ │ │ - a00056.html │ │ │ │ │ │ + a00218.html │ │ │ │ │ │ aabca0a60c41408685e4ef6fa3903dcf0 │ │ │ │ │ │ (name,...) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ DUNE_REGISTER_ITERATIVE_SOLVER │ │ │ │ │ │ - a00056.html │ │ │ │ │ │ + a00218.html │ │ │ │ │ │ a2e50053eee47875dee3ab97cd6ab4278 │ │ │ │ │ │ (name,...) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ solvers.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00200.html │ │ │ │ │ │ - dune/istl/allocator.hh │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ - dune/istl/eigenvalue/arpackpp.hh │ │ │ │ │ │ - dune/istl/istlexception.hh │ │ │ │ │ │ - dune/istl/operators.hh │ │ │ │ │ │ - dune/istl/preconditioner.hh │ │ │ │ │ │ - dune/istl/scalarproducts.hh │ │ │ │ │ │ - dune/istl/solver.hh │ │ │ │ │ │ - dune/istl/solverregistry.hh │ │ │ │ │ │ + a00059.html │ │ │ │ │ │ + dune/istl/allocator.hh │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/eigenvalue/arpackpp.hh │ │ │ │ │ │ + dune/istl/istlexception.hh │ │ │ │ │ │ + dune/istl/operators.hh │ │ │ │ │ │ + dune/istl/preconditioner.hh │ │ │ │ │ │ + dune/istl/scalarproducts.hh │ │ │ │ │ │ + dune/istl/solver.hh │ │ │ │ │ │ + dune/istl/solverregistry.hh │ │ │ │ │ │ Dune::LoopSolver │ │ │ │ │ │ Dune::GradientSolver │ │ │ │ │ │ Dune::CGSolver │ │ │ │ │ │ Dune::BiCGSTABSolver │ │ │ │ │ │ Dune::MINRESSolver │ │ │ │ │ │ Dune::RestartedGMResSolver │ │ │ │ │ │ Dune::RestartedFlexibleGMResSolver │ │ │ │ │ │ @@ -1070,48 +1070,48 @@ │ │ │ │ │ │ Dune::RestartedFCGSolver │ │ │ │ │ │ Dune::CompleteFCGSolver │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ solvertype.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00089.html │ │ │ │ │ │ + a00074.html │ │ │ │ │ │ Dune::IsDirectSolver │ │ │ │ │ │ Dune::StoresColumnCompressed │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ spqr.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00071.html │ │ │ │ │ │ - dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ - dune/istl/solvers.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ - dune/istl/solverfactory.hh │ │ │ │ │ │ + a00065.html │ │ │ │ │ │ + dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ + dune/istl/solvers.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ + dune/istl/solverfactory.hh │ │ │ │ │ │ Dune::SPQR │ │ │ │ │ │ Dune::SPQR< BCRSMatrix< FieldMatrix< T, n, m >, A > > │ │ │ │ │ │ Dune::IsDirectSolver< SPQR< BCRSMatrix< T, A > > > │ │ │ │ │ │ Dune::StoresColumnCompressed< SPQR< BCRSMatrix< T, A > > > │ │ │ │ │ │ Dune::SPQRCreator │ │ │ │ │ │ Dune::SPQRCreator::isValidBlock │ │ │ │ │ │ Dune::SPQRCreator::isValidBlock< FieldVector< double, 1 > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ superlu.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00227.html │ │ │ │ │ │ - superlufunctions.hh │ │ │ │ │ │ - solvers.hh │ │ │ │ │ │ - supermatrix.hh │ │ │ │ │ │ - bcrsmatrix.hh │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ - dune/istl/solverfactory.hh │ │ │ │ │ │ + a00026.html │ │ │ │ │ │ + superlufunctions.hh │ │ │ │ │ │ + solvers.hh │ │ │ │ │ │ + supermatrix.hh │ │ │ │ │ │ + bcrsmatrix.hh │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ + dune/istl/solverfactory.hh │ │ │ │ │ │ Dune::SuperLUSolveChooser │ │ │ │ │ │ Dune::SuperLUDenseMatChooser │ │ │ │ │ │ Dune::SuperLUQueryChooser │ │ │ │ │ │ Dune::QuerySpaceChooser │ │ │ │ │ │ Dune::SuperLU │ │ │ │ │ │ Dune::IsDirectSolver< SuperLU< BCRSMatrix< T, A > > > │ │ │ │ │ │ Dune::StoresColumnCompressed< SuperLU< BCRSMatrix< T, A > > > │ │ │ │ │ │ @@ -1122,31 +1122,31 @@ │ │ │ │ │ │ Dune::SuperLUCreator::isValidBlock< double > │ │ │ │ │ │ Dune::SuperLUCreator::isValidBlock< std::complex< double > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ superlufunctions.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00092.html │ │ │ │ │ │ + a00017.html │ │ │ │ │ │ │ │ │ │ │ │ #define │ │ │ │ │ │ int_t │ │ │ │ │ │ - a00092.html │ │ │ │ │ │ + a00017.html │ │ │ │ │ │ adae0e0955f67a0812302aab3d89a7cb3 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ supermatrix.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00059.html │ │ │ │ │ │ - bcrsmatrix.hh │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ - superlufunctions.hh │ │ │ │ │ │ + a00215.html │ │ │ │ │ │ + bcrsmatrix.hh │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ + superlufunctions.hh │ │ │ │ │ │ Dune::SuperMatrixCreateSparseChooser │ │ │ │ │ │ Dune::SuperMatrixPrinter │ │ │ │ │ │ Dune::BaseGetSuperLUType │ │ │ │ │ │ Dune::GetSuperLUType │ │ │ │ │ │ Dune::GetSuperLUType< double > │ │ │ │ │ │ Dune::GetSuperLUType< float > │ │ │ │ │ │ Dune::GetSuperLUType< std::complex< double > > │ │ │ │ │ │ @@ -1156,38 +1156,38 @@ │ │ │ │ │ │ Dune::SuperLUMatrix< BCRSMatrix< B, TA > > │ │ │ │ │ │ Dune::SuperMatrixInitializer< BCRSMatrix< B, A > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ umfpack.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00209.html │ │ │ │ │ │ - dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ - dune/istl/bcrsmatrix.hh │ │ │ │ │ │ - dune/istl/solvers.hh │ │ │ │ │ │ - dune/istl/solvertype.hh │ │ │ │ │ │ - dune/istl/solverfactory.hh │ │ │ │ │ │ + a00191.html │ │ │ │ │ │ + dune/istl/bccsmatrixinitializer.hh │ │ │ │ │ │ + dune/istl/bcrsmatrix.hh │ │ │ │ │ │ + dune/istl/solvers.hh │ │ │ │ │ │ + dune/istl/solvertype.hh │ │ │ │ │ │ + dune/istl/solverfactory.hh │ │ │ │ │ │ Dune::UMFPackMethodChooser │ │ │ │ │ │ Dune::UMFPackMethodChooser< double > │ │ │ │ │ │ Dune::UMFPackMethodChooser< std::complex< double > > │ │ │ │ │ │ Dune::UMFPack │ │ │ │ │ │ Dune::IsDirectSolver< UMFPack< BCRSMatrix< FieldMatrix< T, n, m >, A > > > │ │ │ │ │ │ Dune::StoresColumnCompressed< UMFPack< BCRSMatrix< T, A > > > │ │ │ │ │ │ Dune::UMFPackCreator │ │ │ │ │ │ Dune::UMFPackCreator::isValidBlock │ │ │ │ │ │ Dune::UMFPackCreator::isValidBlock< B, std::enable_if_t< std::is_same< typename FieldTraits< B >::real_type, double >::value > > │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ vbvector.hh │ │ │ │ │ │ /build/reproducible-path/dune-istl-2.9.0/dune/istl/ │ │ │ │ │ │ - a00185.html │ │ │ │ │ │ - istlexception.hh │ │ │ │ │ │ - bvector.hh │ │ │ │ │ │ - dune/istl/blocklevel.hh │ │ │ │ │ │ + a00116.html │ │ │ │ │ │ + istlexception.hh │ │ │ │ │ │ + bvector.hh │ │ │ │ │ │ + dune/istl/blocklevel.hh │ │ │ │ │ │ Dune::VariableBlockVector │ │ │ │ │ │ Dune::VariableBlockVector::CreateIterator │ │ │ │ │ │ Dune::VariableBlockVector::RealIterator │ │ │ │ │ │ Dune │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ Dune::AdderSelector │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/files.html │ │ │ │ @@ -75,90 +75,90 @@ │ │ │ │
Here is a list of all files with brief descriptions:
│ │ │ │
[detail level 1234]
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
  doc
 doxygen
  dune
  istl
  common
 counter.hh
 registry.hh
 counter.hh
 registry.hh
  eigenvalue
 arpackpp.hh
 poweriteration.hh
 arpackpp.hh
 poweriteration.hh
  paamg
 aggregates.hhProvides classes for the Coloring process of AMG
 amg.hhThe AMG preconditioner
 combinedfunctor.hh
 construction.hhHelper classes for the construction of classes without empty constructor
 dependency.hhProvides classes for initializing the link attributes of a matrix graph
 fastamg.hhA 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
 fastamgsmoother.hh
 galerkin.hhProvides a class for building the galerkin product based on a aggregation scheme
 globalaggregates.hhProvdes class for identifying aggregates globally
 graph.hhProvides classes for building the matrix graph
 graphcreator.hh
 hierarchy.hhProvides a classes representing the hierarchies in AMG
 indicescoarsener.hhProvides a class for building the index set and remote indices on the coarse level
 kamg.hhProvides an algebraic multigrid using a Krylov cycle
 matrixhierarchy.hhProvides a classes representing the hierarchies in AMG
 parameters.hhParameter classes for customizing AMG
 aggregates.hhProvides classes for the Coloring process of AMG
 amg.hhThe AMG preconditioner
 combinedfunctor.hh
 construction.hhHelper classes for the construction of classes without empty constructor
 dependency.hhProvides classes for initializing the link attributes of a matrix graph
 fastamg.hhA 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
 fastamgsmoother.hh
 galerkin.hhProvides a class for building the galerkin product based on a aggregation scheme
 globalaggregates.hhProvdes class for identifying aggregates globally
 graph.hhProvides classes for building the matrix graph
 graphcreator.hh
 hierarchy.hhProvides a classes representing the hierarchies in AMG
 indicescoarsener.hhProvides a class for building the index set and remote indices on the coarse level
 kamg.hhProvides an algebraic multigrid using a Krylov cycle
 matrixhierarchy.hhProvides a classes representing the hierarchies in AMG
 parameters.hhParameter classes for customizing AMG
 pinfo.hh
 properties.hhProvides classes for handling internal properties in a graph
 renumberer.hh
 smoother.hhClasses for the generic construction and application of the smoothers
 transfer.hhProlongation and restriction for amg
 twolevelmethod.hhAlgebraic twolevel methods
 allocator.hh
 basearray.hhImplements several basic array containers
 bccsmatrix.hh
 bccsmatrixinitializer.hh
 bcrsmatrix.hhImplementation of the BCRSMatrix class
 bdmatrix.hhImplementation of the BDMatrix class
 blocklevel.hhHelper functions for determining the vector/matrix block level
 btdmatrix.hhImplementation of the BTDMatrix class
 bvector.hhThis file implements a vector space as a tensor product of a given vector space. The number of components can be given at run-time
 cholmod.hh
 foreach.hh
 gsetc.hhSimple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way
 ildl.hhIncomplete LDL decomposition
 ilu.hhThe incomplete LU factorization kernels
 ilusubdomainsolver.hhVarious local subdomain solvers based on ILU for SeqOverlappingSchwarz
 io.hhSome generic functions for pretty printing vectors and matrices
 istlexception.hh
 ldl.hhClass for using LDL with ISTL matrices
 matrix.hhA dynamic dense block matrix class
 matrixindexset.hh
 matrixmarket.hhProvides classes for reading and writing MatrixMarket Files with an extension for parallel matrices
 matrixmatrix.hhFunctions for sparse matrix matrix multiplication
 matrixredistribute.hhFunctionality for redistributing a sparse matrix
 matrixutils.hhSome handy generic functions for ISTL matrices
 multitypeblockmatrix.hh
 multitypeblockvector.hh
 novlpschwarz.hh
 operators.hhDefine general, extensible interface for operators. The available implementation wraps a matrix
 overlappingschwarz.hhContains one level overlapping Schwarz preconditioners
 owneroverlapcopy.hhClasses providing communication interfaces for overlapping Schwarz methods
 preconditioner.hh
 preconditioners.hhDefine general preconditioner interface
 repartition.hhFunctionality for redistributing a parallel index set using graph partitioning
 scalarproducts.hhDefine base class for scalar product and norm
 scaledidmatrix.hhThis file implements a quadratic matrix of fixed size which is a multiple of the identity
 schwarz.hh
 solver.hhDefine general, extensible interface for inverse operators
 solvercategory.hh
 solverfactory.hh
 solverregistry.hh
 solvers.hhImplementations of the inverse operator interface
 solvertype.hhTemplates characterizing the type of a solver
 spqr.hhClass for using SPQR with ISTL matrices
 superlu.hhClasses for using SuperLU with ISTL matrices
 superlufunctions.hh
 supermatrix.hh
 umfpack.hhClasses for using UMFPack with ISTL matrices
 vbvector.hh???
 properties.hhProvides classes for handling internal properties in a graph
 renumberer.hh
 smoother.hhClasses for the generic construction and application of the smoothers
 transfer.hhProlongation and restriction for amg
 twolevelmethod.hhAlgebraic twolevel methods
 allocator.hh
 basearray.hhImplements several basic array containers
 bccsmatrix.hh
 bccsmatrixinitializer.hh
 bcrsmatrix.hhImplementation of the BCRSMatrix class
 bdmatrix.hhImplementation of the BDMatrix class
 blocklevel.hhHelper functions for determining the vector/matrix block level
 btdmatrix.hhImplementation of the BTDMatrix class
 bvector.hhThis file implements a vector space as a tensor product of a given vector space. The number of components can be given at run-time
 cholmod.hh
 foreach.hh
 gsetc.hhSimple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way
 ildl.hhIncomplete LDL decomposition
 ilu.hhThe incomplete LU factorization kernels
 ilusubdomainsolver.hhVarious local subdomain solvers based on ILU for SeqOverlappingSchwarz
 io.hhSome generic functions for pretty printing vectors and matrices
 istlexception.hh
 ldl.hhClass for using LDL with ISTL matrices
 matrix.hhA dynamic dense block matrix class
 matrixindexset.hh
 matrixmarket.hhProvides classes for reading and writing MatrixMarket Files with an extension for parallel matrices
 matrixmatrix.hhFunctions for sparse matrix matrix multiplication
 matrixredistribute.hhFunctionality for redistributing a sparse matrix
 matrixutils.hhSome handy generic functions for ISTL matrices
 multitypeblockmatrix.hh
 multitypeblockvector.hh
 novlpschwarz.hh
 operators.hhDefine general, extensible interface for operators. The available implementation wraps a matrix
 overlappingschwarz.hhContains one level overlapping Schwarz preconditioners
 owneroverlapcopy.hhClasses providing communication interfaces for overlapping Schwarz methods
 preconditioner.hh
 preconditioners.hhDefine general preconditioner interface
 repartition.hhFunctionality for redistributing a parallel index set using graph partitioning
 scalarproducts.hhDefine base class for scalar product and norm
 scaledidmatrix.hhThis file implements a quadratic matrix of fixed size which is a multiple of the identity
 schwarz.hh
 solver.hhDefine general, extensible interface for inverse operators
 solvercategory.hh
 solverfactory.hh
 solverregistry.hh
 solvers.hhImplementations of the inverse operator interface
 solvertype.hhTemplates characterizing the type of a solver
 spqr.hhClass for using SPQR with ISTL matrices
 superlu.hhClasses for using SuperLU with ISTL matrices
 superlufunctions.hh
 supermatrix.hh
 umfpack.hhClasses for using UMFPack with ISTL matrices
 vbvector.hh???
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/globals.html │ │ │ │ @@ -67,26 +67,26 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Here is a list of all file members with links to the files they belong to:
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/globals_defs.html │ │ │ │ @@ -66,22 +66,22 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Here is a list of all macros with links to the files they belong to:
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/globals_func.html │ │ │ │ @@ -66,15 +66,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Here is a list of all functions with links to the files they belong to:
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/globals_vars.html │ │ │ │ @@ -67,17 +67,17 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
Here is a list of all variables with links to the files they belong to:
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │